From 6efd5efabae37cc61ab736a3f26de0abf26fd3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=B6ller?= Date: Mon, 21 Oct 2024 19:21:32 +0200 Subject: [PATCH] Refactor naming --- packages/evm/jsonrpc/evmchain.go | 4 ++-- packages/evm/jsonrpc/types.go | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/evm/jsonrpc/evmchain.go b/packages/evm/jsonrpc/evmchain.go index 20509b73a6..9d651d4632 100644 --- a/packages/evm/jsonrpc/evmchain.go +++ b/packages/evm/jsonrpc/evmchain.go @@ -710,7 +710,7 @@ func (e *EVMChain) trace(config *tracers.TraceConfig, blockInfo *blocklog.BlockI result, err := tracer.GetResult() if err != nil { - if err != nil && !errors.Is(err, ErrIncorrectTopLevelCalls) { + if !errors.Is(err, ErrIncorrectTopLevelCalls) { return nil, err } @@ -720,7 +720,7 @@ func (e *EVMChain) trace(config *tracers.TraceConfig, blockInfo *blocklog.BlockI } if e.isFakeTransaction(tx) { - return json.Marshal(RPCMarshalTransactionForFakeTX(tx, tx.GasPrice())) + return json.Marshal(RPCMarshalTransactionTraceForFakeTX(tx, tx.GasPrice())) } } diff --git a/packages/evm/jsonrpc/types.go b/packages/evm/jsonrpc/types.go index 5cd3a6ed52..10418e05f8 100644 --- a/packages/evm/jsonrpc/types.go +++ b/packages/evm/jsonrpc/types.go @@ -15,7 +15,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/rpc" iotago "github.com/iotaledger/iota.go/v3" @@ -159,14 +158,16 @@ func parseBlockNumber(bn rpc.BlockNumber) *big.Int { return big.NewInt(n) } -func RPCMarshalTransactionForFakeTX(tx *types.Transaction, effectiveGasPrice *big.Int) map[string]interface{} { +const FakeTxOpcode = "STOP" + +func RPCMarshalTransactionTraceForFakeTX(tx *types.Transaction, effectiveGasPrice *big.Int) map[string]interface{} { return map[string]interface{}{ "from": evmutil.MustGetSenderIfTxSigned(tx), "gas": hexutil.Uint64(tx.Gas()), "gasUsed": hexutil.Uint64(tx.Gas()), "to": tx.To(), "input": hexutil.Bytes(tx.Data()), - "type": vm.OpCode(tx.Type()).String(), + "type": FakeTxOpcode, "value": hexutil.Big(*tx.Value()), } }