fix(core): resolve token symbols for silent contracts in state diff summary - #159
Merged
Conversation
…ummary
`summarizeStateDiffs` previously resolved token symbols only from decoded
events. Contracts that modified storage without emitting events ("silent
contracts") always showed `tokenSymbol: null`, even when they are
well-known tokens like USDC or WETH.
This matters because silent contracts are the most suspicious entries in
the state diff summary — they signal hidden effects (e.g. allowance
consumption via `transferFrom` without an `Approval` event). Showing the
token symbol makes them immediately identifiable instead of showing only
a raw address.
Changes:
- Add optional `chainId` parameter to `summarizeStateDiffs()`
- Fall back to shared `resolveTokenMeta()` when no event-derived symbol
is available, giving silent contracts proper token labels
- Pass `evidence.chainId` from both desktop and generator call sites
- Remove unused `TokenMeta` type import from event-decoder.ts
- 4 new tests: silent contract resolution, multi-chain, event priority,
unknown contract null fallback
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
summarizeStateDiffsnow accepts optionalchainIdand falls back to the sharedresolveTokenMeta()registry when no event-derived token symbol is availableTokenMetatype import fromevent-decoder.tsWhy this matters
Silent contracts are the most suspicious entries in the state diff summary — they signal hidden effects like allowance consumption via
transferFromwithout anApprovalevent. Showing the token symbol makes them immediately identifiable to users reviewing the transaction.Before: Silent USDC contract shows as
0xa0b8...with no token badgeAfter: Silent USDC contract shows with a "USDC" badge, making it clear what token had hidden storage changes
Changes
simulation/summary.tschainId?param, fall back toresolveTokenMetafor symbol resolutionsimulation/event-decoder.tsTokenMetatype importdesktop/VerifyScreen.tsxevidence.chainIdtosummarizeStateDiffsgenerator/page.tsxevidence.chainIdtosummarizeStateDiffssimulation/__tests__/summary.test.tsTest plan
chainIdis optional, existing callers without it still work🤖 Generated with Claude Code
Note
Low Risk
Small, additive change to summary formatting logic plus UI call-site wiring; low risk with new unit tests validating symbol resolution behavior.
Overview
Fixes state-diff summaries so "silent" contracts (storage changes without decoded events) can still display a token badge by extending
summarizeStateDiffswith an optionalchainIdand falling back to the well-known token registry when no event-derived symbol exists.Updates desktop
VerifyScreenand the generator UI to passchainIdintosummarizeStateDiffs, removes an unusedTokenMetaimport, and adds targeted tests covering registry resolution (including multi-chain USDC), event-symbol precedence, and unknown-token behavior.Written by Cursor Bugbot for commit aaf9e95. This will update automatically on new commits. Configure here.