Skip to content

fix(core): resolve token symbols for silent contracts in state diff summary - #159

Merged
Th0rgal merged 1 commit into
mainfrom
fix/silent-contract-symbols
Feb 25, 2026
Merged

fix(core): resolve token symbols for silent contracts in state diff summary#159
Th0rgal merged 1 commit into
mainfrom
fix/silent-contract-symbols

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Feb 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • summarizeStateDiffs now accepts optional chainId and falls back to the shared resolveTokenMeta() registry when no event-derived token symbol is available
  • Silent contracts (storage changes without events) that are well-known tokens now show proper symbols (e.g. "USDC") instead of raw addresses
  • Removes unused TokenMeta type import from event-decoder.ts

Why this matters

Silent contracts are the most suspicious entries in the state diff summary — they signal hidden effects like allowance consumption via transferFrom without an Approval event. Showing the token symbol makes them immediately identifiable to users reviewing the transaction.

Before: Silent USDC contract shows as 0xa0b8... with no token badge
After: Silent USDC contract shows with a "USDC" badge, making it clear what token had hidden storage changes

Changes

File Change
simulation/summary.ts Add chainId? param, fall back to resolveTokenMeta for symbol resolution
simulation/event-decoder.ts Remove unused TokenMeta type import
desktop/VerifyScreen.tsx Pass evidence.chainId to summarizeStateDiffs
generator/page.tsx Pass evidence.chainId to summarizeStateDiffs
simulation/__tests__/summary.test.ts 4 new tests

Test plan

  • 4 new tests: silent contract resolution, multi-chain (Polygon USDC), event-symbol priority, unknown contract null fallback
  • All 621 tests pass (4 new + 617 existing)
  • Type-check clean (desktop + generator)
  • Backward compatible — chainId is 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 summarizeStateDiffs with an optional chainId and falling back to the well-known token registry when no event-derived symbol exists.

Updates desktop VerifyScreen and the generator UI to pass chainId into summarizeStateDiffs, removes an unused TokenMeta import, 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.

…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>
@vercel

vercel Bot commented Feb 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
safe-lens-generator Building Building Preview, Comment Feb 25, 2026 10:30am

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Th0rgal
Th0rgal merged commit 46ec887 into main Feb 25, 2026
4 checks passed
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.

1 participant