Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Asynchronous Backing MegaPR #5022

Merged
merged 123 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
559a46c
inclusion emulator logic for asynchronous backing (#4790)
rphmeier Feb 21, 2022
ba0def5
Merge branch 'rh-async-backing-feature' of https://github.com/parityt…
rphmeier Feb 25, 2022
37735ee
Runtime changes for Asynchronous Backing (#4786)
rphmeier Mar 2, 2022
1fdd683
Merge branch 'master' into rh-async-backing-feature
rphmeier Mar 7, 2022
6261133
Merge branch 'rh-async-backing-feature' of https://github.com/parityt…
rphmeier Mar 7, 2022
e398a9b
Merge branch 'master' into rh-async-backing-feature
rphmeier Mar 9, 2022
b265c4b
Merge branch 'master' into rh-async-backing-feature
rphmeier Apr 5, 2022
ce23bf7
Merge branch 'master' into rh-async-backing-feature
rphmeier Apr 20, 2022
569242a
Merge branch 'master' into rh-async-backing-feature
rphmeier Apr 27, 2022
3cdda45
Merge branch 'master' into rh-async-backing-feature
rphmeier May 18, 2022
c1fbdee
Prospective Parachains Subsystem (#4913)
rphmeier May 18, 2022
36268ec
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Jun 22, 2022
88be445
Integrate prospective parachains subsystem into backing: Part 1 (#5557)
rphmeier Jul 10, 2022
2c9296d
Track occupied depth in backing per parachain (#5778)
slumber Jul 13, 2022
d63ecc8
provisioner: async backing changes (#5711)
slumber Sep 6, 2022
de0fc3e
Merge branch 'master' into rh-async-backing-feature
rphmeier Sep 6, 2022
c61b949
provisioner: async backing changes (#5711)
slumber Sep 6, 2022
db5e798
Merge remote-tracking branch 'upstream/rh-async-backing-feature' into…
rphmeier Sep 6, 2022
aa5b9bf
fmt
rphmeier Sep 6, 2022
25b9f7e
Network bridge changes for asynchronous backing + update subsystems t…
rphmeier Sep 12, 2022
2c215b2
remove max_pov_size requirement from prospective pvd request (#6014)
rphmeier Sep 15, 2022
4b913e7
Extract legacy statement distribution to its own module (#6026)
rphmeier Sep 23, 2022
e17bffb
Merge branch 'master' into rh-async-backing-feature
eskimor Sep 23, 2022
82ff991
Version 3 is already live.
eskimor Sep 26, 2022
614ee8c
Fix tests (#6055)
eskimor Sep 28, 2022
1bde1f7
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Oct 7, 2022
04de8e5
fmt
slumber Oct 7, 2022
ca5e2fe
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Oct 12, 2022
c23032a
collator-protocol: asynchronous backing changes (#5740)
slumber Oct 12, 2022
e3dff2f
Merge branch 'master' into rh-async-backing-feature
rphmeier Oct 13, 2022
6138103
Merge branch 'rh-async-backing-feature' of https://github.com/parityt…
rphmeier Oct 13, 2022
604cfc4
validator assignment fixes for backing and collator protocol (#6158)
slumber Oct 19, 2022
41e2f4d
Refactor prospective parachains mode request (#6179)
slumber Oct 24, 2022
fd1569a
backing: don't send backed candidate to provisioner (#6185)
slumber Oct 25, 2022
0f3ef99
backing: introduce `CanSecond` request for advertisements filtering (…
slumber Nov 3, 2022
21e1932
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Nov 9, 2022
55f3633
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Nov 13, 2022
f062f3c
cargo generate-lockfile
slumber Nov 13, 2022
8b1eb15
Implement `StagingValidityConstraints` Runtime API method (#6258)
slumber Nov 13, 2022
aacb2b3
Merge branch 'master' into rh-async-backing-feature
slumber Nov 28, 2022
c41cbbe
Prepare the Runtime for asynchronous backing upgrade (#6287)
slumber Nov 30, 2022
9f27a2f
Use real prospective parachains subsystem (#6407)
mrcnski Dec 8, 2022
17e945c
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Jan 12, 2023
d9847aa
Merge branch 'master' into rh-async-backing-feature
rphmeier Jan 18, 2023
32759c5
Merge branch 'master' into rh-async-backing-feature
rphmeier Jan 19, 2023
cb193fb
Backport `HypotheticalFrontier` into the feature branch (#6605)
slumber Jan 24, 2023
fbd5999
Resolve todo about legacy leaf activation (#6447)
mrcnski Jan 24, 2023
d7cca3f
fix bug/warning in handling membership answers
rphmeier Jan 25, 2023
7dde6d7
Remove `HypotheticalDepthRequest` in favor of `HypotheticalFrontierRe…
mrcnski Jan 27, 2023
c760b76
Async Backing: Send Statement Distribution "Backed" messages (#6634)
mrcnski Jan 27, 2023
3ae0f24
Fix compile error
mrcnski Jan 28, 2023
d2e6081
Fix some clippy errors
mrcnski Jan 29, 2023
11556a6
Add prospective parachains subsystem tests (#6454)
mrcnski Jan 30, 2023
1c59180
Node-side metrics for asynchronous backing (#6549)
mrcnski Jan 30, 2023
8ce4057
Fix `check_depth_query` test
mrcnski Jan 30, 2023
9153998
inclusion-emulator: mirror advancement rule check (#6361)
slumber Jan 31, 2023
b858af1
prospective-parachains: introduce `backed_in_path_only` flag for adve…
slumber Jan 31, 2023
300e301
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Feb 16, 2023
381862b
fmt
slumber Feb 16, 2023
7f19196
Merge branch 'master' into rh-async-backing-feature
rphmeier Feb 22, 2023
c752c6c
Add async-backing zombienet tests (#6314)
bredamatt Mar 1, 2023
797b32f
Async backing: impl guide for statement distribution (#6738)
mrcnski Mar 1, 2023
8c45c2e
Asynchronous backing statement distribution: Take III (#5999)
rphmeier Mar 3, 2023
2b1f1c7
miscellaneous fixes to make asynchronous backing work (#6791)
rphmeier Mar 8, 2023
ab476ca
Merge branch 'master' into rh-async-backing-feature
rphmeier Mar 8, 2023
626805d
Merge branch 'rh-async-backing-feature' of https://github.com/parityt…
rphmeier Mar 8, 2023
5e53c38
Remove restart from test (#6840)
bredamatt Mar 8, 2023
6d7f78a
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Mar 9, 2023
cf5f666
Async Backing: Statement Distribution Tests (#6755)
mrcnski Mar 10, 2023
6dfbd20
Fix some clippy lints in tests
mrcnski Mar 15, 2023
c9552b7
Async backing: minor fixes (#6920)
mrcnski Mar 21, 2023
2945ba2
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Mar 21, 2023
49ca776
bitfield-distribution test
slumber Mar 21, 2023
e03fb90
implicit view tests
slumber Mar 21, 2023
1e06eb8
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Mar 23, 2023
caa60ba
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Mar 28, 2023
2259262
Refactor parameters -> params
slumber Mar 28, 2023
a9a06aa
scheduler: update storage migration (#6963)
slumber Apr 10, 2023
664d6b2
Statement Distribution Guide Edits (#7025)
BradleyOlson64 Apr 10, 2023
ed9420b
Add attested candidate request retry timeouts (#6833)
mrcnski Apr 12, 2023
631b66d
Async backing: add Prospective Parachains impl guide (#6933)
mrcnski Apr 13, 2023
cdc8c18
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Apr 19, 2023
aee4ba9
Updates to Provisioner Guide for Async Backing (#7106)
BradleyOlson64 May 1, 2023
5b8a0ad
Merge branch 'master' of https://github.com/paritytech/polkadot into …
BradleyOlson64 May 1, 2023
5ad5706
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber May 24, 2023
baf1365
fmt
slumber May 24, 2023
5c53e31
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber May 25, 2023
137668d
Renaming Parathread Mentions (#7287)
BradleyOlson64 Jun 2, 2023
b2e3cf2
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Jun 27, 2023
2b6ea67
fix bitfield distribution test
slumber Jun 27, 2023
789eadf
approval distribution tests
slumber Jun 27, 2023
b7b2748
fix bridge tests
slumber Jun 27, 2023
8737dc6
Merge branch 'rh-async-backing-feature' into rh-async-backing-feature…
rphmeier Jul 3, 2023
ba1b67f
Merge branch 'master' into rh-async-backing-feature-while-frozen
rphmeier Jul 3, 2023
c4b7412
update Cargo.lock
rphmeier Jul 3, 2023
f74d85a
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Jul 5, 2023
5fb7ffb
[async-backing-branch] Optimize collator-protocol validator-side requ…
alindima Jul 10, 2023
89f600d
Update collation generation for asynchronous backing (#7405)
rphmeier Jul 10, 2023
cdcff53
Merge branch 'master' into rh-async-backing-feature
rphmeier Jul 10, 2023
9426a27
Merge branch 'master' into rh-async-backing-feature
rphmeier Jul 13, 2023
5207e17
fix some more fallout from merge
rphmeier Jul 13, 2023
6e3efdb
fmt
rphmeier Jul 13, 2023
c2f3daa
remove staging APIs from Rococo & Westend (#7513)
rphmeier Jul 18, 2023
2933d34
send network messages on main protocol name (#7515)
rphmeier Jul 19, 2023
d3f0fe6
misc async backing improvements for allowed ancestry blocks (#7532)
slumber Jul 21, 2023
9f91005
Merge branch 'master' into rh-async-backing-feature
rphmeier Jul 21, 2023
a16c843
provisioner: request candidate receipt by relay parent (#7527)
slumber Jul 21, 2023
5a45ecd
Merge branch 'master' into rh-async-backing-feature
rphmeier Jul 26, 2023
637f0c5
Merge branch 'rh-async-backing-feature' of https://github.com/parityt…
rphmeier Jul 26, 2023
f2aa3b3
revert to old `handle_new_activations` logic in some cases (#7514)
rphmeier Jul 28, 2023
5625f42
Omnibus asynchronous backing bugfix PR (#7529)
rphmeier Jul 28, 2023
21fec9d
Merge branch 'master' into rh-async-backing-feature
rphmeier Jul 28, 2023
bd6b87d
fix zombienet tests (#7614)
sandreim Aug 14, 2023
6214bfb
Merge branch 'master' into rh-async-backing-feature
rphmeier Aug 14, 2023
eb4ae4e
fix runtime compilation
rphmeier Aug 14, 2023
876fc04
make bitfield distribution tests compile
rphmeier Aug 14, 2023
ebe28f8
attempt to fix zombienet disputes (#7618)
rphmeier Aug 15, 2023
09b653b
Merge branch 'master' into rh-async-backing-feature
rphmeier Aug 15, 2023
5115d95
fmt
rphmeier Aug 15, 2023
d5151e9
Merge remote-tracking branch 'origin/master' into rh-async-backing-fe…
slumber Aug 17, 2023
e0d0d87
clippy
slumber Aug 17, 2023
17e2e2e
add RUN_IN_CONTAINER to new ZombieNet tests (#7631)
rphmeier Aug 17, 2023
27bcad9
remove duplicated migration
slumber Aug 18, 2023
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
481 changes: 278 additions & 203 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ members = [
"node/core/chain-selection",
"node/core/dispute-coordinator",
"node/core/parachains-inherent",
"node/core/prospective-parachains",
"node/core/provisioner",
"node/core/pvf",
"node/core/pvf-checker",
Expand Down Expand Up @@ -207,6 +208,7 @@ fast-runtime = [ "polkadot-cli/fast-runtime" ]
runtime-metrics = [ "polkadot-cli/runtime-metrics" ]
pyroscope = ["polkadot-cli/pyroscope"]
jemalloc-allocator = ["polkadot-node-core-pvf/jemalloc-allocator", "polkadot-overseer/jemalloc-allocator"]
network-protocol-staging = ["polkadot-cli/network-protocol-staging"]

# Configuration for building a .deb package - for use with `cargo-deb`
[package.metadata.deb]
Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ rococo-native = ["service/rococo-native"]

malus = ["full-node", "service/malus"]
runtime-metrics = ["service/runtime-metrics", "polkadot-node-metrics/runtime-metrics"]
network-protocol-staging = ["service/network-protocol-staging"]
28 changes: 17 additions & 11 deletions node/collation-generation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ async fn handle_new_activations<Context>(
let (scheduled_core, assumption) = match core {
CoreState::Scheduled(scheduled_core) =>
(scheduled_core, OccupiedCoreAssumption::Free),
CoreState::Occupied(_occupied_core) => {
// TODO: https://github.com/paritytech/polkadot/issues/1573
gum::trace!(
target: LOG_TARGET,
core_idx = %core_idx,
relay_parent = ?relay_parent,
"core is occupied. Keep going.",
);
continue
CoreState::Occupied(occupied_core) => {
// TODO [now]: this assumes that next up == current.
// in practice we should only set `OccupiedCoreAssumption::Included`
// when the candidate occupying the core is also of the same para.
if let Some(scheduled) = occupied_core.next_up_on_available {
(scheduled, OccupiedCoreAssumption::Included)
} else {
continue
}
},
CoreState::Free => {
gum::trace!(
Expand Down Expand Up @@ -286,6 +286,7 @@ async fn handle_new_activations<Context>(
"collation-builder",
Box::pin(async move {
let persisted_validation_data_hash = validation_data.hash();
let parent_head_data_hash = validation_data.parent_head.hash();

let (collation, result_sender) =
match (task_config.collator)(relay_parent, &validation_data).await {
Expand Down Expand Up @@ -385,8 +386,13 @@ async fn handle_new_activations<Context>(

if let Err(err) = task_sender
.send(
CollatorProtocolMessage::DistributeCollation(ccr, pov, result_sender)
.into(),
CollatorProtocolMessage::DistributeCollation(
ccr,
parent_head_data_hash,
pov,
result_sender,
)
.into(),
)
.await
{
Expand Down
4 changes: 2 additions & 2 deletions node/core/approval-voting/src/criteria.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub(crate) fn compute_assignments(
// Ignore any cores where the assigned group is our own.
let leaving_cores = leaving_cores
.into_iter()
.filter(|&(_, _, ref g)| !is_in_backing_group(&config.validator_groups, index, *g))
.filter(|(_, _, g)| !is_in_backing_group(&config.validator_groups, index, *g))
.map(|(c_hash, core, _)| (c_hash, core))
.collect::<Vec<_>>();

Expand Down Expand Up @@ -496,7 +496,7 @@ pub(crate) fn check_assignment_cert(
return Err(InvalidAssignment(Reason::IsInBackingGroup))
}

let &(ref vrf_output, ref vrf_proof) = &assignment.vrf;
let (vrf_output, vrf_proof) = &assignment.vrf;
match assignment.kind {
AssignmentCertKind::RelayVRFModulo { sample } => {
if sample >= config.relay_vrf_modulo_samples {
Expand Down
2 changes: 1 addition & 1 deletion node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl Wakeups {
.collect();

let mut pruned_wakeups = BTreeMap::new();
self.reverse_wakeups.retain(|&(ref h, ref c_h), tick| {
self.reverse_wakeups.retain(|(h, c_h), tick| {
let live = !pruned_blocks.contains(h);
if !live {
pruned_wakeups.entry(*tick).or_insert_with(HashSet::new).insert((*h, *c_h));
Expand Down
4 changes: 2 additions & 2 deletions node/core/approval-voting/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn visit_and_remove_block_entry(
};

overlayed_db.delete_block_entry(&block_hash);
for &(_, ref candidate_hash) in block_entry.candidates() {
for (_, candidate_hash) in block_entry.candidates() {
let candidate = match visited_candidates.entry(*candidate_hash) {
Entry::Occupied(e) => e.into_mut(),
Entry::Vacant(e) => {
Expand Down Expand Up @@ -227,7 +227,7 @@ pub fn add_block_entry(

// read and write all updated entries.
{
for &(_, ref candidate_hash) in entry.candidates() {
for (_, candidate_hash) in entry.candidates() {
let NewCandidateInfo { candidate, backing_group, our_assignment } =
match candidate_info(candidate_hash) {
None => return Ok(Vec::new()),
Expand Down
43 changes: 31 additions & 12 deletions node/core/backing/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
use fatality::Nested;
use futures::channel::{mpsc, oneshot};

use polkadot_node_subsystem::{messages::ValidationFailed, SubsystemError};
use polkadot_node_subsystem_util::Error as UtilError;
use polkadot_primitives::BackedCandidate;
use polkadot_node_subsystem::{messages::ValidationFailed, RuntimeApiError, SubsystemError};
use polkadot_node_subsystem_util::{runtime, Error as UtilError};
use polkadot_primitives::{BackedCandidate, ValidationCodeHash};

use crate::LOG_TARGET;

Expand All @@ -30,6 +30,18 @@ pub type FatalResult<T> = std::result::Result<T, FatalError>;
#[allow(missing_docs)]
#[fatality::fatality(splitable)]
pub enum Error {
#[fatal]
#[error("Failed to spawn background task")]
FailedToSpawnBackgroundTask,

#[fatal(forward)]
#[error("Error while accessing runtime information")]
Runtime(#[from] runtime::Error),

#[fatal]
#[error(transparent)]
BackgroundValidationMpsc(#[from] mpsc::SendError),

#[error("Candidate is not found")]
CandidateNotFound,

Expand All @@ -42,16 +54,27 @@ pub enum Error {
#[error("FetchPoV failed")]
FetchPoV,

#[fatal]
#[error("Failed to spawn background task")]
FailedToSpawnBackgroundTask,
#[error("Fetching validation code by hash failed {0:?}, {1:?}")]
FetchValidationCode(ValidationCodeHash, RuntimeApiError),

#[error("Fetching Runtime API version failed {0:?}")]
FetchRuntimeApiVersion(RuntimeApiError),

#[error("No validation code {0:?}")]
NoValidationCode(ValidationCodeHash),

#[error("Candidate rejected by prospective parachains subsystem")]
RejectedByProspectiveParachains,

#[error("ValidateFromChainState channel closed before receipt")]
ValidateFromChainState(#[source] oneshot::Canceled),
#[error("ValidateFromExhaustive channel closed before receipt")]
ValidateFromExhaustive(#[source] oneshot::Canceled),

#[error("StoreAvailableData channel closed before receipt")]
StoreAvailableData(#[source] oneshot::Canceled),

#[error("RuntimeAPISubsystem channel closed before receipt")]
RuntimeApiUnavailable(#[source] oneshot::Canceled),

#[error("a channel was closed before receipt in try_join!")]
JoinMultiple(#[source] oneshot::Canceled),

Expand All @@ -61,10 +84,6 @@ pub enum Error {
#[error(transparent)]
ValidationFailed(#[from] ValidationFailed),

#[fatal]
#[error(transparent)]
BackgroundValidationMpsc(#[from] mpsc::SendError),

#[error(transparent)]
UtilError(#[from] UtilError),

Expand Down
Loading