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

feat: send certificates to every nodes when spamming the network #490

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion crates/topos-certificate-spammer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ pub async fn run(
args: CertificateSpammerConfig,
mut shutdown: mpsc::Receiver<oneshot::Sender<()>>,
) -> Result<(), Error> {
info!("{:#?}", args);
// Is list of nodes is specified in the command line use them otherwise use
// config file provided nodes
let target_nodes = if args.benchmark {
Expand Down Expand Up @@ -346,10 +347,16 @@ pub async fn run(
// Randomly choose target tce node for every certificate from related source_subnet_id connection list
let target_node_connection = &target_node_connections[&cert.source_subnet_id]
[rand::random::<usize>() % target_nodes.len()];
dispatch(cert, target_node_connection)
// for target_node_connection in &target_node_connections[&cert.source_subnet_id] {
// info!(
// "Dispatching {cert:?} to target node {}",
// target_node_connection.address
// );
dispatch(cert.clone(), target_node_connection)
.instrument(Span::current())
.with_current_context()
.await;
// }
}
}
.instrument(span)
Expand Down
2 changes: 1 addition & 1 deletion crates/topos/src/components/regtest/commands/spam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct Spam {
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS",
default_value = "1"
default_value = "100"
)]
pub nb_subnets: u8,
/// Number of batches to generate before finishing execution.
Expand Down
2 changes: 2 additions & 0 deletions crates/topos/src/components/regtest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub(crate) async fn handle_command(
env!("TOPOS_VERSION"),
)?;

info!("Verify version of topos_certificate_spammer: 111");

let (shutdown_sender, shutdown_receiver) = mpsc::channel::<oneshot::Sender<()>>(1);
let mut runtime = spawn(topos_certificate_spammer::run(config, shutdown_receiver));

Expand Down
Loading