From 5b8abbc8846eb3a61127c8a54fa96a2ba2328a5a Mon Sep 17 00:00:00 2001 From: asynchronous rob Date: Wed, 24 Jan 2024 11:31:48 -0600 Subject: [PATCH] statement-dist: activate leaves before unconditional deactivate (#3048) https://github.com/paritytech/polkadot-sdk/pull/3042/files#r1465115145 --------- Co-authored-by: command-bot <> --- polkadot/node/network/statement-distribution/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/polkadot/node/network/statement-distribution/src/lib.rs b/polkadot/node/network/statement-distribution/src/lib.rs index 54567f0d8afa..7e91d2849120 100644 --- a/polkadot/node/network/statement-distribution/src/lib.rs +++ b/polkadot/node/network/statement-distribution/src/lib.rs @@ -319,10 +319,12 @@ impl StatementDistributionSubsystem { if let Some(ref activated) = activated { let mode = prospective_parachains_mode(ctx.sender(), activated.hash).await?; if let ProspectiveParachainsMode::Enabled { .. } = mode { - // Ensure we deactivate first, before we activate the new block. - // Activation can fail and then we would skip the deactivation. + let res = + v2::handle_active_leaves_update(ctx, state, activated, mode).await; + // Regardless of the result of leaf activation, we always prune before + // handling it to avoid leaks. v2::handle_deactivate_leaves(state, &deactivated); - v2::handle_active_leaves_update(ctx, state, activated, mode).await?; + res?; } else if let ProspectiveParachainsMode::Disabled = mode { for deactivated in &deactivated { crate::legacy_v1::handle_deactivate_leaf(legacy_v1_state, *deactivated);