diff --git a/cmd/minitiad/launch.go b/cmd/minitiad/launch.go index 9d7368bb..e7545885 100644 --- a/cmd/minitiad/launch.go +++ b/cmd/minitiad/launch.go @@ -11,6 +11,7 @@ import ( "github.com/initia-labs/OPinit/contrib/launchtools/steps" "github.com/initia-labs/initia/app/params" minitiaapp "github.com/initia-labs/minievm/app" + "github.com/initia-labs/minievm/types" ) // DefaultLaunchStepFactories is a list of default launch step factories. @@ -50,6 +51,12 @@ func LaunchCommand(ac *appCreator, enc params.EncodingConfig, mbm module.BasicMa return launchtools.LaunchCmd( ac, func(denom string) map[string]json.RawMessage { + // default denom in OPinit is "umin" + if denom == "umin" { + // convert to "GAS" + denom = types.BaseDenom + } + return minitiaapp.NewDefaultGenesisState(enc.Codec, mbm, denom) }, DefaultLaunchStepFactories, diff --git a/types/const.go b/types/const.go index 001f9d22..c1170c55 100644 --- a/types/const.go +++ b/types/const.go @@ -2,5 +2,5 @@ package types const ( // BaseDenom base denom for genesis boot - BaseDenom = "umin" + BaseDenom = "GAS" ) diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index 019f1cbc..763fd8db 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -179,6 +179,15 @@ func (ms *msgServerImpl) UpdateParams(ctx context.Context, msg *types.MsgUpdateP return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", ms.authority, msg.Authority) } + params, err := ms.Params.Get(ctx) + if err != nil { + return nil, err + } + + if params.FeeDenom != msg.Params.FeeDenom { + return nil, sdkerrors.ErrInvalidRequest.Wrap("fee denom cannot be changed") + } + // validate params if err := msg.Params.Validate(ms.ac); err != nil { return nil, err diff --git a/x/evm/keeper/msg_server_test.go b/x/evm/keeper/msg_server_test.go index 35b21cc9..3330ba6d 100644 --- a/x/evm/keeper/msg_server_test.go +++ b/x/evm/keeper/msg_server_test.go @@ -138,6 +138,15 @@ func Test_MsgServer_UpdateParams(t *testing.T) { }) require.Error(t, err) + // cannot change fee denom + params = types.DefaultParams() + params.FeeDenom = "otherdenom" + _, err = msgServer.UpdateParams(ctx, &types.MsgUpdateParams{ + Authority: input.EVMKeeper.GetAuthority(), + Params: params, + }) + require.ErrorContains(t, err, "fee denom cannot be changed") + // valid _, _, addr := keyPubAddr() params = types.DefaultParams()