Skip to content

Withdraw context words read their own column or revert - #2927

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

thedavidmeister merged 3 commits into
mainfrom
context-column-withdraw

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR 2 of 4, based on context-column-deposit (#2926). Split from #2921 (one context column per PR). Advances #2647.

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

Problem

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

Fix

  • CALLING_CONTEXT_COLUMNS = 6; new CONTEXT_WITHDRAW_COLUMN = 6, filled only by withdraw4 post: [token, vaultId, before, after, target, decimals, msg.sender] via LibRaindex.callingContextColumn.
  • withdraw-* words read column 6; withdrawer reads (6,6) (new subParserWithdrawer).
  • Signers move to column 7, signed context starts at 8 (derived from CONTEXT_COLUMNS); CONTEXT_COLUMNS_EXTENDED = CONTEXT_SIGNED_CONTEXT_START_COLUMN + 1; withdraw tables sit at CONTEXT_WITHDRAW_COLUMN.
  • order-clearer is unchanged here (PR3).

Why

Same mechanism as PR1: each entrypoint fills only its own columns, so a withdraw word read anywhere else panics out of bounds instead of reading another entrypoint's value. Full design rationale: #2921.

Evidence

  • RaindexV6.contextWordEntrypoints.t.sol: deposit- and withdraw-column words (withdraw-token, withdraw-vault-id, withdraw-vault-balance-before/after, withdraw-target-amount, withdraw-token-decimals, withdrawer) x {deposit4, withdraw4, addOrder4, removeOrder3, entask2, calculate-io, handle-io}: true value in their family, stdError.indexOOBError elsewhere. Calculate-io reads go through quote2 (since takeOrders4 skips an order whose calculate fails #2923 takeOrders4 skips a reverting calculate).
  • Routing / wiring tests updated to the layout; signer/signed-context tests renumbered.
  • Regen committed.
  • Full forge test: on 48f8128: 749 passed / 3 failed (752); the 3 are env/network (testIsStartBlockFlare, testSuitesLiveOnEverySupportedNetwork, testSupportedNetworkChainIdsAreBound, no FLARE_RPC_URL).

QA

  • Discriminating tests: RaindexV6ContextWordEntrypointsTest (testWithdrawContextWords, testDepositContextWords, testAddOrderContextWords, testRemoveOrderContextWords, testEntaskContextWords, testCalculateOrderContextWords, testHandleIOContextWords) over the withdraw-column words, testRouteWithdrawer. Fail on base (PR1): there withdraw words read column 1 (a wrong-entrypoint read returns order data instead of reverting) and withdrawer 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 withdraw-column words x all 7 entrypoints (deposit words from PR1 kept). Order words follow in PR3.

Migration

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

🤖 Generated with Claude Code

thedavidmeister and others added 3 commits October 26, 2026 17:23
withdraw4 post tasks get the withdraw values (plus msg.sender as the
withdrawer row) in a dedicated calling context column 6; every other
column is empty, so withdraw words read outside withdraw tasks revert
out of bounds. Signers move to column 7 and signed context to 8.

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

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 4 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 bf61b0c and 48f8128.

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: 14
  • 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/lib/LibTestContextWords.sol
  • 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-deposit to main October 26, 2026 19:25
@thedavidmeister
thedavidmeister merged commit aee4288 into main Oct 26, 2026
19 of 21 checks passed
@linear

linear Bot commented Oct 26, 2026

Copy link
Copy Markdown

RAI-3865

@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