Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discuss: potential direction for refactoring differential tests #1293

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contracts/conduit/Conduit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ import { Conduit as CoreConduit } from "seaport-core/src/conduit/Conduit.sol";
* approved ERC20/721/1155 tokens to be taken immediately — be extremely
* cautious with what conduits you give token approvals to!*
*/
contract LocalConduit is CoreConduit {}
contract LocalConduit is CoreConduit {

}
8 changes: 6 additions & 2 deletions contracts/conduit/ConduitController.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { ConduitController as CoreConduitController } from "seaport-core/src/conduit/ConduitController.sol";
import {
ConduitController as CoreConduitController
} from "seaport-core/src/conduit/ConduitController.sol";

/**
* @title ConduitController
Expand All @@ -10,4 +12,6 @@ import { ConduitController as CoreConduitController } from "seaport-core/src/con
* contracts that allow registered callers (or open "channels") to
* transfer approved ERC20/721/1155 tokens on their behalf.
*/
contract LocalConduitController is CoreConduitController {}
contract LocalConduitController is CoreConduitController {

}
12 changes: 9 additions & 3 deletions contracts/helpers/TransferHelper.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { IERC721Receiver } from "seaport-types/src/interfaces/IERC721Receiver.sol";
import {
IERC721Receiver
} from "seaport-types/src/interfaces/IERC721Receiver.sol";

import {
TransferHelperItem,
TransferHelperItemsWithRecipient
} from "seaport-types/src/helpers/TransferHelperStructs.sol";

import { ConduitItemType } from "seaport-types/src/conduit/lib/ConduitEnums.sol";
import {
ConduitItemType
} from "seaport-types/src/conduit/lib/ConduitEnums.sol";

import {
ConduitInterface
Expand All @@ -18,7 +22,9 @@ import {
ConduitControllerInterface
} from "seaport-types/src/interfaces/ConduitControllerInterface.sol";

import { ConduitTransfer } from "seaport-types/src/conduit/lib/ConduitStructs.sol";
import {
ConduitTransfer
} from "seaport-types/src/conduit/lib/ConduitStructs.sol";

import {
TransferHelperInterface
Expand Down
34 changes: 17 additions & 17 deletions contracts/helpers/order-validator/lib/Murky.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ contract Murky {
********************/

/// ascending sort and concat prior to hashing
function _hashLeafPairs(bytes32 left, bytes32 right)
internal
pure
returns (bytes32 _hash)
{
function _hashLeafPairs(
bytes32 left,
bytes32 right
) internal pure returns (bytes32 _hash) {
assembly {
switch lt(left, right)
case 0 {
Expand All @@ -58,7 +57,9 @@ contract Murky {
* PROOF GENERATION *
********************/

function _getRoot(uint256[] memory data)
function _getRoot(
uint256[] memory data
)
internal
pure
returns (bytes32 result, ErrorsAndWarnings memory errorsAndWarnings)
Expand Down Expand Up @@ -159,7 +160,10 @@ contract Murky {
}
}

function _getProof(uint256[] memory data, uint256 node)
function _getProof(
uint256[] memory data,
uint256 node
)
internal
pure
returns (
Expand Down Expand Up @@ -316,11 +320,9 @@ contract Murky {
/**
* Hashes each element of the input array in place using keccak256
*/
function _processInput(uint256[] memory data)
private
pure
returns (bool sorted)
{
function _processInput(
uint256[] memory data
) private pure returns (bool sorted) {
sorted = true;

// Hash inputs with keccak256
Expand Down Expand Up @@ -352,11 +354,9 @@ contract Murky {
bytes32 hash;
}

function _sortUint256ByHash(uint256[] memory values)
internal
pure
returns (uint256[] memory sortedValues)
{
function _sortUint256ByHash(
uint256[] memory values
) internal pure returns (uint256[] memory sortedValues) {
HashAndIntTuple[] memory toSort = new HashAndIntTuple[](values.length);
for (uint256 i = 0; i < values.length; i++) {
toSort[i] = HashAndIntTuple(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import {
ContractOffererInterface
} from "seaport-types/src/interfaces/ContractOffererInterface.sol";
import { ZoneInterface } from "seaport-types/src/interfaces/ZoneInterface.sol";
import { GettersAndDerivers } from "seaport-core/src/lib/GettersAndDerivers.sol";
import {
GettersAndDerivers
} from "seaport-core/src/lib/GettersAndDerivers.sol";
import {
SeaportValidatorInterface
} from "../lib/SeaportValidatorInterface.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ImmutableCreate2FactoryInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ interface ImmutableCreate2FactoryInterface {
function hasBeenDeployed(
address deploymentAddress
) external view returns (bool);
}
}
4 changes: 3 additions & 1 deletion contracts/test/ERC721ReceiverMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { IERC721Receiver } from "seaport-types/src/interfaces/IERC721Receiver.sol";
import {
IERC721Receiver
} from "seaport-types/src/interfaces/IERC721Receiver.sol";

contract ERC721ReceiverMock is IERC721Receiver {
enum Error {
Expand Down
4 changes: 3 additions & 1 deletion reference/conduit/ReferenceConduit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
ConduitInterface
} from "seaport-types/src/interfaces/ConduitInterface.sol";

import { ConduitItemType } from "seaport-types/src/conduit/lib/ConduitEnums.sol";
import {
ConduitItemType
} from "seaport-types/src/conduit/lib/ConduitEnums.sol";

import {
ReferenceTokenTransferrer
Expand Down
4 changes: 3 additions & 1 deletion reference/lib/ReferenceAssertions.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { OrderParameters } from "seaport-types/src/lib/ConsiderationStructs.sol";
import {
OrderParameters
} from "seaport-types/src/lib/ConsiderationStructs.sol";

import { ReferenceGettersAndDerivers } from "./ReferenceGettersAndDerivers.sol";

Expand Down
9 changes: 7 additions & 2 deletions reference/lib/ReferenceConsiderationStructs.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { ItemType, OrderType } from "seaport-types/src/lib/ConsiderationEnums.sol";
import {
ItemType,
OrderType
} from "seaport-types/src/lib/ConsiderationEnums.sol";

import {
ReceivedItem,
SpentItem
} from "seaport-types/src/lib/ConsiderationStructs.sol";

import { ConduitTransfer } from "seaport-types/src/conduit/lib/ConduitStructs.sol";
import {
ConduitTransfer
} from "seaport-types/src/conduit/lib/ConduitStructs.sol";

// This file should only be used by the Reference Implementation

Expand Down
8 changes: 6 additions & 2 deletions reference/lib/ReferenceExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { ConduitItemType } from "seaport-types/src/conduit/lib/ConduitEnums.sol";
import {
ConduitItemType
} from "seaport-types/src/conduit/lib/ConduitEnums.sol";

import {
ConduitInterface
} from "seaport-types/src/interfaces/ConduitInterface.sol";

import { ConduitTransfer } from "seaport-types/src/conduit/lib/ConduitStructs.sol";
import {
ConduitTransfer
} from "seaport-types/src/conduit/lib/ConduitStructs.sol";

import { ItemType } from "seaport-types/src/lib/ConsiderationEnums.sol";

Expand Down
38 changes: 22 additions & 16 deletions reference/lib/ReferenceOrderCombiner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@ contract ReferenceOrderCombiner is
returns (bool[] memory availableOrders, Execution[] memory executions)
{
// Validate orders, apply amounts, & determine if they use conduits.
(bytes32[] memory orderHashes, bool containsNonOpen) = _validateOrdersAndPrepareToFulfill(
advancedOrders,
ordersToExecute,
criteriaResolvers,
false, // Signifies that invalid orders should NOT revert.
maximumFulfilled,
recipient
);
(
bytes32[] memory orderHashes,
bool containsNonOpen
) = _validateOrdersAndPrepareToFulfill(
advancedOrders,
ordersToExecute,
criteriaResolvers,
false, // Signifies that invalid orders should NOT revert.
maximumFulfilled,
recipient
);

// Execute transfers.
(availableOrders, executions) = _executeAvailableFulfillments(
Expand Down Expand Up @@ -908,14 +911,17 @@ contract ReferenceOrderCombiner is
);

// Validate orders, apply amounts, & determine if they utilize conduits.
(bytes32[] memory orderHashes, bool containsNonOpen) = _validateOrdersAndPrepareToFulfill(
advancedOrders,
ordersToExecute,
criteriaResolvers,
true, // Signifies that invalid orders should revert.
advancedOrders.length,
recipient
);
(
bytes32[] memory orderHashes,
bool containsNonOpen
) = _validateOrdersAndPrepareToFulfill(
advancedOrders,
ordersToExecute,
criteriaResolvers,
true, // Signifies that invalid orders should revert.
advancedOrders.length,
recipient
);

// Emit OrdersMatched event.
emit OrdersMatched(orderHashes);
Expand Down
5 changes: 4 additions & 1 deletion reference/lib/ReferenceOrderFulfiller.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { ItemType, OrderType } from "seaport-types/src/lib/ConsiderationEnums.sol";
import {
ItemType,
OrderType
} from "seaport-types/src/lib/ConsiderationEnums.sol";

import {
AdvancedOrder,
Expand Down
5 changes: 4 additions & 1 deletion reference/lib/ReferenceOrderValidator.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import { OrderType, ItemType } from "seaport-types/src/lib/ConsiderationEnums.sol";
import {
OrderType,
ItemType
} from "seaport-types/src/lib/ConsiderationEnums.sol";

import {
AdvancedOrder,
Expand Down
5 changes: 4 additions & 1 deletion reference/lib/ReferenceZoneInteraction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {
ContractOffererInterface
} from "seaport-types/src/interfaces/ContractOffererInterface.sol";

import { ItemType, OrderType } from "seaport-types/src/lib/ConsiderationEnums.sol";
import {
ItemType,
OrderType
} from "seaport-types/src/lib/ConsiderationEnums.sol";

import {
AdditionalRecipient,
Expand Down
Loading