Skip to content
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] Allow migration of x/lockup uosmo to staking to a valset preference #3810

Merged
merged 5 commits into from
Jan 19, 2023

Conversation

stackman27
Copy link
Contributor

Closes: #3703
Part of: Part of : #2579

What is the purpose of the change

We should add a new message in valset preference which allows breaking of a bonded lockup (by ID) of osmo, of length <= 2 weeks, add takes all that osmo and stakes according to your current validator set preference. If you don't have a valset preference, return an error. (Noting that there is an implicit valset preference if you've already staked)

Brief Changelog

n/a

Testing and Verifying

added tests for MsgDelegateBondedTokens

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? (yes / no)
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? (yes / no)
  • How is the feature or change documented? (not applicable / specification (x/<module>/spec/) / Osmosis docs repo / not documented)

@stackman27 stackman27 added the V:state/breaking State machine breaking PR label Dec 21, 2022
@github-actions github-actions bot added C:app-wiring Changes to the app folder C:x/lockup and removed C:x/lockup labels Dec 21, 2022
@stackman27
Copy link
Contributor Author

Rebased and ready for review @czarcas7ic

x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/validator_set.go Outdated Show resolved Hide resolved
x/valset-pref/validator_set.go Outdated Show resolved Hide resolved
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments on the parts I feel concerned about, please take a look and lmk!

proto/osmosis/valset-pref/v1beta1/tx.proto Outdated Show resolved Hide resolved
x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/validator_set.go Outdated Show resolved Hide resolved
x/valset-pref/msg_server.go Outdated Show resolved Hide resolved
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main logic lgtm, left some minor comments and reviews upon testing 🌮

proto/osmosis/valset-pref/v1beta1/tx.proto Outdated Show resolved Hide resolved
proto/osmosis/valset-pref/v1beta1/tx.proto Outdated Show resolved Hide resolved
x/valset-pref/validator_set.go Outdated Show resolved Hide resolved
x/valset-pref/validator_set.go Show resolved Hide resolved
x/valset-pref/validator_set.go Show resolved Hide resolved
x/valset-pref/types/expected_interfaces.go Outdated Show resolved Hide resolved
x/valset-pref/types/expected_interfaces.go Outdated Show resolved Hide resolved
x/valset-pref/msg_server.go Show resolved Hide resolved
x/valset-pref/msg_server_test.go Show resolved Hide resolved
x/valset-pref/msg_server_test.go Show resolved Hide resolved
@stackman27 stackman27 requested a review from mattverse January 14, 2023 23:04
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Major logic looks good, just some comments and questions on the testings before merging!

x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/keeper_test.go Outdated Show resolved Hide resolved
x/valset-pref/msg_server_test.go Outdated Show resolved Hide resolved
x/valset-pref/msg_server_test.go Show resolved Hide resolved
x/valset-pref/validator_set_test.go Show resolved Hide resolved
x/valset-pref/types/expected_interfaces.go Outdated Show resolved Hide resolved
lockId: testLock[6].ID,
expectPass: false,
},
{
name: "Force Unlocks tokens, but doesnot have delegations",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this because multi message tx reverts are being tested manually cli tested

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have plans to add a go test for this or no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the last chain dev call, i think the verdict was to just write e2e test

@stackman27
Copy link
Contributor Author

Thank you @mattverse for your feedback resolved everything here: 875e31

@stackman27 stackman27 requested a review from mattverse January 17, 2023 08:02
@mattverse
Copy link
Member

The lock check in the test and LGTM

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM! Nice job!

Comment on lines +270 to +276
_, err := sdk.AccAddressFromBech32(m.Delegator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err)
}

return nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe in future PR can add check that lockId is positive

@czarcas7ic czarcas7ic merged commit 0730d2c into main Jan 19, 2023
@czarcas7ic czarcas7ic deleted the sis/MsgDelBondTok branch January 19, 2023 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder V:state/breaking State machine breaking PR
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Allow migration of x/lockup uosmo to staking to a valset preference
3 participants