Skip to content

Commit c3d2923

Browse files
Merge origin/main into 2026-10-26-raindex-v7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 parents 4391e03 + 823ebfe commit c3d2923

27 files changed

Lines changed: 469 additions & 262 deletions

‎.github/workflows/vercel-prod.yaml‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##
22
## SECURITY MODEL FOR VERCEL PRODUCTION DEPLOYS (READ BEFORE EDITING)
33
##
4-
## This workflow runs on main pushes in this repository:
4+
## This workflow runs only on manual dispatch against main in this repository:
55
## - The wrapper (checkout, nix, caches, build, Vercel pull + deploy, security
66
## hardening) lives in the rainix `rainix-vercel.yaml` reusable workflow; this
77
## file is a thin caller that selects the production environment and maps
@@ -10,28 +10,16 @@
1010
## workflow, never to the build step.
1111
##
1212
## WARNING: Changing any of the following may break the security model:
13-
## - Triggers (the main push + webapp paths).
13+
## - Triggers (manual dispatch only, main ref only).
1414
## - The reusable workflow ref / inputs.
1515
## If you modify this file, re-validate these invariants (and those in rainix).
1616
name: GitHub Actions Vercel Production Deployment
17+
# Manual so front-end changes ship only once the contracts they call are deployed.
1718
on:
18-
push:
19-
branches:
20-
- main
21-
# Only redeploy prod when something webapp-relevant changed (see
22-
# vercel-preview.yaml for the rationale) — a sol-only main merge shouldn't
23-
# rebuild + redeploy the webapp.
24-
paths:
25-
- 'packages/**'
26-
- 'crates/**'
27-
- 'package.json'
28-
- 'package-lock.json'
29-
- 'flake.nix'
30-
- 'flake.lock'
31-
- 'script/vercel-build.sh'
32-
- '.github/workflows/vercel-prod.yaml'
19+
workflow_dispatch:
3320
jobs:
3421
production:
22+
if: github.ref == 'refs/heads/main'
3523
uses: rainlanguage/rainix/.github/workflows/rainix-vercel.yaml@main
3624
with:
3725
environment: production

‎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‎

-24 Bytes
Binary file not shown.
64 Bytes
Binary file not shown.

‎src/concrete/parser/RaindexV6SubParser.sol‎

Lines changed: 5 additions & 0 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_CALLING_CONTEXT_ROW_ORDER_CLEARER,
5455
CONTEXT_DEPOSIT_COLUMN,
5556
CONTEXT_WITHDRAW_COLUMN,
5657
CONTEXT_CALLING_CONTEXT_ROW_ORDER_OWNER,
@@ -124,6 +125,8 @@ contract RaindexV6SubParser is BaseRainlangSubParser {
124125
contextCallingContextHandlers[CONTEXT_CALLING_CONTEXT_ROW_ORDER_OWNER] = LibParseOperand.handleOperandDisallowed;
125126
contextCallingContextHandlers[CONTEXT_CALLING_CONTEXT_ROW_ORDER_COUNTERPARTY] =
126127
LibParseOperand.handleOperandDisallowed;
128+
contextCallingContextHandlers[CONTEXT_CALLING_CONTEXT_ROW_ORDER_CLEARER] =
129+
LibParseOperand.handleOperandDisallowed;
127130

128131
function(bytes32[] memory) internal pure returns (OperandV2)[] memory contextCalculationsHandlers =
129132
new function(bytes32[] memory) internal pure returns (OperandV2)[](CONTEXT_CALCULATIONS_ROWS);
@@ -225,6 +228,8 @@ contract RaindexV6SubParser is BaseRainlangSubParser {
225228
contextCallingContextParsers[CONTEXT_CALLING_CONTEXT_ROW_ORDER_OWNER] = LibRaindexSubParser.subParserOrderOwner;
226229
contextCallingContextParsers[CONTEXT_CALLING_CONTEXT_ROW_ORDER_COUNTERPARTY] =
227230
LibRaindexSubParser.subParserOrderCounterparty;
231+
contextCallingContextParsers[CONTEXT_CALLING_CONTEXT_ROW_ORDER_CLEARER] =
232+
LibRaindexSubParser.subParserOrderClearer;
228233

229234
function(uint256, uint256, OperandV2) internal view returns (bool, bytes memory, bytes32[] memory)[] memory
230235
contextCalculationsParsers =

‎src/concrete/raindex/RaindexV6.sol‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ import {
6464
} from "../../lib/LibRaindex.sol";
6565
import {RaindexV6FlashLender} from "../../abstract/RaindexV6FlashLender.sol";
6666
import {LibBytes32Array} from "rain-solmem-0.1.28/src/lib/LibBytes32Array.sol";
67-
import {LibBytes32Matrix} from "rain-solmem-0.1.28/src/lib/LibBytes32Matrix.sol";
6867

6968
import {LibFormatDecimalFloat} from "rain-math-float-0.3.10/src/lib/format/LibFormatDecimalFloat.sol";
7069
import {
@@ -314,7 +313,10 @@ contract RaindexV6 is IRaindexV7, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
314313
/// with a context of the order hash and the caller.
315314
function _doOrderPost(bytes32 orderHash, TaskV3[] calldata post) internal {
316315
LibRaindex.doPost(
317-
LibBytes32Matrix.matrixFrom(LibBytes32Array.arrayFrom(orderHash, bytes32(uint256(uint160(msg.sender))))),
316+
LibRaindex.callingContextColumn(
317+
CONTEXT_CALLING_CONTEXT_COLUMN,
318+
LibBytes32Array.arrayFrom(orderHash, bytes32(uint256(uint160(msg.sender))))
319+
),
318320
post
319321
);
320322
}
@@ -346,6 +348,7 @@ contract RaindexV6 is IRaindexV7, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
346348
msg.sender,
347349
quoteConfig.signedContext,
348350
new bytes32[](0),
351+
false,
349352
false
350353
);
351354
// true is quote3's "order is live" result required by IRaindexV7.
@@ -436,7 +439,8 @@ contract RaindexV6 is IRaindexV7, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
436439
msg.sender,
437440
takeOrderConfig.signedContext,
438441
new bytes32[](0),
439-
true
442+
true,
443+
false
440444
);
441445

442446
// Skip orders that are too expensive rather than revert as we have
@@ -630,7 +634,8 @@ contract RaindexV6 is IRaindexV7, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
630634
bobOrder.owner,
631635
bobSignedContext,
632636
new bytes32[](0),
633-
false
637+
false,
638+
true
634639
);
635640
(, OrderIOCalculationV4 memory bobOrderIOCalculation) = calculateOrderIO(
636641
bobOrder,
@@ -639,7 +644,8 @@ contract RaindexV6 is IRaindexV7, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
639644
aliceOrder.owner,
640645
aliceSignedContext,
641646
new bytes32[](0),
642-
false
647+
false,
648+
true
643649
);
644650

645651
// Each side must be one `takeOrders5` would take. Given this, each
@@ -715,6 +721,8 @@ contract RaindexV6 is IRaindexV7, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
715721
/// single-order callers (`quote`, `clear4`).
716722
/// @param skipFailure If true, a reverting calculate eval or a stack shorter
717723
/// than `CALCULATE_ORDER_MIN_OUTPUTS` returns false instead of reverting.
724+
/// @param clearing Whether the order column includes the clearer row; true
725+
/// only for `clear4`.
718726
/// @return False if `skipFailure` caught a failure, in which case the
719727
/// calculation is zeroed and MUST NOT be used.
720728
/// @return The order IO calculation.
@@ -725,15 +733,23 @@ contract RaindexV6 is IRaindexV7, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
725733
address counterparty,
726734
SignedContextV2[] memory signedContext,
727735
bytes32[] memory stateOverlay,
728-
bool skipFailure
736+
bool skipFailure,
737+
bool clearing
729738
) internal view returns (bool, OrderIOCalculationV4 memory) {
730739
unchecked {
731740
bytes32[][] memory context;
732741
{
733742
bytes32[][] memory callingContext = new bytes32[][](CALLING_CONTEXT_COLUMNS);
734-
callingContext[CONTEXT_CALLING_CONTEXT_COLUMN - 1] = LibBytes32Array.arrayFrom(
735-
order.hash(), bytes32(uint256(uint160(order.owner))), bytes32(uint256(uint160(counterparty)))
736-
);
743+
callingContext[CONTEXT_CALLING_CONTEXT_COLUMN - 1] = clearing
744+
? LibBytes32Array.arrayFrom(
745+
order.hash(),
746+
bytes32(uint256(uint160(order.owner))),
747+
bytes32(uint256(uint160(counterparty))),
748+
bytes32(uint256(uint160(msg.sender)))
749+
)
750+
: LibBytes32Array.arrayFrom(
751+
order.hash(), bytes32(uint256(uint160(order.owner))), bytes32(uint256(uint160(counterparty)))
752+
);
737753

738754
// The calculations column holds the calculated max output and IO
739755
// ratio, which only become known after the calculate eval below.

‎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(0x2bafaa417c2e9542a78321c186f293f581bb2a075bcdbfb03b2cf22fb4ecdabb);
8+
bytes32 constant BYTECODE_HASH = bytes32(0x303da2f6de1eaef16d1fe3f763e23b0b846f5c5aae1f8b26b2d54b71908e9859);
99

1010
/// @dev The hash of the meta that describes the contract.
11-
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xe5f5c8b20782dd193ccec19353560b4bba9e69c36c2e6dbf45ef331a38d96dc9);
11+
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x0368780942430ca285c5ae9332c68bbd7953a56ce02e6cc518a9bcc142046cff);
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(0xe5f5c8b20782dd193ccec1935356
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"0101180010800082000100010480300038412a001810000010020004200005002038038ff54900cc66c61df3dcab061659221fc9ec8109895f0b14fec9301902e0920c5bfe561b21609201e959460b1974270f844db208bcd3bf1c9893761e1049db11b93430180ae9a00af82a7805c138f40d28083f0742ef2104d561fd1215a13315716a6117d260cc107b9bfc0eec7ade13cba2891a6b14a520792bdb02e0f14716565589";
30+
hex"0101180010a00082000100010480300038412a001810000010020004200005002038038ff54905cc66c61ef3dcab0716592220c9ec810a895f0b15fec9301a02e0920d5bfe561c21609201e959460c19742710844db209bcd3bf1d9893761f1049db12b93430190ae9a00bf82a7806c138f40e28083f0842ef2104d561fd1315a13316716a6118d260cc117b9bfc0fec7ade14cba28900a422961b6b14a521792bdb02e0f14717565589";
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"183b1858186718761885189518a418b418c318d318e318f21902191119211931194119de19ed19fc1a0c1a1c1a2c1a3c1a4b1a5a1a6a1a7a1a8a1a9a195019691987";
42+
hex"18a718c418d318e218f11901191119201930193f194f195f196e197e198d199d19ad19bd1a571a661a751a851a951aa51ab51ac41ad31ae31af31b031b1319cc19e51a03";
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"1e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e411e6a1e6a1f06";
48+
hex"1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1eba1ee31ee31f7f";
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.

0 commit comments

Comments
 (0)