Fix for #6296: Deterministic RNG in peer DAS publish block tests (#7192)

#6296: Deterministic RNG in peer DAS publish block tests


  Made test functions to call publish-block APIs with true for the deterministic RNG boolean parameter while production code with false. This will deterministically shuffle columns for unit tests under broadcast_validation_tests.rs.
This commit is contained in:
SunnysidedJ
2025-04-09 16:35:15 +01:00
committed by GitHub
parent 759b0612b3
commit d96b73152e
9 changed files with 36 additions and 5 deletions

View File

@@ -31,6 +31,7 @@ logging = { workspace = true }
metrics = { workspace = true }
monitoring_api = { workspace = true }
network = { workspace = true }
rand = { workspace = true }
sensitive_url = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }

View File

@@ -33,6 +33,8 @@ use genesis::{interop_genesis_state, Eth1GenesisService, DEFAULT_ETH1_BLOCK_HASH
use lighthouse_network::{prometheus_client::registry::Registry, NetworkGlobals};
use monitoring_api::{MonitoringHttpClient, ProcessType};
use network::{NetworkConfig, NetworkSenders, NetworkService};
use rand::rngs::{OsRng, StdRng};
use rand::SeedableRng;
use slasher::Slasher;
use slasher_service::SlasherService;
use std::net::TcpListener;
@@ -210,7 +212,10 @@ where
.event_handler(event_handler)
.execution_layer(execution_layer)
.import_all_data_columns(config.network.subscribe_all_data_column_subnets)
.validator_monitor_config(config.validator_monitor.clone());
.validator_monitor_config(config.validator_monitor.clone())
.rng(Box::new(
StdRng::from_rng(OsRng).map_err(|e| format!("Failed to create RNG: {:?}", e))?,
));
let builder = if let Some(slasher) = self.slasher.clone() {
builder.slasher(slasher)