diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index cce75b0e6..4fc839af9 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -56,7 +56,7 @@ func (s *KeeperTestHelper) CreateRollappByName(name string) { InitialSequencer: "*", Alias: strings.ToLower(rand.Str(7)), VmType: rollapptypes.Rollapp_EVM, - GenesisInfo: rollapptypes.GenesisInfo{ + GenesisInfo: &rollapptypes.GenesisInfo{ Bech32Prefix: strings.ToLower(rand.Str(3)), GenesisChecksum: "1234567890abcdefg", InitialSupply: sdk.NewInt(1000), diff --git a/ibctesting/utils_test.go b/ibctesting/utils_test.go index 304c23ae3..4badfe760 100644 --- a/ibctesting/utils_test.go +++ b/ibctesting/utils_test.go @@ -136,7 +136,7 @@ func (s *utilSuite) createRollapp(transfersEnabled bool, channelID *string) { Telegram: "https://t.me/rolly", X: "https://x.dymension.xyz", }, - rollapptypes.GenesisInfo{ + &rollapptypes.GenesisInfo{ GenesisChecksum: "somechecksum", Bech32Prefix: "eth", NativeDenom: rollapptypes.DenomMetadata{ diff --git a/proto/dymensionxyz/dymension/rollapp/tx.proto b/proto/dymensionxyz/dymension/rollapp/tx.proto index 55b819a6a..c9f49c9d0 100644 --- a/proto/dymensionxyz/dymension/rollapp/tx.proto +++ b/proto/dymensionxyz/dymension/rollapp/tx.proto @@ -38,7 +38,7 @@ message MsgCreateRollapp { // metadata is the rollapp metadata RollappMetadata metadata = 13; // genesis_info is the genesis information - GenesisInfo genesis_info = 14 [(gogoproto.nullable) = false ]; + GenesisInfo genesis_info = 14 [(gogoproto.nullable) = true ]; // vm_type is the type of rollapp machine: EVM or WASM Rollapp.VMType vm_type = 15; } @@ -60,7 +60,7 @@ message MsgUpdateRollappInformation { // metadata is the rollapp metadata RollappMetadata metadata = 5 [(gogoproto.nullable) = true ]; // genesis_info is the genesis information - GenesisInfo genesis_info = 6 [(gogoproto.nullable) = false ]; + GenesisInfo genesis_info = 6 [(gogoproto.nullable) = true ]; } message MsgUpdateRollappInformationResponse { diff --git a/x/denommetadata/ibc_middleware.go b/x/denommetadata/ibc_middleware.go index b9276c1dc..dcbd7c4c2 100644 --- a/x/denommetadata/ibc_middleware.go +++ b/x/denommetadata/ibc_middleware.go @@ -90,6 +90,10 @@ func (im IBCModule) OnRecvPacket( return uevent.NewErrorAcknowledgement(ctx, gerrc.ErrNotFound) } + if im.keeper.HasDenomMetadata(ctx, ibcDenom) { + return im.IBCModule.OnRecvPacket(ctx, packet, relayer) + } + dm.Base = ibcDenom dm.DenomUnits[0].Denom = dm.Base diff --git a/x/denommetadata/ibc_middleware_test.go b/x/denommetadata/ibc_middleware_test.go index b9ed3e6ca..60798e5d9 100644 --- a/x/denommetadata/ibc_middleware_test.go +++ b/x/denommetadata/ibc_middleware_test.go @@ -596,7 +596,7 @@ func (m *mockIBCModule) OnRecvPacket(_ sdk.Context, p channeltypes.Packet, _ sdk return emptyResult } -func (m *mockIBCModule) OnAcknowledgementPacket(_ sdk.Context, _ channeltypes.Packet, ack []byte, _ sdk.AccAddress) error { +func (m *mockIBCModule) OnAcknowledgementPacket(sdk.Context, channeltypes.Packet, []byte, sdk.AccAddress) error { return nil } @@ -604,7 +604,11 @@ type mockDenomMetadataKeeper struct { hasDenomMetaData, created bool } -func (m *mockDenomMetadataKeeper) CreateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error { +func (m *mockDenomMetadataKeeper) HasDenomMetadata(sdk.Context, string) bool { + return true +} + +func (m *mockDenomMetadataKeeper) CreateDenomMetadata(sdk.Context, banktypes.Metadata) error { m.created = true return nil } diff --git a/x/denommetadata/types/expected_keepers.go b/x/denommetadata/types/expected_keepers.go index 374281ce1..3fb289268 100644 --- a/x/denommetadata/types/expected_keepers.go +++ b/x/denommetadata/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank/types" + rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" ) @@ -14,6 +15,7 @@ type BankKeeper interface { type DenomMetadataKeeper interface { CreateDenomMetadata(ctx sdk.Context, metadata types.Metadata) error + HasDenomMetadata(ctx sdk.Context, base string) bool } type RollappKeeper interface { diff --git a/x/incentives/client/cli/query_test.go b/x/incentives/client/cli/query_test.go index f61aeb62d..1f6e907ef 100644 --- a/x/incentives/client/cli/query_test.go +++ b/x/incentives/client/cli/query_test.go @@ -34,7 +34,7 @@ func (suite *QueryTestSuite) CreateDefaultRollapp() string { RollappId: urand.RollappID(), Alias: strings.ToLower(tmrand.Str(7)), VmType: rollapptypes.Rollapp_EVM, - GenesisInfo: rollapptypes.GenesisInfo{ + GenesisInfo: &rollapptypes.GenesisInfo{ Bech32Prefix: strings.ToLower(tmrand.Str(3)), }, } diff --git a/x/incentives/keeper/suite_test.go b/x/incentives/keeper/suite_test.go index 54fb2b02a..db1785cbb 100644 --- a/x/incentives/keeper/suite_test.go +++ b/x/incentives/keeper/suite_test.go @@ -214,7 +214,7 @@ func (suite *KeeperTestSuite) CreateDefaultRollapp(addr sdk.AccAddress) string { InitialSequencer: addr.String(), Alias: strings.ToLower(tmrand.Str(7)), VmType: rollapptypes.Rollapp_EVM, - GenesisInfo: rollapptypes.GenesisInfo{ + GenesisInfo: &rollapptypes.GenesisInfo{ Bech32Prefix: strings.ToLower(tmrand.Str(3)), GenesisChecksum: "checksum", NativeDenom: rollapptypes.DenomMetadata{ diff --git a/x/rollapp/client/cli/tx_create_rollapp.go b/x/rollapp/client/cli/tx_create_rollapp.go index ecf0d7801..550348ed9 100644 --- a/x/rollapp/client/cli/tx_create_rollapp.go +++ b/x/rollapp/client/cli/tx_create_rollapp.go @@ -69,43 +69,43 @@ func CmdCreateRollapp() *cobra.Command { return cmd } -func parseGenesisInfo(cmd *cobra.Command) (types.GenesisInfo, error) { +func parseGenesisInfo(cmd *cobra.Command) (*types.GenesisInfo, error) { var ( - genesisInfo types.GenesisInfo + genesisInfo = &types.GenesisInfo{} err error ok bool ) genesisInfo.GenesisChecksum, err = cmd.Flags().GetString(FlagGenesisChecksum) if err != nil { - return types.GenesisInfo{}, err + return nil, err } genesisInfo.Bech32Prefix, err = cmd.Flags().GetString(FlagBech32Prefix) if err != nil { - return types.GenesisInfo{}, err + return nil, err } nativeDenomFlag, err := cmd.Flags().GetString(FlagNativeDenom) if err != nil { - return types.GenesisInfo{}, err + return nil, err } if nativeDenomFlag != "" { if err = utils.ParseJsonFromFile(nativeDenomFlag, &genesisInfo.NativeDenom); err != nil { - return types.GenesisInfo{}, err + return nil, err } } initialSupplyFlag, err := cmd.Flags().GetString(FlagInitialSupply) if err != nil { - return types.GenesisInfo{}, err + return nil, err } if initialSupplyFlag != "" { genesisInfo.InitialSupply, ok = sdk.NewIntFromString(initialSupplyFlag) if !ok { - return types.GenesisInfo{}, fmt.Errorf("invalid initial supply: %s", initialSupplyFlag) + return nil, fmt.Errorf("invalid initial supply: %s", initialSupplyFlag) } } diff --git a/x/rollapp/keeper/msg_server_create_rollapp_test.go b/x/rollapp/keeper/msg_server_create_rollapp_test.go index a81f89ab6..2f9fd373c 100644 --- a/x/rollapp/keeper/msg_server_create_rollapp_test.go +++ b/x/rollapp/keeper/msg_server_create_rollapp_test.go @@ -351,7 +351,7 @@ func (suite *RollappTestSuite) createRollappWithCreatorAndVerify( InitialSequencer: rollapp.GetInitialSequencer(), VmType: types.Rollapp_EVM, Metadata: rollapp.GetMetadata(), - GenesisInfo: rollapp.GetGenesisInfo(), + GenesisInfo: *rollapp.GetGenesisInfo(), } rollappExpect.GenesisState.TransfersEnabled = true @@ -385,7 +385,7 @@ var mockRollappMetadata = types.RollappMetadata{ X: "https://x.dymension.xyz", } -var mockGenesisInfo = types.GenesisInfo{ +var mockGenesisInfo = &types.GenesisInfo{ Bech32Prefix: "rol", GenesisChecksum: "checksum", NativeDenom: types.DenomMetadata{ diff --git a/x/rollapp/keeper/msg_server_transfer_ownership_test.go b/x/rollapp/keeper/msg_server_transfer_ownership_test.go index dce6b28a2..7daa17c46 100644 --- a/x/rollapp/keeper/msg_server_transfer_ownership_test.go +++ b/x/rollapp/keeper/msg_server_transfer_ownership_test.go @@ -25,7 +25,7 @@ func (suite *RollappTestSuite) TestTransferOwnership() { expRollapp: types.Rollapp{ Owner: bob, RollappId: rollappId, - GenesisInfo: mockGenesisInfo, + GenesisInfo: *mockGenesisInfo, }, }, { name: "Transfer rollapp ownership: failed, rollapp not found", @@ -75,7 +75,7 @@ func (suite *RollappTestSuite) TestTransferOwnership() { rollapp := types.Rollapp{ RollappId: rollappId, Owner: alice, - GenesisInfo: mockGenesisInfo, + GenesisInfo: *mockGenesisInfo, } if tc.malleate != nil { diff --git a/x/rollapp/keeper/msg_server_update_rollapp_test.go b/x/rollapp/keeper/msg_server_update_rollapp_test.go index b208cf115..90ccecbe1 100644 --- a/x/rollapp/keeper/msg_server_update_rollapp_test.go +++ b/x/rollapp/keeper/msg_server_update_rollapp_test.go @@ -33,7 +33,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { RollappId: rollappId, InitialSequencer: initialSequencerAddress, Metadata: &mockRollappMetadata, - GenesisInfo: types.GenesisInfo{ + GenesisInfo: &types.GenesisInfo{ Bech32Prefix: "new", GenesisChecksum: "new_checksum", InitialSupply: sdk.NewInt(1000), @@ -103,7 +103,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { RollappId: rollappId, InitialSequencer: "", Metadata: nil, - GenesisInfo: types.GenesisInfo{ + GenesisInfo: &types.GenesisInfo{ GenesisChecksum: "new_checksum", }, }, @@ -114,7 +114,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { update: &types.MsgUpdateRollappInformation{ Owner: alice, RollappId: rollappId, - GenesisInfo: types.GenesisInfo{ + GenesisInfo: &types.GenesisInfo{ Bech32Prefix: "new", }, }, @@ -125,7 +125,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { update: &types.MsgUpdateRollappInformation{ Owner: alice, RollappId: rollappId, - GenesisInfo: types.GenesisInfo{ + GenesisInfo: &types.GenesisInfo{ NativeDenom: types.DenomMetadata{ Display: "DEN", Base: "aden", @@ -140,7 +140,7 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { update: &types.MsgUpdateRollappInformation{ Owner: alice, RollappId: rollappId, - GenesisInfo: types.GenesisInfo{ + GenesisInfo: &types.GenesisInfo{ InitialSupply: sdk.NewInt(1000), }, }, @@ -178,6 +178,38 @@ func (suite *RollappTestSuite) TestUpdateRollapp() { Sealed: true, }, }, + }, { + name: "Update rollapp: success - unsealed, update rollapp without genesis info", + update: &types.MsgUpdateRollappInformation{ + Owner: alice, + RollappId: rollappId, + Metadata: &mockRollappMetadata, + }, + rollappLaunched: false, + genInfoSealed: false, + expError: nil, + expRollapp: types.Rollapp{ + RollappId: rollappId, + Owner: alice, + InitialSequencer: "", + ChannelId: "", + Frozen: false, + RegisteredDenoms: nil, + Launched: false, + VmType: types.Rollapp_EVM, + Metadata: &mockRollappMetadata, + GenesisInfo: types.GenesisInfo{ + Bech32Prefix: "old", + GenesisChecksum: "old", + InitialSupply: sdk.NewInt(1000), + NativeDenom: types.DenomMetadata{ + Display: "OLD", + Base: "aold", + Exponent: 18, + }, + Sealed: false, + }, + }, }, } @@ -238,7 +270,7 @@ func (suite *RollappTestSuite) TestCreateAndUpdateRollapp() { InitialSequencer: "", Alias: "default", VmType: types.Rollapp_EVM, - GenesisInfo: types.GenesisInfo{ + GenesisInfo: &types.GenesisInfo{ Bech32Prefix: "rol", GenesisChecksum: "checksum", InitialSupply: sdk.NewInt(1000), @@ -265,7 +297,7 @@ func (suite *RollappTestSuite) TestCreateAndUpdateRollapp() { Owner: alice, RollappId: rollappId, InitialSequencer: addrInit, - GenesisInfo: types.GenesisInfo{GenesisChecksum: "checksum1"}, + GenesisInfo: &types.GenesisInfo{GenesisChecksum: "checksum1"}, }) suite.Require().NoError(err) diff --git a/x/rollapp/keeper/msg_server_update_state_test.go b/x/rollapp/keeper/msg_server_update_state_test.go index 08a040acd..d4aacfe0f 100644 --- a/x/rollapp/keeper/msg_server_update_state_test.go +++ b/x/rollapp/keeper/msg_server_update_state_test.go @@ -191,7 +191,7 @@ func (suite *RollappTestSuite) TestUpdateStateErrLogicUnpermissioned() { RollappId: rollappID, Owner: alice, InitialSequencer: sample.AccAddress(), - GenesisInfo: mockGenesisInfo, + GenesisInfo: *mockGenesisInfo, } suite.App.RollappKeeper.SetRollapp(suite.Ctx, rollapp) diff --git a/x/rollapp/keeper/rollapp.go b/x/rollapp/keeper/rollapp.go index dfa610aa6..9c20bae31 100644 --- a/x/rollapp/keeper/rollapp.go +++ b/x/rollapp/keeper/rollapp.go @@ -40,20 +40,22 @@ func (k Keeper) CheckAndUpdateRollappFields(ctx sdk.Context, update *types.MsgUp current.InitialSequencer = update.InitialSequencer } - if update.GenesisInfo.GenesisChecksum != "" { - current.GenesisInfo.GenesisChecksum = update.GenesisInfo.GenesisChecksum - } + if update.GenesisInfo != nil { + if update.GenesisInfo.GenesisChecksum != "" { + current.GenesisInfo.GenesisChecksum = update.GenesisInfo.GenesisChecksum + } - if update.GenesisInfo.Bech32Prefix != "" { - current.GenesisInfo.Bech32Prefix = update.GenesisInfo.Bech32Prefix - } + if update.GenesisInfo.Bech32Prefix != "" { + current.GenesisInfo.Bech32Prefix = update.GenesisInfo.Bech32Prefix + } - if update.GenesisInfo.NativeDenom.Base != "" { - current.GenesisInfo.NativeDenom = update.GenesisInfo.NativeDenom - } + if update.GenesisInfo.NativeDenom.Base != "" { + current.GenesisInfo.NativeDenom = update.GenesisInfo.NativeDenom + } - if !update.GenesisInfo.InitialSupply.IsNil() { - current.GenesisInfo.InitialSupply = update.GenesisInfo.InitialSupply + if !update.GenesisInfo.InitialSupply.IsNil() { + current.GenesisInfo.InitialSupply = update.GenesisInfo.InitialSupply + } } if update.Metadata != nil && !update.Metadata.IsEmpty() { @@ -141,6 +143,11 @@ func (k Keeper) SetIROPlanToRollapp(ctx sdk.Context, rollapp *types.Rollapp, pre if rollapp.Launched { return errorsmod.Wrap(gerrc.ErrFailedPrecondition, "rollapp already launched") } + + if rollapp.GenesisInfo.Sealed { + return errorsmod.Wrap(gerrc.ErrFailedPrecondition, "genesis info already sealed") + } + if !rollapp.GenesisInfoFieldsAreSet() { return errorsmod.Wrap(gerrc.ErrFailedPrecondition, "genesis info not set") } diff --git a/x/rollapp/simulation/create_rollapp.go b/x/rollapp/simulation/create_rollapp.go index 2c4694983..c43b09dbc 100644 --- a/x/rollapp/simulation/create_rollapp.go +++ b/x/rollapp/simulation/create_rollapp.go @@ -41,7 +41,7 @@ func SimulateMsgCreateRollapp(ak simulationtypes.AccountKeeper, bk simulationtyp Telegram: "https://t.me/rolly", X: "https://x.dymension.xyz", }, - GenesisInfo: types.GenesisInfo{ + GenesisInfo: &types.GenesisInfo{ GenesisChecksum: "checksum", Bech32Prefix: "bech", NativeDenom: types.DenomMetadata{ diff --git a/x/rollapp/types/message_create_rollapp.go b/x/rollapp/types/message_create_rollapp.go index c666b8d64..96a792fbf 100644 --- a/x/rollapp/types/message_create_rollapp.go +++ b/x/rollapp/types/message_create_rollapp.go @@ -15,7 +15,7 @@ func NewMsgCreateRollapp( alias string, vmType Rollapp_VMType, metadata *RollappMetadata, - genesisInfo GenesisInfo, + genesisInfo *GenesisInfo, ) *MsgCreateRollapp { return &MsgCreateRollapp{ Creator: creator, @@ -50,13 +50,17 @@ func (msg *MsgCreateRollapp) GetSignBytes() []byte { } func (msg *MsgCreateRollapp) GetRollapp() Rollapp { + genInfo := GenesisInfo{} + if msg.GenesisInfo != nil { + genInfo = *msg.GenesisInfo + } return NewRollapp( msg.Creator, msg.RollappId, msg.InitialSequencer, msg.VmType, msg.Metadata, - msg.GenesisInfo, + genInfo, true, ) } diff --git a/x/rollapp/types/message_create_rollapp_test.go b/x/rollapp/types/message_create_rollapp_test.go index 8de44d17d..ce9fdd803 100644 --- a/x/rollapp/types/message_create_rollapp_test.go +++ b/x/rollapp/types/message_create_rollapp_test.go @@ -28,7 +28,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { InitialSequencer: sample.AccAddress(), Alias: "Rollapp", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -55,7 +55,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: " ", Alias: "Rollapp", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -72,7 +72,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "Rollapp", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -89,7 +89,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "Rollapp", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -105,7 +105,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "Rollapp", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -122,7 +122,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "Rollapp", VmType: Rollapp_WASM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -139,7 +139,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "Rollapp", VmType: Rollapp_WASM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -158,7 +158,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "Rollapp", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -175,7 +175,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "Rollapp", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: "DYM", GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -192,7 +192,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "alias", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -214,7 +214,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "alias", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: strings.Repeat("a", maxGenesisChecksumLength+1), NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -231,7 +231,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "alias", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -251,7 +251,7 @@ func TestMsgCreateRollapp_ValidateBasic(t *testing.T) { RollappId: "dym_100-1", Alias: "alias", VmType: Rollapp_EVM, - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, diff --git a/x/rollapp/types/message_update_rollapp.go b/x/rollapp/types/message_update_rollapp.go index fc3963f61..a571be23f 100644 --- a/x/rollapp/types/message_update_rollapp.go +++ b/x/rollapp/types/message_update_rollapp.go @@ -3,7 +3,9 @@ package types import ( "errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dymensionxyz/gerr-cosmos/gerrc" ) const TypeMsgUpdateRollappInformation = "update_rollapp" @@ -15,7 +17,7 @@ func NewMsgUpdateRollappInformation( rollappId, initSequencer string, metadata *RollappMetadata, - genesisInfo GenesisInfo, + genesisInfo *GenesisInfo, ) *MsgUpdateRollappInformation { return &MsgUpdateRollappInformation{ Owner: creator, @@ -55,13 +57,15 @@ func (msg *MsgUpdateRollappInformation) ValidateBasic() error { } } - if len(msg.GenesisInfo.GenesisChecksum) > maxGenesisChecksumLength { - return ErrInvalidGenesisChecksum - } + if msg.GenesisInfo != nil { + if len(msg.GenesisInfo.GenesisChecksum) > maxGenesisChecksumLength { + return ErrInvalidGenesisChecksum + } - if msg.GenesisInfo.Bech32Prefix != "" { - if err := validateBech32Prefix(msg.GenesisInfo.Bech32Prefix); err != nil { - return errors.Join(ErrInvalidBech32Prefix, err) + if msg.GenesisInfo.Bech32Prefix != "" { + if err := validateBech32Prefix(msg.GenesisInfo.Bech32Prefix); err != nil { + return errorsmod.Wrap(errors.Join(err, gerrc.ErrInvalidArgument), "bech32 prefix") + } } } @@ -79,6 +83,9 @@ func (msg *MsgUpdateRollappInformation) UpdatingImmutableValues() bool { } func (msg *MsgUpdateRollappInformation) UpdatingGenesisInfo() bool { + if msg.GenesisInfo == nil { + return false + } return msg.GenesisInfo.GenesisChecksum != "" || msg.GenesisInfo.Bech32Prefix != "" || msg.GenesisInfo.NativeDenom.Base != "" || diff --git a/x/rollapp/types/message_update_rollapp_test.go b/x/rollapp/types/message_update_rollapp_test.go index ce1141849..c74fdd0b1 100644 --- a/x/rollapp/types/message_update_rollapp_test.go +++ b/x/rollapp/types/message_update_rollapp_test.go @@ -22,7 +22,7 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Owner: sample.AccAddress(), RollappId: "dym_100-1", InitialSequencer: sample.AccAddress(), - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -51,7 +51,7 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Owner: sample.AccAddress(), InitialSequencer: "invalid_address", RollappId: "dym_100-1", - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -66,7 +66,7 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Owner: sample.AccAddress(), InitialSequencer: sample.AccAddress(), RollappId: "dym_100-1", - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: "checksum", NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -86,7 +86,7 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { Owner: sample.AccAddress(), InitialSequencer: sample.AccAddress(), RollappId: "dym_100-1", - GenesisInfo: GenesisInfo{ + GenesisInfo: &GenesisInfo{ Bech32Prefix: bech32Prefix, GenesisChecksum: strings.Repeat("a", maxGenesisChecksumLength+1), NativeDenom: DenomMetadata{Display: "DEN", Base: "aden", Exponent: 18}, @@ -95,6 +95,16 @@ func TestMsgUpdateRollappInformation_ValidateBasic(t *testing.T) { }, err: ErrInvalidGenesisChecksum, }, + { + name: "valid: updating without genesis info", + msg: MsgUpdateRollappInformation{ + Owner: sample.AccAddress(), + InitialSequencer: sample.AccAddress(), + RollappId: "dym_100-1", + GenesisInfo: nil, + }, + err: nil, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/rollapp/types/tx.pb.go b/x/rollapp/types/tx.pb.go index feec6f50a..991e960fa 100644 --- a/x/rollapp/types/tx.pb.go +++ b/x/rollapp/types/tx.pb.go @@ -44,7 +44,7 @@ type MsgCreateRollapp struct { // metadata is the rollapp metadata Metadata *RollappMetadata `protobuf:"bytes,13,opt,name=metadata,proto3" json:"metadata,omitempty"` // genesis_info is the genesis information - GenesisInfo GenesisInfo `protobuf:"bytes,14,opt,name=genesis_info,json=genesisInfo,proto3" json:"genesis_info"` + GenesisInfo *GenesisInfo `protobuf:"bytes,14,opt,name=genesis_info,json=genesisInfo,proto3" json:"genesis_info,omitempty"` // vm_type is the type of rollapp machine: EVM or WASM VmType Rollapp_VMType `protobuf:"varint,15,opt,name=vm_type,json=vmType,proto3,enum=dymensionxyz.dymension.rollapp.Rollapp_VMType" json:"vm_type,omitempty"` } @@ -117,11 +117,11 @@ func (m *MsgCreateRollapp) GetMetadata() *RollappMetadata { return nil } -func (m *MsgCreateRollapp) GetGenesisInfo() GenesisInfo { +func (m *MsgCreateRollapp) GetGenesisInfo() *GenesisInfo { if m != nil { return m.GenesisInfo } - return GenesisInfo{} + return nil } func (m *MsgCreateRollapp) GetVmType() Rollapp_VMType { @@ -180,7 +180,7 @@ type MsgUpdateRollappInformation struct { // metadata is the rollapp metadata Metadata *RollappMetadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` // genesis_info is the genesis information - GenesisInfo GenesisInfo `protobuf:"bytes,6,opt,name=genesis_info,json=genesisInfo,proto3" json:"genesis_info"` + GenesisInfo *GenesisInfo `protobuf:"bytes,6,opt,name=genesis_info,json=genesisInfo,proto3" json:"genesis_info,omitempty"` } func (m *MsgUpdateRollappInformation) Reset() { *m = MsgUpdateRollappInformation{} } @@ -244,11 +244,11 @@ func (m *MsgUpdateRollappInformation) GetMetadata() *RollappMetadata { return nil } -func (m *MsgUpdateRollappInformation) GetGenesisInfo() GenesisInfo { +func (m *MsgUpdateRollappInformation) GetGenesisInfo() *GenesisInfo { if m != nil { return m.GenesisInfo } - return GenesisInfo{} + return nil } type MsgUpdateRollappInformationResponse struct { @@ -1032,7 +1032,7 @@ func init() { } var fileDescriptor_1a86300fb8647ecb = []byte{ - // 1047 bytes of a gzipped FileDescriptorProto + // 1048 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, 0x17, 0xcf, 0xda, 0x8e, 0x7f, 0x3c, 0x3b, 0xfe, 0x3a, 0xf3, 0x8d, 0xc2, 0xe2, 0x16, 0xd7, 0x75, 0x84, 0x08, 0xb4, 0xd8, 0x34, 0x0d, 0x08, 0x02, 0x97, 0xa4, 0x91, 0xda, 0x82, 0x4c, 0x61, 0x1b, @@ -1053,52 +1053,52 @@ var fileDescriptor_1a86300fb8647ecb = []byte{ 0x64, 0x7a, 0x49, 0x2a, 0x84, 0x1b, 0xf4, 0x11, 0xe4, 0x63, 0xe0, 0xfa, 0x4a, 0x5d, 0xdb, 0x2c, 0x6e, 0xb5, 0x9a, 0xf3, 0xcb, 0xd0,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f, 0x75, 0x3a, 0xfa, 0x55, - 0x1a, 0x06, 0x98, 0x1d, 0x65, 0xe5, 0xbf, 0xc4, 0xfd, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc4, - 0xab, 0x08, 0x89, 0x59, 0x0d, 0x00, 0x00, + 0x87, 0xa1, 0xcd, 0x63, 0xff, 0x98, 0xec, 0x65, 0x9e, 0xff, 0x79, 0x4b, 0x33, 0x8a, 0xf6, 0x48, + 0x84, 0x1e, 0x42, 0x6e, 0xe0, 0x75, 0xf8, 0x30, 0xc0, 0xfa, 0xff, 0xea, 0xda, 0x66, 0x79, 0xab, + 0x99, 0x10, 0x61, 0xf3, 0xb0, 0x7d, 0x30, 0x0c, 0xb0, 0x91, 0x1d, 0x78, 0xe2, 0xbb, 0x53, 0xfa, + 0xfa, 0xef, 0x9f, 0xdf, 0x88, 0xb9, 0xfd, 0x30, 0x93, 0x4f, 0x57, 0x8a, 0x8d, 0x2a, 0xe8, 0x97, + 0xeb, 0x61, 0x60, 0x16, 0x10, 0x9f, 0xe1, 0xc6, 0xaf, 0x29, 0xb8, 0xd1, 0x66, 0xf6, 0x67, 0x81, + 0x35, 0x3a, 0x14, 0x88, 0xa8, 0x67, 0x72, 0x87, 0xf8, 0x82, 0x51, 0x72, 0xe2, 0xe3, 0xb8, 0x6a, + 0xe1, 0xe6, 0x5a, 0x35, 0x4b, 0xcf, 0xa8, 0xd9, 0xa7, 0x63, 0xd5, 0x59, 0xbe, 0x56, 0x75, 0x22, + 0x42, 0x67, 0xd7, 0x28, 0xfb, 0x5f, 0xd4, 0x68, 0x07, 0x04, 0xb5, 0x21, 0x01, 0x8d, 0x57, 0x61, + 0x63, 0x0e, 0x6b, 0x8a, 0xdd, 0x5f, 0x52, 0x50, 0x56, 0x7a, 0x4f, 0xb9, 0xc9, 0xf1, 0x9c, 0x46, + 0xb8, 0x09, 0x23, 0x0a, 0x27, 0x39, 0xad, 0x43, 0x91, 0x71, 0x93, 0xf2, 0x47, 0x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+ 0x95, 0x86, 0x01, 0x66, 0x47, 0x59, 0xf9, 0x2f, 0x71, 0xff, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x6d, 0x1c, 0x48, 0x7b, 0x59, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1458,16 +1458,18 @@ func (m *MsgCreateRollapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x78 } - { - size, err := m.GenesisInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.GenesisInfo != nil { + { + size, err := m.GenesisInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x72 } - i-- - dAtA[i] = 0x72 if m.Metadata != nil { { size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) @@ -1554,16 +1556,18 @@ func (m *MsgUpdateRollappInformation) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l - { - size, err := m.GenesisInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.GenesisInfo != nil { + { + size, err := m.GenesisInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 } - i-- - dAtA[i] = 0x32 if m.Metadata != nil { { size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) @@ -2149,8 +2153,10 @@ func (m *MsgCreateRollapp) Size() (n int) { l = m.Metadata.Size() n += 1 + l + sovTx(uint64(l)) } - l = m.GenesisInfo.Size() - n += 1 + l + sovTx(uint64(l)) + if m.GenesisInfo != nil { + l = m.GenesisInfo.Size() + n += 1 + l + sovTx(uint64(l)) + } if m.VmType != 0 { n += 1 + sovTx(uint64(m.VmType)) } @@ -2188,8 +2194,10 @@ func (m *MsgUpdateRollappInformation) Size() (n int) { l = m.Metadata.Size() n += 1 + l + sovTx(uint64(l)) } - l = m.GenesisInfo.Size() - n += 1 + l + sovTx(uint64(l)) + if m.GenesisInfo != nil { + l = m.GenesisInfo.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2655,6 +2663,9 @@ func (m *MsgCreateRollapp) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.GenesisInfo == nil { + m.GenesisInfo = &GenesisInfo{} + } if err := m.GenesisInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2939,6 +2950,9 @@ func (m *MsgUpdateRollappInformation) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.GenesisInfo == nil { + m.GenesisInfo = &GenesisInfo{} + } if err := m.GenesisInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err }