From afce88a78eabea731448eaef5f96e146d52b2412 Mon Sep 17 00:00:00 2001 From: Simon Paitrault Date: Fri, 28 Jul 2023 10:28:27 +0200 Subject: [PATCH] chore: adding dummy proof size for spammer Signed-off-by: Simon Paitrault --- Cargo.lock | 1 + crates/topos-certificate-spammer/Cargo.toml | 1 + crates/topos-certificate-spammer/src/lib.rs | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index d2b671fd5..a29b70536 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6726,6 +6726,7 @@ dependencies = [ "clap 4.3.11", "futures", "hex", + "lazy_static", "opentelemetry", "rand 0.8.5", "rand_core 0.6.4", diff --git a/crates/topos-certificate-spammer/Cargo.toml b/crates/topos-certificate-spammer/Cargo.toml index 18c5f2193..7261a698f 100644 --- a/crates/topos-certificate-spammer/Cargo.toml +++ b/crates/topos-certificate-spammer/Cargo.toml @@ -20,6 +20,7 @@ tracing-opentelemetry.workspace = true opentelemetry.workspace = true tiny-keccak.workspace = true uuid.workspace = true +lazy_static.workspace = true toml = "0.5.9" diff --git a/crates/topos-certificate-spammer/src/lib.rs b/crates/topos-certificate-spammer/src/lib.rs index d81536fef..91aa0e51b 100644 --- a/crates/topos-certificate-spammer/src/lib.rs +++ b/crates/topos-certificate-spammer/src/lib.rs @@ -13,6 +13,10 @@ use topos_tce_proxy::client::{TceClient, TceClientBuilder}; 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; +} + #[derive(Debug, thiserror::Error)] pub enum Error { #[error("target nodes are not specified")] @@ -98,7 +102,7 @@ pub fn generate_test_certificate( generate_random_32b_array(), target_subnet_ids, 0, - Vec::new(), + vec![254u8; *PROOF_SIZE], )?; new_cert .update_signature(&source_subnet.signing_key)