From 5338f0f0555f655fbc75f3f9df4384bcb80913bc Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 1 Apr 2021 19:06:58 +0200 Subject: [PATCH] tweaks to relevant_authority_ids (#2796) --- .../runtime/parachains/src/runtime_api_impl/v1.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/polkadot/runtime/parachains/src/runtime_api_impl/v1.rs b/polkadot/runtime/parachains/src/runtime_api_impl/v1.rs index 4b2c0f9599..2714be84b8 100644 --- a/polkadot/runtime/parachains/src/runtime_api_impl/v1.rs +++ b/polkadot/runtime/parachains/src/runtime_api_impl/v1.rs @@ -240,9 +240,16 @@ pub fn session_index_for_child() -> SessionIndex { pub fn relevant_authority_ids() -> Vec { let current_session_index = session_index_for_child::(); let earliest_stored_session = >::earliest_stored_session(); - let mut authority_ids = >::next_authorities(); - for session_index in earliest_stored_session..=current_session_index { + // Due to `max_validators`, the `SessionInfo` stores only the validators who are actively + // selected to participate in parachain consensus. We'd like all authorities for the current + // and next sessions to be used in authority-discovery. The two sets likely have large overlap. + let mut authority_ids = >::current_authorities(); + authority_ids.extend(>::next_authorities()); + + // Due to disputes, we'd like to remain connected to authorities of the previous few sessions. + // For this, we don't need anyone other than the validators actively participating in consensus. + for session_index in earliest_stored_session..current_session_index { let info = >::session_info(session_index); if let Some(mut info) = info { authority_ids.append(&mut info.discovery_keys);