-
Notifications
You must be signed in to change notification settings - Fork 608
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] Added Proto Definitions and spec #2745
Conversation
d992ac6
to
1a9abb4
Compare
x/validator-preference/README.md
Outdated
|
||
UnStaking Calculation | ||
|
||
- The user provides an amount to unstake and our `MsgUnStakeFromValidatorSet` divides the amount based on validator weight distribution. |
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.
What if I stake with set A, then I change my preferences to different proportions (set B) and try to unstake? Is there some kind of history of preferences to make sure that we don't attempt to unstake more or fewer tokens based on the changed preference list?
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 thats interesting. Are you recommending something like this approach?
UserA -> {ValA: 0.5, ValB: 0.2, ValC: 0.3}
User A stakes: 100osmo {ValA-> 50osmo, ValB-> 20osmo, ValC -> 30osmo}
** Store the history of {weight, amount} **
UserA modifies the weight -> {ValA: 0.1, ValB: 0.1, ValC: 0.8}
** Internally check if this modification is possible **
** Only allow weight modification if the newAmountToStake < oldAmountStaked which can be calculated by weight*TotalAmount **
UserA unstakes 50osmo -> {ValA -> 5osmo, ValB -> 10osmo, ValC -> 40osmo}
**Result in error because ValC only has 30tokens staked**
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.
On another look, I think I just misinterpreted what is happening here.
I guess when userA changes their preferences list, the unstaking from the old set and restaking to a new set is going to happen behind the scenes. That way, the problem I originally mentioned wouldn't happen. It might be worth specifying in the doc that changing the preferences list implies that we unstake from the old + restake to a new set.
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.
aah i see. Yea i believe this is a much cleaner approach. I will mention it :))
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'm going to leave this unresolved, so that we can get more feedback from other 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.
So this spec doesn't discuss the case of what is done when a user does some 'direct' undelegation.
So I set valset { A: .5, B: .2, C: .3 }, and suppose I stake 100 to it, to get:
A: 50, B: 20, C: 30
Then I directly undelegate 20 from B. (So I'm at A:50, C:30)
If I try to valset undelegate 80, what should happen. Options that I think are fine:
- valset Undelegate fails
- valset Undelegate Takes {arbitrary distribution across valset validators if theres been direct modification that is unsatisfiable}
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 find this generally not that concerning, since theres multiple direct user actions to fix 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.
hmm i didn't really think about "direct unstake" and "val-set undelegate" colliding. Should i look into updating "validator-set" state based on the txs from "direct undelegate" and vice versa?
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.
Nice work! The implementation seems pretty straight foward!
Left some comments, please take a look 🌮
Thank you @p0mvn and @mattverse for the feedback! Resolved pretty much all the suggestions (:<. . 🌮 |
} | ||
|
||
// MsgCreateValidatorSetPreference is a list that holds validator-set. | ||
message MsgCreateValidatorSetPreference { |
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.
message MsgCreateValidatorSetPreference { | |
message MsgSetValidatorSetPreference { |
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 think we just make 1 message, SetValidatorSetPreference
wdyt?
(As opposed to create + update)
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 agree with @ValarDragon here
// to modify the weights and the validator. | ||
message ValidatorSetPreferences { | ||
// delegator is the address of the user who created the validator-set. | ||
string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; |
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.
Why is this in the struct? We should just be keying using the delegator 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.
Changes LGTM Once @ValarDragon's suggestion of changing message name get's changed!
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. I think folks left some good feedback that looks like it's being addressed, so approving 👍
} | ||
|
||
// MsgCreateValidatorSetPreference is a list that holds validator-set. | ||
message MsgCreateValidatorSetPreference { |
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 agree with @ValarDragon here
687e176
to
12d13c6
Compare
Hi @ValarDragon, all comments resolved! |
Part of : #2579
This PR definies the proto messages to build validator-set-preference. There are 3 tx messages;
Brief Changelog
n/a
Testing and Verifying
n/a
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? (yes / no)x/<module>/spec/
) / Osmosis docs repo / not documented)