Skip to content

Commit

Permalink
feat: spam cert to everyone and dont gossip them
Browse files Browse the repository at this point in the history
  • Loading branch information
hadjiszs committed Jul 7, 2023
1 parent e612f73 commit a7db6fc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
16 changes: 8 additions & 8 deletions crates/topos-certificate-spammer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub async fn run(
args
);

// Is list of nodes is specified in the command line use them otherwise use
// If list of nodes is specified in the command line use them otherwise use
// config file provided nodes
let target_nodes = if let Some(nodes) = args.target_nodes {
nodes
Expand Down Expand Up @@ -408,13 +408,13 @@ pub async fn run(

// Dispatch certs in this batch
for cert in batch {
// 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)
.instrument(Span::current())
.with_current_context()
.await;
// Send the certificate to all the TCE participants
for target_node in &target_node_connections[&cert.source_subnet_id] {
dispatch(cert.clone(), target_node)
.instrument(Span::current())
.with_current_context()
.await;
}
}
}
.instrument(span)
Expand Down
4 changes: 0 additions & 4 deletions crates/topos-p2p/src/behaviour/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ impl Behaviour {
}

pub fn subscribe(&mut self) -> Result<(), &'static str> {
self.gossipsub
.subscribe(&gossipsub::IdentTopic::new(TOPOS_GOSSIP))
.unwrap();

self.gossipsub
.subscribe(&gossipsub::IdentTopic::new(TOPOS_ECHO))
.unwrap();
Expand Down
5 changes: 4 additions & 1 deletion crates/topos-tce/src/app_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ impl AppContext {
} => {
let span = info_span!(parent: &ctx, "TCE Runtime");

// Assume that the client submitted the Certificate to everyone
let need_gossip = false;

_ = self
.tce_cli
.broadcast_new_certificate(*certificate, true)
.broadcast_new_certificate(*certificate, need_gossip)
.with_context(span.context())
.instrument(span)
.await;
Expand Down
2 changes: 1 addition & 1 deletion tools/env/node.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ TCE_READY_THRESHOLD=6
TCE_DELIVERY_THRESHOLD=10

TOPOS_OTLP_SERVICE_NAME=simon-tce-node
TOPOS_OTLP_TAGS=run_id=simon-local-0019,number_of_peer_nodes=15,cert_per_batch=10,node_kind=boot,number_of_batches=60
TOPOS_OTLP_TAGS=run_id=spammer-gossip,number_of_peer_nodes=15,cert_per_batch=10,node_kind=boot,number_of_batches=60
4 changes: 2 additions & 2 deletions tools/env/spammer.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RUST_LOG=info
TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH=20
TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH=50
TOPOS_NETWORK_SPAMMER_BATCH_INTERVAL=1000
TOPOS_NETWORK_SPAMMER_TARGET_NODES_PATH=/tmp/shared/peer_nodes.json
TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS=1
TOPOS_NETWORK_SPAMMER_NUMBER_OF_BATCHES=60
TOPOS_OTLP_SERVICE_NAME=simon-spammer
TOPOS_OTLP_SERVICE_NAME=monir-spammer

0 comments on commit a7db6fc

Please sign in to comment.