Skip to content

arbos/tracing: fix swapped caller/address in NewTracingInfo's fake Contract - #4772

Open
HusseinAdeiza wants to merge 1 commit into
OffchainLabs:masterfrom
HusseinAdeiza:fix/tracing-info-contract-swap
Open

HusseinAdeiza wants to merge 1 commit into
OffchainLabs:masterfrom
HusseinAdeiza:fix/tracing-info-contract-swap

Conversation

@HusseinAdeiza

Copy link
Copy Markdown

Fixes #4771

NewTracingInfo built its fake vm.Contract with vm.NewContract(to, from, ...), but go-ethereum's signature is NewContract(caller, address, ...) and ScopeContext.Address() reports the second argument. Every fake opcode emitted through this TracingInfo (RecordStorageGet/Set, CaptureEVMTraceForHostio, captureState) therefore carried a scope naming the caller instead of the executing contract, so prestateTracer recorded Stylus SLOAD/SSTOREs and non-ArbOS state writes under the sender's account (diff mode showed nothing for the contract).

Swap to NewContract(from, to, ...): caller = the message sender, address = the executing contract, matching the pattern already used in MockCall (tracing.go:87) and the semantics of the NewTracingInfo call sites in tx_processor.go.

Note for reviewers: full local verification of arbos/util requires the solgen codegen chain (contracts + contracts-legacy + safe-smart-account submodules plus a yarn/forge pipeline); the branch compiles at the file level and the change is a two-token argument-order fix confined to this struct literal. CI's solgen + tracer tests cover the behavior.

…ntract

NewTracingInfo built its fake vm.Contract with vm.NewContract(to, from, ...),
but go-ethereum's signature is NewContract(caller, address, ...) and
ScopeContext.Address() reports the second argument. Every fake opcode emitted
through this TracingInfo (RecordStorageGet/Set, CaptureEVMTraceForHostio,
captureState) therefore carried a scope naming the caller instead of the
executing contract, so prestateTracer recorded Stylus SLOAD/SSTOREs and
non-ArbOS state writes under the sender's account (diff mode showed nothing
for the contract).

Swap to NewContract(from, to, ...): caller = the message sender, address =
the executing contract, matching the pattern already used in MockCall
(tracing.go:87) and the semantics of the NewTracingInfo call sites in
tx_processor.go.

Fixes OffchainLabs#4771

Signed-off-by: Hussein Adeiza Yunusa <HusseinAdeiza@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@HusseinAdeiza

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prestateTracer misses Stylus storage writes and ArbOS store writes outside the ArbOS state account: fake opcodes name the caller as the contract

2 participants