diff --git a/.gas-snapshot b/.gas-snapshot index 0eab8bdb9..1a15068f5 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,106 +1,107 @@ -GenericPoolOrderBookV4ArbOrderTakerExpressionTest:testGenericPoolTakeOrdersExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256[],uint256[]) (runs: 5097, μ: 364606, ~: 363613) -GenericPoolOrderBookV4ArbOrderTakerExpressionTest:testGenericPoolTakeOrdersWrongExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,address,bytes)) (runs: 5097, μ: 160691, ~: 159659) -GenericPoolOrderBookV4ArbOrderTakerSenderTest:testGenericPoolMinimumOutput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5097, μ: 296449, ~: 295241) -GenericPoolOrderBookV4ArbOrderTakerSenderTest:testGenericPoolTakeOrdersSender((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5097, μ: 251268, ~: 249876) -GenericPoolOrderBookV4FlashBorrowerTest:testGenericPoolOrderBookV4FlashBorrowerMinimumOutput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5097, μ: 495731, ~: 492574) -GenericPoolOrderBookV4FlashBorrowerTest:testGenericPoolOrderBookV4FlashBorrowerTakeOrdersSender((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5097, μ: 449570, ~: 446112) -LibOrderTest:testHashEqual((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32)) (runs: 5097, μ: 199730, ~: 196369) -LibOrderTest:testHashNotEqual((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32)) (runs: 5097, μ: 302886, ~: 302032) -OrderBookAddOrderEnactTest:testAddLiveOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 914350, ~: 902996) -OrderBookAddOrderEnactTest:testAddLiveOrderRevertNoAdd(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 715259, ~: 706575) -OrderBookAddOrderEnactTest:testAddOrderContext(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1017084, ~: 1007028) -OrderBookAddOrderEnactTest:testAddOrderEmptyNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 640707, ~: 632416) -OrderBookAddOrderEnactTest:testAddOrderOneReadState(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 699135, ~: 690841) -OrderBookAddOrderEnactTest:testAddOrderOneStateless(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 688205, ~: 679911) -OrderBookAddOrderEnactTest:testAddOrderWriteStateDifferentOwnersNamespaced(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 3063458, ~: 3055653) -OrderBookAddOrderEnactTest:testAddOrderWriteStateSequential(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 923716, ~: 915410) -OrderBookAddOrderEnactTest:testAddOrderWriteStateSingle(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1322569, ~: 1307883) -OrderBookAddOrderMockTest:testAddOrderSameAccountWithDifferentConfig(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,bytes) (runs: 5097, μ: 2580586, ~: 2572966) -OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithDifferentConfig(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,bytes) (runs: 5097, μ: 2462070, ~: 2457108) -OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithSameConfig(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 2327262, ~: 2308095) -OrderBookAddOrderMockTest:testAddOrderWithCalculationsInputsAndOutputsSucceeds(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 1194298, ~: 1173789) -OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaEmitsMetaV1(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 1202499, ~: 1182724) -OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 668866, ~: 659411) -OrderBookAddOrderMockTest:testAddOrderWithoutCalculationsDeploys(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 658671, ~: 650005) -OrderBookAddOrderMockTest:testAddOrderWithoutInputsReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 157131, ~: 156289) -OrderBookAddOrderMockTest:testAddOrderWithoutOutputsReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 157556, ~: 156385) -OrderBookAddOrderNonceTest:testAddOrderNonceDifferentNonceStateChange(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes32) (runs: 5097, μ: 1222444, ~: 1213156) -OrderBookAddOrderNonceTest:testAddOrderNonceSameNonceDifferentOrderStateChange(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1455639, ~: 1450215) -OrderBookAddOrderNonceTest:testAddOrderNonceSameOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 944149, ~: 930835) -OrderBookAddOrderOwnerTest:testAddOrderOwnerDifferentOwnerStateChange(((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),address,address) (runs: 5097, μ: 1213761, ~: 1213360) -OrderBookAddOrderOwnerTest:testAddOrderOwnerSameOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 944245, ~: 930931) -OrderBookAddOrderTest:testAddOrderRealCalculateInputsReverts1(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 641029, ~: 632736) -OrderBookAddOrderTest:testAddOrderRealCalculateInputsReverts2(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 642846, ~: 634553) -OrderBookAddOrderTest:testAddOrderRealCalculateInputsRevertsPreference(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 642347, ~: 634054) -OrderBookAddOrderTest:testAddOrderRealNoHandleIODeploys(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 633304, ~: 625011) -OrderBookAddOrderTest:testAddOrderRealNoSourcesDeploys(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 612841, ~: 604550) -OrderBookAddOrderTest:testAddOrderRealOneStackCalculateReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 645279, ~: 636986) -OrderBookAddOrderTest:testAddOrderRealThreeStackCalculate(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 657707, ~: 649414) -OrderBookAddOrderTest:testAddOrderRealTwoStackCalculateReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 651404, ~: 643111) -OrderBookAddOrderTest:testAddOrderRealZeroStackCalculateReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 639733, ~: 631440) -OrderBookClearHandleIORevertTest:testClearOrderAliceNoHandleIORevert() (gas: 497653) -OrderBookClearHandleIORevertTest:testClearOrderBobNoHandleIORevert() (gas: 497632) -OrderBookClearHandleIORevertTest:testClearOrderBothNoHandleIORevert() (gas: 477631) -OrderBookClearHandleIORevertTest:testClearOrderHandleIO0() (gas: 530711) -OrderBookClearHandleIORevertTest:testClearOrderHandleIO1() (gas: 526075) -OrderBookClearHandleIORevertTest:testClearOrderHandleIO2() (gas: 526194) -OrderBookClearHandleIORevertTest:testClearOrderHandleIO3() (gas: 530755) -OrderBookClearHandleIORevertTest:testClearOrderHandleIO4() (gas: 540384) -OrderBookClearHandleIORevertTest:testClearOrderHandleIO5() (gas: 503761) -OrderBookClearOrderBadStackTest:testClearOrderBadStackEmptyStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 2298841, ~: 2299377) -OrderBookClearOrderBadStackTest:testClearOrderBadStackOneEmpty(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 2382326, ~: 2384569) -OrderBookClearOrderBadStackTest:testClearOrderBadStackOneOne(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 2389386, ~: 2391646) -OrderBookClearOrderBadStackTest:testClearOrderBadStackOneOtherOne(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 2318732, ~: 2319268) -OrderBookClearOrderBadStackTest:testClearOrderBadStackOneStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 2312358, ~: 2312894) -OrderBookClearOrderBadStackTest:testClearOrderBadStackOtherEmpty(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 2311721, ~: 2312256) -OrderBookClearTest:testClearSimple(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256,bytes,address,uint256,uint256) (runs: 5097, μ: 516847, ~: 516239) -OrderBookClearTest:testFlashLoanToNonReceiver(uint256,bytes,bytes32,bytes) (runs: 5097, μ: 26163, ~: 26154) -OrderBookDepositEnactTest:testDepositRevertInAction(address,uint256,uint256) (runs: 5097, μ: 94311, ~: 94311) -OrderBookDepositEnactTest:testOrderBookDepositEnactEmptyNoop(address,uint256,uint256) (runs: 5097, μ: 41047, ~: 41047) -OrderBookDepositEnactTest:testOrderBookDepositEnactOneReadState(address,uint256,uint256) (runs: 5097, μ: 101319, ~: 101319) -OrderBookDepositEnactTest:testOrderBookDepositEnactOneStateless(address,uint256,uint256) (runs: 5097, μ: 90425, ~: 90425) -OrderBookDepositEnactTest:testOrderBookDepositEvalWriteStateDifferentOwnersNamespaced(address,address,uint256,uint256) (runs: 5097, μ: 925174, ~: 924944) -OrderBookDepositEnactTest:testOrderBookDepositEvalWriteStateSequential(address,uint256,uint256) (runs: 5097, μ: 572304, ~: 572076) -OrderBookDepositEnactTest:testOrderBookDepositEvalWriteStateSingle(address,uint256,uint256) (runs: 5097, μ: 206378, ~: 206150) -OrderBookDepositEnactTest:testOrderDepositContext(address,uint256,uint256,uint256) (runs: 5097, μ: 809897, ~: 810246) -OrderBookDepositTest:testDepositEvent(address,uint256,uint256) (runs: 5097, μ: 38853, ~: 38853) -OrderBookDepositTest:testDepositFail(address,uint256,uint256) (runs: 5097, μ: 1040440699, ~: 1040440664) +GenericPoolOrderBookV4ArbOrderTakerExpressionTest:testGenericPoolTakeOrdersExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256[],uint256[]) (runs: 5108, μ: 364548, ~: 363555) +GenericPoolOrderBookV4ArbOrderTakerExpressionTest:testGenericPoolTakeOrdersWrongExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,address,bytes)) (runs: 5108, μ: 160657, ~: 159645) +GenericPoolOrderBookV4ArbOrderTakerSenderTest:testGenericPoolMinimumOutput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5108, μ: 296404, ~: 295241) +GenericPoolOrderBookV4ArbOrderTakerSenderTest:testGenericPoolTakeOrdersSender((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5108, μ: 251218, ~: 249876) +GenericPoolOrderBookV4FlashBorrowerTest:testGenericPoolOrderBookV4FlashBorrowerMinimumOutput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5108, μ: 495646, ~: 492574) +GenericPoolOrderBookV4FlashBorrowerTest:testGenericPoolOrderBookV4FlashBorrowerTakeOrdersSender((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5108, μ: 449478, ~: 446089) +LibOrderTest:testHashEqual((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32)) (runs: 5108, μ: 199682, ~: 196369) +LibOrderTest:testHashNotEqual((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32)) (runs: 5108, μ: 302795, ~: 302032) +OrderBookAddOrderEnactTest:testAddLiveOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 914161, ~: 902996) +OrderBookAddOrderEnactTest:testAddLiveOrderRevertNoAdd(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 715113, ~: 706575) +OrderBookAddOrderEnactTest:testAddOrderContext(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1016936, ~: 1006873) +OrderBookAddOrderEnactTest:testAddOrderEmptyNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 640572, ~: 632416) +OrderBookAddOrderEnactTest:testAddOrderOneReadState(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 699000, ~: 690841) +OrderBookAddOrderEnactTest:testAddOrderOneStateless(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 688070, ~: 679911) +OrderBookAddOrderEnactTest:testAddOrderWriteStateDifferentOwnersNamespaced(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 3062291, ~: 3055050) +OrderBookAddOrderEnactTest:testAddOrderWriteStateSequential(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 923580, ~: 915410) +OrderBookAddOrderEnactTest:testAddOrderWriteStateSingle(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1322322, ~: 1307883) +OrderBookAddOrderMockTest:testAddOrderSameAccountWithDifferentConfig(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,bytes) (runs: 5108, μ: 2579974, ~: 2572953) +OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithDifferentConfig(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,bytes) (runs: 5108, μ: 2461275, ~: 2456303) +OrderBookAddOrderMockTest:testAddOrderTwoAccountsWithSameConfig(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 2325905, ~: 2307743) +OrderBookAddOrderMockTest:testAddOrderWithCalculationsInputsAndOutputsSucceeds(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 1194015, ~: 1173744) +OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaEmitsMetaV1(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 1202217, ~: 1182463) +OrderBookAddOrderMockTest:testAddOrderWithNonEmptyMetaReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 668713, ~: 659383) +OrderBookAddOrderMockTest:testAddOrderWithoutCalculationsDeploys(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 658525, ~: 650005) +OrderBookAddOrderMockTest:testAddOrderWithoutInputsReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 157101, ~: 156228) +OrderBookAddOrderMockTest:testAddOrderWithoutOutputsReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 157521, ~: 156371) +OrderBookAddOrderNonceTest:testAddOrderNonceDifferentNonceStateChange(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes32) (runs: 5108, μ: 1222168, ~: 1213114) +OrderBookAddOrderNonceTest:testAddOrderNonceSameNonceDifferentOrderStateChange(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1455284, ~: 1450041) +OrderBookAddOrderNonceTest:testAddOrderNonceSameOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 943936, ~: 930835) +OrderBookAddOrderOwnerTest:testAddOrderOwnerDifferentOwnerStateChange(((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),address,address) (runs: 5108, μ: 1214089, ~: 1213666) +OrderBookAddOrderOwnerTest:testAddOrderOwnerSameOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 944032, ~: 930931) +OrderBookAddOrderTest:testAddOrderRealCalculateInputsReverts1(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 640893, ~: 632736) +OrderBookAddOrderTest:testAddOrderRealCalculateInputsReverts2(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 642710, ~: 634553) +OrderBookAddOrderTest:testAddOrderRealCalculateInputsRevertsPreference(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 642211, ~: 634054) +OrderBookAddOrderTest:testAddOrderRealNoHandleIODeploys(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 633168, ~: 625011) +OrderBookAddOrderTest:testAddOrderRealNoSourcesDeploys(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 612706, ~: 604550) +OrderBookAddOrderTest:testAddOrderRealOneStackCalculateReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 645143, ~: 636986) +OrderBookAddOrderTest:testAddOrderRealThreeStackCalculate(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 657571, ~: 649414) +OrderBookAddOrderTest:testAddOrderRealTwoStackCalculateReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 651268, ~: 643111) +OrderBookAddOrderTest:testAddOrderRealZeroStackCalculateReverts(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 639597, ~: 631440) +OrderBookClearHandleIORevertTest:testClearOrderAliceNoHandleIORevert() (gas: 501293) +OrderBookClearHandleIORevertTest:testClearOrderBobNoHandleIORevert() (gas: 501272) +OrderBookClearHandleIORevertTest:testClearOrderBothNoHandleIORevert() (gas: 481271) +OrderBookClearHandleIORevertTest:testClearOrderHandleIO0() (gas: 534351) +OrderBookClearHandleIORevertTest:testClearOrderHandleIO1() (gas: 529715) +OrderBookClearHandleIORevertTest:testClearOrderHandleIO2() (gas: 529834) +OrderBookClearHandleIORevertTest:testClearOrderHandleIO3() (gas: 534395) +OrderBookClearHandleIORevertTest:testClearOrderHandleIO4() (gas: 544024) +OrderBookClearHandleIORevertTest:testClearOrderHandleIO5() (gas: 507401) +OrderBookClearOrderBadStackTest:testClearOrderBadStackEmptyStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 2298365, ~: 2299737) +OrderBookClearOrderBadStackTest:testClearOrderBadStackOneEmpty(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 2382630, ~: 2383540) +OrderBookClearOrderBadStackTest:testClearOrderBadStackOneOne(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 2389689, ~: 2390604) +OrderBookClearOrderBadStackTest:testClearOrderBadStackOneOtherOne(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 2318255, ~: 2319627) +OrderBookClearOrderBadStackTest:testClearOrderBadStackOneStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 2311881, ~: 2313253) +OrderBookClearOrderBadStackTest:testClearOrderBadStackOtherEmpty(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 2311245, ~: 2312607) +OrderBookClearOrderContextTest:testContextEmptyStack(address,address,uint256,uint256,uint256,uint256) (runs: 5108, μ: 2058476, ~: 2059489) +OrderBookClearTest:testClearSimple(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256,bytes,address,uint256,uint256) (runs: 5108, μ: 518584, ~: 517984) +OrderBookClearTest:testFlashLoanToNonReceiver(uint256,bytes,bytes32,bytes) (runs: 5108, μ: 26163, ~: 26154) +OrderBookDepositEnactTest:testDepositRevertInAction(address,uint256,uint256) (runs: 5108, μ: 94311, ~: 94311) +OrderBookDepositEnactTest:testOrderBookDepositEnactEmptyNoop(address,uint256,uint256) (runs: 5108, μ: 41047, ~: 41047) +OrderBookDepositEnactTest:testOrderBookDepositEnactOneReadState(address,uint256,uint256) (runs: 5108, μ: 101319, ~: 101319) +OrderBookDepositEnactTest:testOrderBookDepositEnactOneStateless(address,uint256,uint256) (runs: 5108, μ: 90425, ~: 90425) +OrderBookDepositEnactTest:testOrderBookDepositEvalWriteStateDifferentOwnersNamespaced(address,address,uint256,uint256) (runs: 5108, μ: 925173, ~: 924944) +OrderBookDepositEnactTest:testOrderBookDepositEvalWriteStateSequential(address,uint256,uint256) (runs: 5108, μ: 572302, ~: 572076) +OrderBookDepositEnactTest:testOrderBookDepositEvalWriteStateSingle(address,uint256,uint256) (runs: 5108, μ: 206376, ~: 206150) +OrderBookDepositEnactTest:testOrderDepositContext(address,uint256,uint256,uint256) (runs: 5108, μ: 809491, ~: 810169) +OrderBookDepositTest:testDepositEvent(address,uint256,uint256) (runs: 5108, μ: 38853, ~: 38853) +OrderBookDepositTest:testDepositFail(address,uint256,uint256) (runs: 5108, μ: 1040440701, ~: 1040440664) OrderBookDepositTest:testDepositGas00() (gas: 8771) OrderBookDepositTest:testDepositGas01() (gas: 35148) -OrderBookDepositTest:testDepositMany((address,address,uint256,uint248)[]) (runs: 5096, μ: 2483641, ~: 1708734) -OrderBookDepositTest:testDepositOverflow(address,uint256,uint256,uint256) (runs: 5097, μ: 51608, ~: 51929) -OrderBookDepositTest:testDepositReentrancy(address,uint256,uint256,address,uint256,uint256) (runs: 5097, μ: 606384, ~: 606775) -OrderBookDepositTest:testDepositSimple(address,uint256,uint256) (runs: 5097, μ: 38105, ~: 38105) -OrderBookDepositTest:testDepositZero(address,uint256) (runs: 5097, μ: 12924, ~: 12924) -OrderBookDepositTest:testVaultBalanceNoDeposits(address,uint256) (runs: 5097, μ: 8938, ~: 8938) -OrderBookEnactTest:testOrderBookEvalEmptyNoop(address) (runs: 5097, μ: 14063, ~: 14063) -OrderBookEnactTest:testOrderBookEvalOneReadState(address) (runs: 5097, μ: 71033, ~: 71033) -OrderBookEnactTest:testOrderBookEvalOneStateless(address) (runs: 5097, μ: 60115, ~: 60115) -OrderBookEnactTest:testOrderBookEvalWriteStateDifferentOwnersNamespaced(address,address) (runs: 5097, μ: 831324, ~: 831324) +OrderBookDepositTest:testDepositMany((address,address,uint256,uint248)[]) (runs: 5097, μ: 2479134, ~: 1708734) +OrderBookDepositTest:testDepositOverflow(address,uint256,uint256,uint256) (runs: 5108, μ: 51608, ~: 51929) +OrderBookDepositTest:testDepositReentrancy(address,uint256,uint256,address,uint256,uint256) (runs: 5108, μ: 606377, ~: 606775) +OrderBookDepositTest:testDepositSimple(address,uint256,uint256) (runs: 5108, μ: 38105, ~: 38105) +OrderBookDepositTest:testDepositZero(address,uint256) (runs: 5108, μ: 12924, ~: 12924) +OrderBookDepositTest:testVaultBalanceNoDeposits(address,uint256) (runs: 5108, μ: 8938, ~: 8938) +OrderBookEnactTest:testOrderBookEvalEmptyNoop(address) (runs: 5108, μ: 14063, ~: 14063) +OrderBookEnactTest:testOrderBookEvalOneReadState(address) (runs: 5108, μ: 71033, ~: 71033) +OrderBookEnactTest:testOrderBookEvalOneStateless(address) (runs: 5108, μ: 60115, ~: 60115) +OrderBookEnactTest:testOrderBookEvalWriteStateDifferentOwnersNamespaced(address,address) (runs: 5108, μ: 831324, ~: 831324) OrderBookEnactTest:testOrderBookEvalWriteStateSequential() (gas: 519879) -OrderBookEnactTest:testOrderBookEvalWriteStateSingle(address) (runs: 5097, μ: 165041, ~: 165041) -OrderBookQuoteTest:testQuoteContextSender(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256) (runs: 5097, μ: 9726163, ~: 9616307) -OrderBookQuoteTest:testQuoteDeadOrder(((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,uint256[],bytes)[])) (runs: 5097, μ: 6669076, ~: 5838032) -OrderBookQuoteTest:testQuoteMaxOutput(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256) (runs: 5097, μ: 1105551, ~: 1093435) -OrderBookQuoteTest:testQuoteSimple(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256) (runs: 5097, μ: 1098979, ~: 1086880) -OrderBookRemoveOrderEnactTest:testRemoveOrderContext(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 645219, ~: 638840) -OrderBookRemoveOrderEnactTest:testRemoveOrderDeadOrder(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 354778, ~: 350017) -OrderBookRemoveOrderEnactTest:testRemoveOrderEmptyNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1081051, ~: 1066445) -OrderBookRemoveOrderEnactTest:testRemoveOrderOneReadState(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1139686, ~: 1125079) -OrderBookRemoveOrderEnactTest:testRemoveOrderOneStateless(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1128808, ~: 1114201) -OrderBookRemoveOrderEnactTest:testRemoveOrderRevertInAction(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1265413, ~: 1248808) -OrderBookRemoveOrderEnactTest:testRemoveOrderWriteStateDifferentOwnersNamespaced(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 4832516, ~: 4817717) -OrderBookRemoveOrderEnactTest:testRemoveOrderWriteStateSequential(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 1365194, ~: 1350575) -OrderBookRemoveOrderEnactTest:testRemoveOrderWriteStateSingle(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 2203733, ~: 2176419) -OrderBookRemoveOrderMockTest:testRemoveOrderAddRemoveMulti(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 6810671, ~: 6662571) -OrderBookRemoveOrderMockTest:testRemoveOrderDifferent(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 4770916, ~: 4707920) -OrderBookRemoveOrderMockTest:testRemoveOrderDifferentOwners(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 4608312, ~: 4557525) -OrderBookRemoveOrderMockTest:testRemoveOrderDifferentOwnersDifferent(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 9904145, ~: 9785235) -OrderBookRemoveOrderMockTest:testRemoveOrderDoesNotExist(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 374572, ~: 368808) -OrderBookRemoveOrderMockTest:testRemoveOrderOnlyOwner(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5097, μ: 2475044, ~: 2452573) -OrderBookRemoveOrderOwnerTest:testRemoveOrderOwnerDifferentOwnerStateChange(((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),address,address) (runs: 5097, μ: 5914238, ~: 5837982) -OrderBookRemoveOrderOwnerTest:testRemoveOrderOwnerSameOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 3398831, ~: 3339431) -OrderBookRemoveOrderOwnerTest:testRemoveOrderWrongOwner(((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),address,address) (runs: 5097, μ: 758141, ~: 757511) +OrderBookEnactTest:testOrderBookEvalWriteStateSingle(address) (runs: 5108, μ: 165041, ~: 165041) +OrderBookQuoteTest:testQuoteContextSender(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256) (runs: 5108, μ: 10167185, ~: 10064132) +OrderBookQuoteTest:testQuoteDeadOrder(((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,uint256[],bytes)[])) (runs: 5108, μ: 6663419, ~: 5832695) +OrderBookQuoteTest:testQuoteMaxOutput(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256) (runs: 5108, μ: 1108902, ~: 1096998) +OrderBookQuoteTest:testQuoteSimple(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),uint256) (runs: 5108, μ: 1102322, ~: 1090401) +OrderBookRemoveOrderEnactTest:testRemoveOrderContext(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 645135, ~: 638606) +OrderBookRemoveOrderEnactTest:testRemoveOrderDeadOrder(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 354707, ~: 350017) +OrderBookRemoveOrderEnactTest:testRemoveOrderEmptyNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1080804, ~: 1066445) +OrderBookRemoveOrderEnactTest:testRemoveOrderOneReadState(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1139439, ~: 1125079) +OrderBookRemoveOrderEnactTest:testRemoveOrderOneStateless(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1128561, ~: 1114201) +OrderBookRemoveOrderEnactTest:testRemoveOrderRevertInAction(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1265141, ~: 1248808) +OrderBookRemoveOrderEnactTest:testRemoveOrderWriteStateDifferentOwnersNamespaced(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 4830163, ~: 4817389) +OrderBookRemoveOrderEnactTest:testRemoveOrderWriteStateSequential(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 1364947, ~: 1350575) +OrderBookRemoveOrderEnactTest:testRemoveOrderWriteStateSingle(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 2203262, ~: 2176419) +OrderBookRemoveOrderMockTest:testRemoveOrderAddRemoveMulti(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 6809007, ~: 6662571) +OrderBookRemoveOrderMockTest:testRemoveOrderDifferent(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 4771475, ~: 4707793) +OrderBookRemoveOrderMockTest:testRemoveOrderDifferentOwners(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 4605540, ~: 4556938) +OrderBookRemoveOrderMockTest:testRemoveOrderDifferentOwnersDifferent(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 9901135, ~: 9779715) +OrderBookRemoveOrderMockTest:testRemoveOrderDoesNotExist(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 374485, ~: 368808) +OrderBookRemoveOrderMockTest:testRemoveOrderOnlyOwner(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),bytes) (runs: 5108, μ: 2473575, ~: 2452298) +OrderBookRemoveOrderOwnerTest:testRemoveOrderOwnerDifferentOwnerStateChange(((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),address,address) (runs: 5108, μ: 5915110, ~: 5838087) +OrderBookRemoveOrderOwnerTest:testRemoveOrderOwnerSameOrderNoop(address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 3398031, ~: 3339431) +OrderBookRemoveOrderOwnerTest:testRemoveOrderWrongOwner(((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),address,address) (runs: 5108, μ: 758239, ~: 757542) OrderBookSubParserContextCalculatedIORatioTest:testSubParserContextHappy() (gas: 2190404) OrderBookSubParserContextCalculatedIORatioTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2169061) OrderBookSubParserContextCalculatedIORatioTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2155576) @@ -113,9 +114,9 @@ OrderBookSubParserContextInputTokenDecimalsTest:testSubParserContextUnhappyDisal OrderBookSubParserContextInputTokenTest:testSubParserContextHappy() (gas: 2189107) OrderBookSubParserContextInputTokenTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2167761) OrderBookSubParserContextInputTokenTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2154280) -OrderBookSubParserContextInputVaultBalanceIncreaseTest:testSubParserContextHappy() (gas: 2191876) -OrderBookSubParserContextInputVaultBalanceIncreaseTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2170529) -OrderBookSubParserContextInputVaultBalanceIncreaseTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2157050) +OrderBookSubParserContextInputVaultBalanceIncreaseTest:testSubParserContextHappy() (gas: 2190570) +OrderBookSubParserContextInputVaultBalanceIncreaseTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2169223) +OrderBookSubParserContextInputVaultBalanceIncreaseTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2155741) OrderBookSubParserContextOrderBookTest:testSubParserContextHappy() (gas: 2188783) OrderBookSubParserContextOrderBookTest:testSubParserContextHappy() (gas: 2189594) OrderBookSubParserContextOrderBookTest:testSubParserContextHappy() (gas: 2189756) @@ -143,20 +144,20 @@ OrderBookSubParserContextOutputTokenDecimalsTest:testSubParserContextUnhappyDisa OrderBookSubParserContextOutputTokenTest:testSubParserContextHappy() (gas: 2189269) OrderBookSubParserContextOutputTokenTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2167923) OrderBookSubParserContextOutputTokenTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2154442) -OrderBookSubParserContextOutputVaultBalanceBeforeTest:testSubParserContextHappy() (gas: 2191704) -OrderBookSubParserContextOutputVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2170357) -OrderBookSubParserContextOutputVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2156868) -OrderBookSubParserContextOutputVaultBalanceDecreaseTest:testSubParserContextHappy() (gas: 2192038) -OrderBookSubParserContextOutputVaultBalanceDecreaseTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2170681) -OrderBookSubParserContextOutputVaultBalanceDecreaseTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2157212) -OrderBookSubParserContextVaultBalanceBeforeTest:testSubParserContextHappy() (gas: 2191542) -OrderBookSubParserContextVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2170195) -OrderBookSubParserContextVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2156716) -OrderBookSubParserDescribedByMetaV1Test:testOrderBookSubParserDescribedByMetaV1Happy() (gas: 2106782) -OrderBookSubParserIERC165Test:testOrderBookSubParserIERC165(bytes4) (runs: 5097, μ: 2110113, ~: 2110113) +OrderBookSubParserContextOutputVaultBalanceBeforeTest:testSubParserContextHappy() (gas: 2190404) +OrderBookSubParserContextOutputVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2169061) +OrderBookSubParserContextOutputVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2155576) +OrderBookSubParserContextOutputVaultBalanceDecreaseTest:testSubParserContextHappy() (gas: 2190732) +OrderBookSubParserContextOutputVaultBalanceDecreaseTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2169385) +OrderBookSubParserContextOutputVaultBalanceDecreaseTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2155903) +OrderBookSubParserContextVaultBalanceBeforeTest:testSubParserContextHappy() (gas: 2190242) +OrderBookSubParserContextVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedInputs() (gas: 2168899) +OrderBookSubParserContextVaultBalanceBeforeTest:testSubParserContextUnhappyDisallowedOperand() (gas: 2155414) +OrderBookSubParserDescribedByMetaV1Test:testOrderBookSubParserDescribedByMetaV1Happy() (gas: 2107037) +OrderBookSubParserIERC165Test:testOrderBookSubParserIERC165(bytes4) (runs: 5108, μ: 2110113, ~: 2110113) OrderBookSubParserPointersTest:testSubParserFunctionPointers() (gas: 2121602) OrderBookSubParserPointersTest:testSubParserOperandParsers() (gas: 2121602) -OrderBookSubParserPointersTest:testSubParserParseMeta() (gas: 110462) +OrderBookSubParserPointersTest:testSubParserParseMeta() (gas: 254036) OrderBookSubParserPointersTest:testWordOperandLengthEquivalence() (gas: 4098) OrderBookSubParserSignedContextTest:testSubParserContextSignedContextHappy0() (gas: 2195800) OrderBookSubParserSignedContextTest:testSubParserContextSignedContextHappy1() (gas: 2195834) @@ -170,69 +171,69 @@ OrderBookSubParserSignersTest:testSubParserContextSignerHappy1() (gas: 2191312) OrderBookSubParserSignersTest:testSubParserContextSignerUnhappyInput() (gas: 2169797) OrderBookSubParserSignersTest:testSubParserContextSignerUnhappyNoOperand() (gas: 2150334) OrderBookSubParserSignersTest:testSubParserContextSignerUnhappyTooManyOperands() (gas: 2156254) -OrderBookTakeOrderBadStackTest:testTakeOrderBadStackEmptyStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 939577, ~: 934926) -OrderBookTakeOrderBadStackTest:testTakeOrderBadStackOneStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 946272, ~: 941621) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO0() (gas: 228847) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO1() (gas: 385528) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO10(uint256) (runs: 5097, μ: 614041, ~: 577960) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO2() (gas: 398922) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO3() (gas: 535919) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO4() (gas: 552810) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO5() (gas: 552809) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO6() (gas: 539456) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO7(uint256) (runs: 5097, μ: 784754, ~: 784716) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO8(uint256) (runs: 5097, μ: 935551, ~: 935512) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO9(uint256) (runs: 5097, μ: 696587, ~: 628667) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderNoHandleIORevert0() (gas: 223689) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderNoHandleIORevert1() (gas: 373841) -OrderBookTakeOrderHandleIORevertTest:testTakeOrderNoHandleIORevert2() (gas: 360492) -OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputMultipleOrders(uint256,uint256) (runs: 5097, μ: 393397, ~: 403790) -OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputMultipleOrdersMultipleOwners(uint256,uint256,uint256) (runs: 5097, μ: 448526, ~: 460557) -OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleAnyDeposit(uint256,uint256) (runs: 5097, μ: 247282, ~: 249507) -OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleOrderLessThanMaximumInput(uint256,uint256) (runs: 5097, μ: 230000, ~: 231088) -OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleOrderLessThanMaximumOutput(uint256) (runs: 5097, μ: 229486, ~: 229447) -OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleOrderUnlimitedMax(uint256) (runs: 5097, μ: 227342, ~: 227116) -OrderBookTakeOrderMaximumInputTest:testTakeOrderNoopZeroMaxTakerInput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),(address,uint256[],bytes)) (runs: 5097, μ: 184667, ~: 184752) -OrderBookTakeOrderNoopTest:testTakeOrderNoopNonLiveOrderOne((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,uint256[],bytes)) (runs: 5097, μ: 424828, ~: 422962) -OrderBookTakeOrderNoopTest:testTakeOrderNoopNonLiveOrderTwo((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256,(address,uint256[],bytes),(address,uint256[],bytes)) (runs: 5097, μ: 851465, ~: 847207) +OrderBookTakeOrderBadStackTest:testTakeOrderBadStackEmptyStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 939878, ~: 935548) +OrderBookTakeOrderBadStackTest:testTakeOrderBadStackOneStack(address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 946573, ~: 942243) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO0() (gas: 229757) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO1() (gas: 387348) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO10(uint256) (runs: 5108, μ: 615496, ~: 578476) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO2() (gas: 400742) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO3() (gas: 538649) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO4() (gas: 555540) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO5() (gas: 555539) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO6() (gas: 542186) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO7(uint256) (runs: 5108, μ: 788395, ~: 788356) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO8(uint256) (runs: 5108, μ: 940102, ~: 940062) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderHandleIO9(uint256) (runs: 5108, μ: 697951, ~: 629175) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderNoHandleIORevert0() (gas: 224599) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderNoHandleIORevert1() (gas: 375661) +OrderBookTakeOrderHandleIORevertTest:testTakeOrderNoHandleIORevert2() (gas: 362312) +OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputMultipleOrders(uint256,uint256) (runs: 5108, μ: 394878, ~: 405610) +OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputMultipleOrdersMultipleOwners(uint256,uint256,uint256) (runs: 5108, μ: 449781, ~: 462377) +OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleAnyDeposit(uint256,uint256) (runs: 5108, μ: 248164, ~: 250417) +OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleOrderLessThanMaximumInput(uint256,uint256) (runs: 5108, μ: 230806, ~: 231998) +OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleOrderLessThanMaximumOutput(uint256) (runs: 5108, μ: 230399, ~: 230357) +OrderBookTakeOrderMaximumInputTest:testTakeOrderMaximumInputSingleOrderUnlimitedMax(uint256) (runs: 5108, μ: 228250, ~: 228026) +OrderBookTakeOrderMaximumInputTest:testTakeOrderNoopZeroMaxTakerInput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),(address,uint256[],bytes)) (runs: 5108, μ: 184639, ~: 184719) +OrderBookTakeOrderNoopTest:testTakeOrderNoopNonLiveOrderOne((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,uint256[],bytes)) (runs: 5108, μ: 424745, ~: 422709) +OrderBookTakeOrderNoopTest:testTakeOrderNoopNonLiveOrderTwo((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256,(address,uint256[],bytes),(address,uint256[],bytes)) (runs: 5108, μ: 851264, ~: 847042) OrderBookTakeOrderNoopTest:testTakeOrderNoopZeroOrders() (gas: 12341) -OrderBookTakeOrderPrecisionTest:testTakeOrderPrecisionKnownBad01() (gas: 2102060) -OrderBookTakeOrderTokenMismatchDecimalsTest:testTokenMismatchInputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5097, μ: 613674, ~: 609626) -OrderBookTakeOrderTokenMismatchDecimalsTest:testTokenMismatchOutputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5097, μ: 615403, ~: 611852) -OrderBookTakeOrderTokenMismatchTest:testTokenMismatchInputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5097, μ: 612667, ~: 611091) -OrderBookTakeOrderTokenMismatchTest:testTokenMismatchOutputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5097, μ: 613905, ~: 612378) -OrderBookV4ArbOrderTakerIERC165Test:testOrderBookV4ArbOrderTakerIERC165(bytes4) (runs: 5097, μ: 1977114, ~: 1977114) -OrderBookV4FlashBorrowerIERC165Test:testOrderBookV4FlashBorrowerIERC165(bytes4) (runs: 5097, μ: 2490318, ~: 2490318) -OrderBookV4FlashLenderFeeTest:testFlashFee(address,uint256) (runs: 5097, μ: 6573, ~: 6573) -OrderBookV4FlashLenderIERC165Test:testOrderBookV4FlashLenderIERC165(bytes4) (runs: 5097, μ: 563157, ~: 563157) -OrderBookV4FlashLenderMaxFlashLoanTest:testFlashMaxLoan(uint256) (runs: 5097, μ: 7744, ~: 7744) -OrderBookV4FlashLenderMockSuccessTest:testFlashLoanToReceiver(uint256,bytes) (runs: 5097, μ: 13564, ~: 13557) -OrderBookV4FlashLenderReentrant:testReenterAddOrder(uint256,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 18626109, ~: 18580187) -OrderBookV4FlashLenderReentrant:testReenterCheckOrderExists(bytes32,uint256) (runs: 5097, μ: 535364, ~: 535614) -OrderBookV4FlashLenderReentrant:testReenterClear(uint256,address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 37659124, ~: 37558143) -OrderBookV4FlashLenderReentrant:testReenterDeposit(uint256,uint256,uint256) (runs: 5097, μ: 635655, ~: 636074) -OrderBookV4FlashLenderReentrant:testReenterReadVaultBalances(uint256,uint256) (runs: 5097, μ: 580220, ~: 580599) -OrderBookV4FlashLenderReentrant:testReenterRemoveOrder(uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32)) (runs: 5097, μ: 18063513, ~: 17985662) -OrderBookV4FlashLenderReentrant:testReenterTakeOrder(uint256,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5097, μ: 19200032, ~: 19147523) -OrderBookV4FlashLenderReentrant:testReenterWithdraw(uint256,uint256,uint256) (runs: 5097, μ: 612333, ~: 612752) -OrderBookV4FlashLenderTransferTest:testFlashLoanTransferFail(uint256,uint256,bool) (runs: 5097, μ: 1315073, ~: 1314004) -OrderBookV4FlashLenderTransferTest:testFlashLoanTransferSuccess(uint256,bool) (runs: 5097, μ: 1261032, ~: 1267965) -OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalEmptyNoop(address,uint256,uint256,uint256) (runs: 5097, μ: 52136, ~: 52592) -OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalOneReadState(address,uint256,uint256,uint256) (runs: 5097, μ: 112543, ~: 113358) -OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalOneStateless(address,uint256,uint256,uint256) (runs: 5097, μ: 101648, ~: 102463) -OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalWriteStateDifferentOwnersNamespaced(address,address,uint256,uint256,uint256) (runs: 5097, μ: 957814, ~: 959248) -OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalWriteStateSequential(address,uint256,uint256,uint256) (runs: 5097, μ: 589813, ~: 590627) -OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalWriteStateSingle(address,uint256,uint256,uint256) (runs: 5097, μ: 222101, ~: 222915) -OrderBookWithdrawEvalTest:testOrderBookWithdrawalEvalRevertInAction(address,uint256,uint256,uint256) (runs: 5097, μ: 105276, ~: 106092) -OrderBookWithdrawEvalTest:testOrderBookWithdrawalEvalZeroAmountEvalNoop(address,uint256,uint256) (runs: 5097, μ: 57925, ~: 57699) -OrderBookWithdrawEvalTest:testOrderWithdrawContext(address,uint256,uint256,uint256) (runs: 5097, μ: 963654, ~: 960597) -OrderBookWithdrawTest:testWithdrawEmptyVault(address,address,uint256,uint256) (runs: 5097, μ: 17492, ~: 17492) -OrderBookWithdrawTest:testWithdrawFailure(address,uint256,uint256,uint256) (runs: 5097, μ: 1040417064, ~: 1040398271) -OrderBookWithdrawTest:testWithdrawFullVault(address,uint256,uint256,uint256) (runs: 5097, μ: 39862, ~: 39848) -OrderBookWithdrawTest:testWithdrawMany((bool,address,address,uint256,uint248)[]) (runs: 5097, μ: 3131975, ~: 3123504) -OrderBookWithdrawTest:testWithdrawPartialVault(address,uint256,uint256,uint256) (runs: 5096, μ: 50202, ~: 50202) -OrderBookWithdrawTest:testWithdrawZero(address,address,uint256) (runs: 5097, μ: 13038, ~: 13038) -RouteProcessorOrderBookV4ArbOrderTakerExpressionTest:testRouteProcessorTakeOrdersExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256[],uint256[]) (runs: 5097, μ: 364650, ~: 363704) -RouteProcessorOrderBookV4ArbOrderTakerExpressionTest:testRouteProcessorTakeOrdersWrongExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,address,bytes)) (runs: 5097, μ: 160711, ~: 159691) -RouteProcessorOrderBookV4ArbOrderTakerSenderTest:testRouteProcessorMinimumOutput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5097, μ: 296578, ~: 295366) -RouteProcessorOrderBookV4ArbOrderTakerSenderTest:testRouteProcessorTakeOrdersSender((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5097, μ: 251423, ~: 250031) \ No newline at end of file +OrderBookTakeOrderPrecisionTest:testTakeOrderPrecisionKnownBad01() (gas: 2120482) +OrderBookTakeOrderTokenMismatchDecimalsTest:testTokenMismatchInputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5108, μ: 613785, ~: 609484) +OrderBookTakeOrderTokenMismatchDecimalsTest:testTokenMismatchOutputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5108, μ: 615268, ~: 611651) +OrderBookTakeOrderTokenMismatchTest:testTokenMismatchInputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5108, μ: 612692, ~: 611023) +OrderBookTakeOrderTokenMismatchTest:testTokenMismatchOutputs((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5108, μ: 613956, ~: 612339) +OrderBookV4ArbOrderTakerIERC165Test:testOrderBookV4ArbOrderTakerIERC165(bytes4) (runs: 5108, μ: 1977114, ~: 1977114) +OrderBookV4FlashBorrowerIERC165Test:testOrderBookV4FlashBorrowerIERC165(bytes4) (runs: 5108, μ: 2490318, ~: 2490318) +OrderBookV4FlashLenderFeeTest:testFlashFee(address,uint256) (runs: 5108, μ: 6573, ~: 6573) +OrderBookV4FlashLenderIERC165Test:testOrderBookV4FlashLenderIERC165(bytes4) (runs: 5108, μ: 563157, ~: 563157) +OrderBookV4FlashLenderMaxFlashLoanTest:testFlashMaxLoan(uint256) (runs: 5108, μ: 7744, ~: 7744) +OrderBookV4FlashLenderMockSuccessTest:testFlashLoanToReceiver(uint256,bytes) (runs: 5108, μ: 13564, ~: 13557) +OrderBookV4FlashLenderReentrant:testReenterAddOrder(uint256,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 18624420, ~: 18599593) +OrderBookV4FlashLenderReentrant:testReenterCheckOrderExists(bytes32,uint256) (runs: 5108, μ: 535399, ~: 535614) +OrderBookV4FlashLenderReentrant:testReenterClear(uint256,address,address,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes),((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 37650938, ~: 37548644) +OrderBookV4FlashLenderReentrant:testReenterDeposit(uint256,uint256,uint256) (runs: 5108, μ: 635660, ~: 636074) +OrderBookV4FlashLenderReentrant:testReenterReadVaultBalances(uint256,uint256) (runs: 5108, μ: 580236, ~: 580599) +OrderBookV4FlashLenderReentrant:testReenterRemoveOrder(uint256,(address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32)) (runs: 5108, μ: 18055022, ~: 17982604) +OrderBookV4FlashLenderReentrant:testReenterTakeOrder(uint256,((address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32,bytes32,bytes)) (runs: 5108, μ: 19199000, ~: 19169665) +OrderBookV4FlashLenderReentrant:testReenterWithdraw(uint256,uint256,uint256) (runs: 5108, μ: 612338, ~: 612752) +OrderBookV4FlashLenderTransferTest:testFlashLoanTransferFail(uint256,uint256,bool) (runs: 5108, μ: 1315070, ~: 1314004) +OrderBookV4FlashLenderTransferTest:testFlashLoanTransferSuccess(uint256,bool) (runs: 5108, μ: 1261028, ~: 1267965) +OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalEmptyNoop(address,uint256,uint256,uint256) (runs: 5108, μ: 52132, ~: 52592) +OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalOneReadState(address,uint256,uint256,uint256) (runs: 5108, μ: 112536, ~: 113358) +OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalOneStateless(address,uint256,uint256,uint256) (runs: 5108, μ: 101641, ~: 102463) +OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalWriteStateDifferentOwnersNamespaced(address,address,uint256,uint256,uint256) (runs: 5108, μ: 957760, ~: 959248) +OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalWriteStateSequential(address,uint256,uint256,uint256) (runs: 5108, μ: 589806, ~: 590627) +OrderBookWithdrawEvalTest:testOrderBookWithdrawEvalWriteStateSingle(address,uint256,uint256,uint256) (runs: 5108, μ: 222094, ~: 222915) +OrderBookWithdrawEvalTest:testOrderBookWithdrawalEvalRevertInAction(address,uint256,uint256,uint256) (runs: 5108, μ: 105270, ~: 106092) +OrderBookWithdrawEvalTest:testOrderBookWithdrawalEvalZeroAmountEvalNoop(address,uint256,uint256) (runs: 5108, μ: 57930, ~: 57699) +OrderBookWithdrawEvalTest:testOrderWithdrawContext(address,uint256,uint256,uint256) (runs: 5108, μ: 963970, ~: 960739) +OrderBookWithdrawTest:testWithdrawEmptyVault(address,address,uint256,uint256) (runs: 5108, μ: 17492, ~: 17492) +OrderBookWithdrawTest:testWithdrawFailure(address,uint256,uint256,uint256) (runs: 5108, μ: 1040417244, ~: 1040398271) +OrderBookWithdrawTest:testWithdrawFullVault(address,uint256,uint256,uint256) (runs: 5101, μ: 39862, ~: 39848) +OrderBookWithdrawTest:testWithdrawMany((bool,address,address,uint256,uint248)[]) (runs: 5108, μ: 3133203, ~: 3125728) +OrderBookWithdrawTest:testWithdrawPartialVault(address,uint256,uint256,uint256) (runs: 5103, μ: 50202, ~: 50202) +OrderBookWithdrawTest:testWithdrawZero(address,address,uint256) (runs: 5108, μ: 13038, ~: 13038) +RouteProcessorOrderBookV4ArbOrderTakerExpressionTest:testRouteProcessorTakeOrdersExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256[],uint256[]) (runs: 5108, μ: 364592, ~: 363612) +RouteProcessorOrderBookV4ArbOrderTakerExpressionTest:testRouteProcessorTakeOrdersWrongExpression((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,(address,address,bytes)) (runs: 5108, μ: 160677, ~: 159681) +RouteProcessorOrderBookV4ArbOrderTakerSenderTest:testRouteProcessorMinimumOutput((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256,uint256,uint256) (runs: 5108, μ: 296534, ~: 295366) +RouteProcessorOrderBookV4ArbOrderTakerSenderTest:testRouteProcessorTakeOrdersSender((address,(address,address,bytes),(address,uint8,uint256)[],(address,uint8,uint256)[],bytes32),uint256,uint256) (runs: 5108, μ: 251374, ~: 250031) \ No newline at end of file diff --git a/src/concrete/ob/OrderBook.sol b/src/concrete/ob/OrderBook.sol index b14e4d4aa..dbf0353b0 100644 --- a/src/concrete/ob/OrderBook.sol +++ b/src/concrete/ob/OrderBook.sol @@ -50,6 +50,7 @@ import { CONTEXT_CALLING_CONTEXT_COLUMN, CONTEXT_CALCULATIONS_COLUMN, CONTEXT_VAULT_IO_BALANCE_DIFF, + CONTEXT_VAULT_IO_TOKEN_DECIMALS, CONTEXT_VAULT_INPUTS_COLUMN, CONTEXT_VAULT_IO_TOKEN, CONTEXT_VAULT_OUTPUTS_COLUMN, @@ -748,24 +749,30 @@ contract OrderBook is IOrderBookV4, IMetaV1_2, ReentrancyGuard, Multicall, Order ); { + uint256 inputTokenVaultBalance = sVaultBalances[order.owner][order.validInputs[inputIOIndex].token][order + .validInputs[inputIOIndex].vaultId]; callingContext[CONTEXT_VAULT_INPUTS_COLUMN - 1] = LibUint256Array.arrayFrom( uint256(uint160(order.validInputs[inputIOIndex].token)), order.validInputs[inputIOIndex].decimals * 1e18, order.validInputs[inputIOIndex].vaultId, - sVaultBalances[order.owner][order.validInputs[inputIOIndex].token][order.validInputs[inputIOIndex] - .vaultId], + LibFixedPointDecimalScale.scale18( + inputTokenVaultBalance, order.validInputs[inputIOIndex].decimals, 0 + ), // Don't know the balance diff yet! 0 ); } { + uint256 outputTokenVaultBalance = sVaultBalances[order.owner][order.validOutputs[outputIOIndex] + .token][order.validOutputs[outputIOIndex].vaultId]; callingContext[CONTEXT_VAULT_OUTPUTS_COLUMN - 1] = LibUint256Array.arrayFrom( uint256(uint160(order.validOutputs[outputIOIndex].token)), order.validOutputs[outputIOIndex].decimals * 1e18, order.validOutputs[outputIOIndex].vaultId, - sVaultBalances[order.owner][order.validOutputs[outputIOIndex].token][order.validOutputs[outputIOIndex] - .vaultId], + LibFixedPointDecimalScale.scale18( + outputTokenVaultBalance, order.validOutputs[outputIOIndex].decimals, 0 + ), // Don't know the balance diff yet! 0 ); @@ -854,8 +861,24 @@ contract OrderBook is IOrderBookV4, IMetaV1_2, ReentrancyGuard, Multicall, Order /// @param orderIOCalculation The verbatim order IO calculation returned by /// `_calculateOrderIO`. function recordVaultIO(uint256 input, uint256 output, OrderIOCalculationV2 memory orderIOCalculation) internal { - orderIOCalculation.context[CONTEXT_VAULT_INPUTS_COLUMN][CONTEXT_VAULT_IO_BALANCE_DIFF] = input; - orderIOCalculation.context[CONTEXT_VAULT_OUTPUTS_COLUMN][CONTEXT_VAULT_IO_BALANCE_DIFF] = output; + unchecked { + orderIOCalculation.context[CONTEXT_VAULT_INPUTS_COLUMN][CONTEXT_VAULT_IO_BALANCE_DIFF] = + LibFixedPointDecimalScale.scale18( + input, + orderIOCalculation.context[CONTEXT_VAULT_INPUTS_COLUMN][CONTEXT_VAULT_IO_TOKEN_DECIMALS] / 1e18, + 0 + ); + orderIOCalculation.context[CONTEXT_VAULT_OUTPUTS_COLUMN][CONTEXT_VAULT_IO_BALANCE_DIFF] = + LibFixedPointDecimalScale.scale18( + output, + orderIOCalculation.context[CONTEXT_VAULT_OUTPUTS_COLUMN][CONTEXT_VAULT_IO_TOKEN_DECIMALS] / 1e18, + // Round outputs diff up if the scaling causes a rounding error. + // This only happens if the token has more than 18 decimals. + // Generally it's safer to overestimate output than + // underestimate. + FLAG_ROUND_UP + ); + } if (input > 0) { // IMPORTANT! THIS MATH MUST BE CHECKED TO AVOID OVERFLOW. diff --git a/src/generated/OrderBookSubParser.pointers.sol b/src/generated/OrderBookSubParser.pointers.sol index d54542184..0ad31770b 100644 --- a/src/generated/OrderBookSubParser.pointers.sol +++ b/src/generated/OrderBookSubParser.pointers.sol @@ -9,10 +9,10 @@ pragma solidity =0.8.25; /// @dev Hash of the known bytecode. -bytes32 constant BYTECODE_HASH = bytes32(0xf8d804a6f741a21c63ef4bfe2330c4eeaee58c3ec6caaf63657f41e6d862f4a0); +bytes32 constant BYTECODE_HASH = bytes32(0x0c60cb3f7af79c229c38a06c1fed7cf23fb76e1177b7cad267b0a6eb4aff93e3); /// @dev The hash of the meta that describes the contract. -bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x37096fdde7b025c34cf7d2774f97f0fbb7711051fe45d959b7d34acadc31e4ee); +bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x1dbcdb005e2031aff1a4acda69b478f09665c3414e7b2a72f96c0c3099a380a9); /// @dev The parse meta that is used to lookup word definitions. /// The structure of the parse meta is: @@ -31,7 +31,7 @@ bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x37096fdde7b025c34cf7d2774f97 /// bit count of the previous bloom filter. If we reach the end of the bloom /// filters then we have a miss. bytes constant PARSE_META = - hex"01004800040040420206180010a00040003806204008040820840086010100000030088de69a165139fb02c9be1f14361d851dc13efa18bc2b16131296c8116682f50b6f6a660584c8d41c02582b1ad22c2f06bbcde61ea8967915b4f4091283156f0109ac301087b0c70398cd201f611967211923d122dd2b8317c02b171b3926a52035ccb90ea9bcef19d276fe0a865655075e0bc300d3b4e80f8316290de78f2e0c9fc5d509a7e6560427db4a"; + hex"010f400000028002c04430408080100088204004040001c04122021002014400002204bf47e41a19b4d70efcb25710917c780d8a999e00070e0c1bf88d921681b49419da75e908a426f7079c5bad20ce2f881edef4a21492cb9c172eb0931504342f01f5e3e51cc18c8712e8d28313b32a0b21b6e80f02af2c090611d3b80c5121240906775105ed58f018fc66531ff92d2111def2391d669daf0f6787972275a57f0aaef47f03bd62390bccc2da"; /// @dev The build depth of the parser meta. diff --git a/src/lib/LibOrderBookSubParser.sol b/src/lib/LibOrderBookSubParser.sol index 7a8cbdb38..0d530ca12 100644 --- a/src/lib/LibOrderBookSubParser.sol +++ b/src/lib/LibOrderBookSubParser.sol @@ -62,13 +62,13 @@ bytes constant WORD_CALCULATED_IO_RATIO = "calculated-io-ratio"; bytes constant WORD_INPUT_TOKEN = "input-token"; bytes constant WORD_INPUT_TOKEN_DECIMALS = "input-token-decimals"; bytes constant WORD_INPUT_VAULT_ID = "input-vault-id"; -bytes constant WORD_INPUT_VAULT_BALANCE_BEFORE = "uint256-input-vault-before"; -bytes constant WORD_INPUT_VAULT_BALANCE_INCREASE = "uint256-input-vault-increase"; +bytes constant WORD_INPUT_VAULT_BALANCE_BEFORE = "input-vault-before"; +bytes constant WORD_INPUT_VAULT_BALANCE_INCREASE = "input-vault-increase"; bytes constant WORD_OUTPUT_TOKEN = "output-token"; bytes constant WORD_OUTPUT_TOKEN_DECIMALS = "output-token-decimals"; bytes constant WORD_OUTPUT_VAULT_ID = "output-vault-id"; -bytes constant WORD_OUTPUT_VAULT_BALANCE_BEFORE = "uint256-output-vault-before"; -bytes constant WORD_OUTPUT_VAULT_BALANCE_DECREASE = "uint256-output-vault-decrease"; +bytes constant WORD_OUTPUT_VAULT_BALANCE_BEFORE = "output-vault-before"; +bytes constant WORD_OUTPUT_VAULT_BALANCE_DECREASE = "output-vault-decrease"; bytes constant WORD_DEPOSITOR = "depositor"; bytes constant WORD_DEPOSIT_TOKEN = "deposit-token"; diff --git a/test/concrete/ob/OrderBook.clear.context.t.sol b/test/concrete/ob/OrderBook.clear.context.t.sol new file mode 100644 index 000000000..d64ae5a47 --- /dev/null +++ b/test/concrete/ob/OrderBook.clear.context.t.sol @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: CAL +pragma solidity =0.8.25; + +import {OrderBookExternalRealTest} from "test/util/abstract/OrderBookExternalRealTest.sol"; +import {LibTestAddOrder} from "test/util/lib/LibTestAddOrder.sol"; +import { + OrderConfigV3, + OrderV3, + ActionV1, + ClearConfig, + SignedContextV1, + IO, + EvaluableV3 +} from "rain.orderbook.interface/interface/IOrderBookV4.sol"; +import {REVERTING_MOCK_BYTECODE} from "test/util/lib/LibTestConstants.sol"; +import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; + +import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol"; + +contract OrderBookClearOrderContextTest is OrderBookExternalRealTest { + using Strings for address; + using Strings for uint256; + + function testContextEmptyStack( + address alice, + address bob, + uint256 aliceInputVaultId, + uint256 aliceOutputVaultId, + uint256 bobInputVaultId, + uint256 bobOutputVaultId + ) external { + vm.assume(alice != bob); + + string memory usingWordsFrom = string.concat("using-words-from ", address(iSubParser).toHexString(), "\n"); + + bytes memory rainStringAlice = bytes( + string.concat( + usingWordsFrom, + "_ _:5 2;", + ":ensure(equal-to(input-token() ", + address(iToken0).toHexString(), + ") \"input token\"),", + ":ensure(equal-to(input-token-decimals() 12) \"input token decimals\"),", + ":ensure(equal-to(input-vault-id() ", + aliceInputVaultId.toHexString(), + ") \"input token vault\"),", + ":ensure(equal-to(input-vault-before() 0) \"input vault before\"),", + ":ensure(equal-to(output-token() ", + address(iToken1).toHexString(), + ") \"output token\"),", + ":ensure(equal-to(output-token-decimals() 6) \"output token decimals\"),", + ":ensure(equal-to(output-vault-id() ", + aliceOutputVaultId.toHexString(), + ") \"output token vault\"),", + ":ensure(equal-to(output-vault-before() 100) \"output vault before\"),", + ":ensure(equal-to(orderbook() ", + address(iOrderbook).toHexString(), + ") \"OrderBook\"),", + ":ensure(equal-to(order-clearer() ", + address(this).toHexString(), + ") \"clearer\"),", + ":ensure(equal-to(order-owner() ", + alice.toHexString(), + ") \"Alice\"),", + ":ensure(equal-to(order-counterparty() ", + bob.toHexString(), + ") \"Bob\"),", + ":ensure(equal-to(calculated-io-ratio() 2) \"alice io ratio\"),", + ":ensure(equal-to(output-vault-decrease() 1.5) \"alice output vault decrease\"),", + ":ensure(equal-to(input-vault-increase() 3) \"alice input vault increase\"),", + ":ensure(equal-to(calculated-max-output() 5) \"alice max output\");" + ) + ); + + bytes memory rainStringBob = bytes( + string.concat( + string.concat( + usingWordsFrom, + "_ _:3 0.5;", + ":ensure(equal-to(input-token() ", + address(iToken1).toHexString(), + ") \"input token\"),", + ":ensure(equal-to(input-token-decimals() 6) \"input token decimals\"),", + ":ensure(equal-to(input-vault-id() ", + bobInputVaultId.toHexString(), + ") \"input token vault\"),", + ":ensure(equal-to(input-vault-before() 0) \"input vault before\"),", + ":ensure(equal-to(output-token() ", + address(iToken0).toHexString(), + ") \"output token\"),", + ":ensure(equal-to(output-token-decimals() 12) \"output token decimals\"),", + ":ensure(equal-to(output-vault-id() ", + bobOutputVaultId.toHexString(), + ") \"output token vault\"),", + ":ensure(equal-to(output-vault-before() 100) \"output vault before\"),", + ":ensure(equal-to(orderbook() ", + address(iOrderbook).toHexString(), + ") \"OrderBook\")," + ), + ":ensure(equal-to(order-clearer() ", + address(this).toHexString(), + ") \"clearer\"),", + ":ensure(equal-to(order-owner() ", + bob.toHexString(), + ") \"Bob\"),", + ":ensure(equal-to(order-counterparty() ", + alice.toHexString(), + ") \"Alice\"),", + ":ensure(equal-to(calculated-io-ratio() 0.5) \"bob io ratio\"),", + ":ensure(equal-to(output-vault-decrease() 3) \"bob output vault decrease\"),", + ":ensure(equal-to(input-vault-increase() 1.5) \"bob input vault increase\"),", + ":ensure(equal-to(calculated-max-output() 3) \"bob max output\");" + ) + ); + + OrderConfigV3 memory configAlice; + { + IO[] memory validInputsAlice = new IO[](1); + validInputsAlice[0] = IO({token: address(iToken0), decimals: 12, vaultId: aliceInputVaultId}); + IO[] memory validOutputsAlice = new IO[](1); + validOutputsAlice[0] = IO({token: address(iToken1), decimals: 6, vaultId: aliceOutputVaultId}); + configAlice = OrderConfigV3({ + evaluable: EvaluableV3({ + bytecode: iParserV2.parse2(rainStringAlice), + interpreter: iInterpreter, + store: iStore + }), + validInputs: validInputsAlice, + validOutputs: validOutputsAlice, + nonce: 0, + secret: 0, + meta: "" + }); + } + OrderConfigV3 memory configBob; + { + IO[] memory validInputsBob = new IO[](1); + validInputsBob[0] = IO({token: address(iToken1), decimals: 6, vaultId: bobInputVaultId}); + + IO[] memory validOutputsBob = new IO[](1); + validOutputsBob[0] = IO({token: address(iToken0), decimals: 12, vaultId: bobOutputVaultId}); + + configBob = OrderConfigV3({ + evaluable: EvaluableV3({bytecode: iParserV2.parse2(rainStringBob), interpreter: iInterpreter, store: iStore}), + validInputs: validInputsBob, + validOutputs: validOutputsBob, + nonce: 0, + secret: 0, + meta: "" + }); + } + + vm.mockCall( + configAlice.validOutputs[0].token, + abi.encodeWithSelector(IERC20.transferFrom.selector, alice, address(iOrderbook)), + abi.encode(true) + ); + vm.mockCall( + configBob.validOutputs[0].token, + abi.encodeWithSelector(IERC20.transferFrom.selector, bob, address(iOrderbook)), + abi.encode(true) + ); + + OrderV3 memory orderAlice = + OrderV3(alice, configAlice.evaluable, configAlice.validInputs, configAlice.validOutputs, configAlice.nonce); + OrderV3 memory orderBob = + OrderV3(bob, configBob.evaluable, configBob.validInputs, configBob.validOutputs, configBob.nonce); + + vm.prank(alice); + iOrderbook.addOrder2(configAlice, new ActionV1[](0)); + + vm.prank(alice); + iOrderbook.deposit2( + configAlice.validOutputs[0].token, configAlice.validOutputs[0].vaultId, 100e6, new ActionV1[](0) + ); + + vm.prank(bob); + iOrderbook.addOrder2(configBob, new ActionV1[](0)); + + vm.prank(bob); + iOrderbook.deposit2( + configBob.validOutputs[0].token, configBob.validOutputs[0].vaultId, 100e12, new ActionV1[](0) + ); + + iOrderbook.clear2( + orderAlice, orderBob, ClearConfig(0, 0, 0, 0, 0, 0), new SignedContextV1[](0), new SignedContextV1[](0) + ); + } +} diff --git a/test/concrete/ob/OrderBook.quote.t.sol b/test/concrete/ob/OrderBook.quote.t.sol index 701150119..d50f2b73f 100644 --- a/test/concrete/ob/OrderBook.quote.t.sol +++ b/test/concrete/ob/OrderBook.quote.t.sol @@ -19,6 +19,7 @@ import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol"; /// @title OrderBookQuoteTest contract OrderBookQuoteTest is OrderBookExternalRealTest { using Strings for address; + using Strings for uint256; /// Dead orders always eval to false. function testQuoteDeadOrder(Quote memory quoteConfig) external view { @@ -39,7 +40,9 @@ contract OrderBookQuoteTest is OrderBookExternalRealTest { LibTestAddOrder.conformConfig(config, iInterpreter, iStore); config.validOutputs[0].token = address(iToken0); - config.validOutputs[0].decimals = 18; + config.validOutputs[0].decimals = 12; + vm.mockCall(address(iToken0), abi.encodeWithSelector(IERC20Metadata.decimals.selector), abi.encode(12)); + config.validInputs[0].token = address(iToken1); config.validInputs[0].decimals = 6; vm.mockCall(address(iToken1), abi.encodeWithSelector(IERC20Metadata.decimals.selector), abi.encode(6)); @@ -71,8 +74,8 @@ contract OrderBookQuoteTest is OrderBookExternalRealTest { Quote({order: order, inputIOIndex: 0, outputIOIndex: 0, signedContext: new SignedContextV1[](0)}); (bool success, uint256 maxOutput, uint256 ioRatio) = iOrderbook.quote(quoteConfig); assert(success); - assertEq(maxOutput, expectedMaxOutput[i]); - assertEq(ioRatio, expectedIoRatio[i]); + assertEq(maxOutput, expectedMaxOutput[i], "max output"); + assertEq(ioRatio, expectedIoRatio[i], "io ratio"); } } @@ -97,19 +100,21 @@ contract OrderBookQuoteTest is OrderBookExternalRealTest { } function testQuoteSimple(address owner, OrderConfigV3 memory config, uint256 depositAmount) external { - depositAmount = bound(depositAmount, 1e18, type(uint256).max); + depositAmount = bound(depositAmount, 1e18, type(uint256).max / 1e6); checkQuote(owner, config, "_ _:1 2;", depositAmount, 1e18, 2e18); } /// The output will be maxed at the deposit in the vault. function testQuoteMaxOutput(address owner, OrderConfigV3 memory config, uint256 depositAmount) external { - depositAmount = bound(depositAmount, 1, 1e18); - checkQuote(owner, config, "_ _:1 2;:;", depositAmount, depositAmount, 2e18); + depositAmount = bound(depositAmount, 1, 1e12); + checkQuote(owner, config, "_ _:1 2;:;", depositAmount, depositAmount * 1e6, 2e18); } /// Can access context. function testQuoteContextSender(address owner, OrderConfigV3 memory config, uint256 depositAmount) external { - depositAmount = bound(depositAmount, 1e18, type(uint256).max); + // Max amount needs to be small enough to be scaled up to 18 decimals + // from 12 decimals. + depositAmount = bound(depositAmount, 1e18, type(uint256).max / 1e6); string memory usingWordsFrom = string.concat("using-words-from ", address(iSubParser).toHexString(), "\n"); @@ -140,8 +145,15 @@ contract OrderBookQuoteTest is OrderBookExternalRealTest { // vault io vault id // not easy to test with this setup // rainlang[6] = "_ _:1 context<3 2>();:;"; - // vault io balance before - rainlang[6] = "_ _:1 context<3 3>();:;"; + // input vault balance before + rainlang[6] = bytes( + string.concat( + usingWordsFrom, + ":ensure(equal-to(input-vault-before() context<3 3>()) \"input vault before\"),", + ":ensure(equal-to(input-vault-before() 0) \"input vault before literal\"),", + "_ _:1 context<3 3>();:;" + ) + ); // outputs // vault output token rainlang[7] = "_ _:1 context<4 0>();:;"; @@ -150,15 +162,24 @@ contract OrderBookQuoteTest is OrderBookExternalRealTest { string.concat( usingWordsFrom, ":ensure(equal-to(output-token-decimals() context<4 1>()) \"output decimals\"),", - ":ensure(equal-to(output-token-decimals() 18) \"output decimals literal\"),", + ":ensure(equal-to(output-token-decimals() 12) \"output decimals literal\"),", "_ _:1 context<4 1>();:;" ) ); // vault io vault id // not easy to test with this setup // rainlang[9] = "_ _:1 context<4 2>();:;"; - // vault io balance before - rainlang[9] = "_ _:1 context<4 3>();:;"; + // output vault balance before + rainlang[9] = bytes( + string.concat( + usingWordsFrom, + ":ensure(equal-to(output-vault-before() context<4 3>()) \"output vault before\"),", + ":ensure(equal-to(output-vault-before() ", + depositAmount.toString(), + "e-12) \"output vault before literal\"),", + "_ _:1 context<4 3>();:;" + ) + ); uint256[] memory expectedMaxOutput = new uint256[](10); expectedMaxOutput[0] = 1e18; @@ -182,8 +203,9 @@ contract OrderBookQuoteTest is OrderBookExternalRealTest { expectedIoRatio[5] = 6e18; expectedIoRatio[6] = 0; expectedIoRatio[7] = uint256(uint160(address(iToken0))); - expectedIoRatio[8] = 18e18; - expectedIoRatio[9] = depositAmount; + expectedIoRatio[8] = 12e18; + // Output decimals scaled to 18 fixed point value from 12. + expectedIoRatio[9] = depositAmount * 1e6; checkQuote(owner, config, rainlang, depositAmount, expectedMaxOutput, expectedIoRatio); } diff --git a/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceBefore.t.sol b/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceBefore.t.sol index c4a423041..2ca4e9b7e 100644 --- a/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceBefore.t.sol +++ b/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceBefore.t.sol @@ -5,6 +5,6 @@ import {OrderBookSubParserContextTest} from "test/util/abstract/OrderBookSubPars contract OrderBookSubParserContextVaultBalanceBeforeTest is OrderBookSubParserContextTest { function word() internal pure override returns (string memory) { - return "uint256-input-vault-before"; + return "input-vault-before"; } } diff --git a/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceIncrease.t.sol b/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceIncrease.t.sol index 153cb2e74..09c395487 100644 --- a/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceIncrease.t.sol +++ b/test/concrete/parser/OrderBookSubParser.contextInputVaultBalanceIncrease.t.sol @@ -5,6 +5,6 @@ import {OrderBookSubParserContextTest} from "test/util/abstract/OrderBookSubPars contract OrderBookSubParserContextInputVaultBalanceIncreaseTest is OrderBookSubParserContextTest { function word() internal pure override returns (string memory) { - return "uint256-input-vault-increase"; + return "input-vault-increase"; } } diff --git a/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceBefore.t.sol b/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceBefore.t.sol index 1a5b9d719..3634f02b4 100644 --- a/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceBefore.t.sol +++ b/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceBefore.t.sol @@ -5,6 +5,6 @@ import {OrderBookSubParserContextTest} from "test/util/abstract/OrderBookSubPars contract OrderBookSubParserContextOutputVaultBalanceBeforeTest is OrderBookSubParserContextTest { function word() internal pure override returns (string memory) { - return "uint256-output-vault-before"; + return "output-vault-before"; } } diff --git a/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceDecrease.t.sol b/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceDecrease.t.sol index 43cf26261..4cbd66971 100644 --- a/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceDecrease.t.sol +++ b/test/concrete/parser/OrderBookSubParser.contextOutputVaultBalanceDecrease.t.sol @@ -5,6 +5,6 @@ import {OrderBookSubParserContextTest} from "test/util/abstract/OrderBookSubPars contract OrderBookSubParserContextOutputVaultBalanceDecreaseTest is OrderBookSubParserContextTest { function word() internal pure override returns (string memory) { - return "uint256-output-vault-decrease"; + return "output-vault-decrease"; } } diff --git a/test/util/abstract/OrderBookExternalRealTest.sol b/test/util/abstract/OrderBookExternalRealTest.sol index 98f2256be..d640aa128 100644 --- a/test/util/abstract/OrderBookExternalRealTest.sol +++ b/test/util/abstract/OrderBookExternalRealTest.sol @@ -28,6 +28,7 @@ import {IERC20Metadata} from "openzeppelin-contracts/contracts/token/ERC20/exten abstract contract OrderBookExternalRealTest is Test, IOrderBookV4Stub { IInterpreterV3 internal immutable iInterpreter; IInterpreterStoreV2 internal immutable iStore; + RainterpreterParserNPE2 internal immutable iParser; IParserV2 internal immutable iParserV2; IOrderBookV4 internal immutable iOrderbook; IERC20 internal immutable iToken0; @@ -37,12 +38,12 @@ abstract contract OrderBookExternalRealTest is Test, IOrderBookV4Stub { constructor() { iInterpreter = IInterpreterV3(new RainterpreterNPE2()); iStore = IInterpreterStoreV2(new RainterpreterStoreNPE2()); - address parser = address(new RainterpreterParserNPE2()); + iParser = new RainterpreterParserNPE2(); iParserV2 = new RainterpreterExpressionDeployerNPE2( RainterpreterExpressionDeployerNPE2ConstructionConfigV2({ interpreter: address(iInterpreter), store: address(iStore), - parser: parser + parser: address(iParser) }) ); @@ -59,6 +60,24 @@ abstract contract OrderBookExternalRealTest is Test, IOrderBookV4Stub { iSubParser = new OrderBookSubParser(); } + function assumeEtchable(address account) internal view { + assumeNotPrecompile(account); + vm.assume(account != address(iInterpreter)); + vm.assume(account != address(iStore)); + vm.assume(account != address(iParserV2)); + vm.assume(account != address(iParser)); + + vm.assume(account != address(iOrderbook)); + vm.assume(account != address(iToken0)); + vm.assume(account != address(iToken1)); + vm.assume(account != address(iSubParser)); + + vm.assume(account != address(this)); + vm.assume(account != address(vm)); + // The console. + vm.assume(account != address(0x000000000000000000636F6e736F6c652e6c6f67)); + } + function evalsToActions(bytes[] memory evals) internal view returns (ActionV1[] memory) { ActionV1[] memory actions = new ActionV1[](evals.length); for (uint256 i = 0; i < evals.length; i++) {