Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 6 additions & 6 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[advisories]
ignore = [
# NOTE: cargo-audit reads config from .cargo/audit.toml.
# RUSTSEC-2025-0055 (tracing-subscriber 0.2.25)
# Pulled in via ark-relations.
# Upgrade blocked until upstream bumps tracing-subscriber >= 0.3.20.
# Low risk: affects ANSI escape sequences in logs only.
"RUSTSEC-2025-0055",
# NOTE: cargo-audit reads config from .cargo/audit.toml.
# RUSTSEC-2025-0055 (tracing-subscriber 0.2.25)
# Pulled in via ark-relations.
# Upgrade blocked until upstream bumps tracing-subscriber >= 0.3.20.
# Low risk: affects ANSI escape sequences in logs only.
"RUSTSEC-2025-0055",
]
45 changes: 27 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ members = [
"crates/msgs/bridge",
"crates/msgs/checkpoint",
"crates/params",
"crates/proof-db",
"crates/proof-impl",
"crates/proof/db",
"crates/proof/statements",
"crates/proof/types",
"crates/rpc",
"crates/spec",
"crates/spec-debug",
Expand Down Expand Up @@ -49,7 +50,9 @@ strata-asm-common = { path = "crates/common" }
strata-asm-logs = { path = "crates/logs" }
strata-asm-manifest-types = { path = "crates/manifest-types" }
strata-asm-params = { path = "crates/params" }
strata-asm-proof-impl = { path = "crates/proof-impl" }
strata-asm-proof-db = { path = "crates/proof/db" }
strata-asm-proof-impl = { path = "crates/proof/statements" }
strata-asm-proof-types = { path = "crates/proof/types" }
strata-asm-proto-administration = { path = "crates/subprotocols/admin" }
strata-asm-proto-bridge-v1 = { path = "crates/subprotocols/bridge-v1" }
strata-asm-proto-checkpoint = { path = "crates/subprotocols/checkpoint" }
Expand All @@ -65,7 +68,6 @@ strata-asm-txs-checkpoint = { path = "crates/txs/checkpoint" }
strata-asm-txs-checkpoint-v0 = { path = "crates/txs/checkpoint-v0" }
strata-asm-txs-test-utils = { path = "crates/txs/test-utils" }
strata-asm-worker = { path = "crates/worker" }
strata-bridge-proof-db = { path = "crates/proof-db" }

# Dependencies from alpenlabs/alpen pinned to commit 787b804 (main @ 2026-03-17)
# NOTE: keep `typed-sled` pinned in Cargo.lock to 9062bff for compatibility with this alpen rev.
Expand Down Expand Up @@ -94,7 +96,6 @@ strata-test-utils-ssz = { git = "https://github.com/alpenlabs/alpen.git", rev =
# Dependencies from alpenlabs/strata-bridge pinned to commit fc966d5 (STR-2598-asm-stf-proof-statements @ 2026-03-17)
btc-tracker = { git = "https://github.com/alpenlabs/strata-bridge.git", rev = "fc966d5f81c773de10a4ef3a66666687ec11d715" }
strata-bridge-common = { git = "https://github.com/alpenlabs/strata-bridge.git", rev = "fc966d5f81c773de10a4ef3a66666687ec11d715" }
strata-bridge-primitives = { git = "https://github.com/alpenlabs/strata-bridge.git", rev = "fc966d5f81c773de10a4ef3a66666687ec11d715" }

# Dependencies from alpenlabs/moho pinned to commit 97e9d28 (main @ 2026-03-12)
moho-runtime-impl = { git = "https://github.com/alpenlabs/moho", rev = "97e9d281f310e9c2e60cf80448c95e855be589b9" }
Expand Down Expand Up @@ -123,8 +124,11 @@ tree_hash = { git = "https://github.com/alpenlabs/ssz-gen", tag = "v0.14.0" }
tree_hash_derive = { git = "https://github.com/alpenlabs/ssz-gen", tag = "v0.14.0" }

# dependencies from alpenlabs/zkaleido
zkaleido = { git = "https://github.com/alpenlabs/zkaleido", tag = "v0.1.0-alpha-rc21" }
zkaleido-native-adapter = { git = "https://github.com/alpenlabs/zkaleido", tag = "v0.1.0-alpha-rc21" }
# FIXME: (@prajwolrg) use a proper tag
zkaleido = { git = "https://github.com/alpenlabs/zkaleido", rev = "750c209f5850af29e34c39c250c24e1c69ffa2aa", features = [
"borsh",
] }
zkaleido-native-adapter = { git = "https://github.com/alpenlabs/zkaleido", rev = "750c209f5850af29e34c39c250c24e1c69ffa2aa" }

# external dependencies
anyhow = "1.0.86"
Expand Down
8 changes: 5 additions & 3 deletions crates/proof-db/Cargo.toml → crates/proof/db/Cargo.toml
Comment thread
MdTeach marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[package]
name = "strata-bridge-proof-db"
name = "strata-asm-proof-db"
version = "0.1.0"
edition = "2024"

[dependencies]
strata-bridge-primitives.workspace = true
strata-identifiers = { git = "https://github.com/alpenlabs/alpen.git", rev = "201c3fa0af3b1a2173e8e5ae3cdb5d20c311ed17" }
strata-asm-proof-types.workspace = true
strata-identifiers.workspace = true

borsh.workspace = true
sled.workspace = true
zkaleido.workspace = true

[dev-dependencies]
proptest.workspace = true
Expand Down
28 changes: 28 additions & 0 deletions crates/proof/db/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! Persistence layer for ASM and Moho proofs.
//!
//! This crate defines three storage traits that together cover the full
//! lifecycle of a proof — from submission to a remote prover, through status
//! tracking, to final local storage:
//!
//! - [`ProofDb`] — stores and retrieves finalised ASM step proofs and Moho recursive proofs, keyed
//! by their L1 block range or commitment.
//! - [`RemoteProofMappingDb`] — maintains a bidirectional mapping between local
//! [`ProofId`](strata_asm_proof_types::ProofId)s and opaque
//! [`RemoteProofId`](strata_asm_proof_types::RemoteProofId)s assigned by the remote prover
//! service.
//! - [`RemoteProofStatusDb`] — tracks the execution status of in-flight remote proof jobs until
//! their results are retrieved and stored locally.
//!
//! A sled-backed implementation ([`SledProofDb`]) is provided out of the box.

mod proof_db;
mod remote_mapping;
mod remote_status;
mod sled;

pub use self::{
proof_db::ProofDb,
remote_mapping::RemoteProofMappingDb,
remote_status::RemoteProofStatusDb,
sled::{RemoteProofMappingError, RemoteProofStatusError, SledProofDb},
};
11 changes: 5 additions & 6 deletions crates/proof-db/src/lib.rs → crates/proof/db/src/proof_db.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//! Sled-based proof storage.
//! Storage trait for finalised ASM step proofs and Moho recursive proofs.
//!
//! Proofs are keyed by L1 block range (ASM) or L1 block commitment (Moho) and
//! support height-based pruning to reclaim space for old entries.

use std::fmt::Debug;

use strata_bridge_primitives::proof::{AsmProof, L1Range, MohoProof};
use strata_asm_proof_types::{AsmProof, L1Range, MohoProof};
use strata_identifiers::L1BlockCommitment;

mod sled;

pub use self::sled::SledProofDb;

/// Persistence interface for proof storage.
pub trait ProofDb {
/// The error type returned by the database operations.
Expand Down
47 changes: 47 additions & 0 deletions crates/proof/db/src/remote_mapping.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//! Bidirectional mapping between local proof identifiers and remote prover
//! identifiers.
//!
//! This mapping is used to prevent duplicate proof submissions and to recover
//! the association between local and remote identifiers after restarts.

use std::fmt::Debug;

use strata_asm_proof_types::{ProofId, RemoteProofId};

/// Persistent bidirectional mapping between local [`ProofId`]s and
/// [`RemoteProofId`]s assigned by the remote prover service.
///
/// Used to prevent duplicate proof submissions and to recover the association
/// between local and remote identifiers after restarts.
pub trait RemoteProofMappingDb {
/// The error type returned by database operations.
type Error: Debug;

/// Returns the remote proof ID associated with the given local proof ID, if one exists.
fn get_remote_proof_id(
&self,
id: ProofId,
) -> impl Future<Output = Result<Option<RemoteProofId>, Self::Error>> + Send;

/// Returns the local proof ID associated with the given remote proof ID, if one exists.
fn get_proof_id(
&self,
remote_id: &RemoteProofId,
) -> impl Future<Output = Result<Option<ProofId>, Self::Error>> + Send;

/// Stores a mapping between a local proof ID and a remote proof ID.
///
/// A single [`ProofId`] may be associated with multiple [`RemoteProofId`]s
/// (e.g. when a proof is resubmitted), so calling this with the same
/// `id` but a different `remote_id` is allowed — only the forward lookup
/// (`ProofId → RemoteProofId`) is updated to point to the latest remote ID.
///
/// However, a [`RemoteProofId`] must map to exactly one [`ProofId`].
/// If `remote_id` is already associated with a **different** proof ID,
/// this method returns an error.
fn put_remote_proof_id(
&self,
id: ProofId,
remote_id: RemoteProofId,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
55 changes: 55 additions & 0 deletions crates/proof/db/src/remote_status.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//! Status tracking for in-flight remote proof jobs.
//!
//! Entries are created when a proof is submitted to the remote prover and
//! removed once the result has been retrieved and stored locally via
//! [`ProofDb`](crate::ProofDb).

use std::fmt::Debug;

use strata_asm_proof_types::RemoteProofId;
use zkaleido::RemoteProofStatus;

/// Persistent store for the execution status of remote proof jobs.
///
/// Tracks only proofs whose results have **not yet been retrieved and stored
/// locally**. Once a proof is stored via [`ProofDb`](crate::ProofDb), the corresponding status
/// entry should be removed.
pub trait RemoteProofStatusDb {
/// The error type returned by database operations.
type Error: Debug;

/// Inserts a new status entry for the given remote proof ID.
///
/// Returns an error if an entry already exists for this ID.
fn put_status(
&self,
remote_id: &RemoteProofId,
status: RemoteProofStatus,
) -> impl Future<Output = Result<(), Self::Error>> + Send;

/// Updates the status of an existing remote proof entry.
///
/// Returns an error if no entry exists for this ID.
fn update_status(
&self,
remote_id: &RemoteProofId,
status: RemoteProofStatus,
) -> impl Future<Output = Result<(), Self::Error>> + Send;

/// Returns the current status of the given remote proof, if tracked.
fn get_status(
&self,
remote_id: &RemoteProofId,
) -> impl Future<Output = Result<Option<RemoteProofStatus>, Self::Error>> + Send;

/// Returns all remote proofs that are currently active (i.e. `Requested` or `InProgress`).
fn get_all_in_progress(
&self,
) -> impl Future<Output = Result<Vec<(RemoteProofId, RemoteProofStatus)>, Self::Error>> + Send;

/// Removes the status entry for the given remote proof ID.
fn remove(
&self,
remote_id: &RemoteProofId,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Loading
Loading