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

Make superfluid staking stakers get direct governance votes #1161

Closed
ValarDragon opened this issue Mar 27, 2022 · 1 comment · Fixed by #1191
Closed

Make superfluid staking stakers get direct governance votes #1161

ValarDragon opened this issue Mar 27, 2022 · 1 comment · Fixed by #1191
Assignees

Comments

@ValarDragon
Copy link
Member

To give SFS stakers direct voting power in votes, we need to pass in the superfluid staking keeper as the staking keeper to the governance keeper.

The governance keeper requires the following methods defined in order to be a staking keeper: https://github.com/cosmos/cosmos-sdk/blob/master/x/gov/types/expected_keepers.go#L16-L27

	IterateBondedValidatorsByPower(
		sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool),
	)
	TotalBondedTokens(sdk.Context) sdk.Int // total bonded tokens within the validator set
	IterateDelegations(
		ctx sdk.Context, delegator sdk.AccAddress,
		fn func(index int64, delegation stakingtypes.DelegationI) (stop bool),
	)

So we should add a staking_keeper.go file in x/superfluid/keeper/ and add these three methods. IterateBondedValidatorsByPower and TotalBondedTokens can just return data from the underlying staking keeper.

IterateDelegations needs to basically just return the staking keepers delegations and then construct delegations from the existing superfluid delegations from this address. Looking at the Tally code it appears that it should be fine to return multiple delegation structs for each validator, making this even simpler to integrate.

We should make golang tests for this, by making a validator vote, a superfluid delegator override it, and see that it works.

@mconcat
Copy link
Collaborator

mconcat commented Mar 30, 2022

How are the stakingkeeper and superfluidkeeper combined inside the gov module? Is there already a feature for merging multiple staking keepers?

EDIT: oh I see the superfluid keeper act as a wrapper for staking keeper, so by exposing the method of the underlying, it covers the staking amount of both keepers.

EDIT: then why doesnt it work to simply use the underlying stakingkeeper to governance? because of the delegations are done by intermediary. okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants