Commit fbd508bf authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #1320 from ethereum-optimism/fix/reduce-diff-evm-id

l2geth: removes the id from the evm
parents 0f6f7e35 101b942c
---
'@eth-optimism/l2geth': patch
---
Removes `id` field from EVM and no longer logs the EVM execution id
...@@ -249,7 +249,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo ...@@ -249,7 +249,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
l1MessageSender = msg.L1MessageSender().Hex() l1MessageSender = msg.L1MessageSender().Hex()
} }
if st.evm.EthCallSender == nil { if st.evm.EthCallSender == nil {
log.Debug("Applying transaction", "ID", st.evm.Id, "from", sender.Address().Hex(), "to", to, "nonce", msg.Nonce(), "gasPrice", msg.GasPrice().Uint64(), "gasLimit", msg.Gas(), "value", msg.Value().Uint64(), "l1MessageSender", l1MessageSender, "data", hexutil.Encode(msg.Data())) log.Debug("Applying transaction", "from", sender.Address().Hex(), "to", to, "nonce", msg.Nonce(), "gasPrice", msg.GasPrice().Uint64(), "gasLimit", msg.Gas(), "value", msg.Value().Uint64(), "l1MessageSender", l1MessageSender, "data", hexutil.Encode(msg.Data()))
} }
} }
......
...@@ -18,8 +18,6 @@ package vm ...@@ -18,8 +18,6 @@ package vm
import ( import (
"bytes" "bytes"
"crypto/rand"
"encoding/hex"
"fmt" "fmt"
"math/big" "math/big"
"strings" "strings"
...@@ -120,7 +118,7 @@ func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, err ...@@ -120,7 +118,7 @@ func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, err
// OVM_ENABLED // OVM_ENABLED
// Only log for non `eth_call`s // Only log for non `eth_call`s
if evm.Context.EthCallSender == nil { if evm.Context.EthCallSender == nil {
log.Debug("Calling contract", "ID", evm.Id, "Address", contract.Address().Hex(), "Data", hexutil.Encode(input)) log.Debug("Calling contract", "Address", contract.Address().Hex(), "Data", hexutil.Encode(input))
} }
// Uncomment to make Safety checker always returns true. // Uncomment to make Safety checker always returns true.
...@@ -132,7 +130,7 @@ func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, err ...@@ -132,7 +130,7 @@ func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, err
if contract.Address() == evm.Context.OvmStateManager.Address { if contract.Address() == evm.Context.OvmStateManager.Address {
// The caller must be the execution manager // The caller must be the execution manager
if contract.Caller() != evm.Context.OvmExecutionManager.Address { if contract.Caller() != evm.Context.OvmExecutionManager.Address {
log.Error("StateManager called by non ExecutionManager", "ID", evm.Id, "caller", contract.Caller().Hex()) log.Error("StateManager called by non ExecutionManager", "caller", contract.Caller().Hex())
return nil, ErrOvmSandboxEscape return nil, ErrOvmSandboxEscape
} }
return callStateManager(input, evm, contract) return callStateManager(input, evm, contract)
...@@ -238,8 +236,6 @@ type EVM struct { ...@@ -238,8 +236,6 @@ type EVM struct {
// available gas is calculated in gasCall* according to the 63/64 rule and later // available gas is calculated in gasCall* according to the 63/64 rule and later
// applied in opCall*. // applied in opCall*.
callGasTemp uint64 callGasTemp uint64
Id string
} }
// NewEVM returns a new EVM. The returned EVM is not thread safe and should // NewEVM returns a new EVM. The returned EVM is not thread safe and should
...@@ -256,9 +252,6 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon ...@@ -256,9 +252,6 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon
ctx.OvmL2StandardBridge = chainConfig.StateDump.Accounts["OVM_L2StandardBridge"] ctx.OvmL2StandardBridge = chainConfig.StateDump.Accounts["OVM_L2StandardBridge"]
} }
id := make([]byte, 4)
rand.Read(id)
evm := &EVM{ evm := &EVM{
Context: ctx, Context: ctx,
StateDB: statedb, StateDB: statedb,
...@@ -266,8 +259,6 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon ...@@ -266,8 +259,6 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon
chainConfig: chainConfig, chainConfig: chainConfig,
chainRules: chainConfig.Rules(ctx.BlockNumber), chainRules: chainConfig.Rules(ctx.BlockNumber),
interpreters: make([]Interpreter, 0, 1), interpreters: make([]Interpreter, 0, 1),
Id: hex.EncodeToString(id),
} }
if chainConfig.IsEWASM(ctx.BlockNumber) { if chainConfig.IsEWASM(ctx.BlockNumber) {
...@@ -467,7 +458,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas ...@@ -467,7 +458,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
} }
} }
if evm.Context.EthCallSender == nil { if evm.Context.EthCallSender == nil {
log.Debug("Reached the end of an OVM execution", "ID", evm.Id, "Return Data", hexutil.Encode(ret), "Error", err) log.Debug("Reached the end of an OVM execution", "Return Data", hexutil.Encode(ret), "Error", err)
} }
} }
} }
...@@ -700,7 +691,7 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I ...@@ -700,7 +691,7 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I
contractAddr = evm.OvmADDRESS() contractAddr = evm.OvmADDRESS()
if evm.Context.EthCallSender == nil { if evm.Context.EthCallSender == nil {
log.Debug("[EM] Creating contract.", "ID", evm.Id, "New contract address", contractAddr.Hex(), "Caller Addr", caller.Address().Hex(), "Caller nonce", evm.StateDB.GetNonce(caller.Address())) log.Debug("[EM] Creating contract.", "New contract address", contractAddr.Hex(), "Caller Addr", caller.Address().Hex(), "Caller nonce", evm.StateDB.GetNonce(caller.Address()))
} }
} }
...@@ -726,7 +717,7 @@ func (evm *EVM) Create2(caller ContractRef, code []byte, gas uint64, endowment * ...@@ -726,7 +717,7 @@ func (evm *EVM) Create2(caller ContractRef, code []byte, gas uint64, endowment *
contractAddr = evm.OvmADDRESS() contractAddr = evm.OvmADDRESS()
if evm.Context.EthCallSender == nil { if evm.Context.EthCallSender == nil {
log.Debug("[EM] Creating contract [create2].", "ID", evm.Id, "New contract address", contractAddr.Hex(), "Caller Addr", caller.Address().Hex(), "Caller nonce", evm.StateDB.GetNonce(caller.Address())) log.Debug("[EM] Creating contract [create2].", "New contract address", contractAddr.Hex(), "Caller Addr", caller.Address().Hex(), "Caller nonce", evm.StateDB.GetNonce(caller.Address()))
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment