From cba75418727e2771e04f04feaeeedde633e3f67e Mon Sep 17 00:00:00 2001 From: Kamil Popielarz Date: Tue, 15 Oct 2024 14:45:06 +0000 Subject: [PATCH 1/2] . --- rs/replica/setup_ic_network/src/lib.rs | 36 ++++++++++++++++++++------ 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/rs/replica/setup_ic_network/src/lib.rs b/rs/replica/setup_ic_network/src/lib.rs index c339f500fbd..a93bd47366f 100644 --- a/rs/replica/setup_ic_network/src/lib.rs +++ b/rs/replica/setup_ic_network/src/lib.rs @@ -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. @@ -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 = { From d1284279993c5e3fd5a482fb8cbf8a099e5e18a1 Mon Sep 17 00:00:00 2001 From: Kamil Popielarz Date: Tue, 15 Oct 2024 14:49:37 +0000 Subject: [PATCH 2/2] . --- rs/replica/setup_ic_network/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/replica/setup_ic_network/src/lib.rs b/rs/replica/setup_ic_network/src/lib.rs index a93bd47366f..832bc7c5741 100644 --- a/rs/replica/setup_ic_network/src/lib.rs +++ b/rs/replica/setup_ic_network/src/lib.rs @@ -65,7 +65,7 @@ use tower_http::trace::TraceLayer; /// 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; +const HASHES_IN_BLOCKS_FEATURE_ENABLED: bool = true; pub const MAX_ADVERT_BUFFER: usize = 100_000; /// This limit is used to protect against a malicious peer advertising many ingress messages.