-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/positions2 WIP #6
Conversation
…governance into feature/positions2
Some more meat on the menu: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool lots of good stuff in here. Left you a bunch of comments. I'd like to look at this again once you've addressed them.
Also, since this PR is so large, please make sure you don't break the commit history as you respond to the comments. (As long as you don't git push -f
, the commit history should be fine.)
@@ -0,0 +1 @@ | |||
*.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe ignore the entire keypairs/
directory? This directory only exists for testing purposes right?
}); | ||
|
||
it("alice and bob get staking accounts", async () => { | ||
for (let user of [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(comment for the future) would be nice to make a typescript API for the staking program to wrap up these transactions into easy-to-use methods.
Definitely do not make this change as part of this PR.
if (err instanceof ProgramError) { | ||
assert.equal( | ||
parseErrorMessage(err, idlErrors), | ||
error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor thing: this would be a nicer method to use if you made error a regex and had this check do a match against the string. This would help if there were error messages that got populated with parameters.
❌ Deploy Preview for competent-kirch-7c1110 failed. 🔨 Explore the source changes: a4e0829 🔍 Inspect the deploy log: https://app.netlify.com/sites/competent-kirch-7c1110/deploys/6226e2ffb6e85000073e1c0f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nicely done
for i in 0..MAX_POSITIONS { | ||
if stake_account_positions.positions[i].is_some() { | ||
let position = stake_account_positions.positions[i].unwrap(); | ||
match position.get_current_position(current_epoch, config.unlocking_duration)? { | ||
PositionState::LOCKED => { | ||
if position.product.is_none() { | ||
voter_weight += position.amount; | ||
if position.product.is_none() && position.publisher.is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may want to add a function like position.is_voting()
for this particular check, because you're going to use it in a bunch of places.
* w <= floor((RISK_THRESH * vested balance - sum exposure_i)/RISK_THRESH) | ||
* which implies the actual inequality. | ||
* The maximum value for w is then just the minimum of all the RHS of all the inequalities. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 excellent comment
Goals :