Skip to content

Commit b176939

Browse files
committed
chore: check NUT pre-fork state snapshots
1 parent a71cadf commit b176939

4 files changed

Lines changed: 60 additions & 2 deletions

File tree

.circleci/continue/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,25 @@ jobs:
17161716
- go-save-cache:
17171717
namespace: check-nut-locks
17181718

1719+
check-nut-prefork-states:
1720+
docker:
1721+
- image: <<pipeline.parameters.c-default_docker_image>>
1722+
resource_class: large.gen2
1723+
steps:
1724+
- utils/checkout-with-mise:
1725+
checkout-method: blobless
1726+
enable-mise-cache: true
1727+
- attach_workspace:
1728+
at: .
1729+
- go-restore-cache:
1730+
namespace: check-nut-prefork-states
1731+
- run:
1732+
name: check NUT pre-fork states
1733+
command: |
1734+
just _check-nut-prefork-states
1735+
- go-save-cache:
1736+
namespace: check-nut-prefork-states
1737+
17191738
nut-provenance-verify:
17201739
docker:
17211740
- image: <<pipeline.parameters.c-default_docker_image>>
@@ -2442,6 +2461,13 @@ workflows:
24422461
- prep-go-modules
24432462
context:
24442463
- circleci-repo-readonly-authenticated-github-token
2464+
- check-nut-prefork-states:
2465+
requires:
2466+
- contracts-bedrock-build
2467+
- prep-superchain
2468+
- prep-go-modules
2469+
context:
2470+
- circleci-repo-readonly-authenticated-github-token
24452471
- nut-provenance-verify:
24462472
requires:
24472473
- prep-go-modules
@@ -2644,6 +2670,7 @@ workflows:
26442670
- check-generated-mocks-op-service: terminal
26452671
# Misc checks that run on the merge queue.
26462672
- check-nut-locks: terminal
2673+
- check-nut-prefork-states: terminal
26472674
- check-op-geth-version: terminal
26482675
- op-deployer-forge-version: terminal
26492676
- l2-chains-sync-check: terminal

justfile

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,24 @@ build-rust-release:
418418
check-nut-locks:
419419
go run ./ops/scripts/check-nut-locks
420420

421+
# Checks that committed NUT pre-fork states regenerate without drift. Assumes required build artifacts are present.
422+
[script('bash')]
423+
_check-nut-prefork-states:
424+
set -euo pipefail
425+
shopt -s nullglob
426+
for state in op-core/nuts/state/*_state.json; do
427+
fork="$(basename "$state" _state.json)"
428+
if [ "$fork" = "jovian" ]; then
429+
continue
430+
fi
431+
just _nut-prefork-state-for "$fork"
432+
done
433+
git diff --exit-code -- op-core/nuts/state/*_state.json
434+
435+
# Checks that committed NUT pre-fork states regenerate without drift.
436+
check-nut-prefork-states: build-contracts build-superchain-go
437+
just _check-nut-prefork-states
438+
421439
# Snapshots current-upgrade-bundle.json as a fork's NUT bundle and updates the lock file.
422440
nut-snapshot-for fork:
423441
go run ./ops/scripts/nut-snapshot-for {{fork}}
@@ -427,9 +445,12 @@ nut-provenance-verify fork:
427445
go run ./ops/scripts/nut-provenance-verify {{fork}}
428446

429447
# Generates op-core/nuts/state/<fork>_state.json (predecessor state + frozen <fork> bundle).
430-
nut-prefork-state-for fork:
431-
OP_E2E_GEN_PREFORK_STATE={{fork}} go test -run TestGenerateForkState ./rust/kona/tests/proofs/
448+
_nut-prefork-state-for fork:
449+
OP_E2E_GEN_PREFORK_STATE={{fork}} go test -count=1 -run TestGenerateForkState ./rust/kona/tests/proofs/
432450

451+
# Generates op-core/nuts/state/<fork>_state.json (predecessor state + frozen <fork> bundle).
452+
nut-prefork-state-for fork: build-contracts build-superchain-go
453+
just _nut-prefork-state-for {{fork}}
433454

434455
# Checks that TODO comments have corresponding issues.
435456
todo-checker:

op-core/nuts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Requires `forge` for the provenance check (step 2).
6363
### CI checks
6464

6565
- **`check-nut-locks`** — Verifies all bundle hashes match their lock entries, all entries have a commit, every `*_nut_bundle.json` file has a corresponding lock entry, and each locked fork has a committed pre-fork state (`op-core/nuts/state/<fork>_state.json`). Runs in CI on every PR.
66+
- **`check-nut-prefork-states`** — Regenerates every committed non-seed `op-core/nuts/state/<fork>_state.json` file and fails if any committed state snapshot drifts.
6667

6768
## fork_lock.toml schema
6869

op-core/nuts/state/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ bundle, so current tooling is fine despite the ABI drift above.
6060
compile time, so `<prev>_state.json` must be on disk before generating
6161
`<fork>_state.json`.
6262

63+
To verify every committed fork state is up to date, run:
64+
65+
```bash
66+
just check-nut-prefork-states
67+
```
68+
69+
This regenerates committed non-seed fork states and fails if the committed JSON
70+
changes.
71+
6372
## Determinism
6473

6574
**Composed states** (`karst_state` and later) are byte-reproducible given the

0 commit comments

Comments
 (0)