Skip to content

Commit

Permalink
Merge pull request #19 from ProjectOpenSea/bubble-up-contract-order-r…
Browse files Browse the repository at this point in the history
…everts

bubble up contract order reverts
  • Loading branch information
DJViau authored Feb 15, 2024
2 parents 901d051 + 6b63ba8 commit 378ceb5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
32 changes: 7 additions & 25 deletions src/core/lib/OrderValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions test/foundry/new/helpers/FuzzMutationSelectorLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -804,15 +804,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
Expand Down

0 comments on commit 378ceb5

Please sign in to comment.