Commit f331428f authored by Mark Tyneway's avatar Mark Tyneway

l2geth: update memory usage in geth

This PR updates the memory usage
parent 4a5833f7
---
'@eth-optimism/l2geth': patch
---
Update the memory usage in geth
...@@ -767,6 +767,7 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory ...@@ -767,6 +767,7 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory
stack.push(interpreter.intPool.get().SetUint64(1)) stack.push(interpreter.intPool.get().SetUint64(1))
} }
if err == nil || err == errExecutionReverted { if err == nil || err == errExecutionReverted {
ret = common.CopyBytes(ret)
memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) memory.Set(retOffset.Uint64(), retSize.Uint64(), ret)
} }
contract.Gas += returnGas contract.Gas += returnGas
...@@ -796,6 +797,7 @@ func opCallCode(pc *uint64, interpreter *EVMInterpreter, contract *Contract, mem ...@@ -796,6 +797,7 @@ func opCallCode(pc *uint64, interpreter *EVMInterpreter, contract *Contract, mem
stack.push(interpreter.intPool.get().SetUint64(1)) stack.push(interpreter.intPool.get().SetUint64(1))
} }
if err == nil || err == errExecutionReverted { if err == nil || err == errExecutionReverted {
ret = common.CopyBytes(ret)
memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) memory.Set(retOffset.Uint64(), retSize.Uint64(), ret)
} }
contract.Gas += returnGas contract.Gas += returnGas
...@@ -821,6 +823,7 @@ func opDelegateCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, ...@@ -821,6 +823,7 @@ func opDelegateCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract,
stack.push(interpreter.intPool.get().SetUint64(1)) stack.push(interpreter.intPool.get().SetUint64(1))
} }
if err == nil || err == errExecutionReverted { if err == nil || err == errExecutionReverted {
ret = common.CopyBytes(ret)
memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) memory.Set(retOffset.Uint64(), retSize.Uint64(), ret)
} }
contract.Gas += returnGas contract.Gas += returnGas
...@@ -846,6 +849,7 @@ func opStaticCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, m ...@@ -846,6 +849,7 @@ func opStaticCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, m
stack.push(interpreter.intPool.get().SetUint64(1)) stack.push(interpreter.intPool.get().SetUint64(1))
} }
if err == nil || err == errExecutionReverted { if err == nil || err == errExecutionReverted {
ret = common.CopyBytes(ret)
memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) memory.Set(retOffset.Uint64(), retSize.Uint64(), ret)
} }
contract.Gas += returnGas contract.Gas += returnGas
......
...@@ -276,7 +276,7 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) ( ...@@ -276,7 +276,7 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
// if the operation clears the return data (e.g. it has returning data) // if the operation clears the return data (e.g. it has returning data)
// set the last return to the result of the operation. // set the last return to the result of the operation.
if operation.returns { if operation.returns {
in.returnData = common.CopyBytes(res) in.returnData = res
} }
switch { switch {
......
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