Skip to content

Commit

Permalink
Refactor naming
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoe committed Oct 21, 2024
1 parent f55b2a9 commit 6efd5ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/evm/jsonrpc/evmchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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()))
}
}

Expand Down
7 changes: 4 additions & 3 deletions packages/evm/jsonrpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()),
}
}
Expand Down

0 comments on commit 6efd5ef

Please sign in to comment.