Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
df828ac
Indentation fix.
eskimor Mar 18, 2021
06d4d90
Prepare request-response for PoV fetching.
eskimor Mar 18, 2021
6a940eb
Drop old PoV distribution.
eskimor Mar 18, 2021
a7fc368
WIP: Fetch PoV directly from backing.
eskimor Mar 18, 2021
9847b81
Merge branch 'master' into rk-pov-distribution-2590
eskimor Mar 19, 2021
e03ff75
Backing compiles.
eskimor Mar 19, 2021
a49b4d4
Runtime access and connection management for PoV distribution.
eskimor Mar 23, 2021
545e950
Get rid of seemingly dead code.
eskimor Mar 23, 2021
47d9f5f
Implement PoV fetching.
eskimor Mar 23, 2021
0a283ab
Don't send `ConnectToValidators` for empty list.
eskimor Mar 24, 2021
afd795f
Even better - no need to check over and over again.
eskimor Mar 24, 2021
1c3eec8
PoV fetching implemented.
eskimor Mar 24, 2021
fb24855
Merge branch 'master' into rk-pov-distribution-2590
eskimor Mar 24, 2021
cceddce
Check PoV hash upon reception.
eskimor Mar 24, 2021
89f0bf9
Implement retry of PoV fetching in backing.
eskimor Mar 25, 2021
ab75fea
Avoid pointless validation spawning.
eskimor Mar 25, 2021
10da891
Merge branch 'master' into rk-pov-distribution-2590
eskimor Mar 25, 2021
3915a57
Add jaeger span to pov requesting.
eskimor Mar 25, 2021
fa6409e
Add back tracing.
eskimor Mar 25, 2021
8b9c2d4
Review remarks.
eskimor Mar 25, 2021
2d27be5
Merge branch 'master' into rk-pov-distribution-2590
eskimor Mar 25, 2021
4af7d2e
Whitespace.
eskimor Mar 25, 2021
5c09829
Whitespace again.
eskimor Mar 26, 2021
ea9bde4
Cleanup + fix tests.
eskimor Mar 27, 2021
4207eaf
Log to log target in overseer.
eskimor Mar 27, 2021
3691061
Fix more tests.
eskimor Mar 27, 2021
b1a201a
Don't fail if group cannot be found.
eskimor Mar 27, 2021
298fe9d
Simple test for PoV fetcher.
eskimor Mar 27, 2021
af9f12c
Handle missing group membership better.
eskimor Mar 27, 2021
0c30792
Add test for retry functionality.
eskimor Mar 27, 2021
eb47465
Fix flaky test.
eskimor Mar 27, 2021
071bcca
Merge branch 'master' into rk-pov-distribution-2590
eskimor Mar 27, 2021
3fa5791
Spaces again.
eskimor Mar 28, 2021
82d4a11
Guide updates.
eskimor Mar 28, 2021
b58a2ab
Merge branch 'master' into rk-pov-distribution-2590
eskimor Mar 28, 2021
a0609e7
Spaces.
eskimor Mar 28, 2021
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
Prev Previous commit
Next Next commit
Handle missing group membership better.
  • Loading branch information
eskimor committed Mar 27, 2021
commit af9f12cbc1e0368e28c57e548892cc4f4eac5c9c
15 changes: 8 additions & 7 deletions node/network/availability-distribution/src/pov_requester/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ use polkadot_subsystem::{
ActiveLeavesUpdate, SubsystemContext, messages::{AllMessages, NetworkBridgeMessage, IfDisconnected}
};

use crate::{
runtime::Runtime,
error::{Error, log_error},
};
use crate::{error::{Error, log_error}, runtime::{Runtime, ValidatorInfo}};

/// Number of sessions we want to keep in the LRU.
const NUM_SESSIONS: usize = 2;
Expand Down Expand Up @@ -216,13 +213,17 @@ where
Context: SubsystemContext,
{
let info = runtime.get_session_info_by_index(ctx, parent, session).await?;
if let Some(validator_info) = &info.validator_info {
let indeces = info.session_info.validator_groups.get(validator_info.our_group.0 as usize)
if let ValidatorInfo {
our_index: Some(our_index),
our_group: Some(our_group)
} = &info.validator_info {

let indeces = info.session_info.validator_groups.get(our_group.0 as usize)
.expect("Our group got retrieved from that session info, it must exist. qed.")
.clone();
Ok(Some(
indeces.into_iter()
.filter(|i| *i != validator_info.our_index)
.filter(|i| *i != *our_index)
.map(|i| info.session_info.discovery_keys[i.0 as usize].clone())
.collect()
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl FetchTaskConfig {
let live_in = vec![leaf].into_iter().collect();

// Don't run tasks for our backing group:
if session_info.our_group == core.group_responsible {
if session_info.our_group == Some(core.group_responsible) {
return FetchTaskConfig {
live_in,
prepared_running: None,
Expand Down
30 changes: 12 additions & 18 deletions node/network/availability-distribution/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ pub struct ExtendedSessionInfo {
/// Actual session info as fetched from the runtime.
pub session_info: SessionInfo,
/// Contains useful information about ourselves, in case this node is a validator.
pub validator_info: Option<ValidatorInfo>,
pub validator_info: ValidatorInfo,
}

/// Information about ourself, in case we are an `Authority`.
///
/// This data is derived from the `SessionInfo` and our key as found in the keystore.
pub struct ValidatorInfo {
/// The index this very validator has in `SessionInfo` vectors.
pub our_index: ValidatorIndex,
/// The group we belong to.
pub our_group: GroupIndex,
/// The index this very validator has in `SessionInfo` vectors, if any.
pub our_index: Option<ValidatorIndex>,
/// The group we belong to, if any.
pub our_group: Option<GroupIndex>,
}

impl Runtime {
Expand Down Expand Up @@ -155,7 +155,7 @@ impl Runtime {
async fn get_validator_info(
&self,
session_info: &SessionInfo,
) -> Result<Option<ValidatorInfo>, Error>
) -> Result<ValidatorInfo, Error>
{
if let Some(our_index) = self.get_our_index(&session_info.validators).await {
// Get our group index:
Expand All @@ -172,19 +172,13 @@ impl Runtime {
})
}
);
debug_assert!(
our_group.is_some() || session_info.validator_groups.is_empty(),
"Groups are initialized but validator could not be found in any"
);
if let Some(our_group) = our_group {
let info = ValidatorInfo {
our_index,
our_group,
};
return Ok(Some(info))
}
let info = ValidatorInfo {
our_index: Some(our_index),
our_group,
};
return Ok(info)
}
return Ok(None)
return Ok(ValidatorInfo { our_index: None, our_group: None })
}

/// Get our `ValidatorIndex`.
Expand Down
24 changes: 10 additions & 14 deletions node/network/availability-distribution/src/session_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ pub struct SessionInfo {

/// Remember to which group we belong, so we won't start fetching chunks for candidates with
/// our group being responsible. (We should have that chunk already.)
pub our_group: GroupIndex,
///
/// `None`, if we are not in fact part of any group.
pub our_group: Option<GroupIndex>,
}

/// Report of bad validators.
Expand Down Expand Up @@ -246,10 +248,6 @@ impl SessionCache {
})
}
);
debug_assert!(
our_group.is_some() || validator_groups.is_empty(),
"Groups are initialized but validator could not be found in any"
);

// Shuffle validators in groups:
let mut rng = thread_rng();
Expand All @@ -271,15 +269,13 @@ impl SessionCache {
})
.collect();

if let Some(our_group) = our_group {
let info = SessionInfo {
validator_groups,
our_index,
session_index,
our_group,
};
return Ok(Some(info))
}
let info = SessionInfo {
validator_groups,
our_index,
session_index,
our_group,
};
return Ok(Some(info))
}
return Ok(None)
}
Expand Down