Skip to content

Modular gov tally - #64

Draft
sunnya97 wants to merge 19 commits into
masterfrom
modular-gov-tally
Draft

Modular gov tally#64
sunnya97 wants to merge 19 commits into
masterfrom
modular-gov-tally

Conversation

@sunnya97

@sunnya97 sunnya97 commented Jan 22, 2021

Copy link
Copy Markdown

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
Comment thread simapp/app.go
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

Copy link
Copy Markdown

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
Copy Markdown
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

Copy link
Copy Markdown

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
Copy Markdown
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

Copy link
Copy Markdown

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) {

Copy link
Copy Markdown

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
Copy Markdown
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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Where sealed is set?

@sunnya97 sunnya97 Feb 5, 2021

Copy link
Copy Markdown
Author

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
Copy Markdown
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;

@antstalepresh antstalepresh Feb 5, 2021

Copy link
Copy Markdown

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