Skip to content

Signed-context row operand reverts past 255 instead of wrapping - #2930

Merged
thedavidmeister merged 2 commits into
mainfrom
context-signed-row-mask
Oct 26, 2026
Merged

thedavidmeister merged 2 commits into
mainfrom
context-signed-row-mask

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR 4 of 4, based on context-column-order (#2928). Split from #2921 (one context column per PR). Last PR of the stack: closes the three issues the stack advances.

Stack: PR1 deposit column (#2926) -> PR2 withdraw column (#2927) -> PR3 order column (#2928) -> PR4 signed-context row mask (this).

Problem

subParserSignedContext computed the row as (operand >> 8) & 0xFF (#2653). The operand handler (handleOperandDoublePerByteNoDefault) already rejects values above 255 with OperandOverflow, so the mask is redundant; and a wide row reaching the parser would wrap onto another row instead of reverting like a wide signer index (signer<256>, unmasked).

Fix

  • subParserSignedContext: row = operand >> 8 (drop the & 0xFF); the column-byte mask is kept; signers stay unmasked.
  • Tests: main's mask-pinning tests replaced by testSignedContextWideRowReverts (ContextGridOverflow(8, 256)); testSubParserContextSignerUnhappyIndexOverflow pins signer<256> -> ContextGridOverflow(7, 256).

Why

A wide row now reverts in LibSubParse.subParserContext exactly like a wide signer index, instead of wrapping onto a different row: a loud failure, never a silent wrong read.

Evidence

QA

Migration

  • Re-parse expressions with the new sub parser. A signed-context<c r> with r > 255 now fails parse instead of reading row r & 0xFF.
  • Whole stack: see PR1-PR3 migration notes (signers context<5 i> / <6+i j> -> <7 i> / <8+i j>; deposit context<1 n> -> <5 n>; withdraw context<1 n> -> <6 n>; clearer context<0 0> -> <1 3>; ContextV2 order column gains a 4th row).

Closes #2619
Closes #2647
Closes #2653

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Signed-context row values are no longer truncated. Values that exceed the supported range now produce a clear overflow error.
    • Signer lookups with an index outside the supported range, such as 256, now return an overflow error.

A row past 255 now reverts ContextGridOverflow like a signer index past
255, instead of wrapping onto another row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between c379154 and f113453.

Files ignored due to path filters: 2
  • src/generated/RaindexV6SubParserPointers.sol is excluded by !**/generated/**
  • src/generated/candidate/RaindexV6SubParser.sol is excluded by !**/generated/**
Files selected for processing: 4
  • crates/test_fixtures/abis/RaindexV6SubParser.json
  • src/lib/LibRaindexSubParser.sol
  • test/concrete/parser/RaindexV6SubParser.routingTokenDecimalsAndMasks.t.sol
  • test/concrete/parser/RaindexV6SubParser.signers.t.sol

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between eb5a3b2 and c379154.

Files ignored due to path filters: 2
  • src/generated/RaindexV6SubParserPointers.sol is excluded by !**/generated/**
  • src/generated/candidate/RaindexV6SubParser.sol is excluded by !**/generated/**
Files selected for processing: 4
  • crates/test_fixtures/abis/RaindexV6SubParser.json
  • src/lib/LibRaindexSubParser.sol
  • test/concrete/parser/RaindexV6SubParser.routingTokenDecimalsAndMasks.t.sol
  • test/concrete/parser/RaindexV6SubParser.signers.t.sol

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The signed-context parser now derives the row from the full operand value above its low byte, while retaining the low byte as the column. Tests assert overflow for row 256 in signed-context and signer parsing. The ABI fixture bytecode object was replaced; ABI entries are unchanged.

Changes: Context row bounds

Layer / File(s) Summary
Parser behavior and validation
src/lib/LibRaindexSubParser.sol, crates/test_fixtures/abis/RaindexV6SubParser.json, test/concrete/parser/RaindexV6SubParser.routingTokenDecimalsAndMasks.t.sol, test/concrete/parser/RaindexV6SubParser.signers.t.sol
The signed-context parser uses the full operand-derived row instead of masking it to one byte. Tests expect ContextGridOverflow for row 256 in signed-context and signer parsing. The ABI fixture bytecode object changed; ABI entries remain unchanged.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

Merge Risk: Minimal · previous review c3791

No actionable issue remains from this review; the change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #2653 is supported: subParserSignedContext now computes row with operand >> 8, keeps the column-byte mask, and adds a wide-row ContextGridOverflow(8, 256) test. The signer overflow test … Provide reviewable code and test evidence at the reviewed head for #2619 and #2647. The evidence must show that post-action context words are gated, withheld, or populated for each affected entrypoint, including the silent-alias and out-of-…
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: signed-context row operands above 255 now revert instead of wrapping.
Out of Scope Changes check Passed The source change removes one redundant signed-context row mask. The added tests cover wide signed-context rows and wide signer indices. The regenerated bytecode fixture supports the source change. No…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 …
Full details: Out of Scope Changes check

Explanation

The source change removes one redundant signed-context row mask. The added tests cover wide signed-context rows and wide signer indices. The regenerated bytecode fixture supports the source change. No unrelated change is shown.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)

Full details: Linked Issues check

Explanation

Issue #2653 is supported: subParserSignedContext now computes row with operand &gt;&gt; 8, keeps the column-byte mask, and adds a wide-row ContextGridOverflow(8, 256) test. The signer overflow test also checks ContextGridOverflow(7, 256). The available summary does not establish the implementation or tests for the #2619 and #2647 post-action context requirements. It only states that PRs 1–3 addressed those issues. A related pull request reference is not code evidence.

Resolution

Provide reviewable code and test evidence at the reviewed head for #2619 and #2647. The evidence must show that post-action context words are gated, withheld, or populated for each affected entrypoint, including the silent-alias and out-of-bounds cases.

Finishing Touches: 💡 2
⚔️ Resolve merge conflicts: 💡
  • Resolve merge conflict in branch context-signed-row-mask
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thedavidmeister
thedavidmeister changed the base branch from context-column-order to main October 26, 2026 22:29
Signed-context overflow tests derive their expected column from
CONTEXT_SIGNED_CONTEXT_START_COLUMN / CONTEXT_SIGNED_CONTEXT_SIGNERS_COLUMN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thedavidmeister
thedavidmeister merged commit 823ebfe into main Oct 26, 2026
18 of 20 checks passed
@linear

linear Bot commented Oct 26, 2026

Copy link
Copy Markdown

RAI-3903

@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment