Skip to content

Pin seaport-core to deployed 1.6 and modernize the Foundry toolchain and CI - #1427

Merged
ryanio merged 8 commits into
mainfrom
ryan/modernize-toolchain
Nov 10, 2026
Merged

ryanio merged 8 commits into
mainfrom
ryan/modernize-toolchain

Conversation

@ryanio

@ryanio ryanio commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

First PR in a series that moves Seaport to Foundry-only tooling without changing the deployed contract code. This one updates the toolchain and CI and adds a test proving the build still matches the deployed Seaport 1.6. Porting the Hardhat suite comes in later PRs.

The build now reproduces deployed Seaport 1.6

lib/seaport-core was pinned to 1.6.5. That tag is missing the two _assertNonZeroAmount(amount) checks in BasicOrderFulfiller that shipped in the deployed contract. seaport-core v1.6.6 matches the verified source file for file. The Hardhat build already compiled 1.6.6 from npm, so until now the Foundry and Hardhat suites tested slightly different code.

With the pin corrected, FOUNDRY_PROFILE=optimized forge build produces the deployed init code byte for byte. 1.6 was verified on Etherscan with 9,999,999 optimizer runs, but the repo's default of 4,294,967,295 builds identical bytecode, so every profile stays on the max. test/foundry/DeployedBytecode.t.sol asserts the match in two steps:

  • The init code hash, the deploy salt and the ImmutableCreate2Factory derive the canonical address, so the expected hash in the test can't be wrong.
  • The hash of the optimized artifact plus the ConduitController constructor argument equals that expected hash.

Any later toolchain, dependency or config change that alters the bytecode fails CI at this step.

Toolchain

  • Foundry v1.9.0, up from v1.4.4, installed through the same cached composite action SeaDrop uses.
  • forge-std v1.17.0, up from v1.5.5. The ds-test submodule and its remapping are removed, since nothing imports them.
  • Node 26 from .nvmrc (previously 16.15.1 in .nvmrc and 18.15.0 in CI), with engines updated to match.

CI

  • The reference and optimized profiles compile once in a new forge-build job, cached on the Foundry version, foundry.toml, remappings.txt, contracts/, reference/, .github/actions/ and every submodule commit. The four Forge jobs restore that cache through a forge-precompile composite action, which rebuilds only if the cache is unavailable. They used to spend about 3.5 minutes each recompiling before running any test.
  • actions/checkout v7, actions/setup-node v7 with a frozen lockfile, codecov/codecov-action v7.1.1 pinned by SHA, and actions/stale v11 (with the actions: write it needs for its cached state). Every job now has a timeout, and the workflows set explicit permissions.
  • The single-value Node matrices are removed, so job names no longer carry (18.15.0). The repo has no branch protection, so no required check names change.
  • docs.yml is deleted. It pushes to ProjectOpenSea/developer-docs, which has been archived since February, and its github.ref == 'refs/heads/main' check never passes on a release event. That makes Fix docs release workflow trigger obsolete.

Included from #1426

Foundry 1.9's fuzzer found the collision described in prevent recipient collision in zone fuzz test: offerRecipient = 0xdeafbeef with a specified recipient makes the "stranger" address authorized, so testFulfillAvailableAdvancedFuzz failed. The fix is cherry-picked with its author kept, plus a prettier fix in a separate commit. Either PR can merge first.

Verification

All runs used Foundry 1.9.0 and Node 26.

  • Forge test profile: 484 tests passed, including the bytecode check. The only failure before the test: prevent recipient collision in zone fuzz test #1426 commit was the fuzz collision.
  • Forge reference profile: 484 passed. Forge offerers profile: 39 passed.
  • Hardhat yarn test: 402 passing, 1 pending. yarn test:ref: 376 passing, 15 pending.
  • yarn lint:check passes for prettier and eslint. lib/ is now ignored by ESLint, because recursively checked-out submodules contain JS files its parser rejects.

Notes for review

  • Hardhat 2 (including the latest 2.29.1) lists Node 20, 22 and 24 as supported and prints a warning on Node 26. Both Hardhat suites pass. Hardhat leaves the repo in a later PR, so I went with 26.
  • The codecov steps pass secrets.CODECOV_TOKEN. I can't see the repo secrets. If the token is missing, the upload fails without failing the job, as it does today.

🤖 Generated with Claude Code

ryanio and others added 5 commits November 9, 2026 13:45
forge-std no longer depends on ds-test, and nothing in the repo
imports it directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt 1.6

lib/seaport-core was pinned to 1.6.5, which lacks the two
_assertNonZeroAmount checks in BasicOrderFulfiller that shipped in the
deployed contract. v1.6.6 matches the Etherscan-verified source exactly,
and the Hardhat build already used it from npm.

The optimized profile now uses the deployment's 9_999_999 optimizer runs
and its own cache directory. With both changes it reproduces the
deployed init code byte for byte, which DeployedBytecode.t.sol asserts
against the CREATE2 address of the canonical deployment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Run the Hardhat jobs on Node 26 from .nvmrc with actions/setup-node v7
  and a frozen yarn lockfile, and drop the single-value Node matrices.
- Install Foundry v1.9.0 through a cached composite action, as SeaDrop
  does.
- Compile the reference and optimized profiles once in a forge-build
  job, cached on foundry.toml, the sources, and the submodule commits.
  The four Forge jobs restore that cache instead of each rebuilding for
  about four minutes.
- Run the deployed bytecode check as its own step in the Forge job.
- Bump checkout to v7, codecov to v7.1.1 (pinned by SHA), and stale to
  v11, and set workflow permissions and timeouts.
- Delete docs.yml. It pushes to ProjectOpenSea/developer-docs, which is
  archived, and its release trigger could never pass its branch check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prettier wraps the new ternary in TestTransferValidationZoneFuzz. ESLint
now ignores all of lib/, since nested submodules such as
lib/seaport-sol/lib/solady ship JS files that fail the repo's parser
config when submodules are checked out recursively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A cache upload failure can leave forge-build successful without publishing the required build, causing all four downstream Forge jobs to fail before running tests.

1 open issue
What changed in this PR

Prepares Seaport for a gradual move to Foundry-only tooling while preserving deployed Seaport 1.6 bytecode compatibility. Hardhat remains in place for this stage.

Changes:

  • Aligns optimized compiler settings with deployment and adds an init-code verification test.
  • Updates toolchain versions and CI actions, shares cached Forge builds, and removes obsolete documentation publishing.
  • Fixes the zone fuzz-test recipient collision and cleans up dependency-related configuration.
File Description
test/​foundry/​zone/​TestTransferValidationZoneFuzz.t.sol Keeps the negative-test recipient distinct from the authorized recipient.
test/​foundry/​DeployedBytecode.t.sol Checks canonical address derivation and optimized init-code compatibility.
README.md Documents Node selection and deployed-bytecode verification.
foundry.toml Aligns optimizer runs, isolates the optimized cache, and removes the ds-test remapping.
.nvmrc Selects Node 26.
.gitmodules Removes the ds-test submodule declaration.
.gitignore Ignores reference and optimized build caches.
.github/​workflows/​test.yml Modernizes CI and shares precompiled Forge artifacts through caching.
.github/​workflows/​stale.yml Updates the stale action and adds permissions and a timeout.
.github/​workflows/​docs.yml Removes obsolete documentation publishing.
.github/​actions/​setup-foundry/​action.yml Adds reusable, cached Foundry installation.
.eslintignore Excludes all dependency submodules from ESLint.

Review effort: Balanced

Comment thread .github/workflows/test.yml Resolved
actions/cache treats a failed save as a warning, so a cache outage on a
new key used to leave forge-build green while every Forge job failed at
fail-on-cache-miss. A forge-precompile composite action now restores the
cache and compiles whatever is missing. forge-build saves the result,
and the test jobs only restore it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Deployed-bytecode equivalence cannot be verified from this snapshot because the pinned submodule contents are absent and the required optimized Foundry v1.9.0 build cannot be run here.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Seaport 1.6 was verified with 9_999_999 runs, but 4_294_967_295 builds
byte-identical init code; the earlier mismatch came entirely from the
stale seaport-core pin. Drop the per-profile override so every profile
uses the same runs, and DeployedBytecode.t.sol still passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the Foundry toolchain and CI updates.

No open issues 🎉

Review effort: Balanced

@tomhirst

tomhirst commented Nov 9, 2026

Copy link
Copy Markdown

Looks good to merge. I checked the seaport-core v1.6.6 diff and confirmed the bytecode test's salt and init code hash against mainnet tx 0x926e95…. Three optional, non-blocking things to check, either here or in a follow-up:

  1. stale.yml permissions. The new explicit permissions block grants only issues and pull-requests. actions/stale v9+ keeps its processing state in the Actions cache, and I believe it needs actions: write to update that state. Without it, the run may log a 403 and start from the beginning each night. Worth adding actions: write, or checking the first scheduled run after merge.

  2. The bytecode check relies on the cache key being complete. The forge job runs DeployedBytecode.t.sol against an optimized-out restored from cache. The key covers every input today (foundry.toml, contracts/**, submodule SHAs, Foundry version). If a future input is missed, such as a remappings.txt, a FOUNDRY_* env var or a change to the precompile action, the check would compare old artifacts without failing. A cheap safeguard is to also run the bytecode test inside forge-build right after it compiles on a cache miss, and/or add .github/actions/** to the key.

  3. Node version mismatch. .nvmrc is now 26, which is outside Hardhat 2's supported range (20/22/24, and it prints a warning), while package.json engines still says >=18.15.0. Consider Node 24 LTS until Hardhat is removed, or at least bumping engines to match.

🤖 Generated with Claude Code

From review on #1427:
- actions/stale keeps its state in the Actions cache and needs
  actions: write to save it between runs.
- The precompiled-artifact cache key now also covers remappings.txt and
  .github/actions/**, so a change to the build steps can't hand the
  deployed bytecode check a stale build.
- package.json engines now matches .nvmrc (Node 26).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ryanio

ryanio commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @tomhirst, all three were worth acting on. Fixed in e89cb60:

  1. stale.yml now grants actions: write. You're right: the actions/stale README lists it, since the action saves its state in the Actions cache.
  2. The cache key now also hashes remappings.txt and .github/actions/**, so a change to the precompile steps forces a rebuild before the bytecode check runs. I didn't add a second bytecode run inside forge-build. It would recompile the whole test tree on every cache miss, and with the key covering the build inputs, a restored optimized-out is the same artifact forge-build would produce.
  3. I kept Node 26, since Ryan asked for the latest. Both Hardhat suites pass on it (402 and 376), and Hardhat leaves the repo later in this series. package.json engines now says >=26 to match .nvmrc.

@ryanio
ryanio merged commit 2e11093 into main Nov 10, 2026
15 checks passed
@ryanio
ryanio deleted the ryan/modernize-toolchain branch November 10, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants