Repository navigation
Deposit context words read their own column or revert - #2926
Conversation
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>
|
Warning Review limit reachedYou'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. View limit details
No actionable comments were generated in the recent review.
|
| 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:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Possibly related issues
- rainlanguage/raindex#2908: The issue concerns signer and signed-context column resolution, which this change updates.
Possibly related PRs
- rainlanguage/raindex.deploy#2921: It changes the same context layout and parser table, with conflicting deposit and signer column assignments.
- rainlanguage/raindex.deploy#2917: Its context padding and signer tests depend on the column count and signer positions changed here.
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: 
5
-
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.
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>
|
@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:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
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, anddeposit-*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; newCONTEXT_DEPOSIT_COLUMN = 5, filled only bydeposit4post:[token, vaultId, before, after, decimals, msg.sender]viaLibRaindex.callingContextColumn.deposit-*words read column 5;depositorreads(5,5)(newsubParserDepositor).CONTEXT_COLUMNS(signers = 6, signed start = 7).CONTEXT_DEPOSIT_COLUMN; withdraw tables atCONTEXT_SIGNED_CONTEXT_START_COLUMN + 1until PR2.order-clearerandwithdrawerare 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.indexOOBErrorelsewhere.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).forge test: on 0b5338f: 752 passed / 3 failed (755); the 3 are env/network (testIsStartBlockFlare,testSuitesLiveOnEverySupportedNetwork,testSupportedNetworkChainIdsAreBound, noFLARE_RPC_URL).QA
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) anddepositorreads base(0,0).msg.sendervia prank, token, vault id, amounts), independent of the sub parser andLibRaindex.Migration
context<5 i>/context<6+i j>->context<6 i>/context<7+i j>.context<1 n>->context<5 n>.🤖 Generated with Claude Code