mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +00:00
Move inherents to primitives (#4126)
* Split Aura and Timestamp inherents out of paint * fixup node depedencies * move babe inherents to primitives * move authorship inherents into primitives * Move finalty tracker inherents into primitives * fix aura primitives import
This commit is contained in:
committed by
GitHub
parent
5979a8c3e5
commit
303843f483
@@ -27,7 +27,7 @@ runtime_version = { package = "sr-version", path = "../../../primitives/sr-versi
|
||||
slots = { package = "substrate-consensus-slots", path = "../slots" }
|
||||
sr-api = { path = "../../../primitives/sr-api" }
|
||||
sr-primitives = { path = "../../../primitives/sr-primitives" }
|
||||
paint-aura = { path = "../../../paint/aura" }
|
||||
sp-timestamp = { path = "../../../primitives/timestamp" }
|
||||
substrate-telemetry = { path = "../../telemetry" }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -56,10 +56,10 @@ use futures::prelude::*;
|
||||
use parking_lot::Mutex;
|
||||
use log::{debug, info, trace};
|
||||
|
||||
use paint_aura::{
|
||||
InherentType as AuraInherent, AuraInherentData,
|
||||
timestamp::{TimestampInherentData, InherentType as TimestampInherent, InherentError as TIError}
|
||||
use sp_timestamp::{
|
||||
TimestampInherentData, InherentType as TimestampInherent, InherentError as TIError
|
||||
};
|
||||
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_TRACE, CONSENSUS_DEBUG, CONSENSUS_INFO};
|
||||
|
||||
use slots::{CheckedHeader, SlotData, SlotWorker, SlotInfo, SlotCompatible};
|
||||
@@ -69,7 +69,13 @@ use keystore::KeyStorePtr;
|
||||
|
||||
use sr_api::ApiExt;
|
||||
|
||||
pub use aura_primitives::*;
|
||||
pub use aura_primitives::{
|
||||
ConsensusLog, AuraApi, AURA_ENGINE_ID,
|
||||
inherents::{
|
||||
InherentType as AuraInherent,
|
||||
AuraInherentData, INHERENT_IDENTIFIER, InherentDataProvider,
|
||||
},
|
||||
};
|
||||
pub use consensus_common::SyncOracle;
|
||||
pub use digest::CompatibleDigestItem;
|
||||
|
||||
@@ -654,9 +660,9 @@ fn register_aura_inherent_data_provider(
|
||||
inherent_data_providers: &InherentDataProviders,
|
||||
slot_duration: u64,
|
||||
) -> Result<(), consensus_common::Error> {
|
||||
if !inherent_data_providers.has_provider(&paint_aura::INHERENT_IDENTIFIER) {
|
||||
if !inherent_data_providers.has_provider(&INHERENT_IDENTIFIER) {
|
||||
inherent_data_providers
|
||||
.register_provider(paint_aura::InherentDataProvider::new(slot_duration))
|
||||
.register_provider(InherentDataProvider::new(slot_duration))
|
||||
.map_err(Into::into)
|
||||
.map_err(consensus_common::Error::InherentData)
|
||||
} else {
|
||||
|
||||
@@ -16,9 +16,9 @@ num-traits = "0.2.8"
|
||||
runtime-version = { package = "sr-version", path = "../../../primitives/sr-version" }
|
||||
runtime-io = { package = "sr-io", path = "../../../primitives/sr-io" }
|
||||
inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" }
|
||||
sp-timestamp = { path = "../../../primitives/timestamp" }
|
||||
substrate-telemetry = { path = "../../telemetry" }
|
||||
keystore = { package = "substrate-keystore", path = "../../keystore" }
|
||||
paint-babe = { path = "../../../paint/babe" }
|
||||
client-api = { package = "substrate-client-api", path = "../../api" }
|
||||
client = { package = "substrate-client", path = "../../" }
|
||||
sr-api = { path = "../../../primitives/sr-api" }
|
||||
|
||||
@@ -58,7 +58,10 @@
|
||||
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(missing_docs)]
|
||||
pub use babe_primitives::*;
|
||||
pub use babe_primitives::{
|
||||
BabeApi, ConsensusLog, BABE_ENGINE_ID, BabePreDigest, SlotNumber, BabeConfiguration,
|
||||
CompatibleDigestItem,
|
||||
};
|
||||
pub use consensus_common::SyncOracle;
|
||||
use std::{collections::HashMap, sync::Arc, u64, pin::Pin, time::{Instant, Duration}};
|
||||
use babe_primitives;
|
||||
@@ -80,10 +83,8 @@ use consensus_common::{
|
||||
self, BlockImport, Environment, Proposer, BlockCheckParams,
|
||||
ForkChoiceStrategy, BlockImportParams, BlockOrigin, Error as ConsensusError,
|
||||
};
|
||||
use paint_babe::{
|
||||
BabeInherentData,
|
||||
timestamp::{TimestampInherentData, InherentType as TimestampInherent}
|
||||
};
|
||||
use babe_primitives::inherents::BabeInherentData;
|
||||
use sp_timestamp::{TimestampInherentData, InherentType as TimestampInherent};
|
||||
use consensus_common::SelectChain;
|
||||
use consensus_common::import_queue::{Verifier, BasicQueue, CacheKeyId};
|
||||
use client_api::{
|
||||
@@ -771,9 +772,9 @@ fn register_babe_inherent_data_provider(
|
||||
slot_duration: u64,
|
||||
) -> Result<(), consensus_common::Error> {
|
||||
debug!(target: "babe", "Registering");
|
||||
if !inherent_data_providers.has_provider(&paint_babe::INHERENT_IDENTIFIER) {
|
||||
if !inherent_data_providers.has_provider(&babe_primitives::inherents::INHERENT_IDENTIFIER) {
|
||||
inherent_data_providers
|
||||
.register_provider(paint_babe::InherentDataProvider::new(slot_duration))
|
||||
.register_provider(babe_primitives::inherents::InherentDataProvider::new(slot_duration))
|
||||
.map_err(Into::into)
|
||||
.map_err(consensus_common::Error::InherentData)
|
||||
} else {
|
||||
|
||||
@@ -11,10 +11,10 @@ primitives = { package = "substrate-primitives", path = "../../../primitives/cor
|
||||
sr-primitives = { path = "../../../primitives/sr-primitives" }
|
||||
client-api = { package = "substrate-client-api", path = "../../api" }
|
||||
block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../../primitives/block-builder/runtime-api" }
|
||||
paint-timestamp = { path = "../../../paint/timestamp" }
|
||||
inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" }
|
||||
pow-primitives = { package = "substrate-consensus-pow-primitives", path = "../../../primitives/consensus/pow" }
|
||||
consensus-common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" }
|
||||
log = "0.4.8"
|
||||
futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] }
|
||||
sp-timestamp = { path = "../../../primitives/timestamp" }
|
||||
derive_more = "0.15.0"
|
||||
|
||||
@@ -40,7 +40,7 @@ use block_builder_api::BlockBuilder as BlockBuilderApi;
|
||||
use sr_primitives::{Justification, RuntimeString};
|
||||
use sr_primitives::generic::{BlockId, Digest, DigestItem};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, ProvideRuntimeApi};
|
||||
use paint_timestamp::{TimestampInherentData, InherentError as TIError};
|
||||
use sp_timestamp::{TimestampInherentData, InherentError as TIError};
|
||||
use pow_primitives::{Seal, TotalDifficulty, POW_ENGINE_ID};
|
||||
use primitives::H256;
|
||||
use inherents::{InherentDataProviders, InherentData};
|
||||
@@ -316,9 +316,9 @@ impl<B: BlockT<Hash=H256>, C, S, Algorithm> Verifier<B> for PowVerifier<B, C, S,
|
||||
pub fn register_pow_inherent_data_provider(
|
||||
inherent_data_providers: &InherentDataProviders,
|
||||
) -> Result<(), consensus_common::Error> {
|
||||
if !inherent_data_providers.has_provider(&paint_timestamp::INHERENT_IDENTIFIER) {
|
||||
if !inherent_data_providers.has_provider(&sp_timestamp::INHERENT_IDENTIFIER) {
|
||||
inherent_data_providers
|
||||
.register_provider(paint_timestamp::InherentDataProvider)
|
||||
.register_provider(sp_timestamp::InherentDataProvider)
|
||||
.map_err(Into::into)
|
||||
.map_err(consensus_common::Error::InherentData)
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,7 @@ edition = "2018"
|
||||
client-api = { package = "substrate-client-api", path = "../../api" }
|
||||
primitives = { package = "substrate-primitives", path = "../../../primitives/core" }
|
||||
sr-primitives = { path = "../../../primitives/sr-primitives" }
|
||||
paint-authorship = { path = "../../../paint/authorship" }
|
||||
sp-authorship = { path = "../../../primitives/authorship" }
|
||||
consensus_common = { package = "substrate-consensus-common", path = "../../../primitives/consensus/common" }
|
||||
inherents = { package = "substrate-inherents", path = "../../../primitives/inherents" }
|
||||
log = "0.4.8"
|
||||
|
||||
@@ -25,6 +25,7 @@ use log::warn;
|
||||
use client_api::ProvideUncles;
|
||||
use sr_primitives::traits::{Block as BlockT, Header};
|
||||
use std::sync::Arc;
|
||||
use sp_authorship;
|
||||
|
||||
/// Maximum uncles generations we may provide to the runtime.
|
||||
const MAX_UNCLE_GENERATIONS: u32 = 8;
|
||||
@@ -39,9 +40,9 @@ pub fn register_uncles_inherent_data_provider<B, C, SC>(
|
||||
C: ProvideUncles<B> + Send + Sync + 'static,
|
||||
SC: SelectChain<B> + 'static,
|
||||
{
|
||||
if !inherent_data_providers.has_provider(&paint_authorship::INHERENT_IDENTIFIER) {
|
||||
if !inherent_data_providers.has_provider(&sp_authorship::INHERENT_IDENTIFIER) {
|
||||
inherent_data_providers
|
||||
.register_provider(paint_authorship::InherentDataProvider::new(move || {
|
||||
.register_provider(sp_authorship::InherentDataProvider::new(move || {
|
||||
{
|
||||
let chain_head = match select_chain.best_chain() {
|
||||
Ok(x) => x,
|
||||
|
||||
@@ -25,7 +25,7 @@ client = { package = "substrate-client", path = "../" }
|
||||
header-metadata = { package = "substrate-header-metadata", path = "../header-metadata" }
|
||||
inherents = { package = "substrate-inherents", path = "../../primitives/inherents" }
|
||||
network = { package = "substrate-network", path = "../network" }
|
||||
paint-finality-tracker = { path = "../../paint/finality-tracker" }
|
||||
sp-finality-tracker = { path = "../../primitives/finality-tracker" }
|
||||
fg_primitives = { package = "substrate-finality-grandpa-primitives", path = "../../primitives/finality-grandpa" }
|
||||
grandpa = { package = "finality-grandpa", version = "0.9.0", features = ["derive-codec"] }
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ use primitives::{H256, Blake2Hasher, Pair};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_INFO, CONSENSUS_DEBUG, CONSENSUS_WARN};
|
||||
use serde_json;
|
||||
|
||||
use paint_finality_tracker;
|
||||
use sp_finality_tracker;
|
||||
|
||||
use grandpa::Error as GrandpaError;
|
||||
use grandpa::{voter, BlockNumberOps, voter_set::VoterSet};
|
||||
@@ -505,9 +505,9 @@ fn register_finality_tracker_inherent_data_provider<B, E, Block: BlockT<Hash=H25
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
RA: Send + Sync + 'static,
|
||||
{
|
||||
if !inherent_data_providers.has_provider(&paint_finality_tracker::INHERENT_IDENTIFIER) {
|
||||
if !inherent_data_providers.has_provider(&sp_finality_tracker::INHERENT_IDENTIFIER) {
|
||||
inherent_data_providers
|
||||
.register_provider(paint_finality_tracker::InherentDataProvider::new(move || {
|
||||
.register_provider(sp_finality_tracker::InherentDataProvider::new(move || {
|
||||
#[allow(deprecated)]
|
||||
{
|
||||
let info = client.info().chain;
|
||||
|
||||
Reference in New Issue
Block a user