mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
frame: remove finality-tracker (#7228)
* frame: remove finality-tracker * node: remove unused parameter types * node: bump spec_version
This commit is contained in:
@@ -40,7 +40,6 @@ sp-inherents = { version = "2.0.0", path = "../../primitives/inherents" }
|
||||
sp-blockchain = { version = "2.0.0", path = "../../primitives/blockchain" }
|
||||
sc-network = { version = "0.8.0", path = "../network" }
|
||||
sc-network-gossip = { version = "0.8.0", path = "../network-gossip" }
|
||||
sp-finality-tracker = { version = "2.0.0", path = "../../primitives/finality-tracker" }
|
||||
sp-finality-grandpa = { version = "2.0.0", path = "../../primitives/finality-grandpa" }
|
||||
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0"}
|
||||
sc-block-builder = { version = "0.8.0", path = "../block-builder" }
|
||||
|
||||
@@ -1157,9 +1157,9 @@ where
|
||||
let status = client.info();
|
||||
|
||||
if number <= status.finalized_number && client.hash(number)? == Some(hash) {
|
||||
// This can happen after a forced change (triggered by the finality tracker when finality is stalled), since
|
||||
// the voter will be restarted at the median last finalized block, which can be lower than the local best
|
||||
// finalized block.
|
||||
// This can happen after a forced change (triggered manually from the runtime when
|
||||
// finality is stalled), since the voter will be restarted at the median last finalized
|
||||
// block, which can be lower than the local best finalized block.
|
||||
warn!(target: "afg", "Re-finalized block #{:?} ({:?}) in the canonical chain, current best finalized is #{:?}",
|
||||
hash,
|
||||
number,
|
||||
|
||||
@@ -72,7 +72,6 @@ use sp_api::ProvideRuntimeApi;
|
||||
use sp_blockchain::{HeaderBackend, Error as ClientError, HeaderMetadata};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sp_runtime::traits::{NumberFor, Block as BlockT, DigestFor, Zero};
|
||||
use sp_inherents::InherentDataProviders;
|
||||
use sp_consensus::{SelectChain, BlockImport};
|
||||
use sp_core::{
|
||||
crypto::Public,
|
||||
@@ -650,33 +649,6 @@ fn global_communication<BE, Block: BlockT, C, N>(
|
||||
(global_in, global_out)
|
||||
}
|
||||
|
||||
/// Register the finality tracker inherent data provider (which is used by
|
||||
/// GRANDPA), if not registered already.
|
||||
fn register_finality_tracker_inherent_data_provider<Block: BlockT, Client>(
|
||||
client: Arc<Client>,
|
||||
inherent_data_providers: &InherentDataProviders,
|
||||
) -> Result<(), sp_consensus::Error> where
|
||||
Client: HeaderBackend<Block> + 'static,
|
||||
{
|
||||
if !inherent_data_providers.has_provider(&sp_finality_tracker::INHERENT_IDENTIFIER) {
|
||||
inherent_data_providers
|
||||
.register_provider(sp_finality_tracker::InherentDataProvider::new(move || {
|
||||
#[allow(deprecated)]
|
||||
{
|
||||
let info = client.info();
|
||||
telemetry!(CONSENSUS_INFO; "afg.finalized";
|
||||
"finalized_number" => ?info.finalized_number,
|
||||
"finalized_hash" => ?info.finalized_hash,
|
||||
);
|
||||
Ok(info.finalized_number)
|
||||
}
|
||||
}))
|
||||
.map_err(|err| sp_consensus::Error::InherentData(err))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Parameters used to run Grandpa.
|
||||
pub struct GrandpaParams<Block: BlockT, C, N, SC, VR> {
|
||||
/// Configuration for the GRANDPA service.
|
||||
@@ -685,8 +657,6 @@ pub struct GrandpaParams<Block: BlockT, C, N, SC, VR> {
|
||||
pub link: LinkHalf<Block, C, SC>,
|
||||
/// The Network instance.
|
||||
pub network: N,
|
||||
/// The inherent data providers.
|
||||
pub inherent_data_providers: InherentDataProviders,
|
||||
/// If supplied, can be used to hook on telemetry connection established events.
|
||||
pub telemetry_on_connect: Option<TracingUnboundedReceiver<()>>,
|
||||
/// A voting rule used to potentially restrict target votes.
|
||||
@@ -716,7 +686,6 @@ pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR>(
|
||||
mut config,
|
||||
link,
|
||||
network,
|
||||
inherent_data_providers,
|
||||
telemetry_on_connect,
|
||||
voting_rule,
|
||||
prometheus_registry,
|
||||
@@ -745,8 +714,6 @@ pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR>(
|
||||
prometheus_registry.as_ref(),
|
||||
);
|
||||
|
||||
register_finality_tracker_inherent_data_provider(client.clone(), &inherent_data_providers)?;
|
||||
|
||||
let conf = config.clone();
|
||||
let telemetry_task = if let Some(telemetry_on_connect) = telemetry_on_connect {
|
||||
let authorities = persistent_data.authority_set.clone();
|
||||
@@ -1096,19 +1063,10 @@ where
|
||||
/// discards all GRANDPA messages (otherwise, we end up banning nodes that send
|
||||
/// us a `Neighbor` message, since there is no registered gossip validator for
|
||||
/// the engine id defined in the message.)
|
||||
pub fn setup_disabled_grandpa<Block: BlockT, Client, N>(
|
||||
client: Arc<Client>,
|
||||
inherent_data_providers: &InherentDataProviders,
|
||||
network: N,
|
||||
) -> Result<(), sp_consensus::Error> where
|
||||
pub fn setup_disabled_grandpa<Block: BlockT, N>(network: N) -> Result<(), sp_consensus::Error>
|
||||
where
|
||||
N: NetworkT<Block> + Send + Clone + 'static,
|
||||
Client: HeaderBackend<Block> + 'static,
|
||||
{
|
||||
register_finality_tracker_inherent_data_provider(
|
||||
client,
|
||||
inherent_data_providers,
|
||||
)?;
|
||||
|
||||
// We register the GRANDPA protocol so that we don't consider it an anomaly
|
||||
// to receive GRANDPA messages on the network. We don't process the
|
||||
// messages.
|
||||
|
||||
@@ -371,7 +371,6 @@ fn run_to_completion_with<F>(
|
||||
},
|
||||
link: link,
|
||||
network: net_service,
|
||||
inherent_data_providers: InherentDataProviders::new(),
|
||||
telemetry_on_connect: None,
|
||||
voting_rule: (),
|
||||
prometheus_registry: None,
|
||||
@@ -503,7 +502,6 @@ fn finalize_3_voters_1_full_observer() {
|
||||
},
|
||||
link: link,
|
||||
network: net_service,
|
||||
inherent_data_providers: InherentDataProviders::new(),
|
||||
telemetry_on_connect: None,
|
||||
voting_rule: (),
|
||||
prometheus_registry: None,
|
||||
@@ -667,7 +665,6 @@ fn transition_3_voters_twice_1_full_observer() {
|
||||
},
|
||||
link: link,
|
||||
network: net_service,
|
||||
inherent_data_providers: InherentDataProviders::new(),
|
||||
telemetry_on_connect: None,
|
||||
voting_rule: (),
|
||||
prometheus_registry: None,
|
||||
@@ -1092,7 +1089,6 @@ fn voter_persists_its_votes() {
|
||||
},
|
||||
link,
|
||||
network: this.net.lock().peers[0].network_service().clone(),
|
||||
inherent_data_providers: InherentDataProviders::new(),
|
||||
telemetry_on_connect: None,
|
||||
voting_rule: VotingRulesBuilder::default().build(),
|
||||
prometheus_registry: None,
|
||||
@@ -1438,7 +1434,6 @@ fn voter_catches_up_to_latest_round_when_behind() {
|
||||
},
|
||||
link,
|
||||
network: net.lock().peer(peer_id).network_service().clone(),
|
||||
inherent_data_providers: InherentDataProviders::new(),
|
||||
telemetry_on_connect: None,
|
||||
voting_rule: (),
|
||||
prometheus_registry: None,
|
||||
|
||||
Reference in New Issue
Block a user