Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.{sol,sh,toml}]
indent_size = 4
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

57 changes: 0 additions & 57 deletions .eslintrc.js

This file was deleted.

8 changes: 6 additions & 2 deletions .github/actions/forge-precompile/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ runs:
- name: Precompile reference using 0.8.24 and via-ir=false
if: steps.restore.outputs.cache-hit != 'true'
shell: bash
run: FOUNDRY_PROFILE=reference forge build
env:
FOUNDRY_PROFILE: reference
run: forge build

- name: Precompile optimized using 0.8.24 and via-ir=true
if: steps.restore.outputs.cache-hit != 'true'
shell: bash
run: FOUNDRY_PROFILE=optimized forge build
env:
FOUNDRY_PROFILE: optimized
run: forge build

- name: Save precompiled artifacts
if: inputs.save == 'true' && steps.restore.outputs.cache-hit != 'true'
Expand Down
69 changes: 58 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,48 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- name: Use Node.js
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn lint:check
submodules: recursive

- uses: ./.github/actions/setup-foundry
with:
version: ${{ env.FOUNDRY_VERSION }}

# The tools are pinned by version and SHA-256 in the install script, so
# the cache only skips downloads.
- name: Restore tools
uses: actions/cache@v6
with:
path: .tools
key: tools-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/install-tools.sh') }}

- name: Install tools
run: |
scripts/install-tools.sh
echo "$PWD/.tools/bin" >> "$GITHUB_PATH"

- name: Check deployed contract sources are unchanged
run: shasum -a 256 --check --quiet scripts/frozen-contracts.sha256

- name: Check Solidity formatting
run: forge fmt --check contracts test script reference

- name: Lint Solidity
run: forge lint --deny warnings

- name: Check formatting and lint with Biome
run: biome ci .

- name: Check TOML formatting
run: taplo fmt --check

- name: Lint shell scripts
run: |
shellcheck scripts/*.sh templates/*.sh
shfmt -d scripts/*.sh templates/*.sh

- name: Lint workflows
run: actionlint

test:
name: Run Tests
Expand Down Expand Up @@ -157,10 +192,14 @@ jobs:
cache-key: ${{ needs.forge-build.outputs.cache-key }}

- name: Check the build matches deployed Seaport 1.6
run: FOUNDRY_PROFILE=test forge test --match-path test/foundry/DeployedBytecode.t.sol -vvv
env:
FOUNDRY_PROFILE: test
run: forge test --match-path test/foundry/DeployedBytecode.t.sol -vvv

- name: Run tests
run: FOUNDRY_PROFILE=test forge test -vvv
env:
FOUNDRY_PROFILE: test
run: forge test -vvv

forge-ref:
name: Run Forge Reference Tests (via_ir = false)
Expand All @@ -181,7 +220,10 @@ jobs:
cache-key: ${{ needs.forge-build.outputs.cache-key }}

- name: Run reference tests
run: FOUNDRY_PROFILE=reference MOAT_PROFILE=reference forge test -vvv
env:
FOUNDRY_PROFILE: reference
MOAT_PROFILE: reference
run: forge test -vvv

forge-offerers:
name: Run Contract Offerer Forge Tests (via_ir = false)
Expand All @@ -202,7 +244,9 @@ jobs:
cache-key: ${{ needs.forge-build.outputs.cache-key }}

- name: Run tests
run: FOUNDRY_PROFILE=offerers forge test -vvv
env:
FOUNDRY_PROFILE: offerers
run: forge test -vvv

forge-coverage:
name: Run Forge Coverage report on tests
Expand All @@ -223,7 +267,10 @@ jobs:
cache-key: ${{ needs.forge-build.outputs.cache-key }}

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

- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ metrics.txt
*-metrics.txt

fuzz_debug.json
.tools/
20 changes: 0 additions & 20 deletions .prettierignore

This file was deleted.

13 changes: 0 additions & 13 deletions .prettierrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include = ["*.toml"]

[formatting]
indent_string = " "
29 changes: 29 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Seaport

Tests, docs, and tooling for Seaport 1.6, deployed at `0x0000000000000068F116a894984e2DB1123eB395` on every supported chain. No 1.7 release is planned.

## Rule

The deployed bytecode must not change. Don't change `contracts/Seaport.sol`, the `lib/seaport-core` and `lib/seaport-types` pins, or any compiler setting the `optimized` profile uses, including the `solc`, `evm_version`, `optimizer_runs`, and remappings it inherits from `[profile.default]`. `test/foundry/DeployedBytecode.t.sol` fails if a change alters the build, and `scripts/frozen-contracts.sha256` fails if any deployed contract's source changes; revert the change rather than the test. Ideas that would change bytecode go in `docs/Seaport-1.7-candidates.md`.

## Layout

- `contracts/`: the `Seaport` wrapper (core logic is in `lib/seaport-core`), helpers, zones, and test mocks in `contracts/test/`.
- `reference/`: an unoptimized implementation that differential tests compare against.
- `test/foundry/`: Foundry tests. `test/*.spec.ts` is the legacy Hardhat suite, being ported.

## Commands

Foundry v1.9.0, submodules checked out recursively.

```bash
FOUNDRY_PROFILE=reference forge build
FOUNDRY_PROFILE=optimized forge build
FOUNDRY_PROFILE=test forge test
scripts/install-tools.sh # pinned Biome, taplo, lefthook, shellcheck, shfmt, actionlint
scripts/lint.sh check
```

Tests load both builds, so run both `forge build` commands first. To check only the bytecode: `FOUNDRY_PROFILE=test forge test --match-path test/foundry/DeployedBytecode.t.sol`.

Node from `.nvmrc` runs the Hardhat suite: `yarn install --frozen-lockfile && yarn build && yarn test`.
Loading
Loading