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

Parameter Change Proposal #3565

Closed
mossid opened this issue Feb 9, 2019 · 3 comments · Fixed by #4206
Closed

Parameter Change Proposal #3565

mossid opened this issue Feb 9, 2019 · 3 comments · Fixed by #4206
Assignees
Labels
Milestone

Comments

@mossid
Copy link
Contributor

mossid commented Feb 9, 2019

Add ParameterChangeProposal to params proposal type. type Proposal is already defined as an interface, and TextProposal implements it without doing actual state transition, so we can define additional proposal types by embedding TextProposal.

type ParameterChange struct {
    Key string
    Subkey string
    Value interface{}
}

type ParameterChangeProposal struct {
    TextProposal
    Changes []ParameterChange
}

To apply the proposal to the state, we can add type ProposalHandler. Modules who wants to add new proposal type can define func NewProposalHandler(k Keeper) ProposalHandler, which can be registered to gov.Keeper. When a new proposal has been passed, the keeper will pass the proposal into the handler, where then the other keepers modify the state.

// package gov
type ProposalHandler func(sdk.Context, Proposal) error

// see baseapp/router.go
type ProposalRouter interface {
    AddRouter(r string, h ProposalHandler) ProposalRouter
    Route(path string) ProposalHandler
}

func (k Keeper) ProposalRouter() Router {
    return k.router
}

// package params
func NewProposalHandler(k Keeper) sdk.ProposalHandler {
    return func(ctx sdk.Context, prop sdk.Proposal) error {
        switch prop := prop.(type) {
        case ParameterChangeProposal:
            // ...
        }
    }
}

type Proposal will moved into types so the modules who want to define new Proposal type can just import types not gov.

@hleb-albau
Copy link
Contributor

hleb-albau commented Mar 1, 2019

Hi,
A very desirable feature. Also, enabling tokens transfers can be done via such government mechanism. Is it in progress? Will we see it on the mainnet? Can we help implement that feature?

@alexanderbez
Copy link
Contributor

@mossid is there any progress on this?

@cwgoes
Copy link
Contributor

cwgoes commented Mar 7, 2019

Example possible parameter change proposals:

  • Increasing number of max validators
  • Changing the inflation rate
  • Changing consensus parameters (max block size, gas limits)
  • Changing slashing parameters (amounts, liveness windows)
  • Changing reward distribution fractions (to proposer, bonus for precommits, etc)
  • Changing governance parameters (quorum)
  • Changing unbonding period
  • Enabling/disabling message types

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