Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
Ok(self.rpc_client.parachain_host_max_relay_parent_session_age(at).await?)
}

async fn allowed_relay_parent_info(
async fn ancestor_relay_parent_info(
&self,
at: Hash,
session_index: polkadot_primitives::SessionIndex,
Expand All @@ -498,7 +498,7 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
> {
Ok(self
.rpc_client
.parachain_host_allowed_relay_parent_info(at, session_index, relay_parent)
.parachain_host_ancestor_relay_parent_info(at, session_index, relay_parent)
.await?)
}
}
Expand Down
4 changes: 2 additions & 2 deletions cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,14 +799,14 @@ impl RelayChainRpcClient {
.await
}

pub async fn parachain_host_allowed_relay_parent_info(
pub async fn parachain_host_ancestor_relay_parent_info(
&self,
at: RelayHash,
session_index: SessionIndex,
relay_parent: RelayHash,
) -> Result<Option<RelayParentInfo<RelayHash, BlockNumber>>, RelayChainError> {
self.call_remote_runtime_function(
"ParachainHost_allowed_relay_parent_info",
"ParachainHost_ancestor_relay_parent_info",
at,
Some((session_index, relay_parent)),
)
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/collation-generation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ async fn construct_and_distribute_receipt(

let ccr = CommittedCandidateReceiptV2 { descriptor, commitments: commitments.clone() };

ccr.parse_ump_signals(&transposed_claim_queue, scheduling_parent.is_some())
ccr.parse_ump_signals(&transposed_claim_queue)
.map_err(Error::CandidateReceiptCheck)?;

ccr.to_plain()
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/collation-generation/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ fn approved_peer_signal() {
assert_eq!(descriptor.persisted_validation_data_hash(), expected_pvd.hash());
assert_eq!(descriptor.para_head(), dummy_head_data().hash());
assert_eq!(descriptor.validation_code_hash(), validation_code_hash);
assert_eq!(descriptor.version(true), CandidateDescriptorVersion::V3);
assert_eq!(descriptor.version(), CandidateDescriptorVersion::V3);
}
);

Expand Down
81 changes: 37 additions & 44 deletions polkadot/node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,46 +847,22 @@ impl CurrentlyCheckingSet {
}
}

async fn get_extended_session_info<'a, Sender>(
runtime_info: &'a mut RuntimeInfo,
sender: &mut Sender,
relay_parent: Hash,
) -> Option<&'a ExtendedSessionInfo>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
match runtime_info.get_session_info(sender, relay_parent).await {
Ok(extended_info) => Some(&extended_info),
Err(_) => {
gum::debug!(
target: LOG_TARGET,
?relay_parent,
"Can't obtain SessionInfo or ExecutorParams"
);
None
},
}
}

async fn get_extended_session_info_by_index<'a, Sender>(
runtime_info: &'a mut RuntimeInfo,
sender: &mut Sender,
relay_parent: Hash,
block_hash: Hash,
session_index: SessionIndex,
) -> Option<&'a ExtendedSessionInfo>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
match runtime_info
.get_session_info_by_index(sender, relay_parent, session_index)
.await
{
match runtime_info.get_session_info_by_index(sender, block_hash, session_index).await {
Ok(extended_info) => Some(&extended_info),
Err(_) => {
gum::debug!(
target: LOG_TARGET,
session = session_index,
?relay_parent,
?block_hash,
"Can't obtain SessionInfo or ExecutorParams"
);
None
Expand All @@ -897,13 +873,13 @@ where
async fn get_session_info_by_index<'a, Sender>(
runtime_info: &'a mut RuntimeInfo,
sender: &mut Sender,
relay_parent: Hash,
block_hash: Hash,
session_index: SessionIndex,
) -> Option<&'a SessionInfo>
where
Sender: SubsystemSender<RuntimeApiMessage>,
{
get_extended_session_info_by_index(runtime_info, sender, relay_parent, session_index)
get_extended_session_info_by_index(runtime_info, sender, block_hash, session_index)
.await
.map(|extended_info| &extended_info.session_info)
}
Expand Down Expand Up @@ -1923,14 +1899,24 @@ async fn distribution_messages_for_activation<Sender: SubsystemSender<RuntimeApi

if !block_entry.candidate_is_pending_signature(*candidate_hash)
{
// Executor params are session-buffered, so we use
// block_hash (the including relay block) for the runtime
// API query — its state is guaranteed available. The
// session index comes from the candidate descriptor
// (relay_parent's session), falling back to the including
// block's session for V1 descriptors where relay_parent
// == scheduling_parent.
let session = candidate_entry
.candidate_receipt()
.descriptor()
.session_index()
.unwrap_or(block_entry.session());
let ExtendedSessionInfo { ref executor_params, .. } =
match get_extended_session_info(
match get_extended_session_info_by_index(
session_info_provider,
sender,
candidate_entry
.candidate_receipt()
.descriptor()
.relay_parent(),
block_hash,
session,
)
.await
{
Expand Down Expand Up @@ -3388,16 +3374,23 @@ async fn process_wakeup<Sender: SubsystemSender<RuntimeApiMessage>>(
};

if let Some((cert, val_index, tranche)) = maybe_cert {
let ExtendedSessionInfo { ref executor_params, .. } = match get_extended_session_info(
session_info_provider,
sender,
candidate_entry.candidate_receipt().descriptor().relay_parent(),
)
.await
{
Some(i) => i,
None => return Ok(actions),
};
// Executor params are session-buffered, so we use relay_block (the including relay
// block) for the runtime API query — its state is guaranteed available. The session
// index comes from the candidate descriptor (relay_parent's session), falling back
// to the including block's session for V1 descriptors.
let session = candidate_receipt.descriptor.session_index().unwrap_or(block_entry.session());
let ExtendedSessionInfo { ref executor_params, .. } =
match get_extended_session_info_by_index(
session_info_provider,
sender,
relay_block,
session,
)
.await
{
Some(i) => i,
None => return Ok(actions),
};
let indirect_cert =
IndirectAssignmentCertV2 { block_hash: relay_block, validator: val_index, cert };

Expand Down
41 changes: 0 additions & 41 deletions polkadot/node/core/approval-voting/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2963,13 +2963,6 @@ fn subsystem_validate_approvals_cache() {
assert!(clock.inner.lock().current_wakeup_is(slot_to_tick(slot)));
clock.inner.lock().wakeup_all(slot_to_tick(slot));

assert_matches!(
overseer_recv(&mut virtual_overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(_, RuntimeApiRequest::SessionIndexForChild(rx), )) => {
rx.send(Ok(1u32.into())).unwrap();
}
);

futures_timer::Delay::new(Duration::from_millis(200)).await;

clock.inner.lock().wakeup_all(slot_to_tick(slot + 2));
Expand Down Expand Up @@ -4090,13 +4083,6 @@ fn test_approval_is_sent_on_max_approval_coalesce_count() {
assert!(clock.inner.lock().current_wakeup_is(slot_to_tick(slot)));
clock.inner.lock().wakeup_all(slot_to_tick(slot));

assert_matches!(
overseer_recv(&mut virtual_overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(_, RuntimeApiRequest::SessionIndexForChild(rx), )) => {
rx.send(Ok(1u32.into())).unwrap();
}
);

futures_timer::Delay::new(Duration::from_millis(200)).await;

clock.inner.lock().wakeup_all(slot_to_tick(slot + 2));
Expand Down Expand Up @@ -4398,13 +4384,6 @@ fn test_approval_is_sent_on_max_approval_coalesce_wait() {
assert!(clock.inner.lock().current_wakeup_is(slot_to_tick(slot)));
clock.inner.lock().wakeup_all(slot_to_tick(slot));

assert_matches!(
overseer_recv(&mut virtual_overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(_, RuntimeApiRequest::SessionIndexForChild(rx), )) => {
rx.send(Ok(1u32.into())).unwrap();
}
);

futures_timer::Delay::new(Duration::from_millis(200)).await;

clock.inner.lock().wakeup_all(slot_to_tick(slot + 2));
Expand Down Expand Up @@ -4519,13 +4498,6 @@ async fn setup_overseer_with_two_blocks_each_with_one_assignment_triggered(
assert!(clock.inner.lock().current_wakeup_is(slot_to_tick(slot)));
clock.inner.lock().wakeup_all(slot_to_tick(slot));

assert_matches!(
overseer_recv(virtual_overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(_, RuntimeApiRequest::SessionIndexForChild(rx), )) => {
rx.send(Ok(1u32.into())).unwrap();
}
);

futures_timer::Delay::new(Duration::from_millis(200)).await;

clock.inner.lock().wakeup_all(slot_to_tick(slot + 2));
Expand Down Expand Up @@ -4629,13 +4601,6 @@ async fn setup_overseer_with_blocks_with_two_assignments_triggered(
assert!(clock.inner.lock().current_wakeup_is(slot_to_tick(slot)));
clock.inner.lock().wakeup_all(slot_to_tick(slot));

assert_matches!(
overseer_recv(virtual_overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(_, RuntimeApiRequest::SessionIndexForChild(rx), )) => {
rx.send(Ok(1u32.into())).unwrap();
}
);

futures_timer::Delay::new(Duration::from_millis(200)).await;

clock.inner.lock().wakeup_all(slot_to_tick(slot + 2));
Expand Down Expand Up @@ -5621,12 +5586,6 @@ fn subsystem_launches_missed_assignments_on_restart() {
}
);

assert_matches!(
overseer_recv(&mut virtual_overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(_, RuntimeApiRequest::SessionIndexForChild(rx), )) => {
rx.send(Ok(1u32.into())).unwrap();
}
);
assert_matches!(
overseer_recv(&mut virtual_overseer).await,
AllMessages::ApprovalDistribution(ApprovalDistributionMessage::DistributeAssignment(
Expand Down
Loading
Loading