Cosmos-sdk: Validate genesis params from staking

Created on 21 Apr 2018  路  2Comments  路  Source: cosmos/cosmos-sdk

We need to validate the staking.GenesisState when unmarshalled from the genesis.json or else fill in defaults. Otherwise we easily get panics, for instance if goal_bonded isn't provided, then it defaults to 0, which results in "divide by 0 errors"

UX bug staking

Most helpful comment

yeah let's have each module define a ValidateGenesis function

All 2 comments

Perhaps modules which need to enforce these kinds of invariants have a CheckInvariants function, which can be called in this case, whenever we import or manually modify state (especially during software upgrades), and by a gaiad check command for debugging.

yeah let's have each module define a ValidateGenesis function

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rigelrozanski picture rigelrozanski  路  3Comments

cwgoes picture cwgoes  路  3Comments

johnmcdowall picture johnmcdowall  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

fedekunze picture fedekunze  路  3Comments