From 6bbc45611193040c077d0e8772f345fa483af180 Mon Sep 17 00:00:00 2001 From: 0age <0age@protonmail.com> Date: Thu, 15 Feb 2024 13:12:13 -0500 Subject: [PATCH 1/2] bubble up contract order reverts --- src/core/lib/OrderValidator.sol | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/src/core/lib/OrderValidator.sol b/src/core/lib/OrderValidator.sol index 18a6c66..7b69202 100644 --- a/src/core/lib/OrderValidator.sol +++ b/src/core/lib/OrderValidator.sol @@ -698,7 +698,13 @@ contract OrderValidator is Executor, ZoneInteraction { // Revert or skip if the call to generate the contract order failed. if (!success) { - return _revertOrReturnEmpty(revertOnInvalid, orderHash); + if (revertOnInvalid) { + _revertWithReasonIfOneIsReturned(); + + _revertInvalidContractOrder(orderHash); + } + + return bytes32(0); } } @@ -1019,30 +1025,6 @@ contract OrderValidator is Executor, ZoneInteraction { ); } - /** - * @dev Internal pure function to either revert or return an empty tuple - * depending on the value of `revertOnInvalid`. - * - * @param revertOnInvalid Whether to revert on invalid input. - * @param contractOrderHash The contract order hash. - * - * @return orderHash The order hash. - */ - function _revertOrReturnEmpty( - bool revertOnInvalid, - bytes32 contractOrderHash - ) - internal - pure - returns (bytes32 orderHash) - { - if (revertOnInvalid) { - _revertInvalidContractOrder(contractOrderHash); - } - - return bytes32(0); - } - /** * @dev Internal pure function to check whether a given order type indicates * that partial fills are not supported (e.g. only "full fills" are From 6b63ba8444e6a35c1d7a54535a15e3991f35aad2 Mon Sep 17 00:00:00 2001 From: DJViau Date: Thu, 15 Feb 2024 13:38:41 -0500 Subject: [PATCH 2/2] fix old copy paste mistake --- test/foundry/new/helpers/FuzzMutationSelectorLib.sol | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/foundry/new/helpers/FuzzMutationSelectorLib.sol b/test/foundry/new/helpers/FuzzMutationSelectorLib.sol index e34c9b2..2364bf6 100644 --- a/test/foundry/new/helpers/FuzzMutationSelectorLib.sol +++ b/test/foundry/new/helpers/FuzzMutationSelectorLib.sol @@ -797,15 +797,14 @@ library FailureDetailsLib { details_withOrderHash ); - failureDetailsArray[i++] = ZoneInteractionErrors - .InvalidContractOrder + failureDetailsArray[i++] = HashCalldataContractOfferer + .HashCalldataContractOffererGenerateOrderReverts .selector .withOrder( "InvalidContractOrder_generateReverts", FuzzMutations - .mutation_invalidContractOrderGenerateReturnsInvalidEncoding - .selector, - details_withOrderHash + .mutation_invalidContractOrderGenerateReverts + .selector ); failureDetailsArray[i++] = HashCalldataContractOfferer