Repository navigation
Port Hardhat-only test coverage to Foundry - #1432
Merged
Merged
Conversation
Add Foundry coverage that only the Hardhat suite had: - ConduitController.t.sol: createConduit reverts, channel add/remove including swap-and-pop and the desynced close branch, two-step ownership transfer, every getter, and Conduit.updateChannel's InvalidController and ChannelStatusAlreadySet. Each case runs against the optimized and reference controllers. - TransferHelper single and multiple recipient tests: InvalidConduit for a zero conduit key, RecipientCannotBeZeroAddress, and ERC721ReceiverErrorRevertBytes. - GetterTests: deploy Seaport itself and check name(), its raw encoding, information(), and the domain separator on the current and a changed chain id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
forge coverage skips libraries unless given --include-libs, so the codecov report never showed Seaport's core logic. Include libraries and filter out the third-party ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add SeaportRouter.t.sol covering all 10 tests in test/router.spec.ts and zone/PausableZone.t.sol covering the 16 tests in the "Zone - PausableZone" block of test/zone.spec.ts, plus getSeaportMetadata and supportsInterface. Tests that touch Seaport run against both the optimized and reference builds. The router and controller deploy from optimized-out, or with `new` under SEAPORT_COVERAGE so coverage attributes them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RevertParity.t.sol ports the revert and edge cases only revert.spec.ts, counter.spec.ts, advanced.spec.ts and conduit.spec.ts reached: basic order InvalidMsgValue and InsufficientNativeTokensSupplied, ERC721 amount > 1 on the basic and standard paths, OrderPartiallyFilled via basic fulfillment, validate() contract-order skip and length mismatch, the zero-amount aggregation early return in a match, 1/1 after earlier partial fills, receive() rejection, zone calls that revert with no data, and TokenTransferrer generic failures (non-token accounts, falsey ERC20, batch 1155 bubbling, encoding check, uncopyable revert data). Each runs against the optimized and reference builds and pins both payloads where they differ. NonReentrantPreCancun.t.sol deploys Seaport on Shanghai via vm.setEvmVersion, so it starts with the SSTORE guard, and runs the NonReentrant matrix, basic and advanced fills, receive() rejection, and every __activateTstore outcome (not supported, guard set, already active, successful activation followed by the matrix on the activated branch) plus TloadTestContractDeploymentFailed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The conduit test does not exercise conduit-backed transfers or assert key forwarding, so it can pass even if the router ignores fulfillerConduitKey.
1 open issue
What changed in this PR
Ports Hardhat-only coverage to Foundry ahead of the planned Hardhat removal, while leaving deployed contracts unchanged.
Changes:
- Adds router, zone, conduit-controller, getter, transfer-helper, and revert-path tests.
- Exercises pre-Cancun reentrancy guards and activation of transient storage after an upgrade.
- Includes Seaport core libraries in coverage reports and documents the deferred router fix.
| File | Description |
|---|---|
test/foundry/zone/PausableZone.t.sol |
Tests zone fulfillment, permissions, ownership, and interfaces. |
test/foundry/utils/RevertParityMocks.sol |
Adds mocks for empty and oversized revert data. |
test/foundry/TransferHelperSingleRecipientTest.sol |
Adds single-recipient transfer failure cases. |
test/foundry/TransferHelperMultipleRecipientsTest.sol |
Adds multiple-recipient transfer failure cases. |
test/foundry/SeaportRouter.t.sol |
Ports router fulfillment, refund, and access tests. |
test/foundry/RevertParity.t.sol |
Covers missing revert paths and fulfillment edge cases. |
test/foundry/NonReentrantPreCancun.t.sol |
Tests storage guards and post-upgrade transient-storage activation. |
test/foundry/GetterTests.t.sol |
Checks Seaport wrapper names and domain separators. |
test/foundry/conduit/ConduitController.t.sol |
Tests conduit creation, channels, ownership, and getters. |
docs/Seaport-1.7-candidates.md |
Records the router tally-loop fix for a future deployment. |
docs/Development.md |
Documents coverage commands that include Seaport core. |
.github/workflows/test.yml |
Includes Seaport core in CI coverage while filtering other libraries. |
Review effort: Balanced
The router is the fulfiller and pays only native consideration, so no conduit moves tokens in the conduit variant. Check the exact call to each Seaport instead, including the fulfiller conduit key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BCLeFevre
approved these changes
Nov 10, 2026
tomhirst
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #1431. Part 6 of the modernization series, and the first of two PRs that remove Hardhat. The next PR deletes the Hardhat suite and every npm dependency. This one adds the Foundry tests that make that safe.
How the gaps were found
Both suites ran under coverage and the line and branch reports were compared. Two things in the existing tooling hid gaps:
seaport-core, because it's a dependency import. The comparison used a temporary config that added it.forge coveragedrops libraries unless it gets--include-libs, so codecov has never shown Seaport's core logic. This PR fixes the CI command (see below).Everything Hardhat covered that Foundry didn't fell into four areas:
SeaportRouterand the PausableZone pair (zero Foundry coverage), the admin and getter half ofConduitController, and about 15 revert paths. None of the fourtest/findingsspecs covered a line Foundry misses.New tests (90)
test/foundry/SeaportRouter.t.solrouter.spec.tstest/foundry/zone/PausableZone.t.solzone.spec.ts, plusgetSeaportMetadataandsupportsInterfacetest/foundry/conduit/ConduitController.t.solconduit.spec.ts: create reverts, channels with swap-and-pop, two-step ownership, every getter,Conduit.updateChannelrevertsTransferHelperSingleRecipientTest.sol,TransferHelperMultipleRecipientsTest.soltransferhelper.spec.ts: zero conduit key, zero recipient, receiver reverting with datatest/foundry/GetterTests.t.solgetter.spec.ts: deploysSeaportitself and checksname()and the domain separatortest/foundry/RevertParity.t.solrevert.spec.ts,counter.spec.ts,advanced.spec.tsandconduit.spec.tstest/foundry/NonReentrantPreCancun.t.solTests that touch Seaport run against both the optimized and reference builds, like the existing suites. Reverts are checked with exact selectors and arguments, including many Hardhat only checked as bare reverts.
The pre-Cancun file deploys Seaport under Shanghai (
vm.setEvmVersion), so it starts with the SSTORE reentrancy guard, as it does on chains that lacked TSTORE at deployment. It runs the existing reentrancy matrix in that mode, then tests__activateTstoreafter a simulated upgrade. Neither suite covered that path before. Hardhat only reached it by accident, because its coverage config fell back to Shanghai.Hardhat test to Foundry test mapping
Router: every
itinrouter.spec.tsmaps one to one (testGetAllowedSeaportContracts,testFulfillThroughSingleSeaport,testFulfillThroughMultipleSeaports,testMaximumFulfilledAcrossSeaports,testFulfillThroughMultipleSeaportsWithConduit,testSkipsInvalidOrders,testRevertsOnAllErrorsExceptNoSpecifiedOrdersAvailable,testRevertsIfExcessEtherCannotBeReturned,testCannotReenterThroughReceive,testReceiveOnlyFromAllowedSeaports).PausableZone: each of the 16 tests maps to one Foundry test with the same intent. Two Hardhat titles describe something other than what the test does ("caller being offerer" and "non-owner tries to self destruct"), and the ports follow the test bodies.
ConduitController:
deployNewConduitfixture totestCreateConduit, plustestCreateConduitRevertsInvalidCreator,testCreateConduitRevertsConduitAlreadyExists,testUpdateChannelRevertsCallerIsNotOwner,testConduitUpdateChannelRevertsInvalidController,testConduitUpdateChannelRevertsChannelStatusAlreadySet,testAddsAndRemovesChannels,testTransferOwnershipTwoStep,testOwnerOf,testGetKey,testGetPotentialOwner,testGetChannelStatus,testGetChannels. Each case runs againstConduitControllerandReferenceConduitController.Revert parity: basic InvalidMsgValue both ways, ERC721 amount above 1 (basic, standard, via conduit), InsufficientNativeTokensSupplied for offerer and additional recipient, OrderPartiallyFilled via basic fulfillment,
validate()skipping a contract order and rejecting a length mismatch, a match whose consideration aggregates to zero, a 1/1 partial fill after earlier partial fills, Seaport as an ether recipient, a zone failing with no revert data, and the TokenTransferrer non-token, falsey-return and batch-1155 bubbling cases.Dropped on purpose: Hardhat's generic
checkExpectedEventsandwithBalanceCheckswrappers on success fills, replaced by explicit balance, ownership and order-status checks; thecallStaticdry run before each zone match call, since the real call's return value and logs are checked; and the contract offerer that Hardhat deployed for thevalidate()test, whichvalidate()never calls.Coverage
Forge line coverage before and after, with
seaport-coreincluded:helpers/SeaportRouter.solzones/PausableZoneController.solzones/PausableZone.solseaport-coreConduitController.solseaport-coreConduit.solhelpers/TransferHelper.solseaport-coreBasicOrderFulfiller.solseaport-coreReentrancyGuard.solseaport-coreOrderValidator.solThe CI coverage job now passes
--include-libswith a filter that keepsseaport-coreand drops the other libraries.docs/Development.mdgives the same command.Found along the way
SeaportRouter's tally loop only advances its index when an order was filled. If a Seaport returns a skipped order in a batch, the loop runs until it's out of gas. This is the bug fix(SeaportRouter): terminate tally loop on partially-available batches #1415 proposed fixing. The deployed router is frozen, so the fix is noted indocs/Seaport-1.7-candidates.mdfor a future router deployment. No test pins the broken behavior.Verification
FOUNDRY_PROFILE=test forge test: 574 passed (484 before).FOUNDRY_PROFILE=reference MOAT_PROFILE=reference forge test: 574 passed.FOUNDRY_PROFILE=offerers forge test: 39 passed.DeployedBytecode.t.solpasses,scripts/frozen-contracts.sha256checks clean, and no file undercontracts/orlib/changed.scripts/lint.sh checkpasses. The new test files add no compiler warnings.🤖 Generated with Claude Code