feat(sp1): upgrade to SP1 v6.0.0 (Hypercube)#798
Open
fakedev9999 wants to merge 39 commits intomainfrom
Open
Conversation
BREAKING CHANGE: SP1 SDK v6.0.0-beta.1 introduces significant API changes ## SDK Changes - Upgraded sp1-sdk from v5.2.4 to v6.0.0-beta.1 ## API Migration ### Async Prover Building - `ProverClient::builder()...build()` now returns a `Future` requiring `.await` - All prover client instantiation updated across codebase ### ELF Handling - Raw `&[u8]` ELF bytes must now be wrapped in `Elf::Static()` - Updated all `setup()` and `execute()` calls ### Setup Method Changes - `setup()` now returns `Result<SP1ProvingKey>` instead of tuple `(ProvingKey, VerifyingKey)` - Use `pk.verifying_key().clone()` to get the verifying key ### Trait Requirements - Added `ProvingKey` trait import for `.verifying_key()` method - Added `ProveRequest` trait import for `.compressed()`, `.mode()`, `.strategy()` - Added `Prover` trait import for `.execute()` method ### Prove Method Changes - `prove()` now takes `SP1Stdin` by value, not by reference ### Async vs Blocking Execution - Async prover: use `.await` directly (IntoFuture pattern, no `.run()`) - Blocking prover: use `sp1_sdk::blocking::CpuProver` with `.run()` for sync contexts (e.g., rayon parallel iterators) ### Verification Changes - `verify()` now takes 3 arguments (third is `Option<StatusCode>`) ### Network Prover Changes - `request_async()` renamed to `request()` - `.run().await` pattern changed to direct `.await` ### Report API Changes - `report.gas` field changed to `report.gas()` method ## Cleanup - Removed 10 unused reth patches from Cargo.toml to eliminate build warnings
SP1 v6.0.0-beta.1 introduced a dependency on Protocol Buffers in the sp1-prover-types crate. This requires protoc to be installed during the build process. Changes: - Added protobuf-compiler to all Dockerfiles (validity, fault-proof) - Added protobuf-compiler to GitHub Actions workflows: - .github/actions/setup/action.yml (shared action) - .github/actions/setup-e2e-sysgo/action.yml (e2e tests) - .github/workflows/cargo-tests.yml - .github/workflows/elf.yml - .github/workflows/integration-tests.yml - .github/workflows/lint.yml
- Restore embedded = ["sp1-zkvm/embedded"] feature in range program Cargo.toml files that was accidentally removed during SP1 v6 upgrade - Fix "Cannot start a runtime from within a runtime" error in cost_estimator.rs by wrapping parallel execution in spawn_blocking
In SP1 v6, the embedded allocator is now the default (previously bump). - Replace `embedded = ["sp1-zkvm/embedded"]` with `bump = ["sp1-zkvm/bump"]` - Update justfile ELF build commands to use v6.0.0-beta.1 tag - Remove --features embedded (now default) from embedded ELF builds - Add --features bump for the bump allocator ELF build
Switch SP1 dependencies from git sources to crates.io to match hokulea's dependency resolution. This eliminates the duplicate `koalabear*` symbols that occurred when both git and crates.io versions of sp1-recursion-gnark-ffi were linked together. Changes: - Update sp1-sdk, sp1-lib, sp1-zkvm, sp1-build, sp1-prover, sp1-core-executor to use crates.io version "6.0.0-beta.1" instead of git tag - Remove sp1-lib and sp1-zkvm patches from [patch.crates-io] section - Refresh Cargo.lock to consolidate SP1 packages to single source
Pin sp1up to specific version matching SP1 v6 crate dependency. Without version pinning, CI could install incompatible toolchain versions.
d3269d4 to
27ae0ba
Compare
Contributor
Performance Comparison (ELF: eigenda-range-elf-embedded)Range 1782104~1782109
|
- Update all SP1 crate versions to 6.0.0-rc.1 - Update hokulea branch refs to fakedev9999/bump-sp1-v6-rc1 - Update sp1-patches tags and kzg-rs branch to rc.1 - Pin sp1up to v6.0.0-rc.1 in all CI workflows (5 files) - Pin sp1up to v6.0.0-rc.1 in all Dockerfiles (7 files) - Update justfile docker build tags to v6.0.0-rc.1 - Add package = "substrate-bn-succinct-rs" for renamed bn patch Note: Cargo.lock update pending - SP1 rc.1 crates not yet published to crates.io.
SP1 6.0.0-rc.1 crates are not yet published to crates.io. Switch all 6 SP1 workspace deps to git tag source to avoid duplicate symbol linker errors from mixed sources.
Embedded is now the default allocator in SP1 v6 (Hypercube) and the bump allocator was never consumed anywhere in the codebase. Remove the bump feature flag, ELF binary, and build command to reduce maintenance burden.
Patched crypto crates (k256, p256, etc.) depend on sp1-lib ^6.0.0-rc.1 from crates.io, but rc.1 isn't published there yet. Adding sp1-lib to [patch.crates-io] redirects the lookup to the SP1 git repo.
fakedev9999
commented
Feb 6, 2026
- Move CpuProver::new() inside spawn_blocking in cost_estimator to avoid creating a nested tokio runtime (SP1 v6 CpuProver creates its own runtime internally) - Switch cycle-count-diff execute_multi from async ProverClient to blocking CpuProver wrapped in spawn_blocking for the same reason - Add protobuf-compiler installation to sqlx-check workflow (sp1-prover-types requires protoc for prost codegen) - Add sp1-hypercube and sp1-primitives deps for eigenda witness generator proof deserialization refactor
…tokio runtime SP1 v6's blocking ProverClient creates its own internal tokio runtime. When get_sp1_stdin is called from an async context (e.g. #[tokio::test]), this causes "Cannot start a runtime from within a runtime" panics, failing both da-integration-tests and cycle-count-diff-eigenda CI.
sp1-lib 6.0.0-rc.1 is now available on crates.io, so the git redirect patch is no longer needed.
fakedev9999
commented
Feb 6, 2026
Cargo.toml
Outdated
| p256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-p256-13.2-sp1-6.0.0-rc.1" } | ||
| k256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-k256-13.4-sp1-6.0.0-rc.1" } | ||
| tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", tag = "patch-2.0.2-sp1-6.0.0-rc.1" } | ||
| kzg-rs = { git = "https://github.com/succinctlabs/kzg-rs", branch = "fakedev9999/patch-6.0.0-rc.1" } |
Member
Author
There was a problem hiding this comment.
Remove patch once merged and bump kzg-rs crate directly.
fakedev9999
added a commit
that referenced
this pull request
Feb 6, 2026
Backport of PR #798 from main into release/v3.x. ## SP1 v6.0.0-rc.1 API Changes - Async prover building: `ProverClient::builder().build()` → `.build().await` - ELF wrapping: raw `&[u8]` → `Elf::Static(bytes)` - Setup return type: `(PK, VK)` → `Result<SP1ProvingKey>`, use `pk.verifying_key().clone()` - Prove by value: `prove(&pk, &stdin)` → `prove(&pk, stdin)` (stdin moved) - Async execution: `.run()` → `.await` - Verification: `verify(proof, &vk)` → `verify(proof, &vk, None)` (3rd arg) - Network prover: `request_async()` → `request()`, `.run().await` → `.await` - Report API: `report.gas` → `report.gas()` - New trait imports: `Elf`, `Prover`, `ProveRequest`, `ProvingKey` - Blocking prover: `sp1_sdk::blocking::CpuProver` for sync contexts (rayon) ## Other Changes - Updated hokulea deps to SP1 v6-compatible branch - Updated sp1-patches to rc.1 tags - Added kzg-rs patch for rc.1 compatibility - Added protobuf-compiler to all Dockerfiles and CI workflows - Pinned sp1up to v6.0.0-rc.1 in CI and Dockerfiles - Removed unused bump allocator ELF and feature - Removed unused reth patches - Added sp1-hypercube and sp1-primitives deps for eigenda witness generator
2 tasks
Bump SP1 dependency chain from v6.0.0-rc.1 to v6.0.0 final release: - SP1 crate versions 6.0.0-rc.1 → 6.0.0 - sp1-patches tags updated to 6.0.0 - kzg-rs branch updated to fakedev9999/patch-6.0.0 - hokulea branch updated to fakedev9999/bump-sp1-v6 - sp1up installer version in CI workflows and Dockerfiles - cargo-prove --tag in justfile build commands - rust-toolchain bumped to nightly-2025-09-15 for SP1 v6.0.0 compat
de1c0e6 to
3981d37
Compare
The fakedev9999/patch-6.0.0 branch was merged to master via kzg-rs#29, so the branch specifier is no longer needed.
Remove git override for kzg-rs now that 0.2.8 (with sp1_bls12_381 v0.8.0-sp1-6.0.0 from crates.io) has been published.
Pick up kzg-rs 0.2.8 from crates.io transitively via hokulea, rsp, and sp1-contract-call updates.
…time The blocking::CpuProver creates its own internal tokio runtime, which can panic when called from within an existing tokio context. Reuse the async ProverClient already created in main() for proof verification.
Picks up CI fixes (MSRV 1.91, ELF rebuilt for v6.0.0 final, clippy 1.91 lints, stale RC/beta tag cleanup).
- Change `prover` parameter type from `&ProverClient` to `&impl Prover` since `ProverClient::from_env()` now returns `EnvProver` - Remove `.await` from `prover.verify()` which is synchronous in SP1 v6
The sp1-patches/bn repo at tag patch-0.6.0-sp1-6.0.0 renamed the package to substrate-bn-succinct-rs, which breaks Cargo's patch mechanism (replacement must have the same package name as the original). Use new tag patch-0.6.0-sp1-6.0.0-substrate-bn which has the correct package name "substrate-bn", allowing [patch.crates-io] to properly replace the transitive crates.io dependency used by revm-precompile. This fixes the ~18x BN254 pairing cycle blowup (21.4M vs 1.18M cycles/pairing) caused by guest programs running pure-software field arithmetic instead of SP1 precompile syscalls.
hokulea bump-sp1-v6 added a boot_info parameter to extract l1_head and l1_chain_id for EigenDAWitnessWithTrustedData construction.
Resolve ELF conflicts by keeping the rebuilt ELFs with the substrate-bn patch fix applied.
…n-patch fix: use correct substrate-bn package name in [patch.crates-io]
Merge main's v4.0.2 release and fault-proof backward compat fix (l2BlockNumber) into the SP1 v6 upgrade branch. Conflict resolution: all SP1 version pins resolved in favor of branch's unpinned sp1up (v6 default). range-elf-bump deleted as SP1 v6 uses embedded allocator by default. ELFs kept as branch's SP1 v6 compiled versions (need rebuild to include fault-proof fix).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades SP1 from v5.2.4 to v6.0.0 (Hypercube) across the entire op-succinct stack.
Dependency changes
=5.2.4→6.0.0(sp1-sdk, sp1-lib, sp1-zkvm, sp1-build, sp1-prover, sp1-core-executor) + new cratessp1-hypercube,sp1-primitivesblocking(forCpuProverexecution outside async context),profilingfeaturessp1-4.0.0/sp1-5.0.0→sp1-6.0.0(sha2, sha3, substrate-bn, p256, k256, tiny-keccak)0.2.6→0.2.8(from crates.io, usessp1_bls12_381v0.8.0-sp1-6.0.0)Layr-Labs/hokuleatagv1.1.4→fakedev9999/hokuleabranchfakedev9999/bump-sp1-v6(SP1 v6 compatible fork with rebuilt ELF + updated vkey)nightly-2025-08-02→nightly-2025-09-15(SP1 v6 requiresduration_constructors_liteunstable feature)SP1 v6 API migration
ProverClient::builder().build()→.build().await(async)prover.setup(elf_bytes)→prover.setup(Elf::Static(elf_bytes)).await(returnsProvingKey, vkey accessed viapk.verifying_key()instead of tuple destructuring)prover.prove(pk, &stdin)→prover.prove(pk, &stdin).awaitSP1Stdin::new()→SP1Stdin::default(), stdin now owned (not borrowed)load_aggregation_proof_datachanged from sync to asyncembeddedfeature from zkVM program crates (no longer needed in v6)range-elf-bumpELF variant (v6 no longer needs separate bump allocator build)sp1_sdk::blocking::CpuProverwithtokio::task::spawn_blockingto avoid nested tokio runtime panics (CpuProver creates its own internal tokio runtime)CI & Docker
sp1up -v v6.0.0, addprotobuf-compiler(new SP1 v6 build dependency)sp1upversion (v6 is now the default release), addedprotobuf-compilerinstall stepprotobuf-compilerinstall step--tag v5.2.4→--tag v6.0.0, removed--features embeddedflagsELF binaries
Upstream PRs
Test plan
cargo check --workspacepasses