From 381ab78c29fecb5f3f707e9d9e3023154d55a108 Mon Sep 17 00:00:00 2001 From: Monir Hadji Date: Mon, 31 Jul 2023 19:52:52 -0400 Subject: [PATCH] chore: fill the dummy proof with random values In order to avoid measure artefacts due to unrealistic compression ratio --- crates/topos-certificate-spammer/src/lib.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/topos-certificate-spammer/src/lib.rs b/crates/topos-certificate-spammer/src/lib.rs index 91aa0e51b..36a9a1c8b 100644 --- a/crates/topos-certificate-spammer/src/lib.rs +++ b/crates/topos-certificate-spammer/src/lib.rs @@ -14,7 +14,18 @@ use tracing::{debug, error, info, info_span, Instrument, Span}; use tracing_opentelemetry::OpenTelemetrySpanExt; lazy_static::lazy_static! { - static ref PROOF_SIZE: usize = std::env::var("PROOF_SIZE_KB").map(|v| v.parse::().unwrap_or(0)).unwrap_or(0) * 1024; + /// Size of the proof + static ref PROOF_SIZE_BYTES: usize = + std::env::var("TOPOS_PROOF_SIZE_BYTES") + .ok() + .and_then(|s| s.parse().ok()) + .unwrap_or(1000); + + /// Dummy proof with specified size + static ref STARK_BLOB: Vec = + (0..*PROOF_SIZE_BYTES) + .map(|_| rand::random::()) + .collect::>(); } #[derive(Debug, thiserror::Error)] @@ -102,7 +113,7 @@ pub fn generate_test_certificate( generate_random_32b_array(), target_subnet_ids, 0, - vec![254u8; *PROOF_SIZE], + STARK_BLOB.clone(), )?; new_cert .update_signature(&source_subnet.signing_key)