Skip to content

Traces as of 1.10.9 do not include memory (or storage as of 1.0.5) #24146

@haltman-at

Description

@haltman-at

System information

Geth version: 1.10.9 and up for memory; 1.10.5 and up for storage (most recent at time of submission: 1.10.13)
OS & Version: Linux

Expected behaviour

Traces obtained from debug_traceTransaction ought to include memory (and storage).

Actual behaviour

No memory field (nor storage) is present.

Steps to reproduce the behaviour

Do a debug_traceTransaction on Geth 1.10.9 or higher (at least up to 1.10.13, the most recent at time of submission), or on 1.10.5 or higher if you just want to see the problem for storage.

Significance

I'm reporting this as a bug even though it's possible it was a deliberate decision. But, doing this makes Geth traces (as of 1.10.9) unusable with Truffle Debugger and presumably other debuggers. Right now Truffle Debugger will just crash; we can of course fix the crash, but then we're still stuck with no memory! What do we do, just pretend the memory is all zero? We could of course attempt to keep track of memory ourself, and this might not seem unreasonable, as we already do this with storage; but in actual fact I don't think this is quite so feasible as that due to how many things can alter memory, whereas storage can only be interacted with via SSTORE and SLOAD.

(Edit: Actually, I forgot, we do actually still use storage in certain cases.)

By contrast, with memory, in addition to being able to store things to it from the stack, one can also read things into it from other locations, such as code, calldata, or returndata; and old-style CALLs, with a nonempty output region set, will write to it directly. I don't think it's practical for the debugger itself to compute all this. The worst case is that of precompiled contracts, where, in order for us to get the output (whether written directly into memory or copied into memory from returndata), we'd have to actually compute it ourselves, because there are no trace steps to go by. (And some languages, such as Vyper, do in fact use precompile 0x4 to copy memory around...) I don't think it's reasonable for the debugger to compute outputs of precompiles.

So, please restore memory (and storage) to traces! Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions