Skip to content

[NONEVM-5607] Overflow Static Analyzer#802

Open
patricios-space wants to merge 6 commits into
mainfrom
sec/overflow-static-analyzer
Open

[NONEVM-5607] Overflow Static Analyzer#802
patricios-space wants to merge 6 commits into
mainfrom
sec/overflow-static-analyzer

Conversation

@patricios-space

@patricios-space patricios-space commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

@patricios-space patricios-space changed the title Sec: overflow static analyzer [NONEVM-5607] Overflow Static Analyzer Jul 21, 2026
@patricios-space
patricios-space force-pushed the sec/overflow-static-analyzer branch from b7b7082 to 3350b91 Compare July 21, 2026 17:28
@patricios-space
patricios-space marked this pull request as ready for review July 21, 2026 18:14
@patricios-space
patricios-space requested a review from a team as a code owner July 21, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a TypeScript static analyzer to detect Tolk ABI-serialized types that can overflow a single TON cell (1023 bits / 4 refs), including support for custom-serialized types via doc-comment bounds annotations, and wires it into both Yarn scripts and Nix tooling.

Changes:

  • Introduces scripts/overflowCheck.ts to compute worst-case bit/ref usage across ABI type graphs and report unsafe cell boundaries.
  • Adds a minimal TOML parser for Acton.toml and reuses it from abigen.ts.
  • Exposes the analyzer via yarn check-overflows and a default.nix overflow-check shell application; annotates CrossChainAddress serialization bounds.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
contracts/scripts/overflowCheck.ts New analyzer that walks ABI types, computes bounds, and aggregates reports/diagnostics across contracts.
contracts/scripts/acton/toml.ts New minimal TOML parser used to read Acton.toml contract entries.
contracts/scripts/abigen.ts Switches TOML parsing import to the new shared parser.
contracts/package.json Adds a Yarn script entry to run the overflow checker.
contracts/default.nix Adds overflow-check wrapper script for running the analyzer from Nix tooling.
contracts/contracts/ccip/common/types.tolk Adds ABI serialization bounds annotation for a custom-serialized type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +171 to +178
function widen(alternatives: Bounds[]): Bounds {
return alternatives.reduce((acc, b) => ({
minBits: Math.min(acc.minBits, b.minBits),
maxBits: Math.max(acc.maxBits, b.maxBits),
minRefs: Math.min(acc.minRefs, b.minRefs),
maxRefs: Math.max(acc.maxRefs, b.maxRefs),
}))
}
Comment thread contracts/contracts/ccip/common/types.tolk Outdated
Comment thread contracts/default.nix Outdated
Comment thread contracts/default.nix Outdated
Comment thread contracts/scripts/overflowCheck.ts Outdated
Base automatically changed from chore/migrate-to-abigen-offramp to main July 21, 2026 20:20
@patricios-space
patricios-space force-pushed the sec/overflow-static-analyzer branch from a83a9f5 to 9f9b14e Compare July 21, 2026 21:30
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.

2 participants