-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: allow withdrawing without cleaning #502
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
if let Some(position) = self.read_position(i)? { | ||
if position.target_with_parameters.get_target() == *target | ||
&& position.get_current_position(current_epoch, unlocking_duration)? | ||
!= PositionState::UNLOCKED |
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.
ignore unlocked here
@@ -1385,6 +1409,13 @@ pub mod tests { | |||
{ | |||
return false; | |||
} | |||
|
|||
if (target == &TargetWithParameters::Voting && curr_state == &PositionState::UNLOCKED) |
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.
this tests that slashing ignores unlocked governance positions, the new behavior
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 need brackets here?
@@ -81,6 +81,9 @@ describe("fills a stake account with positions", async () => { | |||
) { | |||
await provider.sendAndConfirm(transaction, [], {}); | |||
transaction = new Transaction(); | |||
transaction.instructions.push( | |||
ComputeBudgetProgram.setComputeUnitLimit({ units: 1_400_000 }) |
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.
this PR made me find this bug, previously we were just requesting compute units in the first tx
@@ -351,7 +371,9 @@ impl<'a> DynamicPositionArray<'a> { | |||
let current_state = | |||
position.get_current_position(current_epoch, unlocking_duration)?; | |||
|
|||
if position.target_with_parameters == TargetWithParameters::Voting { | |||
if position.target_with_parameters == TargetWithParameters::Voting | |||
&& (current_state != PositionState::UNLOCKED) |
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 need brackets here ()
?
We can withdraw without cleaning.
For that I just need to update
validate
to ignore Unlocked positions.We also need to update slashing since governance exposure no longer counts unlocked positions, so we ignore unlocked positions when we adjust positions in
slash_account