How to read a remote contract's state
The Quickstart flagged in gotcha 2 of card 04 that an entry counts only in its block; this card is static reads in full: what a read of the proxy really answers, and how a routed read resolves.
The contract you want to read lives on another rollup. Here it has a stand-in — a proxy — and that proxy is a real contract on this chain, with its own code and its own balance.
So inspecting it answers about it. This is the caveat with no compiler help: the read succeeds and hands back a real number about the wrong contract. The fix is to call through the proxy instead of inspecting it.
- 01 · A CONTRACT ON THIS CHAINOnce created, the proxy is a contract here, so opcodes answer about it, not about the contract it stands for.
- 02 · THREE READS, NO REVERTbalance, extcodesize and extcodecopy describe the proxy; block-state opcodes describe this chain. A delegatecall into the proxy reverts instead.
- 03 · ASK IT, DON'T INSPECT ITA routed read resolves against a pre-computed entry, or reverts (ExecutionNotFound() on L1, EntryNotFound on L2) — and the forwarded revert data usually tells that from the destination reverting, but don't branch on it.
RUN IT YOURSELF · forge test --match-test test_routedReadReturnsThePreCommittedEntry -vv — from eez-demos/snippets, Foundry only.
Verified against eez-core-protocol Git commit 9a1f815; interfaces may move.