mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 19:01:08 +00:00
The great refactor (#325)
* Move pallets to pallets folder and rename them * Move genesis file to service * Rename primitives to primitives-core * Delete cumulus-runtime * Move stuff to client folder and rename
This commit is contained in:
Generated
+108
-130
@@ -1070,12 +1070,11 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-collator"
|
||||
name = "cumulus-client-collator"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-network",
|
||||
"cumulus-primitives",
|
||||
"cumulus-runtime",
|
||||
"cumulus-client-network",
|
||||
"cumulus-primitives-core",
|
||||
"cumulus-test-client",
|
||||
"cumulus-test-runtime",
|
||||
"env_logger",
|
||||
@@ -1106,7 +1105,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-consensus"
|
||||
name = "cumulus-client-consensus"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-test-client",
|
||||
@@ -1131,10 +1130,9 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-network"
|
||||
name = "cumulus-client-network"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives",
|
||||
"cumulus-test-service",
|
||||
"derive_more 0.99.11",
|
||||
"futures 0.3.12",
|
||||
@@ -1161,89 +1159,18 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-parachain-system"
|
||||
name = "cumulus-client-service"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives",
|
||||
"cumulus-runtime",
|
||||
"cumulus-test-relay-sproof-builder",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"hash-db",
|
||||
"hex-literal 0.2.1",
|
||||
"lazy_static",
|
||||
"pallet-balances",
|
||||
"parity-scale-codec",
|
||||
"polkadot-parachain",
|
||||
"serde",
|
||||
"sp-core",
|
||||
"sp-externalities",
|
||||
"sp-inherents",
|
||||
"sp-io",
|
||||
"sp-runtime",
|
||||
"sp-state-machine",
|
||||
"sp-std",
|
||||
"sp-trie",
|
||||
"sp-version",
|
||||
"substrate-test-runtime-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-primitives"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"impl-trait-for-tuples 0.1.3",
|
||||
"parity-scale-codec",
|
||||
"polkadot-core-primitives",
|
||||
"polkadot-parachain",
|
||||
"polkadot-primitives",
|
||||
"sc-chain-spec",
|
||||
"sp-core",
|
||||
"sp-inherents",
|
||||
"sp-runtime",
|
||||
"sp-std",
|
||||
"sp-trie",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-runtime"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives",
|
||||
"cumulus-test-client",
|
||||
"cumulus-test-relay-sproof-builder",
|
||||
"env_logger",
|
||||
"frame-executive",
|
||||
"hash-db",
|
||||
"memory-db",
|
||||
"parity-scale-codec",
|
||||
"polkadot-parachain",
|
||||
"sc-client-api",
|
||||
"sc-executor",
|
||||
"sp-blockchain",
|
||||
"sp-consensus",
|
||||
"sp-core",
|
||||
"sp-externalities",
|
||||
"sp-io",
|
||||
"sp-keyring",
|
||||
"sp-runtime",
|
||||
"sp-state-machine",
|
||||
"sp-std",
|
||||
"sp-trie",
|
||||
"trie-db",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-service"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-collator",
|
||||
"cumulus-consensus",
|
||||
"cumulus-primitives",
|
||||
"cumulus-client-collator",
|
||||
"cumulus-client-consensus",
|
||||
"cumulus-primitives-core",
|
||||
"futures 0.3.12",
|
||||
"parity-scale-codec",
|
||||
"polkadot-overseer",
|
||||
"polkadot-primitives",
|
||||
"polkadot-service",
|
||||
"sc-chain-spec",
|
||||
"sc-client-api",
|
||||
"sc-service",
|
||||
"sc-tracing",
|
||||
@@ -1256,11 +1183,76 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-pallet-parachain-system"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives-core",
|
||||
"cumulus-test-client",
|
||||
"cumulus-test-relay-sproof-builder",
|
||||
"env_logger",
|
||||
"frame-executive",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"hash-db",
|
||||
"hex-literal 0.2.1",
|
||||
"lazy_static",
|
||||
"memory-db",
|
||||
"pallet-balances",
|
||||
"parity-scale-codec",
|
||||
"polkadot-parachain",
|
||||
"sc-client-api",
|
||||
"sc-executor",
|
||||
"serde",
|
||||
"sp-blockchain",
|
||||
"sp-consensus",
|
||||
"sp-core",
|
||||
"sp-externalities",
|
||||
"sp-inherents",
|
||||
"sp-io",
|
||||
"sp-keyring",
|
||||
"sp-runtime",
|
||||
"sp-state-machine",
|
||||
"sp-std",
|
||||
"sp-trie",
|
||||
"sp-version",
|
||||
"substrate-test-runtime-client",
|
||||
"trie-db",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-pallet-xcm-handler"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives-core",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"parity-scale-codec",
|
||||
"sp-std",
|
||||
"xcm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-primitives-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"polkadot-core-primitives",
|
||||
"polkadot-parachain",
|
||||
"polkadot-primitives",
|
||||
"sp-core",
|
||||
"sp-inherents",
|
||||
"sp-runtime",
|
||||
"sp-std",
|
||||
"sp-trie",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-test-client"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives",
|
||||
"cumulus-primitives-core",
|
||||
"cumulus-test-relay-sproof-builder",
|
||||
"cumulus-test-runtime",
|
||||
"cumulus-test-service",
|
||||
@@ -1288,9 +1280,9 @@ dependencies = [
|
||||
name = "cumulus-test-parachain-runtime"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-parachain-system",
|
||||
"cumulus-primitives",
|
||||
"cumulus-runtime",
|
||||
"cumulus-pallet-parachain-system",
|
||||
"cumulus-pallet-xcm-handler",
|
||||
"cumulus-primitives-core",
|
||||
"frame-executive",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
@@ -1319,14 +1311,13 @@ dependencies = [
|
||||
"xcm",
|
||||
"xcm-builder",
|
||||
"xcm-executor",
|
||||
"xcm-handler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cumulus-test-relay-sproof-builder"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives",
|
||||
"cumulus-primitives-core",
|
||||
"parity-scale-codec",
|
||||
"polkadot-primitives",
|
||||
"sp-runtime",
|
||||
@@ -1338,9 +1329,8 @@ dependencies = [
|
||||
name = "cumulus-test-runtime"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-parachain-system",
|
||||
"cumulus-primitives",
|
||||
"cumulus-runtime",
|
||||
"cumulus-pallet-parachain-system",
|
||||
"cumulus-primitives-core",
|
||||
"frame-executive",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
@@ -1370,10 +1360,10 @@ dependencies = [
|
||||
name = "cumulus-test-service"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-consensus",
|
||||
"cumulus-network",
|
||||
"cumulus-primitives",
|
||||
"cumulus-service",
|
||||
"cumulus-client-consensus",
|
||||
"cumulus-client-network",
|
||||
"cumulus-client-service",
|
||||
"cumulus-primitives-core",
|
||||
"cumulus-test-runtime",
|
||||
"futures 0.3.12",
|
||||
"jsonrpc-core",
|
||||
@@ -1970,7 +1960,7 @@ dependencies = [
|
||||
"bitflags",
|
||||
"frame-metadata",
|
||||
"frame-support-procedural",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"log",
|
||||
"once_cell",
|
||||
"parity-scale-codec",
|
||||
@@ -2028,7 +2018,7 @@ version = "2.0.1"
|
||||
source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b14ca6235b4b916"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"serde",
|
||||
"sp-core",
|
||||
@@ -2780,9 +2770,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "impl-trait-for-tuples"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f65a8ecf74feeacdab8d38cb129e550ca871cccaa7d1921d8636ecd75534903"
|
||||
checksum = "d5dacb10c5b3bb92d46ba347505a9041e676bb20ad220101326bffb0c93031ee"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.8",
|
||||
@@ -4296,7 +4286,7 @@ source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"sp-authorship",
|
||||
"sp-inherents",
|
||||
@@ -4675,7 +4665,7 @@ dependencies = [
|
||||
"frame-benchmarking",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"serde",
|
||||
"sp-inherents",
|
||||
@@ -4749,7 +4739,7 @@ source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"pallet-balances",
|
||||
"parity-scale-codec",
|
||||
"serde",
|
||||
@@ -4790,7 +4780,7 @@ dependencies = [
|
||||
name = "parachain-info"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives",
|
||||
"cumulus-primitives-core",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"parity-scale-codec",
|
||||
@@ -4890,7 +4880,7 @@ dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"ethereum-types",
|
||||
"hashbrown",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"lru",
|
||||
"parity-util-mem-derive",
|
||||
"parking_lot 0.11.1",
|
||||
@@ -6888,11 +6878,11 @@ name = "rococo-collator"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"assert_cmd",
|
||||
"cumulus-collator",
|
||||
"cumulus-consensus",
|
||||
"cumulus-network",
|
||||
"cumulus-primitives",
|
||||
"cumulus-service",
|
||||
"cumulus-client-collator",
|
||||
"cumulus-client-consensus",
|
||||
"cumulus-client-network",
|
||||
"cumulus-client-service",
|
||||
"cumulus-primitives-core",
|
||||
"cumulus-test-parachain-runtime",
|
||||
"derive_more 0.15.0",
|
||||
"exit-future 0.1.4",
|
||||
@@ -7219,7 +7209,7 @@ name = "sc-chain-spec"
|
||||
version = "2.0.1"
|
||||
source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b14ca6235b4b916"
|
||||
dependencies = [
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"sc-chain-spec-derive",
|
||||
"sc-consensus-babe",
|
||||
@@ -8918,7 +8908,7 @@ source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b
|
||||
dependencies = [
|
||||
"either",
|
||||
"hash256-std-hasher",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"log",
|
||||
"parity-scale-codec",
|
||||
"parity-util-mem",
|
||||
@@ -8937,7 +8927,7 @@ name = "sp-runtime-interface"
|
||||
version = "2.0.1"
|
||||
source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b14ca6235b4b916"
|
||||
dependencies = [
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"primitive-types",
|
||||
"sp-externalities",
|
||||
@@ -9064,7 +9054,7 @@ name = "sp-timestamp"
|
||||
version = "2.0.1"
|
||||
source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b14ca6235b4b916"
|
||||
dependencies = [
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"sp-api",
|
||||
"sp-inherents",
|
||||
@@ -9145,7 +9135,7 @@ name = "sp-wasm-interface"
|
||||
version = "2.0.1"
|
||||
source = "git+https://github.com/paritytech/substrate#cc71cca1d3087bf62381a9d60b14ca6235b4b916"
|
||||
dependencies = [
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"sp-std",
|
||||
"wasmi",
|
||||
@@ -10096,7 +10086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"rand 0.3.23",
|
||||
"rand 0.7.3",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
@@ -10845,7 +10835,7 @@ version = "0.8.22"
|
||||
source = "git+https://github.com/paritytech/polkadot#e526a15b1fa9bb7ac5378541d9f32667618e18c4"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"impl-trait-for-tuples 0.2.0",
|
||||
"impl-trait-for-tuples 0.2.1",
|
||||
"parity-scale-codec",
|
||||
"sp-arithmetic",
|
||||
"sp-core",
|
||||
@@ -10855,18 +10845,6 @@ dependencies = [
|
||||
"xcm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xcm-handler"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cumulus-primitives",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"parity-scale-codec",
|
||||
"sp-std",
|
||||
"xcm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yamux"
|
||||
version = "0.8.0"
|
||||
|
||||
+7
-8
@@ -1,21 +1,20 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"consensus",
|
||||
"network",
|
||||
"parachain-system",
|
||||
"primitives",
|
||||
"client/consensus",
|
||||
"client/network",
|
||||
"client/service",
|
||||
"pallets/parachain-system",
|
||||
"pallets/xcm-handler",
|
||||
"primitives/core",
|
||||
"rococo-parachains/",
|
||||
"rococo-parachains/pallets/parachain-info",
|
||||
"rococo-parachains/primitives",
|
||||
"rococo-parachains/runtime",
|
||||
"runtime",
|
||||
"service",
|
||||
"test/runtime",
|
||||
"test/client",
|
||||
"test/service",
|
||||
"test/relay-sproof-builder",
|
||||
"xcm-handler",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
panic = 'unwind'
|
||||
panic = "unwind"
|
||||
|
||||
@@ -25,11 +25,6 @@ follow,
|
||||
[finalize](https://wiki.polkadot.network/docs/en/learn-consensus#probabilistic-vs-provable-finality),
|
||||
and treat as best.
|
||||
|
||||
## Runtime
|
||||
|
||||
The [`cumulus-runtime`](runtime) is wrapper around Substrate runtimes that provides parachain
|
||||
validation capabilities and proof-generation routines.
|
||||
|
||||
## Collator
|
||||
|
||||
A Polkadot [collator](https://wiki.polkadot.network/docs/en/learn-collator) for the parachain is
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "cumulus-collator"
|
||||
name = "cumulus-client-collator"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
@@ -25,9 +25,8 @@ polkadot-overseer = { git = "https://github.com/paritytech/polkadot", branch = "
|
||||
polkadot-node-subsystem = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-network = { path = "../network" }
|
||||
cumulus-primitives = { path = "../primitives" }
|
||||
cumulus-runtime = { path = "../runtime" }
|
||||
cumulus-client-network = { path = "../network" }
|
||||
cumulus-primitives-core = { path = "../../primitives/core" }
|
||||
|
||||
# Other dependencies
|
||||
log = "0.4.8"
|
||||
@@ -37,8 +36,8 @@ parking_lot = "0.9"
|
||||
|
||||
[dev-dependencies]
|
||||
# Cumulus dependencies
|
||||
cumulus-test-runtime = { path = "../test/runtime" }
|
||||
cumulus-test-client = { path = "../test/client" }
|
||||
cumulus-test-runtime = { path = "../../test/runtime" }
|
||||
cumulus-test-client = { path = "../../test/client" }
|
||||
|
||||
# Substrate dependencies
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
//! Cumulus Collator implementation for Substrate.
|
||||
|
||||
use cumulus_network::WaitToAnnounce;
|
||||
use cumulus_primitives::{
|
||||
inherents,
|
||||
use cumulus_client_network::WaitToAnnounce;
|
||||
use cumulus_primitives_core::{
|
||||
inherents, ParachainBlockData,
|
||||
well_known_keys, InboundDownwardMessage, InboundHrmpMessage, OutboundHrmpMessage,
|
||||
PersistedValidationData, relay_chain,
|
||||
};
|
||||
use cumulus_runtime::ParachainBlockData;
|
||||
|
||||
use sc_client_api::{BlockBackend, StateBackend};
|
||||
use sp_consensus::{
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "cumulus-consensus"
|
||||
name = "cumulus-client-consensus"
|
||||
description = "Proxy Polkadot's consensus as a consensus engine for Substrate"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
@@ -32,8 +32,8 @@ tracing = "0.1.22"
|
||||
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-test-runtime = { path = "../test/runtime" }
|
||||
cumulus-test-client = { path = "../test/client" }
|
||||
cumulus-test-runtime = { path = "../../test/runtime" }
|
||||
cumulus-test-client = { path = "../../test/client" }
|
||||
|
||||
# Other deps
|
||||
futures-timer = "3.0.2"
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "cumulus-network"
|
||||
name = "cumulus-client-network"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
description = "Cumulus-specific networking protocol"
|
||||
@@ -23,9 +23,6 @@ polkadot-node-subsystem = { git = "https://github.com/paritytech/polkadot", bran
|
||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
|
||||
# Cumulus deps
|
||||
cumulus-primitives = { path = "../primitives" }
|
||||
|
||||
# other deps
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ] }
|
||||
futures = { version = "0.3.1", features = ["compat"] }
|
||||
@@ -36,7 +33,7 @@ derive_more = "0.99.2"
|
||||
|
||||
[dev-dependencies]
|
||||
# Cumulus deps
|
||||
cumulus-test-service = { path = "../test/service" }
|
||||
cumulus-test-service = { path = "../../test/service" }
|
||||
|
||||
# Polkadot deps
|
||||
polkadot-test-client = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
@@ -1,18 +1,19 @@
|
||||
[package]
|
||||
name = "cumulus-service"
|
||||
name = "cumulus-client-service"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
# Cumulus dependencies
|
||||
cumulus-consensus = { path = "../consensus" }
|
||||
cumulus-collator = { path = "../collator" }
|
||||
cumulus-primitives = { path = "../primitives" }
|
||||
cumulus-client-consensus = { path = "../consensus" }
|
||||
cumulus-client-collator = { path = "../collator" }
|
||||
cumulus-primitives-core = { path = "../../primitives/core" }
|
||||
|
||||
# Substrate dependencies
|
||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
@@ -29,3 +30,4 @@ polkadot-overseer = { git = "https://github.com/paritytech/polkadot", branch = "
|
||||
# Other deps
|
||||
futures = "0.3.6"
|
||||
tracing = "0.1.22"
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0" }
|
||||
@@ -18,7 +18,7 @@ use codec::Encode;
|
||||
use sc_chain_spec::ChainSpec;
|
||||
use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, Zero};
|
||||
|
||||
/// Generate the genesis state for a given ChainSpec.
|
||||
/// Generate the genesis block from a given ChainSpec.
|
||||
pub fn generate_genesis_block<Block: BlockT>(
|
||||
chain_spec: &Box<dyn ChainSpec>,
|
||||
) -> Result<Block, String> {
|
||||
@@ -18,7 +18,7 @@
|
||||
//!
|
||||
//! Provides functions for starting a collator node or a normal full node.
|
||||
|
||||
use cumulus_primitives::ParaId;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use futures::{Future, FutureExt};
|
||||
use polkadot_overseer::OverseerHandler;
|
||||
use polkadot_primitives::v1::{Block as PBlock, CollatorId, CollatorPair};
|
||||
@@ -34,6 +34,8 @@ use sp_inherents::InherentDataProviders;
|
||||
use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
pub mod genesis;
|
||||
|
||||
/// Polkadot full node handles.
|
||||
type PFullNode<C> = polkadot_service::NewFull<C>;
|
||||
|
||||
@@ -188,7 +190,7 @@ where
|
||||
PClient: AbstractClient<PBlock, PBackend, Api = Api> + 'static,
|
||||
{
|
||||
async move {
|
||||
cumulus_collator::start_collator(cumulus_collator::StartCollatorParams {
|
||||
cumulus_client_collator::start_collator(cumulus_client_collator::StartCollatorParams {
|
||||
proposer_factory: self.proposer_factory,
|
||||
inherent_data_providers: self.inherent_data_providers,
|
||||
backend: self.backend,
|
||||
@@ -289,7 +291,7 @@ where
|
||||
Api: RuntimeApiCollection<StateBackend = PBackend::State>,
|
||||
PClient: AbstractClient<PBlock, PBackend, Api = Api> + 'static,
|
||||
{
|
||||
let consensus = cumulus_consensus::run_parachain_consensus(
|
||||
let consensus = cumulus_client_consensus::run_parachain_consensus(
|
||||
self.para_id,
|
||||
self.client,
|
||||
client,
|
||||
@@ -13,7 +13,7 @@ messages of other Parachains.
|
||||
To convert a Substrate runtime into a Parachain runtime, the following code needs to be added to the
|
||||
runtime:
|
||||
```rust
|
||||
cumulus_runtime::register_validate_block!(Block, Executive);
|
||||
cumulus_pallet_parachain_system::register_validate_block!(Block, Executive);
|
||||
```
|
||||
|
||||
This macro call expects the `Block` and `Executive` type. It generates the `validate_block` function
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
[package]
|
||||
name = "cumulus-parachain-system"
|
||||
name = "cumulus-pallet-parachain-system"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
description = "pallet to manage parachain upgrades"
|
||||
description = "Base pallet for cumulus-based parachains"
|
||||
|
||||
[dependencies]
|
||||
# Cumulus dependencies
|
||||
cumulus-primitives = { path = "../primitives", default-features = false }
|
||||
cumulus-runtime = { path = "../runtime", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||
|
||||
# Polkadot dependencies
|
||||
parachain = { package = "polkadot-parachain", git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, features = [ "wasm-api" ], branch = "master" }
|
||||
|
||||
# Substrate dependencies
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
@@ -23,37 +22,50 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-state-machine = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-externalities = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Other Dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"]}
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
hash-db = { version = "0.15.2", default-features = false }
|
||||
memory-db = { version = "0.26.0", default-features = false }
|
||||
trie-db = { version = "0.22.0", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
sp-externalities = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
cumulus-test-relay-sproof-builder = { path = "../test/relay-sproof-builder" }
|
||||
cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder" }
|
||||
hex-literal = "0.2.1"
|
||||
lazy_static = "1.4"
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
cumulus-test-client = { path = "../../test/client" }
|
||||
env_logger = "0.7.1"
|
||||
|
||||
[features]
|
||||
default = ['std']
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
'serde',
|
||||
'codec/std',
|
||||
'frame-support/std',
|
||||
'pallet-balances/std',
|
||||
'cumulus-runtime/std',
|
||||
'sp-core/std',
|
||||
'sp-runtime/std',
|
||||
'sp-io/std',
|
||||
'sp-std/std',
|
||||
'hash-db/std',
|
||||
'sp-state-machine/std',
|
||||
'sp-trie/std',
|
||||
'frame-system/std',
|
||||
'cumulus-primitives/std',
|
||||
"serde",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"pallet-balances/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-io/std",
|
||||
"sp-std/std",
|
||||
"hash-db/std",
|
||||
"memory-db/std",
|
||||
"trie-db/std",
|
||||
"sp-state-machine/std",
|
||||
"sp-trie/std",
|
||||
"sp-externalities/std",
|
||||
"frame-system/std",
|
||||
"frame-executive/std",
|
||||
"cumulus-primitives-core/std",
|
||||
]
|
||||
+102
-110
@@ -16,7 +16,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
//! parachain-system is a base module for cumulus-based parachains.
|
||||
//! cumulus-pallet-parachain-system is a base module for cumulus-based parachains.
|
||||
//!
|
||||
//! This module handles low-level details of being a parachain. It's responsibilities include:
|
||||
//!
|
||||
@@ -27,7 +27,7 @@
|
||||
//!
|
||||
//! Users must ensure that they register this pallet as an inherent provider.
|
||||
|
||||
use cumulus_primitives::{
|
||||
use cumulus_primitives_core::{
|
||||
inherents::{SystemInherentData, SYSTEM_INHERENT_IDENTIFIER},
|
||||
relay_chain,
|
||||
well_known_keys::{self, NEW_VALIDATION_CODE, VALIDATION_DATA},
|
||||
@@ -43,13 +43,15 @@ use frame_support::{
|
||||
weights::{DispatchClass, Weight},
|
||||
};
|
||||
use frame_system::{ensure_none, ensure_root};
|
||||
use parachain::primitives::RelayChainBlockNumber;
|
||||
use polkadot_parachain::primitives::RelayChainBlockNumber;
|
||||
use relay_state_snapshot::MessagingStateSnapshot;
|
||||
use sp_inherents::{InherentData, InherentIdentifier, ProvideInherent};
|
||||
use sp_runtime::traits::{BlakeTwo256, Hash};
|
||||
use sp_std::{cmp, collections::btree_map::BTreeMap, vec::Vec};
|
||||
|
||||
mod relay_state_snapshot;
|
||||
use relay_state_snapshot::MessagingStateSnapshot;
|
||||
#[macro_use]
|
||||
pub mod validate_block;
|
||||
|
||||
/// The pallet's configuration trait.
|
||||
pub trait Config: frame_system::Config {
|
||||
@@ -475,7 +477,7 @@ impl<T: Config> Module<T> {
|
||||
/// This is similar to [`process_inbound_downward_messages`], but works on multiple inbound
|
||||
/// channels.
|
||||
fn process_inbound_horizontal_messages(
|
||||
ingress_channels: &[(ParaId, cumulus_primitives::AbridgedHrmpChannel)],
|
||||
ingress_channels: &[(ParaId, cumulus_primitives_core::AbridgedHrmpChannel)],
|
||||
horizontal_messages: BTreeMap<ParaId, Vec<InboundHrmpMessage>>,
|
||||
) -> DispatchResult {
|
||||
// First, check that all submitted messages are sent from channels that exist. The channel
|
||||
@@ -598,9 +600,8 @@ impl<T: Config> Module<T> {
|
||||
return None;
|
||||
}
|
||||
|
||||
let relay_blocks_since_last_upgrade = vfp
|
||||
.relay_parent_number
|
||||
.saturating_sub(LastUpgrade::get());
|
||||
let relay_blocks_since_last_upgrade =
|
||||
vfp.relay_parent_number.saturating_sub(LastUpgrade::get());
|
||||
|
||||
if relay_blocks_since_last_upgrade <= cfg.validation_upgrade_frequency {
|
||||
// The cooldown after the last upgrade hasn't elapsed yet. Upgrade is not allowed.
|
||||
@@ -611,9 +612,7 @@ impl<T: Config> Module<T> {
|
||||
}
|
||||
|
||||
/// The implementation of the runtime upgrade scheduling.
|
||||
fn schedule_upgrade_impl(
|
||||
validation_function: Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
fn schedule_upgrade_impl(validation_function: Vec<u8>) -> DispatchResult {
|
||||
ensure!(
|
||||
!PendingValidationFunction::exists(),
|
||||
Error::<T>::OverlappingUpgrades
|
||||
@@ -712,9 +711,9 @@ impl<T: Config> Module<T> {
|
||||
match Self::host_configuration() {
|
||||
Some(cfg) => {
|
||||
if message.len() > cfg.max_upward_message_size as usize {
|
||||
return Err(SendUpErr::TooBig)
|
||||
return Err(SendUpErr::TooBig);
|
||||
}
|
||||
},
|
||||
}
|
||||
None => {
|
||||
// This storage field should carry over from the previous block. So if it's None
|
||||
// then it must be that this is an edge-case where a message is attempted to be
|
||||
@@ -758,7 +757,7 @@ impl<T: Config> Module<T> {
|
||||
// opened at all so early. At least, relying on this assumption seems to be a better
|
||||
// tradeoff, compared to introducing an error variant that the clients should be
|
||||
// prepared to handle.
|
||||
return Err(SendHorizontalErr::NoChannel)
|
||||
return Err(SendHorizontalErr::NoChannel);
|
||||
}
|
||||
};
|
||||
let channel_meta = match relevant_messaging_state
|
||||
@@ -769,7 +768,7 @@ impl<T: Config> Module<T> {
|
||||
Err(_) => return Err(SendHorizontalErr::NoChannel),
|
||||
};
|
||||
if data.len() as u32 > channel_meta.max_message_size {
|
||||
return Err(SendHorizontalErr::TooBig)
|
||||
return Err(SendHorizontalErr::TooBig);
|
||||
}
|
||||
|
||||
// And then at last update the storage.
|
||||
@@ -859,7 +858,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use codec::Encode;
|
||||
use cumulus_primitives::{
|
||||
use cumulus_primitives_core::{
|
||||
AbridgedHrmpChannel, InboundDownwardMessage, InboundHrmpMessage, PersistedValidationData,
|
||||
};
|
||||
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
|
||||
@@ -1325,27 +1324,27 @@ mod tests {
|
||||
sproof.host_config.max_upward_message_num_per_candidate = 1;
|
||||
sproof.relay_dispatch_queue_size = None;
|
||||
})
|
||||
.add_with_post_test(1,
|
||||
.add_with_post_test(
|
||||
1,
|
||||
|| {
|
||||
ParachainSystem::send_upward_message(b"Mr F was here".to_vec()).unwrap();
|
||||
ParachainSystem::send_upward_message(b"message 2".to_vec()).unwrap();
|
||||
},
|
||||
|| {
|
||||
let v: Option<Vec<Vec<u8>>> = storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(
|
||||
v,
|
||||
Some(vec![b"Mr F was here".to_vec()]),
|
||||
);
|
||||
})
|
||||
.add_with_post_test(2,
|
||||
let v: Option<Vec<Vec<u8>>> =
|
||||
storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(v, Some(vec![b"Mr F was here".to_vec()]),);
|
||||
},
|
||||
)
|
||||
.add_with_post_test(
|
||||
2,
|
||||
|| { /* do nothing within block */ },
|
||||
|| {
|
||||
let v: Option<Vec<Vec<u8>>> = storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(
|
||||
v,
|
||||
Some(vec![b"message 2".to_vec()]),
|
||||
);
|
||||
});
|
||||
let v: Option<Vec<Vec<u8>>> =
|
||||
storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(v, Some(vec![b"message 2".to_vec()]),);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1360,29 +1359,28 @@ mod tests {
|
||||
2 => sproof.relay_dispatch_queue_size = Some((4, 0)),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
})
|
||||
.add_with_post_test(1,
|
||||
.add_with_post_test(
|
||||
1,
|
||||
|| {
|
||||
ParachainSystem::send_upward_message(vec![0u8; 8]).unwrap();
|
||||
},
|
||||
|| {
|
||||
// The message won't be sent because there is already one message in queue.
|
||||
let v: Option<Vec<Vec<u8>>> = storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(
|
||||
v,
|
||||
Some(vec![]),
|
||||
);
|
||||
})
|
||||
.add_with_post_test(2,
|
||||
let v: Option<Vec<Vec<u8>>> =
|
||||
storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(v, Some(vec![]),);
|
||||
},
|
||||
)
|
||||
.add_with_post_test(
|
||||
2,
|
||||
|| { /* do nothing within block */ },
|
||||
|| {
|
||||
let v: Option<Vec<Vec<u8>>> = storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(
|
||||
v,
|
||||
Some(vec![vec![0u8; 8]]),
|
||||
);
|
||||
});
|
||||
let v: Option<Vec<Vec<u8>>> =
|
||||
storage::unhashed::get(well_known_keys::UPWARD_MESSAGES);
|
||||
assert_eq!(v, Some(vec![vec![0u8; 8]]),);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1396,13 +1394,11 @@ mod tests {
|
||||
})
|
||||
.add(1, || {})
|
||||
.add(2, || {
|
||||
assert!(
|
||||
ParachainSystem::send_hrmp_message(OutboundHrmpMessage {
|
||||
recipient: ParaId::from(300),
|
||||
data: b"derp".to_vec(),
|
||||
})
|
||||
.is_err()
|
||||
);
|
||||
assert!(ParachainSystem::send_hrmp_message(OutboundHrmpMessage {
|
||||
recipient: ParaId::from(300),
|
||||
data: b"derp".to_vec(),
|
||||
})
|
||||
.is_err());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1620,15 +1616,13 @@ mod tests {
|
||||
}
|
||||
|
||||
BlockTests::new()
|
||||
.with_relay_sproof_builder(
|
||||
|_, relay_block_num, sproof| match relay_block_num {
|
||||
1 => {
|
||||
sproof.dmq_mqc_head =
|
||||
Some(MessageQueueChain::default().extend_downward(&MSG).head());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
)
|
||||
.with_relay_sproof_builder(|_, relay_block_num, sproof| match relay_block_num {
|
||||
1 => {
|
||||
sproof.dmq_mqc_head =
|
||||
Some(MessageQueueChain::default().extend_downward(&MSG).head());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.with_inherent_data(|_, relay_block_num, data| match relay_block_num {
|
||||
1 => {
|
||||
data.downward_messages.push(MSG.clone());
|
||||
@@ -1669,35 +1663,34 @@ mod tests {
|
||||
}
|
||||
|
||||
BlockTests::new()
|
||||
.with_relay_sproof_builder(
|
||||
|_, relay_block_num, sproof| match relay_block_num {
|
||||
1 => {
|
||||
// 200 - doesn't exist yet
|
||||
// 300 - one new message
|
||||
sproof.upsert_inbound_channel(ParaId::from(300)).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_1).head());
|
||||
}
|
||||
2 => {
|
||||
// 200 - two new messages
|
||||
// 300 - now present with one message.
|
||||
sproof.upsert_inbound_channel(ParaId::from(200)).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_4).head());
|
||||
sproof.upsert_inbound_channel(ParaId::from(300)).mqc_head =
|
||||
Some(MessageQueueChain::default()
|
||||
.extend_hrmp(&MSG_1)
|
||||
.extend_hrmp(&MSG_2)
|
||||
.extend_hrmp(&MSG_3)
|
||||
.head());
|
||||
}
|
||||
3 => {
|
||||
// 200 - no new messages
|
||||
// 300 - is gone
|
||||
sproof.upsert_inbound_channel(ParaId::from(200)).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_4).head());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
)
|
||||
.with_relay_sproof_builder(|_, relay_block_num, sproof| match relay_block_num {
|
||||
1 => {
|
||||
// 200 - doesn't exist yet
|
||||
// 300 - one new message
|
||||
sproof.upsert_inbound_channel(ParaId::from(300)).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_1).head());
|
||||
}
|
||||
2 => {
|
||||
// 200 - two new messages
|
||||
// 300 - now present with one message.
|
||||
sproof.upsert_inbound_channel(ParaId::from(200)).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_4).head());
|
||||
sproof.upsert_inbound_channel(ParaId::from(300)).mqc_head = Some(
|
||||
MessageQueueChain::default()
|
||||
.extend_hrmp(&MSG_1)
|
||||
.extend_hrmp(&MSG_2)
|
||||
.extend_hrmp(&MSG_3)
|
||||
.head(),
|
||||
);
|
||||
}
|
||||
3 => {
|
||||
// 200 - no new messages
|
||||
// 300 - is gone
|
||||
sproof.upsert_inbound_channel(ParaId::from(200)).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_4).head());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.with_inherent_data(|_, relay_block_num, data| match relay_block_num {
|
||||
1 => {
|
||||
data.horizontal_messages
|
||||
@@ -1779,28 +1772,27 @@ mod tests {
|
||||
const ALICE: ParaId = ParaId::new(300);
|
||||
|
||||
BlockTests::new()
|
||||
.with_relay_sproof_builder(
|
||||
|_, relay_block_num, sproof| match relay_block_num {
|
||||
1 => {
|
||||
sproof.upsert_inbound_channel(ALICE).mqc_head
|
||||
= Some(MessageQueueChain::default().extend_hrmp(&MSG_1).head());
|
||||
}
|
||||
2 => {
|
||||
// 300 - no new messages, mqc stayed the same.
|
||||
sproof.upsert_inbound_channel(ALICE).mqc_head
|
||||
= Some(MessageQueueChain::default().extend_hrmp(&MSG_1).head());
|
||||
}
|
||||
3 => {
|
||||
// 300 - new message.
|
||||
sproof.upsert_inbound_channel(ALICE).mqc_head
|
||||
= Some(MessageQueueChain::default()
|
||||
.with_relay_sproof_builder(|_, relay_block_num, sproof| match relay_block_num {
|
||||
1 => {
|
||||
sproof.upsert_inbound_channel(ALICE).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_1).head());
|
||||
}
|
||||
2 => {
|
||||
// 300 - no new messages, mqc stayed the same.
|
||||
sproof.upsert_inbound_channel(ALICE).mqc_head =
|
||||
Some(MessageQueueChain::default().extend_hrmp(&MSG_1).head());
|
||||
}
|
||||
3 => {
|
||||
// 300 - new message.
|
||||
sproof.upsert_inbound_channel(ALICE).mqc_head = Some(
|
||||
MessageQueueChain::default()
|
||||
.extend_hrmp(&MSG_1)
|
||||
.extend_hrmp(&MSG_2)
|
||||
.head());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
)
|
||||
.head(),
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.with_inherent_data(|_, relay_block_num, data| match relay_block_num {
|
||||
1 => {
|
||||
data.horizontal_messages.insert(ALICE, vec![MSG_1.clone()]);
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use cumulus_primitives::{relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId};
|
||||
use cumulus_primitives_core::{relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId};
|
||||
use hash_db::{HashDB, EMPTY_PREFIX};
|
||||
use sp_runtime::traits::HashFor;
|
||||
use sp_state_machine::{Backend, TrieBackend};
|
||||
+18
-20
@@ -23,16 +23,16 @@ use sp_std::{boxed::Box, vec::Vec};
|
||||
|
||||
use hash_db::{HashDB, EMPTY_PREFIX};
|
||||
|
||||
use parachain::primitives::{HeadData, ValidationCode, ValidationParams, ValidationResult};
|
||||
use polkadot_parachain::primitives::{HeadData, ValidationCode, ValidationParams, ValidationResult};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
use cumulus_primitives::{
|
||||
use cumulus_primitives_core::{
|
||||
well_known_keys::{
|
||||
HRMP_OUTBOUND_MESSAGES, HRMP_WATERMARK, NEW_VALIDATION_CODE, PROCESSED_DOWNWARD_MESSAGES,
|
||||
UPWARD_MESSAGES, VALIDATION_DATA,
|
||||
},
|
||||
OutboundHrmpMessage, UpwardMessage, PersistedValidationData,
|
||||
OutboundHrmpMessage, PersistedValidationData, UpwardMessage,
|
||||
};
|
||||
use sp_core::storage::{ChildInfo, TrackedStorageKey};
|
||||
use sp_externalities::{
|
||||
@@ -67,21 +67,24 @@ impl Encode for EncodeOpaqueValue {
|
||||
/// Validate a given parachain block on a validator.
|
||||
#[doc(hidden)]
|
||||
pub fn validate_block<B: BlockT, E: ExecuteBlock<B>>(params: ValidationParams) -> ValidationResult {
|
||||
let block_data = crate::ParachainBlockData::<B>::decode(&mut ¶ms.block_data.0[..])
|
||||
.expect("Invalid parachain block data");
|
||||
let block_data =
|
||||
cumulus_primitives_core::ParachainBlockData::<B>::decode(&mut ¶ms.block_data.0[..])
|
||||
.expect("Invalid parachain block data");
|
||||
|
||||
let parent_head =
|
||||
B::Header::decode(&mut ¶ms.parent_head.0[..]).expect("Invalid parent head");
|
||||
|
||||
let head_data = HeadData(block_data.header.encode());
|
||||
let (header, extrinsics, storage_proof) = block_data.deconstruct();
|
||||
|
||||
let block = B::new(block_data.header, block_data.extrinsics);
|
||||
let head_data = HeadData(header.encode());
|
||||
|
||||
let block = B::new(header, extrinsics);
|
||||
assert!(
|
||||
parent_head.hash() == *block.header().parent_hash(),
|
||||
"Invalid parent hash",
|
||||
);
|
||||
|
||||
let db = block_data.storage_proof.into_memory_db();
|
||||
let db = storage_proof.into_memory_db();
|
||||
let root = parent_head.state_root().clone();
|
||||
if !HashDB::<HashFor<B>, _>::contains(&db, &root, EMPTY_PREFIX) {
|
||||
panic!("Witness data does not contain given storage root.");
|
||||
@@ -130,10 +133,8 @@ pub fn validate_block<B: BlockT, E: ExecuteBlock<B>>(params: ValidationParams) -
|
||||
.replace_implementation(host_default_child_storage_root),
|
||||
sp_io::default_child_storage::host_next_key
|
||||
.replace_implementation(host_default_child_storage_next_key),
|
||||
sp_io::offchain_index::host_set
|
||||
.replace_implementation(host_offchain_index_set),
|
||||
sp_io::offchain_index::host_clear
|
||||
.replace_implementation(host_offchain_index_clear),
|
||||
sp_io::offchain_index::host_set.replace_implementation(host_offchain_index_set),
|
||||
sp_io::offchain_index::host_clear.replace_implementation(host_offchain_index_clear),
|
||||
);
|
||||
|
||||
set_and_run_with_externalities(&mut ext, || {
|
||||
@@ -205,13 +206,10 @@ impl<'a, B: BlockT> WitnessExt<'a, B> {
|
||||
/// Should be removed with: https://github.com/paritytech/cumulus/issues/217
|
||||
/// When removed `WitnessExt` could also be removed.
|
||||
fn check_validation_data(&self, mut data: &[u8]) {
|
||||
let validation_data = PersistedValidationData::decode(&mut data)
|
||||
.expect("Invalid `PersistedValidationData`");
|
||||
let validation_data =
|
||||
PersistedValidationData::decode(&mut data).expect("Invalid `PersistedValidationData`");
|
||||
|
||||
assert_eq!(
|
||||
self.params.parent_head,
|
||||
validation_data.parent_head,
|
||||
);
|
||||
assert_eq!(self.params.parent_head, validation_data.parent_head,);
|
||||
assert_eq!(
|
||||
self.params.relay_parent_number,
|
||||
validation_data.relay_parent_number,
|
||||
@@ -487,6 +485,6 @@ fn host_default_child_storage_next_key(storage_key: &[u8], key: &[u8]) -> Option
|
||||
with_externalities(|ext| ext.next_child_storage_key(&child_info, key))
|
||||
}
|
||||
|
||||
fn host_offchain_index_set(_key: &[u8], _value: &[u8]) { }
|
||||
fn host_offchain_index_set(_key: &[u8], _value: &[u8]) {}
|
||||
|
||||
fn host_offchain_index_clear(_key: &[u8]) { }
|
||||
fn host_offchain_index_clear(_key: &[u8]) {}
|
||||
+4
-4
@@ -24,7 +24,7 @@ mod tests;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[doc(hidden)]
|
||||
pub use parachain;
|
||||
pub use polkadot_parachain;
|
||||
|
||||
/// Register the `validate_block` function that is used by parachains to validate blocks on a
|
||||
/// validator.
|
||||
@@ -39,7 +39,7 @@ pub use parachain;
|
||||
/// struct Block;
|
||||
/// struct BlockExecutor;
|
||||
///
|
||||
/// cumulus_runtime::register_validate_block!(Block, BlockExecutor);
|
||||
/// cumulus_pallet_parachain_system::register_validate_block!(Block, BlockExecutor);
|
||||
///
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
@@ -63,14 +63,14 @@ macro_rules! register_validate_block_impl {
|
||||
#[no_mangle]
|
||||
unsafe fn validate_block(arguments: *const u8, arguments_len: usize) -> u64 {
|
||||
let params =
|
||||
$crate::validate_block::parachain::load_params(arguments, arguments_len);
|
||||
$crate::validate_block::polkadot_parachain::load_params(arguments, arguments_len);
|
||||
|
||||
let res = $crate::validate_block::implementation::validate_block::<
|
||||
$block,
|
||||
$block_executor,
|
||||
>(params);
|
||||
|
||||
$crate::validate_block::parachain::write_result(&res)
|
||||
$crate::validate_block::polkadot_parachain::write_result(&res)
|
||||
}
|
||||
}
|
||||
};
|
||||
+2
-4
@@ -14,16 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::ParachainBlockData;
|
||||
|
||||
use cumulus_primitives::PersistedValidationData;
|
||||
use cumulus_primitives_core::{PersistedValidationData, ParachainBlockData};
|
||||
use cumulus_test_client::{
|
||||
runtime::{Block, Hash, Header, UncheckedExtrinsic, WASM_BINARY},
|
||||
transfer, Client, DefaultTestClientBuilderExt, InitBlockBuilder, LongestChain,
|
||||
TestClientBuilder, TestClientBuilderExt,
|
||||
};
|
||||
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
|
||||
use parachain::primitives::{BlockData, HeadData, ValidationParams, ValidationResult};
|
||||
use polkadot_parachain::primitives::{BlockData, HeadData, ValidationParams, ValidationResult};
|
||||
use sc_executor::{
|
||||
error::Result, sp_wasm_interface::HostFunctions, WasmExecutionMethod, WasmExecutor,
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "xcm-handler"
|
||||
name = "cumulus-pallet-xcm-handler"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
@@ -17,7 +17,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", default-featur
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus Dependencies
|
||||
cumulus-primitives = { path = "../primitives", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
@@ -26,6 +26,6 @@ std = [
|
||||
"sp-std/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"cumulus-primitives/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"xcm/std"
|
||||
]
|
||||
@@ -23,7 +23,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use cumulus_primitives::{
|
||||
use cumulus_primitives_core::{
|
||||
DownwardMessageHandler, HrmpMessageHandler, HrmpMessageSender, InboundDownwardMessage,
|
||||
InboundHrmpMessage, OutboundHrmpMessage, ParaId, UpwardMessageSender,
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "cumulus-primitives"
|
||||
name = "cumulus-primitives-core"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
@@ -9,7 +9,6 @@ edition = "2018"
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sc-chain-spec = { git = "https://github.com/paritytech/substrate", optional = true, branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -19,7 +18,7 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-
|
||||
|
||||
# Other dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive" ] }
|
||||
impl-trait-for-tuples = "0.1.3"
|
||||
impl-trait-for-tuples = "0.2.1"
|
||||
|
||||
# Polkadot dependencies
|
||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
@@ -27,7 +26,6 @@ polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", def
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"sc-chain-spec",
|
||||
"sp-std/std",
|
||||
"codec/std",
|
||||
"polkadot-primitives/std",
|
||||
@@ -14,19 +14,18 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Cumulus related primitive types and traits.
|
||||
//! Cumulus related core primitive types and traits.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
|
||||
pub use polkadot_core_primitives::InboundDownwardMessage;
|
||||
pub use polkadot_parachain::primitives::{Id as ParaId, UpwardMessage, ValidationParams};
|
||||
pub use polkadot_primitives::v1::{
|
||||
PersistedValidationData, AbridgedHostConfiguration, AbridgedHrmpChannel,
|
||||
};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub mod genesis;
|
||||
|
||||
/// A module that re-exports relevant relay chain definitions.
|
||||
pub mod relay_chain {
|
||||
pub use polkadot_core_primitives::*;
|
||||
@@ -133,3 +132,57 @@ pub trait HrmpMessageSender {
|
||||
pub trait OnValidationData {
|
||||
fn on_validation_data(data: &PersistedValidationData);
|
||||
}
|
||||
|
||||
/// The parachain block that is created by a collator.
|
||||
///
|
||||
/// This is send as PoV (proof of validity block) to the relay-chain validators. There it will be
|
||||
/// passed to the parachain validation Wasm blob to be validated.
|
||||
#[derive(codec::Encode, codec::Decode)]
|
||||
pub struct ParachainBlockData<B: BlockT> {
|
||||
/// The header of the parachain block.
|
||||
header: B::Header,
|
||||
/// The extrinsics of the parachain block.
|
||||
extrinsics: sp_std::vec::Vec<B::Extrinsic>,
|
||||
/// The data that is required to emulate the storage accesses executed by all extrinsics.
|
||||
storage_proof: sp_trie::StorageProof,
|
||||
}
|
||||
|
||||
impl<B: BlockT> ParachainBlockData<B> {
|
||||
/// Creates a new instance of `Self`.
|
||||
pub fn new(
|
||||
header: <B as BlockT>::Header,
|
||||
extrinsics: sp_std::vec::Vec<<B as BlockT>::Extrinsic>,
|
||||
storage_proof: sp_trie::StorageProof,
|
||||
) -> Self {
|
||||
Self {
|
||||
header,
|
||||
extrinsics,
|
||||
storage_proof,
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert `self` into the stored header.
|
||||
pub fn into_header(self) -> B::Header {
|
||||
self.header
|
||||
}
|
||||
|
||||
/// Returns the header.
|
||||
pub fn header(&self) -> &B::Header {
|
||||
&self.header
|
||||
}
|
||||
|
||||
/// Returns the extrinsics.
|
||||
pub fn extrinsics(&self) -> &[B::Extrinsic] {
|
||||
&self.extrinsics
|
||||
}
|
||||
|
||||
/// Returns the [`StorageProof`](sp_trie::StorageProof).
|
||||
pub fn storage_proof(&self) -> &sp_trie::StorageProof {
|
||||
&self.storage_proof
|
||||
}
|
||||
|
||||
/// Deconstruct into the inner parts.
|
||||
pub fn deconstruct(self) -> (B::Header, sp_std::vec::Vec<B::Extrinsic>, sp_trie::StorageProof) {
|
||||
(self.header, self.extrinsics, self.storage_proof)
|
||||
}
|
||||
}
|
||||
@@ -56,11 +56,11 @@ sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "maste
|
||||
jsonrpc-core = "15.1.0"
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-consensus = { path = "../consensus" }
|
||||
cumulus-collator = { path = "../collator" }
|
||||
cumulus-network = { path = "../network" }
|
||||
cumulus-primitives = { path = "../primitives" }
|
||||
cumulus-service = { path = "../service" }
|
||||
cumulus-client-consensus = { path = "../client/consensus" }
|
||||
cumulus-client-collator = { path = "../client/collator" }
|
||||
cumulus-client-service = { path = "../client/service" }
|
||||
cumulus-client-network = { path = "../client/network" }
|
||||
cumulus-primitives-core = { path = "../primitives/core" }
|
||||
|
||||
# Polkadot dependencies
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
|
||||
@@ -409,4 +409,4 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_runtime::register_validate_block!(Block, Executive);
|
||||
cumulus_pallet_parachain_system::register_validate_block!(Block, Executive);
|
||||
|
||||
@@ -11,14 +11,14 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
cumulus-primitives = { path = "../../../primitives", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../../primitives/core", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"serde",
|
||||
"cumulus-primitives/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"codec/std",
|
||||
"serde",
|
||||
"cumulus-primitives-core/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
]
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
use frame_support::{decl_module, decl_storage, traits::Get};
|
||||
|
||||
use cumulus_primitives::ParaId;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
|
||||
/// Configuration trait of this pallet.
|
||||
pub trait Config: frame_system::Config {}
|
||||
|
||||
@@ -34,10 +34,9 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", default-feature
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-runtime = { path = "../../runtime", default-features = false }
|
||||
cumulus-parachain-system = { path = "../../parachain-system", default-features = false }
|
||||
cumulus-primitives = { path = "../../primitives", default-features = false }
|
||||
xcm-handler = { path = "../../xcm-handler", default-features = false }
|
||||
cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||
cumulus-pallet-xcm-handler = { path = "../../pallets/xcm-handler", default-features = false }
|
||||
|
||||
# Polkadot dependencies
|
||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
@@ -74,11 +73,10 @@ std = [
|
||||
"pallet-transaction-payment/std",
|
||||
"parachain-info/std",
|
||||
"rococo-parachain-primitives/std",
|
||||
"cumulus-runtime/std",
|
||||
"cumulus-parachain-system/std",
|
||||
"cumulus-primitives/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-pallet-xcm-handler/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"xcm/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
"xcm-handler/std",
|
||||
]
|
||||
|
||||
@@ -229,7 +229,7 @@ impl pallet_sudo::Config for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl cumulus_parachain_system::Config for Runtime {
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
type SelfParaId = parachain_info::Module<Runtime>;
|
||||
@@ -242,7 +242,7 @@ impl parachain_info::Config for Runtime {}
|
||||
parameter_types! {
|
||||
pub const RococoLocation: MultiLocation = MultiLocation::X1(Junction::Parent);
|
||||
pub const RococoNetwork: NetworkId = NetworkId::Polkadot;
|
||||
pub RelayChainOrigin: Origin = xcm_handler::Origin::Relay.into();
|
||||
pub RelayChainOrigin: Origin = cumulus_pallet_xcm_handler::Origin::Relay.into();
|
||||
pub Ancestry: MultiLocation = Junction::Parachain {
|
||||
id: ParachainInfo::parachain_id().into()
|
||||
}.into();
|
||||
@@ -268,7 +268,7 @@ type LocalAssetTransactor = CurrencyAdapter<
|
||||
type LocalOriginConverter = (
|
||||
SovereignSignedViaLocation<LocationConverter, Origin>,
|
||||
RelayChainAsNative<RelayChainOrigin, Origin>,
|
||||
SiblingParachainAsNative<xcm_handler::Origin, Origin>,
|
||||
SiblingParachainAsNative<cumulus_pallet_xcm_handler::Origin, Origin>,
|
||||
SignedAccountId32AsNative<RococoNetwork, Origin>,
|
||||
);
|
||||
|
||||
@@ -284,7 +284,7 @@ impl Config for XcmConfig {
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
}
|
||||
|
||||
impl xcm_handler::Config for Runtime {
|
||||
impl cumulus_pallet_xcm_handler::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type UpwardMessageSender = ParachainSystem;
|
||||
@@ -302,10 +302,10 @@ construct_runtime! {
|
||||
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
Sudo: pallet_sudo::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||
ParachainSystem: cumulus_parachain_system::{Module, Call, Storage, Inherent, Event},
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Module, Call, Storage, Inherent, Event},
|
||||
TransactionPayment: pallet_transaction_payment::{Module, Storage},
|
||||
ParachainInfo: parachain_info::{Module, Storage, Config},
|
||||
XcmHandler: xcm_handler::{Module, Call, Event<T>, Origin},
|
||||
XcmHandler: cumulus_pallet_xcm_handler::{Module, Call, Event<T>, Origin},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,4 +414,4 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_runtime::register_validate_block!(Block, Executive);
|
||||
cumulus_pallet_parachain_system::register_validate_block!(Block, Executive);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use cumulus_primitives::ParaId;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use hex_literal::hex;
|
||||
use rococo_parachain_primitives::{AccountId, Signature};
|
||||
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
|
||||
|
||||
@@ -19,13 +19,14 @@ use crate::{
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
};
|
||||
use codec::Encode;
|
||||
use cumulus_primitives::{genesis::generate_genesis_block, ParaId};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use cumulus_client_service::genesis::generate_genesis_block;
|
||||
use log::info;
|
||||
use parachain_runtime::Block;
|
||||
use polkadot_parachain::primitives::AccountIdConversion;
|
||||
use sc_cli::{
|
||||
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams,
|
||||
KeystoreParams, NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
|
||||
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
||||
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
|
||||
};
|
||||
use sc_service::{
|
||||
config::{BasePath, PrometheusConfig},
|
||||
@@ -291,11 +292,12 @@ pub fn run() -> Result<()> {
|
||||
|
||||
let task_executor = config.task_executor.clone();
|
||||
let polkadot_config = SubstrateCli::create_configuration(
|
||||
&polkadot_cli,
|
||||
&polkadot_cli,
|
||||
task_executor,
|
||||
config.telemetry_handle.clone(),
|
||||
).map_err(|err| format!("Relay chain argument error: {}", err))?;
|
||||
&polkadot_cli,
|
||||
&polkadot_cli,
|
||||
task_executor,
|
||||
config.telemetry_handle.clone(),
|
||||
)
|
||||
.map_err(|err| format!("Relay chain argument error: {}", err))?;
|
||||
let collator = cli.run.base.validator || cli.collator;
|
||||
|
||||
info!("Parachain id: {:?}", id);
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use cumulus_network::build_block_announce_validator;
|
||||
use cumulus_service::{
|
||||
use cumulus_client_network::build_block_announce_validator;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use cumulus_client_service::{
|
||||
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
||||
};
|
||||
use parachain_runtime::RuntimeApi;
|
||||
@@ -69,7 +70,7 @@ pub fn new_partial(
|
||||
client.clone(),
|
||||
);
|
||||
|
||||
let import_queue = cumulus_consensus::import_queue::import_queue(
|
||||
let import_queue = cumulus_client_consensus::import_queue::import_queue(
|
||||
client.clone(),
|
||||
client.clone(),
|
||||
inherent_data_providers.clone(),
|
||||
@@ -100,7 +101,7 @@ async fn start_node_impl<RB>(
|
||||
parachain_config: Configuration,
|
||||
collator_key: CollatorPair,
|
||||
polkadot_config: Configuration,
|
||||
id: polkadot_primitives::v0::Id,
|
||||
id: ParaId,
|
||||
validator: bool,
|
||||
rpc_ext_builder: RB,
|
||||
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
|
||||
@@ -118,7 +119,7 @@ where
|
||||
let parachain_config = prepare_node_config(parachain_config);
|
||||
|
||||
let polkadot_full_node =
|
||||
cumulus_service::build_polkadot_full_node(polkadot_config, collator_key.public()).map_err(
|
||||
cumulus_client_service::build_polkadot_full_node(polkadot_config, collator_key.public()).map_err(
|
||||
|e| match e {
|
||||
polkadot_service::Error::Sub(x) => x,
|
||||
s => format!("{}", s).into(),
|
||||
@@ -228,7 +229,7 @@ pub async fn start_node(
|
||||
parachain_config: Configuration,
|
||||
collator_key: CollatorPair,
|
||||
polkadot_config: Configuration,
|
||||
id: polkadot_primitives::v0::Id,
|
||||
id: ParaId,
|
||||
validator: bool,
|
||||
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)> {
|
||||
start_node_impl(
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
[package]
|
||||
name = "cumulus-runtime"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
# Other dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive" ] }
|
||||
hash-db = { version = "0.15.2", default-features = false }
|
||||
memory-db = { version = "0.26.0", default-features = false }
|
||||
trie-db = { version = "0.22.0", default-features = false }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-primitives = { path = "../primitives", default-features = false }
|
||||
|
||||
# Substrate dependencies
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-state-machine = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-externalities = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Polkadot dependencies
|
||||
parachain = { package = "polkadot-parachain", git = "https://github.com/paritytech/polkadot", default-features = false, features = [ "wasm-api" ], branch = "master" }
|
||||
|
||||
[dev-dependencies]
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
cumulus-test-relay-sproof-builder = { path = "../test/relay-sproof-builder" }
|
||||
cumulus-test-client = { path = "../test/client" }
|
||||
env_logger = "0.7.1"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"cumulus-primitives/std",
|
||||
"sp-std/std",
|
||||
"sp-io/std",
|
||||
"sp-runtime/std",
|
||||
"sp-core/std",
|
||||
"frame-executive/std",
|
||||
"memory-db/std",
|
||||
"hash-db/std",
|
||||
"trie-db/std",
|
||||
"sp-state-machine/std",
|
||||
"sp-externalities/std",
|
||||
"sp-trie/std",
|
||||
"parachain/std",
|
||||
]
|
||||
@@ -1,76 +0,0 @@
|
||||
// Copyright 2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
///! The Cumulus runtime to make a runtime a parachain.
|
||||
use codec::{Decode, Encode};
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
use sp_std::vec::Vec;
|
||||
use sp_trie::StorageProof;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[doc(hidden)]
|
||||
pub use sp_std::slice;
|
||||
|
||||
#[macro_use]
|
||||
pub mod validate_block;
|
||||
|
||||
/// The parachain block that is created on a collator and validated by a validator.
|
||||
#[derive(Encode, Decode)]
|
||||
pub struct ParachainBlockData<B: BlockT> {
|
||||
/// The header of the parachain block.
|
||||
header: <B as BlockT>::Header,
|
||||
/// The extrinsics of the parachain block without the `PolkadotInherent`.
|
||||
extrinsics: Vec<<B as BlockT>::Extrinsic>,
|
||||
/// The data that is required to emulate the storage accesses executed by all extrinsics.
|
||||
storage_proof: StorageProof,
|
||||
}
|
||||
|
||||
impl<B: BlockT> ParachainBlockData<B> {
|
||||
/// Creates a new instance of `Self`.
|
||||
pub fn new(
|
||||
header: <B as BlockT>::Header,
|
||||
extrinsics: Vec<<B as BlockT>::Extrinsic>,
|
||||
storage_proof: StorageProof,
|
||||
) -> Self {
|
||||
Self {
|
||||
header,
|
||||
extrinsics,
|
||||
storage_proof,
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert `self` into the stored header.
|
||||
pub fn into_header(self) -> B::Header {
|
||||
self.header
|
||||
}
|
||||
|
||||
/// Returns the header.
|
||||
pub fn header(&self) -> &B::Header {
|
||||
&self.header
|
||||
}
|
||||
|
||||
/// Returns the extrinsics.
|
||||
pub fn extrinsics(&self) -> &[B::Extrinsic] {
|
||||
&self.extrinsics
|
||||
}
|
||||
|
||||
/// Returns the [`StorageProof`].
|
||||
pub fn storage_proof(&self) -> &StorageProof {
|
||||
&self.storage_proof
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "m
|
||||
cumulus-test-runtime = { path = "../runtime" }
|
||||
cumulus-test-service = { path = "../service" }
|
||||
cumulus-test-relay-sproof-builder = { path = "../relay-sproof-builder" }
|
||||
cumulus-primitives = { path = "../../primitives" }
|
||||
cumulus-primitives-core = { path = "../../primitives/core" }
|
||||
|
||||
# Polkadot deps
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Backend, Client};
|
||||
use cumulus_primitives::{
|
||||
use cumulus_primitives_core::{
|
||||
inherents::{SystemInherentData, SYSTEM_INHERENT_IDENTIFIER}, PersistedValidationData,
|
||||
};
|
||||
use cumulus_test_runtime::{Block, GetLastTimestamp};
|
||||
|
||||
@@ -17,7 +17,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-primitives = { path = "../../primitives", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
@@ -26,5 +26,5 @@ std = [
|
||||
"sp-state-machine/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"cumulus-primitives/std",
|
||||
"cumulus-primitives-core/std",
|
||||
]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use cumulus_primitives::{relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId};
|
||||
use cumulus_primitives_core::{relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId};
|
||||
use sp_runtime::traits::HashFor;
|
||||
use sp_state_machine::MemoryDB;
|
||||
use sp_std::collections::btree_map::BTreeMap;
|
||||
@@ -44,7 +44,7 @@ impl Default for RelayStateSproofBuilder {
|
||||
fn default() -> Self {
|
||||
RelayStateSproofBuilder {
|
||||
para_id: ParaId::from(200),
|
||||
host_config: cumulus_primitives::AbridgedHostConfiguration {
|
||||
host_config: cumulus_primitives_core::AbridgedHostConfiguration {
|
||||
max_code_size: 2 * 1024 * 1024,
|
||||
max_head_data_size: 1024 * 1024,
|
||||
max_upward_queue_count: 8,
|
||||
|
||||
@@ -30,9 +30,8 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-parachain-system = { path = "../../parachain-system", default-features = false }
|
||||
cumulus-primitives = { path = "../../primitives", default-features = false }
|
||||
cumulus-runtime = { path = "../../runtime", default-features = false }
|
||||
cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../primitives/core", default-features = false }
|
||||
|
||||
# Polkadot dependencies
|
||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
@@ -44,9 +43,8 @@ substrate-wasm-builder = "3.0.0"
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"codec/std",
|
||||
"cumulus-parachain-system/std",
|
||||
"cumulus-primitives/std",
|
||||
"cumulus-runtime/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
|
||||
@@ -207,7 +207,7 @@ impl pallet_sudo::Config for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl cumulus_parachain_system::Config for Runtime {
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type SelfParaId = ParachainId;
|
||||
type Event = Event;
|
||||
type OnValidationData = ();
|
||||
@@ -216,7 +216,7 @@ impl cumulus_parachain_system::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub storage ParachainId: cumulus_primitives::ParaId = 100.into();
|
||||
pub storage ParachainId: cumulus_primitives_core::ParaId = 100.into();
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
@@ -230,7 +230,7 @@ construct_runtime! {
|
||||
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
Sudo: pallet_sudo::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||
ParachainSystem: cumulus_parachain_system::{Module, Call, Storage, Inherent, Event},
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{Module, Call, Storage, Inherent, Event},
|
||||
TransactionPayment: pallet_transaction_payment::{Module, Storage},
|
||||
}
|
||||
}
|
||||
@@ -371,4 +371,4 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_runtime::register_validate_block!(Block, Executive);
|
||||
cumulus_pallet_parachain_system::register_validate_block!(Block, Executive);
|
||||
|
||||
@@ -43,10 +43,10 @@ polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch
|
||||
polkadot-overseer = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
cumulus-consensus = { path = "../../consensus" }
|
||||
cumulus-network = { path = "../../network" }
|
||||
cumulus-primitives = { path = "../../primitives" }
|
||||
cumulus-service = { path = "../../service" }
|
||||
cumulus-client-consensus = { path = "../../client/consensus" }
|
||||
cumulus-client-network = { path = "../../client/network" }
|
||||
cumulus-client-service = { path = "../../client/service" }
|
||||
cumulus-primitives-core = { path = "../../primitives/core" }
|
||||
cumulus-test-runtime = { path = "../runtime" }
|
||||
|
||||
# RPC related dependencies
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use cumulus_primitives::ParaId;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use cumulus_test_runtime::{AccountId, Signature};
|
||||
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
|
||||
use sc_service::ChainType;
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use codec::Encode;
|
||||
use cumulus_primitives::{genesis::generate_genesis_block, ParaId};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use cumulus_client_service::genesis::generate_genesis_block;
|
||||
use cumulus_test_runtime::Block;
|
||||
use polkadot_primitives::v0::HeadData;
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
|
||||
@@ -26,9 +26,9 @@ pub use cumulus_test_runtime as runtime;
|
||||
pub use genesis::*;
|
||||
|
||||
use core::future::Future;
|
||||
use cumulus_network::BlockAnnounceValidator;
|
||||
use cumulus_primitives::ParaId;
|
||||
use cumulus_service::{
|
||||
use cumulus_client_network::BlockAnnounceValidator;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use cumulus_client_service::{
|
||||
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
||||
};
|
||||
use cumulus_test_runtime::{NodeBlock as Block, RuntimeApi};
|
||||
@@ -93,7 +93,7 @@ pub fn new_partial(
|
||||
client.clone(),
|
||||
);
|
||||
|
||||
let import_queue = cumulus_consensus::import_queue::import_queue(
|
||||
let import_queue = cumulus_client_consensus::import_queue::import_queue(
|
||||
client.clone(),
|
||||
client.clone(),
|
||||
inherent_data_providers.clone(),
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use cumulus_primitives::ParaId;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use cumulus_test_service::initial_head_data;
|
||||
use futures::join;
|
||||
use sc_service::TaskExecutor;
|
||||
|
||||
Reference in New Issue
Block a user