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
2,899 changes: 1,108 additions & 1,791 deletions Cargo.lock

Large diffs are not rendered by default.

34 changes: 15 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,31 @@ url = { version = "2.5.7", features = ["serde"] }
# lighthouse
ethereum_serde_utils = "0.8.0"
lighthouse_types = { git = "https://github.com/sigp/lighthouse", branch = "unstable", package = "types" }
ssz = { package = "ethereum_ssz", version = "0.10" }
ssz_derive = { package = "ethereum_ssz_derive", version = "0.10" }
ssz_types = "0.14"
superstruct = "0.10"
tree_hash = "0.12"
tree_hash_derive = "0.12"

# libssz
libssz = "0.2.2"
libssz-derive = "0.2.2"

# alloy
alloy-consensus = "2"
alloy-eips = "2"
alloy-genesis = "2"
alloy-primitives = "1.5"
alloy-primitives = { version = "1.6", features = ["k256", "serde"] }
alloy-rpc-types-debug = "2"
alloy-rpc-types-engine = "2"
alloy-rpc-types-eth = "2"

# reth
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v2.1.0", default-features = false }
stateless = { git = "https://github.com/paradigmxyz/stateless", rev = "e5480e71a8031641ff471cad9dc482a7a14b32d5", default-features = false }

# ere
ere-server-client = { git = "https://github.com/eth-act/ere", tag = "v0.12.1" }
ere-verifier = { git = "https://github.com/eth-act/ere", tag = "v0.12.1" }
ere-catalog = { git = "https://github.com/eth-act/ere", tag = "v0.12.1" }
ere-cluster-client-zisk = { git = "https://github.com/eth-act/ere", tag = "v0.12.1" }
ere-verifier-zisk = { git = "https://github.com/eth-act/ere", tag = "v0.12.1" }
ere-server-client = { git = "https://github.com/eth-act/ere", tag = "v0.13.0" }
ere-verifier = { git = "https://github.com/eth-act/ere", tag = "v0.13.0" }
ere-catalog = { git = "https://github.com/eth-act/ere", tag = "v0.13.0" }
ere-cluster-client-zisk = { git = "https://github.com/eth-act/ere", tag = "v0.13.0" }
ere-verifier-zisk = { git = "https://github.com/eth-act/ere", tag = "v0.13.0" }

# ere-guests
ere-guests-stateless-validator-common = { git = "https://github.com/eth-act/ere-guests", tag = "v0.12.1", package = "stateless-validator-common" }
ere-guests-stateless-validator-ethrex = { git = "https://github.com/eth-act/ere-guests", tag = "v0.12.1", features = ["host"], package = "stateless-validator-ethrex" }
ere-guests-stateless-validator-reth = { git = "https://github.com/eth-act/ere-guests", tag = "v0.12.1", features = ["host"], package = "stateless-validator-reth" }
ere-guests-stateless-validator-common = { git = "https://github.com/eth-act/ere-guests", tag = "v0.13.0", features = ["host"], package = "stateless-validator-common" }
ere-guests-stateless-validator-ethrex = { git = "https://github.com/eth-act/ere-guests", tag = "v0.13.0", features = ["host"], package = "stateless-validator-ethrex" }
ere-guests-stateless-validator-reth = { git = "https://github.com/eth-act/ere-guests", tag = "v0.13.0", features = ["host"], package = "stateless-validator-reth" }

# local
zkboost-client = { path = "crates/client" }
Expand Down
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ port = 3000
# Ethereum execution layer JSON-RPC endpoint (required)
el_endpoint = "http://localhost:8545"

# Optional local chain config JSON file
# Optional local EL chain config JSON file.
# chain_config_path = "path/to/chain_config.json"

# Timeout for witness fetching in seconds (default: 12)
Expand Down Expand Up @@ -100,35 +100,34 @@ mock_proving_time = { kind = "linear", ms_per_mgas = 300 }
# Simulated failure (always returns a proving error)
[[zkvm]]
kind = "mock"
proof_type = "reth-risc0"
proof_type = "reth-openvm"
mock_failure = true
```

Available proof types:

| Index | Name | EL | zkVM |
| ----- | -------------- | -------- | --------- |
| `0` | `ethrex-risc0` | `ethrex` | RISC Zero |
| `1` | `ethrex-sp1` | `ethrex` | SP1 |
| `2` | `ethrex-zisk` | `ethrex` | ZisK |
| `3` | `reth-openvm` | `reth` | OpenVM |
| `4` | `reth-risc0` | `reth` | RISC Zero |
| `5` | `reth-sp1` | `reth` | SP1 |
| `6` | `reth-zisk` | `reth` | ZisK |
| Index | Name | EL | zkVM |
| ----- | --------------- | -------- | ------ |
| `0` | `ethrex-openvm` | `ethrex` | OpenVM |
| `1` | `ethrex-sp1` | `ethrex` | SP1 |
| `2` | `ethrex-zisk` | `ethrex` | ZisK |
| `3` | `reth-openvm` | `reth` | OpenVM |
| `4` | `reth-sp1` | `reth` | SP1 |
| `5` | `reth-zisk` | `reth` | ZisK |

## API

The following endpoints are available:

| Method | Endpoint | Purpose |
| ------ | -------------------------------------------------------------- | ------------------------------------------------------------- |
| `POST` | `/v1/execution_proof_requests?proof_types=` | Submit SSZ-encoded `NewPayloadRequest` to request for a proof |
| `GET` | `/v1/execution_proof_requests?new_payload_request_root=` | SSE stream of proof result |
| `GET` | `/v1/execution_proofs/{new_payload_request_root}/{proof_type}` | Fetch a completed proof |
| `POST` | `/v1/execution_proof_verifications` | Verify a proof |
| `GET` | `/v1/proof_types` | List configured proof types and capabilities |
| `GET` | `/health` | Health check |
| `GET` | `/metrics` | Prometheus metrics |
| Method | Endpoint | Purpose |
| ------ | -------------------------------------------------------------- | -------------------------------------------------------- |
| `POST` | `/v1/execution_proof_requests` | Submit SSZ-encoded `ProofRequestBody` to request a proof |
| `GET` | `/v1/execution_proof_requests?new_payload_request_root=` | SSE stream of proof result |
| `GET` | `/v1/execution_proofs/{new_payload_request_root}/{proof_type}` | Fetch a completed proof |
| `POST` | `/v1/execution_proof_verifications` | Verify a proof via SSZ-encoded `ProofVerificationBody` |
| `GET` | `/v1/proof_types` | List configured proof types and capabilities |
| `GET` | `/health` | Health check |
| `GET` | `/metrics` | Prometheus metrics |

See [openapi.json](openapi.json) for the full API specification ([rendered](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/eth-act/zkboost/master/openapi.json)).

Expand Down
57 changes: 31 additions & 26 deletions crates/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
//! # Example
//!
//! ```ignore
//! use zkboost_client::{zkBoostClient, MainnetEthSpec, NewPayloadRequest};
//! use zkboost_types::ProofType;
//! use zkboost_client::{zkBoostClient, NewPayloadRequest};
//! use zkboost_types::{ChainConfig, ProofType};
//!
//! # async fn example(request: NewPayloadRequest<MainnetEthSpec>) -> Result<(), Box<dyn std::error::Error>> {
//! # async fn example(request: NewPayloadRequest, chain_config: ChainConfig) -> Result<(), Box<dyn std::error::Error>> {
//! let client = zkBoostClient::new("http://localhost:3000".parse()?);
//! let resp = client.request_proof(&request, &[ProofType::RethSP1]).await?;
//! let resp = client.request_proof(&request, &chain_config, &[ProofType::RethSP1]).await?;
//! println!("root: {:?}", resp.new_payload_request_root);
//! # Ok(())
//! # }
Expand All @@ -38,10 +38,10 @@ use url::Url;
pub use {
error::Error,
zkboost_types::{
Encode, FailureReason, Hash256, MainnetEthSpec,
NewPayloadRequest, ProofComplete, ProofEvent, ProofFailure, ProofRequestResponse,
ProofStatus, ProofType, ProofVerificationResponse,
ProofEventParseError,
ChainConfig, FailureReason, Hash256,
NewPayloadRequest, ProofComplete, ProofEvent, ProofFailure, ProofRequestBody,
ProofRequestResponse, ProofStatus, ProofType, ProofVerificationBody,
ProofVerificationResponse, ProofEventParseError, SszEncode,
},
};

Expand Down Expand Up @@ -74,23 +74,27 @@ impl zkBoostClient {

/// Submit a [`NewPayloadRequest`] for proof generation.
///
/// Sends `POST /v1/execution_proof_requests?proof_types=...` with the SSZ-encoded body. Returns
/// the computed `new_payload_request_root` from the server.
/// Sends `POST /v1/execution_proof_requests` with an SSZ-encoded [`ProofRequestBody`] carrying
/// the proof types, payload, and chain config. Returns the computed
/// `new_payload_request_root` from the server.
pub async fn request_proof(
&self,
new_payload_request: &NewPayloadRequest<MainnetEthSpec>,
new_payload_request: &NewPayloadRequest,
chain_config: &ChainConfig,
proof_types: &[ProofType],
) -> Result<ProofRequestResponse, Error> {
let mut url = self.endpoint.join("/v1/execution_proof_requests")?;
let proof_types = Vec::from_iter(proof_types.iter().map(ProofType::as_str)).join(",");
url.query_pairs_mut()
.append_pair("proof_types", &proof_types);
let url = self.endpoint.join("/v1/execution_proof_requests")?;
let body = ProofRequestBody {
new_payload_request: new_payload_request.clone(),
chain_config: chain_config.clone(),
proof_types: proof_types.to_vec(),
};

let response = self
.http_client
.post(url)
.header(CONTENT_TYPE, APPLICATION_OCTET_STREAM)
.body(new_payload_request.as_ssz_bytes())
.body(body.to_ssz())
.send()
.await?;

Expand Down Expand Up @@ -152,27 +156,28 @@ impl zkBoostClient {

/// Verify a proof against the server.
///
/// Sends `POST /v1/execution_proof_verifications?new_payload_request_root=...&proof_type=...`
/// with the raw proof bytes as the request body.
/// Sends `POST /v1/execution_proof_verifications` with an SSZ-encoded [`ProofVerificationBody`]
/// carrying the root, chain config, proof type, and proof bytes.
pub async fn verify_proof(
&self,
new_payload_request_root: Hash256,
chain_config: &ChainConfig,
proof_type: ProofType,
proof: &[u8],
) -> Result<ProofVerificationResponse, Error> {
let mut url = self.endpoint.join("/v1/execution_proof_verifications")?;
url.query_pairs_mut()
.append_pair(
"new_payload_request_root",
&new_payload_request_root.to_string(),
)
.append_pair("proof_type", proof_type.as_str());
let url = self.endpoint.join("/v1/execution_proof_verifications")?;
let body = ProofVerificationBody {
new_payload_request_root: new_payload_request_root.0,
chain_config: chain_config.clone(),
proof_type,
proof: proof.to_vec(),
};

let response = self
.http_client
.post(url)
.header(CONTENT_TYPE, APPLICATION_OCTET_STREAM)
.body(proof.to_vec())
.body(body.to_ssz())
.send()
.await?;

Expand Down
1 change: 0 additions & 1 deletion crates/mock-zkattestor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ reqwest-eventsource.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
sha2.workspace = true
ssz_types.workspace = true
tokio = { workspace = true, features = ["full"] }
tracing.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand Down
Loading
Loading