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

Prospective Parachains Subsystem #4913

Merged
merged 94 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
e6d37b0
docs and skeleton
rphmeier Feb 12, 2022
0c77843
subsystem skeleton
rphmeier Feb 15, 2022
6c82e7c
main loop
rphmeier Feb 15, 2022
4d73138
fragment tree basics & fmt
rphmeier Feb 15, 2022
d7d5ff7
begin fragment trees & view
rphmeier Feb 15, 2022
30ba334
flesh out more of view update logic
rphmeier Feb 15, 2022
6a052e0
further flesh out update logic
rphmeier Feb 15, 2022
65b68fc
some refcount functions for fragment trees
rphmeier Feb 15, 2022
4041460
add fatal/non-fatal errors
rphmeier Feb 16, 2022
e7010ed
use non-fatal results
rphmeier Feb 16, 2022
53dd196
clear up some TODOs
rphmeier Feb 16, 2022
f419c66
ideal format for scheduling info
rphmeier Feb 17, 2022
da1bac8
add a bunch of TODOs
rphmeier Feb 17, 2022
2c51312
some more fluff
rphmeier Feb 24, 2022
efcba0a
extract fragment graph to submodule
rphmeier Feb 24, 2022
435042d
begin fragment graph API
rphmeier Feb 25, 2022
fff0817
trees, not graphs
rphmeier Feb 25, 2022
f49482c
improve docs
rphmeier Feb 25, 2022
73a208f
scope and constructor for trees
rphmeier Feb 25, 2022
1fc33ec
add some test TODOs
rphmeier Mar 1, 2022
5a400a3
limit max ancestors and store constraints
rphmeier Mar 1, 2022
6ff3e31
constructor
rphmeier Mar 1, 2022
109e0f4
constraints: fix bug in HRMP watermarks
rphmeier Mar 1, 2022
3b88edb
fragment tree population logic
rphmeier Mar 2, 2022
eb3c0cc
set::retain
rphmeier Mar 6, 2022
a6a5c5f
extract population logic
rphmeier Mar 6, 2022
67dc653
implement add_and_populate
rphmeier Mar 6, 2022
592cbbf
fmt
rphmeier Mar 6, 2022
2112ba5
add some TODOs in tests
rphmeier Mar 6, 2022
ddcfa78
implement child-selection
rphmeier Mar 6, 2022
2d2e841
strip out old stuff based on wrong assumptions
rphmeier Mar 6, 2022
e188118
use fatality
rphmeier Mar 7, 2022
f573972
Merge branch 'rh-async-backing-feature' into rh-async-backing-prediction
rphmeier Mar 7, 2022
7af95bb
implement pruning
rphmeier Mar 7, 2022
5c3fc42
remove unused ancestor constraints
rphmeier Mar 7, 2022
8d7611a
fragment tree instantiation
rphmeier Mar 7, 2022
b2f3350
remove outdated comment
rphmeier Mar 7, 2022
0a2fe27
add message/request types and skeleton for handling
rphmeier Mar 7, 2022
2c99751
fmt
rphmeier Mar 7, 2022
71b2853
implement handle_candidate_seconded
rphmeier Mar 7, 2022
a462fe7
candidate storage: handle backed
rphmeier Mar 7, 2022
b8e57a0
implement handle_candidate_backed
rphmeier Mar 7, 2022
55f5ba5
implement answer_get_backable_candidate
rphmeier Mar 7, 2022
4cf2a44
remove async where not needed
rphmeier Mar 7, 2022
5a108f2
implement fetch_ancestry
rphmeier Mar 7, 2022
4ae34c3
add logic for run_iteration
rphmeier Mar 7, 2022
843c79d
add some docs
rphmeier Mar 7, 2022
3a47b71
remove global allow(unused), fix warnings
rphmeier Mar 7, 2022
a938910
make spellcheck happy (despite English)
rphmeier Mar 7, 2022
5cad841
fmt
rphmeier Mar 7, 2022
bfaa6d9
Merge branch 'rh-async-backing-feature' into rh-async-backing-prediction
rphmeier Mar 9, 2022
60a4498
Merge branch 'master' into rh-async-backing-prediction
rphmeier Apr 5, 2022
2a0e0f0
bump Cargo.lock
rphmeier Apr 5, 2022
5519a74
Merge branch 'rh-async-backing-feature' into rh-async-backing-prediction
rphmeier Apr 5, 2022
777a3e8
replace tracing with gum
rphmeier Apr 15, 2022
3c5a5d6
introduce PopulateFrom trait
rphmeier Apr 16, 2022
519238c
implement GetHypotheticalDepths
rphmeier Apr 18, 2022
a7fe08c
revise docs slightly
rphmeier Apr 18, 2022
9123ee4
first fragment tree scope test
rphmeier Apr 18, 2022
e89fc3a
more scope tests
rphmeier Apr 18, 2022
9714b6c
test add_candidate
rphmeier Apr 18, 2022
d0dcdb0
fmt
rphmeier Apr 18, 2022
1cf2d8a
test retain
rphmeier Apr 18, 2022
f338eec
refactor test code
rphmeier Apr 19, 2022
1da9150
test populate is recursive
rphmeier Apr 19, 2022
ff8136a
test contiguity of depth 0 is maintained
rphmeier Apr 19, 2022
a45a567
add_and_populate tests
rphmeier Apr 19, 2022
d9f5d3a
cycle tests
rphmeier Apr 19, 2022
c2306ca
remove PopulateFrom trait
rphmeier Apr 19, 2022
8bfdca8
fmt
rphmeier Apr 19, 2022
f237bb6
test hypothetical depths (non-recursive)
rphmeier Apr 19, 2022
745975a
Merge branch 'rh-async-backing-feature' into rh-async-backing-prediction
rphmeier Apr 20, 2022
1dc948b
have CandidateSeconded return membership
rphmeier Apr 20, 2022
9db46eb
tree membership requests
rphmeier Apr 20, 2022
7568d06
Add a ProspectiveParachainsSubsystem struct
rphmeier Apr 20, 2022
d1d240c
add a staging API for base constraints
rphmeier Apr 20, 2022
f7b3f88
add a `From` impl
rphmeier Apr 20, 2022
092f88e
add runtime API for staging_validity_constraints
rphmeier Apr 20, 2022
4519a78
implement fetch_base_constraints
rphmeier Apr 20, 2022
f4cc8f1
implement `fetch_upcoming_paras`
rphmeier Apr 20, 2022
703e9d6
remove reconstruction of candidate receipt; no obvious usecase
rphmeier Apr 20, 2022
20bbbb0
fmt
rphmeier Apr 20, 2022
5228304
export message to broader module
rphmeier Apr 20, 2022
d58e53d
remove last TODO
rphmeier Apr 20, 2022
0c99437
correctly export
rphmeier Apr 20, 2022
abec501
fix compilation and add GetMinimumRelayParent request
rphmeier Apr 21, 2022
4bd03ca
Merge branch 'rh-async-backing-feature' into rh-async-backing-prediction
rphmeier Apr 27, 2022
6f61835
Merge branch 'rh-async-backing-feature' into rh-async-backing-prediction
rphmeier May 18, 2022
8a7f1d9
make provisioner into a real subsystem with proper mesage bounds
rphmeier May 18, 2022
8f62772
fmt
rphmeier May 18, 2022
801c62c
fix ChannelsOut in overseer test
rphmeier May 18, 2022
25d0979
fix overseer tests
rphmeier May 18, 2022
16612b9
fix again
rphmeier May 18, 2022
5024060
fmt
rphmeier May 18, 2022
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
479 changes: 270 additions & 209 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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
26 changes: 26 additions & 0 deletions node/core/prospective-parachains/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "polkadot-node-core-prospective-parachains"
version = "0.9.16"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"

[dependencies]
futures = "0.3.19"
gum = { package = "tracing-gum", path = "../../gum" }
parity-scale-codec = "2"
thiserror = "1.0.30"
fatality = "0.0.6"
bitvec = "1"

polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }

[dev-dependencies]
assert_matches = "1"
polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" }

[features]
# If not enabled, the dispute coordinator will do nothing.
disputes = []
83 changes: 83 additions & 0 deletions node/core/prospective-parachains/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright 2022 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Error types.

use futures::channel::oneshot;

use polkadot_node_subsystem::{
errors::{ChainApiError, RuntimeApiError},
SubsystemError,
};

use crate::LOG_TARGET;
use fatality::Nested;

#[allow(missing_docs)]
#[fatality::fatality(splitable)]
pub enum Error {
#[fatal]
#[error("SubsystemError::Context error: {0}")]
SubsystemContext(String),

#[fatal]
#[error("Spawning a task failed: {0}")]
SpawnFailed(SubsystemError),

#[fatal]
#[error("Participation worker receiver exhausted.")]
ParticipationWorkerReceiverExhausted,

#[fatal]
#[error("Receiving message from overseer failed: {0}")]
SubsystemReceive(#[source] SubsystemError),

#[error(transparent)]
RuntimeApi(#[from] RuntimeApiError),

#[error(transparent)]
ChainApi(#[from] ChainApiError),

#[error(transparent)]
Subsystem(SubsystemError),

#[error("Request to chain API subsystem dropped")]
ChainApiRequestCanceled(oneshot::Canceled),

#[error("Request to runtime API subsystem dropped")]
RuntimeApiRequestCanceled(oneshot::Canceled),
}

/// General `Result` type.
pub type Result<R> = std::result::Result<R, Error>;
/// Result for non-fatal only failures.
pub type JfyiErrorResult<T> = std::result::Result<T, JfyiError>;
/// Result for fatal only failures.
pub type FatalResult<T> = std::result::Result<T, FatalError>;

/// Utility for eating top level errors and log them.
///
/// We basically always want to try and continue on error. This utility function is meant to
/// consume top-level errors by simply logging them
pub fn log_error(result: Result<()>, ctx: &'static str) -> FatalResult<()> {
match result.into_nested()? {
Ok(()) => Ok(()),
Err(jfyi) => {
gum::debug!(target: LOG_TARGET, error = ?jfyi, ctx);
Ok(())
},
}
}
Loading