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:
Benjamin Kampmann
2019-11-20 12:18:36 +01:00
committed by GitHub
parent 5979a8c3e5
commit 303843f483
38 changed files with 654 additions and 404 deletions
+2 -2
View File
@@ -39,6 +39,7 @@ babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../
grandpa_primitives = { package = "substrate-finality-grandpa-primitives", path = "../../../primitives/finality-grandpa" }
primitives = { package = "substrate-primitives", path = "../../../primitives/core" }
sr-primitives = { path = "../../../primitives/sr-primitives" }
sp-timestamp = { path = "../../../primitives/timestamp", default-features = false }
# core dependencies
runtime-io = { package = "sr-io", path = "../../../primitives/sr-io" }
@@ -62,7 +63,7 @@ authority-discovery = { package = "substrate-authority-discovery", path = "../..
# paint dependencies
indices = { package = "paint-indices", path = "../../../paint/indices" }
timestamp = { package = "paint-timestamp", path = "../../../paint/timestamp", default-features = false }
finality_tracker = { package = "paint-finality-tracker", path = "../../../paint/finality-tracker", default-features = false }
sp-finality-tracker = { path = "../../../primitives/finality-tracker", default-features = false }
contracts = { package = "paint-contracts", path = "../../../paint/contracts" }
system = { package = "paint-system", path = "../../../paint/system" }
balances = { package = "paint-balances", path = "../../../paint/balances" }
@@ -71,7 +72,6 @@ support = { package = "paint-support", path = "../../../paint/support", default-
im_online = { package = "paint-im-online", path = "../../../paint/im-online", default-features = false }
sr-authority-discovery = { package = "paint-authority-discovery", path = "../../../paint/authority-discovery"}
# node-specific dependencies
node-runtime = { path = "../runtime" }
node-rpc = { path = "../rpc" }
+4 -4
View File
@@ -35,8 +35,8 @@ use sr_primitives::{
use transaction_factory::RuntimeAdapter;
use transaction_factory::modes::Mode;
use inherents::InherentData;
use timestamp;
use finality_tracker;
use sp_timestamp;
use sp_finality_tracker;
type AccountPublic = <Signature as Verify>::Signer;
@@ -160,9 +160,9 @@ impl RuntimeAdapter for FactoryState<Number> {
let timestamp = (self.block_no as u64 + 1) * MinimumPeriod::get();
let mut inherent = InherentData::new();
inherent.put_data(timestamp::INHERENT_IDENTIFIER, &timestamp)
inherent.put_data(sp_timestamp::INHERENT_IDENTIFIER, &timestamp)
.expect("Failed putting timestamp inherent");
inherent.put_data(finality_tracker::INHERENT_IDENTIFIER, &self.block_no)
inherent.put_data(sp_finality_tracker::INHERENT_IDENTIFIER, &self.block_no)
.expect("Failed putting finalized number inherent");
inherent
}
+4 -4
View File
@@ -370,8 +370,8 @@ mod tests {
traits::Verify,
OpaqueExtrinsic,
};
use timestamp;
use finality_tracker;
use sp_timestamp;
use sp_finality_tracker;
use keyring::AccountKeyring;
use substrate_service::{AbstractService, Roles};
use crate::service::new_full;
@@ -484,7 +484,7 @@ mod tests {
let mut inherent_data = inherent_data_providers
.create_inherent_data()
.expect("Creates inherent data.");
inherent_data.replace_data(finality_tracker::INHERENT_IDENTIFIER, &1u64);
inherent_data.replace_data(sp_finality_tracker::INHERENT_IDENTIFIER, &1u64);
let parent_id = BlockId::number(service.client().info().chain.best_number);
let parent_header = service.client().header(&parent_id).unwrap().unwrap();
@@ -498,7 +498,7 @@ mod tests {
// even though there's only one authority some slots might be empty,
// so we must keep trying the next slots until we can claim one.
let babe_pre_digest = loop {
inherent_data.replace_data(timestamp::INHERENT_IDENTIFIER, &(slot_num * SLOT_DURATION));
inherent_data.replace_data(sp_timestamp::INHERENT_IDENTIFIER, &(slot_num * SLOT_DURATION));
if let Some(babe_pre_digest) = babe::test_helpers::claim_slot(
slot_num,
&parent_header,