Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

feat(sp1): Add zkVM-based fault proofs via SP1 integration#3051

Open
Inphi wants to merge 9 commits into
op-rs:mainfrom
Inphi:inphi/succ
Open

feat(sp1): Add zkVM-based fault proofs via SP1 integration#3051
Inphi wants to merge 9 commits into
op-rs:mainfrom
Inphi:inphi/succ

Conversation

@Inphi

@Inphi Inphi commented Nov 18, 2025

Copy link
Copy Markdown
Collaborator

Integrate SP1 zero-knowledge proof capabilities into the Kona monorepo, derived from OP-Succinct, to enable validity proofs for OP Stack state transitions. This provides an alternative fault proof mechanism that generates cryptographic proofs of execution verifiable on-chain.

kona-sp1 is experimental. This PR establishes the initial crate structure and foundational logic that future work will build on. The SP1 integration is not yet complete; the goal here is to land a clean, minimal baseline that is syntactically correct.

Off-chain op-succinct integration

Code from OP-Succinct has been brought into the repo with the following adjustments:

  • Renamed crates with the kona-sp1- prefix
  • Removed Eigenda and Celestia support
  • Removed Hokulea and Hana programs
  • Restructured modules to follow Kona’s layout conventions
  • Merged range-ethereum and range-utils into a single crate

@codecov

codecov Bot commented Nov 18, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.2%. Comparing base (a7fcea8) to head (91856b8).
⚠️ Report is 37 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (a7fcea8) and HEAD (91856b8). Click for more details.

HEAD has 19 uploads less than BASE
Flag BASE (a7fcea8) HEAD (91856b8)
unit 2 0
proof 14 7
e2e 19 9

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Inphi added 3 commits December 1, 2025 18:48
Integrate SP1 zero-knowledge proof capabilities into the Kona monorepo, derived from OP-Succinct, to enable validity proofs for OP Stack state transitions. This provides an alternative fault proof mechanism that generates cryptographic proofs of execution verifiable on-chain.

kona-sp1 is _experimental_. This PR establishes the initial crate structure and foundational logic that future work will build on. The SP1 integration is not yet complete; the goal here is to land a clean, minimal baseline.

Code from [OP-Succinct](https://github.com/succinctlabs/op-succinct) has been brought into the repo with the following adjustments:

- Renamed crates with the kona-sp1- prefix
- Removed Eigenda and Celestia support
- Removed Hokulea and Hana programs
- Restructured modules to follow Kona’s layout conventions
- Merged range-ethereum and range-utils into a single crate
@Inphi Inphi marked this pull request as ready for review December 2, 2025 14:35
@Inphi Inphi requested a review from BioMark3r as a code owner December 2, 2025 14:35
Copilot AI review requested due to automatic review settings December 2, 2025 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates SP1 zero-knowledge proof capabilities into the Kona monorepo, derived from OP-Succinct, to enable validity proofs for OP Stack state transitions. The implementation provides an experimental alternative fault proof mechanism that generates cryptographic proofs of execution verifiable on-chain.

Key Changes:

  • Addition of SP1 zkVM programs for range proofs and aggregation
  • Host and client utilities for witness generation and proof orchestration
  • Ethereum-specific data availability support
  • Build infrastructure and ELF binary management

Reviewed changes

Copilot reviewed 53 out of 57 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sp1/programs/range/src/main.rs Main zkVM program for verifying L2 block state transitions across a range
sp1/programs/aggregation/src/main.rs Aggregation program to combine multiple range proofs into a single proof
sp1/crates/client/ Client-side utilities for witness execution, precompiles, and types
sp1/crates/host/ Host utilities for witness generation, fetching, stats, and logging
sp1/crates/ethereum/ Ethereum-specific DA implementations for both host and client
sp1/crates/proof/src/lib.rs High-level proof utilities for SP1 integration
sp1/crates/elfs/src/lib.rs Management of compiled ELF binaries for zkVM programs
sp1/crates/build/src/lib.rs Build utilities for compiling SP1 programs
Cargo.toml Workspace configuration adding SP1 dependencies and crate members
deny.toml Security advisories for unmaintained dependencies and license clarifications
.github/codecov.yml Code coverage exclusion for experimental SP1 code
sp1/README.md Documentation explaining the SP1 integration structure and usage
sp1/LICENSE-THIRD-PARTY Attribution for OP-Succinct derivative work under MIT license
sp1/justfile Build recipes for compiling ELF files with cargo-prove

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread deny.toml Outdated
Comment thread sp1/crates/client/src/witness/executor.rs Outdated
Comment thread sp1/crates/host/src/network.rs
Comment thread sp1/crates/host/src/network.rs
Comment thread sp1/programs/range/src/main.rs Outdated
Comment thread sp1/crates/ethereum/client/src/executor.rs Outdated
@theochap

theochap commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

@Inphi can you fix the coverage and cargo-hack CI jobs?

Comment thread .github/codecov.yml Outdated
# Ignore noop files
- "**/noop.rs"
# TODO(inphi): Remove sp1 ignore once tests are added
- "sp1/**/*"

@theochap theochap Dec 4, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it is fine not to ignore sp1. I'd rather see code coverage actually decrease than having a fake coverage info

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The codecov thresholds are pretty low - https://github.com/op-rs/kona/blob/main/.github/codecov.yml#L15. Preventing the PR from being merged with a drop in coverage. Would you be open to relaxing the ci check?

Comment thread sp1/crates/build/src/lib.rs Outdated
Bytes48::from_slice(proof).map_err(|_| PrecompileError::BlobVerifyKzgProofFailed)?;

KzgProof::verify_kzg_proof(&commitment, &z, &y, &proof, &self.kzg_settings)
.map_err(|_| PrecompileError::BlobVerifyKzgProofFailed)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Since all of the BlobVerifyKzgProofFailed wrap a KzgError, I'd actually make sure the BlobVerifyZkgProofFailed contains the inner failure reason so that we can know what exactly failed in the verify_kzg_proof

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

BlobVerifyKzgProoFailed is a flat variant that doesn't wrap anything. We could add a custom failure reason using PrecompileError::Fatal(err.to_string()). But this would be unconventional. Revm itself doesn't include the inner failure reason and opts to return a BlobVerifyKzgProofFailed.

Comment thread sp1/crates/client/src/precompiles/factory.rs Outdated
Comment thread sp1/crates/client/src/precompiles/mod.rs Outdated
Comment thread sp1/crates/client/src/precompiles/mod.rs Outdated
Comment thread sp1/crates/client/src/witness/executor.rs

Ok((oracle, beacon))
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks a lot like our oracle providers. We should probably think of merging this with the kona-proof structs in some follow-up work

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so.
We need a fully in-memory oracle for the sp1 proof as all the witness must be loaded up front into the zkvm.
But the fpvm proof oracle isn't and cannot be adapted into this model because it'll be too expensive to load them into the fault proof.

/// on-chain, so switching to a different hash function is not a concern, as long as the config hash
/// is consistent with the one on the contract.
pub fn hash_rollup_config(config: &RollupConfig) -> B256 {
let serialized_config = serde_json::to_string_pretty(config).unwrap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not an immediate concern but using serde_json here could be an issue. Json is not a determinstic serialization scheme and things like HashMaps or HashSets or anything with a hasher won't be deterministically encoded. We should think about using serialization formats like https://docs.rs/borsh/latest/borsh/. Probably worth opening an issue

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I agree. We plan on replacing the rollup config hash with the l2 chain ID. This doc goes over the details - https://www.notion.so/oplabs/op-succinct-Program-Alterations-2aaf153ee16280489147ca821da0ce48?pvs=26&qid=1%3A77c2afb8-172a-4b81-8616-1077cabea0a0%3A2.

Comment thread sp1/crates/client/src/client.rs
Comment thread sp1/crates/elfs/src/lib.rs Outdated
Comment thread sp1/justfile
#!/usr/bin/env bash

cd programs/range
~/.sp1/bin/cargo-prove prove build --elf-name range-elf-bump --docker --tag v5.2.2 --output-directory ../../elf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How do I set up the .sp1 dir? Is there a just recipe to easily install cargo-prove

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You have to install sp1 toolchain to do this. See https://docs.succinct.xyz/docs/sp1/getting-started/install.
I'll set this up in github CI later once we're in a good state to begin testing all of this.

Comment thread deny.toml
"Zlib",
"0BSD",
"CDLA-Permissive-2.0",
"LicenseRef-BOSL",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is that license? Just making sure we know that we can use it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's the Bootstrap Open Source License. Derivative works have to make the source available if they're distributed. Which is compatible with the software we build and most downstream consumers of kona that I could think of. But maybe not all?

Comment thread sp1/crates/ethereum/host/src/host.rs
kzg_rs::Bytes48(*commitment.to_bytes()),
kzg_rs::Bytes48(*proof.to_bytes()),
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All this host code can be combined with kona-host in a follow-up work

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Similar to my other comment, blob retrieval in kona-sp1 differs from kona-fpvm. The host currently collects all blobs into memory so they can be efficiently loaded into the SP1 VM. While we could refactor this to use the OracleBlobProvider
to load blobs on demand when generating an SP1 proof request, it would introduce some inefficiency.

Comment thread sp1/crates/host/src/block_range.rs Outdated

@theochap theochap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. I left a bunch of nits. Most of them can be tracked in follow-up issues. I am approving to unblock the PR, feel free to merge whenever you feel comfortable with the state of that PR. I'm okay merging as is and tracking all the comments as follow-up PRs.

@Inphi Inphi enabled auto-merge December 4, 2025 15:21
@Inphi Inphi linked an issue Dec 8, 2025 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has been inactive for 3 weeks.
It will be closed in 1 week if no further activity occurs.
If you believe this PR should remain open, please add the M-prevent-stale label or leave a comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kona: Integrate op-succinct changes into kona

4 participants