From 8bbf86e464753e949bdac5bc002e89e7ea8c5154 Mon Sep 17 00:00:00 2001 From: Nick DeLuca Date: Wed, 3 May 2023 17:05:33 -0700 Subject: [PATCH] Nd unify legacy evm subspace usage (#22) * enable registration of feemarket legacy param key table registration to prevent panics when using the feemarket keeper with a vanilla subspace * touch up some comments for clarity, remove unused line * add some tests that enforce keeper registration of the key table in addition to ensuring that the migration stays compatible when a subpsace is shared between the module (and thus the migration) and the keeper which is a common setup in app.go * add test for current bug in legacy merge fork block fetching where value is not fetched and converted into new params structure * get tests passing by using true legacy parameters in keeper and converting them to new params; this fixes key table incompatibility with the migration and a bug where the merge split block renamed value is not set from the historical state * refactor legacy param handling in migration (non-state breaking) and in keeper to simplify logic; avoid additional registration of types on proto codec; remove unused v2 migration code; and avoid copying of EIP712 data in parameters during conversion by using the same concrete type * remove dead code * add test to ensure nil params do not panic for legacy historical queries * fix test error from rebasing onto migration paramstore refactor * remove oboselete test now that store migrations use an indepent subpsace and it is not passed as an argument anymore * refactor to use a shared legacy param store to avoid injecting param keys and amino codec through keeper to migrator. Both keeper and migrator are tested to ensure proper key table registraion that does not conflict and to ensure historical params are fetchable * add additional test to ensure store registors it's own key table when needed * remove unused private member --- app/app.go | 5 +- x/evm/keeper/keeper.go | 16 +- x/evm/keeper/migrations.go | 6 +- x/evm/keeper/params.go | 42 +- x/evm/keeper/params_test.go | 149 + x/evm/migrations/v2/store.go | 231 - x/evm/migrations/v2/store_test.go | 45 - x/evm/migrations/v2/types/evm.pb.go | 4664 ----------------- x/evm/migrations/v3/store.go | 68 +- x/evm/migrations/v3/store_test.go | 229 +- .../v2/types => types/legacy}/chain_config.go | 44 +- x/evm/types/legacy/evm.pb.go | 71 + .../v2/types => types/legacy}/params.go | 41 +- x/evm/types/legacy/testutil/helper.go | 123 + x/evm/types/params_legacy.go | 53 - x/feemarket/keeper/keeper.go | 4 + x/feemarket/keeper/params_test.go | 53 + 17 files changed, 625 insertions(+), 5219 deletions(-) delete mode 100644 x/evm/migrations/v2/store.go delete mode 100644 x/evm/migrations/v2/store_test.go delete mode 100644 x/evm/migrations/v2/types/evm.pb.go rename x/evm/{migrations/v2/types => types/legacy}/chain_config.go (84%) create mode 100644 x/evm/types/legacy/evm.pb.go rename x/evm/{migrations/v2/types => types/legacy}/params.go (82%) create mode 100644 x/evm/types/legacy/testutil/helper.go delete mode 100644 x/evm/types/params_legacy.go diff --git a/app/app.go b/app/app.go index 2c2256c456..e828c0e11f 100644 --- a/app/app.go +++ b/app/app.go @@ -124,6 +124,7 @@ import ( "github.com/evmos/ethermint/x/evm" evmkeeper "github.com/evmos/ethermint/x/evm/keeper" evmtypes "github.com/evmos/ethermint/x/evm/types" + legacyevmtypes "github.com/evmos/ethermint/x/evm/types/legacy" "github.com/evmos/ethermint/x/evm/vm/geth" "github.com/evmos/ethermint/x/feemarket" feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper" @@ -418,7 +419,7 @@ func NewEthermintApp( // 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, cdc, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey], + appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper, nil, geth.NewEVM, tracer, evmSs, @@ -861,7 +862,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) // ethermint subspaces - paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) //nolint: staticcheck + paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(legacyevmtypes.ParamKeyTable()) //nolint: staticcheck paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable()) return paramsKeeper } diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 79288b696e..9c47491d8d 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -34,6 +34,7 @@ import ( ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" + legacytypes "github.com/evmos/ethermint/x/evm/types/legacy" evm "github.com/evmos/ethermint/x/evm/vm" ) @@ -41,8 +42,6 @@ import ( type Keeper struct { // Protobuf codec cdc codec.BinaryCodec - // Amino Codec used for legacy parameters - legacyAmino *codec.LegacyAmino // Store key required for the EVM Prefix KVStore. It is required by: // - storing account's Storage State // - storing account's Code @@ -53,10 +52,6 @@ type Keeper struct { // key to access the transient store, which is reset on every block during Commit transientKey storetypes.StoreKey - // keys used by migrator and interaction with legacy parameter store - paramStoreKey storetypes.StoreKey - paramStoreTKey storetypes.StoreKey - // the address capable of executing a MsgUpdateParams message. Typically, this should be the x/gov module account. authority sdk.AccAddress // access to account state @@ -89,9 +84,7 @@ type Keeper struct { // NewKeeper generates new evm module keeper func NewKeeper( cdc codec.BinaryCodec, - legacyAmino *codec.LegacyAmino, storeKey, transientKey storetypes.StoreKey, - paramStoreKey, paramStoreTKey storetypes.StoreKey, authority sdk.AccAddress, ak types.AccountKeeper, bankKeeper types.BankKeeper, @@ -112,10 +105,13 @@ func NewKeeper( panic(err) } + if !ss.HasKeyTable() { + ss = ss.WithKeyTable(legacytypes.ParamKeyTable()) + } + // NOTE: we pass in the parameter space to the CommitStateDB in order to use custom denominations for the EVM operations return &Keeper{ cdc: cdc, - legacyAmino: legacyAmino, authority: authority, accountKeeper: ak, bankKeeper: bankKeeper, @@ -123,8 +119,6 @@ func NewKeeper( feeMarketKeeper: fmk, storeKey: storeKey, transientKey: transientKey, - paramStoreKey: paramStoreKey, - paramStoreTKey: paramStoreTKey, customPrecompiles: customPrecompiles, evmConstructor: evmConstructor, tracer: tracer, diff --git a/x/evm/keeper/migrations.go b/x/evm/keeper/migrations.go index 646def4d96..4c268e045a 100644 --- a/x/evm/keeper/migrations.go +++ b/x/evm/keeper/migrations.go @@ -36,10 +36,8 @@ func NewMigrator(keeper Keeper) Migrator { func (m Migrator) Migrate2to3(ctx sdk.Context) error { return v3.MigrateStore( ctx, - m.keeper.cdc, - m.keeper.legacyAmino, + m.keeper.ss, m.keeper.storeKey, - m.keeper.paramStoreKey, - m.keeper.paramStoreTKey, + m.keeper.cdc, ) } diff --git a/x/evm/keeper/params.go b/x/evm/keeper/params.go index 4ecd953192..3bc7fa2b01 100644 --- a/x/evm/keeper/params.go +++ b/x/evm/keeper/params.go @@ -18,6 +18,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/evmos/ethermint/x/evm/types" + legacytypes "github.com/evmos/ethermint/x/evm/types/legacy" ) // GetParams returns the total set of evm parameters. @@ -49,7 +50,44 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { // 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) + var legacyParams legacytypes.LegacyParams + k.ss.GetParamSetIfExists(ctx, &legacyParams) + + newChainConfig := types.ChainConfig{ + HomesteadBlock: legacyParams.ChainConfig.HomesteadBlock, + DAOForkBlock: legacyParams.ChainConfig.DAOForkBlock, + DAOForkSupport: legacyParams.ChainConfig.DAOForkSupport, + EIP150Block: legacyParams.ChainConfig.EIP150Block, + EIP150Hash: legacyParams.ChainConfig.EIP150Hash, + EIP155Block: legacyParams.ChainConfig.EIP155Block, + EIP158Block: legacyParams.ChainConfig.EIP158Block, + ByzantiumBlock: legacyParams.ChainConfig.ByzantiumBlock, + ConstantinopleBlock: legacyParams.ChainConfig.ConstantinopleBlock, + PetersburgBlock: legacyParams.ChainConfig.PetersburgBlock, + IstanbulBlock: legacyParams.ChainConfig.IstanbulBlock, + MuirGlacierBlock: legacyParams.ChainConfig.MuirGlacierBlock, + BerlinBlock: legacyParams.ChainConfig.BerlinBlock, + LondonBlock: legacyParams.ChainConfig.LondonBlock, + ArrowGlacierBlock: legacyParams.ChainConfig.ArrowGlacierBlock, + + // This is an old field, but renamed from mergeForkBlock + MergeNetsplitBlock: legacyParams.ChainConfig.MergeForkBlock, + + // New fields are nil + GrayGlacierBlock: nil, + ShanghaiBlock: nil, + CancunBlock: nil, + } + + params := types.Params{ + EvmDenom: legacyParams.EvmDenom, + EnableCreate: legacyParams.EnableCreate, + EnableCall: legacyParams.EnableCall, + ExtraEIPs: legacyParams.ExtraEIPs, + ChainConfig: newChainConfig, + EIP712AllowedMsgs: legacyParams.EIP712AllowedMsgs, + AllowUnprotectedTxs: false, // Upstream v1 to v2 + } + return params } diff --git a/x/evm/keeper/params_test.go b/x/evm/keeper/params_test.go index 9831043073..af64009aab 100644 --- a/x/evm/keeper/params_test.go +++ b/x/evm/keeper/params_test.go @@ -3,7 +3,18 @@ package keeper_test import ( "reflect" + sdkmath "cosmossdk.io/math" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/evmos/ethermint/app" + "github.com/evmos/ethermint/encoding" + "github.com/evmos/ethermint/x/evm/keeper" "github.com/evmos/ethermint/x/evm/types" + legacytypes "github.com/evmos/ethermint/x/evm/types/legacy" + legacytestutil "github.com/evmos/ethermint/x/evm/types/legacy/testutil" + "github.com/evmos/ethermint/x/evm/vm/geth" ) func (suite *KeeperTestSuite) TestParams() { @@ -98,3 +109,141 @@ func (suite *KeeperTestSuite) TestParams() { }) } } + +func (suite *KeeperTestSuite) TestLegacyParamsKeyTableRegistration() { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + paramStoreKey := sdk.NewKVStoreKey(paramtypes.ModuleName) + paramStoreTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) + ctx := legacytestutil.NewDBContext([]storetypes.StoreKey{storeKey, paramStoreKey}, []storetypes.StoreKey{tKey, paramStoreTKey}) + ak := suite.app.AccountKeeper + + // paramspace used only for setting legacy parameters (not given to keeper) + setParamSpace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ).WithKeyTable(legacytypes.ParamKeyTable()) + params := legacytypes.DefaultParams() + params.EIP712AllowedMsgs = legacytestutil.TestEIP712AllowedMsgs + setParamSpace.SetParamSet(ctx, ¶ms) + + // param space that has not been created with a key table + unregisteredSubspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ) + + // assertion required to ensure we are testing correctness + // of a keeper receiving a subpsace without a key table registration + suite.Require().False(unregisteredSubspace.HasKeyTable()) + + newKeeper := func() *keeper.Keeper { + // create a keeper, mimicking an app.go which has not registered the key table + return keeper.NewKeeper( + cdc, storeKey, tKey, authtypes.NewModuleAddress("gov"), + ak, + nil, nil, nil, nil, // OK to pass nil in for these since we only instantiate and use params + geth.NewEVM, + "", + unregisteredSubspace, + ) + } + k := newKeeper() + + // the keeper must set the key table + var fetchedParams types.Params + suite.Require().NotPanics(func() { fetchedParams = k.GetParams(ctx) }) + // this modifies the internal data of the subspace, so we should see the key table registered + suite.Require().True(unregisteredSubspace.HasKeyTable()) + // ensure returned params are equal to the set legacy parameters + legacytestutil.AssertParamsEqual(suite.T(), params, fetchedParams) + // ensure we do not attempt to override any existing key tables to keep compatibility + // when passing a subpsace to the keeper that has already been used to work with parameters + suite.Require().NotPanics(func() { newKeeper() }) +} + +func (suite *KeeperTestSuite) TestRenamedFieldReturnsProperValueForLegacyParams() { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + paramStoreKey := sdk.NewKVStoreKey(paramtypes.ModuleName) + paramStoreTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) + ctx := legacytestutil.NewDBContext([]storetypes.StoreKey{storeKey, paramStoreKey}, []storetypes.StoreKey{tKey, paramStoreTKey}) + ak := suite.app.AccountKeeper + + // paramspace used only for setting legacy parameters (not given to keeper) + legacyParamstore := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ).WithKeyTable(legacytypes.ParamKeyTable()) + + oldParams := legacytypes.DefaultParams() + // ensure this is set regardless of default param refactoring + mergeBlock := sdkmath.NewInt(9999) + oldParams.ChainConfig.MergeForkBlock = &mergeBlock + // set legacy params with merge block set + legacyParamstore.SetParamSet(ctx, &oldParams) + + // new subspace for keeper, mimicking what a new binary would do + subspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ) + k := keeper.NewKeeper( + cdc, storeKey, tKey, authtypes.NewModuleAddress("gov"), + ak, + nil, nil, nil, nil, + geth.NewEVM, + "", + subspace, + ) + + params := k.GetParams(ctx) + + suite.Require().Equal(params.ChainConfig.MergeNetsplitBlock, oldParams.ChainConfig.MergeForkBlock) +} + +func (suite *KeeperTestSuite) TestNilLegacyParamsDoNotPanic() { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + paramStoreKey := sdk.NewKVStoreKey(paramtypes.ModuleName) + paramStoreTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) + ctx := legacytestutil.NewDBContext([]storetypes.StoreKey{storeKey, paramStoreKey}, []storetypes.StoreKey{tKey, paramStoreTKey}) + ak := suite.app.AccountKeeper + + subspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ) + + k := keeper.NewKeeper( + cdc, storeKey, tKey, authtypes.NewModuleAddress("gov"), + ak, + nil, nil, nil, nil, // OK to pass nil in for these since we only instantiate and use params + geth.NewEVM, + "", + subspace, + ) + + suite.Require().NotPanics(func() { k.GetParams(ctx) }) +} diff --git a/x/evm/migrations/v2/store.go b/x/evm/migrations/v2/store.go deleted file mode 100644 index 55da00e127..0000000000 --- a/x/evm/migrations/v2/store.go +++ /dev/null @@ -1,231 +0,0 @@ -package v2 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/evmos/ethermint/x/evm/types" -) - -var ( - NewAllowedMsgs = []types.EIP712AllowedMsg{ - // x/evmutil - { - MsgTypeUrl: "/kava.evmutil.v1beta1.MsgConvertERC20ToCoin", - MsgValueTypeName: "MsgValueEVMConvertERC20ToCoin", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "initiator", Type: "string"}, - {Name: "receiver", Type: "string"}, - {Name: "kava_erc20_address", Type: "string"}, - {Name: "amount", Type: "string"}, - }, - }, - { - MsgTypeUrl: "/kava.evmutil.v1beta1.MsgConvertCoinToERC20", - MsgValueTypeName: "MsgValueEVMConvertCoinToERC20", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "initiator", Type: "string"}, - {Name: "receiver", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - // x/earn - { - MsgTypeUrl: "/kava.earn.v1beta1.MsgDeposit", - MsgValueTypeName: "MsgValueEarnDeposit", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "depositor", Type: "string"}, - {Name: "amount", Type: "Coin"}, - {Name: "strategy", Type: "int32"}, - }, - }, - { - MsgTypeUrl: "/kava.earn.v1beta1.MsgWithdraw", - MsgValueTypeName: "MsgValueEarnWithdraw", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "from", Type: "string"}, - {Name: "amount", Type: "Coin"}, - {Name: "strategy", Type: "int32"}, - }, - }, - // x/staking - { - MsgTypeUrl: "/cosmos.staking.v1beta1.MsgDelegate", - MsgValueTypeName: "MsgValueStakingDelegate", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "delegator_address", Type: "string"}, - {Name: "validator_address", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - { - MsgTypeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", - MsgValueTypeName: "MsgValueStakingUndelegate", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "delegator_address", Type: "string"}, - {Name: "validator_address", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - { - MsgTypeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", - MsgValueTypeName: "MsgValueStakingBeginRedelegate", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "delegator_address", Type: "string"}, - {Name: "validator_src_address", Type: "string"}, - {Name: "validator_dst_address", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - // x/incentive - { - MsgTypeUrl: "/kava.incentive.v1beta1.MsgClaimUSDXMintingReward", - MsgValueTypeName: "MsgValueIncentiveClaimUSDXMintingReward", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "sender", Type: "string"}, - {Name: "multiplier_name", Type: "string"}, - }, - }, - { - MsgTypeUrl: "/kava.incentive.v1beta1.MsgClaimHardReward", - MsgValueTypeName: "MsgValueIncentiveClaimHardReward", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "sender", Type: "string"}, - {Name: "denoms_to_claim", Type: "IncentiveSelection[]"}, - }, - NestedTypes: []types.EIP712NestedMsgType{ - { - Name: "IncentiveSelection", - Attrs: []types.EIP712MsgAttrType{ - {Name: "denom", Type: "string"}, - {Name: "multiplier_name", Type: "string"}, - }, - }, - }, - }, - { - MsgTypeUrl: "/kava.incentive.v1beta1.MsgClaimDelegatorReward", - MsgValueTypeName: "MsgValueIncentiveClaimDelegatorReward", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "sender", Type: "string"}, - {Name: "denoms_to_claim", Type: "IncentiveSelection[]"}, - }, - NestedTypes: []types.EIP712NestedMsgType{ - { - Name: "IncentiveSelection", - Attrs: []types.EIP712MsgAttrType{ - {Name: "denom", Type: "string"}, - {Name: "multiplier_name", Type: "string"}, - }, - }, - }, - }, - { - MsgTypeUrl: "/kava.incentive.v1beta1.MsgClaimSwapReward", - MsgValueTypeName: "MsgValueIncentiveClaimSwapReward", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "sender", Type: "string"}, - {Name: "denoms_to_claim", Type: "IncentiveSelection[]"}, - }, - NestedTypes: []types.EIP712NestedMsgType{ - { - Name: "IncentiveSelection", - Attrs: []types.EIP712MsgAttrType{ - {Name: "denom", Type: "string"}, - {Name: "multiplier_name", Type: "string"}, - }, - }, - }, - }, - { - MsgTypeUrl: "/kava.incentive.v1beta1.MsgClaimSavingsReward", - MsgValueTypeName: "MsgValueIncentiveClaimSavingsReward", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "sender", Type: "string"}, - {Name: "denoms_to_claim", Type: "IncentiveSelection[]"}, - }, - NestedTypes: []types.EIP712NestedMsgType{ - { - Name: "IncentiveSelection", - Attrs: []types.EIP712MsgAttrType{ - {Name: "denom", Type: "string"}, - {Name: "multiplier_name", Type: "string"}, - }, - }, - }, - }, - { - MsgTypeUrl: "/kava.incentive.v1beta1.MsgClaimEarnReward", - MsgValueTypeName: "MsgValueIncentiveClaimEarnReward", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "sender", Type: "string"}, - {Name: "denoms_to_claim", Type: "IncentiveSelection[]"}, - }, - NestedTypes: []types.EIP712NestedMsgType{ - { - Name: "IncentiveSelection", - Attrs: []types.EIP712MsgAttrType{ - {Name: "denom", Type: "string"}, - {Name: "multiplier_name", Type: "string"}, - }, - }, - }, - }, - // x/router - { - MsgTypeUrl: "/kava.router.v1beta1.MsgMintDeposit", - MsgValueTypeName: "MsgValueRouterMintDeposit", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "depositor", Type: "string"}, - {Name: "validator", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - { - MsgTypeUrl: "/kava.router.v1beta1.MsgDelegateMintDeposit", - MsgValueTypeName: "MsgValueRouterDelegateMintDeposit", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "depositor", Type: "string"}, - {Name: "validator", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - { - MsgTypeUrl: "/kava.router.v1beta1.MsgWithdrawBurn", - MsgValueTypeName: "MsgValueRouterWithdrawBurn", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "from", Type: "string"}, - {Name: "validator", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - { - MsgTypeUrl: "/kava.router.v1beta1.MsgWithdrawBurnUndelegate", - MsgValueTypeName: "MsgValueRouterWithdrawBurnUndelegate", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "from", Type: "string"}, - {Name: "validator", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - // x/gov - { - MsgTypeUrl: "/cosmos.gov.v1beta1.MsgVote", - MsgValueTypeName: "MsgValueGovVote", - ValueTypes: []types.EIP712MsgAttrType{ - {Name: "proposal_id", Type: "uint64"}, - {Name: "voter", Type: "string"}, - {Name: "option", Type: "int32"}, - }, - }, - } -) - -// MigrateStore sets the default AllowUnprotectedTxs parameter. -func MigrateStore(ctx sdk.Context, paramstore *paramtypes.Subspace) error { - if !paramstore.HasKeyTable() { - ps := paramstore.WithKeyTable(types.ParamKeyTable()) - paramstore = &ps - } - paramstore.Set(ctx, types.ParamStoreKeyEIP712AllowedMsgs, NewAllowedMsgs) - return nil -} diff --git a/x/evm/migrations/v2/store_test.go b/x/evm/migrations/v2/store_test.go deleted file mode 100644 index 082bd9dc58..0000000000 --- a/x/evm/migrations/v2/store_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package v2_test - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/evmos/ethermint/encoding" - - "github.com/evmos/ethermint/app" - v2 "github.com/evmos/ethermint/x/evm/migrations/v2" - v2types "github.com/evmos/ethermint/x/evm/migrations/v2/types" - "github.com/evmos/ethermint/x/evm/types" -) - -func TestMigrateStore(t *testing.T) { - encCfg := encoding.MakeConfig(app.ModuleBasics) - kvStoreKey := sdk.NewKVStoreKey(types.StoreKey) - tStoreKey := sdk.NewTransientStoreKey(fmt.Sprintf("%s_test", types.StoreKey)) - ctx := testutil.DefaultContext(kvStoreKey, tStoreKey) - paramstore := paramtypes.NewSubspace( - encCfg.Codec, encCfg.Amino, kvStoreKey, tStoreKey, "evm", - ).WithKeyTable(v2types.ParamKeyTable()) - params := v2types.DefaultParams() - paramstore.SetParamSet(ctx, ¶ms) - - require.Panics(t, func() { - var result []types.EIP712AllowedMsg - paramstore.Get(ctx, types.ParamStoreKeyEIP712AllowedMsgs, &result) - }) - - paramstore = paramtypes.NewSubspace( - encCfg.Codec, encCfg.Amino, kvStoreKey, tStoreKey, "evm", - ).WithKeyTable(types.ParamKeyTable()) - err := v2.MigrateStore(ctx, ¶mstore) - require.NoError(t, err) - - var result []types.EIP712AllowedMsg - paramstore.Get(ctx, types.ParamStoreKeyEIP712AllowedMsgs, &result) - require.Equal(t, v2.NewAllowedMsgs, result) -} diff --git a/x/evm/migrations/v2/types/evm.pb.go b/x/evm/migrations/v2/types/evm.pb.go deleted file mode 100644 index 11a5d52062..0000000000 --- a/x/evm/migrations/v2/types/evm.pb.go +++ /dev/null @@ -1,4664 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ethermint/evm/v1/evm.proto - -package types - -import ( - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - 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 - -// V2Params defines the EVM module parameters -type V2Params struct { - // evm denom represents the token denomination used to run the EVM state - // transitions. - EvmDenom string `protobuf:"bytes,1,opt,name=evm_denom,json=evmDenom,proto3" json:"evm_denom,omitempty" yaml:"evm_denom"` - // enable create toggles state transitions that use the vm.Create function - EnableCreate bool `protobuf:"varint,2,opt,name=enable_create,json=enableCreate,proto3" json:"enable_create,omitempty" yaml:"enable_create"` - // enable call toggles state transitions that use the vm.Call function - EnableCall bool `protobuf:"varint,3,opt,name=enable_call,json=enableCall,proto3" json:"enable_call,omitempty" yaml:"enable_call"` - // extra eips defines the additional EIPs for the vm.Config - ExtraEIPs []int64 `protobuf:"varint,4,rep,packed,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty" yaml:"extra_eips"` - // chain config defines the EVM chain configuration parameters - ChainConfig V2ChainConfig `protobuf:"bytes,5,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config" yaml:"chain_config"` - // list of allowed eip712 msgs and their types - EIP712AllowedMsgs []V2EIP712AllowedMsg `protobuf:"bytes,6,rep,name=eip712_allowed_msgs,json=eip712AllowedMsgs,proto3" json:"eip712_allowed_msgs"` -} - -func (m *V2Params) Reset() { *m = V2Params{} } -func (m *V2Params) String() string { return proto.CompactTextString(m) } -func (*V2Params) ProtoMessage() {} -func (*V2Params) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{0} -} -func (m *V2Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *V2Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *V2Params) XXX_Size() int { - return m.Size() -} -func (m *V2Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *V2Params) GetEvmDenom() string { - if m != nil { - return m.EvmDenom - } - return "" -} - -func (m *V2Params) GetEnableCreate() bool { - if m != nil { - return m.EnableCreate - } - return false -} - -func (m *V2Params) GetEnableCall() bool { - if m != nil { - return m.EnableCall - } - return false -} - -func (m *V2Params) GetExtraEIPs() []int64 { - if m != nil { - return m.ExtraEIPs - } - return nil -} - -func (m *V2Params) GetChainConfig() V2ChainConfig { - if m != nil { - return m.ChainConfig - } - return V2ChainConfig{} -} - -func (m *V2Params) GetEIP712AllowedMsgs() []V2EIP712AllowedMsg { - if m != nil { - return m.EIP712AllowedMsgs - } - return nil -} - -// V2ChainConfig defines the Ethereum V2ChainConfig parameters using *sdk.Int values -// instead of *big.Int. -type V2ChainConfig struct { - // Homestead switch block (nil no fork, 0 = already homestead) - HomesteadBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=homestead_block,json=homesteadBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"homestead_block,omitempty" yaml:"homestead_block"` - // TheDAO hard-fork switch block (nil no fork) - DAOForkBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=dao_fork_block,json=daoForkBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"dao_fork_block,omitempty" yaml:"dao_fork_block"` - // Whether the nodes supports or opposes the DAO hard-fork - DAOForkSupport bool `protobuf:"varint,3,opt,name=dao_fork_support,json=daoForkSupport,proto3" json:"dao_fork_support,omitempty" yaml:"dao_fork_support"` - // EIP150 implements the Gas price changes - // (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork) - EIP150Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=eip150_block,json=eip150Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip150_block,omitempty" yaml:"eip150_block"` - // EIP150 HF hash (needed for header only clients as only gas pricing changed) - EIP150Hash string `protobuf:"bytes,5,opt,name=eip150_hash,json=eip150Hash,proto3" json:"eip150_hash,omitempty" yaml:"byzantium_block"` - // EIP155Block HF block - EIP155Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=eip155_block,json=eip155Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip155_block,omitempty" yaml:"eip155_block"` - // EIP158 HF block - EIP158Block *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=eip158_block,json=eip158Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip158_block,omitempty" yaml:"eip158_block"` - // Byzantium switch block (nil no fork, 0 = already on byzantium) - ByzantiumBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=byzantium_block,json=byzantiumBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"byzantium_block,omitempty" yaml:"byzantium_block"` - // Constantinople switch block (nil no fork, 0 = already activated) - ConstantinopleBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=constantinople_block,json=constantinopleBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"constantinople_block,omitempty" yaml:"constantinople_block"` - // Petersburg switch block (nil same as Constantinople) - PetersburgBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=petersburg_block,json=petersburgBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"petersburg_block,omitempty" yaml:"petersburg_block"` - // Istanbul switch block (nil no fork, 0 = already on istanbul) - IstanbulBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=istanbul_block,json=istanbulBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"istanbul_block,omitempty" yaml:"istanbul_block"` - // Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated) - MuirGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,12,opt,name=muir_glacier_block,json=muirGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"muir_glacier_block,omitempty" yaml:"muir_glacier_block"` - // Berlin switch block (nil = no fork, 0 = already on berlin) - BerlinBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,13,opt,name=berlin_block,json=berlinBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"berlin_block,omitempty" yaml:"berlin_block"` - // London switch block (nil = no fork, 0 = already on london) - LondonBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,17,opt,name=london_block,json=londonBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"london_block,omitempty" yaml:"london_block"` - // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) - ArrowGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,18,opt,name=arrow_glacier_block,json=arrowGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"arrow_glacier_block,omitempty" yaml:"arrow_glacier_block"` - // EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in merge proceedings) - MergeForkBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,19,opt,name=merge_fork_block,json=mergeForkBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"merge_fork_block,omitempty" yaml:"merge_fork_block"` -} - -func (m *V2ChainConfig) Reset() { *m = V2ChainConfig{} } -func (m *V2ChainConfig) String() string { return proto.CompactTextString(m) } -func (*V2ChainConfig) ProtoMessage() {} -func (*V2ChainConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{1} -} -func (m *V2ChainConfig) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ChainConfig.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 *V2ChainConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChainConfig.Merge(m, src) -} -func (m *V2ChainConfig) XXX_Size() int { - return m.Size() -} -func (m *V2ChainConfig) XXX_DiscardUnknown() { - xxx_messageInfo_ChainConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_ChainConfig proto.InternalMessageInfo - -func (m *V2ChainConfig) GetDAOForkSupport() bool { - if m != nil { - return m.DAOForkSupport - } - return false -} - -func (m *V2ChainConfig) GetEIP150Hash() string { - if m != nil { - return m.EIP150Hash - } - return "" -} - -// V2State represents a single Storage key value pair item. -type V2State struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *V2State) Reset() { *m = V2State{} } -func (m *V2State) String() string { return proto.CompactTextString(m) } -func (*V2State) ProtoMessage() {} -func (*V2State) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{2} -} -func (m *V2State) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_State.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 *V2State) XXX_Merge(src proto.Message) { - xxx_messageInfo_State.Merge(m, src) -} -func (m *V2State) XXX_Size() int { - return m.Size() -} -func (m *V2State) XXX_DiscardUnknown() { - xxx_messageInfo_State.DiscardUnknown(m) -} - -var xxx_messageInfo_State proto.InternalMessageInfo - -func (m *V2State) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *V2State) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -// V2TransactionLogs define the logs generated from a transaction execution -// with a given hash. It it used for import/export data as transactions are not -// persisted on blockchain state after an upgrade. -type V2TransactionLogs struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - Logs []*V2Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` -} - -func (m *V2TransactionLogs) Reset() { *m = V2TransactionLogs{} } -func (m *V2TransactionLogs) String() string { return proto.CompactTextString(m) } -func (*V2TransactionLogs) ProtoMessage() {} -func (*V2TransactionLogs) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{3} -} -func (m *V2TransactionLogs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2TransactionLogs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TransactionLogs.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 *V2TransactionLogs) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionLogs.Merge(m, src) -} -func (m *V2TransactionLogs) XXX_Size() int { - return m.Size() -} -func (m *V2TransactionLogs) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionLogs.DiscardUnknown(m) -} - -var xxx_messageInfo_TransactionLogs proto.InternalMessageInfo - -func (m *V2TransactionLogs) GetHash() string { - if m != nil { - return m.Hash - } - return "" -} - -func (m *V2TransactionLogs) GetLogs() []*V2Log { - if m != nil { - return m.Logs - } - return nil -} - -// V2Log represents an protobuf compatible Ethereum V2Log that defines a contract -// log event. These events are generated by the LOG opcode and stored/indexed by -// the node. -type V2Log struct { - // address of the contract that generated the event - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // list of topics provided by the contract. - Topics []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"` - // supplied by the contract, usually ABI-encoded - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - // block in which the transaction was included - BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"` - // hash of the transaction - TxHash string `protobuf:"bytes,5,opt,name=tx_hash,json=txHash,proto3" json:"transactionHash"` - // index of the transaction in the block - TxIndex uint64 `protobuf:"varint,6,opt,name=tx_index,json=txIndex,proto3" json:"transactionIndex"` - // hash of the block in which the transaction was included - BlockHash string `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` - // index of the log in the block - Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"logIndex"` - // The Removed field is true if this log was reverted due to a chain - // reorganisation. You must pay attention to this field if you receive logs - // through a filter query. - Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed,omitempty"` -} - -func (m *V2Log) Reset() { *m = V2Log{} } -func (m *V2Log) String() string { return proto.CompactTextString(m) } -func (*V2Log) ProtoMessage() {} -func (*V2Log) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{4} -} -func (m *V2Log) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Log.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 *V2Log) XXX_Merge(src proto.Message) { - xxx_messageInfo_Log.Merge(m, src) -} -func (m *V2Log) XXX_Size() int { - return m.Size() -} -func (m *V2Log) XXX_DiscardUnknown() { - xxx_messageInfo_Log.DiscardUnknown(m) -} - -var xxx_messageInfo_Log proto.InternalMessageInfo - -func (m *V2Log) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *V2Log) GetTopics() []string { - if m != nil { - return m.Topics - } - return nil -} - -func (m *V2Log) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *V2Log) GetBlockNumber() uint64 { - if m != nil { - return m.BlockNumber - } - return 0 -} - -func (m *V2Log) GetTxHash() string { - if m != nil { - return m.TxHash - } - return "" -} - -func (m *V2Log) GetTxIndex() uint64 { - if m != nil { - return m.TxIndex - } - return 0 -} - -func (m *V2Log) GetBlockHash() string { - if m != nil { - return m.BlockHash - } - return "" -} - -func (m *V2Log) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *V2Log) GetRemoved() bool { - if m != nil { - return m.Removed - } - return false -} - -// V2TxResult stores results of Tx execution. -type V2TxResult struct { - // contract_address contains the ethereum address of the created contract (if - // any). If the state transition is an evm.Call, the contract address will be - // empty. - ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty" yaml:"contract_address"` - // bloom represents the bloom filter bytes - Bloom []byte `protobuf:"bytes,2,opt,name=bloom,proto3" json:"bloom,omitempty"` - // tx_logs contains the transaction hash and the proto-compatible ethereum - // logs. - TxLogs V2TransactionLogs `protobuf:"bytes,3,opt,name=tx_logs,json=txLogs,proto3" json:"tx_logs" yaml:"tx_logs"` - // ret defines the bytes from the execution. - Ret []byte `protobuf:"bytes,4,opt,name=ret,proto3" json:"ret,omitempty"` - // reverted flag is set to true when the call has been reverted - Reverted bool `protobuf:"varint,5,opt,name=reverted,proto3" json:"reverted,omitempty"` - // gas_used notes the amount of gas consumed while execution - GasUsed uint64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` -} - -func (m *V2TxResult) Reset() { *m = V2TxResult{} } -func (m *V2TxResult) String() string { return proto.CompactTextString(m) } -func (*V2TxResult) ProtoMessage() {} -func (*V2TxResult) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{5} -} -func (m *V2TxResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxResult.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 *V2TxResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxResult.Merge(m, src) -} -func (m *V2TxResult) XXX_Size() int { - return m.Size() -} -func (m *V2TxResult) XXX_DiscardUnknown() { - xxx_messageInfo_TxResult.DiscardUnknown(m) -} - -var xxx_messageInfo_TxResult proto.InternalMessageInfo - -// V2AccessTuple is the element type of an access list. -type V2AccessTuple struct { - // hex formatted ethereum address - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // hex formatted hashes of the storage keys - StorageKeys []string `protobuf:"bytes,2,rep,name=storage_keys,json=storageKeys,proto3" json:"storageKeys"` -} - -func (m *V2AccessTuple) Reset() { *m = V2AccessTuple{} } -func (m *V2AccessTuple) String() string { return proto.CompactTextString(m) } -func (*V2AccessTuple) ProtoMessage() {} -func (*V2AccessTuple) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{6} -} -func (m *V2AccessTuple) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AccessTuple.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 *V2AccessTuple) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccessTuple.Merge(m, src) -} -func (m *V2AccessTuple) XXX_Size() int { - return m.Size() -} -func (m *V2AccessTuple) XXX_DiscardUnknown() { - xxx_messageInfo_AccessTuple.DiscardUnknown(m) -} - -var xxx_messageInfo_AccessTuple proto.InternalMessageInfo - -// V2TraceConfig holds extra parameters to trace functions. -type V2TraceConfig struct { - // custom javascript tracer - Tracer string `protobuf:"bytes,1,opt,name=tracer,proto3" json:"tracer,omitempty"` - // overrides the default timeout of 5 seconds for JavaScript-based tracing - // calls - Timeout string `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"` - // number of blocks the tracer is willing to go back - Reexec uint64 `protobuf:"varint,3,opt,name=reexec,proto3" json:"reexec,omitempty"` - // disable stack capture - DisableStack bool `protobuf:"varint,5,opt,name=disable_stack,json=disableStack,proto3" json:"disableStack"` - // disable storage capture - DisableStorage bool `protobuf:"varint,6,opt,name=disable_storage,json=disableStorage,proto3" json:"disableStorage"` - // print output during capture end - Debug bool `protobuf:"varint,8,opt,name=debug,proto3" json:"debug,omitempty"` - // maximum length of output, but zero means unlimited - Limit int32 `protobuf:"varint,9,opt,name=limit,proto3" json:"limit,omitempty"` - // Chain overrides, can be used to execute a trace using future fork rules - Overrides *V2ChainConfig `protobuf:"bytes,10,opt,name=overrides,proto3" json:"overrides,omitempty"` - // enable memory capture - EnableMemory bool `protobuf:"varint,11,opt,name=enable_memory,json=enableMemory,proto3" json:"enableMemory"` - // enable return data capture - EnableReturnData bool `protobuf:"varint,12,opt,name=enable_return_data,json=enableReturnData,proto3" json:"enableReturnData"` -} - -func (m *V2TraceConfig) Reset() { *m = V2TraceConfig{} } -func (m *V2TraceConfig) String() string { return proto.CompactTextString(m) } -func (*V2TraceConfig) ProtoMessage() {} -func (*V2TraceConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{7} -} -func (m *V2TraceConfig) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TraceConfig.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 *V2TraceConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_TraceConfig.Merge(m, src) -} -func (m *V2TraceConfig) XXX_Size() int { - return m.Size() -} -func (m *V2TraceConfig) XXX_DiscardUnknown() { - xxx_messageInfo_TraceConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_TraceConfig proto.InternalMessageInfo - -func (m *V2TraceConfig) GetTracer() string { - if m != nil { - return m.Tracer - } - return "" -} - -func (m *V2TraceConfig) GetTimeout() string { - if m != nil { - return m.Timeout - } - return "" -} - -func (m *V2TraceConfig) GetReexec() uint64 { - if m != nil { - return m.Reexec - } - return 0 -} - -func (m *V2TraceConfig) GetDisableStack() bool { - if m != nil { - return m.DisableStack - } - return false -} - -func (m *V2TraceConfig) GetDisableStorage() bool { - if m != nil { - return m.DisableStorage - } - return false -} - -func (m *V2TraceConfig) GetDebug() bool { - if m != nil { - return m.Debug - } - return false -} - -func (m *V2TraceConfig) GetLimit() int32 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *V2TraceConfig) GetOverrides() *V2ChainConfig { - if m != nil { - return m.Overrides - } - return nil -} - -func (m *V2TraceConfig) GetEnableMemory() bool { - if m != nil { - return m.EnableMemory - } - return false -} - -func (m *V2TraceConfig) GetEnableReturnData() bool { - if m != nil { - return m.EnableReturnData - } - return false -} - -// V2EIP712AllowedMsg stores an allowed legacy msg and its eip712 type. -type V2EIP712AllowedMsg struct { - // msg's proto type name. ie "/cosmos.bank.v1beta1.MsgSend" - MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` - // name of the eip712 value type. ie "MsgValueSend" - MsgValueTypeName string `protobuf:"bytes,2,opt,name=msg_value_type_name,json=msgValueTypeName,proto3" json:"msg_value_type_name,omitempty"` - // types of the msg value - ValueTypes []V2EIP712MsgAttrType `protobuf:"bytes,3,rep,name=value_types,json=valueTypes,proto3" json:"value_types"` - // nested types of the msg value - NestedTypes []V2EIP712NestedMsgType `protobuf:"bytes,4,rep,name=nested_types,json=nestedTypes,proto3" json:"nested_types"` -} - -func (m *V2EIP712AllowedMsg) Reset() { *m = V2EIP712AllowedMsg{} } -func (m *V2EIP712AllowedMsg) String() string { return proto.CompactTextString(m) } -func (*V2EIP712AllowedMsg) ProtoMessage() {} -func (*V2EIP712AllowedMsg) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{8} -} -func (m *V2EIP712AllowedMsg) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2EIP712AllowedMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EIP712AllowedMsg.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 *V2EIP712AllowedMsg) XXX_Merge(src proto.Message) { - xxx_messageInfo_EIP712AllowedMsg.Merge(m, src) -} -func (m *V2EIP712AllowedMsg) XXX_Size() int { - return m.Size() -} -func (m *V2EIP712AllowedMsg) XXX_DiscardUnknown() { - xxx_messageInfo_EIP712AllowedMsg.DiscardUnknown(m) -} - -var xxx_messageInfo_EIP712AllowedMsg proto.InternalMessageInfo - -func (m *V2EIP712AllowedMsg) GetMsgTypeUrl() string { - if m != nil { - return m.MsgTypeUrl - } - return "" -} - -func (m *V2EIP712AllowedMsg) GetMsgValueTypeName() string { - if m != nil { - return m.MsgValueTypeName - } - return "" -} - -func (m *V2EIP712AllowedMsg) GetValueTypes() []V2EIP712MsgAttrType { - if m != nil { - return m.ValueTypes - } - return nil -} - -func (m *V2EIP712AllowedMsg) GetNestedTypes() []V2EIP712NestedMsgType { - if m != nil { - return m.NestedTypes - } - return nil -} - -// EIP712MsgType is the eip712 type of a single message. -type V2EIP712NestedMsgType struct { - // name of the nested type. ie "Fee", "Coin" - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // attrs of the nested type - Attrs []V2EIP712MsgAttrType `protobuf:"bytes,2,rep,name=attrs,proto3" json:"attrs"` -} - -func (m *V2EIP712NestedMsgType) Reset() { *m = V2EIP712NestedMsgType{} } -func (m *V2EIP712NestedMsgType) String() string { return proto.CompactTextString(m) } -func (*V2EIP712NestedMsgType) ProtoMessage() {} -func (*V2EIP712NestedMsgType) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{9} -} -func (m *V2EIP712NestedMsgType) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2EIP712NestedMsgType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EIP712NestedMsgType.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 *V2EIP712NestedMsgType) XXX_Merge(src proto.Message) { - xxx_messageInfo_EIP712NestedMsgType.Merge(m, src) -} -func (m *V2EIP712NestedMsgType) XXX_Size() int { - return m.Size() -} -func (m *V2EIP712NestedMsgType) XXX_DiscardUnknown() { - xxx_messageInfo_EIP712NestedMsgType.DiscardUnknown(m) -} - -var xxx_messageInfo_EIP712NestedMsgType proto.InternalMessageInfo - -func (m *V2EIP712NestedMsgType) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *V2EIP712NestedMsgType) GetAttrs() []V2EIP712MsgAttrType { - if m != nil { - return m.Attrs - } - return nil -} - -// V2EIP712MsgAttrType is the eip712 type of a single message attribute. -type V2EIP712MsgAttrType struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` -} - -func (m *V2EIP712MsgAttrType) Reset() { *m = V2EIP712MsgAttrType{} } -func (m *V2EIP712MsgAttrType) String() string { return proto.CompactTextString(m) } -func (*V2EIP712MsgAttrType) ProtoMessage() {} -func (*V2EIP712MsgAttrType) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{10} -} -func (m *V2EIP712MsgAttrType) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V2EIP712MsgAttrType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EIP712MsgAttrType.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 *V2EIP712MsgAttrType) XXX_Merge(src proto.Message) { - xxx_messageInfo_EIP712MsgAttrType.Merge(m, src) -} -func (m *V2EIP712MsgAttrType) XXX_Size() int { - return m.Size() -} -func (m *V2EIP712MsgAttrType) XXX_DiscardUnknown() { - xxx_messageInfo_EIP712MsgAttrType.DiscardUnknown(m) -} - -var xxx_messageInfo_EIP712MsgAttrType proto.InternalMessageInfo - -func (m *V2EIP712MsgAttrType) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *V2EIP712MsgAttrType) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func init() { - proto.RegisterType((*V2Params)(nil), "ethermint.evm.v1.V2Params") - proto.RegisterType((*V2ChainConfig)(nil), "ethermint.evm.v1.V2ChainConfig") - proto.RegisterType((*V2State)(nil), "ethermint.evm.v1.V2State") - proto.RegisterType((*V2TransactionLogs)(nil), "ethermint.evm.v1.V2TransactionLogs") - proto.RegisterType((*V2Log)(nil), "ethermint.evm.v1.V2Log") - proto.RegisterType((*V2TxResult)(nil), "ethermint.evm.v1.V2TxResult") - proto.RegisterType((*V2AccessTuple)(nil), "ethermint.evm.v1.V2AccessTuple") - proto.RegisterType((*V2TraceConfig)(nil), "ethermint.evm.v1.V2TraceConfig") - proto.RegisterType((*V2EIP712AllowedMsg)(nil), "ethermint.evm.v1.V2EIP712AllowedMsg") - proto.RegisterType((*V2EIP712NestedMsgType)(nil), "ethermint.evm.v1.V2EIP712NestedMsgType") - proto.RegisterType((*V2EIP712MsgAttrType)(nil), "ethermint.evm.v1.V2EIP712MsgAttrType") -} - -func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) } - -var fileDescriptor_d21ecc92c8c8583e = []byte{ - // 1683 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xdd, 0x4e, 0xe4, 0xc8, - 0x15, 0x06, 0xda, 0x80, 0xbb, 0xda, 0x74, 0x9b, 0x6a, 0x76, 0xd2, 0x33, 0xa3, 0x60, 0xe2, 0x28, - 0x11, 0x91, 0x76, 0x60, 0x61, 0x85, 0x66, 0xb4, 0xa3, 0x28, 0xc2, 0x0c, 0xbb, 0x0b, 0x99, 0x99, - 0xa0, 0x82, 0x4d, 0xa4, 0x48, 0x91, 0x55, 0x6d, 0xd7, 0x1a, 0x2f, 0xb6, 0xab, 0x55, 0x55, 0xdd, - 0xd3, 0x1d, 0xe5, 0x01, 0x22, 0xe5, 0x26, 0x8f, 0x90, 0x57, 0xc8, 0x3b, 0xe4, 0x62, 0x95, 0xab, - 0xbd, 0x8c, 0x72, 0x61, 0xad, 0x98, 0x3b, 0x2e, 0x79, 0x81, 0x44, 0xf5, 0xd3, 0xbf, 0x30, 0xc9, - 0x36, 0x57, 0x5d, 0xe7, 0xef, 0xfb, 0xea, 0x9c, 0x3a, 0xae, 0x63, 0x37, 0x78, 0x42, 0xc4, 0x25, - 0x61, 0x79, 0x5a, 0x88, 0x5d, 0xd2, 0xcb, 0x77, 0x7b, 0x7b, 0xf2, 0x67, 0xa7, 0xc3, 0xa8, 0xa0, - 0xd0, 0x1d, 0xd9, 0x76, 0xa4, 0xb2, 0xb7, 0xf7, 0x64, 0x23, 0xa1, 0x09, 0x55, 0xc6, 0x5d, 0xb9, - 0xd2, 0x7e, 0xfe, 0x3f, 0x2a, 0x60, 0xe5, 0x0c, 0x33, 0x9c, 0x73, 0xb8, 0x07, 0xaa, 0xa4, 0x97, - 0x87, 0x31, 0x29, 0x68, 0xde, 0x5a, 0xdc, 0x5a, 0xdc, 0xae, 0x06, 0x1b, 0xb7, 0xa5, 0xe7, 0x0e, - 0x70, 0x9e, 0x7d, 0xe6, 0x8f, 0x4c, 0x3e, 0xb2, 0x49, 0x2f, 0x7f, 0x25, 0x97, 0xf0, 0x97, 0x60, - 0x8d, 0x14, 0xb8, 0x9d, 0x91, 0x30, 0x62, 0x04, 0x0b, 0xd2, 0x5a, 0xda, 0x5a, 0xdc, 0xb6, 0x83, - 0xd6, 0x6d, 0xe9, 0x6d, 0x98, 0xb0, 0x49, 0xb3, 0x8f, 0x1c, 0x2d, 0x1f, 0x29, 0x11, 0x3e, 0x07, - 0xb5, 0xa1, 0x1d, 0x67, 0x59, 0xab, 0xa2, 0x82, 0x1f, 0xdd, 0x96, 0x1e, 0x9c, 0x0e, 0xc6, 0x59, - 0xe6, 0x23, 0x60, 0x42, 0x71, 0x96, 0xc1, 0x43, 0x00, 0x48, 0x5f, 0x30, 0x1c, 0x92, 0xb4, 0xc3, - 0x5b, 0xd6, 0x56, 0x65, 0xbb, 0x12, 0xf8, 0xd7, 0xa5, 0x57, 0x3d, 0x96, 0xda, 0xe3, 0x93, 0x33, - 0x7e, 0x5b, 0x7a, 0xeb, 0x06, 0x64, 0xe4, 0xe8, 0xa3, 0xaa, 0x12, 0x8e, 0xd3, 0x0e, 0x87, 0x7f, - 0x00, 0x4e, 0x74, 0x89, 0xd3, 0x22, 0x8c, 0x68, 0xf1, 0x75, 0x9a, 0xb4, 0x96, 0xb7, 0x16, 0xb7, - 0x6b, 0xfb, 0x3f, 0xde, 0x99, 0xad, 0xdb, 0xce, 0x91, 0xf4, 0x3a, 0x52, 0x4e, 0xc1, 0xd3, 0x6f, - 0x4b, 0x6f, 0xe1, 0xb6, 0xf4, 0x9a, 0x1a, 0x7a, 0x12, 0xc0, 0x47, 0xb5, 0x68, 0xec, 0x09, 0x73, - 0xd0, 0x24, 0x69, 0xe7, 0xf9, 0xde, 0x7e, 0x88, 0xb3, 0x8c, 0xbe, 0x23, 0x71, 0x98, 0xf3, 0x84, - 0xb7, 0x56, 0xb6, 0x2a, 0xdb, 0xb5, 0x7d, 0xff, 0x2e, 0xcb, 0xf1, 0xc9, 0xd9, 0xf3, 0xbd, 0xfd, - 0x43, 0xed, 0xfb, 0x86, 0x27, 0xc1, 0x63, 0x49, 0x75, 0x5d, 0x7a, 0xeb, 0xb3, 0x16, 0x8e, 0xd6, - 0x35, 0xf2, 0x84, 0xca, 0xff, 0x7b, 0x1d, 0xd4, 0x8e, 0xa6, 0xe8, 0x1b, 0x97, 0x34, 0x27, 0x5c, - 0x10, 0x1c, 0x87, 0xed, 0x8c, 0x46, 0x57, 0xe6, 0x44, 0x5f, 0xfd, 0xbb, 0xf4, 0x7e, 0x9e, 0xa4, - 0xe2, 0xb2, 0xdb, 0xde, 0x89, 0x68, 0xbe, 0x1b, 0x51, 0x9e, 0x53, 0x6e, 0x7e, 0x9e, 0xf1, 0xf8, - 0x6a, 0x57, 0x0c, 0x3a, 0x84, 0xef, 0x9c, 0x14, 0xe2, 0xb6, 0xf4, 0x1e, 0xe9, 0x3c, 0x67, 0xa0, - 0x7c, 0x54, 0x1f, 0x69, 0x02, 0xa9, 0x80, 0x03, 0x50, 0x8f, 0x31, 0x0d, 0xbf, 0xa6, 0xec, 0xca, - 0xb0, 0x2d, 0x29, 0xb6, 0xf3, 0x1f, 0xce, 0x76, 0x5d, 0x7a, 0xce, 0xab, 0xc3, 0xdf, 0x7c, 0x4e, - 0xd9, 0x95, 0xc2, 0xbc, 0x2d, 0xbd, 0x8f, 0x34, 0xfb, 0x34, 0xb2, 0x8f, 0x9c, 0x18, 0xd3, 0x91, - 0x1b, 0xfc, 0x1d, 0x70, 0x47, 0x0e, 0xbc, 0xdb, 0xe9, 0x50, 0x26, 0x4c, 0x23, 0x3d, 0xbb, 0x2e, - 0xbd, 0xba, 0x81, 0x3c, 0xd7, 0x96, 0xdb, 0xd2, 0xfb, 0xd1, 0x0c, 0xa8, 0x89, 0xf1, 0x51, 0xdd, - 0xc0, 0x1a, 0x57, 0xc8, 0x81, 0x43, 0xd2, 0xce, 0xde, 0xc1, 0x27, 0x26, 0x23, 0x4b, 0x65, 0x74, - 0x36, 0x57, 0x46, 0xb5, 0xe3, 0x93, 0xb3, 0xbd, 0x83, 0x4f, 0x86, 0x09, 0x99, 0xb6, 0x99, 0x84, - 0xf5, 0x51, 0x4d, 0x8b, 0x3a, 0x9b, 0x13, 0x60, 0xc4, 0xf0, 0x12, 0xf3, 0x4b, 0xd5, 0x94, 0xd5, - 0x60, 0xfb, 0xba, 0xf4, 0x80, 0x46, 0xfa, 0x12, 0xf3, 0xcb, 0xf1, 0xb9, 0xb4, 0x07, 0x7f, 0xc4, - 0x85, 0x48, 0xbb, 0xf9, 0x10, 0x0b, 0xe8, 0x60, 0xe9, 0x35, 0xda, 0xff, 0x81, 0xd9, 0xff, 0xca, - 0x83, 0xf7, 0x7f, 0x70, 0xdf, 0xfe, 0x0f, 0xa6, 0xf7, 0xaf, 0x7d, 0x46, 0xa4, 0x2f, 0x0c, 0xe9, - 0xea, 0x83, 0x49, 0x5f, 0xdc, 0x47, 0xfa, 0x62, 0x9a, 0x54, 0xfb, 0xc8, 0x66, 0x9f, 0xa9, 0x44, - 0xcb, 0x7e, 0x78, 0xb3, 0xdf, 0x29, 0x6a, 0x7d, 0xa4, 0xd1, 0x74, 0x7f, 0x02, 0x1b, 0x11, 0x2d, - 0xb8, 0x90, 0xba, 0x82, 0x76, 0x32, 0x62, 0x38, 0xab, 0x8a, 0xf3, 0x64, 0x2e, 0xce, 0xa7, 0xe6, - 0x22, 0xb9, 0x07, 0xcf, 0x47, 0xcd, 0x69, 0xb5, 0x66, 0xef, 0x00, 0xb7, 0x43, 0x04, 0x61, 0xbc, - 0xdd, 0x65, 0x89, 0x61, 0x06, 0x8a, 0xf9, 0x78, 0x2e, 0x66, 0xf3, 0x1c, 0xcc, 0x62, 0xf9, 0xa8, - 0x31, 0x56, 0x69, 0xc6, 0x6f, 0x40, 0x3d, 0x95, 0xdb, 0x68, 0x77, 0x33, 0xc3, 0x57, 0x53, 0x7c, - 0x47, 0x73, 0xf1, 0x99, 0x87, 0x79, 0x1a, 0xc9, 0x47, 0x6b, 0x43, 0x85, 0xe6, 0xea, 0x02, 0x98, - 0x77, 0x53, 0x16, 0x26, 0x19, 0x8e, 0x52, 0xc2, 0x0c, 0x9f, 0xa3, 0xf8, 0xbe, 0x98, 0x8b, 0xef, - 0xb1, 0xe6, 0xbb, 0x8b, 0xe6, 0x23, 0x57, 0x2a, 0xbf, 0xd0, 0x3a, 0x4d, 0x1b, 0x03, 0xa7, 0x4d, - 0x58, 0x96, 0x16, 0x86, 0x70, 0x4d, 0x11, 0x1e, 0xce, 0x45, 0x68, 0xfa, 0x74, 0x12, 0xc7, 0x47, - 0x35, 0x2d, 0x8e, 0x58, 0x32, 0x5a, 0xc4, 0x74, 0xc8, 0xb2, 0xfe, 0x70, 0x96, 0x49, 0x1c, 0x1f, - 0xd5, 0xb4, 0xa8, 0x59, 0xfa, 0xa0, 0x89, 0x19, 0xa3, 0xef, 0x66, 0x6a, 0x08, 0x15, 0xd9, 0x97, - 0x73, 0x91, 0x3d, 0xd1, 0x64, 0xf7, 0xc0, 0xf9, 0x68, 0x5d, 0x69, 0xa7, 0xaa, 0x48, 0x81, 0x9b, - 0x13, 0x96, 0x90, 0xc9, 0x39, 0xd0, 0x7c, 0x78, 0x6b, 0xce, 0x62, 0xf9, 0xa8, 0xae, 0x54, 0xa3, - 0xbb, 0xff, 0xd4, 0xb2, 0xeb, 0x6e, 0xe3, 0xd4, 0xb2, 0x1b, 0xae, 0x7b, 0x6a, 0xd9, 0xae, 0xbb, - 0x8e, 0xd6, 0x06, 0x34, 0xa3, 0x61, 0xef, 0x53, 0x1d, 0x81, 0x6a, 0xe4, 0x1d, 0xe6, 0xe6, 0x41, - 0x46, 0xf5, 0x08, 0x0b, 0x9c, 0x0d, 0xb8, 0x30, 0x70, 0xbb, 0x60, 0xf9, 0x5c, 0xc8, 0xd7, 0x10, - 0x17, 0x54, 0xae, 0xc8, 0x40, 0x0f, 0x48, 0x24, 0x97, 0x70, 0x03, 0x2c, 0xf7, 0x70, 0xd6, 0xd5, - 0xef, 0x33, 0x55, 0xa4, 0x05, 0xff, 0x0c, 0x34, 0x2e, 0x18, 0x2e, 0x38, 0x8e, 0x44, 0x4a, 0x8b, - 0xd7, 0x34, 0xe1, 0x10, 0x02, 0x4b, 0x5d, 0xd4, 0x3a, 0x56, 0xad, 0xe1, 0x2f, 0x80, 0x95, 0xd1, - 0x84, 0xb7, 0x96, 0xd4, 0xac, 0xff, 0xe8, 0xee, 0xac, 0x7f, 0x4d, 0x13, 0xa4, 0x5c, 0xfc, 0x7f, - 0x2e, 0x81, 0xca, 0x6b, 0x9a, 0xc0, 0x16, 0x58, 0xc5, 0x71, 0xcc, 0x08, 0xe7, 0x06, 0x69, 0x28, - 0xc2, 0x47, 0x60, 0x45, 0xd0, 0x4e, 0x1a, 0x69, 0xb8, 0x2a, 0x32, 0x92, 0x24, 0x8e, 0xb1, 0xc0, - 0x6a, 0xd4, 0x39, 0x48, 0xad, 0xe1, 0x3e, 0x70, 0x54, 0x66, 0x61, 0xd1, 0xcd, 0xdb, 0x84, 0xa9, - 0x89, 0x65, 0x05, 0x8d, 0x9b, 0xd2, 0xab, 0x29, 0xfd, 0x5b, 0xa5, 0x46, 0x93, 0x02, 0xfc, 0x18, - 0xac, 0x8a, 0xfe, 0xe4, 0xb0, 0x69, 0xde, 0x94, 0x5e, 0x43, 0x8c, 0xd3, 0x94, 0xb3, 0x04, 0xad, - 0x88, 0xbe, 0x9a, 0x29, 0xbb, 0xc0, 0x16, 0xfd, 0x30, 0x2d, 0x62, 0xd2, 0x57, 0xf3, 0xc4, 0x0a, - 0x36, 0x6e, 0x4a, 0xcf, 0x9d, 0x70, 0x3f, 0x91, 0x36, 0xb4, 0x2a, 0xfa, 0x6a, 0x01, 0x3f, 0x06, - 0x40, 0x6f, 0x49, 0x31, 0xe8, 0x69, 0xb0, 0x76, 0x53, 0x7a, 0x55, 0xa5, 0x55, 0xd8, 0xe3, 0x25, - 0xf4, 0xc1, 0xb2, 0xc6, 0xb6, 0x15, 0xb6, 0x73, 0x53, 0x7a, 0x76, 0x46, 0x13, 0x8d, 0xa9, 0x4d, - 0xb2, 0x54, 0x8c, 0xe4, 0xb4, 0x47, 0x62, 0x75, 0xe1, 0xda, 0x68, 0x28, 0xfa, 0x7f, 0x59, 0x02, - 0xf6, 0x45, 0x1f, 0x11, 0xde, 0xcd, 0x04, 0xfc, 0x1c, 0xb8, 0x11, 0x2d, 0x04, 0xc3, 0x91, 0x08, - 0xa7, 0x4a, 0x1b, 0x3c, 0x1d, 0x77, 0xd8, 0xac, 0x87, 0x8f, 0x1a, 0x43, 0xd5, 0xa1, 0xa9, 0xff, - 0x06, 0x58, 0x6e, 0x67, 0x94, 0xe6, 0xaa, 0x13, 0x1c, 0xa4, 0x05, 0x88, 0x54, 0xd5, 0xd4, 0x29, - 0x57, 0xd4, 0x7b, 0xe3, 0x4f, 0xee, 0x9e, 0xf2, 0x4c, 0xab, 0x04, 0x8f, 0xcc, 0xbb, 0x63, 0x5d, - 0x73, 0x9b, 0x78, 0x5f, 0xd6, 0x56, 0xb5, 0x92, 0x0b, 0x2a, 0x8c, 0x08, 0x75, 0x68, 0x0e, 0x92, - 0x4b, 0xf8, 0x04, 0xd8, 0x8c, 0xf4, 0x08, 0x13, 0x24, 0x56, 0x87, 0x63, 0xa3, 0x91, 0x0c, 0x1f, - 0x03, 0x3b, 0xc1, 0x3c, 0xec, 0x72, 0x12, 0xeb, 0x93, 0x40, 0xab, 0x09, 0xe6, 0x5f, 0x71, 0x12, - 0x7f, 0x66, 0xfd, 0xf9, 0x6f, 0xde, 0x82, 0x8f, 0x41, 0xed, 0x30, 0x8a, 0x08, 0xe7, 0x17, 0xdd, - 0x4e, 0x46, 0xfe, 0x47, 0x87, 0xed, 0x03, 0x87, 0x0b, 0xca, 0x70, 0x42, 0xc2, 0x2b, 0x32, 0x30, - 0x7d, 0xa6, 0xbb, 0xc6, 0xe8, 0x7f, 0x4d, 0x06, 0x1c, 0x4d, 0x0a, 0x86, 0xe2, 0xfb, 0x0a, 0xa8, - 0x5d, 0x30, 0x1c, 0x11, 0xf3, 0xd2, 0x29, 0x7b, 0x55, 0x8a, 0xcc, 0x50, 0x18, 0x49, 0x72, 0x8b, - 0x34, 0x27, 0xb4, 0x2b, 0xcc, 0xf3, 0x34, 0x14, 0x65, 0x04, 0x23, 0xa4, 0x4f, 0x22, 0x55, 0x46, - 0x0b, 0x19, 0x09, 0x1e, 0x80, 0xb5, 0x38, 0xe5, 0xea, 0xe5, 0x9f, 0x0b, 0x1c, 0x5d, 0xe9, 0xf4, - 0x03, 0xf7, 0xa6, 0xf4, 0x1c, 0x63, 0x38, 0x97, 0x7a, 0x34, 0x25, 0xc1, 0x97, 0xa0, 0x31, 0x0e, - 0x53, 0xbb, 0x55, 0xb5, 0xb1, 0x03, 0x78, 0x53, 0x7a, 0xf5, 0x91, 0xab, 0xb2, 0xa0, 0x19, 0x59, - 0x9e, 0x74, 0x4c, 0xda, 0xdd, 0x44, 0x35, 0x9f, 0x8d, 0xb4, 0x20, 0xb5, 0x59, 0x9a, 0xa7, 0x42, - 0x35, 0xdb, 0x32, 0xd2, 0x02, 0x7c, 0x09, 0xaa, 0xb4, 0x47, 0x18, 0x4b, 0x63, 0xc2, 0xd5, 0xf4, - 0xfd, 0x7f, 0x5f, 0x0e, 0x68, 0xec, 0x2f, 0x93, 0x33, 0x1f, 0x36, 0x39, 0xc9, 0x29, 0x1b, 0xa8, - 0x71, 0x6a, 0x92, 0xd3, 0x86, 0x37, 0x4a, 0x8f, 0xa6, 0x24, 0x18, 0x00, 0x68, 0xc2, 0x18, 0x11, - 0x5d, 0x56, 0x84, 0xea, 0xf9, 0x77, 0x54, 0xac, 0x7a, 0x0a, 0xb5, 0x15, 0x29, 0xe3, 0x2b, 0x2c, - 0x30, 0xba, 0xa3, 0x39, 0xb5, 0x6c, 0xcb, 0x5d, 0x3e, 0xb5, 0xec, 0x55, 0xd7, 0x1e, 0xe5, 0x6f, - 0x76, 0x81, 0x9a, 0x43, 0x79, 0x02, 0xde, 0xff, 0xcf, 0x22, 0x70, 0x67, 0x3f, 0x40, 0xe0, 0x16, - 0x70, 0x72, 0x9e, 0x84, 0xf2, 0xca, 0x0e, 0xbb, 0x2c, 0x33, 0xa7, 0x0d, 0x72, 0x9e, 0x5c, 0x0c, - 0x3a, 0xe4, 0x2b, 0x96, 0xc1, 0x67, 0xa0, 0x29, 0x3d, 0xd4, 0xb5, 0xa9, 0xfd, 0x0a, 0x9c, 0x0f, - 0x6f, 0x53, 0x37, 0xe7, 0xc9, 0x6f, 0xa5, 0x45, 0x7a, 0xbf, 0xc5, 0x39, 0x81, 0xa7, 0xa0, 0x36, - 0x76, 0x95, 0x8f, 0x94, 0xbc, 0x38, 0x7f, 0xfa, 0xa1, 0x8f, 0xa4, 0x37, 0x3c, 0x39, 0x14, 0x82, - 0xc9, 0xe8, 0xc0, 0x92, 0x0f, 0x15, 0x02, 0xbd, 0x21, 0x1c, 0x87, 0x6f, 0x81, 0x53, 0xc8, 0x4f, - 0x93, 0xd8, 0x80, 0x59, 0x0a, 0xec, 0x67, 0x1f, 0x02, 0x7b, 0xab, 0x7c, 0xdf, 0xe8, 0xad, 0x1b, - 0xb8, 0x9a, 0x06, 0x50, 0x78, 0xfe, 0x37, 0xa0, 0x79, 0x8f, 0xa7, 0xbc, 0x7f, 0x55, 0x4a, 0xe6, - 0xe2, 0x97, 0x6b, 0xf8, 0x2b, 0xb0, 0x8c, 0x85, 0x60, 0xc3, 0x9b, 0x7f, 0x8e, 0x04, 0x74, 0x9c, - 0xff, 0x12, 0xac, 0xdf, 0xf1, 0xb8, 0x97, 0x09, 0x02, 0x4b, 0x66, 0x67, 0x0a, 0xaa, 0xd6, 0x41, - 0xf0, 0xed, 0xf5, 0xe6, 0xe2, 0x77, 0xd7, 0x9b, 0x8b, 0xdf, 0x5f, 0x6f, 0x2e, 0xfe, 0xf5, 0xfd, - 0xe6, 0xc2, 0x77, 0xef, 0x37, 0x17, 0xfe, 0xf5, 0x7e, 0x73, 0xe1, 0xf7, 0xdb, 0x13, 0x93, 0x57, - 0x5c, 0x62, 0xc6, 0x53, 0xbe, 0x3b, 0xfe, 0xeb, 0xa0, 0xaf, 0xfe, 0x3c, 0x50, 0xc5, 0x6a, 0xaf, - 0xa8, 0x3f, 0x05, 0x3e, 0xfd, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xff, 0x38, 0xa9, 0x5a, - 0x10, 0x00, 0x00, -} - -func (m *V2Params) 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 *V2Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.EIP712AllowedMsgs) > 0 { - for iNdEx := len(m.EIP712AllowedMsgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.EIP712AllowedMsgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - { - size, err := m.ChainConfig.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if len(m.ExtraEIPs) > 0 { - dAtA3 := make([]byte, len(m.ExtraEIPs)*10) - var j2 int - for _, num1 := range m.ExtraEIPs { - num := uint64(num1) - for num >= 1<<7 { - dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j2++ - } - dAtA3[j2] = uint8(num) - j2++ - } - i -= j2 - copy(dAtA[i:], dAtA3[:j2]) - i = encodeVarintEvm(dAtA, i, uint64(j2)) - i-- - dAtA[i] = 0x22 - } - if m.EnableCall { - i-- - if m.EnableCall { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.EnableCreate { - i-- - if m.EnableCreate { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.EvmDenom) > 0 { - i -= len(m.EvmDenom) - copy(dAtA[i:], m.EvmDenom) - i = encodeVarintEvm(dAtA, i, uint64(len(m.EvmDenom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2ChainConfig) 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 *V2ChainConfig) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MergeForkBlock != nil { - { - size := m.MergeForkBlock.Size() - i -= size - if _, err := m.MergeForkBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x9a - } - if m.ArrowGlacierBlock != nil { - { - size := m.ArrowGlacierBlock.Size() - i -= size - if _, err := m.ArrowGlacierBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x92 - } - if m.LondonBlock != nil { - { - size := m.LondonBlock.Size() - i -= size - if _, err := m.LondonBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - if m.BerlinBlock != nil { - { - size := m.BerlinBlock.Size() - i -= size - if _, err := m.BerlinBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6a - } - if m.MuirGlacierBlock != nil { - { - size := m.MuirGlacierBlock.Size() - i -= size - if _, err := m.MuirGlacierBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - } - if m.IstanbulBlock != nil { - { - size := m.IstanbulBlock.Size() - i -= size - if _, err := m.IstanbulBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - if m.PetersburgBlock != nil { - { - size := m.PetersburgBlock.Size() - i -= size - if _, err := m.PetersburgBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - if m.ConstantinopleBlock != nil { - { - size := m.ConstantinopleBlock.Size() - i -= size - if _, err := m.ConstantinopleBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - if m.ByzantiumBlock != nil { - { - size := m.ByzantiumBlock.Size() - i -= size - if _, err := m.ByzantiumBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - if m.EIP158Block != nil { - { - size := m.EIP158Block.Size() - i -= size - if _, err := m.EIP158Block.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.EIP155Block != nil { - { - size := m.EIP155Block.Size() - i -= size - if _, err := m.EIP155Block.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if len(m.EIP150Hash) > 0 { - i -= len(m.EIP150Hash) - copy(dAtA[i:], m.EIP150Hash) - i = encodeVarintEvm(dAtA, i, uint64(len(m.EIP150Hash))) - i-- - dAtA[i] = 0x2a - } - if m.EIP150Block != nil { - { - size := m.EIP150Block.Size() - i -= size - if _, err := m.EIP150Block.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.DAOForkSupport { - i-- - if m.DAOForkSupport { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.DAOForkBlock != nil { - { - size := m.DAOForkBlock.Size() - i -= size - if _, err := m.DAOForkBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.HomesteadBlock != nil { - { - size := m.HomesteadBlock.Size() - i -= size - if _, err := m.HomesteadBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2State) 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 *V2State) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2State) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2TransactionLogs) 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 *V2TransactionLogs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2TransactionLogs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Logs) > 0 { - for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2Log) 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 *V2Log) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Removed { - i-- - if m.Removed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.Index != 0 { - i = encodeVarintEvm(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x40 - } - if len(m.BlockHash) > 0 { - i -= len(m.BlockHash) - copy(dAtA[i:], m.BlockHash) - i = encodeVarintEvm(dAtA, i, uint64(len(m.BlockHash))) - i-- - dAtA[i] = 0x3a - } - if m.TxIndex != 0 { - i = encodeVarintEvm(dAtA, i, uint64(m.TxIndex)) - i-- - dAtA[i] = 0x30 - } - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintEvm(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0x2a - } - if m.BlockNumber != 0 { - i = encodeVarintEvm(dAtA, i, uint64(m.BlockNumber)) - i-- - dAtA[i] = 0x20 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x1a - } - if len(m.Topics) > 0 { - for iNdEx := len(m.Topics) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Topics[iNdEx]) - copy(dAtA[i:], m.Topics[iNdEx]) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Topics[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2TxResult) 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 *V2TxResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GasUsed != 0 { - i = encodeVarintEvm(dAtA, i, uint64(m.GasUsed)) - i-- - dAtA[i] = 0x30 - } - if m.Reverted { - i-- - if m.Reverted { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.Ret) > 0 { - i -= len(m.Ret) - copy(dAtA[i:], m.Ret) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Ret))) - i-- - dAtA[i] = 0x22 - } - { - size, err := m.TxLogs.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Bloom) > 0 { - i -= len(m.Bloom) - copy(dAtA[i:], m.Bloom) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Bloom))) - i-- - dAtA[i] = 0x12 - } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintEvm(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2AccessTuple) 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 *V2AccessTuple) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2AccessTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.StorageKeys) > 0 { - for iNdEx := len(m.StorageKeys) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.StorageKeys[iNdEx]) - copy(dAtA[i:], m.StorageKeys[iNdEx]) - i = encodeVarintEvm(dAtA, i, uint64(len(m.StorageKeys[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2TraceConfig) 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 *V2TraceConfig) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.EnableReturnData { - i-- - if m.EnableReturnData { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x60 - } - if m.EnableMemory { - i-- - if m.EnableMemory { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.Overrides != nil { - { - size, err := m.Overrides.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - if m.Limit != 0 { - i = encodeVarintEvm(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x48 - } - if m.Debug { - i-- - if m.Debug { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.DisableStorage { - i-- - if m.DisableStorage { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.DisableStack { - i-- - if m.DisableStack { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.Reexec != 0 { - i = encodeVarintEvm(dAtA, i, uint64(m.Reexec)) - i-- - dAtA[i] = 0x18 - } - if len(m.Timeout) > 0 { - i -= len(m.Timeout) - copy(dAtA[i:], m.Timeout) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Timeout))) - i-- - dAtA[i] = 0x12 - } - if len(m.Tracer) > 0 { - i -= len(m.Tracer) - copy(dAtA[i:], m.Tracer) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Tracer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2EIP712AllowedMsg) 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 *V2EIP712AllowedMsg) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2EIP712AllowedMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NestedTypes) > 0 { - for iNdEx := len(m.NestedTypes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.NestedTypes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.ValueTypes) > 0 { - for iNdEx := len(m.ValueTypes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ValueTypes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.MsgValueTypeName) > 0 { - i -= len(m.MsgValueTypeName) - copy(dAtA[i:], m.MsgValueTypeName) - i = encodeVarintEvm(dAtA, i, uint64(len(m.MsgValueTypeName))) - i-- - dAtA[i] = 0x12 - } - if len(m.MsgTypeUrl) > 0 { - i -= len(m.MsgTypeUrl) - copy(dAtA[i:], m.MsgTypeUrl) - i = encodeVarintEvm(dAtA, i, uint64(len(m.MsgTypeUrl))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2EIP712NestedMsgType) 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 *V2EIP712NestedMsgType) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2EIP712NestedMsgType) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Attrs) > 0 { - for iNdEx := len(m.Attrs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attrs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V2EIP712MsgAttrType) 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 *V2EIP712MsgAttrType) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V2EIP712MsgAttrType) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintEvm(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintEvm(dAtA []byte, offset int, v uint64) int { - offset -= sovEvm(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *V2Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.EvmDenom) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if m.EnableCreate { - n += 2 - } - if m.EnableCall { - n += 2 - } - if len(m.ExtraEIPs) > 0 { - l = 0 - for _, e := range m.ExtraEIPs { - l += sovEvm(uint64(e)) - } - n += 1 + sovEvm(uint64(l)) + l - } - l = m.ChainConfig.Size() - n += 1 + l + sovEvm(uint64(l)) - if len(m.EIP712AllowedMsgs) > 0 { - for _, e := range m.EIP712AllowedMsgs { - l = e.Size() - n += 1 + l + sovEvm(uint64(l)) - } - } - return n -} - -func (m *V2ChainConfig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HomesteadBlock != nil { - l = m.HomesteadBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.DAOForkBlock != nil { - l = m.DAOForkBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.DAOForkSupport { - n += 2 - } - if m.EIP150Block != nil { - l = m.EIP150Block.Size() - n += 1 + l + sovEvm(uint64(l)) - } - l = len(m.EIP150Hash) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if m.EIP155Block != nil { - l = m.EIP155Block.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.EIP158Block != nil { - l = m.EIP158Block.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.ByzantiumBlock != nil { - l = m.ByzantiumBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.ConstantinopleBlock != nil { - l = m.ConstantinopleBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.PetersburgBlock != nil { - l = m.PetersburgBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.IstanbulBlock != nil { - l = m.IstanbulBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.MuirGlacierBlock != nil { - l = m.MuirGlacierBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.BerlinBlock != nil { - l = m.BerlinBlock.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.LondonBlock != nil { - l = m.LondonBlock.Size() - n += 2 + l + sovEvm(uint64(l)) - } - if m.ArrowGlacierBlock != nil { - l = m.ArrowGlacierBlock.Size() - n += 2 + l + sovEvm(uint64(l)) - } - if m.MergeForkBlock != nil { - l = m.MergeForkBlock.Size() - n += 2 + l + sovEvm(uint64(l)) - } - return n -} - -func (m *V2State) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - return n -} - -func (m *V2TransactionLogs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if len(m.Logs) > 0 { - for _, e := range m.Logs { - l = e.Size() - n += 1 + l + sovEvm(uint64(l)) - } - } - return n -} - -func (m *V2Log) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if len(m.Topics) > 0 { - for _, s := range m.Topics { - l = len(s) - n += 1 + l + sovEvm(uint64(l)) - } - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if m.BlockNumber != 0 { - n += 1 + sovEvm(uint64(m.BlockNumber)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if m.TxIndex != 0 { - n += 1 + sovEvm(uint64(m.TxIndex)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if m.Index != 0 { - n += 1 + sovEvm(uint64(m.Index)) - } - if m.Removed { - n += 2 - } - return n -} - -func (m *V2TxResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - l = len(m.Bloom) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - l = m.TxLogs.Size() - n += 1 + l + sovEvm(uint64(l)) - l = len(m.Ret) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if m.Reverted { - n += 2 - } - if m.GasUsed != 0 { - n += 1 + sovEvm(uint64(m.GasUsed)) - } - return n -} - -func (m *V2AccessTuple) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if len(m.StorageKeys) > 0 { - for _, s := range m.StorageKeys { - l = len(s) - n += 1 + l + sovEvm(uint64(l)) - } - } - return n -} - -func (m *V2TraceConfig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Tracer) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - l = len(m.Timeout) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if m.Reexec != 0 { - n += 1 + sovEvm(uint64(m.Reexec)) - } - if m.DisableStack { - n += 2 - } - if m.DisableStorage { - n += 2 - } - if m.Debug { - n += 2 - } - if m.Limit != 0 { - n += 1 + sovEvm(uint64(m.Limit)) - } - if m.Overrides != nil { - l = m.Overrides.Size() - n += 1 + l + sovEvm(uint64(l)) - } - if m.EnableMemory { - n += 2 - } - if m.EnableReturnData { - n += 2 - } - return n -} - -func (m *V2EIP712AllowedMsg) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MsgTypeUrl) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - l = len(m.MsgValueTypeName) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if len(m.ValueTypes) > 0 { - for _, e := range m.ValueTypes { - l = e.Size() - n += 1 + l + sovEvm(uint64(l)) - } - } - if len(m.NestedTypes) > 0 { - for _, e := range m.NestedTypes { - l = e.Size() - n += 1 + l + sovEvm(uint64(l)) - } - } - return n -} - -func (m *V2EIP712NestedMsgType) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - if len(m.Attrs) > 0 { - for _, e := range m.Attrs { - l = e.Size() - n += 1 + l + sovEvm(uint64(l)) - } - } - return n -} - -func (m *V2EIP712MsgAttrType) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - l = len(m.Type) - if l > 0 { - n += 1 + l + sovEvm(uint64(l)) - } - return n -} - -func sovEvm(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEvm(x uint64) (n int) { - return sovEvm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *V2Params) 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 ErrIntOverflowEvm - } - 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EvmDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EvmDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EnableCreate", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EnableCreate = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EnableCall", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EnableCall = bool(v != 0) - case 4: - if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExtraEIPs = append(m.ExtraEIPs, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.ExtraEIPs) == 0 { - m.ExtraEIPs = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExtraEIPs = append(m.ExtraEIPs, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ExtraEIPs", wireType) - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ChainConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EIP712AllowedMsgs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EIP712AllowedMsgs = append(m.EIP712AllowedMsgs, V2EIP712AllowedMsg{}) - if err := m.EIP712AllowedMsgs[len(m.EIP712AllowedMsgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2ChainConfig) 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 ErrIntOverflowEvm - } - 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: ChainConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ChainConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HomesteadBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.HomesteadBlock = &v - if err := m.HomesteadBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DAOForkBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.DAOForkBlock = &v - if err := m.DAOForkBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DAOForkSupport", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DAOForkSupport = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EIP150Block", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.EIP150Block = &v - if err := m.EIP150Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EIP150Hash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EIP150Hash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EIP155Block", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.EIP155Block = &v - if err := m.EIP155Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EIP158Block", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.EIP158Block = &v - if err := m.EIP158Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ByzantiumBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.ByzantiumBlock = &v - if err := m.ByzantiumBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConstantinopleBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.ConstantinopleBlock = &v - if err := m.ConstantinopleBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PetersburgBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.PetersburgBlock = &v - if err := m.PetersburgBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IstanbulBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.IstanbulBlock = &v - if err := m.IstanbulBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MuirGlacierBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.MuirGlacierBlock = &v - if err := m.MuirGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BerlinBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.BerlinBlock = &v - if err := m.BerlinBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 17: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LondonBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.LondonBlock = &v - if err := m.LondonBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 18: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ArrowGlacierBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.ArrowGlacierBlock = &v - if err := m.ArrowGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 19: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MergeForkBlock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Int - m.MergeForkBlock = &v - if err := m.MergeForkBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2State) 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 ErrIntOverflowEvm - } - 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: State: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: State: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2TransactionLogs) 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 ErrIntOverflowEvm - } - 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: TransactionLogs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TransactionLogs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logs = append(m.Logs, &V2Log{}) - if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2Log) 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 ErrIntOverflowEvm - } - 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: Log: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topics", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Topics = append(m.Topics, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) - } - m.BlockNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) - } - m.TxIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Removed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Removed = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2TxResult) 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 ErrIntOverflowEvm - } - 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: TxResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bloom", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bloom = append(m.Bloom[:0], dAtA[iNdEx:postIndex]...) - if m.Bloom == nil { - m.Bloom = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxLogs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TxLogs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ret", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ret = append(m.Ret[:0], dAtA[iNdEx:postIndex]...) - if m.Ret == nil { - m.Ret = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Reverted", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Reverted = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) - } - m.GasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasUsed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2AccessTuple) 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 ErrIntOverflowEvm - } - 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: AccessTuple: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AccessTuple: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageKeys", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StorageKeys = append(m.StorageKeys, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2TraceConfig) 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 ErrIntOverflowEvm - } - 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: TraceConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TraceConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tracer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Tracer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Timeout = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Reexec", wireType) - } - m.Reexec = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Reexec |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableStack", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableStack = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableStorage", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableStorage = bool(v != 0) - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Debug", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Debug = bool(v != 0) - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Overrides", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Overrides == nil { - m.Overrides = &V2ChainConfig{} - } - if err := m.Overrides.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EnableMemory", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EnableMemory = bool(v != 0) - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EnableReturnData", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.EnableReturnData = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2EIP712AllowedMsg) 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 ErrIntOverflowEvm - } - 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: EIP712AllowedMsg: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EIP712AllowedMsg: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MsgTypeUrl = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgValueTypeName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MsgValueTypeName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValueTypes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValueTypes = append(m.ValueTypes, V2EIP712MsgAttrType{}) - if err := m.ValueTypes[len(m.ValueTypes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NestedTypes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NestedTypes = append(m.NestedTypes, V2EIP712NestedMsgType{}) - if err := m.NestedTypes[len(m.NestedTypes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2EIP712NestedMsgType) 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 ErrIntOverflowEvm - } - 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: EIP712NestedMsgType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EIP712NestedMsgType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attrs = append(m.Attrs, V2EIP712MsgAttrType{}) - if err := m.Attrs[len(m.Attrs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *V2EIP712MsgAttrType) 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 ErrIntOverflowEvm - } - 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: EIP712MsgAttrType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EIP712MsgAttrType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvm - } - 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 ErrInvalidLengthEvm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipEvm(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, ErrIntOverflowEvm - } - 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, ErrIntOverflowEvm - } - 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, ErrIntOverflowEvm - } - 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, ErrInvalidLengthEvm - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupEvm - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthEvm - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthEvm = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEvm = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupEvm = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/evm/migrations/v3/store.go b/x/evm/migrations/v3/store.go index 09566fba85..e7e3918160 100644 --- a/x/evm/migrations/v3/store.go +++ b/x/evm/migrations/v3/store.go @@ -4,33 +4,25 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - v2types "github.com/evmos/ethermint/x/evm/migrations/v2/types" "github.com/evmos/ethermint/x/evm/types" + legacytypes "github.com/evmos/ethermint/x/evm/types/legacy" ) // MigrateStore runs the state migrations that includes upstream consensus // versions v2 to v5. Kava consensus version diverges from upstream at v2. func MigrateStore( ctx sdk.Context, - cdc codec.BinaryCodec, - legacyAmino *codec.LegacyAmino, + paramstore types.Subspace, storeKey storetypes.StoreKey, - paramStoreKey storetypes.StoreKey, - paramStoreTKey storetypes.StoreKey, + cdc codec.BinaryCodec, ) error { - // create independent paramstore with key table that is - // not tied to global state - paramstore := paramtypes.NewSubspace( - cdc, - legacyAmino, - paramStoreKey, - paramStoreTKey, - types.ModuleName, - ).WithKeyTable(v2types.ParamKeyTable()) + // ensure a subspace not passed from keeper includes the legacy param key table + if !paramstore.HasKeyTable() { + paramstore = paramstore.WithKeyTable(legacytypes.ParamKeyTable()) + } // load existing legacy parameters - var legacyParams v2types.V2Params + var legacyParams legacytypes.LegacyParams paramstore.GetParamSetIfExists(ctx, &legacyParams) // ------------------------------------------------------------------------- @@ -78,7 +70,7 @@ func MigrateStore( EnableCall: legacyParams.EnableCall, ExtraEIPs: legacyParams.ExtraEIPs, ChainConfig: newChainConfig, - EIP712AllowedMsgs: MigrateEIP712AllowedMsgs(legacyParams.EIP712AllowedMsgs), + EIP712AllowedMsgs: legacyParams.EIP712AllowedMsgs, AllowUnprotectedTxs: false, // Upstream v1 to v2 } @@ -91,45 +83,3 @@ func MigrateStore( return nil } - -// MigrateEIP712AllowedMsgs converts the old EIP712AllowedMsgs to the new one. -// No changes, just a type conversion. -func MigrateEIP712AllowedMsgs(old []v2types.V2EIP712AllowedMsg) []types.EIP712AllowedMsg { - new := make([]types.EIP712AllowedMsg, len(old)) - for i, msg := range old { - new[i] = types.EIP712AllowedMsg{ - MsgTypeUrl: msg.MsgTypeUrl, - MsgValueTypeName: msg.MsgValueTypeName, - ValueTypes: MigrateEIP712MsgAttrTypes(msg.ValueTypes), - NestedTypes: MigrateNestedTypes(msg.NestedTypes), - } - } - - return new -} - -// MigrateEIP712MsgAttrTypes converts the old EIP712MsgAttrTypes to the new one. -// No changes, just a type conversion. -func MigrateEIP712MsgAttrTypes(old []v2types.V2EIP712MsgAttrType) []types.EIP712MsgAttrType { - new := make([]types.EIP712MsgAttrType, len(old)) - for i, msg := range old { - // We can directly assign because of the same fields - new[i] = types.EIP712MsgAttrType(msg) - } - - return new -} - -// MigrateNestedTypes converts the old EIP712NestedMsgTypes to the new one. -// No changes, just a type conversion. -func MigrateNestedTypes(old []v2types.V2EIP712NestedMsgType) []types.EIP712NestedMsgType { - new := make([]types.EIP712NestedMsgType, len(old)) - for i, msg := range old { - new[i] = types.EIP712NestedMsgType{ - Name: msg.Name, - Attrs: MigrateEIP712MsgAttrTypes(msg.Attrs), - } - } - - return new -} diff --git a/x/evm/migrations/v3/store_test.go b/x/evm/migrations/v3/store_test.go index 9b5786dab3..ddf12a49d4 100644 --- a/x/evm/migrations/v3/store_test.go +++ b/x/evm/migrations/v3/store_test.go @@ -1,47 +1,55 @@ package v3_test import ( - "encoding/json" "testing" + "github.com/evmos/ethermint/x/evm/keeper" "github.com/evmos/ethermint/x/evm/types" + "github.com/evmos/ethermint/x/evm/vm/geth" "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/testutil" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/evmos/ethermint/app" "github.com/evmos/ethermint/encoding" - v2types "github.com/evmos/ethermint/x/evm/migrations/v2/types" v3 "github.com/evmos/ethermint/x/evm/migrations/v3" + legacytypes "github.com/evmos/ethermint/x/evm/types/legacy" + legacytestutil "github.com/evmos/ethermint/x/evm/types/legacy/testutil" ) func TestMigrate(t *testing.T) { encCfg := encoding.MakeConfig(app.ModuleBasics) cdc := encCfg.Codec - storeKey := sdk.NewKVStoreKey(paramtypes.ModuleName) - tKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) - ctx := testutil.DefaultContext(storeKey, tKey) + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + paramStoreKey := sdk.NewKVStoreKey(paramtypes.ModuleName) + paramStoreTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) + ctx := legacytestutil.NewDBContext([]storetypes.StoreKey{storeKey, paramStoreKey}, []storetypes.StoreKey{tKey, paramStoreTKey}) kvStore := ctx.KVStore(storeKey) paramstore := paramtypes.NewSubspace( cdc, encCfg.Amino, - storeKey, - tKey, + paramStoreKey, + paramStoreTKey, "evm", - ).WithKeyTable(v2types.ParamKeyTable()) + ).WithKeyTable(legacytypes.ParamKeyTable()) + + initialParams := legacytypes.DefaultParams() + + // new params treats an empty slice as nil + initialParams.EIP712AllowedMsgs = nil - initialParams := v2types.DefaultParams() paramstore.SetParamSet(ctx, &initialParams) err := v3.MigrateStore( ctx, - cdc, - encCfg.Amino, + paramstore, storeKey, - tKey, + cdc, ) require.NoError(t, err) @@ -50,104 +58,50 @@ func TestMigrate(t *testing.T) { var migratedParams types.Params cdc.MustUnmarshal(paramsBz, &migratedParams) - // No changes to existing params - require.Equal(t, initialParams.EvmDenom, migratedParams.EvmDenom) - require.Equal(t, initialParams.EnableCall, migratedParams.EnableCall) - require.Equal(t, initialParams.EnableCreate, migratedParams.EnableCreate) - require.Equal(t, initialParams.ExtraEIPs, migratedParams.ExtraEIPs) - require.ElementsMatch(t, initialParams.EIP712AllowedMsgs, migratedParams.EIP712AllowedMsgs) - - // New param should be false - require.Equal(t, false, migratedParams.AllowUnprotectedTxs) - - // New ChainConfig options are set to nil - expectedChainConfig := types.DefaultChainConfig() - expectedChainConfig.GrayGlacierBlock = nil - expectedChainConfig.ShanghaiBlock = nil - expectedChainConfig.CancunBlock = nil - - require.EqualValues(t, expectedChainConfig, migratedParams.ChainConfig) + legacytestutil.AssertParamsEqual(t, initialParams, migratedParams) } func TestMigrate_Mainnet(t *testing.T) { encCfg := encoding.MakeConfig(app.ModuleBasics) cdc := encCfg.Codec - storeKey := sdk.NewKVStoreKey(paramtypes.ModuleName) - tKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) - ctx := testutil.DefaultContext(storeKey, tKey) + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + paramStoreKey := sdk.NewKVStoreKey(paramtypes.ModuleName) + paramStoreTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) + ctx := legacytestutil.NewDBContext([]storetypes.StoreKey{storeKey, paramStoreKey}, []storetypes.StoreKey{tKey, paramStoreTKey}) kvStore := ctx.KVStore(storeKey) - initialChainConfig := v2types.DefaultChainConfig() + initialChainConfig := legacytypes.DefaultChainConfig() initialChainConfig.LondonBlock = nil initialChainConfig.ArrowGlacierBlock = nil initialChainConfig.MergeForkBlock = nil - initialParams := v2types.V2Params{ + initialParams := legacytypes.LegacyParams{ EvmDenom: "akava", EnableCreate: true, EnableCall: true, ExtraEIPs: nil, ChainConfig: initialChainConfig, // Start with a subset of allowed messages - EIP712AllowedMsgs: []v2types.V2EIP712AllowedMsg{ - { - MsgTypeUrl: "/kava.evmutil.v1beta1.MsgConvertERC20ToCoin", - MsgValueTypeName: "MsgValueEVMConvertERC20ToCoin", - ValueTypes: []v2types.V2EIP712MsgAttrType{ - {Name: "initiator", Type: "string"}, - {Name: "receiver", Type: "string"}, - {Name: "kava_erc20_address", Type: "string"}, - {Name: "amount", Type: "string"}, - }, - }, - { - MsgTypeUrl: "/kava.evmutil.v1beta1.MsgConvertCoinToERC20", - MsgValueTypeName: "MsgValueEVMConvertCoinToERC20", - ValueTypes: []v2types.V2EIP712MsgAttrType{ - {Name: "initiator", Type: "string"}, - {Name: "receiver", Type: "string"}, - {Name: "amount", Type: "Coin"}, - }, - }, - // x/earn - { - MsgTypeUrl: "/kava.earn.v1beta1.MsgDeposit", - MsgValueTypeName: "MsgValueEarnDeposit", - ValueTypes: []v2types.V2EIP712MsgAttrType{ - {Name: "depositor", Type: "string"}, - {Name: "amount", Type: "Coin"}, - {Name: "strategy", Type: "int32"}, - }, - }, - { - MsgTypeUrl: "/kava.earn.v1beta1.MsgWithdraw", - MsgValueTypeName: "MsgValueEarnWithdraw", - ValueTypes: []v2types.V2EIP712MsgAttrType{ - {Name: "from", Type: "string"}, - {Name: "amount", Type: "Coin"}, - {Name: "strategy", Type: "int32"}, - }, - }, - }, + EIP712AllowedMsgs: legacytestutil.TestEIP712AllowedMsgs, } paramstore := paramtypes.NewSubspace( cdc, encCfg.Amino, - storeKey, - tKey, + paramStoreKey, + paramStoreTKey, "evm", - ).WithKeyTable(v2types.ParamKeyTable()) + ).WithKeyTable(legacytypes.ParamKeyTable()) paramstore.SetParamSet(ctx, &initialParams) err := v3.MigrateStore( ctx, - cdc, - encCfg.Amino, + paramstore, storeKey, - tKey, + cdc, ) require.NoError(t, err) @@ -156,31 +110,102 @@ func TestMigrate_Mainnet(t *testing.T) { var migratedParams types.Params cdc.MustUnmarshal(paramsBz, &migratedParams) - require.Equal(t, initialParams.EvmDenom, migratedParams.EvmDenom) - require.Equal(t, initialParams.EnableCall, migratedParams.EnableCall) - require.Equal(t, initialParams.EnableCreate, migratedParams.EnableCreate) - require.Equal(t, false, migratedParams.AllowUnprotectedTxs) - require.Equal(t, initialParams.ExtraEIPs, migratedParams.ExtraEIPs) + // ensure migrated params match initial params + legacytestutil.AssertParamsEqual(t, initialParams, migratedParams) +} - expectedEIP712AllowedMsgsJson, err := json.Marshal(initialParams.EIP712AllowedMsgs) - require.NoError(t, err) +func TestKeyTableCompatiabilityWithKeeper(t *testing.T) { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec - migratedEIP712AllowedMsgsJson, err := json.Marshal(migratedParams.EIP712AllowedMsgs) - require.NoError(t, err) + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + paramStoreKey := sdk.NewKVStoreKey(paramtypes.ModuleName) + paramStoreTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) + ctx := legacytestutil.NewDBContext([]storetypes.StoreKey{storeKey, paramStoreKey}, []storetypes.StoreKey{tKey, paramStoreTKey}) + + ak := app.Setup(false, nil).AccountKeeper + + // only used to set initial params + initialSubspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ).WithKeyTable(legacytypes.ParamKeyTable()) + initialParams := legacytypes.DefaultParams() + initialSubspace.SetParamSet(ctx, &initialParams) + + // vanilla subspace (no key table) that keeper + // will register a key table on + subspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ) + keeper.NewKeeper( + cdc, storeKey, tKey, authtypes.NewModuleAddress("gov"), + ak, + nil, nil, nil, nil, + geth.NewEVM, + "", + subspace, + ) + + // ensure that the migration is compatible with the keeper legacy + // key table registration + require.NotPanics(t, func() { + v3.MigrateStore( + ctx, + subspace, + storeKey, + cdc, + ) + + }, "type mismatch with registered table") +} - // Convert to JSON since they are different types but of same field and values - require.JSONEq(t, string(expectedEIP712AllowedMsgsJson), string(migratedEIP712AllowedMsgsJson)) +func TestMigrationRegistersItsOwnKeyTable(t *testing.T) { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec - expectedChainConfig := types.DefaultChainConfig() - // Previously nil ChainConfig options are still nil - expectedChainConfig.LondonBlock = nil - expectedChainConfig.ArrowGlacierBlock = nil - expectedChainConfig.MergeNetsplitBlock = nil + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + paramStoreKey := sdk.NewKVStoreKey(paramtypes.ModuleName) + paramStoreTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey) + ctx := legacytestutil.NewDBContext([]storetypes.StoreKey{storeKey, paramStoreKey}, []storetypes.StoreKey{tKey, paramStoreTKey}) - // New ChainConfig options are set to nil - expectedChainConfig.GrayGlacierBlock = nil - expectedChainConfig.ShanghaiBlock = nil - expectedChainConfig.CancunBlock = nil + // only used to set initial params + initialSubspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ).WithKeyTable(legacytypes.ParamKeyTable()) + initialParams := legacytypes.DefaultParams() + initialSubspace.SetParamSet(ctx, &initialParams) - require.EqualValues(t, expectedChainConfig, migratedParams.ChainConfig) + // vanilla subspace (no key table) that MigrateStore + // will register a key table on + subspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + paramStoreKey, + paramStoreTKey, + "evm", + ) + // ensure that the migration is compatible with the keeper legacy + // key table registration + require.NotPanics(t, func() { + v3.MigrateStore( + ctx, + subspace, + storeKey, + cdc, + ) + }) } diff --git a/x/evm/migrations/v2/types/chain_config.go b/x/evm/types/legacy/chain_config.go similarity index 84% rename from x/evm/migrations/v2/types/chain_config.go rename to x/evm/types/legacy/chain_config.go index dfadf56cdd..1c6c8361bf 100644 --- a/x/evm/migrations/v2/types/chain_config.go +++ b/x/evm/types/legacy/chain_config.go @@ -4,7 +4,7 @@ import ( "math/big" "strings" - sdk "github.com/cosmos/cosmos-sdk/types" + sdkmath "cosmossdk.io/math" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/common" @@ -15,7 +15,7 @@ import ( // EthereumConfig returns an Ethereum ChainConfig for EVM state transitions. // All the negative or nil values are converted to nil -func (cc V2ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { +func (cc LegacyChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { return ¶ms.ChainConfig{ ChainID: chainID, HomesteadBlock: getBlockValue(cc.HomesteadBlock), @@ -41,23 +41,23 @@ func (cc V2ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig { } // DefaultChainConfig returns default evm parameters. -func DefaultChainConfig() V2ChainConfig { - homesteadBlock := sdk.ZeroInt() - daoForkBlock := sdk.ZeroInt() - eip150Block := sdk.ZeroInt() - eip155Block := sdk.ZeroInt() - eip158Block := sdk.ZeroInt() - byzantiumBlock := sdk.ZeroInt() - constantinopleBlock := sdk.ZeroInt() - petersburgBlock := sdk.ZeroInt() - istanbulBlock := sdk.ZeroInt() - muirGlacierBlock := sdk.ZeroInt() - berlinBlock := sdk.ZeroInt() - londonBlock := sdk.ZeroInt() - arrowGlacierBlock := sdk.ZeroInt() - mergeForkBlock := sdk.ZeroInt() - - return V2ChainConfig{ +func DefaultChainConfig() LegacyChainConfig { + homesteadBlock := sdkmath.ZeroInt() + daoForkBlock := sdkmath.ZeroInt() + eip150Block := sdkmath.ZeroInt() + eip155Block := sdkmath.ZeroInt() + eip158Block := sdkmath.ZeroInt() + byzantiumBlock := sdkmath.ZeroInt() + constantinopleBlock := sdkmath.ZeroInt() + petersburgBlock := sdkmath.ZeroInt() + istanbulBlock := sdkmath.ZeroInt() + muirGlacierBlock := sdkmath.ZeroInt() + berlinBlock := sdkmath.ZeroInt() + londonBlock := sdkmath.ZeroInt() + arrowGlacierBlock := sdkmath.ZeroInt() + mergeForkBlock := sdkmath.ZeroInt() + + return LegacyChainConfig{ HomesteadBlock: &homesteadBlock, DAOForkBlock: &daoForkBlock, DAOForkSupport: true, @@ -77,7 +77,7 @@ func DefaultChainConfig() V2ChainConfig { } } -func getBlockValue(block *sdk.Int) *big.Int { +func getBlockValue(block *sdkmath.Int) *big.Int { if block == nil || block.IsNegative() { return nil } @@ -87,7 +87,7 @@ func getBlockValue(block *sdk.Int) *big.Int { // Validate performs a basic validation of the ChainConfig params. The function will return an error // if any of the block values is uninitialized (i.e nil) or if the EIP150Hash is an invalid hash. -func (cc V2ChainConfig) Validate() error { +func (cc LegacyChainConfig) Validate() error { if err := validateBlock(cc.HomesteadBlock); err != nil { return sdkerrors.Wrap(err, "homesteadBlock") } @@ -149,7 +149,7 @@ func validateHash(hex string) error { return nil } -func validateBlock(block *sdk.Int) error { +func validateBlock(block *sdkmath.Int) error { // nil value means that the fork has not yet been applied if block == nil { return nil diff --git a/x/evm/types/legacy/evm.pb.go b/x/evm/types/legacy/evm.pb.go new file mode 100644 index 0000000000..e0e4fd40a9 --- /dev/null +++ b/x/evm/types/legacy/evm.pb.go @@ -0,0 +1,71 @@ +package types + +import ( + sdkmath "cosmossdk.io/math" + "github.com/evmos/ethermint/x/evm/types" +) + +// +// LegacyParams and LegacyChainConfig are only used in +// the v3 store migration and fetching parameters for old blocks. +// +// Since the paramstore operates with Amino, we do not need full protobuf +// definitions since legacy param usage not propogated to methods that use +// protobuf serialization. In addition, since these do not implement interfaces +// used in decoding, we do not need to register these types on any codecs. +// + +// LegacyParams defines the EVM module parameters +type LegacyParams struct { + // evm denom represents the token denomination used to run the EVM state + // transitions. + EvmDenom string `protobuf:"bytes,1,opt,name=evm_denom,json=evmDenom,proto3" json:"evm_denom,omitempty" yaml:"evm_denom"` + // enable create toggles state transitions that use the vm.Create function + EnableCreate bool `protobuf:"varint,2,opt,name=enable_create,json=enableCreate,proto3" json:"enable_create,omitempty" yaml:"enable_create"` + // enable call toggles state transitions that use the vm.Call function + EnableCall bool `protobuf:"varint,3,opt,name=enable_call,json=enableCall,proto3" json:"enable_call,omitempty" yaml:"enable_call"` + // extra eips defines the additional EIPs for the vm.Config + ExtraEIPs []int64 `protobuf:"varint,4,rep,packed,name=extra_eips,json=extraEips,proto3" json:"extra_eips,omitempty" yaml:"extra_eips"` + // chain config defines the EVM chain configuration parameters + ChainConfig LegacyChainConfig `protobuf:"bytes,5,opt,name=chain_config,json=chainConfig,proto3" json:"chain_config" yaml:"chain_config"` + // list of allowed eip712 msgs and their types + EIP712AllowedMsgs []types.EIP712AllowedMsg `protobuf:"bytes,6,rep,name=eip712_allowed_msgs,json=eip712AllowedMsgs,proto3" json:"eip712_allowed_msgs"` +} + +// LegacyChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values +// instead of *big.Int. +type LegacyChainConfig struct { + // Homestead switch block (nil no fork, 0 = already homestead) + HomesteadBlock *sdkmath.Int `protobuf:"bytes,1,opt,name=homestead_block,json=homesteadBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"homestead_block,omitempty" yaml:"homestead_block"` + // TheDAO hard-fork switch block (nil no fork) + DAOForkBlock *sdkmath.Int `protobuf:"bytes,2,opt,name=dao_fork_block,json=daoForkBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"dao_fork_block,omitempty" yaml:"dao_fork_block"` + // Whether the nodes supports or opposes the DAO hard-fork + DAOForkSupport bool `protobuf:"varint,3,opt,name=dao_fork_support,json=daoForkSupport,proto3" json:"dao_fork_support,omitempty" yaml:"dao_fork_support"` + // EIP150 implements the Gas price changes + // (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork) + EIP150Block *sdkmath.Int `protobuf:"bytes,4,opt,name=eip150_block,json=eip150Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip150_block,omitempty" yaml:"eip150_block"` + // EIP150 HF hash (needed for header only clients as only gas pricing changed) + EIP150Hash string `protobuf:"bytes,5,opt,name=eip150_hash,json=eip150Hash,proto3" json:"eip150_hash,omitempty" yaml:"byzantium_block"` + // EIP155Block HF block + EIP155Block *sdkmath.Int `protobuf:"bytes,6,opt,name=eip155_block,json=eip155Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip155_block,omitempty" yaml:"eip155_block"` + // EIP158 HF block + EIP158Block *sdkmath.Int `protobuf:"bytes,7,opt,name=eip158_block,json=eip158Block,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eip158_block,omitempty" yaml:"eip158_block"` + // Byzantium switch block (nil no fork, 0 = already on byzantium) + ByzantiumBlock *sdkmath.Int `protobuf:"bytes,8,opt,name=byzantium_block,json=byzantiumBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"byzantium_block,omitempty" yaml:"byzantium_block"` + // Constantinople switch block (nil no fork, 0 = already activated) + ConstantinopleBlock *sdkmath.Int `protobuf:"bytes,9,opt,name=constantinople_block,json=constantinopleBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"constantinople_block,omitempty" yaml:"constantinople_block"` + // Petersburg switch block (nil same as Constantinople) + PetersburgBlock *sdkmath.Int `protobuf:"bytes,10,opt,name=petersburg_block,json=petersburgBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"petersburg_block,omitempty" yaml:"petersburg_block"` + // Istanbul switch block (nil no fork, 0 = already on istanbul) + IstanbulBlock *sdkmath.Int `protobuf:"bytes,11,opt,name=istanbul_block,json=istanbulBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"istanbul_block,omitempty" yaml:"istanbul_block"` + // Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated) + MuirGlacierBlock *sdkmath.Int `protobuf:"bytes,12,opt,name=muir_glacier_block,json=muirGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"muir_glacier_block,omitempty" yaml:"muir_glacier_block"` + // Berlin switch block (nil = no fork, 0 = already on berlin) + BerlinBlock *sdkmath.Int `protobuf:"bytes,13,opt,name=berlin_block,json=berlinBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"berlin_block,omitempty" yaml:"berlin_block"` + // London switch block (nil = no fork, 0 = already on london) + LondonBlock *sdkmath.Int `protobuf:"bytes,17,opt,name=london_block,json=londonBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"london_block,omitempty" yaml:"london_block"` + // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) + ArrowGlacierBlock *sdkmath.Int `protobuf:"bytes,18,opt,name=arrow_glacier_block,json=arrowGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"arrow_glacier_block,omitempty" yaml:"arrow_glacier_block"` + // EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in merge proceedings) + MergeForkBlock *sdkmath.Int `protobuf:"bytes,19,opt,name=merge_fork_block,json=mergeForkBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"merge_fork_block,omitempty" yaml:"merge_fork_block"` +} diff --git a/x/evm/migrations/v2/types/params.go b/x/evm/types/legacy/params.go similarity index 82% rename from x/evm/migrations/v2/types/params.go rename to x/evm/types/legacy/params.go index fc908e057b..346efb47f9 100644 --- a/x/evm/migrations/v2/types/params.go +++ b/x/evm/types/legacy/params.go @@ -2,20 +2,18 @@ package types import ( "fmt" - "math/big" - - "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" + ethtypes "github.com/evmos/ethermint/types" + "github.com/evmos/ethermint/x/evm/types" ) -var _ paramtypes.ParamSet = &V2Params{} +var _ paramtypes.ParamSet = &LegacyParams{} const ( - DefaultEVMDenom = types.AttoPhoton + DefaultEVMDenom = ethtypes.AttoPhoton ) // Parameter keys @@ -37,36 +35,36 @@ var ( // ParamKeyTable returns the parameter key table. func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&V2Params{}) + return paramtypes.NewKeyTable().RegisterParamSet(&LegacyParams{}) } // NewParams creates a new Params instance -func NewParams(evmDenom string, enableCreate, enableCall bool, config V2ChainConfig, extraEIPs ...int64) V2Params { - return V2Params{ +func NewParams(evmDenom string, enableCreate, enableCall bool, config LegacyChainConfig, extraEIPs ...int64) LegacyParams { + return LegacyParams{ EvmDenom: evmDenom, EnableCreate: enableCreate, EnableCall: enableCall, ExtraEIPs: extraEIPs, ChainConfig: config, - EIP712AllowedMsgs: []V2EIP712AllowedMsg{}, + EIP712AllowedMsgs: []types.EIP712AllowedMsg{}, } } // DefaultParams returns default evm parameters // ExtraEIPs is empty to prevent overriding the latest hard fork instruction set -func DefaultParams() V2Params { - return V2Params{ +func DefaultParams() LegacyParams { + return LegacyParams{ EvmDenom: DefaultEVMDenom, EnableCreate: true, EnableCall: true, ChainConfig: DefaultChainConfig(), ExtraEIPs: nil, - EIP712AllowedMsgs: []V2EIP712AllowedMsg{}, + EIP712AllowedMsgs: []types.EIP712AllowedMsg{}, } } // ParamSetPairs returns the parameter set pairs. -func (p *V2Params) ParamSetPairs() paramtypes.ParamSetPairs { +func (p *LegacyParams) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(ParamStoreKeyEVMDenom, &p.EvmDenom, validateEVMDenom), paramtypes.NewParamSetPair(ParamStoreKeyEnableCreate, &p.EnableCreate, validateBool), @@ -78,7 +76,7 @@ func (p *V2Params) ParamSetPairs() paramtypes.ParamSetPairs { } // Validate performs basic validation on evm parameters. -func (p V2Params) Validate() error { +func (p LegacyParams) Validate() error { if err := sdk.ValidateDenom(p.EvmDenom); err != nil { return err } @@ -95,7 +93,7 @@ func (p V2Params) Validate() error { } // EIP712AllowedMsgFromMsgType returns the EIP712AllowedMsg for a given message type url. -func (p V2Params) EIP712AllowedMsgFromMsgType(msgTypeUrl string) *V2EIP712AllowedMsg { +func (p LegacyParams) EIP712AllowedMsgFromMsgType(msgTypeUrl string) *types.EIP712AllowedMsg { for _, allowedMsg := range p.EIP712AllowedMsgs { if allowedMsg.MsgTypeUrl == msgTypeUrl { return &allowedMsg @@ -105,7 +103,7 @@ func (p V2Params) EIP712AllowedMsgFromMsgType(msgTypeUrl string) *V2EIP712Allowe } // EIPs returns the ExtraEips as a int slice -func (p V2Params) EIPs() []int { +func (p LegacyParams) EIPs() []int { eips := make([]int, len(p.ExtraEIPs)) for i, eip := range p.ExtraEIPs { eips[i] = int(eip) @@ -146,7 +144,7 @@ func validateEIPs(i interface{}) error { } func validateChainConfig(i interface{}) error { - cfg, ok := i.(V2ChainConfig) + cfg, ok := i.(LegacyChainConfig) if !ok { return fmt.Errorf("invalid chain config type: %T", i) } @@ -155,7 +153,7 @@ func validateChainConfig(i interface{}) error { } func validateEIP712AllowedMsgs(i interface{}) error { - allowedMsgs, ok := i.([]V2EIP712AllowedMsg) + allowedMsgs, ok := i.([]types.EIP712AllowedMsg) if !ok { return fmt.Errorf("invalid EIP712AllowedMsg slice type: %T", i) } @@ -171,8 +169,3 @@ func validateEIP712AllowedMsgs(i interface{}) error { return nil } - -// IsLondon returns if london hardfork is enabled. -func IsLondon(ethConfig *params.ChainConfig, height int64) bool { - return ethConfig.IsLondon(big.NewInt(height)) -} diff --git a/x/evm/types/legacy/testutil/helper.go b/x/evm/types/legacy/testutil/helper.go new file mode 100644 index 0000000000..cab4aacd33 --- /dev/null +++ b/x/evm/types/legacy/testutil/helper.go @@ -0,0 +1,123 @@ +package testutil + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/evmos/ethermint/x/evm/types" + legacytypes "github.com/evmos/ethermint/x/evm/types/legacy" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" +) + +// NewDefaultContext with multile mounted stores +func NewDBContext(keys []storetypes.StoreKey, tkeys []storetypes.StoreKey) sdk.Context { + db := dbm.NewMemDB() + cms := store.NewCommitMultiStore(db) + + for _, key := range keys { + cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) + } + + for _, tkey := range tkeys { + cms.MountStoreWithDB(tkey, storetypes.StoreTypeTransient, db) + } + + err := cms.LoadLatestVersion() + if err != nil { + panic(err) + } + + return sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger()) +} + +func AssertParamsEqual(t *testing.T, legacyParams legacytypes.LegacyParams, params types.Params) { + // + // Check Primitive Top Level Values + // + require.Equal(t, legacyParams.EvmDenom, params.EvmDenom) + require.Equal(t, legacyParams.EnableCall, params.EnableCall) + require.Equal(t, legacyParams.EnableCreate, params.EnableCreate) + require.Equal(t, legacyParams.ExtraEIPs, params.ExtraEIPs) + + // + // Check Chain Config + // + legacyChainConfig := legacyParams.ChainConfig + chainConfig := params.ChainConfig + + require.Equal(t, legacyChainConfig.HomesteadBlock, chainConfig.HomesteadBlock) + require.Equal(t, legacyChainConfig.DAOForkBlock, chainConfig.DAOForkBlock) + require.Equal(t, legacyChainConfig.DAOForkSupport, chainConfig.DAOForkSupport) + require.Equal(t, legacyChainConfig.EIP150Block, chainConfig.EIP150Block) + require.Equal(t, legacyChainConfig.EIP150Hash, chainConfig.EIP150Hash) + require.Equal(t, legacyChainConfig.ByzantiumBlock, chainConfig.ByzantiumBlock) + require.Equal(t, legacyChainConfig.ConstantinopleBlock, chainConfig.ConstantinopleBlock) + require.Equal(t, legacyChainConfig.PetersburgBlock, chainConfig.PetersburgBlock) + require.Equal(t, legacyChainConfig.IstanbulBlock, chainConfig.IstanbulBlock) + require.Equal(t, legacyChainConfig.MuirGlacierBlock, chainConfig.MuirGlacierBlock) + require.Equal(t, legacyChainConfig.BerlinBlock, chainConfig.BerlinBlock) + require.Equal(t, legacyChainConfig.LondonBlock, chainConfig.LondonBlock) + require.Equal(t, legacyChainConfig.ArrowGlacierBlock, chainConfig.ArrowGlacierBlock) + // renamed value + require.Equal(t, legacyChainConfig.MergeForkBlock, chainConfig.MergeNetsplitBlock) + // new values that should be nil + require.Nil(t, chainConfig.GrayGlacierBlock) + require.Nil(t, chainConfig.ShanghaiBlock) + require.Nil(t, chainConfig.CancunBlock) + + // + // EIP712 + // + require.Equal(t, legacyParams.EIP712AllowedMsgs, params.EIP712AllowedMsgs) + + // + // New Parameter + // + require.Equal(t, false, params.AllowUnprotectedTxs) +} + +var TestEIP712AllowedMsgs = []types.EIP712AllowedMsg{ + { + MsgTypeUrl: "/kava.evmutil.v1beta1.MsgConvertERC20ToCoin", + MsgValueTypeName: "MsgValueEVMConvertERC20ToCoin", + ValueTypes: []types.EIP712MsgAttrType{ + {Name: "initiator", Type: "string"}, + {Name: "receiver", Type: "string"}, + {Name: "kava_erc20_address", Type: "string"}, + {Name: "amount", Type: "string"}, + }, + }, + { + MsgTypeUrl: "/kava.evmutil.v1beta1.MsgConvertCoinToERC20", + MsgValueTypeName: "MsgValueEVMConvertCoinToERC20", + ValueTypes: []types.EIP712MsgAttrType{ + {Name: "initiator", Type: "string"}, + {Name: "receiver", Type: "string"}, + {Name: "amount", Type: "Coin"}, + }, + }, + // x/earn + { + MsgTypeUrl: "/kava.earn.v1beta1.MsgDeposit", + MsgValueTypeName: "MsgValueEarnDeposit", + ValueTypes: []types.EIP712MsgAttrType{ + {Name: "depositor", Type: "string"}, + {Name: "amount", Type: "Coin"}, + {Name: "strategy", Type: "int32"}, + }, + }, + { + MsgTypeUrl: "/kava.earn.v1beta1.MsgWithdraw", + MsgValueTypeName: "MsgValueEarnWithdraw", + ValueTypes: []types.EIP712MsgAttrType{ + {Name: "from", Type: "string"}, + {Name: "amount", Type: "Coin"}, + {Name: "strategy", Type: "int32"}, + }, + }, +} diff --git a/x/evm/types/params_legacy.go b/x/evm/types/params_legacy.go deleted file mode 100644 index e1ba842bc9..0000000000 --- a/x/evm/types/params_legacy.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Evmos Foundation -// This file is part of Evmos' Ethermint library. -// -// The Ethermint library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Ethermint library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE -package types - -import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - -// Parameter keys -var ( - ParamStoreKeyEVMDenom = []byte("EVMDenom") - ParamStoreKeyEnableCreate = []byte("EnableCreate") - ParamStoreKeyEnableCall = []byte("EnableCall") - ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs") - ParamStoreKeyChainConfig = []byte("ChainConfig") - ParamStoreKeyAllowUnprotectedTxs = []byte("AllowUnprotectedTxs") - ParamStoreKeyEIP712AllowedMsgs = []byte("EIP712AllowedMsgs") -) - -// Deprecated: ParamKeyTable returns the parameter key table. -// Usage of x/params to manage parameters is deprecated in favor of x/gov -// controlled execution of MsgUpdateParams messages. These types remain solely -// for migration purposes and will be removed in a future release. -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// Deprecated: ParamSetPairs returns the parameter set pairs. -// Usage of x/params to manage parameters is deprecated in favor of x/gov -// controlled execution of MsgUpdateParams messages. These types remain solely -// for migration purposes and will be removed in a future release. -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, validateEIPs), - paramtypes.NewParamSetPair(ParamStoreKeyChainConfig, &p.ChainConfig, validateChainConfig), - paramtypes.NewParamSetPair(ParamStoreKeyAllowUnprotectedTxs, &p.AllowUnprotectedTxs, validateBool), - paramtypes.NewParamSetPair(ParamStoreKeyEIP712AllowedMsgs, &p.EIP712AllowedMsgs, validateEIP712AllowedMsgs), - } -} diff --git a/x/feemarket/keeper/keeper.go b/x/feemarket/keeper/keeper.go index 3d702a545c..020e20d9b6 100644 --- a/x/feemarket/keeper/keeper.go +++ b/x/feemarket/keeper/keeper.go @@ -52,6 +52,10 @@ func NewKeeper( panic(err) } + if !ss.HasKeyTable() { + ss = ss.WithKeyTable(types.ParamKeyTable()) + } + return Keeper{ cdc: cdc, storeKey: storeKey, diff --git a/x/feemarket/keeper/params_test.go b/x/feemarket/keeper/params_test.go index 59f1a2856f..1601e8f221 100644 --- a/x/feemarket/keeper/params_test.go +++ b/x/feemarket/keeper/params_test.go @@ -3,6 +3,13 @@ package keeper_test import ( "reflect" + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/evmos/ethermint/app" + "github.com/evmos/ethermint/encoding" + "github.com/evmos/ethermint/x/feemarket/keeper" "github.com/evmos/ethermint/x/feemarket/types" ) @@ -69,3 +76,49 @@ func (suite *KeeperTestSuite) TestSetGetParams() { }) } } + +func (suite *KeeperTestSuite) TestLegacyParamsKeyTableRegistration() { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + ctx := testutil.DefaultContext(storeKey, tKey) + + // paramspace used only for setting legacy parameters (not given to keeper) + setParamSpace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + storeKey, + tKey, + "feemarket", + ).WithKeyTable(types.ParamKeyTable()) + params := types.DefaultParams() + setParamSpace.SetParamSet(ctx, ¶ms) + + // param space that has not been created with a key table + unregisteredSubspace := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + storeKey, + tKey, + "feemarket", + ) + + // assertion required to ensure we are testing correctness + // of a keeper receiving a subpsace without a key table registration + suite.Require().False(unregisteredSubspace.HasKeyTable()) + + // create a keeper, mimicking an app.go which has not registered the key table + k := keeper.NewKeeper(cdc, authtypes.NewModuleAddress("gov"), storeKey, tKey, unregisteredSubspace) + + // the keeper must set the key table + var fetchedParams types.Params + suite.Require().NotPanics(func() { fetchedParams = k.GetParams(ctx) }) + // this modifies the internal data of the subspace, so we should see the key table registered + suite.Require().True(unregisteredSubspace.HasKeyTable()) + // general check that params match what we set and are not nil + suite.Require().Equal(params, fetchedParams) + // ensure we do not attempt to override any existing key tables to keep compatibility + // when passing a subpsace to the keeper that has already been used to work with parameters + suite.Require().NotPanics(func() { keeper.NewKeeper(cdc, authtypes.NewModuleAddress("gov"), storeKey, tKey, unregisteredSubspace) }) +}