Skip to content

Deposit context words read their own column or revert - #2926

Merged
thedavidmeister merged 3 commits into
mainfrom
context-column-deposit
Oct 26, 2026
Merged

thedavidmeister merged 3 commits into
mainfrom
context-column-deposit

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR 1 of 4, based on main. Split from #2921 (one context column per PR). Advances #2647.

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

Problem

The deposit post task wrote its data into calling-context column 1, the same column order words read. So order-hash() in a deposit task silently returned the deposit token, and deposit-* words in an add-order task silently returned order data (#2647). depositor() aliased base (0,0) and read a value in every entrypoint.

Fix

  • CALLING_CONTEXT_COLUMNS = 5; new CONTEXT_DEPOSIT_COLUMN = 5, filled only by deposit4 post: [token, vaultId, before, after, decimals, msg.sender] via LibRaindex.callingContextColumn.
  • deposit-* words read column 5; depositor reads (5,5) (new subParserDepositor).
  • Signers / signed-context columns derive from CONTEXT_COLUMNS (signers = 6, signed start = 7).
  • Sub parser deposit tables sit at index CONTEXT_DEPOSIT_COLUMN; withdraw tables at CONTEXT_SIGNED_CONTEXT_START_COLUMN + 1 until PR2.
  • Withdraw words, order-clearer and withdrawer are unchanged here (PR2 / PR3).

Why

Each entrypoint fills only its own columns, so a deposit word read anywhere else panics out of bounds instead of reading another entrypoint's value. Zero-filled rows would be the same silent wrong value. Full design rationale: #2921.

Evidence

  • RaindexV6.contextWordEntrypoints.t.sol: deposit-column words (deposit-token, deposit-vault-id, deposit-vault-balance-before/after, deposit-token-decimals, depositor) x {deposit4, withdraw4, addOrder4, removeOrder3, entask2, calculate-io, handle-io}: true value in deposit4, stdError.indexOOBError elsewhere.
  • Routing / wiring tests updated to the layout; signer/signed-context tests renumbered.
  • Merged main @ 9571c50 (takeOrders4 skips an order whose calculate fails #2923); regen committed (build-meta.sh, Build.sol until stable, forge build, script/build.sh, forge fmt).
  • Full forge test: on 0b5338f: 752 passed / 3 failed (755); the 3 are env/network (testIsStartBlockFlare, testSuitesLiveOnEverySupportedNetwork, testSupportedNetworkChainIdsAreBound, no FLARE_RPC_URL).

QA

  • Discriminating tests: RaindexV6ContextWordEntrypointsTest (testDepositContextWords, testWithdrawContextWords, testAddOrderContextWords, testRemoveOrderContextWords, testEntaskContextWords, testCalculateOrderContextWords, testHandleIOContextWords) over the deposit-column words, testRouteDepositor. Fail on base: there deposit words read column 1 (a wrong-entrypoint read returns order data instead of reverting) and depositor reads base (0,0).
  • Mutations applied: pending (mutation pass running on this head; results will be added here).
  • Oracle: values the test itself passes to each entrypoint (msg.sender via prank, token, vault id, amounts), independent of the sub parser and LibRaindex.
  • Category check: Post-action context: subparser words silently alias other fields or revert OOB (generalizes Protofire M02 #2619) #2647 asks that every post-action word read its true value or revert; this PR covers the deposit-column words x all 7 entrypoints. Withdraw and order words follow in PR2 / PR3.

Migration

  • Re-parse expressions with the new sub parser.
  • Raw signer reads context<5 i> / context<6+i j> -> context<6 i> / context<7+i j>.
  • Raw deposit-task reads context<1 n> -> context<5 n>.

🤖 Generated with Claude Code

thedavidmeister and others added 2 commits October 26, 2026 17:09
Deposit tasks get a dedicated context column (5) holding
[token, vaultId, before, after, decimals, depositor]; every other
entrypoint leaves it empty, so deposit-* words outside deposit tasks
revert out of bounds instead of reading column 1. depositor reads (5,5).
Signers/signed context move to 6/7, derived from CONTEXT_COLUMNS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 52 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 de93f0d and 0b5338f.

Files selected for processing: 1
  • test/concrete/raindex/RaindexV6.contextWordEntrypoints.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 9571c50 and de93f0d.

Files ignored due to path filters: 6
  • src/generated/RaindexV6SubParserPointers.sol is excluded by !**/generated/**
  • src/generated/candidate/GenericPoolRaindexV6ArbOrderTaker.sol is excluded by !**/generated/**
  • src/generated/candidate/GenericPoolRaindexV6FlashBorrower.sol is excluded by !**/generated/**
  • src/generated/candidate/RaindexV6.sol is excluded by !**/generated/**
  • src/generated/candidate/RaindexV6SubParser.sol is excluded by !**/generated/**
  • src/generated/candidate/RouteProcessorRaindexV6ArbOrderTaker.sol is excluded by !**/generated/**
Files selected for processing: 15
  • crates/test_fixtures/abis/RaindexV6.json
  • crates/test_fixtures/abis/RaindexV6SubParser.json
  • meta/RaindexV6SubParser.rain.meta
  • meta/RaindexV6SubParserAuthoringMeta.rain.meta
  • src/concrete/parser/RaindexV6SubParser.sol
  • src/concrete/raindex/RaindexV6.sol
  • src/lib/LibRaindex.sol
  • src/lib/LibRaindexSubParser.sol
  • test/concrete/parser/RaindexV6SubParser.operandHandlersWiring.t.sol
  • test/concrete/parser/RaindexV6SubParser.routing.t.sol
  • test/concrete/parser/RaindexV6SubParser.routingTokenDecimalsAndMasks.t.sol
  • test/concrete/parser/RaindexV6SubParser.wordParsersWiring.t.sol
  • test/concrete/raindex/RaindexV6.contextWordEntrypoints.t.sol
  • test/util/fixture/LibRaindexSubParserContextFixture.sol
  • test/util/lib/LibTestContextWords.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 context layout adds a deposit column and depositor row. Deposit and withdraw parser routing changes to match the layout. Tests cover parser routing and deposit context words across task and order-evaluation entrypoints.

Changes: Deposit Context Column Layout

Layer / File(s) Summary
Context layout and deposit construction
src/lib/LibRaindex.sol, src/concrete/raindex/RaindexV6.sol, test/util/fixture/LibRaindexSubParserContextFixture.sol
The context layout adds a deposit column and depositor row. deposit4 builds the deposit context in that column and includes msg.sender. The fixture sizes its context array from the updated signed-context position.
Deposit and withdraw parser routing
src/concrete/parser/RaindexV6SubParser.sol, src/lib/LibRaindexSubParser.sol
Deposit words, metadata, and operand handlers route to the deposit column. Withdraw and signed-context routing use the revised column positions.
Parser table and routing tests
test/concrete/parser/RaindexV6SubParser.*.t.sol
Parser wiring and routing tests reflect the updated deposit, signer, signed-context, and withdraw positions.
Entrypoint coverage and compiled fixtures
test/concrete/raindex/RaindexV6.contextWordEntrypoints.t.sol, test/util/lib/LibTestContextWords.sol, crates/test_fixtures/abis/RaindexV6*.json
New tests check deposit context words across task and order-evaluation entrypoints. A helper provides the deposit word expressions, and the ABI fixture bytecode payloads are replaced.

Priority: Pending latest changes

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

Merge Risk: Minimal · up to de93f

No confirmed issue prevents merging. Complete the pending tests and fixture checks as part of normal validation.

Pre-merge checks: Passed 5
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 primary change: deposit context words now use their dedicated column or revert when out of bounds.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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

Finishing Touches: 💡 1
🛠️ 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.

… take

takeOrders4 skips an order whose calculate reverts, so a calculate-io
read must be checked where the revert bubbles, and a positive take must
prove the order was taken.

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

linear Bot commented Oct 26, 2026

Copy link
Copy Markdown

RAI-3864

@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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant