feat(common): decoding external contracts - #16766
Open
sakulstra wants to merge 18 commits into
Open
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sakulstra
requested review from
0xrusowsky,
DaniPopes,
figtracer,
grandizzy,
mablr,
mattsse and
stevencartavia
as code owners
September 9, 2026 16:21
Contributor
✅ Changelog foundThe deterministic check will validate the changed entry. |
Decode storage writes with the recorded bytecode address and chain instead of following current explorer proxy hints. Reuse local layouts only when the recorded chain and fork match the active context, prefer exact bytecode matches over proxy heuristics, and omit ambiguous layouts. Bound explorer requests, lock waits, compiler installation, and solc execution by lookup deadlines without replenishing the shared identifier's cumulative budget. Compile inline verified sources in an empty working directory, disable import callbacks where supported, and kill timed-out compiler processes. Preserve contract and enum array dimensions, publish layout cache entries through unique temporary files, and leave transient explorer errors unresolved. Keep unverified results memoized only for the current run. Cover array parsing, cumulative budgets, cache behavior, compiler timeouts, and delegated storage decoding with regression tests.
mablr
reviewed
Sep 10, 2026
Member
There was a problem hiding this comment.
Hi @sakulstra,
Reviewed your PR and applied some fixes, please have a look to 38d18ee.
figtracer
requested changes
Sep 10, 2026
| /// Walks the proxy chain of every address, fetching the metadata of each link as it goes. | ||
| /// | ||
| /// Returns one [`ProxyChain`] per input address, in the same order. | ||
| async fn resolve_proxy_chains(&mut self, addresses: &[Address]) -> Vec<ProxyChain> { |
Member
There was a problem hiding this comment.
optional scope cleanup: could we keep the existing get_abis proxy traversal and leave this refactor out? get_metadata deliberately fetches exact addresses and never uses resolve_proxy_chains, so the new ProxyChain/Stop machinery expands the review surface without serving the storage-layout feature.
Normalize in-root parent components without allowing remappings to escape the source root. Leave expired storage-layout compilations unresolved so later lookups can retry with a fresh budget. AI-assisted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
A couple months ago i started #13417 and while i completely forgot about that pr, seems like multiple other ppl would appreciate it as well #13304 (comment) so trying to revive it against current foundry.
Adding state decoding for external contracts in storage diffs. This features is incredibly handy when simulating complex contract upgrades or when simulating complex transactions (or even for seemingly trivial ones).
Solution
Introducing a new flag
decode_external_storagethat fetches external contract sources from explorers, so we can render a rich diff in json state diff.PR Checklist