Skip to content

Commit 06871eb

Browse files
committed
ValidationCallback to non view
1 parent a45539c commit 06871eb

18 files changed

+128
-8
lines changed
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"DirectFillerFillMacroSingleOrder": "135820",
3+
"DirectFillerFillMacroSingleOrderWithFee": "174331",
4+
"DirectFillerFillMacroThreeOrdersWithFees": "433336",
5+
"DirectFillerFillMacroTwoOrders": "255333"
6+
}

snapshots/DutchOrderReactorTest.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"BaseExecuteSingleWithFee": "176167",
3+
"ExecuteBatch": "188355",
4+
"ExecuteBatchMultipleOutputs": "197673",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "250894",
6+
"ExecuteBatchNativeOutput": "184399",
7+
"ExecuteSingle": "142617",
8+
"ExecuteSingleNativeOutput": "130688",
9+
"ExecuteSingleValidation": "151908",
10+
"RevertInvalidNonce": "22119"
11+
}
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"DirectFillerFillMacroTestEth1Output": "147001",
3+
"DirectFillerFillMacroTestEth2Outputs": "170048"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"EthOutputTest3OrdersWithEthAndERC20Outputs": "362022",
3+
"EthOutputTestEthOutput": "156137"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"BaseExecuteSingleWithFee": "176269",
3+
"ExecuteBatch": "188547",
4+
"ExecuteBatchMultipleOutputs": "197865",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "251086",
6+
"ExecuteBatchNativeOutput": "184591",
7+
"ExecuteSingle": "142727",
8+
"ExecuteSingleNativeOutput": "130798",
9+
"ExecuteSingleValidation": "152018",
10+
"RevertInvalidNonce": "22218"
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"testExclusiveFillerSucceeds": "170981"
3+
}

snapshots/LimitOrderReactorTest.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"BaseExecuteSingleWithFee": "172635",
3+
"ExecuteBatch": "181215",
4+
"ExecuteBatchMultipleOutputs": "189732",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "242149",
6+
"ExecuteBatchNativeOutput": "177259",
7+
"ExecuteSingle": "139086",
8+
"ExecuteSingleNativeOutput": "127157",
9+
"ExecuteSingleValidation": "148377",
10+
"RevertInvalidNonce": "18599"
11+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"V3-DutchDecay": "16243",
3+
"V3-DutchDecayFullyDecayed": "7838",
4+
"V3-DutchDecayFullyDecayedNegative": "7555",
5+
"V3-DutchDecayNegative": "15239",
6+
"V3-DutchDecayNoDecayYet": "5692",
7+
"V3-DutchDecayNoDecayYetNegative": "5664",
8+
"V3-ExtendedMultiPointDutchDecay": "105758",
9+
"V3-LocateCurvePositionMulti": "17610",
10+
"V3-LocateCurvePositionSingle": "4191",
11+
"V3-MultiPointDutchDecay": "33549"
12+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"testPriceOracleValidationSucceeds": "176008"
3+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"BaseExecuteSingleWithFee": "178476",
3+
"ExecuteBatch": "192994",
4+
"ExecuteBatchMultipleOutputs": "202189",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "255286",
6+
"ExecuteBatchNativeOutput": "189038",
7+
"ExecuteSingle": "144934",
8+
"ExecuteSingleNativeOutput": "133005",
9+
"ExecuteSingleValidation": "154225",
10+
"InputPriorityFee": "147237",
11+
"OutputPriorityFee": "147243",
12+
"OutputPriorityFeeAndBaselinePriorityFee": "147243",
13+
"OverrideAuctionTargetBlock": "124368",
14+
"RevertInvalidNonce": "8831"
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"ProtocolFeesGasComparisonTest-InterfaceAndProtocolFee": "173378",
3+
"ProtocolFeesGasComparisonTest-InterfaceAndProtocolFeeEthOutput": "161897",
4+
"ProtocolFeesGasComparisonTest-InterfaceFee": "162696",
5+
"ProtocolFeesGasComparisonTest-InterfaceFeeEthOutput": "146041",
6+
"ProtocolFeesGasComparisonTest-NoFees": "146136",
7+
"ProtocolFeesGasComparisonTest-NoFeesEthOutput": "124307"
8+
}
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"SwapRouter02ExecutorExecute": "260367",
3+
"SwapRouter02ExecutorExecuteAlreadyApproved": "117992"
4+
}

snapshots/V2DutchOrderTest.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"BaseExecuteSingleWithFee": "182252",
3+
"ExclusiveFiller": "152472",
4+
"ExecuteBatch": "200564",
5+
"ExecuteBatchMultipleOutputs": "210371",
6+
"ExecuteBatchMultipleOutputsDifferentTokens": "264081",
7+
"ExecuteBatchNativeOutput": "196608",
8+
"ExecuteSingle": "148702",
9+
"ExecuteSingleNativeOutput": "136773",
10+
"ExecuteSingleValidation": "157993",
11+
"InputOverride": "152550",
12+
"OutputOverride": "152499",
13+
"RevertInvalidNonce": "28124"
14+
}

snapshots/V3DutchOrderTest.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"BaseExecuteSingleWithFee": "192359",
3+
"ExecuteBatch": "220957",
4+
"ExecuteBatchMultipleOutputs": "234094",
5+
"ExecuteBatchMultipleOutputsDifferentTokens": "291152",
6+
"ExecuteBatchNativeOutput": "217001",
7+
"ExecuteSingle": "158808",
8+
"ExecuteSingleNativeOutput": "146879",
9+
"ExecuteSingleValidation": "168099",
10+
"RevertInvalidNonce": "38156",
11+
"V3-ExclusiveFiller": "162677",
12+
"V3-InputOverride": "162758",
13+
"V3-OutputOverride": "162701"
14+
}

src/interfaces/IValidationCallback.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ interface IValidationCallback {
88
/// @notice Called by the reactor for custom validation of an order. Will revert if validation fails
99
/// @param filler The filler of the order
1010
/// @param resolvedOrder The resolved order to fill
11-
function validate(address filler, ResolvedOrder calldata resolvedOrder) external view;
11+
function validate(address filler, ResolvedOrder calldata resolvedOrder) external;
1212
}

src/lib/ResolvedOrderLib.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ library ResolvedOrderLib {
1010

1111
/// @notice Validates a resolved order, reverting if invalid
1212
/// @param filler The filler of the order
13-
function validate(ResolvedOrder memory resolvedOrder, address filler) internal view {
13+
function validate(ResolvedOrder memory resolvedOrder, address filler) internal {
1414
if (address(this) != address(resolvedOrder.info.reactor)) {
1515
revert InvalidReactor();
1616
}

src/sample-validation-contracts/PriceOracleValidation.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ contract PriceOracleValidation is IValidationCallback {
3535
error FailedToCallValidationContract(bytes reason);
3636
error InsufficientOutput(uint256 minOutput, uint256 actualOutput);
3737

38-
function validate(address, ResolvedOrder calldata resolvedOrder) external view {
38+
function validate(address, ResolvedOrder calldata resolvedOrder) external {
3939
(address to, bytes memory data) = abi.decode(resolvedOrder.info.additionalValidationData, (address, bytes));
4040

4141
// No strict interface enforced here
42-
(bool success, bytes memory returnData) = address(to).staticcall(data);
42+
(bool success, bytes memory returnData) = address(to).call(data);
4343
if (!success) {
4444
revert FailedToCallValidationContract(returnData);
4545
}
46-
uint256 amount = abi.decode(returnData, (uint256));
46+
uint256 amountOut = abi.decode(returnData, (uint256));
4747

4848
uint256 totalOutputAmount;
4949
for (uint256 i = 0; i < resolvedOrder.outputs.length; i++) {
5050
totalOutputAmount += resolvedOrder.outputs[i].amount;
5151
}
52-
if (amount < totalOutputAmount) {
53-
revert InsufficientOutput(amount, totalOutputAmount);
52+
if (amountOut < totalOutputAmount) {
53+
revert InsufficientOutput(amountOut, totalOutputAmount);
5454
}
5555
}
5656
}

test/util/mock/MockResolvedOrderLib.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {ResolvedOrderLib} from "../../../src/lib/ResolvedOrderLib.sol";
77
contract MockResolvedOrderLib {
88
using ResolvedOrderLib for ResolvedOrder;
99

10-
function validate(ResolvedOrder memory resolvedOrder, address filler) external view {
10+
function validate(ResolvedOrder memory resolvedOrder, address filler) external {
1111
resolvedOrder.validate(filler);
1212
}
1313
}

0 commit comments

Comments
 (0)