Skip to content

Commit

Permalink
chore: introduce a hashes-in-blocks feature flag (#2058)
Browse files Browse the repository at this point in the history
The change is a no-op
  • Loading branch information
kpop-dfinity authored Oct 16, 2024
1 parent 4bd8e1d commit 0de811a
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions rs/replica/setup_ic_network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ use std::{
use tokio::sync::{mpsc::UnboundedSender, watch};
use tower_http::trace::TraceLayer;

/// [IC-1718]: Whether the `hashes-in-blocks` feature is enabled. If the flag is set to `true`, we
/// will strip all ingress messages from blocks, before sending them to peers. On a receiver side,
/// we will reconstruct the blocks by looking up the referenced ingress messages in the ingress
/// pool or, if they are not there, by fetching missing ingress messages from peers who are
/// advertising the blocks.
const HASHES_IN_BLOCKS_FEATURE_ENABLED: bool = false;

pub const MAX_ADVERT_BUFFER: usize = 100_000;
/// This limit is used to protect against a malicious peer advertising many ingress messages.
/// If no malicious peers are present the ingress pools are bounded by a separate limit.
Expand Down Expand Up @@ -342,14 +349,27 @@ fn start_consensus(
join_handles.push(jh);

let bouncer = Arc::new(ConsensusBouncer::new(metrics_registry, message_router));
let assembler = ic_artifact_downloader::FetchArtifact::new(
log.clone(),
rt_handle.clone(),
consensus_pool,
bouncer,
metrics_registry.clone(),
);
new_p2p_consensus.add_client(consensus_rx, client, assembler, SLOT_TABLE_NO_LIMIT);
if HASHES_IN_BLOCKS_FEATURE_ENABLED {
let assembler = ic_artifact_downloader::FetchStrippedConsensusArtifact::new(
log.clone(),
rt_handle.clone(),
consensus_pool,
artifact_pools.ingress_pool.clone(),
bouncer,
metrics_registry.clone(),
node_id,
);
new_p2p_consensus.add_client(consensus_rx, client, assembler, SLOT_TABLE_NO_LIMIT);
} else {
let assembler = ic_artifact_downloader::FetchArtifact::new(
log.clone(),
rt_handle.clone(),
consensus_pool,
bouncer,
metrics_registry.clone(),
);
new_p2p_consensus.add_client(consensus_rx, client, assembler, SLOT_TABLE_NO_LIMIT);
};
};

let ingress_sender = {
Expand Down

0 comments on commit 0de811a

Please sign in to comment.