diff --git a/crates/server/src/http/v1/post_execution_proof_requests.rs b/crates/server/src/http/v1/post_execution_proof_requests.rs index d306d41..92be0d3 100644 --- a/crates/server/src/http/v1/post_execution_proof_requests.rs +++ b/crates/server/src/http/v1/post_execution_proof_requests.rs @@ -4,7 +4,7 @@ use std::{collections::HashSet, sync::Arc}; use axum::{Json, extract::State}; use bytes::Bytes; -use tracing::{info_span, instrument}; +use tracing::{debug, info_span, instrument}; use zkboost_types::{ Decode, MainnetEthSpec, NewPayloadRequest, ProofRequestQuery, ProofRequestResponse, TreeHash, }; @@ -14,7 +14,7 @@ use crate::{ AppState, v1::{ErrorResponse, Query}, }, - proof::ProofServiceMessage, + proof::{ProofServiceMessage, zkvm::zkVMInstance}, }; #[instrument(skip_all)] @@ -44,6 +44,22 @@ pub(crate) async fn post_execution_proof_requests( } } + // Reject proof generation requests for verifier-only instances early, + // before wasting resources on witness fetching. + for proof_type in &proof_types { + if let Some(zkvm) = state.zkvms.get(proof_type) + && matches!(zkvm, zkVMInstance::Verifier { .. }) + { + debug!( + %proof_type, + "rejecting proof request: verifier-only instance" + ); + return Err(ErrorResponse::bad_request(format!( + "proof generation not supported for verifier-only zkvm '{proof_type}'" + ))); + } + } + let new_payload_request = NewPayloadRequest::::from_ssz_bytes(&body) .map(Arc::new) .map_err(|e| ErrorResponse::bad_request(format!("invalid SSZ body: {e:?}")))?; diff --git a/crates/server/src/server.rs b/crates/server/src/server.rs index f10431f..0355328 100644 --- a/crates/server/src/server.rs +++ b/crates/server/src/server.rs @@ -79,10 +79,22 @@ impl zkBoostServer { let mut zkvms = HashMap::new(); for zkvm_config in &config.zkvm { let instance = zkVMInstance::new(zkvm_config).await?; + let mode = match zkvm_config { + crate::config::zkVMConfig::Ere { .. } => "prover", + crate::config::zkVMConfig::Mock { .. } => "mock", + crate::config::zkVMConfig::Verifier { .. } => "verifier-only", + }; info!( proof_type = %zkvm_config.proof_type(), + mode, "zkvm instance created" ); + if matches!(zkvm_config, crate::config::zkVMConfig::Verifier { .. }) { + info!( + proof_type = %zkvm_config.proof_type(), + "verifier-only mode: proof generation requests will be rejected" + ); + } zkvms.insert(zkvm_config.proof_type(), instance); } set_programs_loaded(zkvms.len());