-
Notifications
You must be signed in to change notification settings - Fork 589
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 RedelegateValidatorSet
message
#3599
Conversation
// A redelegation object is created every time a redelegation occurs. To prevent "redelegation hopping" redelegations may not occur under the situation that: | ||
// 1. the (re)delegator already has another immature redelegation in progress with a destination to a validator (let's call it Validator X) | ||
// 2. the (re)delegator is attempting to create a new redelegation where the source validator for this new redelegation is Validator X | ||
func (k Keeper) PreformRedelegation(ctx sdk.Context, delegator sdk.AccAddress, existingSet types.ValidatorSetPreferences, newSet []types.ValidatorPreference) error { |
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.
Notes for reviewers: Best way to follow with this algorithm would be to check README.MD where i have made sure the pseudocode comments matches with the code 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.
The algo looks correct to me, but I think in a follow-up PR we can simplify / break up the logic a bit.
e.g. make getExistingValset -> getExistingDelegations
its own function
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.
Love the comments throughout the module!
fb4bad2
to
a5aa909
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.
Previous comments were addressed, 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.
Core redelegation loop LGTM, though I think we should simplify the code a bit in a subsequent PR
Part of : #2579
What is the purpose of the change
Introduce Redelegation logic to validator set preference. User now will be able to redelegate from a specific validator to a new set of validator. We are doing this by executing 2 messages;
Brief Changelog
n/a
Testing and Verifying
Added msg_server_test.go for TestRedelegateValidatorSet
example output:
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? (yes / no)x/<module>/spec/
) / Osmosis docs repo / not documented)