diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index cce75b0e6..60cfbec5c 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -5,6 +5,7 @@ import ( "time" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/dymensionxyz/dymension/v3/app/params" dymnstypes "github.com/dymensionxyz/dymension/v3/x/dymns/types" @@ -59,7 +60,7 @@ func (s *KeeperTestHelper) CreateRollappByName(name string) { GenesisInfo: rollapptypes.GenesisInfo{ Bech32Prefix: strings.ToLower(rand.Str(3)), GenesisChecksum: "1234567890abcdefg", - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), NativeDenom: rollapptypes.DenomMetadata{ Display: "DEN", Base: "aden", diff --git a/app/upgrades/v4/upgrade.go b/app/upgrades/v4/upgrade.go index 7fc295229..025fee9de 100644 --- a/app/upgrades/v4/upgrade.go +++ b/app/upgrades/v4/upgrade.go @@ -37,6 +37,7 @@ import ( sequencertypes "github.com/dymensionxyz/dymension/v3/x/sequencer/types" streamerkeeper "github.com/dymensionxyz/dymension/v3/x/streamer/keeper" streamertypes "github.com/dymensionxyz/dymension/v3/x/streamer/types" + "github.com/dymensionxyz/sdk-utils/utils/uptr" ) // CreateUpgradeHandler creates an SDK upgrade handler for v4 @@ -244,7 +245,7 @@ func ConvertOldRollappToNew(oldRollapp rollapptypes.Rollapp) rollapptypes.Rollap Base: "aden", // placeholder data Exponent: 18, // placeholder data }, - InitialSupply: sdk.NewInt(100000), // placeholder data + InitialSupply: uptr.To(sdk.NewInt(100000)), // placeholder data Sealed: true, }, InitialSequencer: "*", diff --git a/ibctesting/utils_test.go b/ibctesting/utils_test.go index 22fa55bcf..f672bfc96 100644 --- a/ibctesting/utils_test.go +++ b/ibctesting/utils_test.go @@ -21,6 +21,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" "github.com/cosmos/ibc-go/v7/testing/mock" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -144,7 +145,7 @@ func (s *utilSuite) createRollapp(transfersEnabled bool, channelID *string) { Base: "aden", Exponent: 18, }, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, ) diff --git a/proto/dymensionxyz/dymension/rollapp/rollapp.proto b/proto/dymensionxyz/dymension/rollapp/rollapp.proto index b3d0a943a..e0d4571fa 100644 --- a/proto/dymensionxyz/dymension/rollapp/rollapp.proto +++ b/proto/dymensionxyz/dymension/rollapp/rollapp.proto @@ -87,7 +87,7 @@ message GenesisInfo { // initial_supply is the initial supply of the native token string initial_supply = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = true ]; // sealed indicates if the fields in this object are no longer updatable bool sealed = 5; diff --git a/x/incentives/keeper/suite_test.go b/x/incentives/keeper/suite_test.go index 54fb2b02a..1d6f34249 100644 --- a/x/incentives/keeper/suite_test.go +++ b/x/incentives/keeper/suite_test.go @@ -8,6 +8,7 @@ import ( tmrand "github.com/cometbft/cometbft/libs/rand" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/dymensionxyz/sdk-utils/utils/urand" "github.com/dymensionxyz/dymension/v3/x/incentives/types" @@ -222,7 +223,7 @@ func (suite *KeeperTestSuite) CreateDefaultRollapp(addr sdk.AccAddress) string { Base: "aden", Exponent: 18, }, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, } diff --git a/x/rollapp/client/cli/tx_create_rollapp.go b/x/rollapp/client/cli/tx_create_rollapp.go index ecf0d7801..f52aa9e81 100644 --- a/x/rollapp/client/cli/tx_create_rollapp.go +++ b/x/rollapp/client/cli/tx_create_rollapp.go @@ -73,7 +73,6 @@ func parseGenesisInfo(cmd *cobra.Command) (types.GenesisInfo, error) { var ( genesisInfo types.GenesisInfo err error - ok bool ) genesisInfo.GenesisChecksum, err = cmd.Flags().GetString(FlagGenesisChecksum) @@ -103,10 +102,11 @@ func parseGenesisInfo(cmd *cobra.Command) (types.GenesisInfo, error) { } if initialSupplyFlag != "" { - genesisInfo.InitialSupply, ok = sdk.NewIntFromString(initialSupplyFlag) + initialSupply, ok := sdk.NewIntFromString(initialSupplyFlag) if !ok { return types.GenesisInfo{}, fmt.Errorf("invalid initial supply: %s", initialSupplyFlag) } + genesisInfo.InitialSupply = &initialSupply } return genesisInfo, nil diff --git a/x/rollapp/genesis_test.go b/x/rollapp/genesis_test.go index 18f9500dc..36e1361ba 100644 --- a/x/rollapp/genesis_test.go +++ b/x/rollapp/genesis_test.go @@ -4,6 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/stretchr/testify/require" keepertest "github.com/dymensionxyz/dymension/v3/testutil/keeper" @@ -27,13 +28,13 @@ func TestInitExportGenesis(t *testing.T) { { RollappId: rollappID1, GenesisInfo: types.GenesisInfo{ - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, { RollappId: rollappID2, GenesisInfo: types.GenesisInfo{ - InitialSupply: sdk.NewInt(1001), + InitialSupply: uptr.To(sdk.NewInt(1001)), }, }, }, diff --git a/x/rollapp/keeper/msg_server_create_rollapp_test.go b/x/rollapp/keeper/msg_server_create_rollapp_test.go index a81f89ab6..57d51c6f0 100644 --- a/x/rollapp/keeper/msg_server_create_rollapp_test.go +++ b/x/rollapp/keeper/msg_server_create_rollapp_test.go @@ -4,6 +4,7 @@ import ( "strings" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/cometbft/cometbft/libs/rand" sdk "github.com/cosmos/cosmos-sdk/types" @@ -393,5 +394,5 @@ var mockGenesisInfo = types.GenesisInfo{ Base: "aden", Exponent: 18, }, - InitialSupply: sdk.NewInt(100000000), + InitialSupply: uptr.To(sdk.NewInt(100000000)), } diff --git a/x/rollapp/keeper/msg_server_update_rollapp_test.go b/x/rollapp/keeper/msg_server_update_rollapp_test.go index b208cf115..511cc9ba8 100644 --- a/x/rollapp/keeper/msg_server_update_rollapp_test.go +++ b/x/rollapp/keeper/msg_server_update_rollapp_test.go @@ -36,7 +36,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { GenesisInfo: types.GenesisInfo{ Bech32Prefix: "new", GenesisChecksum: "new_checksum", - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), NativeDenom: types.DenomMetadata{ Display: "DEN", Base: "aden", @@ -54,7 +54,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { GenesisInfo: types.GenesisInfo{ Bech32Prefix: "new", GenesisChecksum: "new_checksum", - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), NativeDenom: types.DenomMetadata{ Display: "DEN", Base: "aden", @@ -141,11 +141,70 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { Owner: alice, RollappId: rollappId, GenesisInfo: types.GenesisInfo{ - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, genInfoSealed: true, expError: types.ErrGenesisInfoSealed, + }, { + name: "Update rollapp: success - no genesis info, genesis info sealed", + update: &types.MsgUpdateRollappInformation{ + Owner: alice, + RollappId: rollappId, + }, + genInfoSealed: true, + expError: nil, + expRollapp: types.Rollapp{ + RollappId: rollappId, + Owner: alice, + VmType: types.Rollapp_EVM, + Metadata: &types.RollappMetadata{}, + GenesisInfo: types.GenesisInfo{ + Bech32Prefix: "old", + GenesisChecksum: "old", + InitialSupply: uptr.To(sdk.NewInt(1000)), + NativeDenom: types.DenomMetadata{ + Display: "OLD", + Base: "aold", + Exponent: 18, + }, + Sealed: true, + }, + }, + }, { + name: "Update rollapp: success - no initial supply, genesis info not sealed", + update: &types.MsgUpdateRollappInformation{ + Owner: alice, + RollappId: rollappId, + GenesisInfo: types.GenesisInfo{ + Bech32Prefix: "old", + GenesisChecksum: "old", + InitialSupply: nil, + NativeDenom: types.DenomMetadata{ + Display: "OLD", + Base: "aold", + Exponent: 18, + }, + }, + }, + genInfoSealed: false, + expError: nil, + expRollapp: types.Rollapp{ + RollappId: rollappId, + Owner: alice, + VmType: types.Rollapp_EVM, + Metadata: &types.RollappMetadata{}, + GenesisInfo: types.GenesisInfo{ + Bech32Prefix: "old", + GenesisChecksum: "old", + InitialSupply: uptr.To(sdk.NewInt(1000)), + NativeDenom: types.DenomMetadata{ + Display: "OLD", + Base: "aold", + Exponent: 18, + }, + }, + }, }, { name: "Update rollapp: success - update metadata when sealed", update: &types.MsgUpdateRollappInformation{ @@ -169,7 +228,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { GenesisInfo: types.GenesisInfo{ Bech32Prefix: "old", GenesisChecksum: "old", - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), NativeDenom: types.DenomMetadata{ Display: "OLD", Base: "aold", @@ -203,7 +262,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { GenesisInfo: types.GenesisInfo{ Bech32Prefix: "old", GenesisChecksum: "old", - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), NativeDenom: types.DenomMetadata{ Display: "OLD", Base: "aold", @@ -241,7 +300,7 @@ func (suite *RollappTestSuite) TestCreateAndUpdateRollapp() { GenesisInfo: types.GenesisInfo{ Bech32Prefix: "rol", GenesisChecksum: "checksum", - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), NativeDenom: types.DenomMetadata{ Display: "DEN", Base: "aden", diff --git a/x/rollapp/keeper/rollapp.go b/x/rollapp/keeper/rollapp.go index dfa610aa6..011cf3390 100644 --- a/x/rollapp/keeper/rollapp.go +++ b/x/rollapp/keeper/rollapp.go @@ -52,7 +52,7 @@ func (k Keeper) CheckAndUpdateRollappFields(ctx sdk.Context, update *types.MsgUp current.GenesisInfo.NativeDenom = update.GenesisInfo.NativeDenom } - if !update.GenesisInfo.InitialSupply.IsNil() { + if update.GenesisInfo.InitialSupply != nil && update.GenesisInfo.InitialSupply.IsPositive() { current.GenesisInfo.InitialSupply = update.GenesisInfo.InitialSupply } diff --git a/x/rollapp/simulation/create_rollapp.go b/x/rollapp/simulation/create_rollapp.go index 2c4694983..529c9e22e 100644 --- a/x/rollapp/simulation/create_rollapp.go +++ b/x/rollapp/simulation/create_rollapp.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/dymensionxyz/dymension/v3/simulation" simulationtypes "github.com/dymensionxyz/dymension/v3/simulation/types" @@ -49,7 +50,7 @@ func SimulateMsgCreateRollapp(ak simulationtypes.AccountKeeper, bk simulationtyp Base: "udym", Exponent: 6, }, - InitialSupply: sdk.NewInt(1000000000), + InitialSupply: uptr.To(sdk.NewInt(1000000000)), }, } diff --git a/x/rollapp/types/message_create_rollapp_test.go b/x/rollapp/types/message_create_rollapp_test.go index 8de44d17d..78451546d 100644 --- a/x/rollapp/types/message_create_rollapp_test.go +++ b/x/rollapp/types/message_create_rollapp_test.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dymensionxyz/gerr-cosmos/gerrc" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/stretchr/testify/require" "github.com/dymensionxyz/dymension/v3/testutil/sample" @@ -32,7 +33,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, Metadata: &RollappMetadata{ Website: "https://dymension.xyz", @@ -59,7 +60,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: ErrInvalidRollappID, @@ -76,7 +77,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: ErrInvalidCreatorAddress, @@ -93,7 +94,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, }, @@ -109,7 +110,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: ErrInvalidInitialSequencer, @@ -126,7 +127,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: nil, @@ -143,7 +144,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: nil, @@ -162,7 +163,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: ErrInvalidInitialSequencer, @@ -179,7 +180,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: "DYM", GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: gerrc.ErrInvalidArgument, @@ -196,7 +197,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, Metadata: &RollappMetadata{ Website: "https://dymension.xyz", @@ -218,7 +219,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: strings.Repeat("a", maxGenesisChecksumLength+1), NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: ErrInvalidGenesisChecksum, @@ -235,7 +236,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, Metadata: &RollappMetadata{ ExplorerUrl: string(rune(0x7f)), @@ -255,11 +256,39 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(-1), + InitialSupply: uptr.To(sdk.NewInt(-1)), }, }, err: ErrInvalidInitialSupply, }, + { + name: "no initial supply", + msg: MsgCreateRollapp{ + Creator: sample.AccAddress(), + InitialSequencer: sample.AccAddress(), + RollappId: "dym_100-1", + Alias: "alias", + VmType: Rollapp_EVM, + GenesisInfo: GenesisInfo{ + Bech32Prefix: bech32Prefix, + GenesisChecksum: "checksum", + NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, + InitialSupply: nil, + }, + }, + err: nil, + }, + { + name: "no genesis info", + msg: MsgCreateRollapp{ + Creator: sample.AccAddress(), + InitialSequencer: sample.AccAddress(), + RollappId: "dym_100-1", + Alias: "alias", + VmType: Rollapp_EVM, + }, + err: nil, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/rollapp/types/message_update_rollapp.go b/x/rollapp/types/message_update_rollapp.go index fc3963f61..2818d7d16 100644 --- a/x/rollapp/types/message_update_rollapp.go +++ b/x/rollapp/types/message_update_rollapp.go @@ -82,5 +82,5 @@ func (msg *MsgUpdateRollappInformation) UpdatingGenesisInfo() bool { return msg.GenesisInfo.GenesisChecksum != "" || msg.GenesisInfo.Bech32Prefix != "" || msg.GenesisInfo.NativeDenom.Base != "" || - !msg.GenesisInfo.InitialSupply.IsNil() + (msg.GenesisInfo.InitialSupply != nil && msg.GenesisInfo.InitialSupply.IsPositive()) } diff --git a/x/rollapp/types/message_update_rollapp_test.go b/x/rollapp/types/message_update_rollapp_test.go index ce1141849..ad37eb1b9 100644 --- a/x/rollapp/types/message_update_rollapp_test.go +++ b/x/rollapp/types/message_update_rollapp_test.go @@ -5,6 +5,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/stretchr/testify/require" "github.com/dymensionxyz/dymension/v3/testutil/sample" @@ -26,7 +27,7 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, Metadata: &RollappMetadata{ Website: "https://dymension.xyz", @@ -55,7 +56,7 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: ErrInvalidInitialSequencer, @@ -70,7 +71,7 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, Metadata: &RollappMetadata{ Website: "https://dymension.xyz", @@ -90,11 +91,35 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Bech32Prefix: bech32Prefix, GenesisChecksum: strings.Repeat("a", maxGenesisChecksumLength+1), NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, }, err: ErrInvalidGenesisChecksum, }, + { + name: "no initial supply", + msg: MsgUpdateRollappInformation{ + Owner: sample.AccAddress(), + InitialSequencer: sample.AccAddress(), + RollappId: "dym_100-1", + GenesisInfo: GenesisInfo{ + Bech32Prefix: bech32Prefix, + GenesisChecksum: "checksum", + NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, + InitialSupply: nil, + }, + }, + err: nil, + }, + { + name: "no genesis info", + msg: MsgUpdateRollappInformation{ + Owner: sample.AccAddress(), + InitialSequencer: sample.AccAddress(), + RollappId: "dym_100-1", + }, + err: nil, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/rollapp/types/rollapp.go b/x/rollapp/types/rollapp.go index e26efb188..39a75ebf8 100644 --- a/x/rollapp/types/rollapp.go +++ b/x/rollapp/types/rollapp.go @@ -103,7 +103,7 @@ func (r Rollapp) GenesisInfoFieldsAreSet() bool { return r.GenesisInfo.GenesisChecksum != "" && r.GenesisInfo.NativeDenom.Validate() == nil && r.GenesisInfo.Bech32Prefix != "" && - !r.GenesisInfo.InitialSupply.IsNil() + (r.GenesisInfo.InitialSupply != nil && !r.GenesisInfo.InitialSupply.IsNil()) } func (r Rollapp) IsVulnerable() bool { @@ -125,8 +125,8 @@ func (r GenesisInfo) Validate() error { return errors.Join(ErrInvalidNativeDenom, err) } - if r.InitialSupply.IsNil() || !r.InitialSupply.IsPositive() { - return ErrInvalidInitialSupply + if r.InitialSupply != nil && !r.InitialSupply.IsNil() && r.InitialSupply.IsNegative() { + return errorsmod.Wrap(ErrInvalidInitialSupply, "InitialSupply") } return nil diff --git a/x/rollapp/types/rollapp.pb.go b/x/rollapp/types/rollapp.pb.go index d7d204b79..21e0b51e6 100644 --- a/x/rollapp/types/rollapp.pb.go +++ b/x/rollapp/types/rollapp.pb.go @@ -293,7 +293,7 @@ type GenesisInfo struct { // native_denom is the base denom for the native token NativeDenom DenomMetadata `protobuf:"bytes,3,opt,name=native_denom,json=nativeDenom,proto3" json:"native_denom"` // initial_supply is the initial supply of the native token - InitialSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=initial_supply,json=initialSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"initial_supply"` + InitialSupply *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=initial_supply,json=initialSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"initial_supply,omitempty"` // sealed indicates if the fields in this object are no longer updatable Sealed bool `protobuf:"varint,5,opt,name=sealed,proto3" json:"sealed,omitempty"` } @@ -453,62 +453,62 @@ func init() { } var fileDescriptor_d4ef2bec3aea5528 = []byte{ - // 876 bytes of a gzipped FileDescriptorProto + // 878 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x16, 0x25, 0x59, 0x3f, 0x2b, 0xc9, 0x66, 0x36, 0x71, 0xcb, 0x0a, 0x8d, 0x2c, 0xa8, 0x40, - 0xa1, 0x36, 0x31, 0x89, 0xda, 0x01, 0x7a, 0xae, 0x5b, 0x37, 0x51, 0x1a, 0x17, 0x05, 0x65, 0xbb, - 0x40, 0x0e, 0x25, 0x28, 0x72, 0x44, 0x2d, 0x42, 0x2e, 0x59, 0xee, 0x4a, 0xb5, 0xfc, 0x14, 0x79, - 0x88, 0xf6, 0x5d, 0x72, 0x0c, 0x7a, 0x2a, 0x7a, 0x48, 0x0b, 0xfb, 0x45, 0x8a, 0xfd, 0xa1, 0xa2, - 0xd6, 0x49, 0x15, 0xe4, 0xb4, 0x9c, 0xf9, 0x66, 0x66, 0xe7, 0xe7, 0x9b, 0x25, 0xba, 0x1f, 0x2e, - 0x13, 0xa0, 0x8c, 0xa4, 0xf4, 0x62, 0x79, 0xe9, 0xac, 0x04, 0x27, 0x4f, 0xe3, 0xd8, 0xcf, 0xb2, - 0xe2, 0xb4, 0xb3, 0x3c, 0xe5, 0x29, 0xee, 0xad, 0x5b, 0xdb, 0x2b, 0xc1, 0xd6, 0x56, 0xdd, 0x3b, - 0x51, 0x1a, 0xa5, 0xd2, 0xd4, 0x11, 0x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0x21, 0xfe, - 0x00, 0xd5, 0xa6, 0x79, 0x7a, 0x09, 0xd4, 0x6a, 0xca, 0x3a, 0xb5, 0x84, 0x3f, 0x47, 0x66, 0x0e, - 0x11, 0x61, 0x1c, 0x72, 0x08, 0xbf, 0x01, 0x9a, 0x26, 0xcc, 0x42, 0xfd, 0xca, 0xb0, 0xe9, 0xde, - 0xd0, 0xe3, 0xef, 0x50, 0xa3, 0xe8, 0xaf, 0xd5, 0x92, 0xd9, 0x3b, 0xef, 0x98, 0xfd, 0x89, 0x76, - 0x73, 0x57, 0x01, 0xf0, 0x29, 0x2a, 0xf2, 0x97, 0xf3, 0xb5, 0xda, 0x32, 0xe0, 0xbd, 0x4d, 0x01, - 0x75, 0x1f, 0x46, 0x74, 0x9a, 0xea, 0x36, 0xb4, 0xa2, 0xd7, 0x2a, 0x31, 0x59, 0x42, 0x09, 0x27, - 0x7e, 0xec, 0x31, 0xf8, 0x79, 0x0e, 0x34, 0x80, 0xdc, 0xea, 0xc8, 0x66, 0x98, 0x1a, 0x18, 0x17, - 0x7a, 0xfc, 0x10, 0xd5, 0x17, 0x89, 0xc7, 0x97, 0x19, 0x58, 0xdb, 0x7d, 0x63, 0xb8, 0x7d, 0x60, - 0xbf, 0x63, 0x39, 0xf6, 0xf9, 0xc9, 0xe9, 0x32, 0x03, 0xb7, 0xb6, 0x48, 0xc4, 0x89, 0xbb, 0xa8, - 0x11, 0xfb, 0x73, 0x1a, 0xcc, 0x20, 0xb4, 0x76, 0x64, 0x7b, 0x57, 0x32, 0x7e, 0x82, 0x76, 0xb2, - 0x1c, 0x3c, 0x25, 0x7b, 0x62, 0x33, 0x2c, 0x53, 0x96, 0xda, 0xb5, 0xd5, 0xda, 0xd8, 0xc5, 0xda, - 0xd8, 0xa7, 0xc5, 0xda, 0x1c, 0x35, 0x44, 0x65, 0xcf, 0xff, 0xda, 0x33, 0xdc, 0x4e, 0x96, 0xc3, - 0x13, 0xe9, 0x2b, 0x50, 0x7c, 0x80, 0x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, 0xff, 0x7e, 0xf7, 0xb0, 0x5e, 0x44, 0x07, 0x00, 0x00, + 0x10, 0x36, 0x25, 0x59, 0x3f, 0x2b, 0xc9, 0x66, 0x36, 0x71, 0xcb, 0x0a, 0x8d, 0x24, 0xa8, 0x40, + 0xa1, 0x36, 0x31, 0x89, 0xda, 0x01, 0x7a, 0xae, 0x5b, 0x37, 0x51, 0x1a, 0x17, 0x05, 0xfd, 0x53, + 0x20, 0x87, 0x12, 0x14, 0x39, 0xa2, 0x16, 0x21, 0x97, 0x2c, 0x77, 0xa5, 0x5a, 0x7e, 0x8a, 0x3c, + 0x44, 0xfb, 0x2e, 0x3e, 0x06, 0x3d, 0x15, 0x3d, 0xb8, 0x85, 0xfd, 0x22, 0xc5, 0xfe, 0x50, 0x51, + 0xeb, 0xa4, 0x0a, 0x72, 0x5a, 0xce, 0x7c, 0x33, 0xb3, 0xf3, 0xf3, 0xcd, 0x12, 0x3d, 0x0c, 0x17, + 0x09, 0x50, 0x46, 0x52, 0x7a, 0xbe, 0xb8, 0x70, 0x96, 0x82, 0x93, 0xa7, 0x71, 0xec, 0x67, 0x59, + 0x71, 0xda, 0x59, 0x9e, 0xf2, 0x14, 0x77, 0x57, 0xad, 0xed, 0xa5, 0x60, 0x6b, 0xab, 0xce, 0xbd, + 0x28, 0x8d, 0x52, 0x69, 0xea, 0x88, 0x2f, 0xe5, 0xd5, 0xe9, 0x45, 0x69, 0x1a, 0xc5, 0xe0, 0x48, + 0x69, 0x3c, 0x9b, 0x38, 0x9c, 0x24, 0xc0, 0xb8, 0x9f, 0xe8, 0xb0, 0x9d, 0x0f, 0x83, 0x94, 0x25, + 0x29, 0x73, 0x12, 0x16, 0x39, 0xf3, 0x2f, 0xc4, 0xa1, 0x01, 0x67, 0x4d, 0x76, 0x8c, 0xfb, 0x1c, + 0x3c, 0x42, 0x27, 0xc5, 0x55, 0xbb, 0x6b, 0x1c, 0x12, 0xe0, 0x7e, 0xe8, 0x73, 0x5f, 0x99, 0x0f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+ 0xc7, 0xb3, 0x24, 0xf1, 0xf3, 0x05, 0xfe, 0x18, 0xbd, 0x7e, 0x43, 0x6e, 0x3f, 0x2a, 0xcf, 0x91, + 0x19, 0xfb, 0x1c, 0xf4, 0x98, 0x46, 0x34, 0x04, 0xd5, 0x9f, 0xe6, 0x7a, 0xd2, 0x6a, 0x8f, 0x49, + 0x2a, 0xbd, 0xdc, 0x5b, 0x71, 0x70, 0x8c, 0x3e, 0x52, 0xba, 0x6f, 0x09, 0xf5, 0x63, 0x72, 0x01, + 0xe1, 0xca, 0x25, 0xe5, 0xf7, 0xba, 0xe4, 0xed, 0x01, 0xf1, 0x00, 0xb5, 0x14, 0xa8, 0x58, 0x26, + 0xfb, 0x5c, 0x71, 0xff, 0xa5, 0xc3, 0x8f, 0xd0, 0xce, 0x7f, 0x02, 0x68, 0xe3, 0x4d, 0x69, 0xfc, + 0x66, 0xf0, 0xe0, 0xfb, 0xcb, 0xeb, 0xae, 0xf1, 0xea, 0xba, 0x6b, 0xfc, 0x7d, 0xdd, 0x35, 0x5e, + 0xde, 0x74, 0x37, 0x5e, 0xdd, 0x74, 0x37, 0xfe, 0xb8, 0xe9, 0x6e, 0x3c, 0x7f, 0xb4, 0x32, 0xbd, + 0xb7, 0xfc, 0x41, 0xe6, 0xfb, 0xce, 0xf9, 0xf2, 0x37, 0x22, 0xe7, 0x39, 0xae, 0xca, 0xcd, 0xdc, + 0xff, 0x27, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x85, 0x11, 0xf6, 0x44, 0x07, 0x00, 0x00, } func (m *RollappGenesisState) Marshal() (dAtA []byte, err error) { @@ -715,16 +715,18 @@ func (m *GenesisInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - { - size := m.InitialSupply.Size() - i -= size - if _, err := m.InitialSupply.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if m.InitialSupply != nil { + { + size := m.InitialSupply.Size() + i -= size + if _, err := m.InitialSupply.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRollapp(dAtA, i, uint64(size)) } - i = encodeVarintRollapp(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 } - i-- - dAtA[i] = 0x22 { size, err := m.NativeDenom.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -911,8 +913,10 @@ func (m *GenesisInfo) Size() (n int) { } l = m.NativeDenom.Size() n += 1 + l + sovRollapp(uint64(l)) - l = m.InitialSupply.Size() - n += 1 + l + sovRollapp(uint64(l)) + if m.InitialSupply != nil { + l = m.InitialSupply.Size() + n += 1 + l + sovRollapp(uint64(l)) + } if m.Sealed { n += 2 } @@ -1620,6 +1624,8 @@ func (m *GenesisInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + var v github_com_cosmos_cosmos_sdk_types.Int + m.InitialSupply = &v if err := m.InitialSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/sequencer/keeper/msg_server_create_sequencer_test.go b/x/sequencer/keeper/msg_server_create_sequencer_test.go index 4c35460bb..06b1ddf9c 100644 --- a/x/sequencer/keeper/msg_server_create_sequencer_test.go +++ b/x/sequencer/keeper/msg_server_create_sequencer_test.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" bankutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/dymensionxyz/sdk-utils/utils/urand" "github.com/dymensionxyz/dymension/v3/testutil/sample" @@ -129,7 +130,7 @@ func (suite *SequencerTestSuite) TestCreateSequencer() { GenesisInfo: rollapptypes.GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "1234567890abcdefg", - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), NativeDenom: rollapptypes.DenomMetadata{ Display: "DEN", Base: "aden", diff --git a/x/sequencer/keeper/sequencer_suite_test.go b/x/sequencer/keeper/sequencer_suite_test.go index 5dec46111..132db10e6 100644 --- a/x/sequencer/keeper/sequencer_suite_test.go +++ b/x/sequencer/keeper/sequencer_suite_test.go @@ -10,6 +10,7 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" bankutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" + "github.com/dymensionxyz/sdk-utils/utils/uptr" "github.com/dymensionxyz/sdk-utils/utils/urand" "github.com/stretchr/testify/suite" @@ -58,7 +59,7 @@ func (suite *SequencerTestSuite) CreateRollappWithInitialSequencer(initSeq strin Bech32Prefix: "rol", GenesisChecksum: "checksum", NativeDenom: rollapptypes.DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, - InitialSupply: sdk.NewInt(1000), + InitialSupply: uptr.To(sdk.NewInt(1000)), }, InitialSequencer: initSeq, }