From e18d75f614877cbb5b35485ac8372911bc645e66 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Thu, 26 Oct 2023 15:57:50 +0800 Subject: [PATCH 01/11] Problem: state overrides are not supported in eth_call Closes: #368 Solution: - add the feature --- CHANGELOG.md | 1 + proto/ethermint/evm/v1/query.proto | 2 + rpc/backend/backend.go | 2 +- rpc/backend/call_tx.go | 10 ++ rpc/namespaces/ethereum/eth/api.go | 6 +- rpc/types/types.go | 37 ++++ x/evm/keeper/grpc_query.go | 40 +++-- x/evm/keeper/state_transition.go | 12 +- x/evm/keeper/state_transition_test.go | 2 +- x/evm/statedb/interfaces.go | 1 + x/evm/statedb/statedb.go | 20 ++- x/evm/types/query.pb.go | 233 ++++++++++++++++---------- 12 files changed, 256 insertions(+), 110 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1ea8761d..f7435fbab0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (ante) [#310](https://github.com/crypto-org-chain/ethermint/pull/310) Support blocking list of addresses in mempool. * (evm) [#328](https://github.com/crypto-org-chain/ethermint/pull/328) Support precompile interface. * (statedb) [#333](https://github.com/crypto-org-chain/ethermint/pull/333) Support native action in statedb, prepare for precompiles. +* (rpc) [#]() Support state overrides in eth_call. ### State Machine Breaking diff --git a/proto/ethermint/evm/v1/query.proto b/proto/ethermint/evm/v1/query.proto index 49feb723fc..34898b03b2 100644 --- a/proto/ethermint/evm/v1/query.proto +++ b/proto/ethermint/evm/v1/query.proto @@ -225,6 +225,8 @@ message EthCallRequest { bytes proposer_address = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"]; // chain_id is the eip155 chain id parsed from the requested block header int64 chain_id = 4; + // state overrides encoded as json + bytes overrides = 5; } // EstimateGasResponse defines EstimateGas response diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index 29b7925821..fbce475649 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -128,7 +128,7 @@ type EVMBackend interface { SendRawTransaction(data hexutil.Bytes) (common.Hash, error) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.TransactionArgs, error) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error) - DoCall(args evmtypes.TransactionArgs, blockNr rpctypes.BlockNumber) (*evmtypes.MsgEthereumTxResponse, error) + DoCall(args evmtypes.TransactionArgs, blockNr rpctypes.BlockNumber, overrides *rpctypes.StateOverride) (*evmtypes.MsgEthereumTxResponse, error) GasPrice() (*hexutil.Big, error) // Filter API diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 3b346cbeed..92f6b65940 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -360,6 +360,7 @@ func (b *Backend) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rp // estimated gas used on the operation or an error if fails. func (b *Backend) DoCall( args evmtypes.TransactionArgs, blockNr rpctypes.BlockNumber, + overrides *rpctypes.StateOverride, ) (*evmtypes.MsgEthereumTxResponse, error) { bz, err := json.Marshal(&args) if err != nil { @@ -371,11 +372,20 @@ func (b *Backend) DoCall( return nil, errors.New("header not found") } + var overridesJson []byte + if overrides != nil { + overridesJson, err = json.Marshal(overrides) + if err != nil { + return nil, err + } + } + req := evmtypes.EthCallRequest{ Args: bz, GasCap: b.RPCGasCap(), ProposerAddress: sdk.ConsAddress(header.Block.ProposerAddress), ChainId: b.chainID.Int64(), + Overrides: overridesJson, } // From ContextWithHeight: if the provided height is 0, diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 1f13f77549..d64566373c 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -84,7 +84,7 @@ type EthereumAPI interface { // // Allows developers to read data from the blockchain which includes executing // smart contracts. However, no data is published to the Ethereum network. - Call(args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, _ *rpctypes.StateOverride) (hexutil.Bytes, error) + Call(args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, overrides *rpctypes.StateOverride) (hexutil.Bytes, error) // Chain Information // @@ -280,7 +280,7 @@ func (e *PublicAPI) GetProof(address common.Address, // Call performs a raw contract call. func (e *PublicAPI) Call(args evmtypes.TransactionArgs, blockNrOrHash rpctypes.BlockNumberOrHash, - _ *rpctypes.StateOverride, + overrides *rpctypes.StateOverride, ) (hexutil.Bytes, error) { e.logger.Debug("eth_call", "args", args.String(), "block number or hash", blockNrOrHash) @@ -288,7 +288,7 @@ func (e *PublicAPI) Call(args evmtypes.TransactionArgs, if err != nil { return nil, err } - data, err := e.backend.DoCall(args, blockNum) + data, err := e.backend.DoCall(args, blockNum, overrides) if err != nil { return []byte{}, err } diff --git a/rpc/types/types.go b/rpc/types/types.go index dba665e061..6d69b4710a 100644 --- a/rpc/types/types.go +++ b/rpc/types/types.go @@ -16,11 +16,13 @@ package types import ( + "fmt" "math/big" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/ethermint/x/evm/statedb" ) // Copied the Account and StorageResult types since they are registered under an @@ -70,6 +72,41 @@ type RPCTransaction struct { // StateOverride is the collection of overridden accounts. type StateOverride map[common.Address]OverrideAccount +// Apply overrides the fields of specified accounts into the given state. +func (diff *StateOverride) Apply(db *statedb.StateDB) error { + if diff == nil { + return nil + } + for addr, account := range *diff { + // Override account nonce. + if account.Nonce != nil { + db.SetNonce(addr, uint64(*account.Nonce)) + } + // Override account(contract) code. + if account.Code != nil { + db.SetCode(addr, *account.Code) + } + // Override account balance. + if account.Balance != nil { + db.SetBalance(addr, (*big.Int)(*account.Balance)) + } + if account.State != nil && account.StateDiff != nil { + return fmt.Errorf("account %s has both 'state' and 'stateDiff'", addr.Hex()) + } + // Replace entire state if caller requires. + if account.State != nil { + db.SetStorage(addr, *account.State) + } + // Apply state diff into specified accounts. + if account.StateDiff != nil { + for key, value := range *account.StateDiff { + db.SetState(addr, key, value) + } + } + } + return nil +} + // OverrideAccount indicates the overriding fields of account during the execution of // a message call. // Note, state and stateDiff can't be specified at the same time. If state is diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index c25c874c19..0da3a40db3 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -39,6 +39,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" ethparams "github.com/ethereum/go-ethereum/params" + rpctypes "github.com/evmos/ethermint/rpc/types" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" @@ -231,6 +232,13 @@ func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.Ms return nil, status.Error(codes.InvalidArgument, "empty request") } + var overrides *rpctypes.StateOverride + if len(req.Overrides) > 0 { + if err := json.Unmarshal(req.Overrides, overrides); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + } + ctx := sdk.UnwrapSDKContext(c) var args types.TransactionArgs @@ -259,7 +267,7 @@ func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.Ms txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash())) // pass false to not commit StateDB - res, err := k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig) + res, err := k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig, overrides) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -354,7 +362,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type ) // pass false to not commit StateDB - rsp, err = k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig) + rsp, err = k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig, nil) if err != nil { if errors.Is(err, core.ErrIntrinsicGas) { return true, nil, nil // Special case, raise gas limit @@ -406,6 +414,13 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit) } + var overrides *rpctypes.StateOverride + if len(req.Overrides) > 0 { + if err := json.Unmarshal(req.Overrides, overrides); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + } + // get the context of block beginning contextHeight := req.BlockNumber if contextHeight < 1 { @@ -436,7 +451,7 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ } txConfig.TxHash = ethTx.Hash() txConfig.TxIndex = uint(i) - rsp, err := k.ApplyMessageWithConfig(ctx, msg, types.NewNoOpTracer(), true, cfg, txConfig) + rsp, err := k.ApplyMessageWithConfig(ctx, msg, types.NewNoOpTracer(), true, cfg, txConfig, nil) if err != nil { continue } @@ -455,7 +470,7 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ _ = json.Unmarshal([]byte(req.TraceConfig.TracerJsonConfig), &tracerConfig) } - result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false, tracerConfig) + result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false, tracerConfig, overrides) if err != nil { // error will be returned with detail status from traceTx return nil, err @@ -513,7 +528,7 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest) ethTx := tx.AsTransaction() txConfig.TxHash = ethTx.Hash() txConfig.TxIndex = uint(i) - traceResult, logIndex, err := k.traceTx(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true, nil) + traceResult, logIndex, err := k.traceTx(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true, nil, nil) if err != nil { result.Error = err.Error() } else { @@ -543,13 +558,14 @@ func (k *Keeper) traceTx( traceConfig *types.TraceConfig, commitMessage bool, tracerJSONConfig json.RawMessage, + overrides *rpctypes.StateOverride, ) (*interface{}, uint, error) { // Assemble the structured logger or the JavaScript tracer var ( - tracer tracers.Tracer - overrides *ethparams.ChainConfig - err error - timeout = defaultTraceTimeout + tracer tracers.Tracer + overrideCfg *ethparams.ChainConfig + err error + timeout = defaultTraceTimeout ) msg, err := tx.AsMessage(signer, cfg.BaseFee) if err != nil { @@ -561,7 +577,7 @@ func (k *Keeper) traceTx( } if traceConfig.Overrides != nil { - overrides = traceConfig.Overrides.EthereumConfig(cfg.ChainConfig.ChainID) + overrideCfg = traceConfig.Overrides.EthereumConfig(cfg.ChainConfig.ChainID) } logConfig := logger.Config{ @@ -571,7 +587,7 @@ func (k *Keeper) traceTx( EnableReturnData: traceConfig.EnableReturnData, Debug: traceConfig.Debug, Limit: int(traceConfig.Limit), - Overrides: overrides, + Overrides: overrideCfg, } tracer = logger.NewStructLogger(&logConfig) @@ -606,7 +622,7 @@ func (k *Keeper) traceTx( } }() - res, err := k.ApplyMessageWithConfig(ctx, msg, tracer, commitMessage, cfg, txConfig) + res, err := k.ApplyMessageWithConfig(ctx, msg, tracer, commitMessage, cfg, txConfig, overrides) if err != nil { return nil, 0, status.Error(codes.Internal, err.Error()) } diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 36d14ecf5a..9f179e976f 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -25,6 +25,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + rpctypes "github.com/evmos/ethermint/rpc/types" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" @@ -194,7 +195,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, msgEth *types.MsgEthereumTx) } // pass true to commit the StateDB - res, err := k.ApplyMessageWithConfig(tmpCtx, msg, nil, true, cfg, txConfig) + res, err := k.ApplyMessageWithConfig(tmpCtx, msg, nil, true, cfg, txConfig, nil) if err != nil { return nil, errorsmod.Wrap(err, "failed to apply ethereum core message") } @@ -286,7 +287,7 @@ func (k *Keeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLo } txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash())) - return k.ApplyMessageWithConfig(ctx, msg, tracer, commit, cfg, txConfig) + return k.ApplyMessageWithConfig(ctx, msg, tracer, commit, cfg, txConfig, nil) } // ApplyMessageWithConfig computes the new state by applying the given message against the existing state. @@ -333,6 +334,7 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, commit bool, cfg *statedb.EVMConfig, txConfig statedb.TxConfig, + overrides *rpctypes.StateOverride, ) (*types.MsgEthereumTxResponse, error) { var ( ret []byte // return bytes from evm execution @@ -347,6 +349,12 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, } stateDB := statedb.NewWithParams(ctx, k, txConfig, cfg.Params) + if overrides != nil { + if err := overrides.Apply(stateDB); err != nil { + return nil, errorsmod.Wrap(err, "failed to apply state override") + } + } + evm := k.NewEVM(ctx, msg, cfg, tracer, stateDB, k.customContracts) leftoverGas := msg.Gas() // Allow the tracer captures the tx level events, mainly the gas consumption. diff --git a/x/evm/keeper/state_transition_test.go b/x/evm/keeper/state_transition_test.go index cf5de6c247..6f9cd06d0a 100644 --- a/x/evm/keeper/state_transition_test.go +++ b/x/evm/keeper/state_transition_test.go @@ -648,7 +648,7 @@ func (suite *KeeperTestSuite) TestApplyMessageWithConfig() { txConfig = suite.app.EvmKeeper.TxConfig(suite.ctx, common.Hash{}) tc.malleate() - res, err := suite.app.EvmKeeper.ApplyMessageWithConfig(suite.ctx, msg, nil, true, config, txConfig) + res, err := suite.app.EvmKeeper.ApplyMessageWithConfig(suite.ctx, msg, nil, true, config, txConfig, nil) if tc.expErr { suite.Require().Error(err) diff --git a/x/evm/statedb/interfaces.go b/x/evm/statedb/interfaces.go index b27872c004..d6fa79b2cf 100644 --- a/x/evm/statedb/interfaces.go +++ b/x/evm/statedb/interfaces.go @@ -32,6 +32,7 @@ type Keeper interface { AddBalance(ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) error SubBalance(ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) error + SetBalance(ctx sdk.Context, addr common.Address, amount *big.Int) error GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) *big.Int // Read methods diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 054305a894..292b177d35 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -385,6 +385,14 @@ func (s *StateDB) SubBalance(addr common.Address, amount *big.Int) { } } +func (s *StateDB) SetBalance(addr common.Address, amount *big.Int) { + if err := s.ExecuteNativeAction(common.Address{}, nil, func(ctx sdk.Context) error { + return s.keeper.SetBalance(ctx, addr, amount) + }); err != nil { + s.err = err + } +} + // SetNonce sets the nonce of account. func (s *StateDB) SetNonce(addr common.Address, nonce uint64) { stateObject := s.getOrNewStateObject(addr) @@ -404,8 +412,16 @@ func (s *StateDB) SetCode(addr common.Address, code []byte) { // SetState sets the contract state. func (s *StateDB) SetState(addr common.Address, key, value common.Hash) { stateObject := s.getOrNewStateObject(addr) - if stateObject != nil { - stateObject.SetState(key, value) + stateObject.SetState(key, value) +} + +// SetStorage replaces the entire storage for the specified account with given +// storage. This function should only be used for debugging and the mutations +// must be discarded afterwards. +func (s *StateDB) SetStorage(addr common.Address, storage map[common.Hash]common.Hash) { + stateObject := s.getOrNewStateObject(addr) + for k, v := range storage { + stateObject.SetState(k, v) } } diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index 99a5e9c70a..38ea185bc8 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -796,6 +796,8 @@ type EthCallRequest struct { ProposerAddress github_com_cosmos_cosmos_sdk_types.ConsAddress `protobuf:"bytes,3,opt,name=proposer_address,json=proposerAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ConsAddress" json:"proposer_address,omitempty"` // chain_id is the eip155 chain id parsed from the requested block header ChainId int64 `protobuf:"varint,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // state overrides encoded as json + Overrides []byte `protobuf:"bytes,5,opt,name=overrides,proto3" json:"overrides,omitempty"` } func (m *EthCallRequest) Reset() { *m = EthCallRequest{} } @@ -859,6 +861,13 @@ func (m *EthCallRequest) GetChainId() int64 { return 0 } +func (m *EthCallRequest) GetOverrides() []byte { + if m != nil { + return m.Overrides + } + return nil +} + // EstimateGasResponse defines EstimateGas response type EstimateGasResponse struct { // gas returns the estimated gas @@ -1333,99 +1342,100 @@ func init() { func init() { proto.RegisterFile("ethermint/evm/v1/query.proto", fileDescriptor_e15a877459347994) } var fileDescriptor_e15a877459347994 = []byte{ - // 1461 bytes of a gzipped FileDescriptorProto + // 1476 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0xcb, 0x8f, 0x13, 0x47, 0x13, 0xdf, 0x59, 0x7b, 0xd7, 0xde, 0xb6, 0x01, 0x7f, 0xcd, 0xf2, 0x61, 0xe6, 0xdb, 0xb5, 0x97, 0x81, 0x7d, 0xb2, 0xcc, 0x7c, 0xeb, 0x44, 0x48, 0xe1, 0x12, 0xb0, 0xb5, 0x10, 0x02, 0x44, 0x64, 0xb2, 0xca, 0x21, 0x12, 0xb2, 0xda, 0xe3, 0x66, 0x6c, 0xad, 0x67, 0xda, 0x4c, 0xb7, 0x1d, 0x2f, - 0x84, 0x1c, 0x22, 0x05, 0x11, 0x21, 0x45, 0x48, 0xb9, 0x47, 0xfc, 0x07, 0x39, 0xe6, 0x5f, 0xe0, - 0x88, 0x94, 0x4b, 0x94, 0x03, 0x41, 0x90, 0x43, 0x6e, 0xb9, 0xe7, 0x14, 0xf5, 0x63, 0xfc, 0x1a, - 0x3f, 0x96, 0x88, 0x9c, 0x72, 0x9a, 0xee, 0xea, 0xea, 0xaa, 0x5f, 0x55, 0xd7, 0x54,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 0x58, 0x70, 0x48, 0x15, 0x97, 0x6b, 0x88, 0xd6, 0xb2, 0xb3, 0xe2, 0x2c, 0xc9, 0x05, - 0x1f, 0x20, 0x5a, 0x83, 0x8b, 0x60, 0xce, 0x27, 0xfc, 0x52, 0x6c, 0x45, 0xdb, 0x88, 0xdb, 0x72, - 0x63, 0xbc, 0x0f, 0x4e, 0x09, 0x27, 0x25, 0x91, 0xde, 0xbf, 0x81, 0xf2, 0xa1, 0x06, 0xf4, 0x51, - 0x16, 0x14, 0xd8, 0x55, 0x70, 0x54, 0xbe, 0x5c, 0x79, 0xd0, 0xd2, 0x11, 0x29, 0xbd, 0x2c, 0x85, - 0x50, 0x07, 0x49, 0xca, 0x9d, 0x72, 0x7c, 0xb3, 0x02, 0x5f, 0x77, 0xcf, 0x4d, 0x20, 0x69, 0xb5, - 0xec, 0xb7, 0xbc, 0x0a, 0x0e, 0x54, 0x04, 0x47, 0x94, 0xf4, 0x23, 0x21, 0x34, 0xae, 0x83, 0x25, - 0x81, 0xe3, 0x53, 0xd4, 0xa8, 0x57, 0x11, 0x23, 0xc1, 0x50, 0x30, 0xa7, 0x41, 0xda, 0x21, 0xfe, - 0x30, 0x8e, 0x14, 0x97, 0x5d, 0x8e, 0x44, 0xf5, 0x58, 0x03, 0xcb, 0x63, 0xac, 0xa9, 0xc0, 0xd6, - 0xc1, 0xb1, 0x10, 0xd5, 0xa0, 0xc5, 0x10, 0xec, 0x5b, 0x0c, 0x2d, 0x2c, 0xa2, 0xa2, 0x7c, 0xe7, - 0x37, 0x79, 0x9e, 0xff, 0xab, 0x22, 0xea, 0x5e, 0x9d, 0x56, 0x44, 0xc6, 0x75, 0xe5, 0xec, 0x13, - 0x46, 0x02, 0xe4, 0x4e, 0x77, 0x06, 0x33, 0x20, 0xb6, 0x8f, 0x0f, 0x54, 0xbd, 0xf1, 0x65, 0x9f, - 0xfb, 0x6d, 0xe5, 0xbe, 0x6b, 0x4c, 0xb9, 0x5f, 0x04, 0x73, 0x6d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x02, 0x49, 0xa7, 0x86, 0xea, 0x7e, 0xb9, 0x5e, 0xcd, 0xc6, 0x57, 0xb4, 0x8d, 0x98, 0x9d, 0x10, + 0xeb, 0x6b, 0x55, 0xb8, 0x04, 0x16, 0x48, 0x1b, 0x07, 0x41, 0xbd, 0x8a, 0x69, 0x76, 0x4e, 0x60, + 0xed, 0x09, 0x8c, 0x3d, 0x70, 0x7c, 0x97, 0xb2, 0xba, 0x87, 0x18, 0xbe, 0x8a, 0x7a, 0x69, 0xca, + 0x80, 0x98, 0x8b, 0x64, 0x68, 0x71, 0x9b, 0xff, 0x72, 0x49, 0x80, 0x99, 0x88, 0x2a, 0x6d, 0xf3, + 0x5f, 0xee, 0xb3, 0xed, 0x95, 0x71, 0x10, 0x10, 0xf9, 0xd2, 0x17, 0xec, 0x44, 0xdb, 0xdb, 0xe5, + 0x4b, 0xe3, 0x65, 0x2c, 0x2c, 0x8f, 0x00, 0x39, 0x78, 0xaf, 0x13, 0xa6, 0x6c, 0x07, 0xc4, 0x3c, + 0xea, 0xaa, 0xd4, 0xe7, 0xa3, 0xa9, 0xbf, 0x49, 0xdd, 0x5d, 0x2e, 0xc3, 0x2d, 0x6f, 0xaf, 0x63, + 0x73, 0x5d, 0x78, 0x09, 0xa4, 0x19, 0x37, 0x52, 0x76, 0x88, 0x7f, 0xa7, 0xee, 0x0a, 0x4f, 0xa9, + 0xc2, 0x72, 0xf4, 0xac, 0x70, 0x55, 0x12, 0x4a, 0x76, 0x8a, 0xf5, 0x16, 0xb0, 0x04, 0xd2, 0xcd, + 0x00, 0x57, 0xb1, 0x83, 0x29, 0x25, 0x01, 0xcd, 0xc6, 0x45, 0x6d, 0x4e, 0xf5, 0x3e, 0x70, 0x88, + 0x37, 0xdc, 0x4a, 0x83, 0x38, 0xfb, 0x61, 0x6b, 0x9b, 0x13, 0x49, 0x4e, 0x09, 0x99, 0x6c, 0x6c, + 0x70, 0x19, 0x00, 0xa9, 0x22, 0xde, 0xdf, 0xbc, 0xc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 0x11, 0x76, 0xc4, 0x00, + 0xab, 0xcc, 0x8b, 0xd9, 0xff, 0xce, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0x87, 0xbf, 0xd9, + 0x12, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2500,6 +2510,13 @@ func (m *EthCallRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Overrides) > 0 { + i -= len(m.Overrides) + copy(dAtA[i:], m.Overrides) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Overrides))) + i-- + dAtA[i] = 0x2a + } if m.ChainId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) i-- @@ -3127,6 +3144,10 @@ func (m *EthCallRequest) Size() (n int) { if m.ChainId != 0 { n += 1 + sovQuery(uint64(m.ChainId)) } + l = len(m.Overrides) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -4929,6 +4950,40 @@ func (m *EthCallRequest) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Overrides", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Overrides = append(m.Overrides[:0], dAtA[iNdEx:postIndex]...) + if m.Overrides == nil { + m.Overrides = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From 1ea09aabad9b86b3870b34a26959dd2d5a32818e Mon Sep 17 00:00:00 2001 From: yihuang Date: Thu, 26 Oct 2023 16:05:22 +0800 Subject: [PATCH 02/11] Update CHANGELOG.md Signed-off-by: yihuang --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7435fbab0..149256fdde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (ante) [#310](https://github.com/crypto-org-chain/ethermint/pull/310) Support blocking list of addresses in mempool. * (evm) [#328](https://github.com/crypto-org-chain/ethermint/pull/328) Support precompile interface. * (statedb) [#333](https://github.com/crypto-org-chain/ethermint/pull/333) Support native action in statedb, prepare for precompiles. -* (rpc) [#]() Support state overrides in eth_call. +* (rpc) [#369](https://github.com/crypto-org-chain/ethermint/pull/369) Support state overrides in eth_call. ### State Machine Breaking From 4ce15f79d25dbddeeb90b423f8524acccd180653 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 27 Oct 2023 15:23:20 +0800 Subject: [PATCH 03/11] integration test --- tests/integration_tests/test_call.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/integration_tests/test_call.py diff --git a/tests/integration_tests/test_call.py b/tests/integration_tests/test_call.py new file mode 100644 index 0000000000..9d76ae29d7 --- /dev/null +++ b/tests/integration_tests/test_call.py @@ -0,0 +1,17 @@ +from web3 import Web3 +import json + +from .utils import CONTRACTS + + +def test_state_override(ethermint): + w3: Web3 = ethermint.w3 + info = json.loads(CONTRACTS['Greeter'].read_text()) + address = "0x0000000000000000000000000000ffffffffffff" + overrides = { + address: { + "code": info['deployedBytecode'], + }, + } + contract = w3.eth.contract(abi=info['abi'], address=address) + print(contract.greet().call("latest", overrides)) From 159c4d16e1efff2b8ea10da2a8a42a5992cbe9e3 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 27 Oct 2023 15:40:57 +0800 Subject: [PATCH 04/11] fix build --- x/evm/keeper/grpc_query.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 0da3a40db3..37d943a4a0 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -414,13 +414,6 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ return nil, status.Errorf(codes.InvalidArgument, "output limit cannot be negative, got %d", req.TraceConfig.Limit) } - var overrides *rpctypes.StateOverride - if len(req.Overrides) > 0 { - if err := json.Unmarshal(req.Overrides, overrides); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - } - // get the context of block beginning contextHeight := req.BlockNumber if contextHeight < 1 { @@ -470,7 +463,7 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ _ = json.Unmarshal([]byte(req.TraceConfig.TracerJsonConfig), &tracerConfig) } - result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false, tracerConfig, overrides) + result, _, err := k.traceTx(ctx, cfg, txConfig, signer, tx, req.TraceConfig, false, tracerConfig) if err != nil { // error will be returned with detail status from traceTx return nil, err @@ -528,7 +521,7 @@ func (k Keeper) TraceBlock(c context.Context, req *types.QueryTraceBlockRequest) ethTx := tx.AsTransaction() txConfig.TxHash = ethTx.Hash() txConfig.TxIndex = uint(i) - traceResult, logIndex, err := k.traceTx(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true, nil, nil) + traceResult, logIndex, err := k.traceTx(ctx, cfg, txConfig, signer, ethTx, req.TraceConfig, true, nil) if err != nil { result.Error = err.Error() } else { @@ -558,7 +551,6 @@ func (k *Keeper) traceTx( traceConfig *types.TraceConfig, commitMessage bool, tracerJSONConfig json.RawMessage, - overrides *rpctypes.StateOverride, ) (*interface{}, uint, error) { // Assemble the structured logger or the JavaScript tracer var ( @@ -622,7 +614,7 @@ func (k *Keeper) traceTx( } }() - res, err := k.ApplyMessageWithConfig(ctx, msg, tracer, commitMessage, cfg, txConfig, overrides) + res, err := k.ApplyMessageWithConfig(ctx, msg, tracer, commitMessage, cfg, txConfig, nil) if err != nil { return nil, 0, status.Error(codes.Internal, err.Error()) } From 01151553527d5542fa7acd05edab02e357861da2 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 27 Oct 2023 15:42:06 +0800 Subject: [PATCH 05/11] revert renaming --- x/evm/keeper/grpc_query.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 37d943a4a0..812c6f5328 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -554,10 +554,10 @@ func (k *Keeper) traceTx( ) (*interface{}, uint, error) { // Assemble the structured logger or the JavaScript tracer var ( - tracer tracers.Tracer - overrideCfg *ethparams.ChainConfig - err error - timeout = defaultTraceTimeout + tracer tracers.Tracer + overrides *ethparams.ChainConfig + err error + timeout = defaultTraceTimeout ) msg, err := tx.AsMessage(signer, cfg.BaseFee) if err != nil { @@ -569,7 +569,7 @@ func (k *Keeper) traceTx( } if traceConfig.Overrides != nil { - overrideCfg = traceConfig.Overrides.EthereumConfig(cfg.ChainConfig.ChainID) + overrides = traceConfig.Overrides.EthereumConfig(cfg.ChainConfig.ChainID) } logConfig := logger.Config{ @@ -579,7 +579,7 @@ func (k *Keeper) traceTx( EnableReturnData: traceConfig.EnableReturnData, Debug: traceConfig.Debug, Limit: int(traceConfig.Limit), - Overrides: overrideCfg, + Overrides: overrides, } tracer = logger.NewStructLogger(&logConfig) From 90d67d68223fa846419a8436992798327aa258b9 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 27 Oct 2023 16:09:09 +0800 Subject: [PATCH 06/11] fix unmarshal --- x/evm/keeper/grpc_query.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 812c6f5328..5688236f1d 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -232,9 +232,9 @@ func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.Ms return nil, status.Error(codes.InvalidArgument, "empty request") } - var overrides *rpctypes.StateOverride + var overrides rpctypes.StateOverride if len(req.Overrides) > 0 { - if err := json.Unmarshal(req.Overrides, overrides); err != nil { + if err := json.Unmarshal(req.Overrides, &overrides); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } } From dff893168cd34744ebb124fa34de6d47f29ab5b3 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 27 Oct 2023 16:11:04 +0800 Subject: [PATCH 07/11] fix build --- x/evm/keeper/grpc_query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 5688236f1d..d88b8e3fc1 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -267,7 +267,7 @@ func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.Ms txConfig := statedb.NewEmptyTxConfig(common.BytesToHash(ctx.HeaderHash())) // pass false to not commit StateDB - res, err := k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig, overrides) + res, err := k.ApplyMessageWithConfig(ctx, msg, nil, false, cfg, txConfig, &overrides) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } From 769cddfae83c8bf89c1e09d84c3f01273bb935ed Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 27 Oct 2023 18:06:47 +0800 Subject: [PATCH 08/11] fix integration test --- .../hardhat/contracts/Greeter.sol | 5 +++ tests/integration_tests/test_call.py | 33 ++++++++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tests/integration_tests/hardhat/contracts/Greeter.sol b/tests/integration_tests/hardhat/contracts/Greeter.sol index 2f5dbda54f..44caad87b7 100644 --- a/tests/integration_tests/hardhat/contracts/Greeter.sol +++ b/tests/integration_tests/hardhat/contracts/Greeter.sol @@ -1,6 +1,7 @@ pragma solidity >0.5.0; contract Greeter { + uint public n; string public greeting; event ChangeGreeting(address from, string value); @@ -17,4 +18,8 @@ contract Greeter { function greet() public view returns (string memory) { return greeting; } + + function intValue() public view returns (uint) { + return n; + } } diff --git a/tests/integration_tests/test_call.py b/tests/integration_tests/test_call.py index 9d76ae29d7..ed480f809f 100644 --- a/tests/integration_tests/test_call.py +++ b/tests/integration_tests/test_call.py @@ -1,17 +1,34 @@ -from web3 import Web3 import json +from web3 import Web3 +from web3._utils.contracts import encode_transaction_data +from hexbytes import HexBytes from .utils import CONTRACTS -def test_state_override(ethermint): - w3: Web3 = ethermint.w3 - info = json.loads(CONTRACTS['Greeter'].read_text()) - address = "0x0000000000000000000000000000ffffffffffff" +def test_state_override(cronos): + state = 100 + w3: Web3 = cronos.w3 + info = json.loads(CONTRACTS["Greeter"].read_text()) + data = encode_transaction_data(w3, "intValue", info["abi"]) + # call an arbitrary address + address = w3.toChecksumAddress("0x0000000000000000000000000000ffffffffffff") overrides = { address: { - "code": info['deployedBytecode'], + "code": info["deployedBytecode"], + "state": { + ("0x" + "0" * 64): HexBytes( + w3.codec.encode(("uint256",), (state,)) + ).hex(), + }, }, } - contract = w3.eth.contract(abi=info['abi'], address=address) - print(contract.greet().call("latest", overrides)) + result = w3.eth.call( + { + "to": address, + "data": data, + }, + "latest", + overrides, + ) + assert (state,) == w3.codec.decode(("uint256",), result) From 1073d743b2042c448ddcd055e4a31ed3af02d2c2 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 27 Oct 2023 18:20:46 +0800 Subject: [PATCH 09/11] Update tests/integration_tests/test_call.py Signed-off-by: mmsqe --- tests/integration_tests/test_call.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration_tests/test_call.py b/tests/integration_tests/test_call.py index ed480f809f..bc718ac4c6 100644 --- a/tests/integration_tests/test_call.py +++ b/tests/integration_tests/test_call.py @@ -6,9 +6,9 @@ from .utils import CONTRACTS -def test_state_override(cronos): +def test_state_override(ethermint): state = 100 - w3: Web3 = cronos.w3 + w3: Web3 = ethermint.w3 info = json.loads(CONTRACTS["Greeter"].read_text()) data = encode_transaction_data(w3, "intValue", info["abi"]) # call an arbitrary address From f4a5469acea9e74e3fb9f0964f7753d708f6e17c Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 27 Oct 2023 19:58:14 +0800 Subject: [PATCH 10/11] fix lint and test --- rpc/backend/backend.go | 3 +-- rpc/backend/call_tx_test.go | 2 +- tests/integration_tests/test_call.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index fbce475649..2318b8ed4e 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -32,7 +32,6 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/signer/core/apitypes" - "github.com/evmos/ethermint/rpc/types" rpctypes "github.com/evmos/ethermint/rpc/types" "github.com/evmos/ethermint/server/config" ethermint "github.com/evmos/ethermint/types" @@ -150,7 +149,7 @@ type ProcessBlocker func( ethBlock *map[string]interface{}, rewardPercentiles []float64, tendermintBlockResult *tmrpctypes.ResultBlockResults, - targetOneFeeHistory *types.OneFeeHistory, + targetOneFeeHistory *rpctypes.OneFeeHistory, ) error // Backend implements the BackendI interface diff --git a/rpc/backend/call_tx_test.go b/rpc/backend/call_tx_test.go index f4349fc541..033b3602e7 100644 --- a/rpc/backend/call_tx_test.go +++ b/rpc/backend/call_tx_test.go @@ -424,7 +424,7 @@ func (suite *BackendTestSuite) TestDoCall() { suite.SetupTest() // reset test and queries tc.registerMock() - msgEthTx, err := suite.backend.DoCall(tc.callArgs, tc.blockNum) + msgEthTx, err := suite.backend.DoCall(tc.callArgs, tc.blockNum, nil) if tc.expPass { suite.Require().Equal(tc.expEthTx, msgEthTx) diff --git a/tests/integration_tests/test_call.py b/tests/integration_tests/test_call.py index bc718ac4c6..1e21750fa0 100644 --- a/tests/integration_tests/test_call.py +++ b/tests/integration_tests/test_call.py @@ -1,7 +1,8 @@ import json + +from hexbytes import HexBytes from web3 import Web3 from web3._utils.contracts import encode_transaction_data -from hexbytes import HexBytes from .utils import CONTRACTS From 4964d218afa94bb44eaa8b71e340763dbcd141b4 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Tue, 31 Oct 2023 14:31:56 +0800 Subject: [PATCH 11/11] fix lint --- rpc/backend/call_tx.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index 92f6b65940..c70f57a13b 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -372,9 +372,9 @@ func (b *Backend) DoCall( return nil, errors.New("header not found") } - var overridesJson []byte + var overridesJSON []byte if overrides != nil { - overridesJson, err = json.Marshal(overrides) + overridesJSON, err = json.Marshal(overrides) if err != nil { return nil, err } @@ -385,7 +385,7 @@ func (b *Backend) DoCall( GasCap: b.RPCGasCap(), ProposerAddress: sdk.ConsAddress(header.Block.ProposerAddress), ChainId: b.chainID.Int64(), - Overrides: overridesJson, + Overrides: overridesJSON, } // From ContextWithHeight: if the provided height is 0,