From 47a83aa7a474f3fd4613b28c0b84a54e2c4d3c16 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Fri, 28 Jun 2024 12:26:19 +0200 Subject: [PATCH] fix(code): Use more reasonable `history_gossip` and `history_length` config params for GossipSub --- code/crates/gossip-consensus/src/behaviour.rs | 5 +++-- code/crates/gossip-mempool/src/behaviour.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/code/crates/gossip-consensus/src/behaviour.rs b/code/crates/gossip-consensus/src/behaviour.rs index fb3561e7b..0853d3dad 100644 --- a/code/crates/gossip-consensus/src/behaviour.rs +++ b/code/crates/gossip-consensus/src/behaviour.rs @@ -17,6 +17,7 @@ pub struct Behaviour { pub identify: identify::Behaviour, pub gossipsub: gossipsub::Behaviour, } + fn message_id(message: &gossipsub::Message) -> gossipsub::MessageId { let hash = blake3::hash(&message.data); gossipsub::MessageId::from(hash.as_bytes().to_vec()) @@ -28,12 +29,12 @@ fn gossipsub_config() -> gossipsub::Config { .opportunistic_graft_ticks(3) .heartbeat_interval(Duration::from_secs(1)) .validation_mode(gossipsub::ValidationMode::Strict) - .history_gossip(50) + .history_gossip(3) + .history_length(5) .mesh_n_high(12) .mesh_n_low(4) .mesh_outbound_min(2) .mesh_n(6) - .history_length(500) .message_id_fn(message_id) .build() .unwrap() diff --git a/code/crates/gossip-mempool/src/behaviour.rs b/code/crates/gossip-mempool/src/behaviour.rs index cc7778fb3..f9f09de39 100644 --- a/code/crates/gossip-mempool/src/behaviour.rs +++ b/code/crates/gossip-mempool/src/behaviour.rs @@ -30,12 +30,12 @@ fn gossipsub_config() -> gossipsub::Config { .opportunistic_graft_ticks(3) .heartbeat_interval(Duration::from_secs(1)) .validation_mode(gossipsub::ValidationMode::Strict) - .history_gossip(50) + .history_gossip(3) + .history_length(5) .mesh_n_high(12) .mesh_n_low(4) .mesh_outbound_min(2) .mesh_n(6) - .history_length(500) .message_id_fn(message_id) .build() .unwrap()