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] Module Wired up and created MsgSetValidatorSetPreference #2892

Merged
merged 3 commits into from
Nov 6, 2022

Conversation

stackman27
Copy link
Contributor

@stackman27 stackman27 commented Sep 29, 2022

Part of : #2579

What is the purpose of the change

This PR does the following;

  • Setup folder/file structure for the ValSet module
  • Setup KVStore for the module
  • Setup Keeper/Msg_server test suite
  • Create MsgSetValidatorSetPreference that lets users to create their validator-set
  • Make MsgSetValidatorSetPreference module so that it can handle create + update

Brief Changelog

n/a

Testing and Verifying

  1. Added tdd tests for MsgSetValidatorSetPreference

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)

@github-actions github-actions bot added C:app-wiring Changes to the app folder C:CLI C:docs Improvements or additions to documentation labels Sep 29, 2022
@stackman27 stackman27 changed the title [Val-SetPref] Module Wired up and created MsgSetValidatorSetPreference [ValSet-Pref] Module Wired up and created MsgSetValidatorSetPreference Sep 29, 2022
@stackman27 stackman27 force-pushed the sis/valSet-setValMsg branch 2 times, most recently from f18a463 to 5a03823 Compare September 29, 2022 15:36
@github-actions github-actions bot removed C:docs Improvements or additions to documentation C:CLI labels Sep 29, 2022
@stackman27 stackman27 marked this pull request as ready for review September 29, 2022 17:35
@stackman27 stackman27 requested review from a team and mattverse September 29, 2022 17:35
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! Left some initial comments, please take a look 🌮

x/validator-preference/keeper/keeper.go Outdated Show resolved Hide resolved
x/validator-preference/valpref-module/module.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
x/validator-preference/valpref-module/module.go Outdated Show resolved Hide resolved
x/validator-preference/valpref-module/module.go Outdated Show resolved Hide resolved
x/validator-preference/types/codec.go Outdated Show resolved Hide resolved
x/validator-preference/types/msgs.go Outdated Show resolved Hide resolved
x/validator-preference/keeper/ValidatorSet.go Outdated Show resolved Hide resolved
x/validator-preference/keeper/msg_server.go Outdated Show resolved Hide resolved
x/validator-preference/keeper/ValidatorSet.go Outdated Show resolved Hide resolved
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

Have a few changes, one in particular that is a must. Please lmk if you have any questions!

As a side note kind of unrelated to this particular PR, this concept of storing account valset preferences on chain is kind of disturbing to me. I could be wrong / misunderstanding, but wouldn't it be extremely simple for someone to spam create accounts and set validator preferences to preference all 150 validators? I don't even think the account would need to have any balance as it stands right? I think we need to rethink the implementation if this is the case

cc: @p0mvn @mattverse

proto/osmosis/validator-preference/v1beta1/params.proto Outdated Show resolved Hide resolved
x/validator-preference/keeper_test.go Outdated Show resolved Hide resolved
x/validator-preference/msg_server.go Outdated Show resolved Hide resolved
x/validator-preference/msg_server.go Outdated Show resolved Hide resolved
x/validator-preference/msg_server_test.go Outdated Show resolved Hide resolved
x/validator-preference/types/msgs.go Outdated Show resolved Hide resolved
x/validator-preference/types/msgs.go Outdated Show resolved Hide resolved
x/validator-preference/types/msgs.go Outdated Show resolved Hide resolved
x/validator-preference/validator_set.go Outdated Show resolved Hide resolved
x/validator-preference/validator_set.go Outdated Show resolved Hide resolved
@stackman27
Copy link
Contributor Author

Have a few changes, one in particular that is a must. Please lmk if you have any questions!

As a side note kind of unrelated to this particular PR, this concept of storing account valset preferences on chain is kind of disturbing to me. I could be wrong / misunderstanding, but wouldn't it be extremely simple for someone to spam create accounts and set validator preferences to preference all 150 validators? I don't even think the account would need to have any balance as it stands right? I think we need to rethink the implementation if this is the case

cc: @p0mvn @mattverse

Thank you @czarcas7ic for the feedback! Addressed everything here: bb8fb72

I do think we should have an upper limit for the # of validator we can have in a set. Yea the account donot need to have any balance to create a validator set. I can change it based on any design decision we end up making

@czarcas7ic
Copy link
Member

I am going to tag @ValarDragon for his opinion on potential attack surface this would provide. I am not concerned about the number of validators an account can set. Even if it was two, if someone could create unlimited accounts with two validator preferences, this would bloat state significantly.

@stackman27 stackman27 force-pushed the sis/valSet-setValMsg branch from dae4663 to dcd44c5 Compare October 10, 2022 05:23
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 second round of reviews, overall looking good, I think we just need test cases for the community pool funding for val set creation fee

go.mod Outdated Show resolved Hide resolved
x/validator-preference/keeper.go Outdated Show resolved Hide resolved
x/validator-preference/keeper.go Outdated Show resolved Hide resolved
proto/osmosis/validator-preference/v1beta1/genesis.proto Outdated Show resolved Hide resolved
x/validator-preference/keeper_test.go Outdated Show resolved Hide resolved
x/validator-preference/msg_server.go Outdated Show resolved Hide resolved
x/validator-preference/msg_server_test.go Outdated Show resolved Hide resolved
x/validator-preference/msg_server_test.go Outdated Show resolved Hide resolved
x/validator-preference/valpref-module/module.go Outdated Show resolved Hide resolved
@mattverse
Copy link
Member

I am going to tag @ValarDragon for his opinion on potential attack surface this would provide. I am not concerned about the number of validators an account can set. Even if it was two, if someone could create unlimited accounts with two validator preferences, this would bloat state significantly.

My stance is that I'm not pretty much concerned about this, since we have the val set creation fee

@czarcas7ic
Copy link
Member

Yes, as long as fee is implemented I am also not concerned

@stackman27
Copy link
Contributor Author

Left second round of reviews, overall looking good, I think we just need test cases for the community pool funding for val set creation fee

Thank you @mattverse for the feedback. Resolved all you feedback except replacing DeepEqual here 0c6ece9

I want to see if there is a much easier way of doing this other than sorting and comparing, maybe some built in function or osmo util function that i'm not aware of

@mattverse
Copy link
Member

Left second round of reviews, overall looking good, I think we just need test cases for the community pool funding for val set creation fee

Thank you @mattverse for the feedback. Resolved all you feedback except replacing DeepEqual here 0c6ece9

I want to see if there is a much easier way of doing this other than sorting and comparing, maybe some built in function or osmo util function that i'm not aware of

Can you assign me for review once r4r?

@stackman27 stackman27 force-pushed the sis/valSet-setValMsg branch from a32cf1e to 623635a Compare October 31, 2022 20:43
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

My question on the validator_set.go is the only important point I had, all others are low pri, nice work :)

app/upgrades/v13/constants.go Outdated Show resolved Hide resolved
app/upgrades/v13/constants.go Show resolved Hide resolved
x/valset-pref/msg_server_test.go Outdated Show resolved Hide resolved
x/valset-pref/msg_server_test.go Outdated Show resolved Hide resolved
x/valset-pref/types/msgs_test.go Outdated Show resolved Hide resolved
x/valset-pref/validator_set.go Show resolved Hide resolved
x/valset-pref/validator_set.go Outdated Show resolved Hide resolved
x/valset-pref/valpref-module/module.go Show resolved Hide resolved
app/keepers/keepers.go Outdated Show resolved Hide resolved
x/valset-pref/valpref-module/module.go Show resolved Hide resolved
app/keepers/keepers.go Outdated Show resolved Hide resolved
app/modules.go Outdated Show resolved Hide resolved
proto/osmosis/valset-pref/v1beta1/query.proto Outdated Show resolved Hide resolved
proto/osmosis/valset-pref/v1beta1/state.proto Outdated Show resolved Hide resolved
x/valset-pref/client/query_proto_wrap.go Show resolved Hide resolved
x/valset-pref/keeper.go Outdated Show resolved Hide resolved
x/valset-pref/msg_server.go Outdated Show resolved Hide resolved
x/valset-pref/types/codec.go Outdated Show resolved Hide resolved
@stackman27 stackman27 force-pushed the sis/valSet-setValMsg branch from e32b5d6 to c64682a Compare November 2, 2022 00:20
@stackman27
Copy link
Contributor Author

Thank you @alexanderbez for your feedback! implemented all of it here c64682a

Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

LGTM! Did we decide to limit the number of validators one can split delegate to? I dont have any preference for or against, I just remember this being talked about and I didn't see anything in ref to this in the code

x/valset-pref/types/msgs_test.go Outdated Show resolved Hide resolved
@czarcas7ic
Copy link
Member

@alexanderbez are you able to check if your required change was addressed so this can get merged?

@stackman27
Copy link
Contributor Author

LGTM! Did we decide to limit the number of validators one can split delegate to? I dont have any preference for or against, I just remember this being talked about and I didn't see anything in ref to this in the code

Dev seem to not care much about it so i didn't include it. If this discussion opens up in the future i will add it

@stackman27 stackman27 force-pushed the sis/valSet-setValMsg branch 2 times, most recently from 2a48057 to 091c2cc Compare November 4, 2022 05:01
@stackman27 stackman27 force-pushed the sis/valSet-setValMsg branch from 091c2cc to 892ae00 Compare November 4, 2022 21:11
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Left a few minor reviews. I think there are probably a few remaining spots that can be cleaned up. So I'll give this a preliminary ACK

x/valset-pref/types/codec.go Show resolved Hide resolved
x/valset-pref/types/keys.go Outdated Show resolved Hide resolved
x/valset-pref/types/msgs.go Outdated Show resolved Hide resolved
x/valset-pref/types/msgs.go Outdated Show resolved Hide resolved
x/valset-pref/client/query_proto_wrap.go Outdated Show resolved Hide resolved
@stackman27
Copy link
Contributor Author

Thank you @alexanderbez resolved all your comments here a3a55cc

@czarcas7ic
Copy link
Member

Merging, thanks again @stackman27 !

@czarcas7ic czarcas7ic merged commit 2ee66e4 into main Nov 6, 2022
@czarcas7ic czarcas7ic deleted the sis/valSet-setValMsg branch November 6, 2022 00:58
pysel pushed a commit to pysel/osmosis that referenced this pull request Nov 8, 2022
osmosis-labs#2892)

* Module Wired up and created MsgSetValidatorSetPreference

* [ValSet-Pref] Module Wired up and created MsgSetValidatorSetPreference

* bez feedback
stackman27 added a commit that referenced this pull request Nov 8, 2022
ValarDragon pushed a commit that referenced this pull request Nov 8, 2022
…atorSetPreference" (#3306)

* Revert "[ValSet-Pref] Module Wired up and created MsgSetValidatorSetPreference  (#2892)"

This reverts commit 2ee66e4.

* removed folder
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 C:CLI C:docs Improvements or additions to documentation V:state/breaking State machine breaking PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants