Skip to content

Commit

Permalink
Merge pull request #33 from ProjectOpenSea/emo/remove-unused-errors
Browse files Browse the repository at this point in the history
remove unused errors
  • Loading branch information
0age authored Feb 28, 2024
2 parents 8da655a + 8e3ef33 commit d066634
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 197 deletions.
107 changes: 0 additions & 107 deletions src/types/lib/ConsiderationErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -378,38 +378,6 @@ function _revertInvalidTime(uint256 startTime, uint256 endTime) pure {
}
}

/**
* @dev Reverts execution with a
* "MismatchedFulfillmentOfferAndConsiderationComponents" error message.
*
* @param fulfillmentIndex The index of the fulfillment that caused the
* error.
*/
function _revertMismatchedFulfillmentOfferAndConsiderationComponents(
uint256 fulfillmentIndex
) pure {
assembly {
// Store left-padded selector with push4 (reduces bytecode),
// mem[28:32] = selector
mstore(0, MismatchedOfferAndConsiderationComponents_error_selector)

// Store fulfillment index argument.
mstore(
MismatchedOfferAndConsiderationComponents_error_idx_ptr,
fulfillmentIndex
)

// revert(abi.encodeWithSignature(
// "MismatchedFulfillmentOfferAndConsiderationComponents(uint256)",
// fulfillmentIndex
// ))
revert(
Error_selector_offset,
MismatchedOfferAndConsiderationComponents_error_length
)
}
}

/**
* @dev Reverts execution with a "MissingFulfillmentComponentOnAggregation"
* error message.
Expand Down Expand Up @@ -486,26 +454,6 @@ function _revertNoSpecifiedOrdersAvailable() pure {
}
}

/**
* @dev Reverts execution with a "OfferAndConsiderationRequiredOnFulfillment"
* error message.
*/
function _revertOfferAndConsiderationRequiredOnFulfillment() pure {
assembly {
// Store left-padded selector with push4 (reduces bytecode),
// mem[28:32] = selector
mstore(0, OfferAndConsiderationRequiredOnFulfillment_error_selector)

// revert(abi.encodeWithSignature(
// "OfferAndConsiderationRequiredOnFulfillment()"
// ))
revert(
Error_selector_offset,
OfferAndConsiderationRequiredOnFulfillment_error_length
)
}
}

/**
* @dev Reverts execution with an "OrderAlreadyFilled" error message.
*
Expand Down Expand Up @@ -616,61 +564,6 @@ function _revertPartialFillsNotEnabledForOrder() pure {
}
}

/**
* @dev Reverts execution with an "UnresolvedConsiderationCriteria" error
* message.
*/
function _revertUnresolvedConsiderationCriteria(
uint256 orderIndex,
uint256 considerationIndex
) pure {
assembly {
// Store left-padded selector with push4 (reduces bytecode),
// mem[28:32] = selector
mstore(0, UnresolvedConsiderationCriteria_error_selector)

// Store orderIndex and considerationIndex arguments.
mstore(UnresolvedConsiderationCriteria_error_orderIndex_ptr, orderIndex)
mstore(
UnresolvedConsiderationCriteria_error_considerationIdx_ptr,
considerationIndex
)

// revert(abi.encodeWithSignature(
// "UnresolvedConsiderationCriteria(uint256, uint256)",
// orderIndex,
// considerationIndex
// ))
revert(
Error_selector_offset, UnresolvedConsiderationCriteria_error_length
)
}
}

/**
* @dev Reverts execution with an "UnresolvedOfferCriteria" error message.
*/
function _revertUnresolvedOfferCriteria(uint256 orderIndex, uint256 offerIndex)
pure
{
assembly {
// Store left-padded selector with push4 (reduces bytecode),
// mem[28:32] = selector
mstore(0, UnresolvedOfferCriteria_error_selector)

// Store arguments.
mstore(UnresolvedOfferCriteria_error_orderIndex_ptr, orderIndex)
mstore(UnresolvedOfferCriteria_error_offerIndex_ptr, offerIndex)

// revert(abi.encodeWithSignature(
// "UnresolvedOfferCriteria(uint256, uint256)",
// orderIndex,
// offerIndex
// ))
revert(Error_selector_offset, UnresolvedOfferCriteria_error_length)
}
}

/**
* @dev Reverts execution with an "UnusedItemParameters" error message.
*/
Expand Down
39 changes: 0 additions & 39 deletions test/foundry/ConsiderationErrors.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@ contract ConsiderationErrors is BaseOrderTest, ConsiderationErrorsWrapper {
this.__revertInvalidTime(6, 7);
}

function test_revertMismatchedFulfillmentOfferAndConsiderationComponents()
public
{
vm.expectRevert(
abi.encodeWithSignature(
"MismatchedFulfillmentOfferAndConsiderationComponents(uint256)",
8
)
);
this.__revertMismatchedFulfillmentOfferAndConsiderationComponents(8);
}

function test_revertMissingOriginalConsiderationItems() public {
vm.expectRevert(
abi.encodeWithSignature("MissingOriginalConsiderationItems()")
Expand All @@ -135,15 +123,6 @@ contract ConsiderationErrors is BaseOrderTest, ConsiderationErrorsWrapper {
this.__revertNoSpecifiedOrdersAvailable();
}

function test_revertOfferAndConsiderationRequiredOnFulfillment() public {
vm.expectRevert(
abi.encodeWithSignature(
"OfferAndConsiderationRequiredOnFulfillment()"
)
);
this.__revertOfferAndConsiderationRequiredOnFulfillment();
}

function test_revertOrderAlreadyFilled() public {
vm.expectRevert(
abi.encodeWithSignature("OrderAlreadyFilled(bytes32)", someBytes32)
Expand Down Expand Up @@ -183,24 +162,6 @@ contract ConsiderationErrors is BaseOrderTest, ConsiderationErrorsWrapper {
this.__revertPartialFillsNotEnabledForOrder();
}

function test_revertUnresolvedConsiderationCriteria() public {
vm.expectRevert(
abi.encodeWithSignature(
"UnresolvedConsiderationCriteria(uint256,uint256)", 9, 10
)
);
this.__revertUnresolvedConsiderationCriteria(9, 10);
}

function test_revertUnresolvedOfferCriteria() public {
vm.expectRevert(
abi.encodeWithSignature(
"UnresolvedOfferCriteria(uint256,uint256)", 11, 12
)
);
this.__revertUnresolvedOfferCriteria(11, 12);
}

function test_revertUnusedItemParameters() public {
vm.expectRevert(abi.encodeWithSignature("UnusedItemParameters()"));
this.__revertUnusedItemParameters();
Expand Down
51 changes: 0 additions & 51 deletions test/foundry/utils/ConsiderationErrorsWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@ import {
_revertInvalidNativeOfferItem,
_revertInvalidProof,
_revertInvalidTime,
_revertMismatchedFulfillmentOfferAndConsiderationComponents,
_revertMissingFulfillmentComponentOnAggregation,
_revertMissingOriginalConsiderationItems,
_revertNoReentrantCalls,
_revertNoSpecifiedOrdersAvailable,
_revertOfferAndConsiderationRequiredOnFulfillment,
_revertOrderAlreadyFilled,
_revertOrderCriteriaResolverOutOfRange,
_revertOrderIsCancelled,
_revertOrderPartiallyFilled,
_revertPartialFillsNotEnabledForOrder,
_revertUnresolvedConsiderationCriteria,
_revertUnresolvedOfferCriteria,
_revertUnusedItemParameters
} from "seaport-types/src/lib/ConsiderationErrors.sol";

Expand Down Expand Up @@ -176,21 +172,6 @@ contract ConsiderationErrorsWrapper {
_revertInvalidTime(startTime, endTime);
}

/**
* @dev Reverts execution with a
* "MismatchedFulfillmentOfferAndConsiderationComponents" error message.
*
* @param fulfillmentIndex The index of the fulfillment that caused the
* error.
*/
function __revertMismatchedFulfillmentOfferAndConsiderationComponents(
uint256 fulfillmentIndex
) external pure {
_revertMismatchedFulfillmentOfferAndConsiderationComponents(
fulfillmentIndex
);
}

/**
* @dev Reverts execution with a "MissingFulfillmentComponentOnAggregation"
* error message.
Expand Down Expand Up @@ -228,17 +209,6 @@ contract ConsiderationErrorsWrapper {
_revertNoSpecifiedOrdersAvailable();
}

/**
* @dev Reverts execution with a "OfferAndConsiderationRequiredOnFulfillment"
* error message.
*/
function __revertOfferAndConsiderationRequiredOnFulfillment()
external
pure
{
_revertOfferAndConsiderationRequiredOnFulfillment();
}

/**
* @dev Reverts execution with an "OrderAlreadyFilled" error message.
*
Expand Down Expand Up @@ -286,27 +256,6 @@ contract ConsiderationErrorsWrapper {
_revertPartialFillsNotEnabledForOrder();
}

/**
* @dev Reverts execution with an "UnresolvedConsiderationCriteria" error
* message.
*/
function __revertUnresolvedConsiderationCriteria(
uint256 orderIndex,
uint256 considerationIndex
) external pure {
_revertUnresolvedConsiderationCriteria(orderIndex, considerationIndex);
}

/**
* @dev Reverts execution with an "UnresolvedOfferCriteria" error message.
*/
function __revertUnresolvedOfferCriteria(
uint256 orderIndex,
uint256 offerIndex
) external pure {
_revertUnresolvedOfferCriteria(orderIndex, offerIndex);
}

/**
* @dev Reverts execution with an "UnusedItemParameters" error message.
*/
Expand Down

0 comments on commit d066634

Please sign in to comment.