diff --git a/x/rollapp/client/cli/tx_create_rollapp.go b/x/rollapp/client/cli/tx_create_rollapp.go index 9783c3910..0d6ada235 100644 --- a/x/rollapp/client/cli/tx_create_rollapp.go +++ b/x/rollapp/client/cli/tx_create_rollapp.go @@ -91,8 +91,8 @@ func parseGenesisInfo(cmd *cobra.Command) (types.GenesisInfo, error) { return types.GenesisInfo{}, err } - genesisInfo.NativeDenom = new(types.DenomMetadata) if nativeDenomFlag != "" { + genesisInfo.NativeDenom = new(types.DenomMetadata) if err = utils.ParseJsonFromFile(nativeDenomFlag, genesisInfo.NativeDenom); err != nil { return types.GenesisInfo{}, err } diff --git a/x/rollapp/types/message_create_rollapp_test.go b/x/rollapp/types/message_create_rollapp_test.go index 11cbb71e1..882b47b3a 100644 --- a/x/rollapp/types/message_create_rollapp_test.go +++ b/x/rollapp/types/message_create_rollapp_test.go @@ -255,7 +255,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: &DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.Int{}, + InitialSupply: sdk.NewInt(-1), }, }, err: ErrInvalidInitialSupply, diff --git a/x/rollapp/types/rollapp.go b/x/rollapp/types/rollapp.go index 53ea238a1..bcea125ce 100644 --- a/x/rollapp/types/rollapp.go +++ b/x/rollapp/types/rollapp.go @@ -106,15 +106,13 @@ func (r GenesisInfo) Validate() error { return errorsmod.Wrap(ErrInvalidGenesisChecksum, "GenesisChecksum") } - if r.NativeDenom == nil { - return errorsmod.Wrap(ErrInvalidNativeDenom, "NativeDenom") - } - - if err := r.NativeDenom.Validate(); err != nil { - return errorsmod.Wrap(ErrInvalidNativeDenom, err.Error()) + if r.NativeDenom != nil { + if err := r.NativeDenom.Validate(); err != nil { + return errorsmod.Wrap(ErrInvalidNativeDenom, err.Error()) + } } - if r.InitialSupply.IsNil() { + if !r.InitialSupply.IsNil() && r.InitialSupply.IsNegative() { return errorsmod.Wrap(ErrInvalidInitialSupply, "InitialSupply") }