mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
Add block number to activated leaves and associated fixes (#2718)
* add number to `ActivatedLeavesUpdate` * update subsystem util and overseer * use new ActivatedLeaf everywhere * sort view * sorted and limited view in network bridge * use live block hash only if it's newer * grumples
This commit is contained in:
committed by
GitHub
parent
a4ed8aaab2
commit
064df81ee4
@@ -591,7 +591,8 @@ async fn handle_from_overseer(
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(update)) => {
|
||||
let mut actions = Vec::new();
|
||||
|
||||
for (head, _span) in update.activated {
|
||||
for activated in update.activated {
|
||||
let head = activated.hash;
|
||||
match import::handle_new_head(
|
||||
ctx,
|
||||
state,
|
||||
|
||||
@@ -551,9 +551,9 @@ where
|
||||
FromOverseer::Signal(OverseerSignal::ActiveLeaves(
|
||||
ActiveLeavesUpdate { activated, .. })
|
||||
) => {
|
||||
for (activated, _span) in activated.into_iter() {
|
||||
for activated in activated.into_iter() {
|
||||
let _timer = subsystem.metrics.time_block_activated();
|
||||
process_block_activated(ctx, subsystem, activated).await?;
|
||||
process_block_activated(ctx, subsystem, activated.hash).await?;
|
||||
}
|
||||
}
|
||||
FromOverseer::Signal(OverseerSignal::BlockFinalized(hash, number)) => {
|
||||
|
||||
@@ -31,7 +31,7 @@ use polkadot_primitives::v1::{
|
||||
};
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_subsystem::{
|
||||
ActiveLeavesUpdate, errors::RuntimeApiError, jaeger, messages::AllMessages,
|
||||
ActiveLeavesUpdate, errors::RuntimeApiError, jaeger, messages::AllMessages, ActivatedLeaf,
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
@@ -240,7 +240,11 @@ fn runtime_api_error_does_not_stop_the_subsystem() {
|
||||
overseer_signal(
|
||||
&mut virtual_overseer,
|
||||
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated: vec![(new_leaf, Arc::new(jaeger::Span::Disabled))].into(),
|
||||
activated: vec![ActivatedLeaf {
|
||||
hash: new_leaf,
|
||||
number: 1,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
}].into(),
|
||||
deactivated: vec![].into(),
|
||||
}),
|
||||
).await;
|
||||
@@ -885,7 +889,11 @@ async fn import_leaf(
|
||||
overseer_signal(
|
||||
virtual_overseer,
|
||||
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated: vec![(new_leaf, Arc::new(jaeger::Span::Disabled))].into(),
|
||||
activated: vec![ActivatedLeaf {
|
||||
hash: new_leaf,
|
||||
number: 1,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
}].into(),
|
||||
deactivated: vec![].into(),
|
||||
}),
|
||||
).await;
|
||||
|
||||
@@ -1249,7 +1249,7 @@ mod tests {
|
||||
use polkadot_primitives::v1::{BlockData, GroupRotationInfo, HeadData, PersistedValidationData, ScheduledCore};
|
||||
use polkadot_subsystem::{
|
||||
messages::{RuntimeApiRequest, RuntimeApiMessage},
|
||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal,
|
||||
ActiveLeavesUpdate, FromOverseer, OverseerSignal, ActivatedLeaf,
|
||||
};
|
||||
use polkadot_node_primitives::InvalidCandidate;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
@@ -1428,10 +1428,11 @@ mod tests {
|
||||
) {
|
||||
// Start work on some new parent.
|
||||
virtual_overseer.send(FromOverseer::Signal(
|
||||
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
|
||||
test_state.relay_parent,
|
||||
Arc::new(jaeger::Span::Disabled),
|
||||
)))
|
||||
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
|
||||
hash: test_state.relay_parent,
|
||||
number: 1,
|
||||
span: Arc::new(jaeger::Span::Disabled),
|
||||
})))
|
||||
).await;
|
||||
|
||||
// Check that subsystem job issues a request for a validator set.
|
||||
|
||||
Reference in New Issue
Block a user