Skip to content

Commit 72516f6

Browse files
committed
refactor: simplify debug logs
1 parent dab4ab1 commit 72516f6

File tree

2 files changed

+20
-103
lines changed

2 files changed

+20
-103
lines changed

zkvm_execution_layer/src/dummy_proof_gen.rs

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::ethproofs_demo::{
2-
VERIFIER_STORE, download_proof_binary, fetch_proof_from_ethproofs, validate_proof,
2+
download_proof_binary, fetch_proof_from_ethproofs, validate_proof, VERIFIER_STORE,
33
};
44
use crate::proof_generation::{ProofGenerationError, ProofGenerationResult, ProofGenerator};
55
use async_trait::async_trait;
@@ -69,12 +69,6 @@ impl ProofGenerator for DummyProofGenerator {
6969
sleep(self.generation_delay).await;
7070
}
7171

72-
debug!(
73-
proof_id = %self.proof_id,
74-
block_hash = %payload_hash,
75-
"[Ethproofs] Starting proof generation"
76-
);
77-
7872
// Get the Ethproofs prover UUID corresponding to this proof_id
7973
let prover_uuid = match VERIFIER_STORE.get_prover_uuid_for_proof_id(self.proof_id) {
8074
Some(uuid) => uuid,
@@ -91,20 +85,14 @@ impl ProofGenerator for DummyProofGenerator {
9185

9286
debug!(
9387
proof_id = %self.proof_id,
94-
prover_uuid = %prover_uuid,
95-
"[Ethproofs] Querying API"
88+
slot = %slot,
89+
block_hash = %payload_hash,
90+
"[Ethproofs] Starting proof generation"
9691
);
9792

9893
// Fetch proof from Ethproofs API for this proof_id's cluster
9994
match fetch_proof_from_ethproofs(*payload_hash, cluster).await {
10095
Ok(proofs) => {
101-
debug!(
102-
proof_id = %self.proof_id,
103-
block_hash = %payload_hash,
104-
count = proofs.len(),
105-
"[Ethproofs] Fetched proofs"
106-
);
107-
10896
// Try to download and verify the proof
10997
if let Some(proof_entry) = proofs.first() {
11098
// Download the proof binary
@@ -119,32 +107,23 @@ impl ProofGenerator for DummyProofGenerator {
119107
proof_binary,
120108
) {
121109
Ok(proof) => {
122-
// Verify the proof
110+
debug!(
111+
proof_id = proof_entry.proof_id,
112+
cluster_id = %proof_entry.cluster_id,
113+
"[Ethproofs] Proof verification check"
114+
);
115+
123116
if validate_proof(&proof) {
124-
debug!(
125-
proof_id = proof_entry.proof_id,
126-
cluster_id = %proof_entry.cluster_id,
127-
"[Ethproofs] Proof verification succeeded"
128-
);
129117
return Ok(proof);
130-
} else {
131-
debug!(
132-
proof_id = proof_entry.proof_id,
133-
"[Ethproofs] Proof verification failed"
134-
);
135118
}
136119
}
137-
Err(e) => {
138-
debug!(
139-
proof_id = proof_entry.proof_id,
140-
error = %e,
141-
"[Ethproofs] Failed to create proof structure"
142-
);
120+
Err(_) => {
121+
// Proof structure creation failed, will fallback below
143122
}
144123
}
145124
}
146125
Err(e) => {
147-
debug!(
126+
warn!(
148127
proof_id = proof_entry.proof_id,
149128
error = %e,
150129
"[Ethproofs] Failed to download proof"
@@ -159,10 +138,10 @@ impl ProofGenerator for DummyProofGenerator {
159138
}
160139

161140
// Fall back to dummy proof if we get here
162-
warn!(
141+
debug!(
163142
proof_id = %self.proof_id,
164143
block_hash = %payload_hash,
165-
"[Ethproofs] Proof verification failed, falling back to dummy"
144+
"[Ethproofs] API proof generation failed, using dummy fallback"
166145
);
167146
self.create_dummy_proof(slot, payload_hash, block_root)
168147
}

zkvm_execution_layer/src/ethproofs_demo.rs

Lines changed: 5 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,15 @@ use types::ExecutionProof;
1010
/// Global verification key store, loaded once on first access
1111
pub static VERIFICATION_KEY_STORE: Lazy<Option<VerificationKeyStore>> =
1212
Lazy::new(|| match VerificationKeyStore::load_embedded() {
13-
Ok(store) => {
14-
debug!(
15-
key_count = store.len(),
16-
prover_ids = ?store.prover_ids(),
17-
"[Ethproofs] Loaded verification keys"
18-
);
19-
Some(store)
20-
}
13+
Ok(store) => Some(store),
2114
Err(e) => {
2215
warn!(error = %e, "[Ethproofs] Failed to load verification keys");
2316
None
2417
}
2518
});
2619

2720
/// Global verifier store, initialized with default verifiers
28-
pub static VERIFIER_STORE: Lazy<VerifierStore> = Lazy::new(|| {
29-
let store = VerifierStore::with_defaults();
30-
debug!(
31-
verifier_count = store.len(),
32-
"[Ethproofs] Initialized verifier store"
33-
);
34-
store
35-
});
36-
37-
/// Select a random prover_id from available registered verifiers
38-
pub fn select_random_prover_id() -> [u8; 16] {
39-
use rand::Rng;
40-
41-
let available_provers = VERIFIER_STORE.prover_ids();
42-
43-
if available_provers.is_empty() {
44-
warn!("[Ethproofs] No verifiers registered, cannot select prover_id");
45-
return [0u8; 16];
46-
}
47-
48-
let mut rng = rand::rng();
49-
let random_index = rng.random_range(0..available_provers.len());
50-
let selected_uuid = available_provers[random_index];
51-
52-
debug!(
53-
prover_id = %selected_uuid,
54-
available_count = available_provers.len(),
55-
"[Ethproofs] Randomly selected prover_id"
56-
);
57-
58-
*selected_uuid.as_bytes()
59-
}
21+
pub static VERIFIER_STORE: Lazy<VerifierStore> = Lazy::new(VerifierStore::with_defaults);
6022

6123
/// Represents a proof from the Ethproofs proofs list endpoint
6224
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -110,13 +72,6 @@ pub async fn fetch_proof_from_ethproofs(
11072
));
11173
}
11274

113-
debug!(
114-
block_hash = %block_hash,
115-
cluster = %cluster,
116-
delay_ms,
117-
"[Ethproofs] Polling Ethproofs for proof"
118-
);
119-
12075
let response = client
12176
.get(&url)
12277
.send()
@@ -132,21 +87,11 @@ pub async fn fetch_proof_from_ethproofs(
13287

13388
// Return the first proof found for this cluster
13489
if !response_data.proofs.is_empty() {
135-
debug!(
136-
block_hash = %block_hash,
137-
cluster = %cluster,
138-
proof_count = response_data.proofs.len(),
139-
"[Ethproofs] Found proof"
140-
);
14190
return Ok(response_data.proofs);
14291
}
14392
}
14493
StatusCode::NOT_FOUND => {
145-
debug!(
146-
block_hash = %block_hash,
147-
cluster = %cluster,
148-
"[Ethproofs] Block not found, retrying..."
149-
);
94+
// Proof not ready yet, will retry with exponential backoff
15095
}
15196
status => {
15297
return Err(format!(
@@ -185,13 +130,6 @@ pub async fn download_proof_binary(proof_id: u64) -> Result<Vec<u8>, String> {
185130
.bytes()
186131
.await
187132
.map_err(|e| format!("Failed to read response: {}", e))?;
188-
189-
debug!(
190-
proof_id,
191-
size_bytes = proof_data.len(),
192-
"[Ethproofs] Successfully downloaded proof binary"
193-
);
194-
195133
Ok(proof_data.to_vec())
196134
}
197135
StatusCode::NOT_FOUND => Err(format!("Proof {} not found", proof_id)),
@@ -229,7 +167,7 @@ pub fn validate_proof(proof: &ExecutionProof) -> bool {
229167
prover_id = %prover_uuid,
230168
vk_size = vk.size(),
231169
proof_size = proof.proof_data.len(),
232-
"[Ethproofs] Found verification key for prover"
170+
"[Ethproofs] Found vk for prover"
233171
);
234172

235173
// Look up the verifier for this prover
@@ -238,7 +176,7 @@ pub fn validate_proof(proof: &ExecutionProof) -> bool {
238176
debug!(
239177
prover_id = %prover_uuid,
240178
verifier = verifier_entry.name,
241-
"[Ethproofs] Found verifier, running cryptographic verification"
179+
"[Ethproofs] Found verifier, starting verification"
242180
);
243181

244182
// Run the actual cryptographic verification

0 commit comments

Comments
 (0)