Move grandpa crates to consensus folder (#13458)

* Move grandpa under consensus dir
* Rename grandpa folder
* Finish grandpa renaming
* Minor tweaks
* Cargo fmt
* Adjust path to chain spec
This commit is contained in:
Davide Galassi
2023-02-27 17:15:08 +01:00
committed by GitHub
parent 91c595bc78
commit 40c36c0c8a
62 changed files with 356 additions and 356 deletions
+11 -11
View File
@@ -3,8 +3,8 @@
use node_template_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::BlockBackend;
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
use sc_consensus_grandpa::SharedVoterState;
pub use sc_executor::NativeElseWasmExecutor;
use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams};
use sc_telemetry::{Telemetry, TelemetryWorker};
@@ -46,13 +46,13 @@ pub fn new_partial(
sc_consensus::DefaultImportQueue<Block, FullClient>,
sc_transaction_pool::FullPool<Block, FullClient>,
(
sc_finality_grandpa::GrandpaBlockImport<
sc_consensus_grandpa::GrandpaBlockImport<
FullBackend,
Block,
FullClient,
FullSelectChain,
>,
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
sc_consensus_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
Option<Telemetry>,
),
>,
@@ -103,7 +103,7 @@ pub fn new_partial(
client.clone(),
);
let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import(
client.clone(),
&(client.clone() as Arc<_>),
select_chain.clone(),
@@ -177,7 +177,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
))),
};
}
let grandpa_protocol_name = sc_finality_grandpa::protocol_standard_name(
let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name(
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
&config.chain_spec,
);
@@ -185,8 +185,8 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
config
.network
.extra_sets
.push(sc_finality_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
.push(sc_consensus_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));
let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
Vec::default(),
@@ -298,7 +298,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let keystore =
if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };
let grandpa_config = sc_finality_grandpa::Config {
let grandpa_config = sc_consensus_grandpa::Config {
// FIXME #1578 make this available through chainspec
gossip_duration: Duration::from_millis(333),
justification_period: 512,
@@ -316,11 +316,11 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
// and vote data availability than the observer. The observer has not
// been tested extensively yet and having most nodes in a network run it
// could lead to finality stalls.
let grandpa_config = sc_finality_grandpa::GrandpaParams {
let grandpa_config = sc_consensus_grandpa::GrandpaParams {
config: grandpa_config,
link: grandpa_link,
network,
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
voting_rule: sc_consensus_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry,
shared_voter_state: SharedVoterState::empty(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
@@ -331,7 +331,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
task_manager.spawn_essential_handle().spawn_blocking(
"grandpa-voter",
None,
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
sc_consensus_grandpa::run_grandpa_voter(grandpa_config)?,
);
}