Repository navigation
Feat/onchain history mode - #1
Merged
Merged
Conversation
…y-type collisions Two facets that independently declare the same elementary-typed variable (for example address owner) at the same slot previously collapsed to one declaration key and went undetected, because solc embeds the astId in struct type ids but not in elementary type ids. Keying declarationKey on the underlying VariableDeclaration astId closes that false negative while keeping genuinely inherited shared state, which carries one stable astId across artifacts, correctly unflagged.
A build without ast = true ran only the storage-layout analyzers while the namespace, EIP-7201, and inline-assembly analyzers silently produced nothing, and the CLI still exited 0, so a misconfigured CI passed green on a scan that checked almost nothing. The CLI now exits 2 in that case. The decision is extracted into a pure decideCoverageAction so the fail-closed policy is unit tested rather than buried in the action handler, and --allow-missing-ast downgrades it to a warning for a deliberate storage-layout-only scan.
The inline ERC-7201 formula matcher accepted any bitwise-and, so a constant masked with a value other than ~bytes32(uint256(0xff)) was misread as ERC-7201 and assigned the standard slot it does not occupy. The matcher now requires the ~ and the 0xff literal of the canonical low-byte clear.
… registered
Static scans only see facets that compile today, but storage persists after a
facet is removed, so the real collision space is every region the proxy has ever
used. History mode reconstructs that set from the chain:
- replay the DiamondCut event log (read from Etherscan's logs endpoint, since
free RPC tiers cap eth_getLogs to as few as 10 blocks) to recover every facet
address ever registered, removed ones included
- fetch each facet's verified source from Etherscan and recompile it with its
exact solc version so AST and storage layout match what was deployed
- run the existing five analyzers over the union; shared libraries keep one
canonical source path so they do not false-positive against themselves
New flags: --onchain <address>, --rpc, --etherscan-key, --chainid. detect() now
accepts preloaded artifacts so the offline Foundry path is unchanged. Adds offline
tests for the event decoder and the Etherscan source-format parser.
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.
No description provided.