Skip to content

Commit 3e794a0

Browse files
Deposit context words read their own column or revert
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>
1 parent f971796 commit 3e794a0

21 files changed

Lines changed: 423 additions & 317 deletions

‎crates/test_fixtures/abis/RaindexV6.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎crates/test_fixtures/abis/RaindexV6SubParser.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎meta/RaindexV6SubParser.rain.meta‎

2 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

‎src/concrete/parser/RaindexV6SubParser.sol‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import {
5151
CONTEXT_CALCULATIONS_ROW_MAX_OUTPUT,
5252
CONTEXT_CALCULATIONS_ROWS,
5353
CONTEXT_CALLING_CONTEXT_ROW_ORDER_COUNTERPARTY,
54+
CONTEXT_DEPOSIT_COLUMN,
5455
CONTEXT_CALLING_CONTEXT_ROW_ORDER_OWNER,
5556
CONTEXT_CALLING_CONTEXT_ROW_ORDER_HASH,
5657
CONTEXT_CALLING_CONTEXT_ROWS,
@@ -167,7 +168,7 @@ contract RaindexV6SubParser is BaseRainlangSubParser {
167168
contextDepositContextHandlers[DEPOSIT_WORD_VAULT_AFTER] = LibParseOperand.handleOperandDisallowed;
168169
contextDepositContextHandlers[DEPOSIT_WORD_TOKEN_DECIMALS] = LibParseOperand.handleOperandDisallowed;
169170

170-
handlers[CONTEXT_SIGNED_CONTEXT_START_COLUMN + 1] = contextDepositContextHandlers;
171+
handlers[CONTEXT_DEPOSIT_COLUMN] = contextDepositContextHandlers;
171172

172173
function(bytes32[] memory) internal pure returns (OperandV2)[] memory contextWithdrawContextHandlers =
173174
new function(bytes32[] memory) internal pure returns (OperandV2)[](WITHDRAW_WORDS_LENGTH);
@@ -179,7 +180,7 @@ contract RaindexV6SubParser is BaseRainlangSubParser {
179180
contextWithdrawContextHandlers[WITHDRAW_WORD_TARGET_AMOUNT] = LibParseOperand.handleOperandDisallowed;
180181
contextWithdrawContextHandlers[WITHDRAW_WORD_TOKEN_DECIMALS] = LibParseOperand.handleOperandDisallowed;
181182

182-
handlers[CONTEXT_SIGNED_CONTEXT_START_COLUMN + 2] = contextWithdrawContextHandlers;
183+
handlers[CONTEXT_SIGNED_CONTEXT_START_COLUMN + 1] = contextWithdrawContextHandlers;
183184

184185
uint256[][] memory handlersUint256;
185186
assembly ("memory-safe") {
@@ -275,14 +276,14 @@ contract RaindexV6SubParser is BaseRainlangSubParser {
275276
internal
276277
view returns (bool, bytes memory, bytes32[] memory)[](DEPOSIT_WORDS_LENGTH);
277278

278-
depositParsers[DEPOSIT_WORD_DEPOSITOR] = LibRaindexSubParser.subParserSender;
279+
depositParsers[DEPOSIT_WORD_DEPOSITOR] = LibRaindexSubParser.subParserDepositor;
279280
depositParsers[DEPOSIT_WORD_TOKEN] = LibRaindexSubParser.subParserDepositToken;
280281
depositParsers[DEPOSIT_WORD_VAULT_ID] = LibRaindexSubParser.subParserDepositVaultId;
281282
depositParsers[DEPOSIT_WORD_VAULT_BEFORE] = LibRaindexSubParser.subParserDepositVaultBalanceBefore;
282283
depositParsers[DEPOSIT_WORD_VAULT_AFTER] = LibRaindexSubParser.subParserDepositVaultBalanceAfter;
283284
depositParsers[DEPOSIT_WORD_TOKEN_DECIMALS] = LibRaindexSubParser.subParserDepositTokenDecimals;
284285

285-
parsers[CONTEXT_SIGNED_CONTEXT_START_COLUMN + 1] = depositParsers;
286+
parsers[CONTEXT_DEPOSIT_COLUMN] = depositParsers;
286287

287288
// Withdraws
288289

@@ -300,7 +301,7 @@ contract RaindexV6SubParser is BaseRainlangSubParser {
300301
withdrawParsers[WITHDRAW_WORD_TARGET_AMOUNT] = LibRaindexSubParser.subParserWithdrawTargetAmount;
301302
withdrawParsers[WITHDRAW_WORD_TOKEN_DECIMALS] = LibRaindexSubParser.subParserWithdrawTokenDecimals;
302303

303-
parsers[CONTEXT_SIGNED_CONTEXT_START_COLUMN + 2] = withdrawParsers;
304+
parsers[CONTEXT_SIGNED_CONTEXT_START_COLUMN + 1] = withdrawParsers;
304305

305306
uint256[][] memory parsersUint256;
306307
assembly ("memory-safe") {

‎src/concrete/raindex/RaindexV6.sol‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {LibOrder} from "../../lib/LibOrder.sol";
5252
import {
5353
CALLING_CONTEXT_COLUMNS,
5454
CONTEXT_CALLING_CONTEXT_COLUMN,
55+
CONTEXT_DEPOSIT_COLUMN,
5556
CONTEXT_CALCULATIONS_COLUMN,
5657
CONTEXT_CALCULATIONS_ROWS,
5758
CONTEXT_VAULT_IO_BALANCE_DIFF,
@@ -175,13 +176,15 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
175176

176177
if (post.length != 0) {
177178
LibRaindex.doPost(
178-
LibBytes32Matrix.matrixFrom(
179+
LibRaindex.callingContextColumn(
180+
CONTEXT_DEPOSIT_COLUMN,
179181
LibBytes32Array.arrayFrom(
180182
bytes32(uint256(uint160(token))),
181183
bytes32(vaultId),
182184
Float.unwrap(beforeBalance),
183185
Float.unwrap(afterBalance),
184-
bytes32(uint256(decimals))
186+
bytes32(uint256(decimals)),
187+
bytes32(uint256(uint160(msg.sender)))
185188
)
186189
),
187190
post

‎src/generated/RaindexV6SubParserPointers.sol‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ pragma solidity ^0.8.25;
55
// THIS FILE IS AUTOGENERATED BY THE BUILD SCRIPT. DO NOT EDIT BY HAND.
66

77
/// @dev Hash of the known bytecode.
8-
bytes32 constant BYTECODE_HASH = bytes32(0xb5f18596862c369ecb1bc3cf69399785a578427214d9372d94d0fde2ed0ecaeb);
8+
bytes32 constant BYTECODE_HASH = bytes32(0x1229c3e90ccea550ef1fb1a77f54ff7b8b3339800da312a645093454b964a007);
99

1010
/// @dev The hash of the meta that describes the contract.
11-
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xf2d0eca454c544ab10f9991c019349475a416e38494f112a50807174c3000d0b);
11+
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x7e92d4e954f131b7ce6471bc48157dc3125be0b90c8c9e26855b88218d95eb20);
1212

1313
/// @dev The parse meta that is used to lookup word definitions.
1414
/// The structure of the parse meta is:
@@ -27,7 +27,7 @@ bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xf2d0eca454c544ab10f9991c0193
2727
/// bit count of the previous bloom filter. If we reach the end of the bloom
2828
/// filters then we have a miss.
2929
bytes constant PARSE_META =
30-
hex"0101180010800082000100010480300038412a001810000010020004200004002038038ff54900cc66c61ff3dcab0616592209895f0b16fec9301b02e0920c5bfe561d21609201e959460b1974270f844db208bcd3bf1e989376111049db13b934301a0ae9a00af82a7805c138f40d28083f0742ef2104d561fd1415a13317716a6119d260cc107b9bfc0eec7ade15cba2891c6b14a512792bdb02e0f14718565589";
30+
hex"0101180010800082000100010480300038412a001810000010020004200004002038038ff54900cc66c61ff3dcab0616592209895f0b14fec9301b02e0920c5bfe561d21609201e959460b1974270f844db208bcd3bf1e989376171049db11b934301a0ae9a00af82a7805c138f40d28083f0742ef2104d561fd1215a13315716a6119d260cc107b9bfc0eec7ade13cba2891c6b14a518792bdb02e0f14716565589";
3131

3232
/// @dev The build depth of the parser meta.
3333

@@ -39,13 +39,13 @@ uint8 constant PARSE_META_BUILD_DEPTH = 1;
3939
/// to things that happen entirely on the interpreter such as well known
4040
/// constants and references to the context grid.
4141
bytes constant SUB_PARSER_WORD_PARSERS =
42-
hex"16cc16e916f8170717161726173517451754176417741783179317a217b217c217d217e117f016cc16f8170717161825183516cc16f817071716182518351845";
42+
hex"170617231732174117501760176f177f178e179e17ae17bd17cd17dc17ec17fc180c1880188f189e18ae18be18ce181b1834170617321741175018de18ee18fe";
4343

4444
/// @dev Every two bytes is a function pointer for an operand handler.
4545
/// These positional indexes all map to the same indexes looked up in the parse
4646
/// meta.
4747
bytes constant OPERAND_HANDLER_FUNCTION_POINTERS =
48-
hex"1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1c151cb11bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec1bec";
48+
hex"1ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51ca51cce1d6a1ca51ca51ca51ca51ca51ca51ca5";
4949

5050
/// @dev Every two bytes is a function pointer for a literal parser.
5151
/// Literal dispatches are determined by the first byte(s) of the literal

‎src/generated/candidate/GenericPoolRaindexV6ArbOrderTaker.sol‎

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

‎src/generated/candidate/GenericPoolRaindexV6FlashBorrower.sol‎

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

‎src/generated/candidate/RaindexV6.sol‎

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)