Move authorities interface from Core to consensus (#1412)

* Move authorities interface from Core to consensus

f

* notify all caches of block insert + create with up-to-date best_fin

* merged authorities_are_cached from light_grandpa_import2

* Add ProvideCache trait

* Create helper function for 'get_cache'

* Fix some formatting

* Bump impl version

* Resolve wasm conflicts

* Apply review comments

* Use try_for_each

* Move authorities interface from Core to consensus

f

* notify all caches of block insert + create with up-to-date best_fin

* merged authorities_are_cached from light_grandpa_import2

* Add ProvideCache trait

* Create helper function for 'get_cache'

* Fix some formatting

* Bump impl version

* Resolve wasm conflicts

* Apply review comments

* Use try_for_each

* Move authorities interface from Core to consensus

f

* notify all caches of block insert + create with up-to-date best_fin

* merged authorities_are_cached from light_grandpa_import2

* Add ProvideCache trait

* Create helper function for 'get_cache'

* Fix some formatting

* Bump impl version

* Resolve wasm conflicts

* Apply review comments

* Use try_for_each

* Increment impl_version

* Update lib.rs
This commit is contained in:
Stanislav Tkach
2019-03-29 18:41:22 +02:00
committed by Gav Wood
parent 55788fdf77
commit cbfc36b39f
44 changed files with 650 additions and 409 deletions
+1
View File
@@ -23,6 +23,7 @@ runtime_support = { package = "srml-support", path = "../../srml/support", defau
offchain-primitives = { package = "substrate-offchain-primitives", path = "../offchain/primitives", default-features = false}
executive = { package = "srml-executive", path = "../../srml/executive", default-features = false }
cfg-if = "0.1.6"
consensus_authorities = { package = "substrate-consensus-authorities", path = "../../core/consensus/authorities", default-features = false }
[dev-dependencies]
substrate-executor = { path = "../executor" }
+13 -9
View File
@@ -34,7 +34,7 @@ use runtime_primitives::{
create_runtime_str,
traits::{
BlindCheckable, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT,
GetNodeBlockType, GetRuntimeBlockType,
GetNodeBlockType, GetRuntimeBlockType, AuthorityIdFor,
},
};
use runtime_version::RuntimeVersion;
@@ -289,10 +289,6 @@ cfg_if! {
version()
}
fn authorities() -> Vec<AuthorityId> {
system::authorities()
}
fn execute_block(block: Block) {
system::execute_block(block)
}
@@ -386,6 +382,12 @@ cfg_if! {
runtime_io::submit_extrinsic(&ex)
}
}
impl consensus_authorities::AuthoritiesApi<Block> for Runtime {
fn authorities() -> Vec<AuthorityIdFor<Block>> {
crate::system::authorities()
}
}
}
} else {
impl_runtime_apis! {
@@ -394,10 +396,6 @@ cfg_if! {
version()
}
fn authorities() -> Vec<AuthorityId> {
system::authorities()
}
fn execute_block(block: Block) {
system::execute_block(block)
}
@@ -496,6 +494,12 @@ cfg_if! {
runtime_io::submit_extrinsic(&ex)
}
}
impl consensus_authorities::AuthoritiesApi<Block> for Runtime {
fn authorities() -> Vec<AuthorityIdFor<Block>> {
crate::system::authorities()
}
}
}
}
}
+15
View File
@@ -2284,6 +2284,20 @@ dependencies = [
"substrate-client 0.1.0",
]
[[package]]
name = "substrate-consensus-authorities"
version = "0.1.0"
dependencies = [
"parity-codec 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"sr-version 0.1.0",
"srml-support 0.1.0",
"substrate-client 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
name = "substrate-consensus-common"
version = "0.1.0"
@@ -2453,6 +2467,7 @@ dependencies = [
"srml-support 0.1.0",
"substrate-client 0.1.0",
"substrate-consensus-aura-primitives 0.1.0",
"substrate-consensus-authorities 0.1.0",
"substrate-inherents 0.1.0",
"substrate-keyring 0.1.0",
"substrate-offchain-primitives 0.1.0",