core/vm, cmd/evm: standard vm traces#15035
Conversation
holiman
left a comment
There was a problem hiding this comment.
I'm for these changes. They introduce one more if-debug block in the main interpreter loop, but I don't see quite how to get around that. If we want to optimize the evm, there are several other things we can do to shave off some time.
The main crux that this PR handles is that when the CALL gas is shaved down to 63/64 of the total gas, that operation is performed during the operation.gasCost(in.gasTable, in.evm, contract, stack, mem, memorySize) call. When this happens, the actual gas value on the stack is replaced . This PR thus makes a (shallow) copy of the stack (if debug is true), once every loop.
@fjl suggested that a better fix is to remove the swap-gas-stackitem-for-63/64 hack and instead use some callGas in the interpreter object, or somewhere.
That is probably a good idea, but I feel it's a bit too invasive at this point (with metro-changes to the evm already in progress) , and I don't feel comfortable doing that right now.
So I'm all for this patch. The standard vm traces are important for testing metro, and we've already found a post-metro consensus issue using fuzz testing.
fjl
left a comment
There was a problem hiding this comment.
I’m fine with this PR, but I doubt that the temporary hack will ever be removed.
There was a problem hiding this comment.
Please use
// copies used by tracer
stackCopy = newstack() // needed for Tracer since stack is mutated by 63/64 gas rule
pcCopy uint64 // needed for the deferred Tracer
gasCopy uint64 // for Tracer to log gas remaining before execution
logged bool // deferred Tracer should ignore already logged steps8167688 to
f84f368
Compare
|
@fjl I made the requested changes. |
Some standardization (ethereum/tests#249) fixes for EVM traces.