@@ -64,7 +64,6 @@ import {
6464} from "../../lib/LibRaindex.sol " ;
6565import {RaindexV6FlashLender} from "../../abstract/RaindexV6FlashLender.sol " ;
6666import {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
6968import {LibFormatDecimalFloat} from "rain-math-float-0.3.10/src/lib/format/LibFormatDecimalFloat.sol " ;
7069import {
@@ -319,7 +318,10 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
319318 /// with a context of the order hash and the caller.
320319 function _doOrderPost (bytes32 orderHash , TaskV2[] calldata post ) internal {
321320 LibRaindex.doPost (
322- LibBytes32Matrix.matrixFrom (LibBytes32Array.arrayFrom (orderHash, bytes32 (uint256 (uint160 (msg .sender ))))),
321+ LibRaindex.callingContextColumn (
322+ CONTEXT_CALLING_CONTEXT_COLUMN,
323+ LibBytes32Array.arrayFrom (orderHash, bytes32 (uint256 (uint160 (msg .sender ))))
324+ ),
323325 post
324326 );
325327 }
@@ -351,6 +353,7 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
351353 msg .sender ,
352354 quoteConfig.signedContext,
353355 new bytes32 [](0 ),
356+ false ,
354357 false
355358 );
356359 // true is quote2's "order is live" result required by IRaindexV6.
@@ -441,7 +444,8 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
441444 msg .sender ,
442445 takeOrderConfig.signedContext,
443446 new bytes32 [](0 ),
444- true
447+ true ,
448+ false
445449 );
446450
447451 // Skip orders that are too expensive rather than revert as we have
@@ -635,7 +639,8 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
635639 bobOrder.owner,
636640 bobSignedContext,
637641 new bytes32 [](0 ),
638- false
642+ false ,
643+ true
639644 );
640645 (, OrderIOCalculationV4 memory bobOrderIOCalculation ) = calculateOrderIO (
641646 bobOrder,
@@ -644,7 +649,8 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
644649 aliceOrder.owner,
645650 aliceSignedContext,
646651 new bytes32 [](0 ),
647- false
652+ false ,
653+ true
648654 );
649655
650656 // Each side must be one `takeOrders4` would take. Given this, each
@@ -720,6 +726,8 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
720726 /// single-order callers (`quote`, `clear3`).
721727 /// @param skipFailure If true, a reverting calculate eval or a stack shorter
722728 /// than `CALCULATE_ORDER_MIN_OUTPUTS` returns false instead of reverting.
729+ /// @param clearing Whether the order column includes the clearer row; true
730+ /// only for `clear3`.
723731 /// @return False if `skipFailure` caught a failure, in which case the
724732 /// calculation is zeroed and MUST NOT be used.
725733 /// @return The order IO calculation.
@@ -730,15 +738,23 @@ contract RaindexV6 is IRaindexV6, IMetaV1_2, ReentrancyGuard, Multicall, Raindex
730738 address counterparty ,
731739 SignedContextV1[] memory signedContext ,
732740 bytes32 [] memory stateOverlay ,
733- bool skipFailure
741+ bool skipFailure ,
742+ bool clearing
734743 ) internal view returns (bool , OrderIOCalculationV4 memory ) {
735744 unchecked {
736745 bytes32 [][] memory context;
737746 {
738747 bytes32 [][] memory callingContext = new bytes32 [][](CALLING_CONTEXT_COLUMNS);
739- callingContext[CONTEXT_CALLING_CONTEXT_COLUMN - 1 ] = LibBytes32Array.arrayFrom (
740- order.hash (), bytes32 (uint256 (uint160 (order.owner))), bytes32 (uint256 (uint160 (counterparty)))
741- );
748+ callingContext[CONTEXT_CALLING_CONTEXT_COLUMN - 1 ] = clearing
749+ ? LibBytes32Array.arrayFrom (
750+ order.hash (),
751+ bytes32 (uint256 (uint160 (order.owner))),
752+ bytes32 (uint256 (uint160 (counterparty))),
753+ bytes32 (uint256 (uint160 (msg .sender )))
754+ )
755+ : LibBytes32Array.arrayFrom (
756+ order.hash (), bytes32 (uint256 (uint160 (order.owner))), bytes32 (uint256 (uint160 (counterparty)))
757+ );
742758
743759 // The calculations column holds the calculated max output and IO
744760 // ratio, which only become known after the calculate eval below.
0 commit comments