-
Notifications
You must be signed in to change notification settings - Fork 70
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
Changing add stake operation #3196
base: albatross
Are you sure you want to change the base?
Conversation
e62eccb
to
94256d9
Compare
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.
Looks good to me
// If we are delegating to a validator, we need to update it. | ||
if let Some(validator_address) = &staker.delegation { | ||
// Check that the delegation is still valid, i.e. the validator hasn't been deleted. | ||
store.expect_validator(validator_address)?; |
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.
There might be a problem with the ordering. We usually want to do changes only after all potentially failing conditions are checked.
In practice, I don't think it is a problem, as all previous changes are in the staker and that one needs to be put explicitly back.
When |
It doesn't reset it. Also, while discussing with @ii-cruz , one thing that is missing is a version gate for the upgrade. |
What's in this pull request?
add_stake
operation. Add stake transactions have an intrinsic check for itsvalue => min_stake
and thus are rejected before they can break the invariant.add_stake
assumes that the staker wants to have auto-staking as long as there is active stake. Once no active stake exists, the funds are added to whatever is the biggest balance between inactive and retired.Pull request checklist
clippy
andrustfmt
warnings.