diff --git a/polkadot/node/core/backing/src/tests/mod.rs b/polkadot/node/core/backing/src/tests/mod.rs index 5bb8326d409c..4da2752e9905 100644 --- a/polkadot/node/core/backing/src/tests/mod.rs +++ b/polkadot/node/core/backing/src/tests/mod.rs @@ -262,26 +262,9 @@ async fn test_startup(virtual_overseer: &mut VirtualOverseer, test_state: &TestS } ); - // Check if subsystem job issues a request for the minimum backing votes. - // This may or may not happen, depending if the minimum backing votes is already cached in the - // RuntimeInfo. - let next_message = { - let msg = virtual_overseer.recv().await; - match msg { - AllMessages::RuntimeApi(RuntimeApiMessage::Request( - parent, - RuntimeApiRequest::MinimumBackingVotes(tx), - )) if parent == test_state.relay_parent => { - tx.send(Ok(test_state.minimum_backing_votes)).unwrap(); - virtual_overseer.recv().await - }, - _ => msg, - } - }; - // Check that subsystem job issues a request for a validator set. assert_matches!( - next_message, + virtual_overseer.recv().await, AllMessages::RuntimeApi( RuntimeApiMessage::Request(parent, RuntimeApiRequest::Validators(tx)) ) if parent == test_state.relay_parent => { @@ -308,6 +291,17 @@ async fn test_startup(virtual_overseer: &mut VirtualOverseer, test_state: &TestS tx.send(Ok(test_state.availability_cores.clone())).unwrap(); } ); + + // Check if subsystem job issues a request for the minimum backing votes. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + parent, + RuntimeApiRequest::MinimumBackingVotes(session_index, tx), + )) if parent == test_state.relay_parent && session_index == test_state.signing_context.session_index => { + tx.send(Ok(test_state.minimum_backing_votes)).unwrap(); + } + ); } // Test that a `CandidateBackingMessage::Second` issues validation work diff --git a/polkadot/node/core/backing/src/tests/prospective_parachains.rs b/polkadot/node/core/backing/src/tests/prospective_parachains.rs index 93a8e94b98de..fb2a269b86a6 100644 --- a/polkadot/node/core/backing/src/tests/prospective_parachains.rs +++ b/polkadot/node/core/backing/src/tests/prospective_parachains.rs @@ -153,26 +153,9 @@ async fn activate_leaf( } ); - // Check if subsystem job issues a request for the minimum backing votes. - // This may or may not happen, depending if the minimum backing votes is already cached in - // the `RuntimeInfo`. - let next_message = { - let msg = virtual_overseer.recv().await; - match msg { - AllMessages::RuntimeApi(RuntimeApiMessage::Request( - parent, - RuntimeApiRequest::MinimumBackingVotes(tx), - )) if parent == hash => { - tx.send(Ok(test_state.minimum_backing_votes)).unwrap(); - virtual_overseer.recv().await - }, - _ => msg, - } - }; - // Check that subsystem job issues a request for a validator set. assert_matches!( - next_message, + virtual_overseer.recv().await, AllMessages::RuntimeApi( RuntimeApiMessage::Request(parent, RuntimeApiRequest::Validators(tx)) ) if parent == hash => { @@ -201,6 +184,17 @@ async fn activate_leaf( tx.send(Ok(test_state.availability_cores.clone())).unwrap(); } ); + + // Check if subsystem job issues a request for the minimum backing votes. + assert_matches!( + virtual_overseer.recv().await, + AllMessages::RuntimeApi(RuntimeApiMessage::Request( + parent, + RuntimeApiRequest::MinimumBackingVotes(session_index, tx), + )) if parent == hash && session_index == test_state.signing_context.session_index => { + tx.send(Ok(test_state.minimum_backing_votes)).unwrap(); + } + ); } } diff --git a/polkadot/node/network/statement-distribution/src/vstaging/tests/mod.rs b/polkadot/node/network/statement-distribution/src/vstaging/tests/mod.rs index 83922f408527..3440667f56ed 100644 --- a/polkadot/node/network/statement-distribution/src/vstaging/tests/mod.rs +++ b/polkadot/node/network/statement-distribution/src/vstaging/tests/mod.rs @@ -460,8 +460,8 @@ async fn handle_leaf_activation( virtual_overseer.recv().await, AllMessages::RuntimeApi(RuntimeApiMessage::Request( parent, - RuntimeApiRequest::MinimumBackingVotes(tx), - )) if parent == *hash => { + RuntimeApiRequest::MinimumBackingVotes(session_index, tx), + )) if parent == *hash && session_index == *session => { tx.send(Ok(2)).unwrap(); } );