-
Notifications
You must be signed in to change notification settings - Fork 607
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
Add superfluid unbond partial amount #4107
Conversation
Thanks for the PR. Can you please add a changelog entry for this? |
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.
Thanks for the PR! Looks nice 🌮 Left some comments and questions I had + requested some more test cases and checks.
// setup superfluid delegations | ||
_, intermediaryAccs, locks := suite.setupSuperfluidDelegations(valAddrs, []superfluidDelegation{{0, 0, 0, lockAmount}}, denoms) | ||
suite.checkIntermediaryAccountDelegations(intermediaryAccs) | ||
suite.Require().True(len(locks) > 0) |
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.
isn't lock length always = 1 ? If so, can we put it as a variable and then remove the for loop below/
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.
Yes I can. Alternatively would you like me to test with multiple locks?
@t4sk Would it be possible to re-assign me as reviewer once you think the PR is ready for a second round of review? |
@mattverse It's ready for another round of review. But I don't have write access to assign reviewers |
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.
Once final test case requested has been added, lgtm. Thanks for resolving all the feedbacks in such good quality!
x/superfluid/keeper/stake_test.go
Outdated
unlockAmount sdk.Int | ||
expectErr bool | ||
splitLockId bool | ||
undelegate bool |
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.
undelegate bool | |
undelegating bool |
x/superfluid/keeper/stake_test.go
Outdated
unlockAmount: sdk.NewInt(1), | ||
expectErr: true, | ||
splitLockId: false, | ||
undelegate: true, |
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.
undelegate: true, | |
undelegating: true, |
x/superfluid/keeper/stake_test.go
Outdated
unbond: false, | ||
}, | ||
{ | ||
name: "undelegate and unbond an undelegated lock", |
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.
name: "undelegate and unbond an undelegated lock", | |
name: "undelegate and unbond an undelegating lock", |
suite.Require().Equal(newLock.Coins[0].Amount, tc.unlockAmount) | ||
|
||
// check original synthetic lock | ||
stakingDenom := keeper.StakingSyntheticDenom(lock.Coins[0].Denom, valAddr) |
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.
Can we also add check for total supply of stake denom to make sure that we have burnt the correct amount?
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.
I've added code to check the total supply of OSMO. Please let me know if you were thinking of something else
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.
Thank you @t4sk for the PR, i left few comments! 🐙
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.
Awesome! LGTM 🌮
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! 💯
Merging this since I can see 2 approvals. Thanks everyone! |
What is the purpose of the change
Implement partial unbonding from superfluid staking
Here is an overview of how
SuperfluidUndelegateAndUnbondLock
works.If the amount to unlock is equal to the underlying locked amount, this function will behave the same as
SuperfluidUndelegate
followed bySuperfluidUnbondLock
. Otherwise this function will create a new synthetic unlocking lock from the newly created underlying lock.Related links
#4059 (comment)
#3830
Brief Changelog
SuperfluidUndelegateAndUnbondLock
Testing and Verifying
This change added tests and can be verified as follows:
(example:)
x/superfluid/keeper/stake_test.go
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? (yes)