diff --git a/CHANGELOG.md b/CHANGELOG.md index 28269e4180..f300d43c38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (evm) [tharsis#469](https://github.com/tharsis/ethermint/pull/469) Support [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) * (evm) [tharsis#417](https://github.com/tharsis/ethermint/pull/417) Add `EvmHooks` for tx post-processing * (rpc) [tharsis#506](https://github.com/tharsis/ethermint/pull/506) Support for `debug_traceTransaction` RPC endpoint +* (rpc) [tharsis#555](https://github.com/tharsis/ethermint/pull/555) Support for `debug_traceBlockByNumber` RPC endpoint ### Bug Fixes diff --git a/docs/api/json-rpc/endpoints.md b/docs/api/json-rpc/endpoints.md index d95ace0315..aa0b9e6a16 100644 --- a/docs/api/json-rpc/endpoints.md +++ b/docs/api/json-rpc/endpoints.md @@ -124,7 +124,7 @@ Check the JSON-RPC methods supported on Ethermint. {synopsis} | `debug_startGoTrace` | Debug | ✔ | | | | `debug_stopCPUProfile` | Debug | ✔ | | | | `debug_stopGoTrace` | Debug | ✔ | | | -| `debug_traceBlock` | Debug | | | | +| `debug_traceBlock`(#debug-traceblock) | Debug | ✔ | | | | `debug_traceBlockByNumber` | Debug | | | | | `debug_traceBlockByHash` | Debug | | | | | `debug_traceBlockFromFile` | Debug | | | | @@ -1007,6 +1007,22 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params" ["68410", "51470"] ``` +### `debug_traceBlockByNumber` + +The `traceBlockByNumber` endpoint accepts a block number and will replay the block that is already present in the database. + +#### Parameters + +- Trace Config + +```json +// Request +curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceBlockByNumber","params":["0xe", {"tracer": "{data: [], fault: function(log) {}, step: function(log) { if(log.op.toString() == \"CALL\") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}"}],"id":1}' -H "Content-Type: application/json" http://localhost:8545 + +//Result +{"jsonrpc":"2.0","id":1,"result":[{"result":["68410", "51470"]}]} +``` + ## Miner Methods diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index 71aa4ac1b4..0a030fb367 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -847,7 +847,7 @@ QueryTraceTxRequest defines TraceTx request | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `msg` | [MsgEthereumTx](#ethermint.evm.v1.MsgEthereumTx) | | msgEthereumTx for the requested transaction | -| `tx_index` | [uint32](#uint32) | | transaction index | +| `tx_index` | [uint64](#uint64) | | transaction index | | `trace_config` | [TraceConfig](#ethermint.evm.v1.TraceConfig) | | TraceConfig holds extra parameters to trace functions. | diff --git a/ethereum/rpc/backend/backend.go b/ethereum/rpc/backend/backend.go index 55704d4552..0971d74eef 100644 --- a/ethereum/rpc/backend/backend.go +++ b/ethereum/rpc/backend/backend.go @@ -41,6 +41,7 @@ type Backend interface { BlockNumber() (hexutil.Uint64, error) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) + GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) HeaderByNumber(blockNum types.BlockNumber) (*ethtypes.Header, error) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) PendingTransactions() ([]*sdk.Tx, error) @@ -116,6 +117,38 @@ func (e *EVMBackend) BlockNumber() (hexutil.Uint64, error) { // GetBlockByNumber returns the block identified by number. func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) (map[string]interface{}, error) { + resBlock, err := e.GetTendermintBlockByNumber(blockNum) + if err != nil { + return nil, err + } + + res, err := e.EthBlockFromTendermint(resBlock.Block, fullTx) + if err != nil { + e.logger.Debug("EthBlockFromTendermint failed", "height", blockNum, "error", err.Error()) + return nil, err + } + + return res, nil +} + +// GetBlockByHash returns the block identified by hash. +func (e *EVMBackend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { + resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) + if err != nil { + e.logger.Debug("BlockByHash block not found", "hash", hash.Hex(), "error", err.Error()) + return nil, err + } + + if resBlock.Block == nil { + e.logger.Debug("BlockByHash block not found", "hash", hash.Hex()) + return nil, nil + } + + return e.EthBlockFromTendermint(resBlock.Block, fullTx) +} + +// GetTendermintBlockByNumber returns a Tendermint format block by block number +func (e *EVMBackend) GetTendermintBlockByNumber(blockNum types.BlockNumber) (*tmrpctypes.ResultBlock, error) { height := blockNum.Int64() currentBlockNumber, _ := e.BlockNumber() @@ -152,29 +185,7 @@ func (e *EVMBackend) GetBlockByNumber(blockNum types.BlockNumber, fullTx bool) ( e.logger.Debug("GetBlockByNumber block not found", "height", height) return nil, nil } - - res, err := e.EthBlockFromTendermint(resBlock.Block, fullTx) - if err != nil { - e.logger.Debug("EthBlockFromTendermint failed", "height", height, "error", err.Error()) - } - - return res, err -} - -// GetBlockByHash returns the block identified by hash. -func (e *EVMBackend) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { - resBlock, err := e.clientCtx.Client.BlockByHash(e.ctx, hash.Bytes()) - if err != nil { - e.logger.Debug("BlockByHash block not found", "hash", hash.Hex(), "error", err.Error()) - return nil, err - } - - if resBlock.Block == nil { - e.logger.Debug("BlockByHash block not found", "hash", hash.Hex()) - return nil, nil - } - - return e.EthBlockFromTendermint(resBlock.Block, fullTx) + return resBlock, nil } // EthBlockFromTendermint returns a JSON-RPC compatible Ethereum block from a given Tendermint block and its block result. diff --git a/ethereum/rpc/namespaces/debug/api.go b/ethereum/rpc/namespaces/debug/api.go index 073525f426..1ca5465c70 100644 --- a/ethereum/rpc/namespaces/debug/api.go +++ b/ethereum/rpc/namespaces/debug/api.go @@ -13,6 +13,8 @@ import ( "sync" "time" + "github.com/tendermint/tendermint/types" + evmtypes "github.com/tharsis/ethermint/x/evm/types" "github.com/cosmos/cosmos-sdk/client" @@ -89,7 +91,7 @@ func (a *API) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfig) ( traceTxRequest := evmtypes.QueryTraceTxRequest{ Msg: ethMessage, - TxIndex: transaction.Index, + TxIndex: uint64(transaction.Index), } if config != nil { @@ -112,6 +114,102 @@ func (a *API) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfig) ( return decodedResult, nil } +// TraceBlockByNumber returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +func (a *API) TraceBlockByNumber(height rpctypes.BlockNumber, config *evmtypes.TraceConfig) ([]*evmtypes.TxTraceResult, error) { + a.logger.Debug("debug_traceBlockByNumber", "height", height) + if height == 0 { + return nil, errors.New("genesis is not traceable") + } + // Get Tendermint Block + resBlock, err := a.backend.GetTendermintBlockByNumber(height) + if err != nil { + return nil, err + } + + return a.traceBlock(height, config, resBlock.Block.Txs) +} + +// traceBlock configures a new tracer according to the provided configuration, and +// executes all the transactions contained within. The return value will be one item +// per transaction, dependent on the requested tracer. +func (a API) traceBlock(height rpctypes.BlockNumber, config *evmtypes.TraceConfig, txs types.Txs) ([]*evmtypes.TxTraceResult, error) { + txsLength := len(txs) + + if txsLength == 0 { + // If there are no transactions return empty array + return []*evmtypes.TxTraceResult{}, nil + } + + var ( + results = make([]*evmtypes.TxTraceResult, txsLength) + wg = new(sync.WaitGroup) + jobs = make(chan *evmtypes.TxTraceTask, txsLength) + ) + + threads := runtime.NumCPU() + if threads > txsLength { + threads = txsLength + } + + ctxWithHeight := rpctypes.ContextWithHeight(int64(height)) + + wg.Add(threads) + for th := 0; th < threads; th++ { + go func() { + defer wg.Done() + txDecoder := a.clientCtx.TxConfig.TxDecoder() + // Fetch and execute the next transaction trace tasks + for task := range jobs { + tx, err := txDecoder(txs[task.Index]) + if err != nil { + a.logger.Error("failed to decode transaction", "hash", txs[task.Index].Hash(), "error", err.Error()) + continue + } + + messages := tx.GetMsgs() + if len(messages) == 0 { + continue + } + ethMessage, ok := messages[0].(*evmtypes.MsgEthereumTx) + if !ok { + // Just considers Ethereum transactions + continue + } + + traceTxRequest := &evmtypes.QueryTraceTxRequest{ + Msg: ethMessage, + TxIndex: uint64(task.Index), + TraceConfig: config, + } + + res, err := a.queryClient.TraceTx(ctxWithHeight, traceTxRequest) + if err != nil { + results[task.Index] = &evmtypes.TxTraceResult{Error: err.Error()} + continue + } + // Response format is unknown due to custom tracer config param + // More information can be found here https://geth.ethereum.org/docs/dapp/tracing-filtered + var decodedResult interface{} + if err := json.Unmarshal(res.Data, &decodedResult); err != nil { + results[task.Index] = &evmtypes.TxTraceResult{Error: err.Error()} + continue + } + results[task.Index] = &evmtypes.TxTraceResult{Result: decodedResult} + } + }() + } + + for i := range txs { + jobs <- &evmtypes.TxTraceTask{Index: i} + } + + close(jobs) + wg.Wait() + + return results, nil +} + // BlockProfile turns on goroutine profiling for nsec seconds and writes profile data to // file. It uses a profile rate of 1 for most accurate information. If a different rate is // desired, set the rate and write the profile manually. diff --git a/go.mod b/go.mod index b2a39a0437..71d19442ff 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect - google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 + google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af google.golang.org/grpc v1.40.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -44,9 +44,13 @@ require ( github.com/99designs/keyring v1.1.6 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/DataDog/zstd v1.4.8 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver v1.5.0 // indirect + github.com/Masterminds/sprig v2.22.0+incompatible // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.5.7 // indirect github.com/Workiva/go-datastructures v1.0.52 // indirect + github.com/aokoli/goutils v1.1.1 // indirect github.com/armon/go-metrics v0.3.9 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect @@ -68,6 +72,7 @@ require ( github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 // indirect + github.com/envoyproxy/protoc-gen-validate v0.6.1 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect @@ -92,7 +97,9 @@ require ( github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.1.1 // indirect + github.com/huandu/xstrings v1.3.2 // indirect github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 // indirect + github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 // indirect github.com/jmhodges/levigo v1.0.0 // indirect @@ -105,8 +112,10 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect github.com/minio/highwayhash v1.0.1 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/mwitkow/go-proto-validators v0.3.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.3 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect @@ -116,6 +125,7 @@ require ( github.com/prometheus/common v0.29.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect + github.com/pseudomuto/protoc-gen-doc v1.5.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect diff --git a/go.sum b/go.sum index 660a1d1f0c..e90e6c003b 100644 --- a/go.sum +++ b/go.sum @@ -71,6 +71,14 @@ github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t github.com/DataDog/zstd v1.4.8 h1:Rpmta4xZ/MgZnriKNd24iZMhGpP5dvUcs/uqfBapKZY= github.com/DataDog/zstd v1.4.8/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= @@ -105,6 +113,9 @@ github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKS github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= +github.com/aokoli/goutils v1.1.1 h1:/hA+Ywo3AxoDZY5ZMnkiEkUvkK4BPp927ax110KCqqg= +github.com/aokoli/goutils v1.1.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -243,6 +254,7 @@ github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2 github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= +github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -290,6 +302,9 @@ github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 h1:2vLKys4RBU4 github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25/go.mod h1:hTr8+TLQmkUkgcuh3mcr5fjrT9c64ZzsBCdCEC6UppY= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.3.0-java/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.1 h1:4CF52PCseTFt4bE+Yk3dIpdVi7XWuPVMhPtm4FaIJPM= +github.com/envoyproxy/protoc-gen-validate v0.6.1/go.mod h1:txg5va2Qkip90uYoSKH+nkAAmXrb2j3iq4FLwdrCbXQ= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= github.com/ethereum/go-ethereum v1.10.1/go.mod h1:E5e/zvdfUVr91JZ0AwjyuJM3x+no51zZJRz61orLLSk= github.com/ethereum/go-ethereum v1.10.3 h1:SEYOYARvbWnoDl1hOSks3ZJQpRiiRJe8ubaQGJQwq0s= @@ -449,6 +464,7 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/protobuf v3.14.0+incompatible/go.mod h1:lUQ9D1ePzbH2PrIS7ob/bjm9HXyH5WHB0Akwh7URreM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -537,14 +553,21 @@ github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iU github.com/holiman/uint256 v1.1.1 h1:4JywC80b+/hSfljFlEBLHrrh+CIONLDz9NuFl0af4Mw= github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.1-0.20200620063722-49508fba0031/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo= github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 h1:bcAj8KroPf552TScjFPIakjH2/tdIrIH8F+cc4v4SRo= github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/improbable-eng/grpc-web v0.14.0/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs= github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= @@ -646,6 +669,7 @@ github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoR github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= +github.com/lyft/protoc-gen-star v0.5.1/go.mod h1:9toiA3cC7z5uVbODF7kEQ91Xn7XNFkVUl+SrEe+ZORU= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= @@ -680,6 +704,8 @@ github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjK github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= @@ -690,6 +716,8 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -704,6 +732,9 @@ github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ib github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= +github.com/mwitkow/go-proto-validators v0.3.2 h1:qRlmpTzm2pstMKKzTdvwPCF5QfBNURSlAgN/R+qbKos= +github.com/mwitkow/go-proto-validators v0.3.2/go.mod h1:ej0Qp0qMgHN/KtDyUt+Q1/tA7a5VarXUOUxD+oeD30w= github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= @@ -800,6 +831,7 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -848,6 +880,10 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/pseudomuto/protoc-gen-doc v1.5.0 h1:pHZp0MEiT68jrZV8js8BS7E9ZEnlSLegoQbbtXj5lfo= +github.com/pseudomuto/protoc-gen-doc v1.5.0/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= +github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= +github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -910,6 +946,8 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.3.4/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -949,6 +987,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -1062,6 +1101,7 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1205,6 +1245,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1423,6 +1464,7 @@ google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1471,8 +1513,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 h1:3V2dxSZpz4zozWWUq36vUxXEKnSYitEH2LdsAx+RUmg= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af h1:aLMMXFYqw01RA6XJim5uaN+afqNNjc9P8HPAbnpnc5s= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= diff --git a/proto/ethermint/evm/v1/query.proto b/proto/ethermint/evm/v1/query.proto index 17bcc73907..da5d88d718 100644 --- a/proto/ethermint/evm/v1/query.proto +++ b/proto/ethermint/evm/v1/query.proto @@ -281,7 +281,7 @@ message QueryTraceTxRequest { // msgEthereumTx for the requested transaction MsgEthereumTx msg = 1; // transaction index - uint32 tx_index = 2; + uint64 tx_index = 2; // TraceConfig holds extra parameters to trace functions. TraceConfig trace_config = 3; } diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 06a760a449..ee8b36a139 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -469,13 +469,6 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type // executes the given message in the provided environment. The return value will // be tracer dependent. func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*types.QueryTraceTxResponse, error) { - // Assemble the structured logger or the JavaScript tracer - var ( - tracer vm.Tracer - err error - resultData []byte - ) - ctx := sdk.UnwrapSDKContext(c) k.WithContext(ctx) params := k.GetParams(ctx) @@ -487,25 +480,48 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ ethCfg := params.ChainConfig.EthereumConfig(k.eip155ChainID) signer := ethtypes.MakeSigner(ethCfg, big.NewInt(ctx.BlockHeight())) - coreMessage, err := req.Msg.AsMessage(signer) + result, err := k.traceTx(c, coinbase, signer, req.TxIndex, params, ctx, ethCfg, req.Msg, req.TraceConfig) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + resultData, err := json.Marshal(result) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryTraceTxResponse{ + Data: resultData, + }, nil +} + +func (k *Keeper) traceTx(c context.Context, coinbase common.Address, signer ethtypes.Signer, txIndex uint64, + params types.Params, ctx sdk.Context, ethCfg *ethparams.ChainConfig, msg *types.MsgEthereumTx, traceConfig *types.TraceConfig) (*interface{}, error) { + // Assemble the structured logger or the JavaScript tracer + var ( + tracer vm.Tracer + err error + ) + + coreMessage, err := msg.AsMessage(signer) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } switch { - case req.TraceConfig != nil && req.TraceConfig.Tracer != "": + case traceConfig != nil && traceConfig.Tracer != "": timeout := defaultTraceTimeout // TODO change timeout to time.duration // Used string to comply with go ethereum - if req.TraceConfig.Timeout != "" { - if timeout, err = time.ParseDuration(req.TraceConfig.Timeout); err != nil { + if traceConfig.Timeout != "" { + if timeout, err = time.ParseDuration(traceConfig.Timeout); err != nil { return nil, status.Errorf(codes.InvalidArgument, "timeout value: %s", err.Error()) } } txContext := core.NewEVMTxContext(coreMessage) - // Constuct the JavaScript tracer to execute with - if tracer, err = tracers.New(req.TraceConfig.Tracer, txContext); err != nil { + // Construct the JavaScript tracer to execute with + if tracer, err = tracers.New(traceConfig.Tracer, txContext); err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -518,12 +534,12 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ } }() defer cancel() - case req.TraceConfig != nil && req.TraceConfig.LogConfig != nil: + case traceConfig != nil && traceConfig.LogConfig != nil: logConfig := vm.LogConfig{ - DisableMemory: req.TraceConfig.LogConfig.DisableMemory, - Debug: req.TraceConfig.LogConfig.Debug, - DisableStorage: req.TraceConfig.LogConfig.DisableStorage, - DisableStack: req.TraceConfig.LogConfig.DisableStack, + DisableMemory: traceConfig.LogConfig.DisableMemory, + Debug: traceConfig.LogConfig.Debug, + DisableStorage: traceConfig.LogConfig.DisableStorage, + DisableStack: traceConfig.LogConfig.DisableStack, } tracer = vm.NewStructLogger(&logConfig) default: @@ -532,45 +548,34 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ evm := k.NewEVM(coreMessage, ethCfg, params, coinbase, tracer) - k.SetTxHashTransient(common.HexToHash(req.Msg.Hash)) - k.SetTxIndexTransient(uint64(req.TxIndex)) + k.SetTxHashTransient(common.HexToHash(msg.Hash)) + k.SetTxIndexTransient(txIndex) res, err := k.ApplyMessage(evm, coreMessage, ethCfg, true) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } + var result interface{} // Depending on the tracer type, format and return the trace result data. switch tracer := tracer.(type) { case *vm.StructLogger: // TODO Return proper returnValue - result := types.ExecutionResult{ + result = types.ExecutionResult{ Gas: res.GasUsed, Failed: res.Failed(), ReturnValue: "", StructLogs: types.FormatLogs(tracer.StructLogs()), } - - resultData, err = json.Marshal(result) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } case *tracers.Tracer: - result, err := tracer.GetResult() + result, err = tracer.GetResult() if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - resultData, err = json.Marshal(result) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } default: return nil, status.Error(codes.InvalidArgument, "invalid tracer type") } - return &types.QueryTraceTxResponse{ - Data: resultData, - }, nil + return &result, nil } diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index 0ce696a82a..c6a815f225 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -1125,7 +1125,7 @@ type QueryTraceTxRequest struct { // msgEthereumTx for the requested transaction Msg *MsgEthereumTx `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // transaction index - TxIndex uint32 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` + TxIndex uint64 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` // TraceConfig holds extra parameters to trace functions. TraceConfig *TraceConfig `protobuf:"bytes,3,opt,name=trace_config,json=traceConfig,proto3" json:"trace_config,omitempty"` } @@ -1170,7 +1170,7 @@ func (m *QueryTraceTxRequest) GetMsg() *MsgEthereumTx { return nil } -func (m *QueryTraceTxRequest) GetTxIndex() uint32 { +func (m *QueryTraceTxRequest) GetTxIndex() uint64 { if m != nil { return m.TxIndex } @@ -1261,89 +1261,89 @@ func init() { func init() { proto.RegisterFile("ethermint/evm/v1/query.proto", fileDescriptor_e15a877459347994) } var fileDescriptor_e15a877459347994 = []byte{ - // 1308 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6f, 0x13, 0x47, - 0x14, 0xcf, 0x12, 0x63, 0x87, 0x67, 0x42, 0xd3, 0x21, 0x40, 0xd8, 0x06, 0x27, 0x0c, 0xe4, 0x0b, - 0x52, 0x2f, 0x76, 0x2b, 0xa4, 0x22, 0x55, 0x85, 0x44, 0x94, 0x56, 0x40, 0x45, 0x4d, 0xd4, 0x43, - 0x2f, 0xd6, 0x78, 0x3d, 0x5d, 0x5b, 0xd8, 0x3b, 0x66, 0x67, 0xec, 0x3a, 0xd0, 0xb4, 0x55, 0xa5, - 0x22, 0x2a, 0x2e, 0x95, 0x7a, 0xaf, 0x90, 0xaa, 0x9e, 0xfb, 0x6f, 0x70, 0x44, 0xea, 0xa5, 0xa7, - 0xaa, 0x82, 0x1e, 0xfa, 0x67, 0x54, 0xf3, 0xb1, 0xf6, 0xae, 0xd7, 0x1b, 0x87, 0x0a, 0xf5, 0x36, - 0x1f, 0xef, 0xbd, 0xdf, 0xef, 0xbd, 0x79, 0x3b, 0xbf, 0x59, 0x58, 0xa4, 0xa2, 0x41, 0x83, 0x76, - 0xd3, 0x17, 0x0e, 0xed, 0xb5, 0x9d, 0x5e, 0xc9, 0xb9, 0xdf, 0xa5, 0xc1, 0x6e, 0xb1, 0x13, 0x30, - 0xc1, 0xd0, 0xdc, 0x60, 0xb7, 0x48, 0x7b, 0xed, 0x62, 0xaf, 0x64, 0xcf, 0x7b, 0xcc, 0x63, 0x6a, - 0xd3, 0x91, 0x23, 0x6d, 0x67, 0x5f, 0x70, 0x19, 0x6f, 0x33, 0xee, 0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- 0x5f, 0x2f, 0x0a, 0xd6, 0x8f, 0x2f, 0x0b, 0x53, 0xcf, 0x5f, 0x16, 0xa6, 0xfe, 0x78, 0x59, 0x98, - 0xfa, 0x7c, 0xdd, 0x6b, 0x8a, 0x46, 0xb7, 0x56, 0x74, 0x59, 0xdb, 0x11, 0x0d, 0x12, 0xf0, 0x26, - 0x8f, 0xc4, 0xe9, 0xab, 0x48, 0x62, 0xb7, 0x43, 0x79, 0x2d, 0xab, 0xfe, 0x9d, 0xdf, 0xf9, 0x37, - 0x00, 0x00, 0xff, 0xff, 0xbb, 0x7d, 0x12, 0xe6, 0x04, 0x10, 0x00, 0x00, + // 1307 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0x13, 0x47, + 0x14, 0xce, 0x12, 0x63, 0x87, 0x67, 0xa0, 0xe9, 0x10, 0x20, 0x6c, 0x83, 0x13, 0x06, 0x92, 0x38, + 0x90, 0x7a, 0xb1, 0x5b, 0x21, 0x15, 0xa9, 0x2a, 0x24, 0xa2, 0xb4, 0x02, 0x2a, 0x6a, 0xa2, 0x1e, + 0x7a, 0xb1, 0xc6, 0xeb, 0xe9, 0xda, 0xc2, 0xde, 0x31, 0x3b, 0x63, 0xd7, 0x81, 0xa6, 0xad, 0x2a, + 0x15, 0x51, 0x71, 0xa9, 0xd4, 0x7b, 0x85, 0x54, 0xf5, 0xdc, 0x7f, 0x83, 0x23, 0x52, 0x2f, 0x3d, + 0x55, 0x15, 0xf4, 0xd0, 0x3f, 0xa3, 0x9a, 0x1f, 0x6b, 0xef, 0x7a, 0xbd, 0x38, 0x54, 0xa8, 0xb7, + 0xf9, 0xf1, 0xde, 0xfb, 0xbe, 0xf7, 0xe6, 0xed, 0x7c, 0xb3, 0xb0, 0x44, 0x45, 0x93, 0x06, 0x9d, + 0x96, 0x2f, 0x1c, 0xda, 0xef, 0x38, 0xfd,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0xc8, 0x48, 0xfd, 0x45, 0x38, 0xb5, 0x65, 0x86, 0xa2, 0x6e, 0x9f, 0x7d, + 0xa9, 0x8d, 0xe1, 0xb0, 0xa1, 0x38, 0x9c, 0x45, 0x67, 0x26, 0x75, 0x53, 0x23, 0x56, 0x89, 0x6f, + 0x20, 0xab, 0x55, 0x15, 0x9d, 0x4b, 0x89, 0x1c, 0x53, 0x7c, 0x7b, 0x75, 0x8a, 0x95, 0x61, 0x50, + 0x54, 0x0c, 0x30, 0x5a, 0x71, 0x26, 0x3c, 0xf0, 0x95, 0x48, 0x39, 0x0f, 0xa4, 0x44, 0xaa, 0xa3, + 0x38, 0x34, 0x14, 0x33, 0xb4, 0x9e, 0x76, 0xdc, 0x63, 0x72, 0x6b, 0x17, 0xa7, 0x1b, 0x4e, 0xff, + 0xe8, 0xeb, 0xd2, 0x38, 0xc6, 0xe6, 0x91, 0x05, 0x30, 0xd2, 0x20, 0xf4, 0x52, 0x94, 0xa8, 0xb0, + 0xd9, 0x1b, 0xfb, 0xb0, 0x34, 0x84, 0x56, 0x15, 0xa1, 0x65, 0x74, 0x3a, 0x8d, 0x90, 0x52, 0x38, + 0xf4, 0x25, 0x64, 0xb5, 0x28, 0xa5, 0x9e, 0x4c, 0x4c, 0xfb, 0x52, 0x4f, 0x26, 0xae, 0x85, 0x78, + 0x45, 0xa1, 0xdb, 0x68, 0x31, 0x89, 0xae, 0x55, 0x0f, 0x0d, 0x20, 0x67, 0x64, 0x0c, 0xad, 0x24, + 0x63, 0xc6, 0x15, 0xce, 0x5e, 0x9f, 0x26, 0x33, 0x21, 0x2e, 0x56, 0xb8, 0x4b, 0xc8, 0x4e, 0xe2, + 0x52, 0xd1, 0xac, 0xb9, 0x12, 0xee, 0x6b, 0xc8, 0x47, 0x14, 0x70, 0x1f, 0xe8, 0x13, 0x72, 0x9e, + 0x20, 0xa1, 0x78, 0x4d, 0x61, 0xaf, 0xa0, 0xc2, 0x04, 0x6c, 0x63, 0x5e, 0xf3, 0x08, 0x47, 0x5f, + 0x41, 0xce, 0x68, 0x55, 0xea, 0xad, 0x10, 0x97, 0xdc, 0xd4, 0x5b, 0x61, 0x4c, 0xf2, 0x5e, 0x96, + 0xbd, 0x16, 0x59, 0x31, 0xd8, 0xda, 0x7a, 0xfa, 0xbc, 0x60, 0x3d, 0x7b, 0x5e, 0xb0, 0xfe, 0x7a, + 0x5e, 0xb0, 0x7e, 0x7c, 0x51, 0x98, 0x79, 0xf6, 0xa2, 0x30, 0xf3, 0xc7, 0x8b, 0xc2, 0xcc, 0xe7, + 0x45, 0xaf, 0x25, 0x9a, 0xbd, 0x7a, 0xc9, 0x65, 0x1d, 0x47, 0x34, 0x49, 0xc0, 0x5b, 0x3c, 0x12, + 0x67, 0xa0, 0x22, 0x89, 0xdd, 0x2e, 0xe5, 0xf5, 0xac, 0xfa, 0x77, 0x7e, 0xe7, 0xdf, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x87, 0x0b, 0xdf, 0x04, 0x04, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -5387,7 +5387,7 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TxIndex |= uint32(b&0x7F) << shift + m.TxIndex |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/evm/types/tracer.go b/x/evm/types/tracer.go index 93de66dc0f..b61932caa1 100644 --- a/x/evm/types/tracer.go +++ b/x/evm/types/tracer.go @@ -40,6 +40,18 @@ func NewTracer(tracer string, msg core.Message, cfg *params.ChainConfig, height } } +// TxTraceTask represents a single transaction trace task when an entire block +// is being traced. +type TxTraceTask struct { + Index int // Transaction offset in the block +} + +// TxTraceResult is the result of a single transaction trace during a block trace. +type TxTraceResult struct { + Result interface{} `json:"result,omitempty"` // Trace results produced by the tracer + Error string `json:"error,omitempty"` // Trace failure produced by the tracer +} + // ExecutionResult groups all structured logs emitted by the EVM // while replaying a transaction in debug mode as well as transaction // execution status, the amount of gas used and the return value