Skip to content

fix(chain-worker): [5/7] validate canonical ASM manifests - #2299

Closed
storopoli wants to merge 1 commit into
codex/str-4286-1d-recovery-regressionsfrom
codex/str-4286-2-manifest-auth
Closed

storopoli wants to merge 1 commit into
codex/str-4286-1d-recovery-regressionsfrom
codex/str-4286-2-manifest-auth

Conversation

@storopoli

@storopoli storopoli commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Description

Validate every carried ASM manifest against buried canonical L1/ASM data before the STF buffers logs or persists state. All of the validation runs in the chain worker; this PR does not change any crate compiled into the checkpoint guest.

Before reading any canonical data, the worker rejects a header that doesn't continue its parent, and checks that manifest heights continue consecutively from the parent state's last L1 height over the whole range. The height check reports the same AsmManifestHeightMismatch and AsmManifestHeightOverflow errors the STF raises per manifest. A block that fails either check is rejected right away instead of waiting on L1. The worker then requires each manifest to be buried (is_l1_reorg_safe) and compares its complete hash with the canonical manifest at that height, for terminal and nonterminal blocks.

Missing or unburied manifests defer execution through the retry layer. A content mismatch against buried canonical data returns WorkerError::ManifestContentMismatch, and FCM rejects the block and clears its sequencer watermark. Includes chain-worker regressions for forged logs, header and height checks before any canonical read, and canonical lookup boundaries.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency Update

Notes to Reviewers

The checkpoint guest's verifying key is derived from the guest ELF, so this stack must not change non-test code in any crate the guest compiles. An earlier revision of this PR added an STF height preflight, ol/stf dispatch wrappers, and an ExecError variant. Those are gone. The height check is a private helper in chain-worker/src/provenance.rs, and the mismatch is a chain-worker error. Input validation uses the existing sequencer::verify_block_structure, and the chain worker calls the existing public strata_ol_stf_v1::verify_header_continuity directly, so strata-ol-stf-v1 is now a regular dependency of the chain worker. Neither Cargo.lock changes.

The continuity check runs in fetch_block_with_parent, right after the parent header loads. The worker derives the parent's commitment from the block's slot, so checking there means a block that skips a slot is rejected instead of failing as a missing pre-state. Before calling the shared verifier, the worker rejects any slot gap with checked arithmetic, because the verifier subtracts slots as i64 and overflows at 2^63 and above.

Guest-crate check for the whole stack, run against the 21 local packages in provers/sp1/guest-checkpoint/Cargo.lock:

$ TOP=origin/codex/str-4286-canonical-manifests   # #2277 head 0b415de8
$ git diff --stat $(git merge-base origin/main $TOP)..$TOP -- \
    provers/sp1/guest-checkpoint crates/acct-types crates/bridge-params crates/bridge-types \
    crates/codec-utils crates/da-framework crates/ol/chain-types-v1 crates/ol/da-common \
    crates/ol/da-types-v1 crates/ol/msg-types crates/ol/params crates/ol/state-container \
    crates/ol/state-support-types crates/ol/state-types crates/ol/state-types-v1 crates/ol/stf \
    crates/ol/stf-v1 crates/ol/tx-types-v1 crates/proof-impl/checkpoint crates/snark-acct-sys \
    crates/snark-acct-types
 crates/proof-impl/checkpoint/src/statements.rs | 79 ++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

The one hunk (@@ -386,3 +386,82 @@, from #2277) appends a #[cfg(test)] mod tests after the last line of the file and removes nothing. This PR and the other five change no guest crate. provers/sp1/guest-checkpoint/Cargo.lock has no diff. The root Cargo.lock gains one line, from a tracing-subscriber dev-dependency that #2277's tests use.

Part 5 of 7 for STR-4286.

Merge order:

  1. feat(consensus): [1/7] add durable status pagination and retry ticks #2298: durable status pagination and retry ticks.
  2. fix(consensus): [2/7] retry deferred blocks with bounded recovery #2302: deferred execution and bounded recovery.
  3. test(consensus): [3/7] cover retry scheduling and durable discovery #2303: retry scheduling and durable discovery tests.
  4. test(consensus): [4/7] cover local failure and fork-choice recovery #2304: local failure and fork-choice recovery tests.
  5. fix(chain-worker): [5/7] validate canonical ASM manifests #2299: canonical manifest validation.
  6. fix(consensus): [6/7] authenticate restored unfinalized blocks #2300: restored unfinalized block validation.
  7. test(consensus): [7/7] cover manifest authentication through persistence #2277: manifest persistence and checkpoint tests.

Is this PR addressing any specification, design doc or external reference document?

  • Yes
  • No

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added (where necessary) tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.
  • I have disclosed my use of AI in the body of this PR.

AI assistance: Claude implemented the rework and wrote the PR text; Codex reviewed the diff.

Related Issues

STR-4286

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f95b17c5aa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/strata/src/fcm.rs
@storopoli
storopoli added this pull request to stack #2301 September 18, 2026 12:12
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Commit: 80fc0ff

SP1 Execution Results

program cycles gas
Checkpoint 2,782,155 3,212,830

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from f95b17c to 46304ae Compare September 18, 2026 12:24
@github-actions

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5)

✅ No security issues found.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from 46304ae to eff60a2 Compare September 18, 2026 12:30
@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from eff60a2 to 631a7b2 Compare September 18, 2026 12:35
@storopoli

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5)

✅ No security issues found.

@storopoli

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@storopoli

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from 631a7b2 to 8f4d9e7 Compare September 18, 2026 13:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T17:24:05.840891Z d0072c7 New commits
🔒 Security Review ✅ Completed 2026-10-07T17:24:22.947593Z d0072c7 New commits

Security findings

Advisory findings (1)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f4d9e7062

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/strata/src/fcm.rs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5)

✅ No security issues found.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from 8f4d9e7 to b229b63 Compare September 18, 2026 13:16
@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from d865ee5 to df1a211 Compare September 22, 2026 12:49
@github-actions

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5)

✅ No security issues found.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from df1a211 to 2716717 Compare September 24, 2026 19:29
@github-actions

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from 2716717 to f2880be Compare September 29, 2026 12:27
@github-actions

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from f2880be to 6112179 Compare September 29, 2026 12:32
@github-actions

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from 6112179 to 787b236 Compare October 6, 2026 14:05
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 787b236b5b

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread crates/chain-worker/src/state.rs Outdated
@purusang
purusang force-pushed the codex/str-4286-2-manifest-auth branch from 787b236 to d9243cf Compare October 7, 2026 10:46
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from d9243cf to e381d78 Compare October 7, 2026 16:39
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@storopoli

storopoli commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

@purusang @krsnapaudel this PR changed after your approvals, so it needs another look.

The checkpoint guest's verifying key is derived from the guest ELF, and we're posting the key built from v0.4.0-rc.1. To keep a guest rebuilt from main byte-identical, this stack can't change non-test code in any crate the guest compiles. The previous revision did: it added a height preflight to process_block_manifests in stf-v1, two dispatch wrappers and OLStfSpec methods in ol/stf, and ExecError::AsmManifestContentMismatch in ol/state-types.

All of that is reverted, and the checks now live in the chain worker:

  • Before any canonical read, fetch_block_with_parent rejects a header that doesn't continue its parent. It calls the existing public strata_ol_stf_v1::verify_header_continuity, so the chain worker now depends on strata-ol-stf-v1. The check sits there because the worker derives the parent's commitment from the block's slot, so a block that skips a slot is now rejected instead of failing as a missing pre-state. Slot gaps are checked with checked arithmetic first, since the shared verifier's i64 subtraction overflows for slots at 2^63 and above.
  • check_manifest_heights in provenance.rs checks the whole manifest height range before any canonical read and returns the same errors the STF raises.
  • Burial uses the shared strata_primitives::l1::is_l1_reorg_safe.
  • A content mismatch is WorkerError::ManifestContentMismatch.

The two STF tests that covered the removed code are replaced by chain-worker tests. A new test checks that a block with a skipped slot, a wrong epoch, or a slot of 2^63 is rejected with no canonical read while its manifests aren't buried. #2300 and #2277 are restacked on top, and rejections there now carry WorkerError instead of ExecError.

The description has the guest-crate diff for the whole stack. The only change in a guest crate is the test module #2277 appends to statements.rs.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e381d78b1d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/chain-worker/src/provenance.rs Outdated
@storopoli
storopoli force-pushed the codex/str-4286-2-manifest-auth branch from e381d78 to d0072c7 Compare October 7, 2026 17:20
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0072c7f7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/chain-worker/src/state.rs
@storopoli

Copy link
Copy Markdown
Member Author

Closing in favor of #2388, a smaller fix for STR-4286 in the chain worker.

@storopoli storopoli closed this Oct 8, 2026
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.

3 participants