-
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
[ValSet-Pref] Add Msgs for Delegate and Undelegate Tokens #3260
Conversation
why? not that I have any issue with it, it seems cool, but curious on thinking here |
Hi @faddat! This feature can technically be done off-chain today with front-ends, having preference lists stored locally, but Having this on chain:
|
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.
Looking good so far!
Main logic looks lgtm, left some minor comments for the first round of review
expectedShares []sdk.Dec | ||
expectPass bool | ||
valSetExists 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.
would it be possible to add a test case that deals delegating coins that wouldn't be calculated perfectly under the ratio and test the rounding conditions? Ex) 739 or similar
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.
added it here 45964da
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.
cannot see it due to force push :( , can you point me to the specific test case?
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.
Yup, i changed the set-validator weights to have upto 3 decimal places https://github.com/osmosis-labs/osmosis/pull/3260/files#diff-102acff6e2fd0c8c3b2b95afe0c166f91100a1dcbc1204c40a0ff981823504a3R31
expectPass bool | ||
valSetExists 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.
Ditto with the comment above regarding jailed validator. Consider adding a test case on it as well
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.
hmm not sure how i can create a test scenario where a validator is jailed and user tries to delegate to that validator 🤔
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.
So i did some digging around and found out that "It is possible to delegate to a jailed validator, the only difference being it will not be added to the power index until it is unjailed" therefore, i dont think we can add a very indepth test
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.
how about unbonded or unbonding validators?
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.
Here's what i found;
- unbonded: Validators will be removed from active set but still can receive delegations
- unbonding: Validators leaves active set either through slashing, jailing etc, all delegations can be unbonded but will have to wait for unbonding time to exhaust
I am hoping to test all these in either e2e or testnet
Thank you @mattverse and @czarcas7ic for the feedback. Everything should be resolved now :)) |
45964da
to
7c6ed74
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.
This LGTM, well done! Once we get another review here and this gets merged, please ensure to test this on a localosmosis instance with all the applicable CLI commands you used. This way we can easily test come next upgrade!
fac3784
to
06f64dc
Compare
Thank you @czarcas7ic addressed all you comments and added more test coverage still looking on tombstoned validators and ways to approach them |
@stackman27 that comment was more to add it to the TODO, and not a blocker for this PR IMO |
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!
Left some minor comments I would love to see before merging!
x/twap/api.go
Outdated
@@ -58,17 +93,16 @@ func (k Keeper) GetArithmeticTwap( | |||
if err != nil { | |||
return sdk.Dec{}, err | |||
} | |||
return computeArithmeticTwap(startRecord, endRecord, quoteAssetDenom) | |||
return strategy.computeTwap(startRecord, endRecord, quoteAssetDenom) |
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.
doesnt this change to getTwapToNow
anyways if endTime.Equal(ctx.BlockTime())
?
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.
oops this change wasn't supposed to be in this PR, but endTime = BlockTime logic is covered in line 84. We can follow up this conversation in this PR #3529
expectPass bool | ||
valSetExists 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.
how about unbonded or unbonding validators?
expectedShares []sdk.Dec | ||
expectPass bool | ||
valSetExists 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.
cannot see it due to force push :( , can you point me to the specific test case?
06f64dc
to
d2da989
Compare
d2da989
to
69b24a8
Compare
Merging due to approvals, and this PR not being merged blocking things |
Part of : #2579
What is the purpose of the change
This message
MsgDelegateToValidatorSet
allows delegators to delegate to a set of defined validator set. For ex: delegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} our delegate logic would attempt to delegate 5osmo to A , 2osmo to B, 3osmo to CBrief Changelog
n/a
Testing and Verifying
Added tests for TestDelegateToValidatorSet
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? (yes / no)x/<module>/spec/
) / Osmosis docs repo / not documented)