Skip to content

Commit 0c0b061

Browse files
committed
Merge branch 'denzelpenzel/statement-store-loss-during-major-sync' of github.com:paritytech/polkadot-sdk into denzelpenzel/statement-store-loss-during-major-sync
# Conflicts: # cumulus/zombienet/zombienet-sdk/tests/zombie_ci/statement_store/integration.rs
2 parents b69e515 + a8d7939 commit 0c0b061

File tree

2 files changed

+15
-22
lines changed
  • cumulus/zombienet/zombienet-sdk/tests/zombie_ci/statement_store
  • substrate/client/network/statement/src

2 files changed

+15
-22
lines changed

cumulus/zombienet/zombienet-sdk/tests/zombie_ci/statement_store/integration.rs

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use codec::Encode;
77
use log::{debug, info};
88
use sp_core::Bytes;
99
use sp_statement_store::{
10-
RejectionReason, Statement, StatementAllowance, SubmitResult, Topic,
11-
TopicFilter,
10+
RejectionReason, Statement, StatementAllowance, SubmitResult, Topic, TopicFilter,
1211
};
1312

1413
use sc_statement_store::test_utils::{create_allowance_items, create_test_statement, get_keypair};
@@ -388,14 +387,14 @@ async fn statement_store_crash_mid_sync() -> Result<(), anyhow::Error> {
388387
/// Scenario:
389388
/// 1. Spawn charlie only and let the relay chain advance ~10 blocks
390389
/// 2. Submit a statement to charlie
391-
/// 3. Add dave as a late joiner — dave will enter major sync because the chain has
392-
/// already progressed. While dave is major syncing, its statement handler ignores
393-
/// incoming notifications, so the initial sync batch from charlie is dropped
390+
/// 3. Add dave as a late joiner — dave will enter major sync because the chain has already
391+
/// progressed. While dave is major syncing, its statement handler ignores incoming
392+
/// notifications, so the initial sync batch from charlie is dropped
394393
/// 4. Wait for dave to exit major sync
395-
/// 5. Subscribe to statements on dave AFTER sync has ended — any arrival is therefore
396-
/// caused exclusively by the reconnect triggered at sync completion
397-
/// 6. Assert the statement arrives, proving that `reconnect_statement_peers` fired and
398-
/// triggered a fresh initial sync with charlie
394+
/// 5. Subscribe to statements on dave AFTER sync has ended — any arrival is therefore caused
395+
/// exclusively by the reconnect triggered at sync completion
396+
/// 6. Assert the statement arrives, proving that `reconnect_statement_peers` fired and triggered a
397+
/// fresh initial sync with charlie
399398
///
400399
/// Without the fix (reconnect_statement_peers on sync-end), the subscription would time
401400
/// out because nothing re-triggers the initial sync after major sync completes
@@ -464,18 +463,11 @@ async fn statement_store_peer_disconnect_during_major_sync() -> Result<(), anyho
464463
let dave_rpc = dave.rpc().await?;
465464

466465
// Wait for dave to reach charlie's block height
467-
dave.wait_metric_with_timeout(
468-
"block_height{status=\"best\"}",
469-
|h| h >= charlie_height,
470-
120u64,
471-
)
472-
.await
473-
.map_err(|_| {
474-
anyhow::anyhow!(
475-
"Dave did not reach block height {:.0} within 120s",
476-
charlie_height
477-
)
478-
})?;
466+
dave.wait_metric_with_timeout("block_height{status=\"best\"}", |h| h >= charlie_height, 120u64)
467+
.await
468+
.map_err(|_| {
469+
anyhow::anyhow!("Dave did not reach block height {:.0} within 120s", charlie_height)
470+
})?;
479471
let sync_end = dave_join_time.elapsed();
480472
info!("Dave reached block height {:.0} after {:.1}s", charlie_height, sync_end.as_secs_f64());
481473

substrate/client/network/statement/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,8 @@ where
731731
iter::once(multiaddr::Protocol::P2p(p.into())).collect::<multiaddr::Multiaddr>()
732732
})
733733
.collect();
734-
if let Err(err) = self.network.add_peers_to_reserved_set(self.protocol_name.clone(), addrs) {
734+
if let Err(err) = self.network.add_peers_to_reserved_set(self.protocol_name.clone(), addrs)
735+
{
735736
log::warn!(target: LOG_TARGET, "Failed to re-add reserved peers: {err}");
736737
}
737738
}

0 commit comments

Comments
 (0)