default gen state (#6139)
This commit is contained in:
parent
110942add6
commit
106bcd5e13
|
@ -52,28 +52,18 @@ func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {
|
||||||
|
|
||||||
// DefaultGenesis returns default genesis state as raw bytes for the ibc
|
// DefaultGenesis returns default genesis state as raw bytes for the ibc
|
||||||
// module.
|
// module.
|
||||||
func (AppModuleBasic) DefaultGenesis(_ codec.JSONMarshaler) json.RawMessage {
|
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage {
|
||||||
return nil
|
return cdc.MustMarshalJSON(DefaultGenesisState())
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateGenesis performs genesis state validation for the ibc module.
|
// ValidateGenesis performs genesis state validation for the ibc module.
|
||||||
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessage) error {
|
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessage) error {
|
||||||
|
var gs GenesisState
|
||||||
|
if err := cdc.UnmarshalJSON(bz, &gs); err != nil {
|
||||||
|
return fmt.Errorf("failed to unmarshal %s genesis state: %w", ModuleName, err)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: UNDO this when DefaultGenesis() is implemented
|
return gs.Validate()
|
||||||
// This validation is breaking the state as it is trying to
|
|
||||||
// validate nil. DefaultGenesis is not implemented and it just returns nil
|
|
||||||
// This is a quick fix to make the cli-tests work and
|
|
||||||
// SHOULD BE reverted when #5948 is addressed
|
|
||||||
// To UNDO this, just uncomment the code below
|
|
||||||
|
|
||||||
// var gs GenesisState
|
|
||||||
// if err := cdc.UnmarshalJSON(bz, &gs); err != nil {
|
|
||||||
// return fmt.Errorf("failed to unmarshal %s genesis state: %w", ModuleName, err)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return gs.Validate()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterRESTRoutes registers the REST routes for the ibc module.
|
// RegisterRESTRoutes registers the REST routes for the ibc module.
|
||||||
|
|
Loading…
Reference in New Issue