-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fixes: rebalance decrease amount calculation, validator_lamport_balance initialization, tweaks to keeper #72
Conversation
16a0751
to
1e703e2
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.
A couple of questions needed for clarification
@@ -245,6 +252,7 @@ impl UnstakeState { | |||
// either to the target or to the previous balance before the deposit, whichever is lower in terms of total lamports unstaked | |||
if current_lamports > state.validator_lamport_balances[index] | |||
&& self.stake_deposit_unstake_total < self.stake_deposit_unstake_cap | |||
&& state.validator_lamport_balances[index] != LAMPORT_BALANCE_DEFAULT |
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.
Do we want the same check for increase_stake_calculation?
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.
the increase_stake_calculation algo here doesn't interact with this field so we're safe
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.
10-4
@@ -967,15 +967,6 @@ impl StewardState { | |||
RebalanceType::None | |||
}; | |||
|
|||
msg!("Reserve lamports after adjustment: {}", reserve_lamports); |
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.
Too much CU?
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.
was causing local tests to fail since it was calling msg! outside of context, + think we're okay to remove these now since we have the emits
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.
10-4
self.validator_lamport_balances[index] = self.validator_lamport_balances[index] | ||
.checked_add(amount) | ||
.ok_or(StewardError::ArithmeticError)?; | ||
if self.validator_lamport_balances[index] != LAMPORT_BALANCE_DEFAULT { |
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.
Do we want this same check for Decrease?
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.
yep, good catch
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.
lgtm
Changes:
rebalance
instruction when there are no activating or deactivating lamports and then continue with the working process. Adds a sentinel value and checks to skip modifying it when sentinel is present.