Skip to content
Merged
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
16 changes: 11 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: v1.4.4

- name: Install forge dependencies
run: forge install
Expand All @@ -128,7 +128,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: v1.4.4

- name: Install forge dependencies
run: forge install
Expand All @@ -153,7 +153,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: v1.4.4

- name: Install forge dependencies
run: forge install
Expand All @@ -178,13 +178,19 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: v1.4.4

- name: Install forge dependencies
run: forge install

- name: Precompile reference using 0.8.24 and via-ir=false
run: FOUNDRY_PROFILE=reference forge build

- name: Precompile optimized using 0.8.24 and via-ir=true
run: FOUNDRY_PROFILE=optimized forge build

- name: Run coverage with lcov output
run: SEAPORT_COVERAGE=true forge coverage --report lcov
run: FOUNDRY_PROFILE=default SEAPORT_COVERAGE=true forge coverage --report lcov

- uses: codecov/codecov-action@v3
with:
Expand Down
2 changes: 0 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = v1.5.0
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
branch = v0.0.84
[submodule "lib/solarray"]
path = lib/solarray
url = https://github.com/emo-eth/solarray
Expand Down
8 changes: 7 additions & 1 deletion test/foundry/conduit/BaseConduitTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ contract BaseConduitTest is
if (to == address(0)) {
return false;
} else if (to.code.length > 0) {
(bool success, bytes memory returnData) = to.call(
// Cap the gas. A fuzzed address can be any contract already in
// state, and some consume everything forwarded to them: the
// canonical CREATE2 deployer at 0x4e59b448... reads this calldata
// as a salt plus initcode, and once an address has been deployed
// the next colliding CREATE2 burns the whole budget, failing the
// test with OutOfGas. A real onERC1155Received is far cheaper.
(bool success, bytes memory returnData) = to.call{ gas: 100_000 }(
abi.encodePacked(
ERC1155TokenReceiver.onERC1155Received.selector,
address(0),
Expand Down
12 changes: 11 additions & 1 deletion test/foundry/zone/TestTransferValidationZoneFuzz.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1453,10 +1453,20 @@ contract TestTransferValidationZoneOffererTest is BaseOrderTest {
function _nudgeAddressIfProblematic(
address _address
) internal returns (address) {
// Move clear of the precompile range before probing. Precompiles
// revert on a bare value transfer, and nudging by one is not enough
// to escape: under cancun 0x09 nudges to 0x0a, which reverts too.
if (uint160(_address) <= 0x0a) {
_address = address(uint160(_address) + 0x0a);
}

bool success;
assembly {
// Transfer the native token and store if it succeeded or not.
success := call(gas(), _address, 1, 0, 0, 0, 0)
// The gas is capped because a fuzzed address can be a contract
// that consumes everything forwarded to it, such as the CREATE2
// deployer on a colliding deployment.
success := call(100000, _address, 1, 0, 0, 0, 0)
}

if (success) {
Expand Down
12 changes: 11 additions & 1 deletion test/foundry/zone/UnauthorizedOrderSkip.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1650,10 +1650,20 @@ contract UnauthorizedOrderSkipTest is BaseOrderTest {
function _nudgeAddressIfProblematic(
address _address
) internal returns (address) {
// Move clear of the precompile range before probing. Precompiles
// revert on a bare value transfer, and nudging by one is not enough
// to escape: under cancun 0x09 nudges to 0x0a, which reverts too.
if (uint160(_address) <= 0x0a) {
_address = address(uint160(_address) + 0x0a);
}

bool success;
assembly {
// Transfer the native token and store if it succeeded or not.
success := call(gas(), _address, 1, 0, 0, 0, 0)
// The gas is capped because a fuzzed address can be a contract
// that consumes everything forwarded to it, such as the CREATE2
// deployer on a colliding deployment.
success := call(100000, _address, 1, 0, 0, 0, 0)
}

if (success) {
Expand Down
Loading