From d9a405f2b924b4eff58ac0c453679d9586fd1471 Mon Sep 17 00:00:00 2001 From: drklee3 Date: Thu, 30 Mar 2023 11:08:29 -0700 Subject: [PATCH] Apply Kava patches on v0.21.0 (#16) * apply patch for base account to eth account conversion on contract (#5) Apply patch for base account to eth account conversion on contract * register EthAccount with legacy amino codec in order to use EthAccounts (#8) over json rpc * Update cosmos-sdk to use Kava fork and and informal systems tendermint fork * update type signature to match forked sdk (#10) * Add EIP712 with multiple messages and migrations Co-authored-by: Nick DeLuca * Update eip712 tests and params Removal of unsupported test cases * fix denoms_to_claim type * Add tip to ConstructUntypedEIP712Data * Revert "update type signature to match forked sdk (#10)" This reverts commit 7c7109804ca0309ef95aba24258f6c4261e6eb3d. * Update cosmos fork to remove block height from account constructor * Add v3 migrations Includes upstream migrations 2-5 * Remove failing redundant migrations test * Remove upstream v4 and v5 migrations * Update migration docs * Remove redundant v2 param types * Remove min gas parsing in rosetta config * Update Cosmos v0.46.11 and cometbft v0.34.27 * Update go.mod * Rename v2 migration types to avoid duplicate proto registration * Use tagged Cosmos sdk version v0.46.11-kava.1 --------- Co-authored-by: Nick DeLuca Co-authored-by: Ruaridh Co-authored-by: DracoLi --- app/ante/ante_test.go | 176 +- app/ante/eip712.go | 17 +- app/ante/fee_market_test.go | 14 + app/ante/utils_test.go | 33 +- app/app.go | 3 - cmd/ethermintd/root.go | 3 - crypto/ethsecp256k1/ethsecp256k1.go | 15 +- docs/api/proto-docs.md | 53 + encoding/codec/codec.go | 1 + ethereum/eip712/eip712.go | 515 +---- ethereum/eip712/eip712_test.go | 432 ---- ethereum/eip712/encoding.go | 314 --- ethereum/eip712/msg_test.go | 158 ++ ethereum/eip712/preprocess.go | 98 - ethereum/eip712/preprocess_test.go | 222 -- ethereum/eip712/types.go | 60 + go.mod | 37 +- go.sum | 68 +- proto/ethermint/evm/v1/evm.proto | 35 +- server/start.go | 10 +- server/util.go | 2 +- types/codec.go | 6 + x/evm/keeper/grpc_query_test.go | 1 + x/evm/keeper/migrations.go | 19 +- x/evm/keeper/migrations_test.go | 41 - x/evm/keeper/statedb.go | 15 +- x/evm/keeper/statedb_test.go | 101 + x/evm/migrations/v2/store.go | 231 ++ x/evm/migrations/v2/store_test.go | 45 + x/evm/migrations/v2/types/chain_config.go | 165 ++ x/evm/migrations/{v4 => v2}/types/evm.pb.go | 2257 +++++++++++-------- x/evm/migrations/v2/types/params.go | 178 ++ x/evm/migrations/v3/store.go | 121 + x/evm/migrations/v3/store_test.go | 184 ++ x/evm/migrations/v4/migrate.go | 51 - x/evm/migrations/v4/migrate_test.go | 74 - x/evm/migrations/v5/migrate.go | 64 - x/evm/migrations/v5/migrate_test.go | 61 - x/evm/migrations/v5/types/evm.pb.go | 479 ---- x/evm/module.go | 12 +- x/evm/types/evm.pb.go | 1105 ++++++++- x/evm/types/params.go | 46 +- x/evm/types/params_legacy.go | 2 + x/evm/types/params_test.go | 4 +- 44 files changed, 4039 insertions(+), 3489 deletions(-) delete mode 100644 ethereum/eip712/eip712_test.go delete mode 100644 ethereum/eip712/encoding.go create mode 100644 ethereum/eip712/msg_test.go delete mode 100644 ethereum/eip712/preprocess.go delete mode 100644 ethereum/eip712/preprocess_test.go create mode 100644 ethereum/eip712/types.go delete mode 100644 x/evm/keeper/migrations_test.go create mode 100644 x/evm/migrations/v2/store.go create mode 100644 x/evm/migrations/v2/store_test.go create mode 100644 x/evm/migrations/v2/types/chain_config.go rename x/evm/migrations/{v4 => v2}/types/evm.pb.go (63%) create mode 100644 x/evm/migrations/v2/types/params.go create mode 100644 x/evm/migrations/v3/store.go create mode 100644 x/evm/migrations/v3/store_test.go delete mode 100644 x/evm/migrations/v4/migrate.go delete mode 100644 x/evm/migrations/v4/migrate_test.go delete mode 100644 x/evm/migrations/v5/migrate.go delete mode 100644 x/evm/migrations/v5/migrate_test.go delete mode 100644 x/evm/migrations/v5/types/evm.pb.go diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index 15cc95338e..078ae928cd 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -5,7 +5,6 @@ import ( "fmt" "math/big" "strings" - "time" sdkmath "cosmossdk.io/math" kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" @@ -19,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/authz" sdk "github.com/cosmos/cosmos-sdk/types" @@ -49,6 +47,69 @@ func (suite AnteTestSuite) TestAnteHandler() { suite.app.EvmKeeper.SetBalance(suite.ctx, addr, big.NewInt(10000000000)) + params := suite.app.EvmKeeper.GetParams(suite.ctx) + params.EIP712AllowedMsgs = []evmtypes.EIP712AllowedMsg{ + { + MsgTypeUrl: "/cosmos.bank.v1beta1.MsgSend", + MsgValueTypeName: "MsgValueSend", + ValueTypes: []evmtypes.EIP712MsgAttrType{ + {Name: "from_address", Type: "string"}, + {Name: "to_address", Type: "string"}, + {Name: "amount", Type: "Coin[]"}, + }, + }, + { + MsgTypeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + MsgValueTypeName: "MsgValueDelegate", + ValueTypes: []evmtypes.EIP712MsgAttrType{ + {Name: "delegator_address", Type: "string"}, + {Name: "validator_address", Type: "string"}, + {Name: "amount", Type: "Coin"}, + }, + }, + { + MsgTypeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + MsgValueTypeName: "MsgValueCreateValidator", + ValueTypes: []evmtypes.EIP712MsgAttrType{ + {Name: "description", Type: "Description"}, + {Name: "commission", Type: "CommissionRates"}, + {Name: "min_self_delegation", Type: "string"}, + {Name: "delegator_address", Type: "string"}, + {Name: "validator_address", Type: "string"}, + {Name: "pubkey", Type: "Pubkey"}, + {Name: "value", Type: "Coin"}, + }, + NestedTypes: []evmtypes.EIP712NestedMsgType{ + { + Name: "Description", + Attrs: []evmtypes.EIP712MsgAttrType{ + {Name: "moniker", Type: "string"}, + {Name: "identity", Type: "string"}, + {Name: "website", Type: "string"}, + {Name: "security_contact", Type: "string"}, + {Name: "details", Type: "string"}, + }, + }, + { + Name: "CommissionRates", + Attrs: []evmtypes.EIP712MsgAttrType{ + {Name: "rate", Type: "string"}, + {Name: "max_rate", Type: "string"}, + {Name: "max_change_rate", Type: "string"}, + }, + }, + { + Name: "Pubkey", + Attrs: []evmtypes.EIP712MsgAttrType{ + {Name: "type", Type: "string"}, + {Name: "value", Type: "string"}, + }, + }, + }, + }, + } + suite.app.EvmKeeper.SetParams(suite.ctx, params) + suite.app.FeeMarketKeeper.SetBaseFee(suite.ctx, big.NewInt(100)) } @@ -350,135 +411,38 @@ func (suite AnteTestSuite) TestAnteHandler() { }, false, false, true, }, { - "success- DeliverTx EIP712 create validator (with blank fields)", - func() sdk.Tx { - from := acc.GetAddress() - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - amount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgCreateValidator2(from, privKey, "ethermint_9000-1", gas, amount) - return txBuilder.GetTx() - }, false, false, true, - }, - { - "success- DeliverTx EIP712 MsgSubmitProposal", - func() sdk.Tx { - from := acc.GetAddress() - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - gasAmount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - // reusing the gasAmount for deposit - deposit := sdk.NewCoins(coinAmount) - txBuilder := suite.CreateTestEIP712SubmitProposal(from, privKey, "ethermint_9000-1", gas, gasAmount, deposit) - return txBuilder.GetTx() - }, false, false, true, - }, - { - "success- DeliverTx EIP712 MsgGrant", - func() sdk.Tx { - from := acc.GetAddress() - grantee := sdk.AccAddress("_______grantee______") - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - gasAmount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - blockTime := time.Date(1, 1, 1, 1, 1, 1, 1, time.UTC) - expiresAt := blockTime.Add(time.Hour) - msg, err := authz.NewMsgGrant( - from, grantee, &banktypes.SendAuthorization{SpendLimit: gasAmount}, &expiresAt, - ) - suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, privKey, "ethermint_9000-1", gas, gasAmount, msg).GetTx() - }, false, false, true, - }, - - { - "success- DeliverTx EIP712 MsgGrantAllowance", - func() sdk.Tx { - from := acc.GetAddress() - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - gasAmount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - txBuilder := suite.CreateTestEIP712GrantAllowance(from, privKey, "ethermint_9000-1", gas, gasAmount) - return txBuilder.GetTx() - }, false, false, true, - }, - { - "success- DeliverTx EIP712 edit validator", - func() sdk.Tx { - from := acc.GetAddress() - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - amount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, "ethermint_9000-1", gas, amount) - return txBuilder.GetTx() - }, false, false, true, - }, - { - "success- DeliverTx EIP712 submit evidence", - func() sdk.Tx { - from := acc.GetAddress() - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - amount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgSubmitEvidence(from, privKey, "ethermint_9000-1", gas, amount) - return txBuilder.GetTx() - }, false, false, true, - }, - { - "success- DeliverTx EIP712 submit proposal v1", - func() sdk.Tx { - from := acc.GetAddress() - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - amount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - txBuilder := suite.CreateTestEIP712SubmitProposalV1(from, privKey, "ethermint_9000-1", gas, amount) - return txBuilder.GetTx() - }, false, false, true, - }, - { - "success- DeliverTx EIP712 MsgExec", + "success- DeliverTx EIP712 Multiple MsgSend", func() sdk.Tx { from := acc.GetAddress() coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgExec(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712MultipleMsgSend(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, { - "success- DeliverTx EIP712 MsgVoteV1", + "fails - DeliverTx EIP712 Multiple Signers", func() sdk.Tx { from := acc.GetAddress() coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgVoteV1(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712MultipleSignerMsgs(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() - }, false, false, true, + }, false, false, false, }, { - "success- DeliverTx EIP712 Multiple MsgSend", + "success - DeliverTx EIP712 signed Cosmos Tx with multiple messages", func() sdk.Tx { from := acc.GetAddress() coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MultipleMsgSend(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMultipleMsgs(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, - { - "fails - DeliverTx EIP712 Multiple Signers", - func() sdk.Tx { - from := acc.GetAddress() - coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) - amount := sdk.NewCoins(coinAmount) - gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MultipleSignerMsgs(from, privKey, "ethermint_9000-1", gas, amount) - return txBuilder.GetTx() - }, false, false, false, - }, { "fails - DeliverTx EIP712 signed Cosmos Tx with wrong Chain ID", func() sdk.Tx { diff --git a/app/ante/eip712.go b/app/ante/eip712.go index 2ea7f6c21a..ff0a3f3f06 100644 --- a/app/ante/eip712.go +++ b/app/ante/eip712.go @@ -65,7 +65,7 @@ func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler { authante.NewValidateSigCountDecorator(options.AccountKeeper), authante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), // Note: signature verification uses EIP instead of the cosmos signature validator - NewLegacyEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), + NewLegacyEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.EvmKeeper), authante.NewIncrementSequenceDecorator(options.AccountKeeper), ibcante.NewRedundantRelayDecorator(options.IBCKeeper), NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper), @@ -81,16 +81,19 @@ func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler { type LegacyEip712SigVerificationDecorator struct { ak evmtypes.AccountKeeper signModeHandler authsigning.SignModeHandler + evmKeeper EVMKeeper } // Deprecated: NewLegacyEip712SigVerificationDecorator creates a new LegacyEip712SigVerificationDecorator func NewLegacyEip712SigVerificationDecorator( ak evmtypes.AccountKeeper, signModeHandler authsigning.SignModeHandler, + ek EVMKeeper, ) LegacyEip712SigVerificationDecorator { return LegacyEip712SigVerificationDecorator{ ak: ak, signModeHandler: signModeHandler, + evmKeeper: ek, } } @@ -181,7 +184,9 @@ func (svd LegacyEip712SigVerificationDecorator) AnteHandle(ctx sdk.Context, return next(ctx, tx, simulate) } - if err := VerifySignature(pubKey, signerData, sig.Data, svd.signModeHandler, authSignTx); err != nil { + evmParams := svd.evmKeeper.GetParams(ctx) + + if err := VerifySignature(pubKey, signerData, sig.Data, svd.signModeHandler, authSignTx, evmParams); err != nil { errMsg := fmt.Errorf("signature verification failed; please verify account number (%d) and chain-id (%s): %w", accNum, chainID, err) return ctx, errorsmod.Wrap(errortypes.ErrUnauthorized, errMsg.Error()) } @@ -197,6 +202,7 @@ func VerifySignature( sigData signing.SignatureData, _ authsigning.SignModeHandler, tx authsigning.Tx, + params evmtypes.Params, ) error { switch data := sigData.(type) { case *signing.SingleSignatureData: @@ -217,7 +223,7 @@ func VerifySignature( return errorsmod.Wrap(errortypes.ErrNoSignatures, "tx doesn't contain any msgs to verify signature") } - txBytes := legacytx.StdSignBytes( + txBytes := eip712.ConstructUntypedEIP712Data( signerData.ChainID, signerData.AccountNumber, signerData.Sequence, @@ -226,7 +232,8 @@ func VerifySignature( Amount: tx.GetFee(), Gas: tx.GetGas(), }, - msgs, tx.GetMemo(), tx.GetTip(), + msgs, tx.GetMemo(), + tx.GetTip(), ) signerChainID, err := ethermint.ParseChainID(signerData.ChainID) @@ -264,7 +271,7 @@ func VerifySignature( FeePayer: feePayer, } - typedData, err := eip712.WrapTxToTypedData(ethermintCodec, extOpt.TypedDataChainID, msgs[0], txBytes, feeDelegation) + typedData, err := eip712.WrapTxToTypedData(extOpt.TypedDataChainID, msgs, txBytes, feeDelegation, params) if err != nil { return errorsmod.Wrap(err, "failed to create EIP-712 typed data from tx") } diff --git a/app/ante/fee_market_test.go b/app/ante/fee_market_test.go index 48a765ca4c..2b2425318f 100644 --- a/app/ante/fee_market_test.go +++ b/app/ante/fee_market_test.go @@ -19,6 +19,20 @@ func (suite AnteTestSuite) TestGasWantedDecorator() { from, fromPrivKey := tests.NewAddrKey() to := tests.GenerateAddress() + params := suite.app.EvmKeeper.GetParams(suite.ctx) + params.EIP712AllowedMsgs = []evmtypes.EIP712AllowedMsg{ + { + MsgTypeUrl: "/cosmos.bank.v1beta1.MsgSend", + MsgValueTypeName: "MsgValueSend", + ValueTypes: []evmtypes.EIP712MsgAttrType{ + {Name: "from_address", Type: "string"}, + {Name: "to_address", Type: "string"}, + {Name: "amount", Type: "Coin[]"}, + }, + }, + } + suite.app.EvmKeeper.SetParams(suite.ctx, params) + testCases := []struct { name string expectedGasWanted uint64 diff --git a/app/ante/utils_test.go b/app/ante/utils_test.go index 838ad63f7f..c92961c391 100644 --- a/app/ante/utils_test.go +++ b/app/ante/utils_test.go @@ -120,7 +120,6 @@ func (suite *AnteTestSuite) SetupTest() { encodingConfig := encoding.MakeConfig(app.ModuleBasics) // We're using TestMsg amino encoding in some tests, so register it here. encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) - eip712.SetEncodingConfig(encodingConfig) suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) @@ -285,6 +284,15 @@ func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMsgDelegate(from sdk.AccAdd return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgSend) } +func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMultipleMsgs(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder { + valEthAddr := tests.GenerateAddress() + valAddr := sdk.ValAddress(valEthAddr.Bytes()) + recipient := sdk.AccAddress(common.Address{}.Bytes()) + msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(1)))) + msgDelegate := stakingtypes.NewMsgDelegate(from, valAddr, sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20))) + return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainId, gas, gasAmount, []sdk.Msg{msgSend, msgDelegate, msgDelegate, msgSend}) +} + func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder { // Build MsgCreateValidator valAddr := sdk.ValAddress(from.Bytes()) @@ -486,19 +494,18 @@ func (suite *AnteTestSuite) CreateTestEIP712CosmosTxBuilder( ethChainId := pc.Uint64() // GenerateTypedData TypedData - var ethermintCodec codec.ProtoCodecMarshaler registry := codectypes.NewInterfaceRegistry() types.RegisterInterfaces(registry) - ethermintCodec = codec.NewProtoCodec(registry) cryptocodec.RegisterInterfaces(registry) fee := legacytx.NewStdFee(gas, gasAmount) accNumber := suite.app.AccountKeeper.GetAccount(suite.ctx, from).GetAccountNumber() - data := legacytx.StdSignBytes(chainId, accNumber, nonce, 0, fee, msgs, "", nil) - typedData, err := eip712.WrapTxToTypedData(ethermintCodec, ethChainId, msgs[0], data, &eip712.FeeDelegationOptions{ + data := eip712.ConstructUntypedEIP712Data(chainId, accNumber, nonce, 0, fee, msgs, "", nil) + evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) + typedData, err := eip712.WrapTxToTypedData(ethChainId, msgs, data, &eip712.FeeDelegationOptions{ FeePayer: from, - }) + }, evmParams) suite.Require().NoError(err) sigHash, _, err := apitypes.TypedDataAndHash(typedData) @@ -560,19 +567,7 @@ func (suite *AnteTestSuite) GenerateMultipleKeys(n int) ([]cryptotypes.PrivKey, // generateSingleSignature signs the given sign doc bytes using the given signType (EIP-712 or Standard) func (suite *AnteTestSuite) generateSingleSignature(signMode signing.SignMode, privKey cryptotypes.PrivKey, signDocBytes []byte, signType string) (signature signing.SignatureV2) { - var ( - msg []byte - err error - ) - - msg = signDocBytes - - if signType == "EIP-712" { - msg, err = eip712.GetEIP712BytesForMsg(signDocBytes) - suite.Require().NoError(err) - } - - sigBytes, _ := privKey.Sign(msg) + sigBytes, _ := privKey.Sign(signDocBytes) sigData := &signing.SingleSignatureData{ SignMode: signMode, Signature: sigBytes, diff --git a/app/app.go b/app/app.go index 7e5b3e8982..26036dea68 100644 --- a/app/app.go +++ b/app/app.go @@ -119,7 +119,6 @@ import ( _ "github.com/evmos/ethermint/client/docs/statik" "github.com/evmos/ethermint/app/ante" - "github.com/evmos/ethermint/ethereum/eip712" srvflags "github.com/evmos/ethermint/server/flags" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm" @@ -268,8 +267,6 @@ func NewEthermintApp( cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry - eip712.SetEncodingConfig(encodingConfig) - // NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx bApp := baseapp.NewBaseApp( appName, diff --git a/cmd/ethermintd/root.go b/cmd/ethermintd/root.go index 5474ac57d2..ab543ff499 100644 --- a/cmd/ethermintd/root.go +++ b/cmd/ethermintd/root.go @@ -52,7 +52,6 @@ import ( "github.com/evmos/ethermint/client/debug" "github.com/evmos/ethermint/crypto/hd" "github.com/evmos/ethermint/encoding" - "github.com/evmos/ethermint/ethereum/eip712" "github.com/evmos/ethermint/server" servercfg "github.com/evmos/ethermint/server/config" srvflags "github.com/evmos/ethermint/server/flags" @@ -77,8 +76,6 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { WithKeyringOptions(hd.EthSecp256k1Option()). WithViper(EnvPrefix) - eip712.SetEncodingConfig(encodingConfig) - rootCmd := &cobra.Command{ Use: "ethermintd", Short: "Ethermint Daemon", diff --git a/crypto/ethsecp256k1/ethsecp256k1.go b/crypto/ethsecp256k1/ethsecp256k1.go index d01a357d67..6d4b2e03ca 100644 --- a/crypto/ethsecp256k1/ethsecp256k1.go +++ b/crypto/ethsecp256k1/ethsecp256k1.go @@ -26,7 +26,6 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/crypto" - "github.com/evmos/ethermint/ethereum/eip712" tmcrypto "github.com/tendermint/tendermint/crypto" ) @@ -224,19 +223,7 @@ func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { // // CONTRACT: The signature should be in [R || S] format. func (pubKey PubKey) VerifySignature(msg, sig []byte) bool { - return pubKey.verifySignatureECDSA(msg, sig) || pubKey.verifySignatureAsEIP712(msg, sig) -} - -// Verifies the signature as an EIP-712 signature by first converting the message payload -// to EIP-712 object bytes, then performing ECDSA verification on the hash. This is to support -// signing a Cosmos payload using EIP-712. -func (pubKey PubKey) verifySignatureAsEIP712(msg, sig []byte) bool { - eip712Bytes, err := eip712.GetEIP712BytesForMsg(msg) - if err != nil { - return false - } - - return pubKey.verifySignatureECDSA(eip712Bytes, sig) + return pubKey.verifySignatureECDSA(msg, sig) } // Perform standard ECDSA signature verification for the given raw bytes and signature. diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index 74a9f93db7..5027237af6 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -11,6 +11,9 @@ - [ethermint/evm/v1/evm.proto](#ethermint/evm/v1/evm.proto) - [AccessTuple](#ethermint.evm.v1.AccessTuple) - [ChainConfig](#ethermint.evm.v1.ChainConfig) + - [EIP712AllowedMsg](#ethermint.evm.v1.EIP712AllowedMsg) + - [EIP712MsgAttrType](#ethermint.evm.v1.EIP712MsgAttrType) + - [EIP712NestedMsgType](#ethermint.evm.v1.EIP712NestedMsgType) - [Log](#ethermint.evm.v1.Log) - [Params](#ethermint.evm.v1.Params) - [State](#ethermint.evm.v1.State) @@ -196,6 +199,56 @@ instead of *big.Int. + + +### EIP712AllowedMsg +EIP712AllowedMsg stores an allowed legacy msg and its eip712 type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `msg_type_url` | [string](#string) | | msg's proto type name. ie "/cosmos.bank.v1beta1.MsgSend" | +| `msg_value_type_name` | [string](#string) | | name of the eip712 value type. ie "MsgValueSend" | +| `value_types` | [EIP712MsgAttrType](#ethermint.evm.v1.EIP712MsgAttrType) | repeated | types of the msg value | +| `nested_types` | [EIP712NestedMsgType](#ethermint.evm.v1.EIP712NestedMsgType) | repeated | nested types of the msg value | + + + + + + + + +### EIP712MsgAttrType +EIP712MsgAttrType is the eip712 type of a single message attribute. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | | +| `type` | [string](#string) | | | + + + + + + + + +### EIP712NestedMsgType +EIP712MsgType is the eip712 type of a single message. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | name of the nested type. ie "Fee", "Coin" | +| `attrs` | [EIP712MsgAttrType](#ethermint.evm.v1.EIP712MsgAttrType) | repeated | attrs of the nested type | + + + + + + ### Log diff --git a/encoding/codec/codec.go b/encoding/codec/codec.go index e2e92caf7b..a92ff1a773 100644 --- a/encoding/codec/codec.go +++ b/encoding/codec/codec.go @@ -29,6 +29,7 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { sdk.RegisterLegacyAminoCodec(cdc) cryptocodec.RegisterCrypto(cdc) + ethermint.RegisterLegacyAminoCodec(cdc) codec.RegisterEvidences(cdc) } diff --git a/ethereum/eip712/eip712.go b/ethereum/eip712/eip712.go index f4f8e8530e..71847e100a 100644 --- a/ethereum/eip712/eip712.go +++ b/ethereum/eip712/eip712.go @@ -16,53 +16,93 @@ package eip712 import ( - "bytes" "encoding/json" "fmt" - "math/big" - "reflect" - "strings" - "time" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "golang.org/x/text/cases" - "golang.org/x/text/language" - - errorsmod "cosmossdk.io/errors" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - errortypes "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" + + evmtypes "github.com/evmos/ethermint/x/evm/types" ) +// ConstructUntypedEIP712Data returns the bytes to sign for a transaction. +func ConstructUntypedEIP712Data( + chainID string, + accnum, sequence, timeout uint64, + fee legacytx.StdFee, + msgs []sdk.Msg, + memo string, + tip *tx.Tip, +) []byte { + signBytes := legacytx.StdSignBytes(chainID, accnum, sequence, timeout, fee, msgs, memo, tip) + var inInterface map[string]interface{} + err := json.Unmarshal(signBytes, &inInterface) + if err != nil { + panic(err) + } + + // remove msgs from the sign doc since we will be adding them as separate fields + delete(inInterface, "msgs") + + // Add messages as separate fields + for i := 0; i < len(msgs); i++ { + msg := msgs[i] + legacyMsg, ok := msg.(legacytx.LegacyMsg) + if !ok { + panic(fmt.Errorf("expected %T when using amino JSON", (*legacytx.LegacyMsg)(nil))) + } + msgsBytes := json.RawMessage(legacyMsg.GetSignBytes()) + inInterface[fmt.Sprintf("msg%d", i+1)] = msgsBytes + } + + bz, err := json.Marshal(inInterface) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(bz) +} + +// ComputeTypedDataHash computes keccak hash of typed data for signing. +func ComputeTypedDataHash(typedData apitypes.TypedData) ([]byte, error) { + domainSeparator, err := typedData.HashStruct("EIP712Domain", typedData.Domain.Map()) + if err != nil { + err = sdkerrors.Wrap(err, "failed to pack and hash typedData EIP712Domain") + return nil, err + } + + typedDataHash, err := typedData.HashStruct(typedData.PrimaryType, typedData.Message) + if err != nil { + err = sdkerrors.Wrap(err, "failed to pack and hash typedData primary type") + return nil, err + } + + rawData := []byte(fmt.Sprintf("\x19\x01%s%s", string(domainSeparator), string(typedDataHash))) + return crypto.Keccak256(rawData), nil +} + // WrapTxToTypedData is an ultimate method that wraps Amino-encoded Cosmos Tx JSON data // into an EIP712-compatible TypedData request. func WrapTxToTypedData( - cdc codectypes.AnyUnpacker, chainID uint64, - msg sdk.Msg, + msgs []sdk.Msg, data []byte, feeDelegation *FeeDelegationOptions, + params evmtypes.Params, ) (apitypes.TypedData, error) { txData := make(map[string]interface{}) if err := json.Unmarshal(data, &txData); err != nil { - return apitypes.TypedData{}, errorsmod.Wrap(errortypes.ErrJSONUnmarshal, "failed to JSON unmarshal data") + return apitypes.TypedData{}, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, "failed to JSON unmarshal data") } - domain := apitypes.TypedDataDomain{ - Name: "Cosmos Web3", - Version: "1.0.0", - ChainId: math.NewHexOrDecimal256(int64(chainID)), - VerifyingContract: "cosmos", - Salt: "0", - } + domain := getTypedDataDomain(chainID) - msgTypes, err := extractMsgTypes(cdc, "MsgValue", msg) + msgTypes, err := extractMsgTypes(msgs, params) if err != nil { return apitypes.TypedData{}, err } @@ -70,7 +110,7 @@ func WrapTxToTypedData( if feeDelegation != nil { feeInfo, ok := txData["fee"].(map[string]interface{}) if !ok { - return apitypes.TypedData{}, errorsmod.Wrap(errortypes.ErrInvalidType, "cannot parse fee from tx data") + return apitypes.TypedData{}, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "cannot parse fee from tx data") } feeInfo["feePayer"] = feeDelegation.FeePayer.String() @@ -97,394 +137,71 @@ type FeeDelegationOptions struct { FeePayer sdk.AccAddress } -func extractMsgTypes(cdc codectypes.AnyUnpacker, msgTypeName string, msg sdk.Msg) (apitypes.Types, error) { - rootTypes := apitypes.Types{ - "EIP712Domain": { - { - Name: "name", - Type: "string", - }, - { - Name: "version", - Type: "string", - }, - { - Name: "chainId", - Type: "uint256", - }, - { - Name: "verifyingContract", - Type: "string", - }, - { - Name: "salt", - Type: "string", - }, - }, - "Tx": { - {Name: "account_number", Type: "string"}, - {Name: "chain_id", Type: "string"}, - {Name: "fee", Type: "Fee"}, - {Name: "memo", Type: "string"}, - {Name: "msgs", Type: "Msg[]"}, - {Name: "sequence", Type: "string"}, - // Note timeout_height was removed because it was not getting filled with the legacyTx - // {Name: "timeout_height", Type: "string"}, - }, - "Fee": { - {Name: "amount", Type: "Coin[]"}, - {Name: "gas", Type: "string"}, - }, - "Coin": { - {Name: "denom", Type: "string"}, - {Name: "amount", Type: "string"}, - }, - "Msg": { - {Name: "type", Type: "string"}, - {Name: "value", Type: msgTypeName}, - }, - msgTypeName: {}, - } +func extractMsgTypes(msgs []sdk.Msg, params evmtypes.Params) (apitypes.Types, error) { + rootTypes := getRootTypes() - if err := walkFields(cdc, rootTypes, msgTypeName, msg); err != nil { - return nil, err - } + // Add types each message + for i := 0; i < len(msgs); i++ { + msg := msgs[i] + msgAttrName := fmt.Sprintf("msg%d", i+1) + msgTypeName := fmt.Sprintf("Msg%d", i+1) - return rootTypes, nil -} - -const typeDefPrefix = "_" - -func walkFields(cdc codectypes.AnyUnpacker, typeMap apitypes.Types, rootType string, in interface{}) (err error) { - defer doRecover(&err) - - t := reflect.TypeOf(in) - v := reflect.ValueOf(in) - - for { - if t.Kind() == reflect.Ptr || - t.Kind() == reflect.Interface { - t = t.Elem() - v = v.Elem() - - continue - } - - break - } - - return traverseFields(cdc, typeMap, rootType, typeDefPrefix, t, v) -} - -type cosmosAnyWrapper struct { - Type string `json:"type"` - Value interface{} `json:"value"` -} - -func traverseFields( - cdc codectypes.AnyUnpacker, - typeMap apitypes.Types, - rootType string, - prefix string, - t reflect.Type, - v reflect.Value, -) error { - n := t.NumField() - - if prefix == typeDefPrefix { - if len(typeMap[rootType]) == n { - return nil - } - } else { - typeDef := sanitizeTypedef(prefix) - if len(typeMap[typeDef]) == n { - return nil - } - } - - for i := 0; i < n; i++ { - var ( - field reflect.Value - err error - ) - - if v.IsValid() { - field = v.Field(i) - } - - fieldType := t.Field(i).Type - fieldName := jsonNameFromTag(t.Field(i).Tag) - - if fieldType == cosmosAnyType { - // Unpack field, value as Any - if fieldType, field, err = unpackAny(cdc, field); err != nil { - return err - } - } - - // If field is an empty value, do not include in types, since it will not be present in the object - if field.IsZero() { - continue + // ensure eip712 messages implement legacytx.LegacyMsg + _, ok := msg.(legacytx.LegacyMsg) + if !ok { + err := sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "msg %T must implement legacytx.LegacyMsg", (*legacytx.LegacyMsg)(nil)) + return apitypes.Types{}, err } - for { - if fieldType.Kind() == reflect.Ptr { - fieldType = fieldType.Elem() - - if field.IsValid() { - field = field.Elem() - } - - continue - } - - if fieldType.Kind() == reflect.Interface { - fieldType = reflect.TypeOf(field.Interface()) - continue - } - - if field.Kind() == reflect.Ptr { - field = field.Elem() - continue - } - - break + // get corresponding allowed msg from params + msgType := sdk.MsgTypeURL(msg) + allowedMsg := params.EIP712AllowedMsgFromMsgType(msgType) + if allowedMsg == nil { + err := sdkerrors.Wrapf( + sdkerrors.ErrInvalidType, + "eip712 message type \"%s\" is not permitted", + msgType, + ) + return apitypes.Types{}, err } - var isCollection bool - if fieldType.Kind() == reflect.Array || fieldType.Kind() == reflect.Slice { - if field.Len() == 0 { - // skip empty collections from type mapping - continue - } - - fieldType = fieldType.Elem() - field = field.Index(0) - isCollection = true + // Add msg property to tx + txMsgType := apitypes.Type{Name: msgAttrName, Type: msgTypeName} + rootTypes["Tx"] = append(rootTypes["Tx"], txMsgType) - if fieldType == cosmosAnyType { - if fieldType, field, err = unpackAny(cdc, field); err != nil { - return err - } - } + // Add msg type to root types + msgValueTypeName := allowedMsg.MsgValueTypeName + rootTypes[msgTypeName] = []apitypes.Type{ + {Name: "type", Type: "string"}, + {Name: "value", Type: msgValueTypeName}, } - for { - if fieldType.Kind() == reflect.Ptr { - fieldType = fieldType.Elem() + // Add msg value type and nested types + if rootTypes[msgValueTypeName] == nil && allowedMsg != nil { + // add msg value type + rootTypes[msgValueTypeName] = msgAttrsToEIP712Types(allowedMsg.ValueTypes) - if field.IsValid() { - field = field.Elem() + // add nested types + for _, nestedType := range allowedMsg.NestedTypes { + nestedTypeName := nestedType.Name + if rootTypes[nestedTypeName] == nil { + rootTypes[nestedTypeName] = msgAttrsToEIP712Types(nestedType.Attrs) } - - continue } - - if fieldType.Kind() == reflect.Interface { - fieldType = reflect.TypeOf(field.Interface()) - continue - } - - if field.Kind() == reflect.Ptr { - field = field.Elem() - continue - } - - break - } - - fieldPrefix := fmt.Sprintf("%s.%s", prefix, fieldName) - - ethTyp := typToEth(fieldType) - if len(ethTyp) > 0 { - // Support array of uint64 - if isCollection && fieldType.Kind() != reflect.Slice && fieldType.Kind() != reflect.Array { - ethTyp += "[]" - } - - if prefix == typeDefPrefix { - typeMap[rootType] = append(typeMap[rootType], apitypes.Type{ - Name: fieldName, - Type: ethTyp, - }) - } else { - typeDef := sanitizeTypedef(prefix) - typeMap[typeDef] = append(typeMap[typeDef], apitypes.Type{ - Name: fieldName, - Type: ethTyp, - }) - } - - continue - } - - if fieldType.Kind() == reflect.Struct { - var fieldTypedef string - - if isCollection { - fieldTypedef = sanitizeTypedef(fieldPrefix) + "[]" - } else { - fieldTypedef = sanitizeTypedef(fieldPrefix) - } - - if prefix == typeDefPrefix { - typeMap[rootType] = append(typeMap[rootType], apitypes.Type{ - Name: fieldName, - Type: fieldTypedef, - }) - } else { - typeDef := sanitizeTypedef(prefix) - typeMap[typeDef] = append(typeMap[typeDef], apitypes.Type{ - Name: fieldName, - Type: fieldTypedef, - }) - } - - if err := traverseFields(cdc, typeMap, rootType, fieldPrefix, fieldType, field); err != nil { - return err - } - - continue } } - - return nil -} - -func jsonNameFromTag(tag reflect.StructTag) string { - jsonTags := tag.Get("json") - parts := strings.Split(jsonTags, ",") - return parts[0] -} - -// Unpack the given Any value with Type/Value deconstruction -func unpackAny(cdc codectypes.AnyUnpacker, field reflect.Value) (reflect.Type, reflect.Value, error) { - any, ok := field.Interface().(*codectypes.Any) - if !ok { - return nil, reflect.Value{}, errorsmod.Wrapf(errortypes.ErrPackAny, "%T", field.Interface()) - } - - anyWrapper := &cosmosAnyWrapper{ - Type: any.TypeUrl, - } - - if err := cdc.UnpackAny(any, &anyWrapper.Value); err != nil { - return nil, reflect.Value{}, errorsmod.Wrap(err, "failed to unpack Any in msg struct") - } - - fieldType := reflect.TypeOf(anyWrapper) - field = reflect.ValueOf(anyWrapper) - - return fieldType, field, nil -} - -// _.foo_bar.baz -> TypeFooBarBaz -// -// this is needed for Geth's own signing code which doesn't -// tolerate complex type names -func sanitizeTypedef(str string) string { - buf := new(bytes.Buffer) - parts := strings.Split(str, ".") - caser := cases.Title(language.English, cases.NoLower) - - for _, part := range parts { - if part == "_" { - buf.WriteString("Type") - continue - } - - subparts := strings.Split(part, "_") - for _, subpart := range subparts { - buf.WriteString(caser.String(subpart)) - } - } - - return buf.String() -} - -var ( - hashType = reflect.TypeOf(common.Hash{}) - addressType = reflect.TypeOf(common.Address{}) - bigIntType = reflect.TypeOf(big.Int{}) - cosmIntType = reflect.TypeOf(sdkmath.Int{}) - cosmDecType = reflect.TypeOf(sdk.Dec{}) - cosmosAnyType = reflect.TypeOf(&codectypes.Any{}) - timeType = reflect.TypeOf(time.Time{}) - - edType = reflect.TypeOf(ed25519.PubKey{}) -) - -// typToEth supports only basic types and arrays of basic types. -// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md -func typToEth(typ reflect.Type) string { - const str = "string" - - switch typ.Kind() { - case reflect.String: - return str - case reflect.Bool: - return "bool" - case reflect.Int: - return "int64" - case reflect.Int8: - return "int8" - case reflect.Int16: - return "int16" - case reflect.Int32: - return "int32" - case reflect.Int64: - return "int64" - case reflect.Uint: - return "uint64" - case reflect.Uint8: - return "uint8" - case reflect.Uint16: - return "uint16" - case reflect.Uint32: - return "uint32" - case reflect.Uint64: - return "uint64" - case reflect.Slice: - ethName := typToEth(typ.Elem()) - if len(ethName) > 0 { - return ethName + "[]" - } - case reflect.Array: - ethName := typToEth(typ.Elem()) - if len(ethName) > 0 { - return ethName + "[]" - } - case reflect.Ptr: - if typ.Elem().ConvertibleTo(bigIntType) || - typ.Elem().ConvertibleTo(timeType) || - typ.Elem().ConvertibleTo(edType) || - typ.Elem().ConvertibleTo(cosmDecType) || - typ.Elem().ConvertibleTo(cosmIntType) { - return str - } - case reflect.Struct: - if typ.ConvertibleTo(hashType) || - typ.ConvertibleTo(addressType) || - typ.ConvertibleTo(bigIntType) || - typ.ConvertibleTo(edType) || - typ.ConvertibleTo(timeType) || - typ.ConvertibleTo(cosmDecType) || - typ.ConvertibleTo(cosmIntType) { - return str - } - } - - return "" + return rootTypes, nil } -func doRecover(err *error) { - if r := recover(); r != nil { - if e, ok := r.(error); ok { - e = errorsmod.Wrap(e, "panicked with error") - *err = e - return +// msgAttrsToEIP712Types converts a slice of EIP712MsgAttrType to a slice of apitypes.Type. +func msgAttrsToEIP712Types(attrTypes []evmtypes.EIP712MsgAttrType) []apitypes.Type { + msgTypes := make([]apitypes.Type, len(attrTypes)) + for i, attrType := range attrTypes { + apitypes := apitypes.Type{ + Name: attrType.Name, + Type: attrType.Type, } - - *err = fmt.Errorf("%v", r) + msgTypes[i] = apitypes } + return msgTypes } diff --git a/ethereum/eip712/eip712_test.go b/ethereum/eip712/eip712_test.go deleted file mode 100644 index 8d78c4d910..0000000000 --- a/ethereum/eip712/eip712_test.go +++ /dev/null @@ -1,432 +0,0 @@ -package eip712_test - -import ( - "testing" - - "cosmossdk.io/math" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/ethereum/go-ethereum/crypto" - "github.com/evmos/ethermint/ethereum/eip712" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/evmos/ethermint/crypto/ethsecp256k1" - - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/evmos/ethermint/app" - "github.com/evmos/ethermint/encoding" - - txtypes "github.com/cosmos/cosmos-sdk/types/tx" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" - - distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/suite" -) - -// Unit tests for single-signer EIP-712 signature verification. Multi-signer verification tests are included -// in ante_test.go. - -type EIP712TestSuite struct { - suite.Suite - - config params.EncodingConfig - clientCtx client.Context -} - -func TestEIP712TestSuite(t *testing.T) { - suite.Run(t, &EIP712TestSuite{}) -} - -// Set up test env to replicate prod. environment -func (suite *EIP712TestSuite) SetupTest() { - suite.config = encoding.MakeConfig(app.ModuleBasics) - suite.clientCtx = client.Context{}.WithTxConfig(suite.config.TxConfig) - - sdk.GetConfig().SetBech32PrefixForAccount("ethm", "") - eip712.SetEncodingConfig(suite.config) -} - -// Helper to create random test addresses for messages -func (suite *EIP712TestSuite) createTestAddress() sdk.AccAddress { - privkey, _ := ethsecp256k1.GenerateKey() - key, err := privkey.ToECDSA() - suite.Require().NoError(err) - - addr := crypto.PubkeyToAddress(key.PublicKey) - - return addr.Bytes() -} - -// Helper to create random keypair for signing + verification -func (suite *EIP712TestSuite) createTestKeyPair() (*ethsecp256k1.PrivKey, *ethsecp256k1.PubKey) { - privKey, err := ethsecp256k1.GenerateKey() - suite.Require().NoError(err) - - pubKey := ðsecp256k1.PubKey{ - Key: privKey.PubKey().Bytes(), - } - suite.Require().Implements((*cryptotypes.PubKey)(nil), pubKey) - - return privKey, pubKey -} - -// Helper to create instance of sdk.Coins[] with single coin -func (suite *EIP712TestSuite) makeCoins(denom string, amount math.Int) sdk.Coins { - return sdk.NewCoins( - sdk.NewCoin( - denom, - amount, - ), - ) -} - -func (suite *EIP712TestSuite) TestEIP712SignatureVerification() { - suite.SetupTest() - - signModes := []signing.SignMode{ - signing.SignMode_SIGN_MODE_DIRECT, - signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, - } - - // Fixed test address - testAddress := suite.createTestAddress() - - testCases := []struct { - title string - chainId string - fee txtypes.Fee - memo string - msgs []sdk.Msg - accountNumber uint64 - sequence uint64 - timeoutHeight uint64 - expectSuccess bool - }{ - { - title: "Succeeds - Standard MsgSend", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - banktypes.NewMsgSend( - suite.createTestAddress(), - suite.createTestAddress(), - suite.makeCoins("photon", math.NewInt(1)), - ), - }, - accountNumber: 8, - sequence: 5, - expectSuccess: true, - }, - { - title: "Succeeds - Standard MsgVote", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - govtypes.NewMsgVote( - suite.createTestAddress(), - 5, - govtypes.OptionNo, - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: true, - }, - { - title: "Succeeds - Standard MsgDelegate", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - stakingtypes.NewMsgDelegate( - suite.createTestAddress(), - sdk.ValAddress(suite.createTestAddress()), - suite.makeCoins("photon", math.NewInt(1))[0], - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: true, - }, - { - title: "Succeeds - Standard MsgWithdrawDelegationReward", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - distributiontypes.NewMsgWithdrawDelegatorReward( - suite.createTestAddress(), - sdk.ValAddress(suite.createTestAddress()), - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: true, - }, - { - title: "Succeeds - Two Single-Signer MsgDelegate", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - stakingtypes.NewMsgDelegate( - testAddress, - sdk.ValAddress(suite.createTestAddress()), - suite.makeCoins("photon", math.NewInt(1))[0], - ), - stakingtypes.NewMsgDelegate( - testAddress, - sdk.ValAddress(suite.createTestAddress()), - suite.makeCoins("photon", math.NewInt(5))[0], - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: true, - }, - { - title: "Fails - Two MsgVotes with Different Signers", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - govtypes.NewMsgVote( - suite.createTestAddress(), - 5, - govtypes.OptionNo, - ), - govtypes.NewMsgVote( - suite.createTestAddress(), - 25, - govtypes.OptionAbstain, - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: false, - }, - { - title: "Fails - Empty transaction", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{}, - accountNumber: 25, - sequence: 78, - expectSuccess: false, - }, - { - title: "Fails - Single-Signer MsgSend + MsgVote", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - govtypes.NewMsgVote( - testAddress, - 5, - govtypes.OptionNo, - ), - banktypes.NewMsgSend( - testAddress, - suite.createTestAddress(), - suite.makeCoins("photon", math.NewInt(50)), - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: false, - }, - { - title: "Fails - Invalid ChainID", - chainId: "invalidchainid", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - govtypes.NewMsgVote( - suite.createTestAddress(), - 5, - govtypes.OptionNo, - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: false, - }, - { - title: "Fails - Includes TimeoutHeight", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - govtypes.NewMsgVote( - suite.createTestAddress(), - 5, - govtypes.OptionNo, - ), - }, - accountNumber: 25, - sequence: 78, - timeoutHeight: 1000, - expectSuccess: false, - }, - { - title: "Fails - Single Message / Multi-Signer", - fee: txtypes.Fee{ - Amount: suite.makeCoins("aphoton", math.NewInt(2000)), - GasLimit: 20000, - }, - memo: "", - msgs: []sdk.Msg{ - banktypes.NewMsgMultiSend( - []banktypes.Input{ - banktypes.NewInput( - suite.createTestAddress(), - suite.makeCoins("photon", math.NewInt(50)), - ), - banktypes.NewInput( - suite.createTestAddress(), - suite.makeCoins("photon", math.NewInt(50)), - ), - }, - []banktypes.Output{ - banktypes.NewOutput( - suite.createTestAddress(), - suite.makeCoins("photon", math.NewInt(50)), - ), - banktypes.NewOutput( - suite.createTestAddress(), - suite.makeCoins("photon", math.NewInt(50)), - ), - }, - ), - }, - accountNumber: 25, - sequence: 78, - expectSuccess: false, - }, - } - - for _, tc := range testCases { - for _, signMode := range signModes { - suite.Run(tc.title, func() { - privKey, pubKey := suite.createTestKeyPair() - - // Init tx builder - txBuilder := suite.clientCtx.TxConfig.NewTxBuilder() - - // Set gas and fees - txBuilder.SetGasLimit(tc.fee.GasLimit) - txBuilder.SetFeeAmount(tc.fee.Amount) - - // Set messages - err := txBuilder.SetMsgs(tc.msgs...) - suite.Require().NoError(err) - - // Set memo - txBuilder.SetMemo(tc.memo) - - // Prepare signature field - txSigData := signing.SingleSignatureData{ - SignMode: signMode, - Signature: nil, - } - txSig := signing.SignatureV2{ - PubKey: pubKey, - Data: &txSigData, - Sequence: tc.sequence, - } - - err = txBuilder.SetSignatures([]signing.SignatureV2{txSig}...) - suite.Require().NoError(err) - - chainId := "ethermint_9000-1" - if tc.chainId != "" { - chainId = tc.chainId - } - - if tc.timeoutHeight != 0 { - txBuilder.SetTimeoutHeight(tc.timeoutHeight) - } - - // Declare signerData - signerData := authsigning.SignerData{ - ChainID: chainId, - AccountNumber: tc.accountNumber, - Sequence: tc.sequence, - PubKey: pubKey, - Address: sdk.MustBech32ifyAddressBytes("ethm", pubKey.Bytes()), - } - - bz, err := suite.clientCtx.TxConfig.SignModeHandler().GetSignBytes( - signMode, - signerData, - txBuilder.GetTx(), - ) - suite.Require().NoError(err) - - suite.verifyEIP712SignatureVerification(tc.expectSuccess, *privKey, *pubKey, bz) - }) - } - } -} - -// Verify that the payload passes signature verification if signed as its EIP-712 representation. -func (suite *EIP712TestSuite) verifyEIP712SignatureVerification(expectedSuccess bool, privKey ethsecp256k1.PrivKey, pubKey ethsecp256k1.PubKey, signBytes []byte) { - // Convert to EIP712 bytes and sign - eip712Bytes, err := eip712.GetEIP712BytesForMsg(signBytes) - if !expectedSuccess { - // Expect failure generating EIP-712 bytes - suite.Require().Error(err) - return - } - - suite.Require().NoError(err) - - sig, err := privKey.Sign(eip712Bytes) - suite.Require().NoError(err) - - // Verify against original payload bytes. This should pass, even though it is not - // the original message that was signed. - res := pubKey.VerifySignature(signBytes, sig) - suite.Require().True(res) - - // Verify against the signed EIP-712 bytes. This should pass, since it is the message signed. - res = pubKey.VerifySignature(eip712Bytes, sig) - suite.Require().True(res) - - // Verify against random bytes to ensure it does not pass unexpectedly (sanity check). - randBytes := make([]byte, len(signBytes)) - copy(randBytes, signBytes) - // Change the first element of signBytes to a different value - randBytes[0] = (signBytes[0] + 10) % 128 - res = pubKey.VerifySignature(randBytes, sig) - suite.Require().False(res) -} diff --git a/ethereum/eip712/encoding.go b/ethereum/eip712/encoding.go deleted file mode 100644 index 4e925d0b1e..0000000000 --- a/ethereum/eip712/encoding.go +++ /dev/null @@ -1,314 +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 eip712 - -import ( - "encoding/json" - "errors" - "fmt" - - "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - - sdk "github.com/cosmos/cosmos-sdk/types" - txTypes "github.com/cosmos/cosmos-sdk/types/tx" - - apitypes "github.com/ethereum/go-ethereum/signer/core/apitypes" - ethermint "github.com/evmos/ethermint/types" - - "github.com/cosmos/cosmos-sdk/codec" -) - -type aminoMessage struct { - Type string `json:"type"` - Value interface{} `json:"value"` -} - -var ( - protoCodec codec.ProtoCodecMarshaler - aminoCodec *codec.LegacyAmino -) - -// SetEncodingConfig set the encoding config to the singleton codecs (Amino and Protobuf). -// The process of unmarshaling SignDoc bytes into a SignDoc object requires having a codec -// populated with all relevant message types. As a result, we must call this method on app -// initialization with the app's encoding config. -func SetEncodingConfig(cfg params.EncodingConfig) { - aminoCodec = cfg.Amino - protoCodec = codec.NewProtoCodec(cfg.InterfaceRegistry) -} - -// Get the EIP-712 object bytes for the given SignDoc bytes by first decoding the bytes into -// an EIP-712 object, then hashing the EIP-712 object to create the bytes to be signed. -// See https://eips.ethereum.org/EIPS/eip-712 for more. -func GetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error) { - typedData, err := GetEIP712TypedDataForMsg(signDocBytes) - if err != nil { - return nil, err - } - - _, rawData, err := apitypes.TypedDataAndHash(typedData) - if err != nil { - return nil, fmt.Errorf("could not get EIP-712 object bytes: %w", err) - } - - return []byte(rawData), nil -} - -// GetEIP712TypedDataForMsg returns the EIP-712 TypedData representation for either -// Amino or Protobuf encoded signature doc bytes. -func GetEIP712TypedDataForMsg(signDocBytes []byte) (apitypes.TypedData, error) { - // Attempt to decode as both Amino and Protobuf since the message format is unknown. - // If either decode works, we can move forward with the corresponding typed data. - typedDataAmino, errAmino := decodeAminoSignDoc(signDocBytes) - if errAmino == nil && isValidEIP712Payload(typedDataAmino) { - return typedDataAmino, nil - } - typedDataProtobuf, errProtobuf := decodeProtobufSignDoc(signDocBytes) - if errProtobuf == nil && isValidEIP712Payload(typedDataProtobuf) { - return typedDataProtobuf, nil - } - - return apitypes.TypedData{}, fmt.Errorf("could not decode sign doc as either Amino or Protobuf.\n amino: %v\n protobuf: %v", errAmino, errProtobuf) -} - -// isValidEIP712Payload ensures that the given TypedData does not contain empty fields from -// an improper initialization. -func isValidEIP712Payload(typedData apitypes.TypedData) bool { - return len(typedData.Message) != 0 && len(typedData.Types) != 0 && typedData.PrimaryType != "" && typedData.Domain != apitypes.TypedDataDomain{} -} - -// decodeAminoSignDoc attempts to decode the provided sign doc (bytes) as an Amino payload -// and returns a signable EIP-712 TypedData object. -func decodeAminoSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { - // Ensure codecs have been initialized - if err := validateCodecInit(); err != nil { - return apitypes.TypedData{}, err - } - - var aminoDoc legacytx.StdSignDoc - if err := aminoCodec.UnmarshalJSON(signDocBytes, &aminoDoc); err != nil { - return apitypes.TypedData{}, err - } - - var fees legacytx.StdFee - if err := aminoCodec.UnmarshalJSON(aminoDoc.Fee, &fees); err != nil { - return apitypes.TypedData{}, err - } - - // Validate payload messages - msgs := make([]sdk.Msg, len(aminoDoc.Msgs)) - for i, jsonMsg := range aminoDoc.Msgs { - var m sdk.Msg - if err := aminoCodec.UnmarshalJSON(jsonMsg, &m); err != nil { - return apitypes.TypedData{}, fmt.Errorf("failed to unmarshal sign doc message: %w", err) - } - msgs[i] = m - } - - if err := validatePayloadMessages(msgs); err != nil { - return apitypes.TypedData{}, err - } - - // Use first message for fee payer and type inference - msg := msgs[0] - - // By convention, the fee payer is the first address in the list of signers. - feePayer := msg.GetSigners()[0] - feeDelegation := &FeeDelegationOptions{ - FeePayer: feePayer, - } - - chainID, err := ethermint.ParseChainID(aminoDoc.ChainID) - if err != nil { - return apitypes.TypedData{}, errors.New("invalid chain ID passed as argument") - } - - typedData, err := WrapTxToTypedData( - protoCodec, - chainID.Uint64(), - msg, - signDocBytes, - feeDelegation, - ) - if err != nil { - return apitypes.TypedData{}, fmt.Errorf("could not convert to EIP712 representation: %w", err) - } - - return typedData, nil -} - -// decodeProtobufSignDoc attempts to decode the provided sign doc (bytes) as a Protobuf payload -// and returns a signable EIP-712 TypedData object. -func decodeProtobufSignDoc(signDocBytes []byte) (apitypes.TypedData, error) { - // Ensure codecs have been initialized - if err := validateCodecInit(); err != nil { - return apitypes.TypedData{}, err - } - - signDoc := &txTypes.SignDoc{} - if err := signDoc.Unmarshal(signDocBytes); err != nil { - return apitypes.TypedData{}, err - } - - authInfo := &txTypes.AuthInfo{} - if err := authInfo.Unmarshal(signDoc.AuthInfoBytes); err != nil { - return apitypes.TypedData{}, err - } - - body := &txTypes.TxBody{} - if err := body.Unmarshal(signDoc.BodyBytes); err != nil { - return apitypes.TypedData{}, err - } - - // Until support for these fields is added, throw an error at their presence - if body.TimeoutHeight != 0 || len(body.ExtensionOptions) != 0 || len(body.NonCriticalExtensionOptions) != 0 { - return apitypes.TypedData{}, errors.New("body contains unsupported fields: TimeoutHeight, ExtensionOptions, or NonCriticalExtensionOptions") - } - - if len(authInfo.SignerInfos) != 1 { - return apitypes.TypedData{}, fmt.Errorf("invalid number of signer infos provided, expected 1 got %v", len(authInfo.SignerInfos)) - } - - // Validate payload messages - msgs := make([]sdk.Msg, len(body.Messages)) - for i, protoMsg := range body.Messages { - var m sdk.Msg - if err := protoCodec.UnpackAny(protoMsg, &m); err != nil { - return apitypes.TypedData{}, fmt.Errorf("could not unpack message object with error %w", err) - } - msgs[i] = m - } - - if err := validatePayloadMessages(msgs); err != nil { - return apitypes.TypedData{}, err - } - - // Use first message for fee payer and type inference - msg := msgs[0] - - signerInfo := authInfo.SignerInfos[0] - - chainID, err := ethermint.ParseChainID(signDoc.ChainId) - if err != nil { - return apitypes.TypedData{}, fmt.Errorf("invalid chain ID passed as argument: %w", err) - } - - stdFee := &legacytx.StdFee{ - Amount: authInfo.Fee.Amount, - Gas: authInfo.Fee.GasLimit, - } - - feePayer := msg.GetSigners()[0] - feeDelegation := &FeeDelegationOptions{ - FeePayer: feePayer, - } - - tip := authInfo.Tip - - // WrapTxToTypedData expects the payload as an Amino Sign Doc - signBytes := legacytx.StdSignBytes( - signDoc.ChainId, - signDoc.AccountNumber, - signerInfo.Sequence, - body.TimeoutHeight, - *stdFee, - msgs, - body.Memo, - tip, - ) - - typedData, err := WrapTxToTypedData( - protoCodec, - chainID.Uint64(), - msg, - signBytes, - feeDelegation, - ) - if err != nil { - return apitypes.TypedData{}, err - } - - return typedData, nil -} - -// validateCodecInit ensures that both Amino and Protobuf encoding codecs have been set on app init, -// so the module does not panic if either codec is not found. -func validateCodecInit() error { - if aminoCodec == nil || protoCodec == nil { - return errors.New("missing codec: codecs have not been properly initialized using SetEncodingConfig") - } - - return nil -} - -// validatePayloadMessages ensures that the transaction messages can be represented in an EIP-712 -// encoding by checking that messages exist, are of the same type, and share a single signer. -func validatePayloadMessages(msgs []sdk.Msg) error { - if len(msgs) == 0 { - return errors.New("unable to build EIP-712 payload: transaction does contain any messages") - } - - var msgType string - var msgSigner sdk.AccAddress - - for i, m := range msgs { - t, err := getMsgType(m) - if err != nil { - return err - } - - if len(m.GetSigners()) != 1 { - return errors.New("unable to build EIP-712 payload: expect exactly 1 signer") - } - - if i == 0 { - msgType = t - msgSigner = m.GetSigners()[0] - continue - } - - if t != msgType { - return errors.New("unable to build EIP-712 payload: different types of messages detected") - } - - if !msgSigner.Equals(m.GetSigners()[0]) { - return errors.New("unable to build EIP-712 payload: multiple signers detected") - } - } - - return nil -} - -// getMsgType returns the message type prefix for the given Cosmos SDK Msg -func getMsgType(msg sdk.Msg) (string, error) { - jsonBytes, err := aminoCodec.MarshalJSON(msg) - if err != nil { - return "", err - } - - var jsonMsg aminoMessage - if err := json.Unmarshal(jsonBytes, &jsonMsg); err != nil { - return "", err - } - - // Verify Type was successfully filled in - if jsonMsg.Type == "" { - return "", errors.New("could not decode message: type is missing") - } - - return jsonMsg.Type, nil -} diff --git a/ethereum/eip712/msg_test.go b/ethereum/eip712/msg_test.go new file mode 100644 index 0000000000..00b40dbe9a --- /dev/null +++ b/ethereum/eip712/msg_test.go @@ -0,0 +1,158 @@ +package eip712 + +import ( + "encoding/json" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/evmos/ethermint/tests" + "github.com/stretchr/testify/require" + + evmtypes "github.com/evmos/ethermint/x/evm/types" +) + +func TestExtractMsgTypes(t *testing.T) { + params := evmtypes.DefaultParams() + params.EIP712AllowedMsgs = []evmtypes.EIP712AllowedMsg{ + { + MsgTypeUrl: "/cosmos.bank.v1beta1.MsgSend", + MsgValueTypeName: "MsgValueSend", + ValueTypes: []evmtypes.EIP712MsgAttrType{ + {Name: "from_address", Type: "string"}, + {Name: "to_address", Type: "string"}, + {Name: "amount", Type: "Coin[]"}, + }, + }, + { + MsgTypeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + MsgValueTypeName: "MsgValueDelegate", + ValueTypes: []evmtypes.EIP712MsgAttrType{ + {Name: "delegator_address", Type: "string"}, + {Name: "validator_address", Type: "string"}, + {Name: "amount", Type: "Coin"}, + }, + NestedTypes: []evmtypes.EIP712NestedMsgType{ + { + Name: "Coin", + Attrs: []evmtypes.EIP712MsgAttrType{ + {Name: "denom", Type: "string"}, + {Name: "amount", Type: "string"}, + }, + }, + { + Name: "Vote", + Attrs: []evmtypes.EIP712MsgAttrType{ + {Name: "voter", Type: "string"}, + }, + }, + }, + }, + } + + fromAddr := sdk.AccAddress(tests.GenerateAddress().Bytes()) + toAddr := sdk.AccAddress(tests.GenerateAddress().Bytes()) + valAddr := sdk.ValAddress(tests.GenerateAddress().Bytes()) + + tests := []struct { + name string + msgs []sdk.Msg + exp string + success bool + errMsg string + }{ + { + name: "success", + success: true, + msgs: []sdk.Msg{ + bankTypes.NewMsgSend(fromAddr, toAddr, sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1)))), + stakingTypes.NewMsgDelegate(fromAddr, valAddr, sdk.NewCoin("atom", sdk.NewInt(1))), + bankTypes.NewMsgSend(fromAddr, toAddr, sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(2)))), + }, + exp: `{ + "Coin": [ + { "name": "denom", "type": "string" }, + { "name": "amount", "type": "string" } + ], + "EIP712Domain": [ + { "name": "name", "type": "string" }, + { "name": "version", "type": "string" }, + { "name": "chainId", "type": "uint256" }, + { "name": "verifyingContract", "type": "string" }, + { "name": "salt", "type": "string" } + ], + "Fee": [ + { "name": "amount", "type": "Coin[]" }, + { "name": "gas", "type": "string" } + ], + "Msg1": [ + { "name": "type", "type": "string" }, + { "name": "value", "type": "MsgValueSend" } + ], + "Msg2": [ + { "name": "type", "type": "string" }, + { "name": "value", "type": "MsgValueDelegate" } + ], + "Msg3": [ + { "name": "type", "type": "string" }, + { "name": "value", "type": "MsgValueSend" } + ], + "MsgValueDelegate": [ + { "name": "delegator_address", "type": "string" }, + { "name": "validator_address", "type": "string" }, + { "name": "amount", "type": "Coin" } + ], + "MsgValueSend": [ + { "name": "from_address", "type": "string" }, + { "name": "to_address", "type": "string" }, + { "name": "amount", "type": "Coin[]" } + ], + "Tx": [ + { "name": "account_number", "type": "string" }, + { "name": "chain_id", "type": "string" }, + { "name": "fee", "type": "Fee" }, + { "name": "memo", "type": "string" }, + { "name": "sequence", "type": "string" }, + { "name": "msg1", "type": "Msg1" }, + { "name": "msg2", "type": "Msg2" }, + { "name": "msg3", "type": "Msg3" } + ], + "Vote": [{ "name": "voter", "type": "string" }] + }`, + }, + { + name: "fails if msg is not allowed", + msgs: []sdk.Msg{ + bankTypes.NewMsgSend(fromAddr, toAddr, sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1)))), + bankTypes.NewMsgMultiSend( + []bankTypes.Input{ + {Address: fromAddr.String(), Coins: sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1)))}, + }, + []bankTypes.Output{ + {Address: toAddr.String(), Coins: sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1)))}, + }, + ), + }, + success: false, + errMsg: "eip712 message type \"/cosmos.bank.v1beta1.MsgMultiSend\" is not permitted: invalid type", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + msgTypes, err := extractMsgTypes(tt.msgs, params) + if tt.success { + require.NoError(t, err) + var expTypes apitypes.Types + err := json.Unmarshal([]byte(tt.exp), &expTypes) + require.NoError(t, err) + require.Equal(t, expTypes, msgTypes) + } else { + require.Error(t, err) + require.Equal(t, tt.errMsg, err.Error()) + } + }) + } +} diff --git a/ethereum/eip712/preprocess.go b/ethereum/eip712/preprocess.go deleted file mode 100644 index bf5fa28a51..0000000000 --- a/ethereum/eip712/preprocess.go +++ /dev/null @@ -1,98 +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 eip712 - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cosmoskr "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/evmos/ethermint/types" -) - -// PreprocessLedgerTx reformats Ledger-signed Cosmos transactions to match the fork expected by Ethermint -// by including the signature in a Web3Tx extension and sending a blank signature in the body. -func PreprocessLedgerTx(chainID string, keyType cosmoskr.KeyType, txBuilder client.TxBuilder) error { - // Only process Ledger transactions - if keyType != cosmoskr.TypeLedger { - return nil - } - - // Init extension builder to set Web3 extension - extensionBuilder, ok := txBuilder.(authtx.ExtensionOptionsTxBuilder) - if !ok { - return fmt.Errorf("cannot cast TxBuilder to ExtensionOptionsTxBuilder") - } - - // Get signatures from TxBuilder - sigs, err := txBuilder.GetTx().GetSignaturesV2() - if err != nil { - return fmt.Errorf("could not get signatures: %w", err) - } - - // Verify single-signer - if len(sigs) != 1 { - return fmt.Errorf("invalid number of signatures, expected 1 and got %v", len(sigs)) - } - - signature := sigs[0] - sigData, ok := signature.Data.(*signing.SingleSignatureData) - if !ok { - return fmt.Errorf("unexpected signature type, expected SingleSignatureData") - } - sigBytes := sigData.Signature - - // Parse Chain ID as big.Int - chainIDInt, err := types.ParseChainID(chainID) - if err != nil { - return fmt.Errorf("could not parse chain id: %w", err) - } - - // Add ExtensionOptionsWeb3Tx extension with signature - var option *codectypes.Any - option, err = codectypes.NewAnyWithValue(&types.ExtensionOptionsWeb3Tx{ - FeePayer: txBuilder.GetTx().FeePayer().String(), - TypedDataChainID: chainIDInt.Uint64(), - FeePayerSig: sigBytes, - }) - if err != nil { - return fmt.Errorf("could not set extension as any: %w", err) - } - - extensionBuilder.SetExtensionOptions(option) - - // Set blank signature with Amino Sign Type - // (Regardless of input signMode, Evmos requires Amino signature type for Ledger) - blankSig := signing.SingleSignatureData{ - SignMode: signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, - Signature: nil, - } - sig := signing.SignatureV2{ - PubKey: signature.PubKey, - Data: &blankSig, - Sequence: signature.Sequence, - } - - err = txBuilder.SetSignatures(sig) - if err != nil { - return fmt.Errorf("unable to set signatures on payload: %w", err) - } - - return nil -} diff --git a/ethereum/eip712/preprocess_test.go b/ethereum/eip712/preprocess_test.go deleted file mode 100644 index db80d44e79..0000000000 --- a/ethereum/eip712/preprocess_test.go +++ /dev/null @@ -1,222 +0,0 @@ -package eip712_test - -import ( - "encoding/hex" - "strings" - "testing" - - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/evmos/ethermint/app" - "github.com/evmos/ethermint/encoding" - "github.com/evmos/ethermint/ethereum/eip712" - "github.com/evmos/ethermint/tests" - "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" - "github.com/stretchr/testify/require" -) - -// Testing Constants -var ( - chainId = "ethermint_9000-1" - ctx = client.Context{}.WithTxConfig( - encoding.MakeConfig(app.ModuleBasics).TxConfig, - ) -) -var feePayerAddress = "ethm17xpfvakm2amg962yls6f84z3kell8c5lthdzgl" - -type TestCaseStruct struct { - txBuilder client.TxBuilder - expectedFeePayer string - expectedGas uint64 - expectedFee math.Int - expectedMemo string - expectedMsg string - expectedSignatureBytes []byte -} - -func TestLedgerPreprocessing(t *testing.T) { - // Update bech32 prefix - sdk.GetConfig().SetBech32PrefixForAccount("ethm", "") - - testCases := []TestCaseStruct{ - createBasicTestCase(t), - createPopulatedTestCase(t), - } - - for _, tc := range testCases { - // Run pre-processing - err := eip712.PreprocessLedgerTx( - chainId, - keyring.TypeLedger, - tc.txBuilder, - ) - - require.NoError(t, err) - - // Verify Web3 extension matches expected - hasExtOptsTx, ok := tc.txBuilder.(ante.HasExtensionOptionsTx) - require.True(t, ok) - require.True(t, len(hasExtOptsTx.GetExtensionOptions()) == 1) - - expectedExt := types.ExtensionOptionsWeb3Tx{ - TypedDataChainID: 9000, - FeePayer: feePayerAddress, - FeePayerSig: tc.expectedSignatureBytes, - } - - expectedExtAny, err := codectypes.NewAnyWithValue(&expectedExt) - require.NoError(t, err) - - actualExtAny := hasExtOptsTx.GetExtensionOptions()[0] - require.Equal(t, expectedExtAny, actualExtAny) - - // Verify signature type matches expected - signatures, err := tc.txBuilder.GetTx().GetSignaturesV2() - require.NoError(t, err) - require.Equal(t, len(signatures), 1) - - txSig := signatures[0].Data.(*signing.SingleSignatureData) - require.Equal(t, txSig.SignMode, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) - - // Verify signature is blank - require.Equal(t, len(txSig.Signature), 0) - - // Verify tx fields are unchanged - tx := tc.txBuilder.GetTx() - - require.Equal(t, tx.FeePayer().String(), tc.expectedFeePayer) - require.Equal(t, tx.GetGas(), tc.expectedGas) - require.Equal(t, tx.GetFee().AmountOf(evmtypes.DefaultParams().EvmDenom), tc.expectedFee) - require.Equal(t, tx.GetMemo(), tc.expectedMemo) - - // Verify message is unchanged - if tc.expectedMsg != "" { - require.Equal(t, len(tx.GetMsgs()), 1) - require.Equal(t, tx.GetMsgs()[0].String(), tc.expectedMsg) - } else { - require.Equal(t, len(tx.GetMsgs()), 0) - } - } -} - -func TestBlankTxBuilder(t *testing.T) { - txBuilder := ctx.TxConfig.NewTxBuilder() - - err := eip712.PreprocessLedgerTx( - chainId, - keyring.TypeLedger, - txBuilder, - ) - - require.Error(t, err) -} - -func TestNonLedgerTxBuilder(t *testing.T) { - txBuilder := ctx.TxConfig.NewTxBuilder() - - err := eip712.PreprocessLedgerTx( - chainId, - keyring.TypeLocal, - txBuilder, - ) - - require.NoError(t, err) -} - -func TestInvalidChainId(t *testing.T) { - txBuilder := ctx.TxConfig.NewTxBuilder() - - err := eip712.PreprocessLedgerTx( - "invalid-chain-id", - keyring.TypeLedger, - txBuilder, - ) - - require.Error(t, err) -} - -func createBasicTestCase(t *testing.T) TestCaseStruct { - t.Helper() - txBuilder := ctx.TxConfig.NewTxBuilder() - - feePayer, err := sdk.AccAddressFromBech32(feePayerAddress) - require.NoError(t, err) - - txBuilder.SetFeePayer(feePayer) - - // Create signature unrelated to payload for testing - signatureHex := strings.Repeat("01", 65) - signatureBytes, err := hex.DecodeString(signatureHex) - require.NoError(t, err) - - _, privKey := tests.NewAddrKey() - sigsV2 := signing.SignatureV2{ - PubKey: privKey.PubKey(), // Use unrelated public key for testing - Data: &signing.SingleSignatureData{ - SignMode: signing.SignMode_SIGN_MODE_DIRECT, - Signature: signatureBytes, - }, - Sequence: 0, - } - - txBuilder.SetSignatures(sigsV2) - return TestCaseStruct{ - txBuilder: txBuilder, - expectedFeePayer: feePayer.String(), - expectedGas: 0, - expectedFee: math.NewInt(0), - expectedMemo: "", - expectedMsg: "", - expectedSignatureBytes: signatureBytes, - } -} - -func createPopulatedTestCase(t *testing.T) TestCaseStruct { - t.Helper() - basicTestCase := createBasicTestCase(t) - txBuilder := basicTestCase.txBuilder - - gasLimit := uint64(200000) - memo := "" - denom := evmtypes.DefaultParams().EvmDenom - feeAmount := math.NewInt(2000) - - txBuilder.SetFeeAmount(sdk.NewCoins( - sdk.NewCoin( - denom, - feeAmount, - ))) - - txBuilder.SetGasLimit(gasLimit) - txBuilder.SetMemo(memo) - - msgSend := banktypes.MsgSend{ - FromAddress: feePayerAddress, - ToAddress: "ethm12luku6uxehhak02py4rcz65zu0swh7wjun6msa", - Amount: sdk.NewCoins( - sdk.NewCoin( - evmtypes.DefaultParams().EvmDenom, - math.NewInt(10000000), - ), - ), - } - - txBuilder.SetMsgs(&msgSend) - - return TestCaseStruct{ - txBuilder: txBuilder, - expectedFeePayer: basicTestCase.expectedFeePayer, - expectedGas: gasLimit, - expectedFee: feeAmount, - expectedMemo: memo, - expectedMsg: msgSend.String(), - expectedSignatureBytes: basicTestCase.expectedSignatureBytes, - } -} diff --git a/ethereum/eip712/types.go b/ethereum/eip712/types.go new file mode 100644 index 0000000000..2cef4539a1 --- /dev/null +++ b/ethereum/eip712/types.go @@ -0,0 +1,60 @@ +package eip712 + +import ( + "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/signer/core/apitypes" +) + +func getTypedDataDomain(chainID uint64) apitypes.TypedDataDomain { + return apitypes.TypedDataDomain{ + Name: "Kava Cosmos", + Version: "1.0.0", + ChainId: math.NewHexOrDecimal256(int64(chainID)), + VerifyingContract: "kavaCosmos", + Salt: "0", + } +} + +func getRootTypes() apitypes.Types { + return apitypes.Types{ + "EIP712Domain": { + { + Name: "name", + Type: "string", + }, + { + Name: "version", + Type: "string", + }, + { + Name: "chainId", + Type: "uint256", + }, + { + Name: "verifyingContract", + Type: "string", + }, + { + Name: "salt", + Type: "string", + }, + }, + "Tx": { + {Name: "account_number", Type: "string"}, + {Name: "chain_id", Type: "string"}, + {Name: "fee", Type: "Fee"}, + {Name: "memo", Type: "string"}, + {Name: "sequence", Type: "string"}, + // Note timeout_height was removed because it was not getting filled with the legacyTx + // {Name: "timeout_height", Type: "string"}, + }, + "Fee": { + {Name: "amount", Type: "Coin[]"}, + {Name: "gas", Type: "string"}, + }, + "Coin": { + {Name: "denom", Type: "string"}, + {Name: "amount", Type: "string"}, + }, + } +} diff --git a/go.mod b/go.mod index f03d6b5dc8..22d63b57ce 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/btcsuite/btcd v0.22.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cosmos/cosmos-proto v1.0.0-beta.1 - github.com/cosmos/cosmos-sdk v0.46.7 + github.com/cosmos/cosmos-sdk v0.46.11 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.3 github.com/cosmos/ibc-go/v6 v6.1.0 @@ -33,11 +33,10 @@ require ( github.com/spf13/viper v1.14.0 github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 github.com/stretchr/testify v1.8.1 - github.com/tendermint/tendermint v0.34.24 + github.com/tendermint/tendermint v0.34.27 github.com/tendermint/tm-db v0.6.7 github.com/tyler-smith/go-bip39 v1.1.0 - golang.org/x/net v0.5.0 - golang.org/x/text v0.6.0 + golang.org/x/net v0.7.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 google.golang.org/grpc v1.52.0 sigs.k8s.io/yaml v1.3.0 @@ -67,11 +66,12 @@ require ( github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect + github.com/cometbft/cometbft-db v0.7.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect - github.com/cosmos/iavl v0.19.4 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect + github.com/cosmos/iavl v0.19.5 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/deckarep/golang-set v1.8.0 // indirect @@ -100,7 +100,7 @@ require ( github.com/golang/glog v1.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.0.1 // indirect + github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/uuid v1.3.0 // indirect @@ -146,9 +146,9 @@ require ( github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.12.2 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.34.0 // indirect + github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -163,22 +163,23 @@ require ( github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.4.1 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect - github.com/tendermint/btcd v0.1.1 // indirect - github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect + github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/go-amino v0.16.0 // indirect + github.com/tidwall/btree v1.5.0 // indirect github.com/tklauser/go-sysconf v0.3.10 // indirect github.com/tklauser/numcpus v0.4.0 // indirect github.com/ulikunitz/xz v0.5.8 // indirect github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.0 // indirect + github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.6 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/crypto v0.3.0 // indirect + golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/term v0.4.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/term v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.102.0 // indirect google.golang.org/appengine v1.6.7 // indirect @@ -193,9 +194,13 @@ require ( replace ( // use cosmos keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 + // Use cosmos-sdk fork with staking transfer events, and custom tally handler support + github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.46.11-kava.1 // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 // use cosmos flavored protobufs github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + // Use cometbft fork of tendermint + github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27 ) diff --git a/go.sum b/go.sum index 7f27bd1ebc..4000118e88 100644 --- a/go.sum +++ b/go.sum @@ -157,6 +157,7 @@ github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/i github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= @@ -211,6 +212,10 @@ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= +github.com/cometbft/cometbft v0.34.27 h1:ri6BvmwjWR0gurYjywcBqRe4bbwc3QVs9KRcCzgh/J0= +github.com/cometbft/cometbft v0.34.27/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw= +github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= +github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= @@ -228,8 +233,6 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-proto v1.0.0-beta.1 h1:iDL5qh++NoXxG8hSy93FdYJut4XfgbShIocllGaXx/0= github.com/cosmos/cosmos-proto v1.0.0-beta.1/go.mod h1:8k2GNZghi5sDRFw/scPL8gMSowT1vDA+5ouxL8GjaUE= -github.com/cosmos/cosmos-sdk v0.46.7 h1:dkGy9y2ewgqvawrUOuWb2oz3MdotVduokyreXC4bS0s= -github.com/cosmos/cosmos-sdk v0.46.7/go.mod h1:fqKqz39U5IlEFb4nbQ72951myztsDzFKKDtffYJ63nk= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -237,14 +240,14 @@ github.com/cosmos/gogoproto v1.4.3 h1:RP3yyVREh9snv/lsOvmsAPQt8f44LgL281X0IOIhhc github.com/cosmos/gogoproto v1.4.3/go.mod h1:0hLIG5TR7IvV1fme1HCFKjfzW9X2x0Mo+RooWXCnOWU= github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok= -github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= +github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= +github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/ibc-go/v6 v6.1.0 h1:o7oXws2vKkKfOFzJI+oNylRn44PCNt5wzHd/zKQKbvQ= github.com/cosmos/ibc-go/v6 v6.1.0/go.mod h1:CY3zh2HLfetRiW8LY6kVHMATe90Wj/UOoY8T6cuB0is= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= +github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= +github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -451,8 +454,8 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -643,6 +646,8 @@ github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kava-labs/cosmos-sdk v0.46.11-kava.1 h1:3VRpm4zf/gQgmpRVd1p99/2P8ZecAu2FVAXHru5caIo= +github.com/kava-labs/cosmos-sdk v0.46.11-kava.1/go.mod h1:bG4AkW9bqc8ycrryyKGQEl3YV9BY2wr6HggGq8kvcgM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -845,15 +850,16 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -864,8 +870,8 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.34.0 h1:RBmGO9d/FVjqHT0yUGQwBJhkwKV+wPCn7KGpvfab0uE= -github.com/prometheus/common v0.34.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -977,16 +983,14 @@ github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNG github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= -github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.34.24 h1:879MKKJWYYPJEMMKME+DWUTY4V9f/FBpnZDI82ky+4k= -github.com/tendermint/tendermint v0.34.24/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI= github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= +github.com/tidwall/btree v1.5.0 h1:iV0yVY/frd7r6qGBXfEYs7DH0gTDgrKTrDjS7xt/IyQ= +github.com/tidwall/btree v1.5.0/go.mod h1:LGm8L/DZjPLmeWGjv5kFrY8dL4uVhMmzmmLYmsObdKE= github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= @@ -1037,8 +1041,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.0 h1:dlMC7aO8Wss1CxBq2I96kZ69Nh1ligzbs8UWOtq/AsA= -github.com/zondax/ledger-go v0.14.0/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= +github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= @@ -1084,8 +1088,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1127,7 +1131,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= +golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1184,8 +1188,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1297,13 +1301,13 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1313,8 +1317,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/proto/ethermint/evm/v1/evm.proto b/proto/ethermint/evm/v1/evm.proto index 9535335234..875619ffec 100644 --- a/proto/ethermint/evm/v1/evm.proto +++ b/proto/ethermint/evm/v1/evm.proto @@ -18,9 +18,12 @@ message Params { repeated int64 extra_eips = 4 [(gogoproto.customname) = "ExtraEIPs", (gogoproto.moretags) = "yaml:\"extra_eips\""]; // chain_config defines the EVM chain configuration parameters ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false]; + // list of allowed eip712 msgs and their types + repeated EIP712AllowedMsg eip712_allowed_msgs = 6 + [(gogoproto.customname) = "EIP712AllowedMsgs", (gogoproto.nullable) = false]; // allow_unprotected_txs defines if replay-protected (i.e non EIP155 // signed) transactions can be executed on the state machine. - bool allow_unprotected_txs = 6; + bool allow_unprotected_txs = 7; } // ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int values @@ -240,3 +243,33 @@ message TraceConfig { // tracer_json_config configures the tracer using a JSON string string tracer_json_config = 13 [(gogoproto.jsontag) = "tracerConfig"]; } + +// EIP712AllowedMsg stores an allowed legacy msg and its eip712 type. +message EIP712AllowedMsg { + // msg's proto type name. ie "/cosmos.bank.v1beta1.MsgSend" + string msg_type_url = 1; + + // name of the eip712 value type. ie "MsgValueSend" + string msg_value_type_name = 2; + + // types of the msg value + repeated EIP712MsgAttrType value_types = 3 [(gogoproto.nullable) = false]; + + // nested types of the msg value + repeated EIP712NestedMsgType nested_types = 4 [(gogoproto.nullable) = false]; +} + +// EIP712MsgType is the eip712 type of a single message. +message EIP712NestedMsgType { + // name of the nested type. ie "Fee", "Coin" + string name = 1; + + // attrs of the nested type + repeated EIP712MsgAttrType attrs = 2 [(gogoproto.nullable) = false]; +} + +// EIP712MsgAttrType is the eip712 type of a single message attribute. +message EIP712MsgAttrType { + string name = 1; + string type = 2; +} diff --git a/server/start.go b/server/start.go index 6236dd9c7a..15ecc9a885 100644 --- a/server/start.go +++ b/server/start.go @@ -36,7 +36,7 @@ import ( "google.golang.org/grpc/credentials/insecure" abciserver "github.com/tendermint/tendermint/abci/server" - tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" + tcmd "github.com/tendermint/tendermint/cmd/cometbft/commands" tmos "github.com/tendermint/tendermint/libs/os" "github.com/tendermint/tendermint/node" "github.com/tendermint/tendermint/p2p" @@ -59,7 +59,6 @@ import ( serverconfig "github.com/cosmos/cosmos-sdk/server/config" servergrpc "github.com/cosmos/cosmos-sdk/server/grpc" "github.com/cosmos/cosmos-sdk/server/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/evmos/ethermint/indexer" ethdebug "github.com/evmos/ethermint/rpc/namespaces/ethereum/debug" @@ -601,12 +600,6 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, opts StartOpt offlineMode = true } - minGasPrices, err := sdk.ParseDecCoins(config.MinGasPrices) - if err != nil { - ctx.Logger.Error("failed to parse minimum-gas-prices", "error", err.Error()) - return err - } - conf := &rosetta.Config{ Blockchain: config.Rosetta.Blockchain, Network: config.Rosetta.Network, @@ -617,7 +610,6 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, opts StartOpt Offline: offlineMode, GasToSuggest: config.Rosetta.GasToSuggest, EnableFeeSuggestion: config.Rosetta.EnableFeeSuggestion, - GasPrices: minGasPrices.Sort(), Codec: clientCtx.Codec.(*codec.ProtoCodec), InterfaceRegistry: clientCtx.InterfaceRegistry, } diff --git a/server/util.go b/server/util.go index 6657f9900a..29a9d55a9d 100644 --- a/server/util.go +++ b/server/util.go @@ -30,7 +30,7 @@ import ( "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/version" - tmcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" + tmcmd "github.com/tendermint/tendermint/cmd/cometbft/commands" tmlog "github.com/tendermint/tendermint/libs/log" rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" ) diff --git a/types/codec.go b/types/codec.go index 1bf2e00dbd..c09085a174 100644 --- a/types/codec.go +++ b/types/codec.go @@ -16,6 +16,7 @@ package types import ( + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -38,3 +39,8 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &ExtensionOptionDynamicFeeTx{}, ) } + +// RegisterLegacyAminoCodec registers the tendermint concrete client-related implmentations and interfaces +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&EthAccount{}, "ethermint/EthAccount", nil) +} diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index a56b78ff48..4149aa47f3 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -405,6 +405,7 @@ func (suite *KeeperTestSuite) TestQueryTxLogs() { func (suite *KeeperTestSuite) TestQueryParams() { ctx := sdk.WrapSDKContext(suite.ctx) expParams := types.DefaultParams() + expParams.EIP712AllowedMsgs = nil res, err := suite.queryClient.Params(ctx, &types.QueryParamsRequest{}) suite.Require().NoError(err) diff --git a/x/evm/keeper/migrations.go b/x/evm/keeper/migrations.go index edb9c70eab..a97e048a4b 100644 --- a/x/evm/keeper/migrations.go +++ b/x/evm/keeper/migrations.go @@ -17,8 +17,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v4 "github.com/evmos/ethermint/x/evm/migrations/v4" - v5 "github.com/evmos/ethermint/x/evm/migrations/v5" + v3 "github.com/evmos/ethermint/x/evm/migrations/v3" "github.com/evmos/ethermint/x/evm/types" ) @@ -36,12 +35,12 @@ func NewMigrator(keeper Keeper, legacySubspace types.Subspace) Migrator { } } -// Migrate3to4 migrates the store from consensus version 3 to 4 -func (m Migrator) Migrate3to4(ctx sdk.Context) error { - return v4.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc) -} - -// Migrate4to5 migrates the store from consensus version 4 to 5 -func (m Migrator) Migrate4to5(ctx sdk.Context) error { - return v5.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) +// Migrate3to4 migrates the store from consensus version 2 to 3 +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v3.MigrateStore( + ctx, + m.legacySubspace, + m.keeper.storeKey, + m.keeper.cdc, + ) } diff --git a/x/evm/keeper/migrations_test.go b/x/evm/keeper/migrations_test.go deleted file mode 100644 index 604d663e1c..0000000000 --- a/x/evm/keeper/migrations_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - evmkeeper "github.com/evmos/ethermint/x/evm/keeper" - "github.com/evmos/ethermint/x/evm/types" -) - -type mockSubspace struct { - ps types.Params -} - -func newMockSubspace(ps types.Params) mockSubspace { - return mockSubspace{ps: ps} -} - -func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) { - *ps.(*types.Params) = ms.ps -} - -func (suite *KeeperTestSuite) TestMigrations() { - legacySubspace := newMockSubspace(types.DefaultParams()) - migrator := evmkeeper.NewMigrator(*suite.app.EvmKeeper, legacySubspace) - - testCases := []struct { - name string - migrateFunc func(ctx sdk.Context) error - }{ - { - "Run Migrate3to4", - migrator.Migrate3to4, - }, - } - - for _, tc := range testCases { - suite.Run(tc.name, func() { - err := tc.migrateFunc(suite.ctx) - suite.Require().NoError(err) - }) - } -} diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go index f4fb742a8e..c2cd893c5e 100644 --- a/x/evm/keeper/statedb.go +++ b/x/evm/keeper/statedb.go @@ -24,6 +24,7 @@ import ( errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" @@ -131,13 +132,25 @@ func (k *Keeper) SetAccount(ctx sdk.Context, addr common.Address, account stated } codeHash := common.BytesToHash(account.CodeHash) + ethAcct, ok := acct.(ethermint.EthAccountI) - if ethAcct, ok := acct.(ethermint.EthAccountI); ok { + if ok { if err := ethAcct.SetCodeHash(codeHash); err != nil { return err } } + if !ok && account.IsContract() { + if baseAcct, isBaseAccount := acct.(*authtypes.BaseAccount); isBaseAccount { + acct = ðermint.EthAccount{ + BaseAccount: baseAcct, + CodeHash: codeHash.Hex(), + } + } else { + return errorsmod.Wrapf(types.ErrInvalidAccount, "type %T, address %s", acct, addr) + } + } + k.accountKeeper.SetAccount(ctx, acct) if err := k.SetBalance(ctx, addr, account.Balance); err != nil { diff --git a/x/evm/keeper/statedb_test.go b/x/evm/keeper/statedb_test.go index b12d0dd460..fecb8392f5 100644 --- a/x/evm/keeper/statedb_test.go +++ b/x/evm/keeper/statedb_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "fmt" "math/big" + "time" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -11,6 +12,7 @@ import ( authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -18,6 +20,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/evmos/ethermint/crypto/ethsecp256k1" "github.com/evmos/ethermint/tests" + etherminttypes "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" ) @@ -219,6 +222,104 @@ func (suite *KeeperTestSuite) TestSetNonce() { } } +func (suite *KeeperTestSuite) TestSetAccount() { + baseAddr := tests.GenerateAddress() + baseAcc := &authtypes.BaseAccount{Address: sdk.AccAddress(baseAddr.Bytes()).String()} + ethAddr := tests.GenerateAddress() + ethAcc := ðerminttypes.EthAccount{BaseAccount: &authtypes.BaseAccount{Address: sdk.AccAddress(ethAddr.Bytes()).String()}, CodeHash: common.BytesToHash(types.EmptyCodeHash).String()} + vestingAddr := tests.GenerateAddress() + vestingAcc := vestingtypes.NewBaseVestingAccount(&authtypes.BaseAccount{Address: sdk.AccAddress(vestingAddr.Bytes()).String()}, sdk.NewCoins(), time.Now().Unix()) + + testCases := []struct { + name string + address common.Address + account statedb.Account + expectedErr error + }{ + { + "new account, non-contract account", + tests.GenerateAddress(), + statedb.Account{10, big.NewInt(100), types.EmptyCodeHash}, + nil, + }, + { + "new account, contract account", + tests.GenerateAddress(), + statedb.Account{10, big.NewInt(100), crypto.Keccak256Hash([]byte("some code hash")).Bytes()}, + nil, + }, + { + "existing eth account, non-contract account", + ethAddr, + statedb.Account{10, big.NewInt(1), types.EmptyCodeHash}, + nil, + }, + { + "existing eth account, contract account", + ethAddr, + statedb.Account{10, big.NewInt(0), crypto.Keccak256Hash([]byte("some code hash")).Bytes()}, + nil, + }, + { + "existing base account, non-contract account", + baseAddr, + statedb.Account{10, big.NewInt(10), types.EmptyCodeHash}, + nil, + }, + { + "existing base account, contract account", + baseAddr, + statedb.Account{10, big.NewInt(99), crypto.Keccak256Hash([]byte("some code hash")).Bytes()}, + nil, + }, + { + "existing vesting account, non-contract account", + vestingAddr, + statedb.Account{10, big.NewInt(1000), types.EmptyCodeHash}, + nil, + }, + { + "existing vesting account, contract account", + vestingAddr, + statedb.Account{10, big.NewInt(1001), crypto.Keccak256Hash([]byte("some code hash")).Bytes()}, + types.ErrInvalidAccount, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + if tc.address == baseAddr { + suite.app.AccountKeeper.SetAccount(suite.ctx, baseAcc) + } + if tc.address == ethAddr { + suite.app.AccountKeeper.SetAccount(suite.ctx, ethAcc) + } + if tc.address == vestingAddr { + suite.app.AccountKeeper.SetAccount(suite.ctx, vestingAcc) + } + + vmdb := suite.StateDB() + err := vmdb.Keeper().SetAccount(suite.ctx, tc.address, tc.account) + + if tc.expectedErr == nil { + suite.Require().NoError(err) + } else { + suite.Require().Error(tc.expectedErr) + return + } + + nonce := vmdb.GetNonce(tc.address) + suite.Equal(nonce, tc.account.Nonce, "expected nonce to be set") + + hash := vmdb.GetCodeHash(tc.address) + suite.Equal(common.BytesToHash(tc.account.CodeHash), hash, "expected code hash to be set") + + balance := vmdb.GetBalance(tc.address) + suite.Equal(balance, tc.account.Balance, "expected balance to be set") + }) + } +} + func (suite *KeeperTestSuite) TestGetCodeHash() { addr := tests.GenerateAddress() baseAcc := &authtypes.BaseAccount{Address: sdk.AccAddress(addr.Bytes()).String()} diff --git a/x/evm/migrations/v2/store.go b/x/evm/migrations/v2/store.go new file mode 100644 index 0000000000..55da00e127 --- /dev/null +++ b/x/evm/migrations/v2/store.go @@ -0,0 +1,231 @@ +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 new file mode 100644 index 0000000000..082bd9dc58 --- /dev/null +++ b/x/evm/migrations/v2/store_test.go @@ -0,0 +1,45 @@ +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/chain_config.go b/x/evm/migrations/v2/types/chain_config.go new file mode 100644 index 0000000000..dfadf56cdd --- /dev/null +++ b/x/evm/migrations/v2/types/chain_config.go @@ -0,0 +1,165 @@ +package types + +import ( + "math/big" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/params" + + "github.com/evmos/ethermint/x/evm/types" +) + +// 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 { + return ¶ms.ChainConfig{ + ChainID: chainID, + HomesteadBlock: getBlockValue(cc.HomesteadBlock), + DAOForkBlock: getBlockValue(cc.DAOForkBlock), + DAOForkSupport: cc.DAOForkSupport, + EIP150Block: getBlockValue(cc.EIP150Block), + EIP150Hash: common.HexToHash(cc.EIP150Hash), + EIP155Block: getBlockValue(cc.EIP155Block), + EIP158Block: getBlockValue(cc.EIP158Block), + ByzantiumBlock: getBlockValue(cc.ByzantiumBlock), + ConstantinopleBlock: getBlockValue(cc.ConstantinopleBlock), + PetersburgBlock: getBlockValue(cc.PetersburgBlock), + IstanbulBlock: getBlockValue(cc.IstanbulBlock), + MuirGlacierBlock: getBlockValue(cc.MuirGlacierBlock), + BerlinBlock: getBlockValue(cc.BerlinBlock), + LondonBlock: getBlockValue(cc.LondonBlock), + ArrowGlacierBlock: getBlockValue(cc.ArrowGlacierBlock), + MergeNetsplitBlock: getBlockValue(cc.MergeForkBlock), + TerminalTotalDifficulty: nil, + Ethash: nil, + Clique: nil, + } +} + +// 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{ + HomesteadBlock: &homesteadBlock, + DAOForkBlock: &daoForkBlock, + DAOForkSupport: true, + EIP150Block: &eip150Block, + EIP150Hash: common.Hash{}.String(), + EIP155Block: &eip155Block, + EIP158Block: &eip158Block, + ByzantiumBlock: &byzantiumBlock, + ConstantinopleBlock: &constantinopleBlock, + PetersburgBlock: &petersburgBlock, + IstanbulBlock: &istanbulBlock, + MuirGlacierBlock: &muirGlacierBlock, + BerlinBlock: &berlinBlock, + LondonBlock: &londonBlock, + ArrowGlacierBlock: &arrowGlacierBlock, + MergeForkBlock: &mergeForkBlock, + } +} + +func getBlockValue(block *sdk.Int) *big.Int { + if block == nil || block.IsNegative() { + return nil + } + + return block.BigInt() +} + +// 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 { + if err := validateBlock(cc.HomesteadBlock); err != nil { + return sdkerrors.Wrap(err, "homesteadBlock") + } + if err := validateBlock(cc.DAOForkBlock); err != nil { + return sdkerrors.Wrap(err, "daoForkBlock") + } + if err := validateBlock(cc.EIP150Block); err != nil { + return sdkerrors.Wrap(err, "eip150Block") + } + if err := validateHash(cc.EIP150Hash); err != nil { + return err + } + if err := validateBlock(cc.EIP155Block); err != nil { + return sdkerrors.Wrap(err, "eip155Block") + } + if err := validateBlock(cc.EIP158Block); err != nil { + return sdkerrors.Wrap(err, "eip158Block") + } + if err := validateBlock(cc.ByzantiumBlock); err != nil { + return sdkerrors.Wrap(err, "byzantiumBlock") + } + if err := validateBlock(cc.ConstantinopleBlock); err != nil { + return sdkerrors.Wrap(err, "constantinopleBlock") + } + if err := validateBlock(cc.PetersburgBlock); err != nil { + return sdkerrors.Wrap(err, "petersburgBlock") + } + if err := validateBlock(cc.IstanbulBlock); err != nil { + return sdkerrors.Wrap(err, "istanbulBlock") + } + if err := validateBlock(cc.MuirGlacierBlock); err != nil { + return sdkerrors.Wrap(err, "muirGlacierBlock") + } + if err := validateBlock(cc.BerlinBlock); err != nil { + return sdkerrors.Wrap(err, "berlinBlock") + } + if err := validateBlock(cc.LondonBlock); err != nil { + return sdkerrors.Wrap(err, "londonBlock") + } + if err := validateBlock(cc.ArrowGlacierBlock); err != nil { + return sdkerrors.Wrap(err, "arrowGlacierBlock") + } + if err := validateBlock(cc.MergeForkBlock); err != nil { + return sdkerrors.Wrap(err, "mergeForkBlock") + } + + // NOTE: chain ID is not needed to check config order + if err := cc.EthereumConfig(nil).CheckConfigForkOrder(); err != nil { + return sdkerrors.Wrap(err, "invalid config fork order") + } + return nil +} + +func validateHash(hex string) error { + if hex != "" && strings.TrimSpace(hex) == "" { + return sdkerrors.Wrap(types.ErrInvalidChainConfig, "hash cannot be blank") + } + + return nil +} + +func validateBlock(block *sdk.Int) error { + // nil value means that the fork has not yet been applied + if block == nil { + return nil + } + + if block.IsNegative() { + return sdkerrors.Wrapf( + types.ErrInvalidChainConfig, "block value cannot be negative: %s", block, + ) + } + + return nil +} diff --git a/x/evm/migrations/v4/types/evm.pb.go b/x/evm/migrations/v2/types/evm.pb.go similarity index 63% rename from x/evm/migrations/v4/types/evm.pb.go rename to x/evm/migrations/v2/types/evm.pb.go index 03a44429ad..11a5d52062 100644 --- a/x/evm/migrations/v4/types/evm.pb.go +++ b/x/evm/migrations/v2/types/evm.pb.go @@ -6,7 +6,7 @@ package types import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -24,36 +24,35 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// V4Params defines the EVM module parameters -type V4Params struct { - // evm_denom represents the token denomination used to run the EVM V4State +// 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 V4State transitions that use the vm.Create function + // 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 V4State transitions that use the vm.Call function + // 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 ExtraEIPs `protobuf:"bytes,4,opt,name=extra_eips,json=extraEips,proto3" json:"extra_eips" yaml:"extra_eips"` - // chain_config defines the EVM chain configuration parameters - V4ChainConfig V4ChainConfig `protobuf:"bytes,5,opt,name=chain_config,json=V4ChainConfig,proto3" json:"chain_config" yaml:"chain_config"` - // allow_unprotected_txs defines if replay-protected (i.e non EIP155 - // signed) transactions can be executed on the V4State machine. - AllowUnprotectedTxs bool `protobuf:"varint,6,opt,name=allow_unprotected_txs,json=allowUnprotectedTxs,proto3" json:"allow_unprotected_txs,omitempty"` -} - -func (m *V4Params) Reset() { *m = V4Params{} } -func (m *V4Params) String() string { return proto.CompactTextString(m) } -func (*V4Params) ProtoMessage() {} -func (*V4Params) Descriptor() ([]byte, []int) { + // 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 *V4Params) XXX_Unmarshal(b []byte) error { +func (m *V2Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *V4Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_V4Params.Marshal(b, m, deterministic) + return xxx_messageInfo_Params.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -63,162 +62,110 @@ func (m *V4Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *V4Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_V4Params.Merge(m, src) +func (m *V2Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) } -func (m *V4Params) XXX_Size() int { +func (m *V2Params) XXX_Size() int { return m.Size() } -func (m *V4Params) XXX_DiscardUnknown() { - xxx_messageInfo_V4Params.DiscardUnknown(m) +func (m *V2Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) } -var xxx_messageInfo_V4Params proto.InternalMessageInfo +var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *V4Params) GetEvmDenom() string { +func (m *V2Params) GetEvmDenom() string { if m != nil { return m.EvmDenom } return "" } -func (m *V4Params) GetEnableCreate() bool { +func (m *V2Params) GetEnableCreate() bool { if m != nil { return m.EnableCreate } return false } -func (m *V4Params) GetEnableCall() bool { +func (m *V2Params) GetEnableCall() bool { if m != nil { return m.EnableCall } return false } -func (m *V4Params) GetExtraEIPs() ExtraEIPs { +func (m *V2Params) GetExtraEIPs() []int64 { if m != nil { return m.ExtraEIPs } - return ExtraEIPs{} -} - -func (m *V4Params) GetV4ChainConfig() V4ChainConfig { - if m != nil { - return m.V4ChainConfig - } - return V4ChainConfig{} + return nil } -func (m *V4Params) GetAllowUnprotectedTxs() bool { +func (m *V2Params) GetChainConfig() V2ChainConfig { if m != nil { - return m.AllowUnprotectedTxs - } - return false -} - -// ExtraEIPs represents extra EIPs for the vm.Config -type ExtraEIPs struct { - // eips defines the additional EIPs for the vm.Config - EIPs []int64 `protobuf:"varint,1,rep,packed,name=eips,proto3" json:"eips,omitempty" yaml:"eips"` -} - -func (m *ExtraEIPs) Reset() { *m = ExtraEIPs{} } -func (m *ExtraEIPs) String() string { return proto.CompactTextString(m) } -func (*ExtraEIPs) ProtoMessage() {} -func (*ExtraEIPs) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{1} -} -func (m *ExtraEIPs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExtraEIPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExtraEIPs.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil + return m.ChainConfig } + return V2ChainConfig{} } -func (m *ExtraEIPs) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtraEIPs.Merge(m, src) -} -func (m *ExtraEIPs) XXX_Size() int { - return m.Size() -} -func (m *ExtraEIPs) XXX_DiscardUnknown() { - xxx_messageInfo_ExtraEIPs.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtraEIPs proto.InternalMessageInfo -func (m *ExtraEIPs) GetEIPs() []int64 { +func (m *V2Params) GetEIP712AllowedMsgs() []V2EIP712AllowedMsg { if m != nil { - return m.EIPs + return m.EIP712AllowedMsgs } return nil } -// V4ChainConfig defines the Ethereum V4ChainConfig parameters using *sdk.Int values +// V2ChainConfig defines the Ethereum V2ChainConfig parameters using *sdk.Int values // instead of *big.Int. -type V4ChainConfig struct { - // homestead_block switch (nil no fork, 0 = already homestead) +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"` - // dao_fork_block corresponds to TheDAO hard-fork switch block (nil no fork) + // 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"` - // dao_fork_support defines whether the nodes supports or opposes the DAO hard-fork + // 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_block: EIP150 implements the Gas price changes + // 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_hash: EIP150 HF hash (needed for header only clients as only gas pricing changed) + // 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"` - // eip155_block: EIP155Block HF 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_block: EIP158 HF 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_block: Byzantium switch block (nil no fork, 0 = already on byzantium) + // 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_block: Constantinople switch block (nil no fork, 0 = already activated) + // 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_block: Petersburg switch block (nil same as Constantinople) + // 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_block: Istanbul switch block (nil no fork, 0 = already on istanbul) + // 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"` - // muir_glacier_block: Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated) + // 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_block: Berlin switch block (nil = no fork, 0 = already on berlin) + // 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_block: London switch block (nil = no fork, 0 = already on london) + // 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"` - // arrow_glacier_block: Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) + // 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"` - // gray_glacier_block: EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already activated) - GrayGlacierBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,20,opt,name=gray_glacier_block,json=grayGlacierBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gray_glacier_block,omitempty" yaml:"gray_glacier_block"` - // merge_netsplit_block: Virtual fork after The Merge to use as a network splitter - MergeNetsplitBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,21,opt,name=merge_netsplit_block,json=mergeNetsplitBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"merge_netsplit_block,omitempty" yaml:"merge_netsplit_block"` - // shanghai_block switch block (nil = no fork, 0 = already on shanghai) - ShanghaiBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,22,opt,name=shanghai_block,json=shanghaiBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shanghai_block,omitempty" yaml:"shanghai_block"` - // cancun_block switch block (nil = no fork, 0 = already on cancun) - CancunBlock *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,23,opt,name=cancun_block,json=cancunBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"cancun_block,omitempty" yaml:"cancun_block"` -} - -func (m *V4ChainConfig) Reset() { *m = V4ChainConfig{} } -func (m *V4ChainConfig) String() string { return proto.CompactTextString(m) } -func (*V4ChainConfig) ProtoMessage() {} -func (*V4ChainConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{2} + // 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 *V4ChainConfig) XXX_Unmarshal(b []byte) error { +func (m *V2ChainConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *V4ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_V4ChainConfig.Marshal(b, m, deterministic) + return xxx_messageInfo_ChainConfig.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -228,52 +175,50 @@ func (m *V4ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *V4ChainConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_V4ChainConfig.Merge(m, src) +func (m *V2ChainConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChainConfig.Merge(m, src) } -func (m *V4ChainConfig) XXX_Size() int { +func (m *V2ChainConfig) XXX_Size() int { return m.Size() } -func (m *V4ChainConfig) XXX_DiscardUnknown() { - xxx_messageInfo_V4ChainConfig.DiscardUnknown(m) +func (m *V2ChainConfig) XXX_DiscardUnknown() { + xxx_messageInfo_ChainConfig.DiscardUnknown(m) } -var xxx_messageInfo_V4ChainConfig proto.InternalMessageInfo +var xxx_messageInfo_ChainConfig proto.InternalMessageInfo -func (m *V4ChainConfig) GetDAOForkSupport() bool { +func (m *V2ChainConfig) GetDAOForkSupport() bool { if m != nil { return m.DAOForkSupport } return false } -func (m *V4ChainConfig) GetEIP150Hash() string { +func (m *V2ChainConfig) GetEIP150Hash() string { if m != nil { return m.EIP150Hash } return "" } -// V4State represents a single Storage key value pair item. -type V4State struct { - // key is the stored key - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // value is the stored value for the given key +// 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 *V4State) Reset() { *m = V4State{} } -func (m *V4State) String() string { return proto.CompactTextString(m) } -func (*V4State) ProtoMessage() {} -func (*V4State) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{3} +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 *V4State) XXX_Unmarshal(b []byte) error { +func (m *V2State) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *V4State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_V4State.Marshal(b, m, deterministic) + return xxx_messageInfo_State.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -283,54 +228,52 @@ func (m *V4State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *V4State) XXX_Merge(src proto.Message) { - xxx_messageInfo_V4State.Merge(m, src) +func (m *V2State) XXX_Merge(src proto.Message) { + xxx_messageInfo_State.Merge(m, src) } -func (m *V4State) XXX_Size() int { +func (m *V2State) XXX_Size() int { return m.Size() } -func (m *V4State) XXX_DiscardUnknown() { - xxx_messageInfo_V4State.DiscardUnknown(m) +func (m *V2State) XXX_DiscardUnknown() { + xxx_messageInfo_State.DiscardUnknown(m) } -var xxx_messageInfo_V4State proto.InternalMessageInfo +var xxx_messageInfo_State proto.InternalMessageInfo -func (m *V4State) GetKey() string { +func (m *V2State) GetKey() string { if m != nil { return m.Key } return "" } -func (m *V4State) GetValue() string { +func (m *V2State) GetValue() string { if m != nil { return m.Value } return "" } -// TransactionV4Logs define the V4Logs generated from a transaction execution +// 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 V4State after an upgrade. -type TransactionV4Logs struct { - // hash of the transaction +// persisted on blockchain state after an upgrade. +type V2TransactionLogs struct { Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - // V4Logs is an array of V4Logs for the given transaction hash - V4Logs []*V4Log `protobuf:"bytes,2,rep,name=V4Logs,proto3" json:"V4Logs,omitempty"` + Logs []*V2Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` } -func (m *TransactionV4Logs) Reset() { *m = TransactionV4Logs{} } -func (m *TransactionV4Logs) String() string { return proto.CompactTextString(m) } -func (*TransactionV4Logs) ProtoMessage() {} -func (*TransactionV4Logs) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{4} +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 *TransactionV4Logs) XXX_Unmarshal(b []byte) error { +func (m *V2TransactionLogs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TransactionV4Logs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2TransactionLogs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_TransactionV4Logs.Marshal(b, m, deterministic) + return xxx_messageInfo_TransactionLogs.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -340,73 +283,70 @@ func (m *TransactionV4Logs) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *TransactionV4Logs) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionV4Logs.Merge(m, src) +func (m *V2TransactionLogs) XXX_Merge(src proto.Message) { + xxx_messageInfo_TransactionLogs.Merge(m, src) } -func (m *TransactionV4Logs) XXX_Size() int { +func (m *V2TransactionLogs) XXX_Size() int { return m.Size() } -func (m *TransactionV4Logs) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionV4Logs.DiscardUnknown(m) +func (m *V2TransactionLogs) XXX_DiscardUnknown() { + xxx_messageInfo_TransactionLogs.DiscardUnknown(m) } -var xxx_messageInfo_TransactionV4Logs proto.InternalMessageInfo +var xxx_messageInfo_TransactionLogs proto.InternalMessageInfo -func (m *TransactionV4Logs) GetHash() string { +func (m *V2TransactionLogs) GetHash() string { if m != nil { return m.Hash } return "" } -func (m *TransactionV4Logs) GetV4Logs() []*V4Log { +func (m *V2TransactionLogs) GetLogs() []*V2Log { if m != nil { - return m.V4Logs + return m.Logs } return nil } -// V4Log represents an protobuf compatible Ethereum V4Log that defines a contract -// V4Log event. These events are generated by the V4Log opcode and stored/indexed by +// 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. -// -// NOTE: address, topics and data are consensus fields. The rest of the fields -// are derived, i.e. filled in by the nodes, but not secured by consensus. -type V4Log struct { +type V2Log struct { // address of the contract that generated the event Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // topics is a list of topics provided by the contract. + // list of topics provided by the contract. Topics []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"` - // data which is supplied by the contract, usually ABI-encoded + // supplied by the contract, usually ABI-encoded Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - // block_number of the block in which the transaction was included + // block in which the transaction was included BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"` - // tx_hash is the transaction hash + // hash of the transaction TxHash string `protobuf:"bytes,5,opt,name=tx_hash,json=txHash,proto3" json:"transactionHash"` - // tx_index of the transaction in the block + // index of the transaction in the block TxIndex uint64 `protobuf:"varint,6,opt,name=tx_index,json=txIndex,proto3" json:"transactionIndex"` - // block_hash of the block in which the transaction was included + // 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 V4Log in the block - Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"V4LogIndex"` - // removed is true if this V4Log was reverted due to a chain - // reorganisation. You must pay attention to this field if you receive V4Logs + // 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 *V4Log) Reset() { *m = V4Log{} } -func (m *V4Log) String() string { return proto.CompactTextString(m) } -func (*V4Log) ProtoMessage() {} -func (*V4Log) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{5} +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 *V4Log) XXX_Unmarshal(b []byte) error { +func (m *V2Log) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *V4Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_V4Log.Marshal(b, m, deterministic) + return xxx_messageInfo_Log.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -416,92 +356,92 @@ func (m *V4Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *V4Log) XXX_Merge(src proto.Message) { - xxx_messageInfo_V4Log.Merge(m, src) +func (m *V2Log) XXX_Merge(src proto.Message) { + xxx_messageInfo_Log.Merge(m, src) } -func (m *V4Log) XXX_Size() int { +func (m *V2Log) XXX_Size() int { return m.Size() } -func (m *V4Log) XXX_DiscardUnknown() { - xxx_messageInfo_V4Log.DiscardUnknown(m) +func (m *V2Log) XXX_DiscardUnknown() { + xxx_messageInfo_Log.DiscardUnknown(m) } -var xxx_messageInfo_V4Log proto.InternalMessageInfo +var xxx_messageInfo_Log proto.InternalMessageInfo -func (m *V4Log) GetAddress() string { +func (m *V2Log) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *V4Log) GetTopics() []string { +func (m *V2Log) GetTopics() []string { if m != nil { return m.Topics } return nil } -func (m *V4Log) GetData() []byte { +func (m *V2Log) GetData() []byte { if m != nil { return m.Data } return nil } -func (m *V4Log) GetBlockNumber() uint64 { +func (m *V2Log) GetBlockNumber() uint64 { if m != nil { return m.BlockNumber } return 0 } -func (m *V4Log) GetTxHash() string { +func (m *V2Log) GetTxHash() string { if m != nil { return m.TxHash } return "" } -func (m *V4Log) GetTxIndex() uint64 { +func (m *V2Log) GetTxIndex() uint64 { if m != nil { return m.TxIndex } return 0 } -func (m *V4Log) GetBlockHash() string { +func (m *V2Log) GetBlockHash() string { if m != nil { return m.BlockHash } return "" } -func (m *V4Log) GetIndex() uint64 { +func (m *V2Log) GetIndex() uint64 { if m != nil { return m.Index } return 0 } -func (m *V4Log) GetRemoved() bool { +func (m *V2Log) GetRemoved() bool { if m != nil { return m.Removed } return false } -// V4TxResult stores results of Tx execution. -type V4TxResult struct { +// V2TxResult stores results of Tx execution. +type V2TxResult struct { // contract_address contains the ethereum address of the created contract (if - // any). If the V4State transition is an evm.Call, the contract address will be + // 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_V4Logs contains the transaction hash and the proto-compatible ethereum - // V4Logs. - TxV4Logs TransactionV4Logs `protobuf:"bytes,3,opt,name=tx_V4Logs,json=txV4Logs,proto3" json:"tx_V4Logs" yaml:"tx_V4Logs"` + // 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 @@ -510,18 +450,18 @@ type V4TxResult struct { GasUsed uint64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` } -func (m *V4TxResult) Reset() { *m = V4TxResult{} } -func (m *V4TxResult) String() string { return proto.CompactTextString(m) } -func (*V4TxResult) ProtoMessage() {} -func (*V4TxResult) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{6} +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 *V4TxResult) XXX_Unmarshal(b []byte) error { +func (m *V2TxResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *V4TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_V4TxResult.Marshal(b, m, deterministic) + return xxx_messageInfo_TxResult.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -531,38 +471,38 @@ func (m *V4TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *V4TxResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_V4TxResult.Merge(m, src) +func (m *V2TxResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxResult.Merge(m, src) } -func (m *V4TxResult) XXX_Size() int { +func (m *V2TxResult) XXX_Size() int { return m.Size() } -func (m *V4TxResult) XXX_DiscardUnknown() { - xxx_messageInfo_V4TxResult.DiscardUnknown(m) +func (m *V2TxResult) XXX_DiscardUnknown() { + xxx_messageInfo_TxResult.DiscardUnknown(m) } -var xxx_messageInfo_V4TxResult proto.InternalMessageInfo +var xxx_messageInfo_TxResult proto.InternalMessageInfo -// V4AccessTuple is the element type of an access list. -type V4AccessTuple struct { - // address is a hex formatted ethereum address +// 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"` - // storage_keys are hex formatted hashes of the storage keys + // hex formatted hashes of the storage keys StorageKeys []string `protobuf:"bytes,2,rep,name=storage_keys,json=storageKeys,proto3" json:"storageKeys"` } -func (m *V4AccessTuple) Reset() { *m = V4AccessTuple{} } -func (m *V4AccessTuple) String() string { return proto.CompactTextString(m) } -func (*V4AccessTuple) ProtoMessage() {} -func (*V4AccessTuple) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{7} +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 *V4AccessTuple) XXX_Unmarshal(b []byte) error { +func (m *V2AccessTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *V4AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_V4AccessTuple.Marshal(b, m, deterministic) + return xxx_messageInfo_AccessTuple.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -572,57 +512,55 @@ func (m *V4AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *V4AccessTuple) XXX_Merge(src proto.Message) { - xxx_messageInfo_V4AccessTuple.Merge(m, src) +func (m *V2AccessTuple) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessTuple.Merge(m, src) } -func (m *V4AccessTuple) XXX_Size() int { +func (m *V2AccessTuple) XXX_Size() int { return m.Size() } -func (m *V4AccessTuple) XXX_DiscardUnknown() { - xxx_messageInfo_V4AccessTuple.DiscardUnknown(m) +func (m *V2AccessTuple) XXX_DiscardUnknown() { + xxx_messageInfo_AccessTuple.DiscardUnknown(m) } -var xxx_messageInfo_V4AccessTuple proto.InternalMessageInfo +var xxx_messageInfo_AccessTuple proto.InternalMessageInfo -// V4TraceConfig holds extra parameters to trace functions. -type V4TraceConfig struct { - // tracer is a custom javascript tracer +// 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"` - // timeout overrides the default timeout of 5 seconds for JavaScript-based tracing + // overrides the default timeout of 5 seconds for JavaScript-based tracing // calls Timeout string `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"` - // reexec defines the number of blocks the tracer is willing to go back + // number of blocks the tracer is willing to go back Reexec uint64 `protobuf:"varint,3,opt,name=reexec,proto3" json:"reexec,omitempty"` - // disable_stack switches stack capture + // disable stack capture DisableStack bool `protobuf:"varint,5,opt,name=disable_stack,json=disableStack,proto3" json:"disableStack"` - // disable_storage switches storage capture + // disable storage capture DisableStorage bool `protobuf:"varint,6,opt,name=disable_storage,json=disableStorage,proto3" json:"disableStorage"` - // debug can be used to print output during capture end + // print output during capture end Debug bool `protobuf:"varint,8,opt,name=debug,proto3" json:"debug,omitempty"` - // limit defines the maximum length of output, but zero means unlimited + // maximum length of output, but zero means unlimited Limit int32 `protobuf:"varint,9,opt,name=limit,proto3" json:"limit,omitempty"` - // overrides can be used to execute a trace using future fork rules - Overrides *V4ChainConfig `protobuf:"bytes,10,opt,name=overrides,proto3" json:"overrides,omitempty"` - // enable_memory switches memory capture + // 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 switches the capture of return data + // enable return data capture EnableReturnData bool `protobuf:"varint,12,opt,name=enable_return_data,json=enableReturnData,proto3" json:"enableReturnData"` - // tracer_json_config configures the tracer using a JSON string - TracerJsonConfig string `protobuf:"bytes,13,opt,name=tracer_json_config,json=tracerJsonConfig,proto3" json:"tracerConfig"` } -func (m *V4TraceConfig) Reset() { *m = V4TraceConfig{} } -func (m *V4TraceConfig) String() string { return proto.CompactTextString(m) } -func (*V4TraceConfig) ProtoMessage() {} -func (*V4TraceConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{8} +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 *V4TraceConfig) XXX_Unmarshal(b []byte) error { +func (m *V2TraceConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *V4TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *V2TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_V4TraceConfig.Marshal(b, m, deterministic) + return xxx_messageInfo_TraceConfig.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -632,217 +570,396 @@ func (m *V4TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *V4TraceConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_V4TraceConfig.Merge(m, src) +func (m *V2TraceConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_TraceConfig.Merge(m, src) } -func (m *V4TraceConfig) XXX_Size() int { +func (m *V2TraceConfig) XXX_Size() int { return m.Size() } -func (m *V4TraceConfig) XXX_DiscardUnknown() { - xxx_messageInfo_V4TraceConfig.DiscardUnknown(m) +func (m *V2TraceConfig) XXX_DiscardUnknown() { + xxx_messageInfo_TraceConfig.DiscardUnknown(m) } -var xxx_messageInfo_V4TraceConfig proto.InternalMessageInfo +var xxx_messageInfo_TraceConfig proto.InternalMessageInfo -func (m *V4TraceConfig) GetTracer() string { +func (m *V2TraceConfig) GetTracer() string { if m != nil { return m.Tracer } return "" } -func (m *V4TraceConfig) GetTimeout() string { +func (m *V2TraceConfig) GetTimeout() string { if m != nil { return m.Timeout } return "" } -func (m *V4TraceConfig) GetReexec() uint64 { +func (m *V2TraceConfig) GetReexec() uint64 { if m != nil { return m.Reexec } return 0 } -func (m *V4TraceConfig) GetDisableStack() bool { +func (m *V2TraceConfig) GetDisableStack() bool { if m != nil { return m.DisableStack } return false } -func (m *V4TraceConfig) GetDisableStorage() bool { +func (m *V2TraceConfig) GetDisableStorage() bool { if m != nil { return m.DisableStorage } return false } -func (m *V4TraceConfig) GetDebug() bool { +func (m *V2TraceConfig) GetDebug() bool { if m != nil { return m.Debug } return false } -func (m *V4TraceConfig) GetLimit() int32 { +func (m *V2TraceConfig) GetLimit() int32 { if m != nil { return m.Limit } return 0 } -func (m *V4TraceConfig) GetOverrides() *V4ChainConfig { +func (m *V2TraceConfig) GetOverrides() *V2ChainConfig { if m != nil { return m.Overrides } return nil } -func (m *V4TraceConfig) GetEnableMemory() bool { +func (m *V2TraceConfig) GetEnableMemory() bool { if m != nil { return m.EnableMemory } return false } -func (m *V4TraceConfig) GetEnableReturnData() bool { +func (m *V2TraceConfig) GetEnableReturnData() bool { if m != nil { return m.EnableReturnData } return false } -func (m *V4TraceConfig) GetTracerJsonConfig() string { +// 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.TracerJsonConfig + return m.Type } return "" } func init() { - proto.RegisterType((*V4Params)(nil), "ethermint.evm.v1.V4Params") - proto.RegisterType((*ExtraEIPs)(nil), "ethermint.evm.v1.ExtraEIPs") - proto.RegisterType((*V4ChainConfig)(nil), "ethermint.evm.v1.V4ChainConfig") - proto.RegisterType((*V4State)(nil), "ethermint.evm.v1.V4State") - proto.RegisterType((*TransactionV4Logs)(nil), "ethermint.evm.v1.TransactionV4Logs") - proto.RegisterType((*V4Log)(nil), "ethermint.evm.v1.V4Log") - proto.RegisterType((*V4TxResult)(nil), "ethermint.evm.v1.V4TxResult") - proto.RegisterType((*V4AccessTuple)(nil), "ethermint.evm.v1.V4AccessTuple") - proto.RegisterType((*V4TraceConfig)(nil), "ethermint.evm.v1.V4TraceConfig") + 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{ - // 1644 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x4f, 0x6f, 0xe3, 0xc6, - 0x15, 0xb7, 0x2d, 0xda, 0xa6, 0x46, 0xb2, 0x44, 0x8f, 0xb5, 0x5e, 0x65, 0x17, 0x35, 0x5d, 0x1e, - 0x02, 0x17, 0x4d, 0xec, 0xd8, 0x81, 0xd1, 0x45, 0x82, 0x16, 0x5d, 0xed, 0x3a, 0x89, 0xdd, 0x6d, - 0x6a, 0x8c, 0x1d, 0x14, 0x28, 0x50, 0x10, 0x23, 0x72, 0x42,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07, 0x40, 0x33, 0x8d, 0x11, 0x91, 0xb3, 0xcc, 0x57, 0xe7, 0xbf, - 0xae, 0xe6, 0xaa, 0x53, 0xa8, 0xbd, 0x48, 0x39, 0x5f, 0x63, 0x81, 0xd1, 0x3d, 0x0b, 0xfc, 0x05, - 0x80, 0x7a, 0x4f, 0xfc, 0xef, 0x38, 0x2d, 0x3f, 0x33, 0xf5, 0xd3, 0x42, 0xe9, 0x6b, 0xaf, 0x59, - 0xb3, 0xa3, 0xd1, 0x05, 0xa7, 0x26, 0x8b, 0x0b, 0xcb, 0xb6, 0x9c, 0xf5, 0x0b, 0xcb, 0xde, 0x74, - 0xec, 0xb2, 0x7e, 0x26, 0x0b, 0xb4, 0x33, 0xc1, 0x33, 0xcb, 0xeb, 0xfc, 0xf2, 0x87, 0xdb, 0xbd, - 0xd5, 0x77, 0xb7, 0x7b, 0xab, 0xff, 0xbe, 0xdd, 0x5b, 0xfd, 0xeb, 0xfb, 0xbd, 0x95, 0x77, 0xef, - 0xf7, 0x56, 0xfe, 0xf9, 0x7e, 0x6f, 0xe5, 0x77, 0xb3, 0xf7, 0x03, 0x19, 0xc8, 0xeb, 0x61, 0xfa, - 0xd3, 0xc2, 0x50, 0xfd, 0xb8, 0xa0, 0xee, 0x88, 0xee, 0x86, 0xfa, 0xd1, 0xe0, 0xd3, 0xff, 0x04, - 0x00, 0x00, 0xff, 0xff, 0x68, 0xce, 0x8e, 0x23, 0x7a, 0x10, 0x00, 0x00, -} - -func (m *V4Params) Marshal() (dAtA []byte, err error) { + // 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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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]) @@ -852,28 +969,32 @@ func (m *V4Params) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *V4Params) MarshalTo(dAtA []byte) (int, error) { +func (m *V2Params) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *V4Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.AllowUnprotectedTxs { - i-- - if m.AllowUnprotectedTxs { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + 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 } - i-- - dAtA[i] = 0x30 } { - size, err := m.V4ChainConfig.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ChainConfig.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -882,16 +1003,25 @@ func (m *V4Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x2a - { - size, err := m.ExtraEIPs.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + 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 -= size - i = encodeVarintEvm(dAtA, i, uint64(size)) + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) + i = encodeVarintEvm(dAtA, i, uint64(j2)) + i-- + dAtA[i] = 0x22 } - i-- - dAtA[i] = 0x22 if m.EnableCall { i-- if m.EnableCall { @@ -922,49 +1052,7 @@ func (m *V4Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ExtraEIPs) 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 *ExtraEIPs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExtraEIPs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.EIPs) > 0 { - dAtA4 := make([]byte, len(m.EIPs)*10) - var j3 int - for _, num1 := range m.EIPs { - num := uint64(num1) - for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j3++ - } - dAtA4[j3] = uint8(num) - j3++ - } - i -= j3 - copy(dAtA[i:], dAtA4[:j3]) - i = encodeVarintEvm(dAtA, i, uint64(j3)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *V4ChainConfig) Marshal() (dAtA []byte, err error) { +func (m *V2ChainConfig) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -974,63 +1062,21 @@ func (m *V4ChainConfig) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *V4ChainConfig) MarshalTo(dAtA []byte) (int, error) { +func (m *V2ChainConfig) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *V4ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.CancunBlock != nil { - { - size := m.CancunBlock.Size() - i -= size - if _, err := m.CancunBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xba - } - if m.ShanghaiBlock != nil { - { - size := m.ShanghaiBlock.Size() - i -= size - if _, err := m.ShanghaiBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb2 - } - if m.MergeNetsplitBlock != nil { - { - size := m.MergeNetsplitBlock.Size() - i -= size - if _, err := m.MergeNetsplitBlock.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - if m.GrayGlacierBlock != nil { + if m.MergeForkBlock != nil { { - size := m.GrayGlacierBlock.Size() + size := m.MergeForkBlock.Size() i -= size - if _, err := m.GrayGlacierBlock.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.MergeForkBlock.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintEvm(dAtA, i, uint64(size)) @@ -1038,7 +1084,7 @@ func (m *V4ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xa2 + dAtA[i] = 0x9a } if m.ArrowGlacierBlock != nil { { @@ -1220,7 +1266,7 @@ func (m *V4ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *V4State) Marshal() (dAtA []byte, err error) { +func (m *V2State) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1230,12 +1276,12 @@ func (m *V4State) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *V4State) MarshalTo(dAtA []byte) (int, error) { +func (m *V2State) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *V4State) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1257,7 +1303,7 @@ func (m *V4State) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *TransactionV4Logs) Marshal() (dAtA []byte, err error) { +func (m *V2TransactionLogs) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1267,20 +1313,20 @@ func (m *TransactionV4Logs) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TransactionV4Logs) MarshalTo(dAtA []byte) (int, error) { +func (m *V2TransactionLogs) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TransactionV4Logs) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2TransactionLogs) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.V4Logs) > 0 { - for iNdEx := len(m.V4Logs) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.V4Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1301,7 +1347,7 @@ func (m *TransactionV4Logs) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *V4Log) Marshal() (dAtA []byte, err error) { +func (m *V2Log) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1311,12 +1357,12 @@ func (m *V4Log) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *V4Log) MarshalTo(dAtA []byte) (int, error) { +func (m *V2Log) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *V4Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1386,7 +1432,7 @@ func (m *V4Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *V4TxResult) Marshal() (dAtA []byte, err error) { +func (m *V2TxResult) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1396,12 +1442,12 @@ func (m *V4TxResult) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *V4TxResult) MarshalTo(dAtA []byte) (int, error) { +func (m *V2TxResult) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *V4TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1429,7 +1475,7 @@ func (m *V4TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } { - size, err := m.TxV4Logs.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.TxLogs.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1455,7 +1501,7 @@ func (m *V4TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *V4AccessTuple) Marshal() (dAtA []byte, err error) { +func (m *V2AccessTuple) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1465,12 +1511,12 @@ func (m *V4AccessTuple) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *V4AccessTuple) MarshalTo(dAtA []byte) (int, error) { +func (m *V2AccessTuple) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *V4AccessTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2AccessTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1494,7 +1540,7 @@ func (m *V4AccessTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *V4TraceConfig) Marshal() (dAtA []byte, err error) { +func (m *V2TraceConfig) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1504,23 +1550,16 @@ func (m *V4TraceConfig) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *V4TraceConfig) MarshalTo(dAtA []byte) (int, error) { +func (m *V2TraceConfig) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *V4TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *V2TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.TracerJsonConfig) > 0 { - i -= len(m.TracerJsonConfig) - copy(dAtA[i:], m.TracerJsonConfig) - i = encodeVarintEvm(dAtA, i, uint64(len(m.TracerJsonConfig))) - i-- - dAtA[i] = 0x6a - } if m.EnableReturnData { i-- if m.EnableReturnData { @@ -1610,60 +1649,198 @@ func (m *V4TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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++ +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 } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *V4Params) 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)) + +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 m.EnableCreate { - n += 2 + 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 m.EnableCall { - n += 2 + 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 } - l = m.ExtraEIPs.Size() - n += 1 + l + sovEvm(uint64(l)) - l = m.V4ChainConfig.Size() - n += 1 + l + sovEvm(uint64(l)) - if m.AllowUnprotectedTxs { - n += 2 + 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 n + 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 (m *ExtraEIPs) Size() (n int) { +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 - if len(m.EIPs) > 0 { + 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.EIPs { + 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 *V4ChainConfig) Size() (n int) { +func (m *V2ChainConfig) Size() (n int) { if m == nil { return 0 } @@ -1728,26 +1905,14 @@ func (m *V4ChainConfig) Size() (n int) { l = m.ArrowGlacierBlock.Size() n += 2 + l + sovEvm(uint64(l)) } - if m.GrayGlacierBlock != nil { - l = m.GrayGlacierBlock.Size() - n += 2 + l + sovEvm(uint64(l)) - } - if m.MergeNetsplitBlock != nil { - l = m.MergeNetsplitBlock.Size() - n += 2 + l + sovEvm(uint64(l)) - } - if m.ShanghaiBlock != nil { - l = m.ShanghaiBlock.Size() - n += 2 + l + sovEvm(uint64(l)) - } - if m.CancunBlock != nil { - l = m.CancunBlock.Size() + if m.MergeForkBlock != nil { + l = m.MergeForkBlock.Size() n += 2 + l + sovEvm(uint64(l)) } return n } -func (m *V4State) Size() (n int) { +func (m *V2State) Size() (n int) { if m == nil { return 0 } @@ -1764,7 +1929,7 @@ func (m *V4State) Size() (n int) { return n } -func (m *TransactionV4Logs) Size() (n int) { +func (m *V2TransactionLogs) Size() (n int) { if m == nil { return 0 } @@ -1774,8 +1939,8 @@ func (m *TransactionV4Logs) Size() (n int) { if l > 0 { n += 1 + l + sovEvm(uint64(l)) } - if len(m.V4Logs) > 0 { - for _, e := range m.V4Logs { + if len(m.Logs) > 0 { + for _, e := range m.Logs { l = e.Size() n += 1 + l + sovEvm(uint64(l)) } @@ -1783,7 +1948,7 @@ func (m *TransactionV4Logs) Size() (n int) { return n } -func (m *V4Log) Size() (n int) { +func (m *V2Log) Size() (n int) { if m == nil { return 0 } @@ -1826,7 +1991,7 @@ func (m *V4Log) Size() (n int) { return n } -func (m *V4TxResult) Size() (n int) { +func (m *V2TxResult) Size() (n int) { if m == nil { return 0 } @@ -1840,7 +2005,7 @@ func (m *V4TxResult) Size() (n int) { if l > 0 { n += 1 + l + sovEvm(uint64(l)) } - l = m.TxV4Logs.Size() + l = m.TxLogs.Size() n += 1 + l + sovEvm(uint64(l)) l = len(m.Ret) if l > 0 { @@ -1855,7 +2020,7 @@ func (m *V4TxResult) Size() (n int) { return n } -func (m *V4AccessTuple) Size() (n int) { +func (m *V2AccessTuple) Size() (n int) { if m == nil { return 0 } @@ -1874,7 +2039,7 @@ func (m *V4AccessTuple) Size() (n int) { return n } -func (m *V4TraceConfig) Size() (n int) { +func (m *V2TraceConfig) Size() (n int) { if m == nil { return 0 } @@ -1913,7 +2078,68 @@ func (m *V4TraceConfig) Size() (n int) { if m.EnableReturnData { n += 2 } - l = len(m.TracerJsonConfig) + 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)) } @@ -1926,7 +2152,7 @@ func sovEvm(x uint64) (n int) { func sozEvm(x uint64) (n int) { return sovEvm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *V4Params) Unmarshal(dAtA []byte) error { +func (m *V2Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1949,10 +2175,10 @@ func (m *V4Params) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: V4Params: wiretype end group for non-group") + return fmt.Errorf("proto: Params: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: V4Params: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2028,9 +2254,85 @@ func (m *V4Params) Unmarshal(dAtA []byte) error { } m.EnableCall = bool(v != 0) case 4: - if wireType != 2 { + 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 { @@ -2056,13 +2358,13 @@ func (m *V4Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ExtraEIPs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ChainConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field V4ChainConfig", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EIP712AllowedMsgs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2089,156 +2391,11 @@ func (m *V4Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.V4ChainConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.EIP712AllowedMsgs = append(m.EIP712AllowedMsgs, V2EIP712AllowedMsg{}) + if err := m.EIP712AllowedMsgs[len(m.EIP712AllowedMsgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowUnprotectedTxs", 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.AllowUnprotectedTxs = 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 *ExtraEIPs) 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: ExtraEIPs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExtraEIPs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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.EIPs = append(m.EIPs, 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.EIPs) == 0 { - m.EIPs = 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.EIPs = append(m.EIPs, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field EIPs", wireType) - } default: iNdEx = preIndex skippy, err := skipEvm(dAtA[iNdEx:]) @@ -2260,7 +2417,7 @@ func (m *ExtraEIPs) Unmarshal(dAtA []byte) error { } return nil } -func (m *V4ChainConfig) Unmarshal(dAtA []byte) error { +func (m *V2ChainConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2283,10 +2440,10 @@ func (m *V4ChainConfig) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: V4ChainConfig: wiretype end group for non-group") + return fmt.Errorf("proto: ChainConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: V4ChainConfig: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ChainConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2809,117 +2966,9 @@ func (m *V4ChainConfig) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 20: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GrayGlacierBlock", 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.GrayGlacierBlock = &v - if err := m.GrayGlacierBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 21: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MergeNetsplitBlock", 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.MergeNetsplitBlock = &v - if err := m.MergeNetsplitBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 22: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShanghaiBlock", 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.ShanghaiBlock = &v - if err := m.ShanghaiBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 23: + case 19: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancunBlock", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MergeForkBlock", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2948,8 +2997,8 @@ func (m *V4ChainConfig) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } var v github_com_cosmos_cosmos_sdk_types.Int - m.CancunBlock = &v - if err := m.CancunBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.MergeForkBlock = &v + if err := m.MergeForkBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2974,7 +3023,7 @@ func (m *V4ChainConfig) Unmarshal(dAtA []byte) error { } return nil } -func (m *V4State) Unmarshal(dAtA []byte) error { +func (m *V2State) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2997,10 +3046,10 @@ func (m *V4State) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: V4State: wiretype end group for non-group") + return fmt.Errorf("proto: State: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: V4State: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: State: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3088,7 +3137,7 @@ func (m *V4State) Unmarshal(dAtA []byte) error { } return nil } -func (m *TransactionV4Logs) Unmarshal(dAtA []byte) error { +func (m *V2TransactionLogs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3111,10 +3160,10 @@ func (m *TransactionV4Logs) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TransactionV4Logs: wiretype end group for non-group") + return fmt.Errorf("proto: TransactionLogs: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TransactionV4Logs: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TransactionLogs: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3151,7 +3200,7 @@ func (m *TransactionV4Logs) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field V4Logs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3178,8 +3227,8 @@ func (m *TransactionV4Logs) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.V4Logs = append(m.V4Logs, &V4Log{}) - if err := m.V4Logs[len(m.V4Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Logs = append(m.Logs, &V2Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3204,7 +3253,7 @@ func (m *TransactionV4Logs) Unmarshal(dAtA []byte) error { } return nil } -func (m *V4Log) Unmarshal(dAtA []byte) error { +func (m *V2Log) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3227,10 +3276,10 @@ func (m *V4Log) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: V4Log: wiretype end group for non-group") + return fmt.Errorf("proto: Log: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: V4Log: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3493,7 +3542,7 @@ func (m *V4Log) Unmarshal(dAtA []byte) error { } return nil } -func (m *V4TxResult) Unmarshal(dAtA []byte) error { +func (m *V2TxResult) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3516,10 +3565,10 @@ func (m *V4TxResult) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: V4TxResult: wiretype end group for non-group") + return fmt.Errorf("proto: TxResult: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: V4TxResult: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TxResult: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3590,7 +3639,7 @@ func (m *V4TxResult) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxV4Logs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxLogs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3617,7 +3666,7 @@ func (m *V4TxResult) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TxV4Logs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TxLogs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3715,7 +3764,7 @@ func (m *V4TxResult) Unmarshal(dAtA []byte) error { } return nil } -func (m *V4AccessTuple) Unmarshal(dAtA []byte) error { +func (m *V2AccessTuple) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3738,10 +3787,10 @@ func (m *V4AccessTuple) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: V4AccessTuple: wiretype end group for non-group") + return fmt.Errorf("proto: AccessTuple: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: V4AccessTuple: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AccessTuple: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3829,7 +3878,7 @@ func (m *V4AccessTuple) Unmarshal(dAtA []byte) error { } return nil } -func (m *V4TraceConfig) Unmarshal(dAtA []byte) error { +func (m *V2TraceConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3852,10 +3901,10 @@ func (m *V4TraceConfig) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: V4TraceConfig: wiretype end group for non-group") + return fmt.Errorf("proto: TraceConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: V4TraceConfig: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TraceConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4050,7 +4099,7 @@ func (m *V4TraceConfig) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Overrides == nil { - m.Overrides = &V4ChainConfig{} + m.Overrides = &V2ChainConfig{} } if err := m.Overrides.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4096,24 +4145,106 @@ func (m *V4TraceConfig) Unmarshal(dAtA []byte) error { } } m.EnableReturnData = bool(v != 0) - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TracerJsonConfig", 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 - } + 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 { @@ -4126,7 +4257,305 @@ func (m *V4TraceConfig) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TracerJsonConfig = string(dAtA[iNdEx:postIndex]) + 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 @@ -4232,4 +4661,4 @@ var ( ErrInvalidLengthEvm = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowEvm = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupEvm = fmt.Errorf("proto: unexpected end of group") -) \ No newline at end of file +) diff --git a/x/evm/migrations/v2/types/params.go b/x/evm/migrations/v2/types/params.go new file mode 100644 index 0000000000..fc908e057b --- /dev/null +++ b/x/evm/migrations/v2/types/params.go @@ -0,0 +1,178 @@ +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" +) + +var _ paramtypes.ParamSet = &V2Params{} + +const ( + DefaultEVMDenom = types.AttoPhoton +) + +// Parameter keys +var ( + ParamStoreKeyEVMDenom = []byte("EVMDenom") + ParamStoreKeyEnableCreate = []byte("EnableCreate") + ParamStoreKeyEnableCall = []byte("EnableCall") + ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs") + ParamStoreKeyChainConfig = []byte("ChainConfig") + ParamStoreKeyEIP712AllowedMsgs = []byte("EIP712AllowedMsgs") + + // AvailableExtraEIPs define the list of all EIPs that can be enabled by the + // EVM interpreter. These EIPs are applied in order and can override the + // instruction sets from the latest hard fork enabled by the ChainConfig. For + // more info check: + // https://github.com/ethereum/go-ethereum/blob/master/core/vm/interpreter.go#L97 + AvailableExtraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529} +) + +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&V2Params{}) +} + +// NewParams creates a new Params instance +func NewParams(evmDenom string, enableCreate, enableCall bool, config V2ChainConfig, extraEIPs ...int64) V2Params { + return V2Params{ + EvmDenom: evmDenom, + EnableCreate: enableCreate, + EnableCall: enableCall, + ExtraEIPs: extraEIPs, + ChainConfig: config, + EIP712AllowedMsgs: []V2EIP712AllowedMsg{}, + } +} + +// DefaultParams returns default evm parameters +// ExtraEIPs is empty to prevent overriding the latest hard fork instruction set +func DefaultParams() V2Params { + return V2Params{ + EvmDenom: DefaultEVMDenom, + EnableCreate: true, + EnableCall: true, + ChainConfig: DefaultChainConfig(), + ExtraEIPs: nil, + EIP712AllowedMsgs: []V2EIP712AllowedMsg{}, + } +} + +// ParamSetPairs returns the parameter set pairs. +func (p *V2Params) 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(ParamStoreKeyEIP712AllowedMsgs, &p.EIP712AllowedMsgs, validateEIP712AllowedMsgs), + } +} + +// Validate performs basic validation on evm parameters. +func (p V2Params) Validate() error { + if err := sdk.ValidateDenom(p.EvmDenom); err != nil { + return err + } + + if err := validateEIPs(p.ExtraEIPs); err != nil { + return err + } + + if err := p.ChainConfig.Validate(); err != nil { + return err + } + + return validateEIP712AllowedMsgs(p.EIP712AllowedMsgs) +} + +// EIP712AllowedMsgFromMsgType returns the EIP712AllowedMsg for a given message type url. +func (p V2Params) EIP712AllowedMsgFromMsgType(msgTypeUrl string) *V2EIP712AllowedMsg { + for _, allowedMsg := range p.EIP712AllowedMsgs { + if allowedMsg.MsgTypeUrl == msgTypeUrl { + return &allowedMsg + } + } + return nil +} + +// EIPs returns the ExtraEips as a int slice +func (p V2Params) EIPs() []int { + eips := make([]int, len(p.ExtraEIPs)) + for i, eip := range p.ExtraEIPs { + eips[i] = int(eip) + } + return eips +} + +func validateEVMDenom(i interface{}) error { + denom, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter EVM denom type: %T", i) + } + + return sdk.ValidateDenom(denom) +} + +func validateBool(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil +} + +func validateEIPs(i interface{}) error { + eips, ok := i.([]int64) + if !ok { + return fmt.Errorf("invalid EIP slice type: %T", i) + } + + for _, eip := range eips { + if !vm.ValidEip(int(eip)) { + return fmt.Errorf("EIP %d is not activateable, valid EIPS are: %s", eip, vm.ActivateableEips()) + } + } + + return nil +} + +func validateChainConfig(i interface{}) error { + cfg, ok := i.(V2ChainConfig) + if !ok { + return fmt.Errorf("invalid chain config type: %T", i) + } + + return cfg.Validate() +} + +func validateEIP712AllowedMsgs(i interface{}) error { + allowedMsgs, ok := i.([]V2EIP712AllowedMsg) + if !ok { + return fmt.Errorf("invalid EIP712AllowedMsg slice type: %T", i) + } + + // ensure no duplicate msg type urls + msgTypes := make(map[string]bool) + for _, allowedMsg := range allowedMsgs { + if _, ok := msgTypes[allowedMsg.MsgTypeUrl]; ok { + return fmt.Errorf("duplicate eip712 allowed legacy msg type: %s", allowedMsg.MsgTypeUrl) + } + msgTypes[allowedMsg.MsgTypeUrl] = true + } + + 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/migrations/v3/store.go b/x/evm/migrations/v3/store.go new file mode 100644 index 0000000000..c2e11194e7 --- /dev/null +++ b/x/evm/migrations/v3/store.go @@ -0,0 +1,121 @@ +package v3 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + v2types "github.com/evmos/ethermint/x/evm/migrations/v2/types" + "github.com/evmos/ethermint/x/evm/types" +) + +// 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, + paramstore types.Subspace, + storeKey storetypes.StoreKey, + cdc codec.BinaryCodec, +) error { + var legacyParams v2types.V2Params + paramstore.GetParamSetIfExists(ctx, &legacyParams) + + // ------------------------------------------------------------------------- + // Upstream v2 to v3 + // New GrayGlacierBlock and MergeNetsplitBlock in ChainConfig parameter. + // Any new fields are disabled / nil. These should be nil if we leave them + // out because of the default value, but set explicitly here to nil. + + 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, + } + + // ------------------------------------------------------------------------- + // Upstream v3 to v4 + // Moves from deprecated Cosmos SDK params module to x/evm module state. + + // Params in store is currently empty + store := ctx.KVStore(storeKey) + + newParams := types.Params{ + EvmDenom: legacyParams.EvmDenom, + EnableCreate: legacyParams.EnableCreate, + EnableCall: legacyParams.EnableCall, + ExtraEIPs: legacyParams.ExtraEIPs, + ChainConfig: newChainConfig, + EIP712AllowedMsgs: MigrateEIP712AllowedMsgs(legacyParams.EIP712AllowedMsgs), + AllowUnprotectedTxs: false, // Upstream v1 to v2 + } + + if err := newParams.Validate(); err != nil { + return err + } + + bz := cdc.MustMarshal(&newParams) + store.Set(types.KeyPrefixParams, bz) + + 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 new file mode 100644 index 0000000000..58bc91ca7a --- /dev/null +++ b/x/evm/migrations/v3/store_test.go @@ -0,0 +1,184 @@ +package v3_test + +import ( + "encoding/json" + "testing" + + "github.com/evmos/ethermint/x/evm/types" + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/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" +) + +func TestMigrate(t *testing.T) { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec + + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + ctx := testutil.DefaultContext(storeKey, tKey) + kvStore := ctx.KVStore(storeKey) + + paramstore := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + storeKey, + tKey, + "evm", + ).WithKeyTable(v2types.ParamKeyTable()) + + initialParams := v2types.DefaultParams() + paramstore.SetParamSet(ctx, &initialParams) + + err := v3.MigrateStore( + ctx, + paramstore, + storeKey, + cdc, + ) + require.NoError(t, err) + + // Get all the new parameters from the kvStore + paramsBz := kvStore.Get(types.KeyPrefixParams) + 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) +} + +func TestMigrate_Mainnet(t *testing.T) { + encCfg := encoding.MakeConfig(app.ModuleBasics) + cdc := encCfg.Codec + + storeKey := sdk.NewKVStoreKey(types.ModuleName) + tKey := sdk.NewTransientStoreKey(types.TransientKey) + ctx := testutil.DefaultContext(storeKey, tKey) + kvStore := ctx.KVStore(storeKey) + + initialChainConfig := v2types.DefaultChainConfig() + initialChainConfig.LondonBlock = nil + initialChainConfig.ArrowGlacierBlock = nil + initialChainConfig.MergeForkBlock = nil + + initialParams := v2types.V2Params{ + 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"}, + }, + }, + }, + } + + paramstore := paramtypes.NewSubspace( + cdc, + encCfg.Amino, + storeKey, + tKey, + "evm", + ).WithKeyTable(v2types.ParamKeyTable()) + + paramstore.SetParamSet(ctx, &initialParams) + + err := v3.MigrateStore( + ctx, + paramstore, + storeKey, + cdc, + ) + require.NoError(t, err) + + // Get all the new parameters from the kvStore + paramsBz := kvStore.Get(types.KeyPrefixParams) + 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) + + expectedEIP712AllowedMsgsJson, err := json.Marshal(initialParams.EIP712AllowedMsgs) + require.NoError(t, err) + + migratedEIP712AllowedMsgsJson, err := json.Marshal(migratedParams.EIP712AllowedMsgs) + require.NoError(t, err) + + // Convert to JSON since they are different types but of same field and values + require.JSONEq(t, string(expectedEIP712AllowedMsgsJson), string(migratedEIP712AllowedMsgsJson)) + + expectedChainConfig := types.DefaultChainConfig() + // Previously nil ChainConfig options are still nil + expectedChainConfig.LondonBlock = nil + expectedChainConfig.ArrowGlacierBlock = nil + expectedChainConfig.MergeNetsplitBlock = nil + + // New ChainConfig options are set to nil + expectedChainConfig.GrayGlacierBlock = nil + expectedChainConfig.ShanghaiBlock = nil + expectedChainConfig.CancunBlock = nil + + require.EqualValues(t, expectedChainConfig, migratedParams.ChainConfig) +} diff --git a/x/evm/migrations/v4/migrate.go b/x/evm/migrations/v4/migrate.go deleted file mode 100644 index 91e49baab3..0000000000 --- a/x/evm/migrations/v4/migrate.go +++ /dev/null @@ -1,51 +0,0 @@ -package v4 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types" - "github.com/evmos/ethermint/x/evm/types" -) - -// MigrateStore migrates the x/evm module state from the consensus version 3 to -// version 4. Specifically, it takes the parameters that are currently stored -// and managed by the Cosmos SDK params module and stores them directly into the x/evm module state. -func MigrateStore( - ctx sdk.Context, - storeKey storetypes.StoreKey, - legacySubspace types.Subspace, - cdc codec.BinaryCodec, -) error { - var params types.Params - - legacySubspace.GetParamSetIfExists(ctx, ¶ms) - - if err := params.Validate(); err != nil { - return err - } - - chainCfgBz := cdc.MustMarshal(¶ms.ChainConfig) - extraEIPsBz := cdc.MustMarshal(&v4types.ExtraEIPs{EIPs: params.ExtraEIPs}) - - store := ctx.KVStore(storeKey) - - store.Set(types.ParamStoreKeyEVMDenom, []byte(params.EvmDenom)) - store.Set(types.ParamStoreKeyExtraEIPs, extraEIPsBz) - store.Set(types.ParamStoreKeyChainConfig, chainCfgBz) - - if params.AllowUnprotectedTxs { - store.Set(types.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01}) - } - - if params.EnableCall { - store.Set(types.ParamStoreKeyEnableCall, []byte{0x01}) - } - - if params.EnableCreate { - store.Set(types.ParamStoreKeyEnableCreate, []byte{0x01}) - } - - return nil -} diff --git a/x/evm/migrations/v4/migrate_test.go b/x/evm/migrations/v4/migrate_test.go deleted file mode 100644 index 09a95ca488..0000000000 --- a/x/evm/migrations/v4/migrate_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package v4_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/evmos/ethermint/x/evm/types" - - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/evmos/ethermint/app" - "github.com/evmos/ethermint/encoding" - v4 "github.com/evmos/ethermint/x/evm/migrations/v4" - v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types" -) - -type mockSubspace struct { - ps types.Params -} - -func newMockSubspace(ps types.Params) mockSubspace { - return mockSubspace{ps: ps} -} - -func (ms mockSubspace) GetParamSetIfExists(ctx sdk.Context, ps types.LegacyParams) { - *ps.(*types.Params) = ms.ps -} - -func TestMigrate(t *testing.T) { - encCfg := encoding.MakeConfig(app.ModuleBasics) - cdc := encCfg.Codec - - storeKey := sdk.NewKVStoreKey(types.ModuleName) - tKey := sdk.NewTransientStoreKey(types.TransientKey) - ctx := testutil.DefaultContext(storeKey, tKey) - kvStore := ctx.KVStore(storeKey) - - legacySubspace := newMockSubspace(types.DefaultParams()) - require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc)) - - // Get all the new parameters from the kvStore - var evmDenom string - bz := kvStore.Get(types.ParamStoreKeyEVMDenom) - evmDenom = string(bz) - - allowUnprotectedTx := kvStore.Has(types.ParamStoreKeyAllowUnprotectedTxs) - enableCreate := kvStore.Has(types.ParamStoreKeyEnableCreate) - enableCall := kvStore.Has(types.ParamStoreKeyEnableCall) - - var chainCfg v4types.V4ChainConfig - bz = kvStore.Get(types.ParamStoreKeyChainConfig) - cdc.MustUnmarshal(bz, &chainCfg) - - var extraEIPs v4types.ExtraEIPs - bz = kvStore.Get(types.ParamStoreKeyExtraEIPs) - cdc.MustUnmarshal(bz, &extraEIPs) - require.Equal(t, []int64(nil), extraEIPs.EIPs) - - params := v4types.V4Params{ - EvmDenom: evmDenom, - AllowUnprotectedTxs: allowUnprotectedTx, - EnableCreate: enableCreate, - EnableCall: enableCall, - V4ChainConfig: chainCfg, - ExtraEIPs: extraEIPs, - } - - require.Equal(t, legacySubspace.ps.EnableCall, params.EnableCall) - require.Equal(t, legacySubspace.ps.EnableCreate, params.EnableCreate) - require.Equal(t, legacySubspace.ps.AllowUnprotectedTxs, params.AllowUnprotectedTxs) - require.Equal(t, legacySubspace.ps.ExtraEIPs, params.ExtraEIPs.EIPs) - require.EqualValues(t, legacySubspace.ps.ChainConfig, params.V4ChainConfig) -} diff --git a/x/evm/migrations/v5/migrate.go b/x/evm/migrations/v5/migrate.go deleted file mode 100644 index e6f85a0152..0000000000 --- a/x/evm/migrations/v5/migrate.go +++ /dev/null @@ -1,64 +0,0 @@ -package v5 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/evmos/ethermint/x/evm/types" - - v5types "github.com/evmos/ethermint/x/evm/migrations/v5/types" -) - -// MigrateStore migrates the x/evm module state from the consensus version 4 to -// version 5. Specifically, it takes the parameters that are currently stored -// in separate keys and stores them directly into the x/evm module state using -// a single params key. -func MigrateStore( - ctx sdk.Context, - storeKey storetypes.StoreKey, - cdc codec.BinaryCodec, -) error { - var ( - extraEIPs v5types.V5ExtraEIPs - chainConfig types.ChainConfig - params types.Params - ) - - store := ctx.KVStore(storeKey) - - denom := string(store.Get(types.ParamStoreKeyEVMDenom)) - - extraEIPsBz := store.Get(types.ParamStoreKeyExtraEIPs) - cdc.MustUnmarshal(extraEIPsBz, &extraEIPs) - - // revert ExtraEIP change for Evmos testnet - if ctx.ChainID() == "evmos_9000-4" { - extraEIPs.EIPs = []int64{} - } - - chainCfgBz := store.Get(types.ParamStoreKeyChainConfig) - cdc.MustUnmarshal(chainCfgBz, &chainConfig) - - params.EvmDenom = denom - params.ExtraEIPs = extraEIPs.EIPs - params.ChainConfig = chainConfig - params.EnableCreate = store.Has(types.ParamStoreKeyEnableCreate) - params.EnableCall = store.Has(types.ParamStoreKeyEnableCall) - params.AllowUnprotectedTxs = store.Has(types.ParamStoreKeyAllowUnprotectedTxs) - - store.Delete(types.ParamStoreKeyChainConfig) - store.Delete(types.ParamStoreKeyExtraEIPs) - store.Delete(types.ParamStoreKeyEVMDenom) - store.Delete(types.ParamStoreKeyEnableCreate) - store.Delete(types.ParamStoreKeyEnableCall) - store.Delete(types.ParamStoreKeyAllowUnprotectedTxs) - - if err := params.Validate(); err != nil { - return err - } - - bz := cdc.MustMarshal(¶ms) - - store.Set(types.KeyPrefixParams, bz) - return nil -} diff --git a/x/evm/migrations/v5/migrate_test.go b/x/evm/migrations/v5/migrate_test.go deleted file mode 100644 index eba9599f81..0000000000 --- a/x/evm/migrations/v5/migrate_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package v5_test - -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/evmos/ethermint/app" - "github.com/evmos/ethermint/encoding" - v5 "github.com/evmos/ethermint/x/evm/migrations/v5" - v5types "github.com/evmos/ethermint/x/evm/migrations/v5/types" - "github.com/evmos/ethermint/x/evm/types" -) - -func TestMigrate(t *testing.T) { - encCfg := encoding.MakeConfig(app.ModuleBasics) - cdc := encCfg.Codec - - storeKey := sdk.NewKVStoreKey(types.ModuleName) - tKey := sdk.NewTransientStoreKey("transient_test") - ctx := testutil.DefaultContext(storeKey, tKey) - kvStore := ctx.KVStore(storeKey) - - extraEIPs := v5types.V5ExtraEIPs{EIPs: types.AvailableExtraEIPs} - extraEIPsBz := cdc.MustMarshal(&extraEIPs) - chainConfig := types.DefaultChainConfig() - chainConfigBz := cdc.MustMarshal(&chainConfig) - - // Set the params in the store - kvStore.Set(types.ParamStoreKeyEVMDenom, []byte("aphoton")) - kvStore.Set(types.ParamStoreKeyEnableCreate, []byte{0x01}) - kvStore.Set(types.ParamStoreKeyEnableCall, []byte{0x01}) - kvStore.Set(types.ParamStoreKeyAllowUnprotectedTxs, []byte{0x01}) - kvStore.Set(types.ParamStoreKeyExtraEIPs, extraEIPsBz) - kvStore.Set(types.ParamStoreKeyChainConfig, chainConfigBz) - - err := v5.MigrateStore(ctx, storeKey, cdc) - require.NoError(t, err) - - paramsBz := kvStore.Get(types.KeyPrefixParams) - var params types.Params - cdc.MustUnmarshal(paramsBz, ¶ms) - - // test that the params have been migrated correctly - require.Equal(t, "aphoton", params.EvmDenom) - require.True(t, params.EnableCreate) - require.True(t, params.EnableCall) - require.True(t, params.AllowUnprotectedTxs) - require.Equal(t, chainConfig, params.ChainConfig) - require.Equal(t, extraEIPs.EIPs, params.ExtraEIPs) - - // check that the keys are deleted - require.False(t, kvStore.Has(types.ParamStoreKeyEVMDenom)) - require.False(t, kvStore.Has(types.ParamStoreKeyEnableCreate)) - require.False(t, kvStore.Has(types.ParamStoreKeyEnableCall)) - require.False(t, kvStore.Has(types.ParamStoreKeyAllowUnprotectedTxs)) - require.False(t, kvStore.Has(types.ParamStoreKeyExtraEIPs)) - require.False(t, kvStore.Has(types.ParamStoreKeyChainConfig)) -} diff --git a/x/evm/migrations/v5/types/evm.pb.go b/x/evm/migrations/v5/types/evm.pb.go deleted file mode 100644 index 4d2b8e0960..0000000000 --- a/x/evm/migrations/v5/types/evm.pb.go +++ /dev/null @@ -1,479 +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/gogoproto/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 - - -// V5ExtraEIPs represents extra EIPs for the vm.Config -type V5ExtraEIPs struct { - // eips defines the additional EIPs for the vm.Config - EIPs []int64 `protobuf:"varint,1,rep,packed,name=eips,proto3" json:"eips,omitempty" yaml:"eips"` -} - -func (m *V5ExtraEIPs) Reset() { *m = V5ExtraEIPs{} } -func (m *V5ExtraEIPs) String() string { return proto.CompactTextString(m) } -func (*V5ExtraEIPs) ProtoMessage() {} -func (*V5ExtraEIPs) Descriptor() ([]byte, []int) { - return fileDescriptor_d21ecc92c8c8583e, []int{1} -} -func (m *V5ExtraEIPs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *V5ExtraEIPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_V5ExtraEIPs.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 *V5ExtraEIPs) XXX_Merge(src proto.Message) { - xxx_messageInfo_V5ExtraEIPs.Merge(m, src) -} -func (m *V5ExtraEIPs) XXX_Size() int { - return m.Size() -} -func (m *V5ExtraEIPs) XXX_DiscardUnknown() { - xxx_messageInfo_V5ExtraEIPs.DiscardUnknown(m) -} - -var xxx_messageInfo_V5ExtraEIPs proto.InternalMessageInfo - -func (m *V5ExtraEIPs) GetEIPs() []int64 { - if m != nil { - return m.EIPs - } - return nil -} - - - - -func init() { - proto.RegisterType((*V5ExtraEIPs)(nil), "ethermint.evm.v1.V5ExtraEIPs") -} - -func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) } - -var fileDescriptor_d21ecc92c8c8583e = []byte{ - // 1644 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x4f, 0x6f, 0xe3, 0xc6, - 0x15, 0xb7, 0x2d, 0xda, 0xa6, 0x46, 0xb2, 0x44, 0x8f, 0xb5, 0x5e, 0x65, 0x17, 0x35, 0x5d, 0x1e, - 0x02, 0x17, 0x4d, 0xec, 0xd8, 0x81, 0xd1, 0x45, 0x82, 0x16, 0x5d, 0xed, 0x3a, 0x89, 0xdd, 0x6d, - 0x6a, 0x8c, 0x1d, 0x14, 0x28, 0x50, 0x10, 0x23, 0x72, 0x42, 0x31, 0x26, 0x39, 0xc2, 0xcc, 0x50, - 0x2b, 0xb5, 0xfd, 0x00, 0x05, 0x7a, 0xe9, 0x27, 0x28, 0x72, 0xee, 0x27, 0x09, 0x7a, 0xda, 0x63, - 0xd1, 0x03, 0x51, 0x78, 0x6f, 0x3e, 0xea, 0x13, 0x14, 0xf3, 0x47, 0xd4, 0x1f, 0x1b, 0x6d, 0xad, - 0x93, 0xe7, 0xf7, 0xde, 0x9b, 0xdf, 0x6f, 0xde, 0x9b, 0x37, 0x9e, 0xa1, 0xc0, 0x33, 0x22, 0x7a, - 0x84, 0xa5, 0x71, 0x26, 0x8e, 0xc8, 0x20, 0x3d, 0x1a, 0x1c, 0xcb, 0x3f, 0x87, 0x7d, 0x46, 0x05, - 0x85, 0x4e, 0xe9, 0x3b, 0x94, 0xc6, 0xc1, 0xf1, 0xb3, 0x56, 0x44, 0x23, 0xaa, 0x9c, 0x47, 0x72, - 0xa4, 0xe3, 0xbc, 0xbf, 0x57, 0xc0, 0xc6, 0x25, 0x66, 0x38, 0xe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x13, 0xd3, 0x4b, 0x53, 0xff, 0x16, 0x58, 0xef, 0x26, 0x94, - 0xa6, 0xaa, 0x13, 0xea, 0x48, 0x03, 0x88, 0x54, 0xd5, 0xd4, 0x2e, 0x57, 0xd4, 0x1b, 0xfd, 0xc7, - 0xf7, 0x77, 0x79, 0xa1, 0x55, 0x3a, 0xbb, 0xe6, 0x9d, 0xde, 0xd0, 0xda, 0x66, 0xbe, 0x27, 0x6b, - 0xab, 0x5a, 0xc9, 0x01, 0x15, 0x46, 0x84, 0xda, 0xb4, 0x3a, 0x92, 0x43, 0xf8, 0x0c, 0xd8, 0x8c, - 0x0c, 0x08, 0x13, 0x24, 0x54, 0x9b, 0x63, 0xa3, 0x12, 0xc3, 0x0f, 0x80, 0x1d, 0x61, 0xee, 0xe7, - 0x9c, 0x84, 0x7a, 0x27, 0xd0, 0x66, 0x84, 0xf9, 0x37, 0x9c, 0x84, 0x9f, 0x59, 0x7f, 0xfe, 0xde, - 0x5d, 0xf1, 0x30, 0xa8, 0xbd, 0x0c, 0x02, 0xc2, 0xf9, 0x75, 0xde, 0x4f, 0xc8, 0x7f, 0xe9, 0xb0, - 0x13, 0x50, 0xe7, 0x82, 0x32, 0x1c, 0x11, 0xff, 0x86, 0x8c, 0x4c, 0x9f, 0xe9, 0xae, 0x31, 0xf6, - 0x5f, 0x91, 0x11, 0x47, 0xb3, 0xc0, 0x48, 0x7c, 0x6f, 0x81, 0xda, 0x35, 0xc3, 0x01, 0x31, 0x2f, - 0x7c, 0xd9, 0xab, 0x12, 0x32, 0x23, 0x61, 0x90, 0xd4, 0x16, 0x71, 0x4a, 0x68, 0x2e, 0xcc, 0x79, - 0x9a, 0x40, 0x39, 0x83, 0x11, 0x32, 0x24, 0x81, 0x2a, 0xa3, 0x85, 0x0c, 0x82, 0xa7, 0x60, 0x2b, - 0x8c, 0xb9, 0xfa, 0x12, 0xe3, 0x02, 0x07, 0x37, 0x3a, 0xfd, 0x8e, 0x73, 0x57, 0xb8, 0x75, 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x7e, 0x6f, 0xe5, 0x77, 0xb3, 0xf7, 0x03, 0x19, 0xc8, 0xeb, 0x61, 0xfa, - 0xd3, 0xc2, 0x50, 0xfd, 0xb8, 0xa0, 0xee, 0x88, 0xee, 0x86, 0xfa, 0xd1, 0xe0, 0xd3, 0xff, 0x04, - 0x00, 0x00, 0xff, 0xff, 0x68, 0xce, 0x8e, 0x23, 0x7a, 0x10, 0x00, 0x00, -} - - -func (m *V5ExtraEIPs) 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 *V5ExtraEIPs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *V5ExtraEIPs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.EIPs) > 0 { - dAtA4 := make([]byte, len(m.EIPs)*10) - var j3 int - for _, num1 := range m.EIPs { - num := uint64(num1) - for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j3++ - } - dAtA4[j3] = uint8(num) - j3++ - } - i -= j3 - copy(dAtA[i:], dAtA4[:j3]) - i = encodeVarintEvm(dAtA, i, uint64(j3)) - 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 *V5ExtraEIPs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.EIPs) > 0 { - l = 0 - for _, e := range m.EIPs { - l += sovEvm(uint64(e)) - } - n += 1 + sovEvm(uint64(l)) + 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 *V5ExtraEIPs) 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: V5ExtraEIPs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: V5ExtraEIPs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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.EIPs = append(m.EIPs, 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.EIPs) == 0 { - m.EIPs = 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.EIPs = append(m.EIPs, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field EIPs", wireType) - } - 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/module.go b/x/evm/module.go index 06a0aebf03..389f036f07 100644 --- a/x/evm/module.go +++ b/x/evm/module.go @@ -44,6 +44,9 @@ var ( _ module.AppModuleBasic = AppModuleBasic{} ) +// ConsensusVersion defines the current module consensus version. +const ConsensusVersion = 3 + // AppModuleBasic defines the basic application module used by the evm module. type AppModuleBasic struct{} @@ -142,12 +145,11 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := keeper.NewMigrator(*am.keeper, am.legacySubspace) - err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4) - if err != nil { - panic(err) - } - if err := cfg.RegisterMigration(types.ModuleName, 4, m.Migrate4to5); err != nil { + // This migration is a Kava specific migration that also includes the + // upstream migrations from 3 to 5. + err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate2to3) + if err != nil { panic(err) } } diff --git a/x/evm/types/evm.pb.go b/x/evm/types/evm.pb.go index 9d1edb3ed5..3bb6b6fef3 100644 --- a/x/evm/types/evm.pb.go +++ b/x/evm/types/evm.pb.go @@ -37,9 +37,11 @@ type Params struct { 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 ChainConfig `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 []EIP712AllowedMsg `protobuf:"bytes,6,rep,name=eip712_allowed_msgs,json=eip712AllowedMsgs,proto3" json:"eip712_allowed_msgs"` // allow_unprotected_txs defines if replay-protected (i.e non EIP155 // signed) transactions can be executed on the state machine. - AllowUnprotectedTxs bool `protobuf:"varint,6,opt,name=allow_unprotected_txs,json=allowUnprotectedTxs,proto3" json:"allow_unprotected_txs,omitempty"` + AllowUnprotectedTxs bool `protobuf:"varint,7,opt,name=allow_unprotected_txs,json=allowUnprotectedTxs,proto3" json:"allow_unprotected_txs,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -110,6 +112,13 @@ func (m *Params) GetChainConfig() ChainConfig { return ChainConfig{} } +func (m *Params) GetEIP712AllowedMsgs() []EIP712AllowedMsg { + if m != nil { + return m.EIP712AllowedMsgs + } + return nil +} + func (m *Params) GetAllowUnprotectedTxs() bool { if m != nil { return m.AllowUnprotectedTxs @@ -675,6 +684,187 @@ func (m *TraceConfig) GetTracerJsonConfig() string { return "" } +// EIP712AllowedMsg stores an allowed legacy msg and its eip712 type. +type EIP712AllowedMsg 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 []EIP712MsgAttrType `protobuf:"bytes,3,rep,name=value_types,json=valueTypes,proto3" json:"value_types"` + // nested types of the msg value + NestedTypes []EIP712NestedMsgType `protobuf:"bytes,4,rep,name=nested_types,json=nestedTypes,proto3" json:"nested_types"` +} + +func (m *EIP712AllowedMsg) Reset() { *m = EIP712AllowedMsg{} } +func (m *EIP712AllowedMsg) String() string { return proto.CompactTextString(m) } +func (*EIP712AllowedMsg) ProtoMessage() {} +func (*EIP712AllowedMsg) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{8} +} +func (m *EIP712AllowedMsg) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EIP712AllowedMsg) 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 *EIP712AllowedMsg) XXX_Merge(src proto.Message) { + xxx_messageInfo_EIP712AllowedMsg.Merge(m, src) +} +func (m *EIP712AllowedMsg) XXX_Size() int { + return m.Size() +} +func (m *EIP712AllowedMsg) XXX_DiscardUnknown() { + xxx_messageInfo_EIP712AllowedMsg.DiscardUnknown(m) +} + +var xxx_messageInfo_EIP712AllowedMsg proto.InternalMessageInfo + +func (m *EIP712AllowedMsg) GetMsgTypeUrl() string { + if m != nil { + return m.MsgTypeUrl + } + return "" +} + +func (m *EIP712AllowedMsg) GetMsgValueTypeName() string { + if m != nil { + return m.MsgValueTypeName + } + return "" +} + +func (m *EIP712AllowedMsg) GetValueTypes() []EIP712MsgAttrType { + if m != nil { + return m.ValueTypes + } + return nil +} + +func (m *EIP712AllowedMsg) GetNestedTypes() []EIP712NestedMsgType { + if m != nil { + return m.NestedTypes + } + return nil +} + +// EIP712MsgType is the eip712 type of a single message. +type EIP712NestedMsgType 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 []EIP712MsgAttrType `protobuf:"bytes,2,rep,name=attrs,proto3" json:"attrs"` +} + +func (m *EIP712NestedMsgType) Reset() { *m = EIP712NestedMsgType{} } +func (m *EIP712NestedMsgType) String() string { return proto.CompactTextString(m) } +func (*EIP712NestedMsgType) ProtoMessage() {} +func (*EIP712NestedMsgType) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{9} +} +func (m *EIP712NestedMsgType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EIP712NestedMsgType) 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 *EIP712NestedMsgType) XXX_Merge(src proto.Message) { + xxx_messageInfo_EIP712NestedMsgType.Merge(m, src) +} +func (m *EIP712NestedMsgType) XXX_Size() int { + return m.Size() +} +func (m *EIP712NestedMsgType) XXX_DiscardUnknown() { + xxx_messageInfo_EIP712NestedMsgType.DiscardUnknown(m) +} + +var xxx_messageInfo_EIP712NestedMsgType proto.InternalMessageInfo + +func (m *EIP712NestedMsgType) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *EIP712NestedMsgType) GetAttrs() []EIP712MsgAttrType { + if m != nil { + return m.Attrs + } + return nil +} + +// EIP712MsgAttrType is the eip712 type of a single message attribute. +type EIP712MsgAttrType 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 *EIP712MsgAttrType) Reset() { *m = EIP712MsgAttrType{} } +func (m *EIP712MsgAttrType) String() string { return proto.CompactTextString(m) } +func (*EIP712MsgAttrType) ProtoMessage() {} +func (*EIP712MsgAttrType) Descriptor() ([]byte, []int) { + return fileDescriptor_d21ecc92c8c8583e, []int{10} +} +func (m *EIP712MsgAttrType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EIP712MsgAttrType) 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 *EIP712MsgAttrType) XXX_Merge(src proto.Message) { + xxx_messageInfo_EIP712MsgAttrType.Merge(m, src) +} +func (m *EIP712MsgAttrType) XXX_Size() int { + return m.Size() +} +func (m *EIP712MsgAttrType) XXX_DiscardUnknown() { + xxx_messageInfo_EIP712MsgAttrType.DiscardUnknown(m) +} + +var xxx_messageInfo_EIP712MsgAttrType proto.InternalMessageInfo + +func (m *EIP712MsgAttrType) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *EIP712MsgAttrType) GetType() string { + if m != nil { + return m.Type + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "ethermint.evm.v1.Params") proto.RegisterType((*ChainConfig)(nil), "ethermint.evm.v1.ChainConfig") @@ -684,113 +874,129 @@ func init() { proto.RegisterType((*TxResult)(nil), "ethermint.evm.v1.TxResult") proto.RegisterType((*AccessTuple)(nil), "ethermint.evm.v1.AccessTuple") proto.RegisterType((*TraceConfig)(nil), "ethermint.evm.v1.TraceConfig") + proto.RegisterType((*EIP712AllowedMsg)(nil), "ethermint.evm.v1.EIP712AllowedMsg") + proto.RegisterType((*EIP712NestedMsgType)(nil), "ethermint.evm.v1.EIP712NestedMsgType") + proto.RegisterType((*EIP712MsgAttrType)(nil), "ethermint.evm.v1.EIP712MsgAttrType") } func init() { proto.RegisterFile("ethermint/evm/v1/evm.proto", fileDescriptor_d21ecc92c8c8583e) } var fileDescriptor_d21ecc92c8c8583e = []byte{ - // 1608 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xdd, 0x6e, 0xe3, 0xc6, - 0x15, 0xb6, 0x2d, 0xda, 0xa6, 0x46, 0xb2, 0x44, 0x8f, 0xb5, 0x8e, 0xb2, 0x8b, 0x9a, 0x2e, 0x2f, - 0x0a, 0x17, 0x48, 0xec, 0xd8, 0x81, 0xd1, 0x45, 0x82, 0x16, 0xb5, 0x76, 0x9d, 0xc4, 0xee, 0x36, - 0x35, 0xc6, 0x0e, 0x0a, 0x14, 0x28, 0x88, 0x11, 0x39, 0xa1, 0x18, 0x93, 0x1c, 0x61, 0x66, 0xa8, - 0x95, 0xda, 0x3e, 0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0xe1, 0xda, 0x09, 0x8d, 0x34, 0xa7, 0x76, 0xc9, 0x54, 0x31, 0x92, 0xd2, 0x01, 0x09, 0xd5, 0xeb, - 0x66, 0xa3, 0x09, 0xf4, 0xfe, 0xba, 0x06, 0xec, 0x9b, 0x21, 0x22, 0x3c, 0x4f, 0x04, 0xfc, 0x02, - 0x38, 0x01, 0xcd, 0x04, 0xc3, 0x81, 0xf0, 0xe7, 0x52, 0xdb, 0x79, 0x31, 0x7d, 0x69, 0x16, 0x23, - 0x3c, 0xd4, 0x9c, 0x98, 0xce, 0x4c, 0xfe, 0x5b, 0x60, 0xbd, 0x9b, 0x50, 0x9a, 0xaa, 0x4a, 0xa8, - 0x23, 0x0d, 0x20, 0x52, 0x59, 0x53, 0xa7, 0x5c, 0x51, 0x9d, 0xf6, 0x8f, 0x1f, 0x9e, 0xf2, 0x42, - 0xa9, 0x74, 0x76, 0x4d, 0xb7, 0xdd, 0xd0, 0xda, 0x66, 0xbe, 0x27, 0x73, 0xab, 0x4a, 0xc9, 0x01, - 0x15, 0x46, 0x84, 0x3a, 0xb4, 0x3a, 0x92, 0x43, 0xf8, 0x1c, 0xd8, 0x8c, 0x0c, 0x08, 0x13, 0x24, - 0x54, 0x87, 0x63, 0xa3, 0x12, 0xc3, 0x0f, 0x81, 0x1d, 0x61, 0xee, 0xe7, 0x9c, 0x84, 0xfa, 0x24, - 0xd0, 0x66, 0x84, 0xf9, 0x37, 0x9c, 0x84, 0x9f, 0x59, 0x7f, 0xfe, 0xde, 0x5d, 0xf1, 0x30, 0xa8, - 0x9d, 0x05, 0x01, 0xe1, 0xfc, 0x26, 0xef, 0x27, 0xe4, 0xbf, 0x54, 0xd8, 0x09, 0xa8, 0x73, 0x41, - 0x19, 0x8e, 0x88, 0x7f, 0x4b, 0x46, 0xa6, 0xce, 0x74, 0xd5, 0x18, 0xfb, 0xaf, 0xc8, 0x88, 0xa3, - 0x59, 0x60, 0x24, 0xbe, 0xb7, 0x40, 0xed, 0x86, 0x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 0x74, 0xc9, - 0xa9, 0xd9, 0xc5, 0xa5, 0x65, 0x5b, 0xce, 0xfa, 0xa5, 0x65, 0x6f, 0x3a, 0x76, 0x99, 0x3f, 0xb3, - 0x0b, 0xb4, 0x33, 0xc1, 0x33, 0xcb, 0xeb, 0xfc, 0xf2, 0x87, 0xbb, 0xbd, 0xd5, 0x77, 0x77, 0x7b, - 0xab, 0xff, 0xbe, 0xdb, 0x5b, 0xfd, 0xdb, 0xfb, 0xbd, 0x95, 0x77, 0xef, 0xf7, 0x56, 0xfe, 0xf9, - 0x7e, 0x6f, 0xe5, 0x77, 0xb3, 0xef, 0x03, 0x19, 0xc8, 0xe7, 0x61, 0xfa, 0xfd, 0x3f, 0x54, 0xff, - 0x01, 0x50, 0x6f, 0x44, 0x77, 0x43, 0x7d, 0xd9, 0x7f, 0xfa, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xe2, 0xe1, 0x18, 0x7a, 0x1f, 0x10, 0x00, 0x00, + // 1810 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x4d, 0x6f, 0x1b, 0xb9, + 0x19, 0x8e, 0xad, 0xb1, 0x3d, 0xa2, 0x64, 0x69, 0x4c, 0x29, 0x5e, 0x25, 0x41, 0x3d, 0xee, 0x14, + 0x2d, 0x5c, 0x60, 0x63, 0xaf, 0xbd, 0x30, 0x12, 0x6c, 0xd0, 0x0f, 0xcb, 0xf1, 0xee, 0xda, 0x4d, + 0x5c, 0x83, 0x71, 0x5a, 0xa0, 0x40, 0x31, 0xa0, 0x66, 0xb8, 0xa3, 0x89, 0x67, 0x86, 0x02, 0xc9, + 0x51, 0xa4, 0xb6, 0x3f, 0xa0, 0x40, 0x2f, 0xfd, 0x05, 0xc5, 0xfe, 0x9c, 0x45, 0x4f, 0x7b, 0x2c, + 0x7a, 0x18, 0x14, 0xce, 0xcd, 0x47, 0x9f, 0x7a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0x5d, 0xbd, + 0x2a, 0xdc, 0xb2, 0xd2, 0x2a, 0xec, 0xc9, 0x10, 0x7a, 0x60, 0x49, 0x63, 0xdb, 0x0a, 0xbb, 0x7a, + 0x55, 0xb8, 0x76, 0x42, 0x23, 0x8d, 0xa9, 0x4d, 0xb2, 0x54, 0x8c, 0xa4, 0xb4, 0x4f, 0x42, 0x75, + 0xba, 0xd9, 0x68, 0x24, 0x7a, 0x7f, 0x59, 0x04, 0xf6, 0xf9, 0x00, 0x11, 0x9e, 0x27, 0x02, 0x7e, + 0x0e, 0x9c, 0x80, 0x66, 0x82, 0xe1, 0x40, 0xf8, 0x33, 0xa5, 0x6d, 0x3f, 0x99, 0x9c, 0x34, 0xf3, + 0x1e, 0x1e, 0xaa, 0x8f, 0x54, 0x07, 0xa6, 0xfe, 0x4d, 0xb0, 0xd4, 0x49, 0x28, 0x4d, 0x55, 0x27, + 0x54, 0x91, 0x16, 0x20, 0x52, 0x55, 0x53, 0xab, 0x5c, 0x52, 0x17, 0xfb, 0x1f, 0xde, 0x5c, 0xe5, + 0xb9, 0x56, 0x69, 0xaf, 0x9b, 0xcb, 0x7d, 0x4d, 0x73, 0x9b, 0x78, 0x4f, 0xd6, 0x56, 0xb5, 0x92, + 0x03, 0x4a, 0x8c, 0x08, 0xb5, 0x68, 0x55, 0x24, 0x87, 0xf0, 0x31, 0xb0, 0x19, 0xe9, 0x13, 0x26, + 0x48, 0xa8, 0x16, 0xc7, 0x46, 0x63, 0x19, 0x3e, 0x02, 0x76, 0x84, 0xb9, 0x9f, 0x73, 0x12, 0xea, + 0x95, 0x40, 0x2b, 0x11, 0xe6, 0x6f, 0x39, 0x09, 0x3f, 0xb3, 0xfe, 0xfc, 0xb5, 0xfb, 0xc0, 0xc3, + 0xa0, 0x72, 0x10, 0x04, 0x84, 0xf3, 0xf3, 0xbc, 0x97, 0x90, 0xff, 0xd1, 0x61, 0x7b, 0xa0, 0xca, + 0x05, 0x65, 0x38, 0x22, 0xfe, 0x05, 0x19, 0x9a, 0x3e, 0xd3, 0x5d, 0x63, 0xf4, 0xbf, 0x22, 0x43, + 0x8e, 0xa6, 0x05, 0x43, 0xf1, 0xb5, 0x05, 0x2a, 0xe7, 0x0c, 0x07, 0xc4, 0xdc, 0xf0, 0x65, 0xaf, + 0x4a, 0x91, 0x19, 0x0a, 0x23, 0x49, 0x6e, 0x11, 0xa7, 0x84, 0xe6, 0xc2, 0xec, 0xa7, 0x91, 0x28, + 0x23, 0x18, 0x21, 0x03, 0x12, 0xa8, 0x32, 0x5a, 0xc8, 0x48, 0x70, 0x1f, 0xac, 0x86, 0x31, 0x57, + 0xaf, 0x33, 0x2e, 0x70, 0x70, 0xa1, 0xd3, 0x6f, 0x3b, 0x57, 0x85, 0x5b, 0x35, 0x86, 0x37, 0x52, + 0x8f, 0x66, 0x24, 0xf8, 0x02, 0xd4, 0x27, 0x61, 0x6a, 0xb6, 0xaa, 0x36, 0x76, 0x1b, 0x5e, 0x15, + 0x6e, 0x6d, 0xec, 0xaa, 0x2c, 0x68, 0x4e, 0x96, 0x2b, 0x1d, 0x92, 0x4e, 0x1e, 0xa9, 0xe6, 0xb3, + 0x91, 0x16, 0xa4, 0x36, 0x89, 0xd3, 0x58, 0xa8, 0x66, 0x5b, 0x42, 0x5a, 0x80, 0x2f, 0x40, 0x99, + 0xf6, 0x09, 0x63, 0x71, 0x48, 0xb8, 0xba, 0xea, 0xfc, 0xbf, 0xa7, 0x1d, 0x9a, 0xf8, 0xcb, 0xe4, + 0xcc, 0xcb, 0x33, 0x25, 0x29, 0x65, 0x43, 0x75, 0x77, 0x31, 0xc9, 0x69, 0xc3, 0x6b, 0xa5, 0x47, + 0x33, 0x12, 0x6c, 0x03, 0x68, 0xc2, 0x18, 0x11, 0x39, 0xcb, 0x7c, 0xb5, 0xff, 0xab, 0x2a, 0x56, + 0xed, 0x42, 0x6d, 0x45, 0xca, 0xf8, 0x12, 0x0b, 0x8c, 0x6e, 0x68, 0xe0, 0xcf, 0x01, 0x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58, 0xbb, 0xe1, 0x71, 0x2b, 0x13, 0x04, 0x96, 0xcc, 0xce, 0x14, 0x54, 0x8d, + 0xdb, 0xbf, 0xfc, 0xe6, 0x72, 0x63, 0xe1, 0xdb, 0xcb, 0x8d, 0x85, 0x7f, 0x5d, 0x6e, 0x2c, 0xfc, + 0xf5, 0xc3, 0xc6, 0x83, 0x6f, 0x3f, 0x6c, 0x3c, 0xf8, 0xc7, 0x87, 0x8d, 0x07, 0xbf, 0x9b, 0x3e, + 0xca, 0x49, 0x5f, 0x9e, 0xe4, 0x93, 0x7f, 0x86, 0x06, 0xea, 0xbf, 0x21, 0x55, 0xaa, 0xce, 0xb2, + 0xfa, 0xcf, 0xe7, 0xd3, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x24, 0x36, 0xc6, 0x32, 0x39, 0x12, + 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -821,7 +1027,21 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x30 + dAtA[i] = 0x38 + } + 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]) @@ -1528,6 +1748,152 @@ func (m *TraceConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EIP712AllowedMsg) 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 *EIP712AllowedMsg) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EIP712AllowedMsg) 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 *EIP712NestedMsgType) 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 *EIP712NestedMsgType) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EIP712NestedMsgType) 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 *EIP712MsgAttrType) 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 *EIP712MsgAttrType) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EIP712MsgAttrType) 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 @@ -1564,6 +1930,12 @@ func (m *Params) Size() (n int) { } 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)) + } + } if m.AllowUnprotectedTxs { n += 2 } @@ -1827,14 +2199,79 @@ func (m *TraceConfig) Size() (n int) { 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 *EIP712AllowedMsg) 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 *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) + +func (m *EIP712NestedMsgType) 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 *EIP712MsgAttrType) 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 *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx @@ -2044,6 +2481,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { } 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, EIP712AllowedMsg{}) + if err := m.EIP712AllowedMsgs[len(m.EIP712AllowedMsgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AllowUnprotectedTxs", wireType) } @@ -3973,6 +4444,418 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } return nil } +func (m *EIP712AllowedMsg) 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, EIP712MsgAttrType{}) + 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, EIP712NestedMsgType{}) + 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 *EIP712NestedMsgType) 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, EIP712MsgAttrType{}) + 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 *EIP712MsgAttrType) 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 diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 1cfad664ae..2ab6ab2e99 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -45,7 +45,15 @@ var ( var AvailableExtraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529} // NewParams creates a new Params instance -func NewParams(evmDenom string, allowUnprotectedTxs, enableCreate, enableCall bool, config ChainConfig, extraEIPs []int64) Params { +func NewParams( + evmDenom string, + allowUnprotectedTxs, + enableCreate, + enableCall bool, + config ChainConfig, + extraEIPs []int64, + eip712AllowedMsgs []EIP712AllowedMsg, +) Params { return Params{ EvmDenom: evmDenom, AllowUnprotectedTxs: allowUnprotectedTxs, @@ -53,6 +61,7 @@ func NewParams(evmDenom string, allowUnprotectedTxs, enableCreate, enableCall bo EnableCall: enableCall, ExtraEIPs: extraEIPs, ChainConfig: config, + EIP712AllowedMsgs: eip712AllowedMsgs, } } @@ -66,6 +75,7 @@ func DefaultParams() Params { ChainConfig: DefaultChainConfig(), ExtraEIPs: nil, AllowUnprotectedTxs: DefaultAllowUnprotectedTxs, + EIP712AllowedMsgs: nil, } } @@ -91,7 +101,21 @@ func (p Params) Validate() error { return err } - return validateChainConfig(p.ChainConfig) + if err := validateChainConfig(p.ChainConfig); err != nil { + return err + } + + return validateEIP712AllowedMsgs(p.EIP712AllowedMsgs) +} + +// EIP712AllowedMsgFromMsgType returns the EIP712AllowedMsg for a given message type url. +func (p Params) EIP712AllowedMsgFromMsgType(msgTypeUrl string) *EIP712AllowedMsg { + for _, allowedMsg := range p.EIP712AllowedMsgs { + if allowedMsg.MsgTypeUrl == msgTypeUrl { + return &allowedMsg + } + } + return nil } // EIPs returns the ExtraEIPS as a int slice @@ -144,6 +168,24 @@ func validateChainConfig(i interface{}) error { return cfg.Validate() } +func validateEIP712AllowedMsgs(i interface{}) error { + allowedMsgs, ok := i.([]EIP712AllowedMsg) + if !ok { + return fmt.Errorf("invalid EIP712AllowedMsg slice type: %T", i) + } + + // ensure no duplicate msg type urls + msgTypes := make(map[string]bool) + for _, allowedMsg := range allowedMsgs { + if _, ok := msgTypes[allowedMsg.MsgTypeUrl]; ok { + return fmt.Errorf("duplicate eip712 allowed legacy msg type: %s", allowedMsg.MsgTypeUrl) + } + msgTypes[allowedMsg.MsgTypeUrl] = true + } + + 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/params_legacy.go b/x/evm/types/params_legacy.go index bea25b7a6a..e1ba842bc9 100644 --- a/x/evm/types/params_legacy.go +++ b/x/evm/types/params_legacy.go @@ -25,6 +25,7 @@ var ( ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs") ParamStoreKeyChainConfig = []byte("ChainConfig") ParamStoreKeyAllowUnprotectedTxs = []byte("AllowUnprotectedTxs") + ParamStoreKeyEIP712AllowedMsgs = []byte("EIP712AllowedMsgs") ) // Deprecated: ParamKeyTable returns the parameter key table. @@ -47,5 +48,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { 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/evm/types/params_test.go b/x/evm/types/params_test.go index 1b3fda4882..eefb1773ed 100644 --- a/x/evm/types/params_test.go +++ b/x/evm/types/params_test.go @@ -18,7 +18,7 @@ func TestParamsValidate(t *testing.T) { {"default", DefaultParams(), false}, { "valid", - NewParams("ara", false, true, true, DefaultChainConfig(), extraEips), + NewParams("ara", false, true, true, DefaultChainConfig(), extraEips, []EIP712AllowedMsg{}), false, }, { @@ -56,7 +56,7 @@ func TestParamsValidate(t *testing.T) { func TestParamsEIPs(t *testing.T) { extraEips := []int64{2929, 1884, 1344} - params := NewParams("ara", false, true, true, DefaultChainConfig(), extraEips) + params := NewParams("ara", false, true, true, DefaultChainConfig(), extraEips, []EIP712AllowedMsg{}) actual := params.EIPs() require.Equal(t, []int([]int{2929, 1884, 1344}), actual)