Initial: Offchain Workers (#1942)

* Refactor state-machine stuff.

* Fix tests.

* WiP

* WiP2

* Service support for offchain workers.

* Service support for offchain workers.

* Testing offchain worker.

* Initial version working.

* Pass side effects in call.

* Pass OffchainExt in context.

* Submit extrinsics to the pool.

* Support inherents.

* Insert to inherents pool.

* Inserting to the pool asynchronously.

* Add test to offchain worker.

* Implement convenience syntax for modules.

* Dispatching offchain worker through executive.

* Fix offchain test.

* Remove offchain worker from timestamp.

* Update Cargo.lock.

* Address review comments.

* Use latest patch version for futures.

* Add CLI parameter for offchain worker.

* Fix compilation.

* Fix test.

* Fix extrinsics format for tests.

* Fix RPC test.

* Bump spec version.

* Fix executive.

* Fix support macro.

* Address grumbles.

* Bump runtime
This commit is contained in:
Tomasz Drwięga
2019-03-25 23:22:11 +01:00
committed by Gav Wood
parent 3ee0e69463
commit e2f5e40876
58 changed files with 1158 additions and 178 deletions
+1
View File
@@ -12,6 +12,7 @@ substrate-primitives = { path = "../../core/primitives", default-features = fals
client = { package = "substrate-client", path = "../../core/client", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
offchain-primitives = { package = "substrate-offchain-primitives", path = "../../core/offchain/primitives", default-features = false }
version = { package = "sr-version", path = "../../core/sr-version", default-features = false }
support = { package = "srml-support", path = "../../srml/support", default-features = false }
aura = { package = "srml-aura", path = "../../srml/aura", default-features = false }
+8 -2
View File
@@ -58,8 +58,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("node"),
impl_name: create_runtime_str!("substrate-node"),
authoring_version: 10,
spec_version: 42,
impl_version: 42,
spec_version: 43,
impl_version: 43,
apis: RUNTIME_API_VERSIONS,
};
@@ -288,6 +288,12 @@ impl_runtime_apis! {
}
}
impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
fn offchain_worker(number: NumberFor<Block>) {
Executive::offchain_worker(number)
}
}
impl fg_primitives::GrandpaApi<Block> for Runtime {
fn grandpa_pending_change(digest: &DigestFor<Block>)
-> Option<ScheduledChange<NumberFor<Block>>>
+9
View File
@@ -1297,6 +1297,7 @@ dependencies = [
"substrate-client 0.1.0",
"substrate-consensus-aura-primitives 0.1.0",
"substrate-keyring 0.1.0",
"substrate-offchain-primitives 0.1.0",
"substrate-primitives 0.1.0",
]
@@ -2666,6 +2667,14 @@ dependencies = [
"substrate-primitives 0.1.0",
]
[[package]]
name = "substrate-offchain-primitives"
version = "0.1.0"
dependencies = [
"sr-primitives 0.1.0",
"substrate-client 0.1.0",
]
[[package]]
name = "substrate-panic-handler"
version = "0.1.0"