mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 09:31:02 +00:00
cargo +nightly fmt (#3540)
* cargo +nightly fmt * add cargo-fmt check to ci * update ci * fmt * fmt * skip macro * ignore bridges
This commit is contained in:
@@ -14,55 +14,48 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::{
|
||||
Error,
|
||||
Registry,
|
||||
IsCollator,
|
||||
Block,
|
||||
SpawnNamed,
|
||||
Hash,
|
||||
AuthorityDiscoveryApi,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use super::{AuthorityDiscoveryApi, Block, Error, Hash, IsCollator, Registry, SpawnNamed};
|
||||
use polkadot_network_bridge::RequestMultiplexer;
|
||||
use polkadot_node_core_av_store::Config as AvailabilityConfig;
|
||||
use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig;
|
||||
use polkadot_node_core_av_store::Config as AvailabilityConfig;
|
||||
use polkadot_node_core_candidate_validation::Config as CandidateValidationConfig;
|
||||
use polkadot_node_core_chain_selection::Config as ChainSelectionConfig;
|
||||
use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig;
|
||||
use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandle};
|
||||
use polkadot_primitives::v1::ParachainHost;
|
||||
use sc_authority_discovery::Service as AuthorityDiscoveryService;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sc_client_api::AuxStore;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_consensus_babe::BabeApi;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use polkadot_availability_distribution::AvailabilityDistributionSubsystem;
|
||||
pub use polkadot_node_core_av_store::AvailabilityStoreSubsystem;
|
||||
pub use polkadot_approval_distribution::ApprovalDistribution as ApprovalDistributionSubsystem;
|
||||
pub use polkadot_availability_bitfield_distribution::BitfieldDistribution as BitfieldDistributionSubsystem;
|
||||
pub use polkadot_node_core_bitfield_signing::BitfieldSigningSubsystem;
|
||||
pub use polkadot_availability_distribution::AvailabilityDistributionSubsystem;
|
||||
pub use polkadot_availability_recovery::AvailabilityRecoverySubsystem;
|
||||
pub use polkadot_collator_protocol::{CollatorProtocolSubsystem, ProtocolSide};
|
||||
pub use polkadot_dispute_distribution::DisputeDistributionSubsystem;
|
||||
pub use polkadot_gossip_support::GossipSupport as GossipSupportSubsystem;
|
||||
pub use polkadot_network_bridge::NetworkBridge as NetworkBridgeSubsystem;
|
||||
pub use polkadot_node_collation_generation::CollationGenerationSubsystem;
|
||||
pub use polkadot_node_core_approval_voting::ApprovalVotingSubsystem;
|
||||
pub use polkadot_node_core_av_store::AvailabilityStoreSubsystem;
|
||||
pub use polkadot_node_core_backing::CandidateBackingSubsystem;
|
||||
pub use polkadot_node_core_bitfield_signing::BitfieldSigningSubsystem;
|
||||
pub use polkadot_node_core_candidate_validation::CandidateValidationSubsystem;
|
||||
pub use polkadot_node_core_chain_api::ChainApiSubsystem;
|
||||
pub use polkadot_node_collation_generation::CollationGenerationSubsystem;
|
||||
pub use polkadot_collator_protocol::{CollatorProtocolSubsystem, ProtocolSide};
|
||||
pub use polkadot_network_bridge::NetworkBridge as NetworkBridgeSubsystem;
|
||||
pub use polkadot_node_core_chain_selection::ChainSelectionSubsystem;
|
||||
pub use polkadot_node_core_dispute_coordinator::DisputeCoordinatorSubsystem;
|
||||
pub use polkadot_node_core_dispute_participation::DisputeParticipationSubsystem;
|
||||
pub use polkadot_node_core_provisioner::ProvisioningSubsystem as ProvisionerSubsystem;
|
||||
pub use polkadot_node_core_runtime_api::RuntimeApiSubsystem;
|
||||
pub use polkadot_statement_distribution::StatementDistribution as StatementDistributionSubsystem;
|
||||
pub use polkadot_availability_recovery::AvailabilityRecoverySubsystem;
|
||||
pub use polkadot_approval_distribution::ApprovalDistribution as ApprovalDistributionSubsystem;
|
||||
pub use polkadot_node_core_approval_voting::ApprovalVotingSubsystem;
|
||||
pub use polkadot_gossip_support::GossipSupport as GossipSupportSubsystem;
|
||||
pub use polkadot_node_core_dispute_coordinator::DisputeCoordinatorSubsystem;
|
||||
pub use polkadot_node_core_dispute_participation::DisputeParticipationSubsystem;
|
||||
pub use polkadot_dispute_distribution::DisputeDistributionSubsystem;
|
||||
pub use polkadot_node_core_chain_selection::ChainSelectionSubsystem;
|
||||
|
||||
/// Arguments passed for overseer construction.
|
||||
pub struct OverseerGenArgs<'a, Spawner, RuntimeClient> where
|
||||
pub struct OverseerGenArgs<'a, Spawner, RuntimeClient>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin,
|
||||
@@ -103,8 +96,7 @@ pub struct OverseerGenArgs<'a, Spawner, RuntimeClient> where
|
||||
///
|
||||
/// A convenience for usage with malus, to avoid
|
||||
/// repetitive code across multiple behavior strain implementations.
|
||||
pub fn create_default_subsystems<'a, Spawner, RuntimeClient>
|
||||
(
|
||||
pub fn create_default_subsystems<'a, Spawner, RuntimeClient>(
|
||||
OverseerGenArgs {
|
||||
keystore,
|
||||
runtime_client,
|
||||
@@ -121,37 +113,40 @@ pub fn create_default_subsystems<'a, Spawner, RuntimeClient>
|
||||
chain_selection_config,
|
||||
dispute_coordinator_config,
|
||||
..
|
||||
} : OverseerGenArgs<'a, Spawner, RuntimeClient>
|
||||
}: OverseerGenArgs<'a, Spawner, RuntimeClient>,
|
||||
) -> Result<
|
||||
AllSubsystems<
|
||||
CandidateValidationSubsystem,
|
||||
CandidateBackingSubsystem<Spawner>,
|
||||
StatementDistributionSubsystem,
|
||||
AvailabilityDistributionSubsystem,
|
||||
AvailabilityRecoverySubsystem,
|
||||
BitfieldSigningSubsystem<Spawner>,
|
||||
BitfieldDistributionSubsystem,
|
||||
ProvisionerSubsystem<Spawner>,
|
||||
RuntimeApiSubsystem<RuntimeClient>,
|
||||
AvailabilityStoreSubsystem,
|
||||
NetworkBridgeSubsystem<Arc<sc_network::NetworkService<Block, Hash>>, AuthorityDiscoveryService>,
|
||||
ChainApiSubsystem<RuntimeClient>,
|
||||
CollationGenerationSubsystem,
|
||||
CollatorProtocolSubsystem,
|
||||
ApprovalDistributionSubsystem,
|
||||
ApprovalVotingSubsystem,
|
||||
GossipSupportSubsystem,
|
||||
DisputeCoordinatorSubsystem,
|
||||
DisputeParticipationSubsystem,
|
||||
DisputeDistributionSubsystem<AuthorityDiscoveryService>,
|
||||
ChainSelectionSubsystem,
|
||||
>,
|
||||
Error
|
||||
CandidateValidationSubsystem,
|
||||
CandidateBackingSubsystem<Spawner>,
|
||||
StatementDistributionSubsystem,
|
||||
AvailabilityDistributionSubsystem,
|
||||
AvailabilityRecoverySubsystem,
|
||||
BitfieldSigningSubsystem<Spawner>,
|
||||
BitfieldDistributionSubsystem,
|
||||
ProvisionerSubsystem<Spawner>,
|
||||
RuntimeApiSubsystem<RuntimeClient>,
|
||||
AvailabilityStoreSubsystem,
|
||||
NetworkBridgeSubsystem<
|
||||
Arc<sc_network::NetworkService<Block, Hash>>,
|
||||
AuthorityDiscoveryService,
|
||||
>,
|
||||
ChainApiSubsystem<RuntimeClient>,
|
||||
CollationGenerationSubsystem,
|
||||
CollatorProtocolSubsystem,
|
||||
ApprovalDistributionSubsystem,
|
||||
ApprovalVotingSubsystem,
|
||||
GossipSupportSubsystem,
|
||||
DisputeCoordinatorSubsystem,
|
||||
DisputeParticipationSubsystem,
|
||||
DisputeDistributionSubsystem<AuthorityDiscoveryService>,
|
||||
ChainSelectionSubsystem,
|
||||
>,
|
||||
Error,
|
||||
>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin,
|
||||
{
|
||||
use polkadot_node_subsystem_util::metrics::Metrics;
|
||||
|
||||
@@ -160,16 +155,13 @@ where
|
||||
keystore.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
availability_recovery: AvailabilityRecoverySubsystem::with_chunks_only(
|
||||
),
|
||||
availability_recovery: AvailabilityRecoverySubsystem::with_chunks_only(),
|
||||
availability_store: AvailabilityStoreSubsystem::new(
|
||||
parachains_db.clone(),
|
||||
availability_config,
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
bitfield_distribution: BitfieldDistributionSubsystem::new(
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
bitfield_distribution: BitfieldDistributionSubsystem::new(Metrics::register(registry)?),
|
||||
bitfield_signing: BitfieldSigningSubsystem::new(
|
||||
spawner.clone(),
|
||||
keystore.clone(),
|
||||
@@ -184,13 +176,8 @@ where
|
||||
candidate_validation_config,
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
chain_api: ChainApiSubsystem::new(
|
||||
runtime_client.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
collation_generation: CollationGenerationSubsystem::new(
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
chain_api: ChainApiSubsystem::new(runtime_client.clone(), Metrics::register(registry)?),
|
||||
collation_generation: CollationGenerationSubsystem::new(Metrics::register(registry)?),
|
||||
collator_protocol: {
|
||||
let side = match is_collator {
|
||||
IsCollator::Yes(collator_pair) => ProtocolSide::Collator(
|
||||
@@ -204,9 +191,7 @@ where
|
||||
metrics: Metrics::register(registry)?,
|
||||
},
|
||||
};
|
||||
CollatorProtocolSubsystem::new(
|
||||
side,
|
||||
)
|
||||
CollatorProtocolSubsystem::new(side)
|
||||
},
|
||||
network_bridge: NetworkBridgeSubsystem::new(
|
||||
network_service.clone(),
|
||||
@@ -215,11 +200,7 @@ where
|
||||
Box::new(network_service.clone()),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
provisioner: ProvisionerSubsystem::new(
|
||||
spawner.clone(),
|
||||
(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
provisioner: ProvisionerSubsystem::new(spawner.clone(), (), Metrics::register(registry)?),
|
||||
runtime_api: RuntimeApiSubsystem::new(
|
||||
runtime_client.clone(),
|
||||
Metrics::register(registry)?,
|
||||
@@ -229,9 +210,7 @@ where
|
||||
keystore.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
approval_distribution: ApprovalDistributionSubsystem::new(
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
approval_distribution: ApprovalDistributionSubsystem::new(Metrics::register(registry)?),
|
||||
approval_voting: ApprovalVotingSubsystem::with_config(
|
||||
approval_voting_config,
|
||||
parachains_db.clone(),
|
||||
@@ -239,9 +218,7 @@ where
|
||||
Box::new(network_service.clone()),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
gossip_support: GossipSupportSubsystem::new(
|
||||
keystore.clone(),
|
||||
),
|
||||
gossip_support: GossipSupportSubsystem::new(keystore.clone()),
|
||||
dispute_coordinator: DisputeCoordinatorSubsystem::new(
|
||||
parachains_db.clone(),
|
||||
dispute_coordinator_config,
|
||||
@@ -253,26 +230,26 @@ where
|
||||
authority_discovery_service.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
chain_selection: ChainSelectionSubsystem::new(
|
||||
chain_selection_config,
|
||||
parachains_db,
|
||||
),
|
||||
chain_selection: ChainSelectionSubsystem::new(chain_selection_config, parachains_db),
|
||||
};
|
||||
Ok(all_subsystems)
|
||||
}
|
||||
|
||||
|
||||
/// Trait for the `fn` generating the overseer.
|
||||
///
|
||||
/// Default behavior is to create an unmodified overseer, as `RealOverseerGen`
|
||||
/// would do.
|
||||
pub trait OverseerGen {
|
||||
/// Overwrite the full generation of the overseer, including the subsystems.
|
||||
fn generate<'a, Spawner, RuntimeClient>(&self, args: OverseerGenArgs<'a, Spawner, RuntimeClient>) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
fn generate<'a, Spawner, RuntimeClient>(
|
||||
&self,
|
||||
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin {
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin,
|
||||
{
|
||||
let gen = RealOverseerGen;
|
||||
RealOverseerGen::generate::<Spawner, RuntimeClient>(&gen, args)
|
||||
}
|
||||
@@ -285,13 +262,14 @@ pub trait OverseerGen {
|
||||
pub struct RealOverseerGen;
|
||||
|
||||
impl OverseerGen for RealOverseerGen {
|
||||
fn generate<'a, Spawner, RuntimeClient>(&self,
|
||||
args : OverseerGenArgs<'a, Spawner, RuntimeClient>
|
||||
fn generate<'a, Spawner, RuntimeClient>(
|
||||
&self,
|
||||
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin,
|
||||
{
|
||||
let spawner = args.spawner.clone();
|
||||
let leaves = args.leaves.clone();
|
||||
@@ -300,12 +278,7 @@ impl OverseerGen for RealOverseerGen {
|
||||
|
||||
let all_subsystems = create_default_subsystems::<Spawner, RuntimeClient>(args)?;
|
||||
|
||||
Overseer::new(
|
||||
leaves,
|
||||
all_subsystems,
|
||||
registry,
|
||||
runtime_client,
|
||||
spawner,
|
||||
).map_err(|e| e.into())
|
||||
Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner)
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user