Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
chore: fill the dummy proof with random values
Browse files Browse the repository at this point in the history
In order to avoid measure artefacts
due to unrealistic compression ratio
  • Loading branch information
hadjiszs committed Aug 1, 2023
1 parent afce88a commit 381ab78
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions crates/topos-certificate-spammer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<usize>().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<u8> =
(0..*PROOF_SIZE_BYTES)
.map(|_| rand::random::<u8>())
.collect::<Vec<u8>>();
}

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 381ab78

Please sign in to comment.