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

Commit

Permalink
State can be finished due to Share message. (#3070)
Browse files Browse the repository at this point in the history
* State can be finished due to `Share` message.

Therefoe a task can still be running in that state. Removed panic and
changed state name to reflect possibility of `Share` message.

* bump spec versions in kusama, polkadot and westend again III

* properly bump for the upcoming release

Co-authored-by: Andronik Ordian <write@reusable.software>
  • Loading branch information
eskimor and ordian committed May 21, 2021
1 parent bd83612 commit 94b79d0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
27 changes: 17 additions & 10 deletions node/network/statement-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,8 @@ enum LargeStatementStatus {
/// We are currently fetching the statement data from a remote peer. We keep a list of other nodes
/// claiming to have that data and will fallback on them.
Fetching(FetchingInfo),
/// Statement data is fetched
Fetched(CommittedCandidateReceipt),
/// Statement data is fetched or we got it locally via `StatementDistributionMessage::Share`.
FetchedOrShared(CommittedCandidateReceipt),
}

/// Info about a fetch in progress.
Expand Down Expand Up @@ -1167,7 +1167,7 @@ async fn retrieve_statement_from_message<'a>(
}
}
}
LargeStatementStatus::Fetched(committed) => {
LargeStatementStatus::FetchedOrShared(committed) => {
match message {
protocol_v1::StatementDistributionMessage::Statement(_, s) => {
// We can now immediately return any statements (should only be
Expand Down Expand Up @@ -1654,7 +1654,7 @@ impl StatementDistribution {
.ok_or(NonFatal::NoSuchHead(relay_parent))?;

let committed = match active_head.waiting_large_statements.get(&candidate_hash) {
Some(LargeStatementStatus::Fetched(committed)) => committed.clone(),
Some(LargeStatementStatus::FetchedOrShared(committed)) => committed.clone(),
_ => {
return Err(
NonFatal::NoSuchFetchedLargeStatement(relay_parent, candidate_hash)
Expand Down Expand Up @@ -1699,8 +1699,9 @@ impl StatementDistribution {

let info = match status {
Some(LargeStatementStatus::Fetching(info)) => info,
Some(LargeStatementStatus::Fetched(_)) => {
panic!("On status fetched, fetching task already succeeded. qed.");
Some(LargeStatementStatus::FetchedOrShared(_)) => {
// We are no longer interested in the data.
return Ok(())
}
None => {
return Err(
Expand All @@ -1711,7 +1712,7 @@ impl StatementDistribution {

active_head.waiting_large_statements.insert(
candidate_hash,
LargeStatementStatus::Fetched(response),
LargeStatementStatus::FetchedOrShared(response),
);

// Cache is now populated, send all messages:
Expand Down Expand Up @@ -1755,8 +1756,14 @@ impl StatementDistribution {

let info = match status {
Some(LargeStatementStatus::Fetching(info)) => info,
Some(LargeStatementStatus::Fetched(_)) =>
panic!("On status fetched, fetching task already succeeded. qed."),
Some(LargeStatementStatus::FetchedOrShared(_)) => {
// This task is going to die soon - no need to send it anything.
tracing::debug!(
target: LOG_TARGET,
"Zombie task wanted more peers."
);
return Ok(())
}
None => {
return Err(
NonFatal::NoSuchLargeStatementStatus(relay_parent, candidate_hash)
Expand Down Expand Up @@ -1845,7 +1852,7 @@ impl StatementDistribution {
.ok_or(NonFatal::NoSuchHead(relay_parent))?;
active_head.waiting_large_statements.insert(
statement.payload().candidate_hash(),
LargeStatementStatus::Fetched(committed.clone())
LargeStatementStatus::FetchedOrShared(committed.clone())
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2,
spec_version: 9020,
spec_version: 9030,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
Expand Down
2 changes: 1 addition & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("polkadot"),
impl_name: create_runtime_str!("parity-polkadot"),
authoring_version: 0,
spec_version: 9020,
spec_version: 9030,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
Expand Down
2 changes: 1 addition & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("westend"),
impl_name: create_runtime_str!("parity-westend"),
authoring_version: 2,
spec_version: 9020,
spec_version: 9030,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
Expand Down

0 comments on commit 94b79d0

Please sign in to comment.