diff --git a/app/app.go b/app/app.go index 40aa6cf76b..d9d42e82f8 100644 --- a/app/app.go +++ b/app/app.go @@ -412,16 +412,18 @@ func NewEthermintApp( tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer)) // Create Ethermint keepers + feeMarketSs := app.GetSubspace(feemarkettypes.ModuleName) app.FeeMarketKeeper = feemarketkeeper.NewKeeper( appCodec, authtypes.NewModuleAddress(govtypes.ModuleName), - keys[feemarkettypes.StoreKey], tkeys[feemarkettypes.TransientKey], + keys[feemarkettypes.StoreKey], tkeys[feemarkettypes.TransientKey], feeMarketSs, ) // Set authority to x/gov module account to only expect the module account to update params + evmSs := app.GetSubspace(evmtypes.ModuleName) app.EvmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper, - nil, geth.NewEVM, tracer, + nil, geth.NewEVM, tracer, evmSs, ) // Create IBC Keeper @@ -507,8 +509,8 @@ func NewEthermintApp( ibc.NewAppModule(app.IBCKeeper), transferModule, // Ethermint app modules - feemarket.NewAppModule(app.FeeMarketKeeper, app.GetSubspace(feemarkettypes.ModuleName)), - evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.GetSubspace(evmtypes.ModuleName)), + feemarket.NewAppModule(app.FeeMarketKeeper, feeMarketSs), + evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -861,7 +863,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) // ethermint subspaces - paramsKeeper.Subspace(evmtypes.ModuleName) - paramsKeeper.Subspace(feemarkettypes.ModuleName) + paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) + paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable()) return paramsKeeper } diff --git a/gomod2nix.toml b/gomod2nix.toml index bc0d27ab68..d54d7f90a2 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -112,7 +112,7 @@ schema = 3 hash = "sha256-EmpRZ48pjPFq/fIHneut9Vyo5QJATfb3ZO7KzWnqs9g=" [mod."github.com/cosmos/ibc-go/v6"] version = "v6.1.0" - hash = "sha256-Gfqhdz9ZKEgb7LCkHiXCwYZYUYluQ+vMew/GkssfVj8=" + hash = "sha256-mHYCqLedcveDjfm1EiO2EMMNJqLm9u4WHwQTy1muOoc=" [mod."github.com/cosmos/ledger-cosmos-go"] version = "v0.12.1" hash = "sha256-9+nr+/r4MyiogddS0JcXOuriPqXP4nxln8ts+mYQRcg=" @@ -406,8 +406,8 @@ schema = 3 version = "v0.9.1" hash = "sha256-YLGNrHHM+mN4ElW/XWuylOnFrA/VjSY+eBuC4LN//5c=" [mod."github.com/rs/cors"] - version = "v1.8.2" - hash = "sha256-FxBbQVb8zIoDGGaAJKfsYV0+POkh1tyX7P6A/Lk5Vsc=" + version = "v1.8.3" + hash = "sha256-VgVB4HKAhPSjNg96mIEUN1bt5ZQng8Fi3ZABy3CDWQE=" [mod."github.com/rs/zerolog"] version = "v1.27.0" hash = "sha256-BxQtP2TROeSSpj9l1irocuSfxn55UL4ugzB/og7r8eE=" @@ -523,11 +523,11 @@ schema = 3 version = "v1.6.7" hash = "sha256-zIxGRHiq4QBvRqkrhMGMGCaVL4iM4TtlYpAi/hrivS4=" [mod."google.golang.org/genproto"] - version = "v0.0.0-20221116193143-41c2ba794472" - hash = "sha256-uQuxuOvWRsdMii5M5QresisVd1E+Ss8s2WfR2n7QSXk=" + version = "v0.0.0-20221118155620-16455021b5e6" + hash = "sha256-FFSliEzgr7AceO8B+ZoPAlZDFVPLeqAFg+25VQw6cFs=" [mod."google.golang.org/grpc"] - version = "v1.51.0" - hash = "sha256-RzH5DU13D/ulxxOouIKpdNt8eHdff7mrEnB+JUupbLU=" + version = "v1.52.0" + hash = "sha256-wYJ/ysugKxz1O9u6BxECTIGFJ3sv0XmxOfM+Y0jW3KQ=" [mod."google.golang.org/protobuf"] version = "v1.28.2-0.20220831092852-f930b1dc76e8" hash = "sha256-li5hXlXwTJ5LIZ8bVki1AZ6UFI2gXHl33JwdX1dOrtM=" diff --git a/tests/integration_tests/configs/upgrade-test-package.nix b/tests/integration_tests/configs/upgrade-test-package.nix index 6b8345cef8..1863054dfb 100644 --- a/tests/integration_tests/configs/upgrade-test-package.nix +++ b/tests/integration_tests/configs/upgrade-test-package.nix @@ -3,10 +3,9 @@ let fetchEthermint = rev: builtins.fetchTarball "https://github.com/evmos/ethermint/archive/${rev}.tar.gz"; released = pkgs.buildGo118Module rec { name = "ethermintd"; - # the commit before https://github.com/evmos/ethermint/pull/943 - src = fetchEthermint "8866ae0ffd67a104e9d1cf4e50fba8391dda6c45"; + src = fetchEthermint "d29cdad6e667f6089dfecbedd36bb8d3a2a7d025"; subPackages = [ "cmd/ethermintd" ]; - vendorSha256 = "sha256-oDtMamNlwe/393fZd+RNtRy6ipWpusbco8Xg1ZuKWYw="; + vendorSha256 = "sha256-cQAol54b6hNzsA4Q3MP9mTqFWM1MvR5uMPrYpaoj3SY="; doCheck = false; }; current = pkgs.callPackage ../../../. { }; diff --git a/tests/integration_tests/cosmoscli.py b/tests/integration_tests/cosmoscli.py index 71bde8f61e..41c24c91e7 100644 --- a/tests/integration_tests/cosmoscli.py +++ b/tests/integration_tests/cosmoscli.py @@ -637,9 +637,8 @@ def edit_validator( ) def gov_propose(self, proposer, kind, proposal, **kwargs): - method = "submit-legacy-proposal" + method = "submit-proposal" kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE) - kwargs.setdefault("gas", DEFAULT_GAS) if kind == "software-upgrade": return json.loads( self.raw( @@ -649,7 +648,6 @@ def gov_propose(self, proposer, kind, proposal, **kwargs): kind, proposal["name"], "-y", - "--no-validate", from_=proposer, # content title=proposal.get("title"), diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index af06e6548f..b1cc2a3778 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -23,6 +23,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -75,6 +76,8 @@ type Keeper struct { // evm constructor function evmConstructor evm.Constructor + // Legacy subspace + ss paramstypes.Subspace } // NewKeeper generates new evm module keeper @@ -89,6 +92,7 @@ func NewKeeper( customPrecompiles evm.PrecompiledContracts, evmConstructor evm.Constructor, tracer string, + ss paramstypes.Subspace, ) *Keeper { // ensure evm module account is set if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { @@ -113,6 +117,7 @@ func NewKeeper( customPrecompiles: customPrecompiles, evmConstructor: evmConstructor, tracer: tracer, + ss: ss, } } diff --git a/x/evm/keeper/migrations_test.go b/x/evm/keeper/migrations_test.go index 0875e4dae1..604d663e1c 100644 --- a/x/evm/keeper/migrations_test.go +++ b/x/evm/keeper/migrations_test.go @@ -3,24 +3,23 @@ package keeper_test import ( sdk "github.com/cosmos/cosmos-sdk/types" evmkeeper "github.com/evmos/ethermint/x/evm/keeper" - v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types" "github.com/evmos/ethermint/x/evm/types" ) type mockSubspace struct { - ps v4types.V4Params + ps types.Params } -func newMockSubspace(ps v4types.V4Params) mockSubspace { +func newMockSubspace(ps types.Params) mockSubspace { return mockSubspace{ps: ps} } func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { - *ps.(*v4types.V4Params) = ms.ps + *ps.(*types.Params) = ms.ps } func (suite *KeeperTestSuite) TestMigrations() { - legacySubspace := newMockSubspace(v4types.DefaultParams()) + legacySubspace := newMockSubspace(types.DefaultParams()) migrator := evmkeeper.NewMigrator(*suite.app.EvmKeeper, legacySubspace) testCases := []struct { diff --git a/x/evm/keeper/params.go b/x/evm/keeper/params.go index 64f582c7f5..2ad6bd4891 100644 --- a/x/evm/keeper/params.go +++ b/x/evm/keeper/params.go @@ -48,13 +48,20 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { return nil } +// GetLegacyParams returns param set for version before migrate +func (k Keeper) GetLegacyParams(ctx sdk.Context) types.Params { + var params types.Params + k.ss.GetParamSetIfExists(ctx, ¶ms) + return params +} + // GetExtraEIPs returns the extra EIPs enabled on the chain. func (k Keeper) GetExtraEIPs(ctx sdk.Context) types.ExtraEIPs { var extraEIPs types.ExtraEIPs store := ctx.KVStore(k.storeKey) bz := store.Get(types.ParamStoreKeyExtraEIPs) if len(bz) == 0 { - return extraEIPs + return k.GetLegacyParams(ctx).ExtraEIPs } k.cdc.MustUnmarshal(bz, &extraEIPs) return extraEIPs @@ -66,7 +73,7 @@ func (k Keeper) GetChainConfig(ctx sdk.Context) types.ChainConfig { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ParamStoreKeyChainConfig) if len(bz) == 0 { - return chainCfg + return k.GetLegacyParams(ctx).ChainConfig } k.cdc.MustUnmarshal(bz, &chainCfg) return chainCfg @@ -77,7 +84,7 @@ func (k Keeper) GetEVMDenom(ctx sdk.Context) string { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ParamStoreKeyEVMDenom) if len(bz) == 0 { - return "" + return k.GetLegacyParams(ctx).EvmDenom } return string(bz) } @@ -85,19 +92,31 @@ func (k Keeper) GetEVMDenom(ctx sdk.Context) string { // GetEnableCall returns true if the EVM Call operation is enabled. func (k Keeper) GetEnableCall(ctx sdk.Context) bool { store := ctx.KVStore(k.storeKey) - return store.Has(types.ParamStoreKeyEnableCall) + exist := store.Has(types.ParamStoreKeyEnableCall) + if !exist { + exist = k.GetLegacyParams(ctx).EnableCall + } + return exist } // GetEnableCreate returns true if the EVM Create contract operation is enabled. func (k Keeper) GetEnableCreate(ctx sdk.Context) bool { store := ctx.KVStore(k.storeKey) - return store.Has(types.ParamStoreKeyEnableCreate) + exist := store.Has(types.ParamStoreKeyEnableCreate) + if !exist { + exist = k.GetLegacyParams(ctx).EnableCreate + } + return exist } // GetAllowUnprotectedTxs returns true if unprotected txs (i.e non-replay protected as per EIP-155) are supported by the chain. func (k Keeper) GetAllowUnprotectedTxs(ctx sdk.Context) bool { store := ctx.KVStore(k.storeKey) - return store.Has(types.ParamStoreKeyAllowUnprotectedTxs) + exist := store.Has(types.ParamStoreKeyAllowUnprotectedTxs) + if !exist { + exist = k.GetLegacyParams(ctx).AllowUnprotectedTxs + } + return exist } // setChainConfig sets the ChainConfig in the store diff --git a/x/evm/migrations/v4/migrate.go b/x/evm/migrations/v4/migrate.go index 0bd9c23557..f9ba9eb1b2 100644 --- a/x/evm/migrations/v4/migrate.go +++ b/x/evm/migrations/v4/migrate.go @@ -4,7 +4,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types" "github.com/evmos/ethermint/x/evm/types" ) @@ -19,7 +18,7 @@ func MigrateStore( ) error { var ( store = ctx.KVStore(storeKey) - params v4types.V4Params + params types.Params ) legacySubspace.GetParamSetIfExists(ctx, ¶ms) @@ -29,22 +28,22 @@ func MigrateStore( } chainCfgBz := cdc.MustMarshal(¶ms.ChainConfig) - extraEIPsBz := cdc.MustMarshal(&v4types.ExtraEIPs{EIPs: v4types.AvailableExtraEIPs}) + extraEIPsBz := cdc.MustMarshal(&types.ExtraEIPs{EIPs: types.AvailableExtraEIPs}) - store.Set(v4types.ParamStoreKeyEVMDenom, []byte(params.EvmDenom)) - store.Set(v4types.ParamStoreKeyExtraEIPs, extraEIPsBz) - store.Set(v4types.ParamStoreKeyChainConfig, chainCfgBz) + store.Set(types.ParamStoreKeyEVMDenom, []byte(params.EvmDenom)) + store.Set(types.ParamStoreKeyExtraEIPs, extraEIPsBz) + store.Set(types.ParamStoreKeyChainConfig, chainCfgBz) if params.AllowUnprotectedTxs { - store.Set(v4types.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01}) + store.Set(types.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01}) } if params.EnableCall { - store.Set(v4types.ParamStoreKeyEnableCall, []byte{0x01}) + store.Set(types.ParamStoreKeyEnableCall, []byte{0x01}) } if params.EnableCreate { - store.Set(v4types.ParamStoreKeyEnableCreate, []byte{0x01}) + store.Set(types.ParamStoreKeyEnableCreate, []byte{0x01}) } return nil diff --git a/x/evm/migrations/v4/migrate_test.go b/x/evm/migrations/v4/migrate_test.go index 1261380208..8cfe022368 100644 --- a/x/evm/migrations/v4/migrate_test.go +++ b/x/evm/migrations/v4/migrate_test.go @@ -11,20 +11,19 @@ import ( "github.com/evmos/ethermint/app" "github.com/evmos/ethermint/encoding" v4 "github.com/evmos/ethermint/x/evm/migrations/v4" - v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types" "github.com/stretchr/testify/require" ) type mockSubspace struct { - ps v4types.V4Params + ps types.Params } -func newMockSubspace(ps v4types.V4Params) mockSubspace { +func newMockSubspace(ps types.Params) mockSubspace { return mockSubspace{ps: ps} } func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { - *ps.(*v4types.V4Params) = ms.ps + *ps.(*types.Params) = ms.ps } func TestMigrate(t *testing.T) { @@ -36,29 +35,30 @@ func TestMigrate(t *testing.T) { ctx := testutil.DefaultContext(storeKey, tKey) kvStore := ctx.KVStore(storeKey) - legacySubspace := newMockSubspace(v4types.DefaultParams()) + legacySubspace := newMockSubspace(types.DefaultParams()) require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc)) // Get all the new parameters from the kvStore var evmDenom string - bz := kvStore.Get(v4types.ParamStoreKeyEVMDenom) + bz := kvStore.Get(types.ParamStoreKeyEVMDenom) evmDenom = string(bz) var allowUnprotectedTx gogotypes.BoolValue - bz = kvStore.Get(v4types.ParamStoreKeyAllowUnprotectedTxs) + bz = kvStore.Get(types.ParamStoreKeyAllowUnprotectedTxs) cdc.MustUnmarshal(bz, &allowUnprotectedTx) - enableCreate := kvStore.Has(v4types.ParamStoreKeyEnableCreate) - enableCall := kvStore.Has(v4types.ParamStoreKeyEnableCall) + enableCreate := kvStore.Has(types.ParamStoreKeyEnableCreate) + enableCall := kvStore.Has(types.ParamStoreKeyEnableCall) - var chainCfg v4types.ChainConfig - bz = kvStore.Get(v4types.ParamStoreKeyChainConfig) + var chainCfg types.ChainConfig + bz = kvStore.Get(types.ParamStoreKeyChainConfig) cdc.MustUnmarshal(bz, &chainCfg) - var extraEIPs v4types.ExtraEIPs - bz = kvStore.Get(v4types.ParamStoreKeyExtraEIPs) + var extraEIPs types.ExtraEIPs + bz = kvStore.Get(types.ParamStoreKeyExtraEIPs) cdc.MustUnmarshal(bz, &extraEIPs) + require.Equal(t, types.AvailableExtraEIPs, extraEIPs.EIPs) - params := v4types.NewParams(evmDenom, allowUnprotectedTx.Value, enableCreate, enableCall, chainCfg, extraEIPs) + params := types.NewParams(evmDenom, allowUnprotectedTx.Value, enableCreate, enableCall, chainCfg, extraEIPs) require.Equal(t, legacySubspace.ps, params) } diff --git a/x/evm/types/events.pb.go b/x/evm/types/events.pb.go new file mode 100644 index 0000000000..ca5ed58858 --- /dev/null +++ b/x/evm/types/events.pb.go @@ -0,0 +1,1265 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ethermint/evm/v1/events.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// EventEthereumTx defines the event for an Ethereum transaction +type EventEthereumTx struct { + // amount + Amount string `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"` + // eth_hash is the Ethereum hash of the transaction + EthHash string `protobuf:"bytes,2,opt,name=eth_hash,json=ethHash,proto3" json:"eth_hash,omitempty"` + // index of the transaction in the block + Index string `protobuf:"bytes,3,opt,name=index,proto3" json:"index,omitempty"` + // gas_used is the amount of gas used by the transaction + GasUsed string `protobuf:"bytes,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + // hash is the Tendermint hash of the transaction + Hash string `protobuf:"bytes,5,opt,name=hash,proto3" json:"hash,omitempty"` + // recipient of the transaction + Recipient string `protobuf:"bytes,6,opt,name=recipient,proto3" json:"recipient,omitempty"` + // eth_tx_failed contains a VM error should it occur + EthTxFailed string `protobuf:"bytes,7,opt,name=eth_tx_failed,json=ethTxFailed,proto3" json:"eth_tx_failed,omitempty"` +} + +func (m *EventEthereumTx) Reset() { *m = EventEthereumTx{} } +func (m *EventEthereumTx) String() string { return proto.CompactTextString(m) } +func (*EventEthereumTx) ProtoMessage() {} +func (*EventEthereumTx) Descriptor() ([]byte, []int) { + return fileDescriptor_432e0d592184bde3, []int{0} +} +func (m *EventEthereumTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventEthereumTx.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventEthereumTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventEthereumTx.Merge(m, src) +} +func (m *EventEthereumTx) XXX_Size() int { + return m.Size() +} +func (m *EventEthereumTx) XXX_DiscardUnknown() { + xxx_messageInfo_EventEthereumTx.DiscardUnknown(m) +} + +var xxx_messageInfo_EventEthereumTx proto.InternalMessageInfo + +func (m *EventEthereumTx) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +func (m *EventEthereumTx) GetEthHash() string { + if m != nil { + return m.EthHash + } + return "" +} + +func (m *EventEthereumTx) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *EventEthereumTx) GetGasUsed() string { + if m != nil { + return m.GasUsed + } + return "" +} + +func (m *EventEthereumTx) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + +func (m *EventEthereumTx) GetRecipient() string { + if m != nil { + return m.Recipient + } + return "" +} + +func (m *EventEthereumTx) GetEthTxFailed() string { + if m != nil { + return m.EthTxFailed + } + return "" +} + +// EventTxLog defines the event for an Ethereum transaction log +type EventTxLog struct { + // tx_logs is an array of transaction logs + TxLogs []string `protobuf:"bytes,1,rep,name=tx_logs,json=txLogs,proto3" json:"tx_logs,omitempty"` +} + +func (m *EventTxLog) Reset() { *m = EventTxLog{} } +func (m *EventTxLog) String() string { return proto.CompactTextString(m) } +func (*EventTxLog) ProtoMessage() {} +func (*EventTxLog) Descriptor() ([]byte, []int) { + return fileDescriptor_432e0d592184bde3, []int{1} +} +func (m *EventTxLog) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventTxLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventTxLog.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventTxLog) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventTxLog.Merge(m, src) +} +func (m *EventTxLog) XXX_Size() int { + return m.Size() +} +func (m *EventTxLog) XXX_DiscardUnknown() { + xxx_messageInfo_EventTxLog.DiscardUnknown(m) +} + +var xxx_messageInfo_EventTxLog proto.InternalMessageInfo + +func (m *EventTxLog) GetTxLogs() []string { + if m != nil { + return m.TxLogs + } + return nil +} + +// EventMessage +type EventMessage struct { + // module which emits the event + Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` + // sender of the message + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + // tx_type is the type of the message + TxType string `protobuf:"bytes,3,opt,name=tx_type,json=txType,proto3" json:"tx_type,omitempty"` +} + +func (m *EventMessage) Reset() { *m = EventMessage{} } +func (m *EventMessage) String() string { return proto.CompactTextString(m) } +func (*EventMessage) ProtoMessage() {} +func (*EventMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_432e0d592184bde3, []int{2} +} +func (m *EventMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventMessage.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventMessage.Merge(m, src) +} +func (m *EventMessage) XXX_Size() int { + return m.Size() +} +func (m *EventMessage) XXX_DiscardUnknown() { + xxx_messageInfo_EventMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_EventMessage proto.InternalMessageInfo + +func (m *EventMessage) GetModule() string { + if m != nil { + return m.Module + } + return "" +} + +func (m *EventMessage) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *EventMessage) GetTxType() string { + if m != nil { + return m.TxType + } + return "" +} + +// EventBlockBloom defines an Ethereum block bloom filter event +type EventBlockBloom struct { + // bloom is the bloom filter of the block + Bloom string `protobuf:"bytes,1,opt,name=bloom,proto3" json:"bloom,omitempty"` +} + +func (m *EventBlockBloom) Reset() { *m = EventBlockBloom{} } +func (m *EventBlockBloom) String() string { return proto.CompactTextString(m) } +func (*EventBlockBloom) ProtoMessage() {} +func (*EventBlockBloom) Descriptor() ([]byte, []int) { + return fileDescriptor_432e0d592184bde3, []int{3} +} +func (m *EventBlockBloom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBlockBloom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBlockBloom.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventBlockBloom) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBlockBloom.Merge(m, src) +} +func (m *EventBlockBloom) XXX_Size() int { + return m.Size() +} +func (m *EventBlockBloom) XXX_DiscardUnknown() { + xxx_messageInfo_EventBlockBloom.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBlockBloom proto.InternalMessageInfo + +func (m *EventBlockBloom) GetBloom() string { + if m != nil { + return m.Bloom + } + return "" +} + +func init() { + proto.RegisterType((*EventEthereumTx)(nil), "ethermint.evm.v1.EventEthereumTx") + proto.RegisterType((*EventTxLog)(nil), "ethermint.evm.v1.EventTxLog") + proto.RegisterType((*EventMessage)(nil), "ethermint.evm.v1.EventMessage") + proto.RegisterType((*EventBlockBloom)(nil), "ethermint.evm.v1.EventBlockBloom") +} + +func init() { proto.RegisterFile("ethermint/evm/v1/events.proto", fileDescriptor_432e0d592184bde3) } + +var fileDescriptor_432e0d592184bde3 = []byte{ + // 360 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x51, 0x4d, 0x4b, 0xeb, 0x40, + 0x14, 0x6d, 0x5e, 0xdb, 0xf4, 0x75, 0xde, 0x7b, 0x3c, 0x19, 0x44, 0x23, 0x68, 0x28, 0x01, 0x3f, + 0x56, 0x09, 0xc5, 0x3f, 0x20, 0x85, 0x8a, 0x0b, 0xdd, 0x48, 0x44, 0x70, 0x13, 0xd2, 0xe6, 0x9a, + 0x09, 0x66, 0x32, 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0x35, 0xe9, 0x6b, 0x23, 0xa8, + 0x79, 0xe9, 0x3d, 0x92, 0xbf, 0xa6, 0xed, 0x0e, 0xa4, 0x8c, 0x53, 0xd0, 0x86, 0xb9, 0x48, 0xea, + 0x1c, 0xbe, 0x0d, 0xb7, 0x48, 0xf3, 0x12, 0x8a, 0x04, 0xaa, 0xce, 0x6e, 0x87, 0xba, 0xc5, 0xb8, + 0x2a, 0xa1, 0xf3, 0x6b, 0xa3, 0x0a, 0x57, 0x25, 0x78, 0xe7, 0xdd, 0x33, 0x67, 0xb9, 0x58, 0xbe, + 0xcc, 0x72, 0x21, 0xb8, 0xfe, 0xcc, 0x42, 0x17, 0xdd, 0xea, 0x16, 0xcc, 0xae, 0xde, 0x36, 0xae, + 0xb5, 0xde, 0xb8, 0xd6, 0xe7, 0xc6, 0xb5, 0x5e, 0xb7, 0x6e, 0x6f, 0xbd, 0x75, 0x7b, 0x1f, 0x5b, + 0xb7, 0xf7, 0x74, 0x96, 0x66, 0xc8, 0xea, 0x85, 0xbf, 0x14, 0x5c, 0x47, 0x28, 0x64, 0xb0, 0x8b, + 0x54, 0x99, 0x50, 0xf5, 0x5d, 0xb9, 0xb0, 0x4d, 0xa2, 0x97, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x4f, 0xb6, 0xd8, 0xd7, 0xf2, 0x01, 0x00, 0x00, +} + +func (m *EventEthereumTx) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventEthereumTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventEthereumTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EthTxFailed) > 0 { + i -= len(m.EthTxFailed) + copy(dAtA[i:], m.EthTxFailed) + i = encodeVarintEvents(dAtA, i, uint64(len(m.EthTxFailed))) + i-- + dAtA[i] = 0x3a + } + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x32 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x2a + } + if len(m.GasUsed) > 0 { + i -= len(m.GasUsed) + copy(dAtA[i:], m.GasUsed) + i = encodeVarintEvents(dAtA, i, uint64(len(m.GasUsed))) + i-- + dAtA[i] = 0x22 + } + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0x1a + } + if len(m.EthHash) > 0 { + i -= len(m.EthHash) + copy(dAtA[i:], m.EthHash) + i = encodeVarintEvents(dAtA, i, uint64(len(m.EthHash))) + i-- + dAtA[i] = 0x12 + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventTxLog) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventTxLog) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventTxLog) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxLogs) > 0 { + for iNdEx := len(m.TxLogs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.TxLogs[iNdEx]) + copy(dAtA[i:], m.TxLogs[iNdEx]) + i = encodeVarintEvents(dAtA, i, uint64(len(m.TxLogs[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *EventMessage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventMessage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxType) > 0 { + i -= len(m.TxType) + copy(dAtA[i:], m.TxType) + i = encodeVarintEvents(dAtA, i, uint64(len(m.TxType))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if len(m.Module) > 0 { + i -= len(m.Module) + copy(dAtA[i:], m.Module) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Module))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBlockBloom) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventBlockBloom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBlockBloom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bloom) > 0 { + i -= len(m.Bloom) + copy(dAtA[i:], m.Bloom) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Bloom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventEthereumTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.EthHash) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Index) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.GasUsed) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.EthTxFailed) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventTxLog) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TxLogs) > 0 { + for _, s := range m.TxLogs { + l = len(s) + n += 1 + l + sovEvents(uint64(l)) + } + } + return n +} + +func (m *EventMessage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Module) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.TxType) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventBlockBloom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bloom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventEthereumTx) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventEthereumTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventEthereumTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EthHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EthHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GasUsed = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Recipient = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EthTxFailed", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EthTxFailed = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventTxLog) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventTxLog: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventTxLog: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxLogs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxLogs = append(m.TxLogs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventMessage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Module", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Module = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBlockBloom) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventBlockBloom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBlockBloom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bloom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bloom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/evm/types/params.go b/x/evm/types/params.go index dc5b714c9d..85a56b1621 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -22,6 +22,7 @@ import ( "github.com/ethereum/go-ethereum/params" sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/evmos/ethermint/types" ) @@ -56,6 +57,11 @@ var ( AvailableExtraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529} ) +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + // NewParams creates a new Params instance func NewParams(evmDenom string, allowUnprotectedTxs, enableCreate, enableCall bool, config ChainConfig, extraEIPs ExtraEIPs) Params { return Params{ @@ -81,6 +87,18 @@ func DefaultParams() Params { } } +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(ParamStoreKeyEVMDenom, &p.EvmDenom, validateEVMDenom), + paramtypes.NewParamSetPair(ParamStoreKeyEnableCreate, &p.EnableCreate, validateBool), + paramtypes.NewParamSetPair(ParamStoreKeyEnableCall, &p.EnableCall, validateBool), + paramtypes.NewParamSetPair(ParamStoreKeyExtraEIPs, &p.ExtraEIPs.EIPs, validateEIPs), + paramtypes.NewParamSetPair(ParamStoreKeyChainConfig, &p.ChainConfig, validateChainConfig), + paramtypes.NewParamSetPair(ParamStoreKeyAllowUnprotectedTxs, &p.AllowUnprotectedTxs, validateBool), + } +} + // Validate performs basic validation on evm parameters. func (p Params) Validate() error { if err := validateEVMDenom(p.EvmDenom); err != nil { diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go index f563fc5ba6..c74acf9b26 100644 --- a/x/evm/types/tx.pb.go +++ b/x/evm/types/tx.pb.go @@ -454,69 +454,68 @@ func init() { func init() { proto.RegisterFile("ethermint/evm/v1/tx.proto", fileDescriptor_f75ac0a12d075f21) } var fileDescriptor_f75ac0a12d075f21 = []byte{ - // 990 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0x5f, 0x27, 0xce, 0xbf, 0x49, 0x58, 0xaa, 0xd1, 0x56, 0x75, 0x22, 0x1a, 0xa7, 0x96, 0xa0, - 0x69, 0xa5, 0xd8, 0xea, 0x82, 0x7a, 0xd8, 0x53, 0x37, 0xdd, 0x6d, 0xd5, 0x6a, 0x57, 0x54, 0x26, - 0xbd, 0xd0, 0x43, 0x34, 0xeb, 0xcc, 0x4e, 0x2c, 0x62, 0x8f, 0xe5, 0x19, 0x5b, 0x09, 0x12, 0x97, - 0x4a, 0x48, 0x1c, 0x90, 0x00, 0xf1, 0x05, 0x38, 0x70, 0xe2, 0x84, 0x44, 0x3f, 0x00, 0xc7, 0x8a, - 0x53, 0x05, 0x17, 0xc4, 0x21, 0xa0, 0x2c, 0x12, 0xd2, 0xde, 0xe0, 0x13, 0xa0, 0x99, 0x71, 0x36, - 0x9b, 0x86, 0x6d, 0xa1, 0x14, 0x71, 0xf2, 0xbc, 0x79, 0x6f, 0xde, 0x7b, 0xf3, 0xfb, 0xfd, 0x66, - 0xc6, 0xa0, 0x8e, 0xf9, 0x10, 0xc7, 0x81, 0x1f, 0x72, 0x07, 0xa7, 0x81, 0x93, 0x5e, 0x73, 0xf8, - 0xd8, 0x8e, 0x62, 0xca, 0x29, 0x3c, 0x77, 0xe2, 0xb2, 0x71, 0x1a, 0xd8, 0xe9, 0xb5, 0xc6, 0x05, - 0x8f, 0xb2, 0x80, 0x32, 0x27, 0x60, 0x44, 0x44, 0x06, 0x8c, 0xa8, 0xd0, 0x46, 0x5d, 0x39, 0xfa, - 0xd2, 0x72, 0x94, 0x91, 0xb9, 0x1a, 0x2b, 0x05, 0x44, 0x32, 0xe5, 0xdb, 0x20, 0x94, 0x50, 0xb5, - 0x46, 0x8c, 0xb2, 0xd9, 0xd7, 0x08, 0xa5, 0x64, 0x84, 0x1d, 0x14, 0xf9,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x2e, 0x2e, 0xcb, 0x2e, 0x2e, 0x59, 0xe6, 0x6a, 0x17, 0x89, 0x8c, 0xef, - 0x2b, 0xe4, 0xba, 0x37, 0x1e, 0xcf, 0x9a, 0xda, 0x93, 0x59, 0x53, 0xfb, 0x65, 0xd6, 0xd4, 0x3e, - 0x3d, 0x6a, 0xae, 0x3d, 0x39, 0x6a, 0xae, 0xfd, 0x78, 0xd4, 0x5c, 0x7b, 0xf7, 0xf4, 0x31, 0xc4, - 0xa9, 0x38, 0x85, 0x8b, 0x54, 0x63, 0x99, 0x4c, 0x1e, 0xc5, 0x83, 0xa2, 0xfc, 0x43, 0x79, 0xf3, - 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x20, 0xbe, 0xf3, 0x9e, 0x09, 0x00, 0x00, + // 975 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x8f, 0xdb, 0xc4, + 0x17, 0x8f, 0x13, 0xe7, 0xd7, 0x24, 0xdf, 0xfd, 0x56, 0xa3, 0xad, 0xea, 0x44, 0x34, 0x0e, 0x96, + 0x80, 0xb4, 0x52, 0x6c, 0x75, 0x41, 0x3d, 0xec, 0xa9, 0x9b, 0xee, 0xb6, 0x6a, 0xb5, 0x2b, 0x2a, + 0x93, 0x5e, 0x28, 0x52, 0x34, 0x6b, 0xcf, 0x4e, 0x2c, 0x62, 0x8f, 0xe5, 0x99, 0x58, 0x09, 0x12, + 0x97, 0x9e, 0xb8, 0x01, 0xe2, 0x1f, 0xe0, 0xc0, 0x89, 0x13, 0x12, 0xfd, 0x03, 0x38, 0x56, 0x9c, + 0x2a, 0xb8, 0x20, 0x0e, 0x01, 0x65, 0x91, 0x90, 0xf6, 0x06, 0x7f, 0x01, 0x9a, 0x19, 0x67, 0xb3, + 0x69, 0xd8, 0x16, 0x4a, 0x11, 0x27, 0xcf, 0x9b, 0xf7, 0xe6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 0x6f, 0x6f, 0x3c, 0xfc, 0xf5, 0xab, 0xab, 0xcb, 0x3c, 0x56, + 0x03, 0x5c, 0x7a, 0xaa, 0xa5, 0x05, 0x76, 0x5b, 0x73, 0x0d, 0x14, 0x0e, 0x18, 0x81, 0x1f, 0x02, + 0x70, 0xe6, 0xf1, 0x35, 0xd7, 0x0b, 0xad, 0x40, 0xdf, 0x7c, 0xe3, 0x39, 0x01, 0x8b, 0xfc, 0xd6, + 0x6b, 0x0f, 0xbf, 0xff, 0xe5, 0xb3, 0xbc, 0x69, 0x5d, 0x76, 0xd6, 0x7f, 0x26, 0xb2, 0xe8, 0x01, + 0x9f, 0xc0, 0xf7, 0x40, 0x7d, 0x05, 0xb1, 0x57, 0xff, 0x34, 0xff, 0xd9, 0x90, 0xe6, 0x95, 0xe7, + 0x86, 0x2c, 0x9a, 0xe8, 0xdd, 0x78, 0x3c, 0x6f, 0x69, 0x4f, 0xe6, 0x2d, 0xed, 0xe7, 0x79, 0x4b, + 0xfb, 0xe4, 0xb8, 0x95, 0x7b, 0x72, 0xdc, 0xca, 0xfd, 0x70, 0xdc, 0xca, 0xbd, 0x7b, 0xf6, 0x70, + 0xe1, 0x54, 0x9c, 0xad, 0x65, 0x9b, 0x13, 0xd9, 0xa8, 0x3c, 0x60, 0x87, 0x25, 0xf9, 0xdf, 0xf1, + 0xe6, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xf3, 0xe0, 0xc6, 0x74, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/evm/types/tx.pb.gw.go b/x/evm/types/tx.pb.gw.go index 7bcb6a8f7d..f58f9572d6 100644 --- a/x/evm/types/tx.pb.gw.go +++ b/x/evm/types/tx.pb.gw.go @@ -69,42 +69,6 @@ func local_request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marsh } -var ( - filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgUpdateParams - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_UpdateParams_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.UpdateParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MsgUpdateParams - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_UpdateParams_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.UpdateParams(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". // UnaryRPC :call MsgServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -134,29 +98,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server }) - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Msg_UpdateParams_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -218,37 +159,13 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client }) - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Msg_UpdateParams_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } var ( pattern_Msg_EthereumTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "ethereum_tx"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Msg_EthereumTx_0 = runtime.ForwardResponseMessage - - forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage ) diff --git a/x/feemarket/keeper/keeper.go b/x/feemarket/keeper/keeper.go index 466e4b418a..3d702a545c 100644 --- a/x/feemarket/keeper/keeper.go +++ b/x/feemarket/keeper/keeper.go @@ -21,6 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/tendermint/tendermint/libs/log" "github.com/evmos/ethermint/x/feemarket/types" @@ -38,11 +39,13 @@ type Keeper struct { transientKey storetypes.StoreKey // the address capable of executing a MsgUpdateParams message. Typically, this should be the x/gov module account. authority sdk.AccAddress + // Legacy subspace + ss paramstypes.Subspace } // NewKeeper generates new fee market module keeper func NewKeeper( - cdc codec.BinaryCodec, authority sdk.AccAddress, storeKey, transientKey storetypes.StoreKey, + cdc codec.BinaryCodec, authority sdk.AccAddress, storeKey, transientKey storetypes.StoreKey, ss paramstypes.Subspace, ) Keeper { // ensure authority account is correctly formatted if err := sdk.VerifyAddressFormat(authority); err != nil { @@ -54,6 +57,7 @@ func NewKeeper( storeKey: storeKey, authority: authority, transientKey: transientKey, + ss: ss, } } diff --git a/x/feemarket/keeper/migrations_test.go b/x/feemarket/keeper/migrations_test.go index 82a90b6533..71b0bca429 100644 --- a/x/feemarket/keeper/migrations_test.go +++ b/x/feemarket/keeper/migrations_test.go @@ -3,24 +3,23 @@ package keeper_test import ( sdk "github.com/cosmos/cosmos-sdk/types" feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper" - v4types "github.com/evmos/ethermint/x/feemarket/migrations/v4/types" "github.com/evmos/ethermint/x/feemarket/types" ) type mockSubspace struct { - ps v4types.Params + ps types.Params } -func newMockSubspace(ps v4types.Params) mockSubspace { +func newMockSubspace(ps types.Params) mockSubspace { return mockSubspace{ps: ps} } func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { - *ps.(*v4types.Params) = ms.ps + *ps.(*types.Params) = ms.ps } func (suite *KeeperTestSuite) TestMigrations() { - legacySubspace := newMockSubspace(v4types.DefaultParams()) + legacySubspace := newMockSubspace(types.DefaultParams()) migrator := feemarketkeeper.NewMigrator(suite.app.FeeMarketKeeper, legacySubspace) testCases := []struct { diff --git a/x/feemarket/keeper/params.go b/x/feemarket/keeper/params.go index 4508e5f442..f8a1f3744f 100644 --- a/x/feemarket/keeper/params.go +++ b/x/feemarket/keeper/params.go @@ -28,7 +28,9 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ParamsKey) if len(bz) == 0 { - return params + var p types.Params + k.ss.GetParamSetIfExists(ctx, &p) + return p } k.cdc.MustUnmarshal(bz, ¶ms) diff --git a/x/feemarket/migrations/v4/migrate.go b/x/feemarket/migrations/v4/migrate.go index 4a1649140f..a13861e861 100644 --- a/x/feemarket/migrations/v4/migrate.go +++ b/x/feemarket/migrations/v4/migrate.go @@ -4,7 +4,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - v4types "github.com/evmos/ethermint/x/feemarket/migrations/v4/types" "github.com/evmos/ethermint/x/feemarket/types" ) @@ -19,7 +18,7 @@ func MigrateStore( ) error { var ( store = ctx.KVStore(storeKey) - params v4types.Params + params types.Params ) legacySubspace.GetParamSetIfExists(ctx, ¶ms) diff --git a/x/feemarket/migrations/v4/migrate_test.go b/x/feemarket/migrations/v4/migrate_test.go index 7980158352..959bf16e5f 100644 --- a/x/feemarket/migrations/v4/migrate_test.go +++ b/x/feemarket/migrations/v4/migrate_test.go @@ -8,25 +8,24 @@ import ( "github.com/evmos/ethermint/app" "github.com/evmos/ethermint/encoding" v4 "github.com/evmos/ethermint/x/feemarket/migrations/v4" - v4types "github.com/evmos/ethermint/x/feemarket/migrations/v4/types" "github.com/evmos/ethermint/x/feemarket/types" "github.com/stretchr/testify/require" ) type mockSubspace struct { - ps v4types.Params + ps types.Params } func newMockSubspaceEmpty() mockSubspace { return mockSubspace{} } -func newMockSubspace(ps v4types.Params) mockSubspace { +func newMockSubspace(ps types.Params) mockSubspace { return mockSubspace{ps: ps} } func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { - *ps.(*v4types.Params) = ms.ps + *ps.(*types.Params) = ms.ps } func TestMigrate(t *testing.T) { @@ -41,11 +40,11 @@ func TestMigrate(t *testing.T) { legacySubspaceEmpty := newMockSubspaceEmpty() require.Error(t, v4.MigrateStore(ctx, storeKey, legacySubspaceEmpty, cdc)) - legacySubspace := newMockSubspace(v4types.DefaultParams()) + legacySubspace := newMockSubspace(types.DefaultParams()) require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc)) - paramsBz := kvStore.Get(v4types.ParamsKey) - var params v4types.Params + paramsBz := kvStore.Get(types.ParamsKey) + var params types.Params cdc.MustUnmarshal(paramsBz, ¶ms) require.Equal(t, params, legacySubspace.ps) diff --git a/x/feemarket/types/events.pb.go b/x/feemarket/types/events.pb.go new file mode 100644 index 0000000000..0ebc8966e5 --- /dev/null +++ b/x/feemarket/types/events.pb.go @@ -0,0 +1,546 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ethermint/feemarket/v1/events.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// EventFeeMarket is the event type for the fee market module +type EventFeeMarket struct { + // base_fee for EIP-1559 blocks + BaseFee string `protobuf:"bytes,1,opt,name=base_fee,json=baseFee,proto3" json:"base_fee,omitempty"` +} + +func (m *EventFeeMarket) Reset() { *m = EventFeeMarket{} } +func (m *EventFeeMarket) String() string { return proto.CompactTextString(m) } +func (*EventFeeMarket) ProtoMessage() {} +func (*EventFeeMarket) Descriptor() ([]byte, []int) { + return fileDescriptor_c6edce8d670faff7, []int{0} +} +func (m *EventFeeMarket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventFeeMarket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventFeeMarket.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventFeeMarket) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventFeeMarket.Merge(m, src) +} +func (m *EventFeeMarket) XXX_Size() int { + return m.Size() +} +func (m *EventFeeMarket) XXX_DiscardUnknown() { + xxx_messageInfo_EventFeeMarket.DiscardUnknown(m) +} + +var xxx_messageInfo_EventFeeMarket proto.InternalMessageInfo + +func (m *EventFeeMarket) GetBaseFee() string { + if m != nil { + return m.BaseFee + } + return "" +} + +// EventBlockGas defines an Ethereum block gas event +type EventBlockGas struct { + // height of the block + Height string `protobuf:"bytes,1,opt,name=height,proto3" json:"height,omitempty"` + // amount of gas wanted by the block + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventBlockGas) Reset() { *m = EventBlockGas{} } +func (m *EventBlockGas) String() string { return proto.CompactTextString(m) } +func (*EventBlockGas) ProtoMessage() {} +func (*EventBlockGas) Descriptor() ([]byte, []int) { + return fileDescriptor_c6edce8d670faff7, []int{1} +} +func (m *EventBlockGas) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBlockGas) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBlockGas.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventBlockGas) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBlockGas.Merge(m, src) +} +func (m *EventBlockGas) XXX_Size() int { + return m.Size() +} +func (m *EventBlockGas) XXX_DiscardUnknown() { + xxx_messageInfo_EventBlockGas.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBlockGas proto.InternalMessageInfo + +func (m *EventBlockGas) GetHeight() string { + if m != nil { + return m.Height + } + return "" +} + +func (m *EventBlockGas) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +func init() { + proto.RegisterType((*EventFeeMarket)(nil), "ethermint.feemarket.v1.EventFeeMarket") + proto.RegisterType((*EventBlockGas)(nil), "ethermint.feemarket.v1.EventBlockGas") +} + +func init() { + proto.RegisterFile("ethermint/feemarket/v1/events.proto", fileDescriptor_c6edce8d670faff7) +} + +var fileDescriptor_c6edce8d670faff7 = []byte{ + // 212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x2d, 0xc9, 0x48, + 0x2d, 0xca, 0xcd, 0xcc, 0x2b, 0xd1, 0x4f, 0x4b, 0x4d, 0xcd, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xd1, + 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x83, 0x2b, 0xd2, 0x83, 0x2b, 0xd2, 0x2b, 0x33, 0x54, 0xd2, 0xe6, 0xe2, 0x73, 0x05, 0xa9, + 0x73, 0x4b, 0x4d, 0xf5, 0x05, 0x0b, 0x0a, 0x49, 0x72, 0x71, 0x24, 0x25, 0x16, 0xa7, 0xc6, 0xa7, + 0xa5, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0xb1, 0x83, 0xf8, 0x6e, 0xa9, 0xa9, 0x4a, + 0xf6, 0x5c, 0xbc, 0x60, 0xc5, 0x4e, 0x39, 0xf9, 0xc9, 0xd9, 0xee, 0x89, 0xc5, 0x42, 0x62, 0x5c, + 0x6c, 0x19, 0xa9, 0x99, 0xe9, 0x19, 0x25, 0x50, 0x95, 0x50, 0x1e, 0x48, 0x3c, 0x31, 0x37, 0xbf, + 0x34, 0xaf, 0x44, 0x82, 0x09, 0x22, 0x0e, 0xe1, 0x39, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, + 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, + 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, + 0x7e, 0x6a, 0x59, 0x6e, 0x7e, 0xb1, 0x3e, 0xc2, 0x57, 0x15, 0x48, 0xfe, 0x2a, 0xa9, 0x2c, 0x48, + 0x2d, 0x4e, 0x62, 0x03, 0x7b, 0xca, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x52, 0xc3, 0x38, + 0xfb, 0x00, 0x00, 0x00, +} + +func (m *EventFeeMarket) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventFeeMarket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventFeeMarket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BaseFee) > 0 { + i -= len(m.BaseFee) + copy(dAtA[i:], m.BaseFee) + i = encodeVarintEvents(dAtA, i, uint64(len(m.BaseFee))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBlockGas) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventBlockGas) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBlockGas) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x12 + } + if len(m.Height) > 0 { + i -= len(m.Height) + copy(dAtA[i:], m.Height) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Height))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventFeeMarket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BaseFee) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventBlockGas) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Height) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventFeeMarket) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventFeeMarket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventFeeMarket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseFee = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBlockGas) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventBlockGas: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBlockGas: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Height = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/feemarket/types/params.go b/x/feemarket/types/params.go index 6d5d718e03..a3f1f6d696 100644 --- a/x/feemarket/types/params.go +++ b/x/feemarket/types/params.go @@ -20,11 +20,10 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/ethereum/go-ethereum/params" ) -var ParamsKey = []byte("Params") - var ( // DefaultMinGasMultiplier is 0.5 or 50% DefaultMinGasMultiplier = sdk.NewDecWithPrec(50, 2) @@ -36,6 +35,36 @@ var ( DefaultNoBaseFee = false ) +// Parameter keys +var ( + ParamsKey = []byte("Params") + ParamStoreKeyNoBaseFee = []byte("NoBaseFee") + ParamStoreKeyBaseFeeChangeDenominator = []byte("BaseFeeChangeDenominator") + ParamStoreKeyElasticityMultiplier = []byte("ElasticityMultiplier") + ParamStoreKeyBaseFee = []byte("BaseFee") + ParamStoreKeyEnableHeight = []byte("EnableHeight") + ParamStoreKeyMinGasPrice = []byte("MinGasPrice") + ParamStoreKeyMinGasMultiplier = []byte("MinGasMultiplier") +) + +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(ParamStoreKeyNoBaseFee, &p.NoBaseFee, validateBool), + paramtypes.NewParamSetPair(ParamStoreKeyBaseFeeChangeDenominator, &p.BaseFeeChangeDenominator, validateBaseFeeChangeDenominator), + paramtypes.NewParamSetPair(ParamStoreKeyElasticityMultiplier, &p.ElasticityMultiplier, validateElasticityMultiplier), + paramtypes.NewParamSetPair(ParamStoreKeyBaseFee, &p.BaseFee, validateBaseFee), + paramtypes.NewParamSetPair(ParamStoreKeyEnableHeight, &p.EnableHeight, validateEnableHeight), + paramtypes.NewParamSetPair(ParamStoreKeyMinGasPrice, &p.MinGasPrice, validateMinGasPrice), + paramtypes.NewParamSetPair(ParamStoreKeyMinGasMultiplier, &p.MinGasMultiplier, validateMinGasPrice), + } +} + // NewParams creates a new Params instance func NewParams( noBaseFee bool, @@ -91,6 +120,14 @@ func (p Params) Validate() error { return validateMinGasPrice(p.MinGasPrice) } +func validateBool(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil +} + func (p *Params) IsBaseFeeEnabled(height int64) bool { return !p.NoBaseFee && height >= p.EnableHeight } @@ -113,6 +150,53 @@ func validateMinGasPrice(i interface{}) error { return nil } +func validateBaseFeeChangeDenominator(i interface{}) error { + value, ok := i.(uint32) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if value == 0 { + return fmt.Errorf("base fee change denominator cannot be 0") + } + + return nil +} + +func validateElasticityMultiplier(i interface{}) error { + _, ok := i.(uint32) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil +} + +func validateBaseFee(i interface{}) error { + value, ok := i.(sdkmath.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if value.IsNegative() { + return fmt.Errorf("base fee cannot be negative") + } + + return nil +} + +func validateEnableHeight(i interface{}) error { + value, ok := i.(int64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if value < 0 { + return fmt.Errorf("enable height cannot be negative: %d", value) + } + + return nil +} + func validateMinGasMultiplier(i interface{}) error { v, ok := i.(sdk.Dec) diff --git a/x/feemarket/types/params_test.go b/x/feemarket/types/params_test.go index 51dd16d9b2..822fb08d01 100644 --- a/x/feemarket/types/params_test.go +++ b/x/feemarket/types/params_test.go @@ -1,7 +1,6 @@ package types import ( - "fmt" "testing" sdkmath "cosmossdk.io/math" @@ -18,61 +17,6 @@ func TestParamsTestSuite(t *testing.T) { suite.Run(t, new(ParamsTestSuite)) } -func validateElasticityMultiplier(i interface{}) error { - _, ok := i.(uint32) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - return nil -} - -func validateBaseFeeChangeDenominator(i interface{}) error { - value, ok := i.(uint32) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if value == 0 { - return fmt.Errorf("base fee change denominator cannot be 0") - } - - return nil -} - -func validateEnableHeight(i interface{}) error { - value, ok := i.(int64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if value < 0 { - return fmt.Errorf("enable height cannot be negative: %d", value) - } - - return nil -} - -func validateBool(i interface{}) error { - _, ok := i.(bool) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - return nil -} - -func validateBaseFee(i interface{}) error { - value, ok := i.(sdkmath.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if value.IsNegative() { - return fmt.Errorf("base fee cannot be negative") - } - - return nil -} - func (suite *ParamsTestSuite) TestParamsValidate() { testCases := []struct { name string