Repository navigation
Remove Hardhat and every npm dependency - #1433
Conversation
The Foundry suite now covers what the Hardhat suite did, so drop the TypeScript tests, Hardhat configs, typechain setup, package.json, yarn.lock, .nvmrc, the Node CI jobs, and the reference shim that only existed for Hardhat. Replace scripts/plot_metrics.ts with a shell script, document Foundry equivalents for the useful package scripts, and stop listing node_modules as a Foundry lib. 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.
🔵 Needs a closer look
A maintainer should confirm that Foundry security invariants adequately replace assertions in roughly 30,000 retired test lines, since line and branch coverage parity alone does not establish equivalent regression protection.
No open issues 🎉
What changed in this PR
Completes the move to Foundry-only development following the coverage work in #1432, removing Hardhat and npm dependencies without changing deployed contract logic.
Changes:
- Removes the legacy TypeScript tests, supporting utilities, unused mocks, and Hardhat configuration.
- Replaces Node-based fuzz metrics reporting with a shell script and documents Foundry alternatives.
- Removes Node CI jobs and updates documentation, lint configuration, and ignore rules.
| File | Description |
|---|---|
tsconfig.json |
Removes TypeScript compiler configuration. |
test/utils/types.ts |
Removes TypeScript order types. |
test/utils/seeded-rng.js |
Removes the JavaScript seeded random generator. |
test/utils/reports/report_parser.ts |
Removes legacy gas-report parsing. |
test/utils/reports/comment-table.ts |
Removes test report formatting. |
test/utils/helpers.ts |
Removes Hardhat test helpers. |
test/utils/fixtures/tokens.ts |
Removes token fixtures. |
test/utils/fixtures/marketplace.ts |
Removes marketplace and signing fixtures. |
test/utils/fixtures/index.ts |
Removes shared fixtures and assertion helpers. |
test/utils/fixtures/create2.ts |
Removes deterministic deployment fixtures. |
test/utils/fixtures/conduit.ts |
Removes conduit fixtures. |
test/utils/faucet.ts |
Removes Hardhat wallet-funding helpers. |
test/utils/events.ts |
Removes TypeScript event decoding. |
test/utils/encoding.ts |
Removes order encoding and hashing helpers. |
test/utils/eip712/utils.ts |
Removes typed-data tree utilities. |
test/utils/eip712/Eip712MerkleTree.ts |
Removes the JavaScript bulk-order tree implementation. |
test/utils/eip712/defaults.ts |
Removes typed-data default generation. |
test/utils/eip712/bulk-orders.ts |
Removes bulk-order signing helpers. |
test/utils/criteria.ts |
Removes JavaScript criteria-proof helpers. |
test/utils/contracts.ts |
Removes Hardhat deployment helpers. |
test/typehashdirectory.spec.ts |
Retires the Hardhat typehash test. |
test/router.spec.ts |
Retires router tests covered by the Foundry port. |
test/getter.spec.ts |
Retires getter tests covered by the Foundry port. |
test/findings/PartialFillFractionOverflow.spec.ts |
Removes the legacy fraction-overflow regression suite. |
test/findings/FulfillmentOverflowWithMissingItems.spec.ts |
Removes the legacy fulfillment-overflow regression suite. |
test/findings/CriteriaResolverUnhashedLeaves.spec.ts |
Removes the legacy criteria-leaf regression suite. |
test/findings/AdditionalRecipientsOffByOne.spec.ts |
Removes the legacy additional-recipient regression suite. |
scripts/write_reports.ts |
Removes Hardhat gas-report generation. |
scripts/utils.ts |
Removes gas-report storage utilities. |
scripts/print_report.ts |
Removes Node-based gas-report printing. |
scripts/plot-metrics.sh |
Adds shell-based call counts and percentages. |
scripts/plot_metrics.ts |
Removes the Node-based metrics chart. |
scripts/compare_reports.ts |
Removes Hardhat gas-report comparisons. |
scripts/comment-table.ts |
Removes Node-based report formatting. |
reference/shim/Shim.sol |
Removes the Hardhat multi-source compilation shim. |
README.md |
Removes the Hardhat suite reference. |
package.json |
Removes npm dependencies and package scripts. |
lefthook.yml |
Removes JavaScript and TypeScript lint globs. |
hardhat.config.ts |
Removes the primary Hardhat configuration. |
hardhat-validator.config.ts |
Removes the Hardhat validator configuration. |
hardhat-reference.config.ts |
Removes the reference-build Hardhat configuration. |
hardhat-reference-coverage.config.ts |
Removes Hardhat reference coverage configuration. |
hardhat-coverage.config.ts |
Removes Hardhat optimized-contract coverage configuration. |
foundry.toml |
Removes node_modules from library search paths. |
eip-712-types/order.js |
Removes JavaScript order type definitions. |
eip-712-types/domain.js |
Removes JavaScript domain type definitions. |
eip-712-types/bulkOrder.js |
Removes JavaScript bulk-order type definitions. |
docs/Development.md |
Replaces Hardhat instructions with Foundry metrics and size commands. |
docs/Deploying.md |
Clarifies that historical verification uses the 1.1 tag’s tooling. |
contracts/test/TestPostExecution.sol |
Removes the TypeScript-only post-execution zone mock. |
contracts/test/TestInvalidZone.sol |
Removes the invalid-zone mock. |
contracts/test/TestInvalidContractOffererRatifyOrder.sol |
Removes the invalid-ratification mock. |
contracts/test/TestInvalidContractOfferer165.sol |
Removes the non-ERC165 contract-offerer mock. |
contracts/test/TestInvalidContractOfferer.sol |
Removes the reverting contract-offerer mock. |
contracts/test/TestERC721Funky.sol |
Removes the malformed royalty-return mock. |
contracts/test/TestERC721Fee.sol |
Removes the configurable royalty mock. |
contracts/test/TestERC1271.sol |
Removes the signature-validation mock. |
contracts/test/TestBadContractOfferer.sol |
Removes the malformed contract-offerer response mock. |
contracts/test/EIP1271Wallet.sol |
Removes the Hardhat wallet mock. |
constants/constants.js |
Removes JavaScript deployment constants. |
config/.solcover.js |
Removes Solidity coverage configuration for Hardhat. |
config/.solcover-reference.js |
Removes reference coverage exclusions for Hardhat. |
biome.json |
Removes obsolete JavaScript settings and exclusions. |
AGENTS.md |
Documents Foundry-only development and pinned standalone tools. |
.nvmrc |
Removes the Node version pin. |
.npmrc |
Removes npm engine configuration. |
.npmignore |
Removes npm publishing exclusions. |
.gitignore |
Removes obsolete Hardhat and Node ignore entries. |
.github/workflows/test.yml |
Removes four Node-based build, test, and coverage jobs. |
.gas_reports/3fab586d8f77266bf79226b17cbc65cb867689e6.json |
Removes a historical Hardhat gas report. |
.gas_reports/10d78fe57eb635a6d8a85e34236aa29548a1b52f.json |
Removes a historical Hardhat gas report. |
Review effort: Balanced
|
On Copilot's "needs a closer look": that is the right question for reviewers, and the PR body says so. The retired Hardhat tests are covered at the line and branch level, not ported assertion for assertion. Besides #1432's 90 targeted tests, regression protection comes from the MOAT fuzz engine in |
# Conflicts: # package.json
The 1.1 tag's own Hardhat setup is gone with the rest of the Node tooling. A minimal Foundry config on that tag (solc 0.8.14, via_ir, 1,000,000 runs, london, no remappings) rebuilds the deployed runtime code byte for byte, metadata included, and the documented init code. Note in the 1.7 candidates that the canonical conduits revert with InvalidERC721TransferAmount() while seaport-types declares the uint256 form that 1.2 introduced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I compared the deleted Hardhat specs on No replacement
Partial replacement
Weaker checks on the reference buildThe Hardhat suite with
Gaps 1, 5 and 6 have no test on either build now. Suggested order
The rest could go in a follow-up issue. 🤖 Generated with Claude Code |
Each test rebuilds the original attack: the additional recipients off-by-one through crafted basic order calldata, a Merkle root used as a criteria leaf, a consideration overflow after a zero-amount item, and a partial fill fraction that reset an order. Where the attack needs a valid order, the honest fill is checked too. Each test fails when its fix is removed from seaport-core: the malicious basic order fills, the root-as-leaf fill succeeds, the overflow check no longer fires, and the order resets to 0 filled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Aggregation InvalidFulfillmentComponentData on match and fulfillAvailable, conduit ChannelClosed/InvalidItemType/NoContract, basic order offset encoding, ERC-1271 revert reasons, InvalidCallToConduit, EOA zone submitter, incrementCounter, and exact-payload checks on both builds for errors only the fuzz engine reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
seaport-sol moves to current main (5b620445): formatted, tests passing on Foundry 1.9.0, npm dependencies corrected, the same 1.6.6/1.6.3 core and types tags this repo pins. install-tools.sh ran tar and mv joined by &&, and set -e ignores a failure on the left of &&, so a failed extraction during an update kept the old binary under the new checksum. Copilot found it on seadrop#229. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README lists the Trail of Bits review, both Code4rena contests (1.0 and 1.2) and Spearbit's 1.2 review. - FunctionSignatures.md is regenerated from the 1.6 build; it listed 1.2 and 1.1 selectors only. - Zone docs describe 1.6: authorizeOrder before transfers and validateOrder after, skipped only when the zone is the caller. The offerer no longer bypasses the zone. - Drops Code4rena-Guidelines.md, the 2022 contest brief. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @tomhirst, this was a useful list. Everything on it is now ported in this PR, so nothing waits on a follow-up issue. Each revert test checks the exact error payload, runs on both builds unless the Hardhat original was optimized-only, and also runs the honest path so a broken fixture can't pass. The suite goes from 578 to 627 tests per build, and offerers from 39 to 45.
Where the builds revert differently, the tests pin both payloads:
The fuzz engine's reference skip is unchanged; the explicit tests replace what it used to cover. The same push also bumps |
Part 7 of the modernization series and the last Hardhat PR. After this the repo has no Node or npm dependencies: no
package.json, no lockfile, nothing for a compromised package to reach.Removed
test/*.spec.ts,test/findings/,test/utils/(about 30,000 lines).tsconfig.json,config/.solcover*.js,constants/,eip-712-types/, typechain setup, and the TypeScript report scripts inscripts/.package.json,yarn.lock,.nvmrc,.npmrc,.npmignore, and.gas_reports/(Hardhat gas reporter output).reference/shim/Shim.sol, which only existed because Hardhat can't compile two source folders. Foundry tests load onlyReferenceConsiderationandReferenceConduitControllerfromreference-out/, and neither depends on it.contracts/test/that only the TypeScript tests used (checked by contract name and import path).What replaces the Hardhat tests
#1432 ported every case where Hardhat covered lines or branches Foundry didn't. Review here found that line coverage wasn't enough, so this PR also ports what the reviewers named (Tom's list, and Ben's point about the exploit tests):
PastFindings.t.solrebuilds the fourtest/findingsattacks. Each test fails when its fix is removed from seaport-core.RevertParity.t.soladds the aggregation, conduit, basic-order encoding, ERC-1271, EOA-zone and incrementCounter cases. It also adds explicit tests for the errors whose exact payload only the fuzz engine checked, which it skips on the reference build.Seaportcontract, the reference getters andTypehashDirectory.Each revert test checks the exact error payload on both builds (both payloads where they differ) and runs the honest path too. The reply to Tom maps each gap to its tests.
Replacements for package scripts
scripts/plot_metrics.tsbecomesscripts/plot-metrics.sh(awk, same per-call counts and percentages).docs/Development.mdgives the Foundry commands for fuzz metrics and the optimized build's size headroom (forge build --sizes).foundry.tomlno longer listsnode_modulesas a lib. The deployed-bytecode test still passes.Docs
AGENTS.md, the README,docs/Development.md, Biome's excludes, lefthook's globs and.gitignoredrop their Hardhat parts.AGENTS.mdnow says to add tools throughscripts/install-tools.sh, pinned by version and SHA-256, instead of npm.docs/Deploying.mdnow verifies the ConduitController with Foundry from the 1.1 tag (solc 0.8.14, via_ir, 1,000,000 runs), which rebuilds the deployed code byte for byte. The 1.7 candidates note that the deployed conduits revert withInvalidERC721TransferAmount()while seaport-types declares theuint256form.Stale docs are refreshed: the README lists every public audit report (Trail of Bits, both Code4rena contests, Spearbit's 1.2 review),
FunctionSignatures.mdis regenerated from the 1.6 build, the zone docs describe 1.6'sauthorizeOrder/validateOrderflow, and the 2022 Code4rena contest brief is removed.lib/seaport-solmoves to current seaport-sol main, andscripts/install-tools.shno longer records a checksum for a binary it failed to extract.Verification
FOUNDRY_PROFILE=test forge test: 627 passed, includingDeployedBytecode.t.sol.FOUNDRY_PROFILE=reference MOAT_PROFILE=reference forge test: 627 passed.FOUNDRY_PROFILE=offerers forge test: 45 passed.scripts/lint.sh checkpasses, including actionlint on the trimmed workflow and the frozen-source check.git grepfinds no remaining reference to yarn, npm, Hardhat or typechain.🤖 Generated with Claude Code