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

Modular gov tally #64

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft

Modular gov tally #64

wants to merge 19 commits into from

Conversation

sunnya97
Copy link

@sunnya97 sunnya97 commented Jan 22, 2021

TODOs:

  • Cause error if no "root" strategy provided
  • Move TallyParams to inside stakingtally
  • Move tests for stakingtally strategy to inside stakingtally
  • Add tests for TokenBalance Tally strategy
  • Add validators only Tally Strategy
  • Make requirement to set a Root Tally Route, panic or something if not set
  • Add spec

@sunnya97 sunnya97 added the WIP label Jan 22, 2021
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

Choose a reason for hiding this comment

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

stakingtally shouldn't be in staking module?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it probably should be actually

Choose a reason for hiding this comment

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

Do we also need to provide additional param to tally router? In case module could customize tally based on that param.

Copy link
Author

Choose a reason for hiding this comment

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

Gov would have no dependency on staking at all then I think

Choose a reason for hiding this comment

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

It would be nice to reduce dependencies, currently some modules are too related each other.


// Tally iterates over the votes and updates the tally of a proposal based on the voting power of the
// voters
func handleTokenBalanceTally(ctx sdk.Context, proposal govtypes.Proposal, gk govkeeper.Keeper, bk govtypes.BankKeeper, denom string) (passes bool, burnDeposits bool, tallyResults govtypes.TallyResult) {

Choose a reason for hiding this comment

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

Where should we put this if we move staking tally to staking module ?
Maybe bank module? :)

Copy link
Author

Choose a reason for hiding this comment

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

Hmm, I guess. Is it going to be odd to have a reference to the gov module within the bank module, even if its just in a submodule?

Should we maybe have a separate folder of tallystrategies, and have that filled with submodules?

// AddRoute adds a governance handler for a given path. It returns the Router
// so AddRoute calls can be linked. It will panic if the router is sealed.
func (rtr *tallyrouter) AddRoute(path string, t TallyStrategy) TallyRouter {
if rtr.sealed {

Choose a reason for hiding this comment

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

Where sealed is set?

Copy link
Author

@sunnya97 sunnya97 Feb 5, 2021

Choose a reason for hiding this comment

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

Ah, I actually meant to get rid of that. I got rid of the .Seal() function on this router, because the point is we want other modules to add Routes dynamically.

940d2cf#diff-240cbd96be80c2c1a5bf3dce2b5aa335deabe0e7d737fca0b85032fd015c01c4L33

Copy link
Author

Choose a reason for hiding this comment

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

You can remove this check and the sealed variable from tally_router

string description = 2;
string title = 1;
string description = 2;
string tallystrategy = 3;
Copy link

@antstalepresh antstalepresh Feb 5, 2021

Choose a reason for hiding this comment

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

Do we need to make all text proposals to have dynamic tally strategy? Or add some configuration for tally strategy for a specific type of proposal to be restricted to few listings?

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

Successfully merging this pull request may close these issues.

2 participants