mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Reversion Safety tools for overseer and subsystems (#3104)
* guide: reversion safety * guide: manage reversion safety in subsystems * add leaf status to ActivatedLeaf * add an LRU-cache to overseer for staleness detection * update ActivatedLeaf usages in tests to contain status field * add variant where missed accidentally * add some helpers to LeafStatus * address grumbles
This commit is contained in:
committed by
GitHub
parent
6b166a7a1f
commit
963993d288
@@ -903,7 +903,7 @@ async fn circulate_statement_and_dependents(
|
||||
|
||||
fn statement_message(relay_parent: Hash, statement: SignedFullStatement)
|
||||
-> protocol_v1::ValidationProtocol
|
||||
{
|
||||
{
|
||||
let msg = if is_statement_large(&statement) {
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(
|
||||
StatementMetadata {
|
||||
@@ -1198,7 +1198,7 @@ async fn retrieve_statement_from_message<'a>(
|
||||
).await {
|
||||
vacant.insert(new_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
protocol_v1::StatementDistributionMessage::Statement(_, s) => {
|
||||
// No fetch in progress, safe to return any statement immediately (we don't bother
|
||||
// about normal network jitter which might cause `Valid` statements to arrive early
|
||||
@@ -1594,7 +1594,7 @@ impl StatementDistribution {
|
||||
match result {
|
||||
Ok(true) => break,
|
||||
Ok(false) => {}
|
||||
Err(Error(Fault::Fatal(f))) => return Err(f),
|
||||
Err(Error(Fault::Fatal(f))) => return Err(f),
|
||||
Err(Error(Fault::Err(error))) =>
|
||||
tracing::debug!(target: LOG_TARGET, ?error)
|
||||
}
|
||||
@@ -2072,7 +2072,9 @@ mod tests {
|
||||
use sp_keystore::{CryptoStore, SyncCryptoStorePtr, SyncCryptoStore};
|
||||
use sc_keystore::LocalKeystore;
|
||||
use polkadot_node_network_protocol::{view, ObservedRole, request_response::Recipient};
|
||||
use polkadot_subsystem::{jaeger, ActivatedLeaf, messages::{RuntimeApiMessage, RuntimeApiRequest}};
|
||||
use polkadot_subsystem::{
|
||||
jaeger, ActivatedLeaf, messages::{RuntimeApiMessage, RuntimeApiRequest}, LeafStatus,
|
||||
};
|
||||
use polkadot_node_network_protocol::request_response::{
|
||||
Requests,
|
||||
v1::{
|
||||
@@ -2690,6 +2692,7 @@ mod tests {
|
||||
activated: vec![ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
status: LeafStatus::Fresh,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
}].into(),
|
||||
deactivated: vec![].into(),
|
||||
@@ -2865,6 +2868,7 @@ mod tests {
|
||||
activated: vec![ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
status: LeafStatus::Fresh,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
}].into(),
|
||||
deactivated: vec![].into(),
|
||||
@@ -3336,6 +3340,7 @@ mod tests {
|
||||
activated: vec![ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
status: LeafStatus::Fresh,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
}].into(),
|
||||
deactivated: vec![].into(),
|
||||
@@ -3591,6 +3596,7 @@ mod tests {
|
||||
activated: vec![ActivatedLeaf {
|
||||
hash: hash_a,
|
||||
number: 1,
|
||||
status: LeafStatus::Fresh,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
}].into(),
|
||||
deactivated: vec![].into(),
|
||||
@@ -3634,7 +3640,7 @@ mod tests {
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a])
|
||||
)
|
||||
}).await;
|
||||
|
||||
|
||||
// receive a seconded statement from peer A.
|
||||
let statement = {
|
||||
let signing_context = SigningContext {
|
||||
|
||||
Reference in New Issue
Block a user