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

Validator set preferences module #2579

Closed
3 tasks
Tracked by #3604
ValarDragon opened this issue Sep 2, 2022 · 0 comments
Closed
3 tasks
Tracked by #3604

Validator set preferences module #2579

ValarDragon opened this issue Sep 2, 2022 · 0 comments
Assignees

Comments

@ValarDragon
Copy link
Member

Background

We should make a new module, for validator set preferences.

The goal is to give users & contracts a better UX for staking to a set of validators. E.g. a one click button, that stakes to multiple people. Then a user can set (or realistically a front-end provides) a list of recommended defaults. (E.g. governooors, relayers, chain/stack contributors, etc) This can technically be done off-chain today with front-ends, having preference lists stored locally. Having this on chain:

  • eases front-end code burden that is already very high in cosmos
  • reduces front-end lock-in, giving you the same UX across multiple front-ends

What this module should do is:

  • Allow an address to set a list of {val addr, weight} in state, called their validator set preference
  • Give users a single message to stake X osmo, according to their validator set preference distribution
  • Give users a single message to claim rewards from everyone on their preference list (or should it be all their staking positions)
  • If a user does not have a validator set preference list set, and has staked, make their preference list default to their current staking distribution
    • Expose a query for this
  • If a user has no preference list and no staking, then return error for messages

Suggested design

couple minute initial sketch of a proto for this

message ValidatorPreference {
  string val_oper_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ];
  // two options for how we build weight.
  // Either as a decimal between 0 and 1, and they all sum to 1
  // OR normal int, and percentage to each validator is int/total weight
  string weight = 2 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
    (gogoproto.moretags) = "yaml:\"autostake_rate\"",
    (gogoproto.nullable) = false
  ];
}

message ValidatorSetPreference {
  repeated ValidatorPreference preferences = 1 [ (gogoproto.nullable) = false ];
}

Acceptance Criteria

  • Above listed features built out
  • We follow a module standard similar to x/TWAP (we should do so for new modules going forward)
  • We document what rounding behavior for splitting stake amounts across validators were taking. Any particular decision is fine, just need to document / be clear about what we did
mergify bot pushed a commit that referenced this issue Sep 29, 2022
Part of : #2579

This PR definies the proto messages to build validator-set-preference. There are 3 tx messages;
1. CreateValidatorSetPreference (creates a new {valAddr, Weight} set) 
2. StakeToValidatorSet (gets the tokens and stakes to the existing validator set) 
3. UnStakeFromoValidatorSet (unstakes the coins from an existing validator set) 

## Brief Changelog
n/a 


## Testing and Verifying
n/a

## 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](https://github.com/osmosis-labs/docs)   /   not documented)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants