mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 00:37:57 +00:00
Moves node-template into substrate repo (#1637)
* Make runtime macros work without required `macro_use` * Adds node-template * Adds node-template-release tool * Fixes building `node-template` and improve the release * Add `profile.release` by release script to remove warning * Adds script for releasing the node template * Fixes compilation after master merge * Port node-template to edition 2018 * Remove license * Fixes compilation after master merge * Add `node-template-release.sh` into the CI * WIP Ci integrate node template (#1701) * copy artifacts to s3 bucket latest path * typo * bucket name * Update wasm files
This commit is contained in:
+37
-20
@@ -107,10 +107,11 @@ build:rust:linux:release: &build
|
||||
- mkdir -p ./artifacts
|
||||
- mv ./target/release/substrate ./artifacts/.
|
||||
- echo -n "Substrate version = "
|
||||
- ./artifacts/substrate --version |
|
||||
- ./artifacts/substrate --version |
|
||||
sed -n -r 's/^substrate ([0-9.]+.*-[0-9a-f]{7,13})-.*$/\1/p' |
|
||||
tee ./artifacts/VERSION
|
||||
- sha256sum ./artifacts/substrate | tee ./artifacts/substrate.sha256
|
||||
- ./scripts/node-template-release.sh ./artifacts/substrate-node-template.tar.gz
|
||||
|
||||
|
||||
|
||||
@@ -169,6 +170,27 @@ publish:docker:release:
|
||||
- docker logout
|
||||
|
||||
|
||||
|
||||
|
||||
# configures aws for fast uploads/syncs
|
||||
.s3_before_script: &s3_before_script
|
||||
before_script:
|
||||
- mkdir -p ${HOME}/.aws
|
||||
- |
|
||||
cat > ${HOME}/.aws/config <<EOC
|
||||
[default]
|
||||
s3 =
|
||||
max_concurrent_requests = 20
|
||||
max_queue_size = 10000
|
||||
multipart_threshold = 64MB
|
||||
multipart_chunksize = 16MB
|
||||
max_bandwidth = 50MB/s
|
||||
use_accelerate_endpoint = false
|
||||
addressing_style = path
|
||||
EOC
|
||||
|
||||
|
||||
|
||||
publish:s3:release:
|
||||
<<: *publish_build
|
||||
image: parity/awscli:latest
|
||||
@@ -176,10 +198,19 @@ publish:s3:release:
|
||||
GIT_STRATEGY: none
|
||||
BUCKET: "releases.parity.io"
|
||||
PREFIX: "substrate/${ARCH}-${DOCKER_OS}"
|
||||
<<: *s3_before_script
|
||||
script:
|
||||
- aws s3 sync ./artifacts/ s3://${BUCKET}/${PREFIX}/$(cat ./artifacts/VERSION)/
|
||||
- echo "update objects in latest path"
|
||||
- for file in ./artifacts/*; do
|
||||
name="$(basename ${file})";
|
||||
aws s3api copy-object
|
||||
--copy-source ${BUCKET}/${PREFIX}/$(cat ./artifacts/VERSION)/${name}
|
||||
--bucket ${BUCKET} --key ${PREFIX}/latest/${name};
|
||||
done
|
||||
after_script:
|
||||
- aws s3 ls s3://${BUCKET}/${PREFIX}/
|
||||
- aws s3 ls s3://${BUCKET}/${PREFIX}/latest/
|
||||
--recursive --human-readable --summarize
|
||||
tags:
|
||||
- linux-docker
|
||||
|
||||
@@ -199,26 +230,12 @@ publish:s3:doc:
|
||||
GIT_STRATEGY: none
|
||||
BUCKET: "releases.parity.io"
|
||||
PREFIX: "substrate-rustdoc"
|
||||
before_script:
|
||||
- mkdir -p ${HOME}/.aws
|
||||
- |
|
||||
cat > ${HOME}/.aws/config <<EOC
|
||||
[default]
|
||||
s3 =
|
||||
max_concurrent_requests = 20
|
||||
max_queue_size = 10000
|
||||
multipart_threshold = 64MB
|
||||
multipart_chunksize = 16MB
|
||||
max_bandwidth = 50MB/s
|
||||
use_accelerate_endpoint = false
|
||||
addressing_style = path
|
||||
EOC
|
||||
<<: *s3_before_script
|
||||
script:
|
||||
- aws s3 sync --delete --size-only --only-show-errors ./crate-docs/ s3://${BUCKET}/${PREFIX}/
|
||||
- aws s3 sync --delete --size-only --only-show-errors
|
||||
./crate-docs/ s3://${BUCKET}/${PREFIX}/
|
||||
after_script:
|
||||
- aws s3 ls s3://${BUCKET}/${PREFIX}/
|
||||
--human-readable --summarize
|
||||
tags:
|
||||
- linux-docker
|
||||
|
||||
|
||||
|
||||
|
||||
Generated
+84
-28
@@ -935,6 +935,11 @@ dependencies = [
|
||||
"tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hash-db"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "hash-db"
|
||||
version = "0.11.0"
|
||||
@@ -1698,24 +1703,6 @@ name = "make-cmd"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "mashup"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mashup-impl"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.8"
|
||||
@@ -1982,6 +1969,64 @@ dependencies = [
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "node-template"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"node-executor 0.1.0",
|
||||
"node-template-runtime 0.9.0",
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-io 0.1.0",
|
||||
"substrate-basic-authorship 0.1.0",
|
||||
"substrate-cli 0.3.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-consensus-aura 0.1.0",
|
||||
"substrate-executor 0.1.0",
|
||||
"substrate-inherents 0.1.0",
|
||||
"substrate-network 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
"substrate-service 0.3.0",
|
||||
"substrate-transaction-pool 0.1.0",
|
||||
"tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "node-template-runtime"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.85 (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-aura 0.1.0",
|
||||
"srml-balances 0.1.0",
|
||||
"srml-consensus 0.1.0",
|
||||
"srml-executive 0.1.0",
|
||||
"srml-indices 0.1.0",
|
||||
"srml-sudo 0.1.0",
|
||||
"srml-support 0.1.0",
|
||||
"srml-system 0.1.0",
|
||||
"srml-timestamp 0.1.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-consensus-aura-primitives 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nodrop"
|
||||
version = "0.1.13"
|
||||
@@ -2172,6 +2217,15 @@ dependencies = [
|
||||
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.5.5"
|
||||
@@ -3261,7 +3315,6 @@ name = "srml-support"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -3631,13 +3684,7 @@ dependencies = [
|
||||
name = "substrate-consensus-aura-primitives"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-io 0.1.0",
|
||||
"sr-primitives 0.1.0",
|
||||
"sr-version 0.1.0",
|
||||
"srml-support 0.1.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4492,6 +4539,14 @@ dependencies = [
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trie-root"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trie-root"
|
||||
version = "0.11.0"
|
||||
@@ -4530,7 +4585,7 @@ name = "twox-hash"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4962,6 +5017,7 @@ dependencies = [
|
||||
"checksum globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4743617a7464bbda3c8aec8558ff2f9429047e025771037df561d383337ff865"
|
||||
"checksum h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb2b25a33e231484694267af28fec74ac63b5ccf51ee2065a5e313b834d836e"
|
||||
"checksum hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b03501f6e1a2a97f1618879aba3156f14ca2847faa530c4e28859638bd11483"
|
||||
"checksum hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc5ec43724866bbc8337e09cab4d4b5f9fdbbe589f04bdc8bfda906a639ad338"
|
||||
"checksum hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5c13dbac3cc50684760f54af18545c9e80fb75e93a3e586d71ebdc13138f6a4"
|
||||
"checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461"
|
||||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||
@@ -5028,8 +5084,6 @@ dependencies = [
|
||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||
"checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21"
|
||||
"checksum make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3"
|
||||
"checksum mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f2d82b34c7fb11bb41719465c060589e291d505ca4735ea30016a91f6fc79c3b"
|
||||
"checksum mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "aa607bfb674b4efb310512527d64266b065de3f894fc52f84efcbf7eaa5965fb"
|
||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8"
|
||||
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
|
||||
@@ -5067,6 +5121,7 @@ dependencies = [
|
||||
"checksum parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e8eab0287ccde7821e337a124dc5a4f1d6e4c25d10cc91e3f9361615dd95076"
|
||||
"checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc"
|
||||
"checksum parity-ws 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2fec5048fba72a2e01baeb0d08089db79aead4b57e2443df172fb1840075a233"
|
||||
"checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e"
|
||||
"checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac"
|
||||
"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
|
||||
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
|
||||
@@ -5200,6 +5255,7 @@ dependencies = [
|
||||
"checksum trie-bench 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77087d1bce467cf8371a5c0e10e4d925b065ec6cfad8b9cdff1fad4f218c6750"
|
||||
"checksum trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7319e28ca295f27359d944a682f7f65b419158bf1590c92cadc0000258d788"
|
||||
"checksum trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c6fef2705af3258ec46a7e22286090394a44216201a1cf7d04b78db825e543"
|
||||
"checksum trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6294c313431d8bd2dda88db3a57550c4911dd6f7f0e8be6001e23c1e6cbdcf1b"
|
||||
"checksum trie-standardmap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e4729504b8102acb1bef3f16e6b64d41aeb1ff0e329081451e8191df0f61ab2"
|
||||
"checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
|
||||
"checksum twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1"
|
||||
|
||||
@@ -78,6 +78,7 @@ members = [
|
||||
"node/executor",
|
||||
"node/primitives",
|
||||
"node/runtime",
|
||||
"node-template",
|
||||
"subkey",
|
||||
]
|
||||
exclude = [
|
||||
|
||||
@@ -6,22 +6,10 @@ description = "Primitives for Aura consensus"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
parity-codec = { version = "3.0", default-features = false }
|
||||
substrate-client = { path = "../../../client", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../../../primitives", default-features = false }
|
||||
runtime_support = { package = "srml-support", path = "../../../../srml/support", default-features = false }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../../sr-primitives", default-features = false }
|
||||
sr-version = { path = "../../../sr-version", default-features = false }
|
||||
runtime_io = { package = "sr-io", path = "../../../sr-io", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"parity-codec/std",
|
||||
"substrate-client/std",
|
||||
"primitives/std",
|
||||
"runtime_support/std",
|
||||
"runtime_primitives/std",
|
||||
"sr-version/std",
|
||||
"runtime_io/std",
|
||||
]
|
||||
|
||||
@@ -342,7 +342,7 @@ macro_rules! __impl_outer_config_types {
|
||||
) => {
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub type $config = $snake::GenesisConfig<$concrete>;
|
||||
__impl_outer_config_types! {$concrete $($rest)*}
|
||||
$crate::__impl_outer_config_types! {$concrete $($rest)*}
|
||||
};
|
||||
(
|
||||
$concrete:ident $config:ident $snake:ident $( $rest:tt )*
|
||||
@@ -367,7 +367,7 @@ macro_rules! impl_outer_config {
|
||||
$( $config:ident => $snake:ident $( < $generic:ident > )*, )*
|
||||
}
|
||||
) => {
|
||||
__impl_outer_config_types! { $concrete $( $config $snake $( < $generic > )* )* }
|
||||
$crate::__impl_outer_config_types! { $concrete $( $config $snake $( < $generic > )* )* }
|
||||
#[cfg(any(feature = "std", test))]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
-27
@@ -438,24 +438,6 @@ dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mashup"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mashup-impl"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.8"
|
||||
@@ -1085,7 +1067,6 @@ name = "srml-support"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1174,13 +1155,7 @@ dependencies = [
|
||||
name = "substrate-consensus-aura-primitives"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-io 0.1.0",
|
||||
"sr-primitives 0.1.0",
|
||||
"sr-version 0.1.0",
|
||||
"srml-support 0.1.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1772,8 +1747,6 @@ dependencies = [
|
||||
"checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a"
|
||||
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
|
||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||
"checksum mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f2d82b34c7fb11bb41719465c060589e291d505ca4735ea30016a91f6fc79c3b"
|
||||
"checksum mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "aa607bfb674b4efb310512527d64266b065de3f894fc52f84efcbf7eaa5965fb"
|
||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
|
||||
"checksum memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94da53143d45f6bad3753f532e56ad57a6a26c0ca6881794583310c7cb4c885f"
|
||||
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,39 @@
|
||||
[package]
|
||||
name = "node-template"
|
||||
version = "0.9.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
name = "template-node"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
error-chain = "0.12"
|
||||
futures = "0.1"
|
||||
ctrlc = { version = "3.0", features = ["termination"] }
|
||||
log = "0.4"
|
||||
tokio = "0.1"
|
||||
exit-future = "0.1"
|
||||
parking_lot = "0.4"
|
||||
hex-literal = "0.1"
|
||||
slog = "^2"
|
||||
parity-codec = "3.0"
|
||||
trie-root = "0.9"
|
||||
sr-io = { path = "../core/sr-io" }
|
||||
substrate-cli = { path = "../core/cli" }
|
||||
primitives = { package = "substrate-primitives", path = "../core/primitives" }
|
||||
substrate-executor = { path = "../core/executor" }
|
||||
substrate-service = { path = "../core/service" }
|
||||
inherents = { package = "substrate-inherents", path = "../core/inherents" }
|
||||
transaction-pool = { package = "substrate-transaction-pool", path = "../core/transaction-pool" }
|
||||
substrate-network = { path = "../core/network" }
|
||||
consensus = { package = "substrate-consensus-aura", path = "../core/consensus/aura" }
|
||||
substrate-client = { path = "../core/client" }
|
||||
basic-authorship = { package = "substrate-basic-authorship", path = "../core/basic-authorship" }
|
||||
node-template-runtime = { path = "runtime" }
|
||||
node-executor = { path = "../node/executor" }
|
||||
|
||||
[build-dependencies]
|
||||
vergen = "3"
|
||||
@@ -0,0 +1,24 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org>
|
||||
@@ -0,0 +1,3 @@
|
||||
# Template Node
|
||||
|
||||
A new SRML-based Substrate node, ready for hacking.
|
||||
@@ -0,0 +1,8 @@
|
||||
use vergen::{ConstantsFlags, generate_cargo_keys};
|
||||
|
||||
const ERROR_MSG: &'static str = "Failed to generate metadata files";
|
||||
|
||||
fn main() {
|
||||
generate_cargo_keys(ConstantsFlags::all()).expect(ERROR_MSG);
|
||||
println!("cargo:rerun-if-changed=.git/HEAD");
|
||||
}
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
export CARGO_INCREMENTAL=0
|
||||
|
||||
bold=$(tput bold)
|
||||
normal=$(tput sgr0)
|
||||
|
||||
# Save current directory.
|
||||
pushd . >/dev/null
|
||||
|
||||
for SRC in runtime/wasm
|
||||
do
|
||||
echo "${bold}Building webassembly binary in $SRC...${normal}"
|
||||
cd "$PROJECT_ROOT/$SRC"
|
||||
|
||||
./build.sh
|
||||
|
||||
cd - >> /dev/null
|
||||
done
|
||||
|
||||
# Restore initial directory.
|
||||
popd >/dev/null
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "*** Initialising WASM build environment"
|
||||
|
||||
if [ -z $CI_PROJECT_NAME ] ; then
|
||||
rustup update nightly
|
||||
rustup update stable
|
||||
fi
|
||||
|
||||
rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||
|
||||
# Install wasm-gc. It's useful for stripping slimming down wasm binaries.
|
||||
command -v wasm-gc || \
|
||||
cargo +nightly install --git https://github.com/alexcrichton/wasm-gc --force
|
||||
@@ -0,0 +1,53 @@
|
||||
[package]
|
||||
name = "node-template-runtime"
|
||||
version = "0.9.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", default-features = false }
|
||||
serde_derive = { version = "1.0", optional = true }
|
||||
safe-mix = { version = "1.0", default-features = false }
|
||||
parity-codec = { version = "3.0", default-features = false }
|
||||
parity-codec-derive = { version = "3.0", default-features = false }
|
||||
rstd = { package = "sr-std", path = "../../core/sr-std", default_features = false }
|
||||
runtime-io = { package = "sr-io", path = "../../core/sr-io", default_features = false }
|
||||
version = { package = "sr-version", path = "../../core/sr-version", default_features = false }
|
||||
support = { package = "srml-support", path = "../../srml/support", default_features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../../core/primitives", default_features = false }
|
||||
balances = { package = "srml-balances", path = "../../srml/balances", default_features = false }
|
||||
consensus = { package = "srml-consensus", path = "../../srml/consensus", default_features = false }
|
||||
aura = { package = "srml-aura", path = "../../srml/aura", default_features = false }
|
||||
executive = { package = "srml-executive", path = "../../srml/executive", default_features = false }
|
||||
indices = { package = "srml-indices", path = "../../srml/indices", default_features = false }
|
||||
system = { package = "srml-system", path = "../../srml/system", default_features = false }
|
||||
timestamp = { package = "srml-timestamp", path = "../../srml/timestamp", default_features = false }
|
||||
sudo = { package = "srml-sudo", path = "../../srml/sudo", default_features = false }
|
||||
runtime-primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default_features = false }
|
||||
substrate-client = { path = "../../core/client", default_features = false }
|
||||
consensus-aura = { package = "substrate-consensus-aura-primitives", path = "../../core/consensus/aura/primitives", default_features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"parity-codec/std",
|
||||
"parity-codec-derive/std",
|
||||
"primitives/std",
|
||||
"substrate-client/std",
|
||||
"rstd/std",
|
||||
"runtime-io/std",
|
||||
"support/std",
|
||||
"balances/std",
|
||||
"executive/std",
|
||||
"aura/std",
|
||||
"indices/std",
|
||||
"primitives/std",
|
||||
"system/std",
|
||||
"timestamp/std",
|
||||
"sudo/std",
|
||||
"version/std",
|
||||
"serde_derive",
|
||||
"serde/std",
|
||||
"safe-mix/std",
|
||||
"consensus-aura/std",
|
||||
]
|
||||
@@ -0,0 +1,268 @@
|
||||
//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
|
||||
#![recursion_limit="256"]
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use substrate_client as client;
|
||||
|
||||
#[macro_use]
|
||||
extern crate parity_codec_derive;
|
||||
|
||||
use rstd::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
use primitives::bytes;
|
||||
use primitives::{Ed25519AuthorityId, OpaqueMetadata};
|
||||
use runtime_primitives::{
|
||||
ApplyResult, transaction_validity::TransactionValidity, Ed25519Signature, generic,
|
||||
traits::{self, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str
|
||||
};
|
||||
use client::{
|
||||
block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api},
|
||||
runtime_api, impl_runtime_apis
|
||||
};
|
||||
use version::RuntimeVersion;
|
||||
#[cfg(feature = "std")]
|
||||
use version::NativeVersion;
|
||||
|
||||
// A few exports that help ease life for downstream crates.
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use runtime_primitives::BuildStorage;
|
||||
pub use consensus::Call as ConsensusCall;
|
||||
pub use timestamp::Call as TimestampCall;
|
||||
pub use balances::Call as BalancesCall;
|
||||
pub use runtime_primitives::{Permill, Perbill};
|
||||
pub use timestamp::BlockPeriod;
|
||||
pub use support::{StorageValue, construct_runtime};
|
||||
|
||||
/// Alias to Ed25519 pubkey that identifies an account on the chain.
|
||||
pub type AccountId = primitives::H256;
|
||||
|
||||
/// A hash of some data used by the chain.
|
||||
pub type Hash = primitives::H256;
|
||||
|
||||
/// Index of a block number in the chain.
|
||||
pub type BlockNumber = u64;
|
||||
|
||||
/// Index of an account's extrinsic in the chain.
|
||||
pub type Nonce = u64;
|
||||
|
||||
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
|
||||
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
|
||||
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
|
||||
/// to even the core datastructures.
|
||||
pub mod opaque {
|
||||
use super::*;
|
||||
|
||||
/// Opaque, encoded, unchecked extrinsic.
|
||||
#[derive(PartialEq, Eq, Clone, Default, Encode, Decode)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
|
||||
pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
|
||||
impl traits::Extrinsic for UncheckedExtrinsic {
|
||||
fn is_signed(&self) -> Option<bool> {
|
||||
None
|
||||
}
|
||||
}
|
||||
/// Opaque block header type.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256, generic::DigestItem<Hash, Ed25519AuthorityId>>;
|
||||
/// Opaque block type.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// Opaque block identifier type.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// Opaque session key type.
|
||||
pub type SessionKey = Ed25519AuthorityId;
|
||||
}
|
||||
|
||||
/// This runtime version.
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("template-node"),
|
||||
impl_name: create_runtime_str!("template-node"),
|
||||
authoring_version: 3,
|
||||
spec_version: 3,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
};
|
||||
|
||||
/// The version infromation used to identify this runtime when compiled natively.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn native_version() -> NativeVersion {
|
||||
NativeVersion {
|
||||
runtime_version: VERSION,
|
||||
can_author_with: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
impl system::Trait for Runtime {
|
||||
/// The identifier used to distinguish between accounts.
|
||||
type AccountId = AccountId;
|
||||
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
||||
type Lookup = Indices;
|
||||
/// The index type for storing how many extrinsics an account has signed.
|
||||
type Index = Nonce;
|
||||
/// The index type for blocks.
|
||||
type BlockNumber = BlockNumber;
|
||||
/// The type for hashing blocks and tries.
|
||||
type Hash = Hash;
|
||||
/// The hashing algorithm used.
|
||||
type Hashing = BlakeTwo256;
|
||||
/// The header digest type.
|
||||
type Digest = generic::Digest<Log>;
|
||||
/// The header type.
|
||||
type Header = generic::Header<BlockNumber, BlakeTwo256, Log>;
|
||||
/// The ubiquitous event type.
|
||||
type Event = Event;
|
||||
/// The ubiquitous log type.
|
||||
type Log = Log;
|
||||
/// The ubiquitous origin type.
|
||||
type Origin = Origin;
|
||||
}
|
||||
|
||||
impl aura::Trait for Runtime {
|
||||
type HandleReport = ();
|
||||
}
|
||||
|
||||
impl consensus::Trait for Runtime {
|
||||
/// The identifier we use to refer to authorities.
|
||||
type SessionKey = Ed25519AuthorityId;
|
||||
// The aura module handles offline-reports internally
|
||||
// rather than using an explicit report system.
|
||||
type InherentOfflineReport = ();
|
||||
/// The ubiquitous log type.
|
||||
type Log = Log;
|
||||
}
|
||||
|
||||
impl indices::Trait for Runtime {
|
||||
/// The type for recording indexing into the account enumeration. If this ever overflows, there
|
||||
/// will be problems!
|
||||
type AccountIndex = u32;
|
||||
/// Use the standard means of resolving an index hint from an id.
|
||||
type ResolveHint = indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
|
||||
/// Determine whether an account is dead.
|
||||
type IsDeadAccount = Balances;
|
||||
/// The uniquitous event type.
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl timestamp::Trait for Runtime {
|
||||
/// A timestamp: seconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = Aura;
|
||||
}
|
||||
|
||||
impl balances::Trait for Runtime {
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = u128;
|
||||
/// What to do if an account's free balance gets zeroed.
|
||||
type OnFreeBalanceZero = ();
|
||||
/// What to do if a new account is created.
|
||||
type OnNewAccount = Indices;
|
||||
/// Restrict whether an account can transfer funds. We don't place any further restrictions.
|
||||
type EnsureAccountLiquid = ();
|
||||
/// The uniquitous event type.
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl sudo::Trait for Runtime {
|
||||
/// The uniquitous event type.
|
||||
type Event = Event;
|
||||
type Proposal = Call;
|
||||
}
|
||||
|
||||
construct_runtime!(
|
||||
pub enum Runtime with Log(InternalLog: DigestItem<Hash, Ed25519AuthorityId>) where
|
||||
Block = Block,
|
||||
NodeBlock = opaque::Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{default, Log(ChangesTrieRoot)},
|
||||
Timestamp: timestamp::{Module, Call, Storage, Config<T>, Inherent},
|
||||
Consensus: consensus::{Module, Call, Storage, Config<T>, Log(AuthoritiesChange), Inherent},
|
||||
Aura: aura::{Module},
|
||||
Indices: indices,
|
||||
Balances: balances,
|
||||
Sudo: sudo,
|
||||
}
|
||||
);
|
||||
|
||||
/// The type used as a helper for interpreting the sender of transactions.
|
||||
type Context = system::ChainContext<Runtime>;
|
||||
/// The address format for describing accounts.
|
||||
type Address = <Indices as StaticLookup>::Source;
|
||||
/// Block header type as expected by this runtime.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256, Log>;
|
||||
/// Block type as expected by this runtime.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// BlockId type as expected by this runtime.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic<Address, Nonce, Call, Ed25519Signature>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Nonce, Call>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = executive::Executive<Runtime, Block, Context, Balances, AllModules>;
|
||||
|
||||
// Implement our runtime API endpoints. This is just a bunch of proxying.
|
||||
impl_runtime_apis! {
|
||||
impl runtime_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
VERSION
|
||||
}
|
||||
|
||||
fn authorities() -> Vec<Ed25519AuthorityId> {
|
||||
Consensus::authorities()
|
||||
}
|
||||
|
||||
fn execute_block(block: Block) {
|
||||
Executive::execute_block(block)
|
||||
}
|
||||
|
||||
fn initialise_block(header: &<Block as BlockT>::Header) {
|
||||
Executive::initialise_block(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl runtime_api::Metadata<Block> for Runtime {
|
||||
fn metadata() -> OpaqueMetadata {
|
||||
Runtime::metadata().into()
|
||||
}
|
||||
}
|
||||
|
||||
impl block_builder_api::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult {
|
||||
Executive::apply_extrinsic(extrinsic)
|
||||
}
|
||||
|
||||
fn finalise_block() -> <Block as BlockT>::Header {
|
||||
Executive::finalise_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
|
||||
fn random_seed() -> <Block as BlockT>::Hash {
|
||||
System::random_seed()
|
||||
}
|
||||
}
|
||||
|
||||
impl runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
||||
Executive::validate_transaction(tx)
|
||||
}
|
||||
}
|
||||
|
||||
impl consensus_aura::AuraApi<Block> for Runtime {
|
||||
fn slot_duration() -> u64 {
|
||||
Aura::slot_duration()
|
||||
}
|
||||
}
|
||||
}
|
||||
+2079
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
[package]
|
||||
name = "node-template-runtime-wasm"
|
||||
version = "0.9.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
node-template-runtime = { path = "..", default-features = false }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
std = [
|
||||
"node-template-runtime/std",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
lto = true
|
||||
|
||||
[workspace]
|
||||
members = []
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if cargo --version | grep -q "nightly"; then
|
||||
CARGO_CMD="cargo"
|
||||
else
|
||||
CARGO_CMD="cargo +nightly"
|
||||
fi
|
||||
$CARGO_CMD build --target=wasm32-unknown-unknown --release
|
||||
for i in node_template_runtime_wasm
|
||||
do
|
||||
wasm-gc target/wasm32-unknown-unknown/release/$i.wasm target/wasm32-unknown-unknown/release/$i.compact.wasm
|
||||
done
|
||||
@@ -0,0 +1,5 @@
|
||||
//! The Substrate node template runtime reexported for WebAssembly compile.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub use node_template_runtime::*;
|
||||
@@ -0,0 +1,104 @@
|
||||
use primitives::{Ed25519AuthorityId, ed25519};
|
||||
use node_template_runtime::{
|
||||
AccountId, GenesisConfig, ConsensusConfig, TimestampConfig, BalancesConfig,
|
||||
SudoConfig, IndicesConfig
|
||||
};
|
||||
use substrate_service;
|
||||
|
||||
// Note this is the URL for the telemetry server
|
||||
//const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
||||
|
||||
/// Specialised `ChainSpec`. This is a specialisation of the general Substrate ChainSpec type.
|
||||
pub type ChainSpec = substrate_service::ChainSpec<GenesisConfig>;
|
||||
|
||||
/// The chain specification option. This is expected to come in from the CLI and
|
||||
/// is little more than one of a number of alternatives which can easily be converted
|
||||
/// from a string (`--chain=...`) into a `ChainSpec`.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Alternative {
|
||||
/// Whatever the current runtime is, with just Alice as an auth.
|
||||
Development,
|
||||
/// Whatever the current runtime is, with simple Alice/Bob auths.
|
||||
LocalTestnet,
|
||||
}
|
||||
|
||||
impl Alternative {
|
||||
/// Get an actual chain config from one of the alternatives.
|
||||
pub(crate) fn load(self) -> Result<ChainSpec, String> {
|
||||
Ok(match self {
|
||||
Alternative::Development => ChainSpec::from_genesis(
|
||||
"Development",
|
||||
"dev",
|
||||
|| testnet_genesis(vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().into(),
|
||||
], vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into(),
|
||||
],
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into()
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
),
|
||||
Alternative::LocalTestnet => ChainSpec::from_genesis(
|
||||
"Local Testnet",
|
||||
"local_testnet",
|
||||
|| testnet_genesis(vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().into(),
|
||||
ed25519::Pair::from_seed(b"Bob ").public().into(),
|
||||
], vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Bob ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Charlie ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Dave ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Eve ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Ferdie ").public().0.into(),
|
||||
],
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into()
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn from(s: &str) -> Option<Self> {
|
||||
match s {
|
||||
"dev" => Some(Alternative::Development),
|
||||
"" | "local" => Some(Alternative::LocalTestnet),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn testnet_genesis(initial_authorities: Vec<Ed25519AuthorityId>, endowed_accounts: Vec<AccountId>, root_key: AccountId) -> GenesisConfig {
|
||||
GenesisConfig {
|
||||
consensus: Some(ConsensusConfig {
|
||||
code: include_bytes!("../runtime/wasm/target/wasm32-unknown-unknown/release/node_template_runtime_wasm.compact.wasm").to_vec(),
|
||||
authorities: initial_authorities.clone(),
|
||||
}),
|
||||
system: None,
|
||||
timestamp: Some(TimestampConfig {
|
||||
period: 5, // 5 second block time.
|
||||
}),
|
||||
indices: Some(IndicesConfig {
|
||||
ids: endowed_accounts.clone(),
|
||||
}),
|
||||
balances: Some(BalancesConfig {
|
||||
transaction_base_fee: 1,
|
||||
transaction_byte_fee: 0,
|
||||
existential_deposit: 500,
|
||||
transfer_fee: 0,
|
||||
creation_fee: 0,
|
||||
balances: endowed_accounts.iter().map(|&k|(k, (1 << 60))).collect(),
|
||||
}),
|
||||
sudo: Some(SudoConfig {
|
||||
key: root_key,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
use crate::service;
|
||||
use futures::{future, Future, sync::oneshot};
|
||||
use std::cell::RefCell;
|
||||
use tokio::runtime::Runtime;
|
||||
pub use substrate_cli::{VersionInfo, IntoExit, error};
|
||||
use substrate_cli::{informant, parse_and_execute, NoCustom};
|
||||
use substrate_service::{ServiceFactory, Roles as ServiceRoles};
|
||||
use crate::chain_spec;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// Parse command line arguments into service configuration.
|
||||
pub fn run<I, T, E>(args: I, exit: E, version: VersionInfo) -> error::Result<()> where
|
||||
I: IntoIterator<Item = T>,
|
||||
T: Into<std::ffi::OsString> + Clone,
|
||||
E: IntoExit,
|
||||
{
|
||||
parse_and_execute::<service::Factory, NoCustom, NoCustom, _, _, _, _, _>(
|
||||
load_spec, &version, "substrate-node", args, exit,
|
||||
|exit, _custom_args, config| {
|
||||
info!("{}", version.name);
|
||||
info!(" version {}", config.full_version());
|
||||
info!(" by {}, 2017, 2018", version.author);
|
||||
info!("Chain specification: {}", config.chain_spec.name());
|
||||
info!("Node name: {}", config.name);
|
||||
info!("Roles: {:?}", config.roles);
|
||||
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
|
||||
let executor = runtime.executor();
|
||||
match config.roles {
|
||||
ServiceRoles::LIGHT => run_until_exit(
|
||||
runtime,
|
||||
service::Factory::new_light(config, executor).map_err(|e| format!("{:?}", e))?,
|
||||
exit
|
||||
),
|
||||
_ => run_until_exit(
|
||||
runtime,
|
||||
service::Factory::new_full(config, executor).map_err(|e| format!("{:?}", e))?,
|
||||
exit
|
||||
),
|
||||
}.map_err(|e| format!("{:?}", e))
|
||||
}
|
||||
).map_err(Into::into).map(|_| ())
|
||||
}
|
||||
|
||||
fn load_spec(id: &str) -> Result<Option<chain_spec::ChainSpec>, String> {
|
||||
Ok(match chain_spec::Alternative::from(id) {
|
||||
Some(spec) => Some(spec.load()?),
|
||||
None => None,
|
||||
})
|
||||
}
|
||||
|
||||
fn run_until_exit<T, C, E>(
|
||||
mut runtime: Runtime,
|
||||
service: T,
|
||||
e: E,
|
||||
) -> error::Result<()>
|
||||
where
|
||||
T: Deref<Target=substrate_service::Service<C>>,
|
||||
C: substrate_service::Components,
|
||||
E: IntoExit,
|
||||
{
|
||||
let (exit_send, exit) = exit_future::signal();
|
||||
|
||||
let executor = runtime.executor();
|
||||
informant::start(&service, exit.clone(), executor.clone());
|
||||
|
||||
let _ = runtime.block_on(e.into_exit());
|
||||
exit_send.fire();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// handles ctrl-c
|
||||
pub struct Exit;
|
||||
impl IntoExit for Exit {
|
||||
type Exit = future::MapErr<oneshot::Receiver<()>, fn(oneshot::Canceled) -> ()>;
|
||||
fn into_exit(self) -> Self::Exit {
|
||||
// can't use signal directly here because CtrlC takes only `Fn`.
|
||||
let (exit_send, exit) = oneshot::channel();
|
||||
|
||||
let exit_send_cell = RefCell::new(Some(exit_send));
|
||||
ctrlc::set_handler(move || {
|
||||
if let Some(exit_send) = exit_send_cell.try_borrow_mut().expect("signal handler not reentrant; qed").take() {
|
||||
exit_send.send(()).expect("Error sending exit notification");
|
||||
}
|
||||
}).expect("Error setting Ctrl-C handler");
|
||||
|
||||
exit.map_err(drop)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//! Initialization errors.
|
||||
|
||||
use client;
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
Io(::std::io::Error) #[doc="IO error"];
|
||||
Cli(::clap::Error) #[doc="CLI error"];
|
||||
}
|
||||
links {
|
||||
Client(client::error::Error, client::error::ErrorKind) #[doc="Client error"];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//! Substrate Node Template CLI library.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![warn(unused_extern_crates)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate error_chain;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate substrate_network as network;
|
||||
#[macro_use]
|
||||
extern crate substrate_executor;
|
||||
#[macro_use]
|
||||
extern crate substrate_service;
|
||||
|
||||
mod chain_spec;
|
||||
mod service;
|
||||
mod cli;
|
||||
|
||||
pub use substrate_cli::{VersionInfo, IntoExit, error};
|
||||
|
||||
fn run() -> cli::error::Result<()> {
|
||||
let version = VersionInfo {
|
||||
name: "Substrate Node",
|
||||
commit: env!("VERGEN_SHA_SHORT"),
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
executable_name: "template-node",
|
||||
author: "Anonymous",
|
||||
description: "Template Node",
|
||||
support_url: "support.anonymous.an",
|
||||
};
|
||||
cli::run(::std::env::args(), cli::Exit, version)
|
||||
}
|
||||
|
||||
quick_main!(run);
|
||||
@@ -0,0 +1,112 @@
|
||||
//! Service and ServiceFactory implementation. Specialized wrapper over Substrate service.
|
||||
|
||||
#![warn(unused_extern_crates)]
|
||||
|
||||
use std::sync::Arc;
|
||||
use transaction_pool::{self, txpool::{Pool as TransactionPool}};
|
||||
use node_template_runtime::{self, GenesisConfig, opaque::Block, RuntimeApi};
|
||||
use substrate_service::{
|
||||
FactoryFullConfiguration, LightComponents, FullComponents, FullBackend,
|
||||
FullClient, LightClient, LightBackend, FullExecutor, LightExecutor,
|
||||
TaskExecutor,
|
||||
};
|
||||
use basic_authorship::ProposerFactory;
|
||||
use node_executor;
|
||||
use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration, NothingExtra};
|
||||
use substrate_client as client;
|
||||
use primitives::ed25519::Pair;
|
||||
use inherents::InherentDataProviders;
|
||||
|
||||
pub use substrate_executor::NativeExecutor;
|
||||
// Our native executor instance.
|
||||
native_executor_instance!(
|
||||
pub Executor,
|
||||
node_template_runtime::api::dispatch,
|
||||
node_template_runtime::native_version,
|
||||
include_bytes!("../runtime/wasm/target/wasm32-unknown-unknown/release/node_template_runtime_wasm.compact.wasm")
|
||||
);
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct NodeConfig {
|
||||
inherent_data_providers: InherentDataProviders,
|
||||
}
|
||||
|
||||
construct_simple_protocol! {
|
||||
/// Demo protocol attachment for substrate.
|
||||
pub struct NodeProtocol where Block = Block { }
|
||||
}
|
||||
|
||||
construct_service_factory! {
|
||||
struct Factory {
|
||||
Block = Block,
|
||||
RuntimeApi = RuntimeApi,
|
||||
NetworkProtocol = NodeProtocol { |config| Ok(NodeProtocol::new()) },
|
||||
RuntimeDispatch = node_executor::Executor,
|
||||
FullTransactionPoolApi = transaction_pool::ChainApi<client::Client<FullBackend<Self>, FullExecutor<Self>, Block, RuntimeApi>, Block>
|
||||
{ |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
|
||||
LightTransactionPoolApi = transaction_pool::ChainApi<client::Client<LightBackend<Self>, LightExecutor<Self>, Block, RuntimeApi>, Block>
|
||||
{ |config, client| Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client))) },
|
||||
Genesis = GenesisConfig,
|
||||
Configuration = NodeConfig,
|
||||
FullService = FullComponents<Self>
|
||||
{ |config: FactoryFullConfiguration<Self>, executor: TaskExecutor|
|
||||
FullComponents::<Factory>::new(config, executor)
|
||||
},
|
||||
AuthoritySetup = {
|
||||
|service: Self::FullService, executor: TaskExecutor, key: Option<Arc<Pair>>| {
|
||||
if let Some(key) = key {
|
||||
info!("Using authority key {}", key.public());
|
||||
let proposer = Arc::new(ProposerFactory {
|
||||
client: service.client(),
|
||||
transaction_pool: service.transaction_pool(),
|
||||
});
|
||||
let client = service.client();
|
||||
executor.spawn(start_aura(
|
||||
SlotDuration::get_or_compute(&*client)?,
|
||||
key.clone(),
|
||||
client.clone(),
|
||||
client,
|
||||
proposer,
|
||||
service.network(),
|
||||
service.on_exit(),
|
||||
service.config.custom.inherent_data_providers.clone(),
|
||||
)?);
|
||||
}
|
||||
|
||||
Ok(service)
|
||||
}
|
||||
},
|
||||
LightService = LightComponents<Self>
|
||||
{ |config, executor| <LightComponents<Factory>>::new(config, executor) },
|
||||
FullImportQueue = AuraImportQueue<
|
||||
Self::Block,
|
||||
FullClient<Self>,
|
||||
NothingExtra,
|
||||
>
|
||||
{ |config: &mut FactoryFullConfiguration<Self> , client: Arc<FullClient<Self>>|
|
||||
import_queue(
|
||||
SlotDuration::get_or_compute(&*client)?,
|
||||
client.clone(),
|
||||
None,
|
||||
client,
|
||||
NothingExtra,
|
||||
config.custom.inherent_data_providers.clone(),
|
||||
).map_err(Into::into)
|
||||
},
|
||||
LightImportQueue = AuraImportQueue<
|
||||
Self::Block,
|
||||
LightClient<Self>,
|
||||
NothingExtra,
|
||||
>
|
||||
{ |config: &mut FactoryFullConfiguration<Self>, client: Arc<LightClient<Self>>|
|
||||
import_queue(
|
||||
SlotDuration::get_or_compute(&*client)?,
|
||||
client.clone(),
|
||||
None,
|
||||
client,
|
||||
NothingExtra,
|
||||
config.custom.inherent_data_providers.clone(),
|
||||
).map_err(Into::into)
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,6 @@
|
||||
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
|
||||
#![recursion_limit="256"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate srml_support;
|
||||
#[macro_use]
|
||||
extern crate runtime_primitives;
|
||||
|
||||
@@ -29,6 +27,7 @@ use rstd::prelude::*;
|
||||
use parity_codec_derive::{Encode, Decode};
|
||||
#[cfg(feature = "std")]
|
||||
use srml_support::{Serialize, Deserialize};
|
||||
use srml_support::construct_runtime;
|
||||
use substrate_primitives::u32_trait::{_2, _4};
|
||||
use node_primitives::{
|
||||
AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, SessionKey, Signature
|
||||
|
||||
Generated
-27
@@ -438,24 +438,6 @@ dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mashup"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mashup-impl"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.8"
|
||||
@@ -1386,7 +1368,6 @@ name = "srml-support"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1544,13 +1525,7 @@ dependencies = [
|
||||
name = "substrate-consensus-aura-primitives"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-io 0.1.0",
|
||||
"sr-primitives 0.1.0",
|
||||
"sr-version 0.1.0",
|
||||
"srml-support 0.1.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2124,8 +2099,6 @@ dependencies = [
|
||||
"checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a"
|
||||
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
|
||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||
"checksum mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f2d82b34c7fb11bb41719465c060589e291d505ca4735ea30016a91f6fc79c3b"
|
||||
"checksum mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "aa607bfb674b4efb310512527d64266b065de3f894fc52f84efcbf7eaa5965fb"
|
||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
|
||||
"checksum memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94da53143d45f6bad3753f532e56ad57a6a26c0ca6881794583310c7cb4c885f"
|
||||
|
||||
BIN
Binary file not shown.
@@ -6,6 +6,7 @@ ROOT=`dirname "$0"`
|
||||
SRCS=(
|
||||
"core/executor/wasm"
|
||||
"node/runtime/wasm"
|
||||
"node-template/runtime/wasm"
|
||||
"core/test-runtime/wasm"
|
||||
)
|
||||
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT=`git rev-parse --show-toplevel`
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "node-template-release.sh path_to_target_archive"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PATH_TO_ARCHIVE=$(pwd)/$1
|
||||
cd $PROJECT_ROOT/scripts/node-template-release
|
||||
|
||||
echo $PATH_TO_ARCHIVE
|
||||
cargo run $PROJECT_ROOT/node-template $PATH_TO_ARCHIVE
|
||||
@@ -0,0 +1,17 @@
|
||||
[package]
|
||||
name = "node-template-release"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
toml = "0.4"
|
||||
tar = "0.4"
|
||||
glob = "0.2"
|
||||
structopt = "0.2"
|
||||
tempfile = "3"
|
||||
fs_extra = "1"
|
||||
git2 = "0.8"
|
||||
flate2 = "1.0"
|
||||
|
||||
[workspace]
|
||||
@@ -0,0 +1,200 @@
|
||||
use structopt::StructOpt;
|
||||
|
||||
use std::{
|
||||
path::{PathBuf, Path}, collections::HashMap, fs::{File, self}, io::{Read, Write},
|
||||
process::Command
|
||||
};
|
||||
|
||||
use glob;
|
||||
|
||||
use fs_extra::dir::{self, CopyOptions};
|
||||
|
||||
use tempfile;
|
||||
|
||||
use git2;
|
||||
|
||||
use toml;
|
||||
|
||||
use tar;
|
||||
|
||||
use flate2::{write::GzEncoder, Compression};
|
||||
|
||||
const SUBSTRATE_GIT_URL: &str = "https://github.com/paritytech/substrate.git";
|
||||
|
||||
type CargoToml = HashMap<String, toml::Value>;
|
||||
|
||||
#[derive(StructOpt)]
|
||||
struct Options {
|
||||
/// The path to the `node-template` source.
|
||||
#[structopt(parse(from_os_str))]
|
||||
node_template: PathBuf,
|
||||
/// The path where to output the generated `tar.gz` file.
|
||||
#[structopt(parse(from_os_str))]
|
||||
output: PathBuf,
|
||||
}
|
||||
|
||||
/// Find all `Cargo.toml` files in the given path.
|
||||
fn find_cargo_tomls(path: PathBuf) -> Vec<PathBuf> {
|
||||
let path = format!("{}/**/*.toml", path.display());
|
||||
|
||||
let glob = glob::glob(&path).expect("Generates globbing pattern");
|
||||
|
||||
let mut result = Vec::new();
|
||||
glob.into_iter().for_each(|file| {
|
||||
match file {
|
||||
Ok(file) => result.push(file),
|
||||
Err(e) => println!("{:?}", e),
|
||||
}
|
||||
});
|
||||
|
||||
if result.is_empty() {
|
||||
panic!("Did not found any `Cargo.toml` files.");
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
/// Copy the `node-template` to the given path.
|
||||
fn copy_node_template(node_template: &Path, dest_path: &Path) {
|
||||
let options = CopyOptions::new();
|
||||
dir::copy(node_template, dest_path, &options).expect("Copies node-template to tmp dir");
|
||||
}
|
||||
|
||||
/// Gets the latest commit id of the repository given by `path`.
|
||||
fn get_git_commit_id(path: &Path) -> String {
|
||||
let repo = git2::Repository::discover(path)
|
||||
.expect(&format!("Node template ({}) should be in a git repository.", path.display()));
|
||||
|
||||
let commit_id = repo
|
||||
.head()
|
||||
.expect("Repository should have a head")
|
||||
.peel_to_commit()
|
||||
.expect("Head references a commit")
|
||||
.id();
|
||||
|
||||
format!("{}", commit_id)
|
||||
}
|
||||
|
||||
/// Parse the given `Cargo.toml` into a `HashMap`
|
||||
fn parse_cargo_toml(file: &Path) -> CargoToml {
|
||||
let mut content = String::new();
|
||||
File::open(file).expect("Cargo.toml exists").read_to_string(&mut content).expect("Reads file");
|
||||
toml::from_str(&content).expect("Cargo.toml is a valid toml file")
|
||||
}
|
||||
|
||||
/// Replaces all substrate path dependencies with a git dependency.
|
||||
fn replace_path_dependencies_with_git(cargo_toml_path: &Path, commit_id: &str, cargo_toml: &mut CargoToml) {
|
||||
let mut cargo_toml_path = cargo_toml_path.to_path_buf();
|
||||
// remove `Cargo.toml`
|
||||
cargo_toml_path.pop();
|
||||
|
||||
let mut dependencies: toml::value::Table = match cargo_toml
|
||||
.remove("dependencies")
|
||||
.and_then(|v| v.try_into().ok()) {
|
||||
Some(deps) => deps,
|
||||
None => return,
|
||||
};
|
||||
|
||||
let deps_rewritten = dependencies
|
||||
.iter()
|
||||
.filter_map(|(k, v)| v.clone().try_into::<toml::value::Table>().ok().map(move |v| (k, v)))
|
||||
.filter(|t| t.1.contains_key("path"))
|
||||
.filter(|t| {
|
||||
// if the path does not exists, we need to add this as git dependency
|
||||
t.1.get("path").unwrap().as_str().map(|path| !cargo_toml_path.join(path).exists()).unwrap_or(false)
|
||||
})
|
||||
.map(|(k, mut v)| {
|
||||
// remove `path` and add `git` and `rev`
|
||||
v.remove("path");
|
||||
v.insert("git".into(), SUBSTRATE_GIT_URL.into());
|
||||
v.insert("rev".into(), commit_id.into());
|
||||
|
||||
(k.clone(), v.into())
|
||||
}).collect::<HashMap<_, _>>();
|
||||
|
||||
dependencies.extend(deps_rewritten.into_iter());
|
||||
|
||||
cargo_toml.insert("dependencies".into(), dependencies.into());
|
||||
}
|
||||
|
||||
/// Add `profile.release` = `panic = unwind` to the given `Cargo.toml`
|
||||
fn cargo_toml_add_profile_release(cargo_toml: &mut CargoToml) {
|
||||
let mut panic_unwind = toml::value::Table::new();
|
||||
panic_unwind.insert("panic".into(), "unwind".into());
|
||||
|
||||
let mut profile = toml::value::Table::new();
|
||||
profile.insert("release".into(), panic_unwind.into());
|
||||
|
||||
cargo_toml.insert("profile".into(), profile.into());
|
||||
}
|
||||
|
||||
fn write_cargo_toml(path: &Path, cargo_toml: CargoToml) {
|
||||
let content = toml::to_string_pretty(&cargo_toml).expect("Creates `Cargo.toml`");
|
||||
let mut file = File::create(path).expect(&format!("Creates `{}`.", path.display()));
|
||||
write!(file, "{}", content).expect("Writes `Cargo.toml`");
|
||||
}
|
||||
|
||||
/// Build and test the generated node-template
|
||||
fn build_and_test(path: &Path, cargo_tomls: &[PathBuf]) {
|
||||
// Build wasm
|
||||
assert!(Command::new(path.join("build.sh")).current_dir(path).status().expect("Compiles wasm").success());
|
||||
|
||||
// Build node
|
||||
assert!(Command::new("cargo").args(&["build", "--all"]).current_dir(path).status().expect("Compiles node").success());
|
||||
|
||||
// Test node
|
||||
assert!(Command::new("cargo").args(&["test", "--all"]).current_dir(path).status().expect("Tests node").success());
|
||||
|
||||
// Remove all `target` directories
|
||||
for toml in cargo_tomls {
|
||||
let mut target_path = toml.clone();
|
||||
target_path.pop();
|
||||
target_path = target_path.join("target");
|
||||
|
||||
if target_path.exists() {
|
||||
fs::remove_dir_all(&target_path).expect(&format!("Removes `{}`", target_path.display()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let options = Options::from_args();
|
||||
|
||||
let build_dir = tempfile::tempdir().expect("Creates temp build dir");
|
||||
|
||||
let node_template_folder = options
|
||||
.node_template
|
||||
.canonicalize()
|
||||
.expect("Node template path exists")
|
||||
.file_name()
|
||||
.expect("Node template folder is last element of path")
|
||||
.to_owned();
|
||||
|
||||
// The path to the node-template in the build dir.
|
||||
let node_template_path = build_dir.path().join(node_template_folder);
|
||||
|
||||
copy_node_template(&options.node_template, build_dir.path());
|
||||
let cargo_tomls = find_cargo_tomls(build_dir.path().to_owned());
|
||||
|
||||
let commit_id = get_git_commit_id(&options.node_template);
|
||||
|
||||
cargo_tomls.iter().for_each(|t| {
|
||||
let mut cargo_toml = parse_cargo_toml(&t);
|
||||
replace_path_dependencies_with_git(&t, &commit_id, &mut cargo_toml);
|
||||
|
||||
// If this is the top-level `Cargo.toml`, add `profile.release`
|
||||
if &node_template_path.join("Cargo.toml") == t {
|
||||
cargo_toml_add_profile_release(&mut cargo_toml);
|
||||
}
|
||||
|
||||
write_cargo_toml(&t, cargo_toml);
|
||||
});
|
||||
|
||||
build_and_test(&node_template_path, &cargo_tomls);
|
||||
|
||||
let output = GzEncoder::new(File::create(&options.output)
|
||||
.expect("Creates output file"), Compression::default());
|
||||
let mut tar = tar::Builder::new(output);
|
||||
tar.append_dir_all("substrate-node-template", node_template_path)
|
||||
.expect("Writes substrate-node-template archive");
|
||||
}
|
||||
@@ -16,9 +16,8 @@ runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features =
|
||||
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
|
||||
inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false }
|
||||
srml-support-procedural = { path = "./procedural" }
|
||||
mashup = "0.1.7"
|
||||
once_cell = { version = "0.1.6", default-features = false, optional = true }
|
||||
paste = "0.1"
|
||||
once_cell = { version = "0.1.6", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "0.5.1"
|
||||
|
||||
@@ -690,13 +690,13 @@ macro_rules! decl_module {
|
||||
impl<$trait_instance: $trait_name> $crate::dispatch::Decode for $call_type<$trait_instance> {
|
||||
fn decode<I: $crate::dispatch::Input>(input: &mut I) -> Option<Self> {
|
||||
let _input_id = input.read_byte()?;
|
||||
__impl_decode!(input; _input_id; 0; $call_type; $( fn $fn_name( $( $(#[$codec_attr on type $param])* $param_name ),* ); )*)
|
||||
$crate::__impl_decode!(input; _input_id; 0; $call_type; $( fn $fn_name( $( $(#[$codec_attr on type $param])* $param_name ),* ); )*)
|
||||
}
|
||||
}
|
||||
|
||||
impl<$trait_instance: $trait_name> $crate::dispatch::Encode for $call_type<$trait_instance> {
|
||||
fn encode_to<W: $crate::dispatch::Output>(&self, _dest: &mut W) {
|
||||
__impl_encode!(_dest; *self; 0; $call_type; $( fn $fn_name( $( $(#[$codec_attr on type $param])* $param_name ),* ); )*);
|
||||
$crate::__impl_encode!(_dest; *self; 0; $call_type; $( fn $fn_name( $( $(#[$codec_attr on type $param])* $param_name ),* ); )*);
|
||||
if let $call_type::__PhantomItem(_) = *self { unreachable!() }
|
||||
if let $call_type::__OtherPhantomItem(_) = *self { unreachable!() }
|
||||
}
|
||||
@@ -710,7 +710,7 @@ macro_rules! decl_module {
|
||||
match self {
|
||||
$(
|
||||
$call_type::$fn_name( $( $param_name ),* ) => {
|
||||
decl_module!(
|
||||
$crate::decl_module!(
|
||||
@call
|
||||
$from
|
||||
$mod_type $trait_instance $fn_name _origin $system [ $( $param_name ),* ]
|
||||
@@ -755,7 +755,7 @@ macro_rules! __impl_decode {
|
||||
{
|
||||
if $input_id == ($fn_id) {
|
||||
$(
|
||||
__impl_decode!(@decode
|
||||
$crate::__impl_decode!(@decode
|
||||
$(#[$codec_attr on type $param])*
|
||||
$param_name;
|
||||
$input;
|
||||
@@ -764,7 +764,7 @@ macro_rules! __impl_decode {
|
||||
return Some($call_type:: $fn_name( $( $param_name ),* ));
|
||||
}
|
||||
|
||||
__impl_decode!($input; $input_id; $fn_id + 1; $call_type; $($rest)*)
|
||||
$crate::__impl_decode!($input; $input_id; $fn_id + 1; $call_type; $($rest)*)
|
||||
}
|
||||
};
|
||||
(
|
||||
@@ -822,7 +822,7 @@ macro_rules! __impl_encode {
|
||||
) = $self {
|
||||
$dest.push_byte(($fn_id) as u8);
|
||||
$(
|
||||
__impl_encode!(@encode_as
|
||||
$crate::__impl_encode!(@encode_as
|
||||
$(#[$codec_attr on type $param])*
|
||||
$param_name;
|
||||
$dest;
|
||||
@@ -830,7 +830,7 @@ macro_rules! __impl_encode {
|
||||
)*
|
||||
}
|
||||
|
||||
__impl_encode!($dest; $self; $fn_id + 1; $call_type; $($rest)*)
|
||||
$crate::__impl_encode!($dest; $self; $fn_id + 1; $call_type; $($rest)*)
|
||||
}
|
||||
};
|
||||
(
|
||||
@@ -887,7 +887,7 @@ macro_rules! impl_outer_dispatch {
|
||||
$camelcase ( $crate::dispatch::CallableCallFor<$camelcase> )
|
||||
,)*
|
||||
}
|
||||
__impl_outer_dispatch_common! { $call_type, $($camelcase,)* }
|
||||
$crate::__impl_outer_dispatch_common! { $call_type, $($camelcase,)* }
|
||||
impl $crate::dispatch::Dispatchable for $call_type {
|
||||
type Origin = $origin;
|
||||
type Trait = $call_type;
|
||||
@@ -923,13 +923,13 @@ macro_rules! __impl_outer_dispatch_common {
|
||||
impl $crate::dispatch::Decode for $call_type {
|
||||
fn decode<I: $crate::dispatch::Input>(input: &mut I) -> Option<Self> {
|
||||
let input_id = input.read_byte()?;
|
||||
__impl_decode!(input; input_id; 0; $call_type; $( fn $camelcase ( outer_dispatch_param ); )*)
|
||||
$crate::__impl_decode!(input; input_id; 0; $call_type; $( fn $camelcase ( outer_dispatch_param ); )*)
|
||||
}
|
||||
}
|
||||
|
||||
impl $crate::dispatch::Encode for $call_type {
|
||||
fn encode_to<W: $crate::dispatch::Output>(&self, dest: &mut W) {
|
||||
__impl_encode!(dest; *self; 0; $call_type; $( fn $camelcase( outer_dispatch_param ); )*)
|
||||
$crate::__impl_encode!(dest; *self; 0; $call_type; $( fn $camelcase( outer_dispatch_param ); )*)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -945,7 +945,7 @@ macro_rules! __dispatch_impl_metadata {
|
||||
) => {
|
||||
impl<$trait_instance: $trait_name> $mod_type<$trait_instance> {
|
||||
pub fn call_functions() -> &'static [$crate::dispatch::FunctionMetadata] {
|
||||
__call_to_functions!($($rest)*)
|
||||
$crate::__call_to_functions!($($rest)*)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -966,7 +966,7 @@ macro_rules! __call_to_functions {
|
||||
);
|
||||
)*}
|
||||
) => {
|
||||
__functions_to_metadata!(0; $origin_type;; $(
|
||||
$crate::__functions_to_metadata!(0; $origin_type;; $(
|
||||
fn $fn_name( $($(#[$codec_attr])* $param_name: $param ),* );
|
||||
$( $doc_attr ),*;
|
||||
)*)
|
||||
@@ -990,9 +990,9 @@ macro_rules! __functions_to_metadata{
|
||||
$( $fn_doc:expr ),*;
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
__functions_to_metadata!(
|
||||
$crate::__functions_to_metadata!(
|
||||
$fn_id + 1; $origin_type;
|
||||
$( $function_metadata, )* __function_to_metadata!(
|
||||
$( $function_metadata, )* $crate::__function_to_metadata!(
|
||||
fn $fn_name($( $(#[$codec_attr])* $param_name : $param ),*); $( $fn_doc ),*; $fn_id;
|
||||
);
|
||||
$($rest)*
|
||||
@@ -1025,7 +1025,7 @@ macro_rules! __function_to_metadata {
|
||||
$crate::dispatch::FunctionArgumentMetadata {
|
||||
name: $crate::dispatch::DecodeDifferent::Encode(stringify!($param_name)),
|
||||
ty: $crate::dispatch::DecodeDifferent::Encode(
|
||||
__function_to_metadata!(@stringify_expand_attr
|
||||
$crate::__function_to_metadata!(@stringify_expand_attr
|
||||
$(#[$codec_attr])* $param_name: $param
|
||||
)
|
||||
),
|
||||
|
||||
@@ -282,7 +282,7 @@ macro_rules! impl_outer_event {
|
||||
$( $rest:tt $( <$t:ident> )*, )*
|
||||
}
|
||||
) => {
|
||||
impl_outer_event!(
|
||||
$crate::impl_outer_event!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -298,7 +298,7 @@ macro_rules! impl_outer_event {
|
||||
$( $rest:tt $( <$t:ident> )*, )*
|
||||
}
|
||||
) => {
|
||||
impl_outer_event!(
|
||||
$crate::impl_outer_event!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -314,7 +314,7 @@ macro_rules! impl_outer_event {
|
||||
$( $rest:tt $( <$t:ident> )*, )*
|
||||
}
|
||||
) => {
|
||||
impl_outer_event!(
|
||||
$crate::impl_outer_event!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -334,7 +334,7 @@ macro_rules! impl_outer_event {
|
||||
};
|
||||
$( $module_name:ident::Event $( <$generic_param:ident> )*, )*;
|
||||
) => {
|
||||
impl_outer_event!(
|
||||
$crate::impl_outer_event!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -354,7 +354,7 @@ macro_rules! impl_outer_event {
|
||||
};
|
||||
$( $module_name:ident::Event $( <$generic_param:ident> )*, )*;
|
||||
) => {
|
||||
impl_outer_event!(
|
||||
$crate::impl_outer_event!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -397,7 +397,7 @@ macro_rules! impl_outer_event {
|
||||
}
|
||||
}
|
||||
)*
|
||||
__impl_outer_event_json_metadata!(
|
||||
$crate::__impl_outer_event_json_metadata!(
|
||||
$runtime;
|
||||
$name;
|
||||
$system;
|
||||
|
||||
@@ -113,9 +113,6 @@ macro_rules! assert_ok {
|
||||
#[cfg_attr(feature = "std", derive(Debug))]
|
||||
pub enum Void {}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use mashup::*;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[doc(hidden)]
|
||||
pub use serde_derive::*;
|
||||
|
||||
@@ -38,7 +38,7 @@ macro_rules! impl_runtime_metadata {
|
||||
pub fn metadata() -> $crate::metadata::RuntimeMetadataPrefixed {
|
||||
$crate::metadata::RuntimeMetadata::V1 (
|
||||
$crate::metadata::RuntimeMetadataV1 {
|
||||
modules: __runtime_modules_to_metadata!($runtime;; $( $rest )*),
|
||||
modules: $crate::__runtime_modules_to_metadata!($runtime;; $( $rest )*),
|
||||
}
|
||||
).into()
|
||||
}
|
||||
@@ -55,14 +55,14 @@ macro_rules! __runtime_modules_to_metadata {
|
||||
$mod:ident::$module:ident $(with)+ $($kw:ident)*,
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
__runtime_modules_to_metadata!(
|
||||
$crate::__runtime_modules_to_metadata!(
|
||||
$runtime;
|
||||
$( $metadata, )* $crate::metadata::ModuleMetadata {
|
||||
name: $crate::metadata::DecodeDifferent::Encode(stringify!($mod)),
|
||||
prefix: __runtime_modules_to_metadata_calls_storagename!($mod, $module, $runtime, $(with $kw)*),
|
||||
storage: __runtime_modules_to_metadata_calls_storage!($mod, $module, $runtime, $(with $kw)*),
|
||||
calls: __runtime_modules_to_metadata_calls_call!($mod, $module, $runtime, $(with $kw)*),
|
||||
event: __runtime_modules_to_metadata_calls_event!($mod, $module, $runtime, $(with $kw)*),
|
||||
prefix: $crate::__runtime_modules_to_metadata_calls_storagename!($mod, $module, $runtime, $(with $kw)*),
|
||||
storage: $crate::__runtime_modules_to_metadata_calls_storage!($mod, $module, $runtime, $(with $kw)*),
|
||||
calls: $crate::__runtime_modules_to_metadata_calls_call!($mod, $module, $runtime, $(with $kw)*),
|
||||
event: $crate::__runtime_modules_to_metadata_calls_event!($mod, $module, $runtime, $(with $kw)*),
|
||||
};
|
||||
$( $rest )*
|
||||
)
|
||||
@@ -83,7 +83,7 @@ macro_rules! __runtime_modules_to_metadata_calls_call {
|
||||
system,
|
||||
$skip_module: ident,
|
||||
$skip_runtime: ident,
|
||||
with Call
|
||||
with Call
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
None
|
||||
@@ -92,7 +92,7 @@ macro_rules! __runtime_modules_to_metadata_calls_call {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with Call
|
||||
with Call
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
Some($crate::metadata::DecodeDifferent::Encode(
|
||||
@@ -105,10 +105,10 @@ macro_rules! __runtime_modules_to_metadata_calls_call {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with $_:ident
|
||||
with $_:ident
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
__runtime_modules_to_metadata_calls_call!( $mod, $module, $runtime, $(with $kws)* );
|
||||
$crate::__runtime_modules_to_metadata_calls_call!( $mod, $module, $runtime, $(with $kws)* );
|
||||
};
|
||||
(
|
||||
$mod: ident,
|
||||
@@ -127,7 +127,7 @@ macro_rules! __runtime_modules_to_metadata_calls_event {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with Event
|
||||
with Event
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
Some($crate::metadata::DecodeDifferent::Encode(
|
||||
@@ -142,10 +142,10 @@ macro_rules! __runtime_modules_to_metadata_calls_event {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with $_:ident
|
||||
with $_:ident
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
__runtime_modules_to_metadata_calls_event!( $mod, $module, $runtime, $(with $kws)* );
|
||||
$crate::__runtime_modules_to_metadata_calls_event!( $mod, $module, $runtime, $(with $kws)* );
|
||||
};
|
||||
(
|
||||
$mod: ident,
|
||||
@@ -163,7 +163,7 @@ macro_rules! __runtime_modules_to_metadata_calls_storagename {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with Storage
|
||||
with Storage
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
$crate::metadata::DecodeDifferent::Encode(
|
||||
@@ -176,10 +176,10 @@ macro_rules! __runtime_modules_to_metadata_calls_storagename {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with $_:ident
|
||||
with $_:ident
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
__runtime_modules_to_metadata_calls_storagename!( $mod, $module, $runtime, $(with $kws)* );
|
||||
$crate::__runtime_modules_to_metadata_calls_storagename!( $mod, $module, $runtime, $(with $kws)* );
|
||||
};
|
||||
(
|
||||
$mod: ident,
|
||||
@@ -199,7 +199,7 @@ macro_rules! __runtime_modules_to_metadata_calls_storage {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with Storage
|
||||
with Storage
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
Some($crate::metadata::DecodeDifferent::Encode(
|
||||
@@ -212,10 +212,10 @@ macro_rules! __runtime_modules_to_metadata_calls_storage {
|
||||
$mod: ident,
|
||||
$module: ident,
|
||||
$runtime: ident,
|
||||
with $_:ident
|
||||
with $_:ident
|
||||
$(with $kws:ident)*
|
||||
) => {
|
||||
__runtime_modules_to_metadata_calls_storage!( $mod, $module, $runtime, $(with $kws)* );
|
||||
$crate::__runtime_modules_to_metadata_calls_storage!( $mod, $module, $runtime, $(with $kws)* );
|
||||
};
|
||||
(
|
||||
$mod: ident,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Macros that define an Origin type. Every function call to your runtime has an origin which
|
||||
//! specifies where the extrinsic was generated from.
|
||||
|
||||
/// Constructs an Origin type for a runtime. This is usually called automatically by the
|
||||
/// Constructs an Origin type for a runtime. This is usually called automatically by the
|
||||
/// construct_runtime macro. See also __create_decl_macro.
|
||||
#[macro_export]
|
||||
macro_rules! impl_outer_origin {
|
||||
@@ -31,7 +31,7 @@ macro_rules! impl_outer_origin {
|
||||
$( $module:ident $( <$generic:ident> )* ),* $(,)*
|
||||
}
|
||||
) => {
|
||||
impl_outer_origin! {
|
||||
$crate::impl_outer_origin! {
|
||||
$(#[$attr])*
|
||||
pub enum $name for $runtime where system = system {
|
||||
$( $module $( <$generic> )*, )*
|
||||
@@ -42,7 +42,7 @@ macro_rules! impl_outer_origin {
|
||||
$(#[$attr:meta])*
|
||||
pub enum $name:ident for $runtime:ident where system = $system:ident {}
|
||||
) => {
|
||||
impl_outer_origin!(
|
||||
$crate::impl_outer_origin!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -58,7 +58,7 @@ macro_rules! impl_outer_origin {
|
||||
$( $rest_module:ident $( <$rest_generic:ident> )* ),* $(,)*
|
||||
}
|
||||
) => {
|
||||
impl_outer_origin!(
|
||||
$crate::impl_outer_origin!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -74,7 +74,7 @@ macro_rules! impl_outer_origin {
|
||||
$( $rest_module:ident $( <$rest_generic:ident> )* ),* $(,)*
|
||||
}
|
||||
) => {
|
||||
impl_outer_origin!(
|
||||
$crate::impl_outer_origin!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -94,7 +94,7 @@ macro_rules! impl_outer_origin {
|
||||
};
|
||||
$( $parsed_module:ident $( <$generic_param:ident> )* ),*;
|
||||
) => {
|
||||
impl_outer_origin!(
|
||||
$crate::impl_outer_origin!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
@@ -114,7 +114,7 @@ macro_rules! impl_outer_origin {
|
||||
};
|
||||
$( $parsed_module:ident $( <$generic_param:ident> )* ),*;
|
||||
) => {
|
||||
impl_outer_origin!(
|
||||
$crate::impl_outer_origin!(
|
||||
$( #[$attr] )*;
|
||||
$name;
|
||||
$runtime;
|
||||
|
||||
@@ -299,15 +299,6 @@ macro_rules! construct_runtime {
|
||||
}
|
||||
),*;
|
||||
) => {
|
||||
// This generates a substrate_generate_ident_name macro that will substitute
|
||||
// "config-ident FooModule" => FooModuleConfig for every module included in the
|
||||
// runtime.
|
||||
mashup! {
|
||||
$(
|
||||
substrate_generate_ident_name["config-ident" $name] = $name Config;
|
||||
)*
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "std", derive(Debug))]
|
||||
pub struct $runtime;
|
||||
@@ -317,19 +308,19 @@ macro_rules! construct_runtime {
|
||||
impl $crate::runtime_primitives::traits::GetRuntimeBlockType for $runtime {
|
||||
type RuntimeBlock = $block;
|
||||
}
|
||||
__decl_outer_event!(
|
||||
$crate::__decl_outer_event!(
|
||||
$runtime;
|
||||
$(
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* ),* }
|
||||
),*
|
||||
);
|
||||
__decl_outer_origin!(
|
||||
$crate::__decl_outer_origin!(
|
||||
$runtime;
|
||||
$(
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* ),* }
|
||||
),*
|
||||
);
|
||||
__decl_all_modules!(
|
||||
$crate::__decl_all_modules!(
|
||||
$runtime;
|
||||
;
|
||||
;
|
||||
@@ -337,21 +328,21 @@ macro_rules! construct_runtime {
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* ),* }
|
||||
),*;
|
||||
);
|
||||
__decl_outer_dispatch!(
|
||||
$crate::__decl_outer_dispatch!(
|
||||
$runtime;
|
||||
;
|
||||
$(
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* ),* }
|
||||
),*;
|
||||
);
|
||||
__decl_runtime_metadata!(
|
||||
$crate::__decl_runtime_metadata!(
|
||||
$runtime;
|
||||
;
|
||||
$(
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* )* }
|
||||
)*
|
||||
);
|
||||
__decl_outer_log!(
|
||||
$crate::__decl_outer_log!(
|
||||
$runtime;
|
||||
$log_internal < $( $log_genarg ),* >;
|
||||
;
|
||||
@@ -359,14 +350,14 @@ macro_rules! construct_runtime {
|
||||
$name: $module::{ $( $modules $( ( $( $modules_args ),* ) )* ),* }
|
||||
),*;
|
||||
);
|
||||
__decl_outer_config!(
|
||||
$crate::__decl_outer_config!(
|
||||
$runtime;
|
||||
;
|
||||
$(
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* ),* }
|
||||
),*;
|
||||
);
|
||||
__decl_outer_inherent!(
|
||||
$crate::__decl_outer_inherent!(
|
||||
$runtime;
|
||||
$block;
|
||||
$uncheckedextrinsic;
|
||||
@@ -403,7 +394,7 @@ macro_rules! __create_decl_macro {
|
||||
$d( $rest_modules:ident $d( <$rest_modules_generic:ident> )* ),*
|
||||
})*
|
||||
) => {
|
||||
$macro_name!(
|
||||
$d crate::$macro_name!(
|
||||
$runtime;
|
||||
$module;
|
||||
;
|
||||
@@ -425,7 +416,7 @@ macro_rules! __create_decl_macro {
|
||||
$d( $rest_modules:ident $d( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
$macro_name!(
|
||||
$d crate::$macro_name!(
|
||||
$runtime;
|
||||
$module;
|
||||
$d( $parsed_modules $d( <$parsed_generic> )* ),*;
|
||||
@@ -445,7 +436,7 @@ macro_rules! __create_decl_macro {
|
||||
$d( $rest_modules:ident $d( <$rest_modules_generic:ident> )* ),*
|
||||
})*
|
||||
) => {
|
||||
$macro_name!(
|
||||
$d crate::$macro_name!(
|
||||
$runtime;
|
||||
;
|
||||
;
|
||||
@@ -468,7 +459,7 @@ macro_rules! __create_decl_macro {
|
||||
$d( $rest_modules:ident $d( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
$macro_name!(
|
||||
$d crate::$macro_name!(
|
||||
$runtime;
|
||||
$d( $system )*;
|
||||
$d(
|
||||
@@ -492,7 +483,7 @@ macro_rules! __create_decl_macro {
|
||||
$d( $rest_modules:ident $d( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
$macro_name!(
|
||||
$d crate::$macro_name!(
|
||||
$runtime;
|
||||
$d( $system )*;
|
||||
$d( $parsed_modules $d( <$parsed_generic> )* ),*;
|
||||
@@ -513,7 +504,7 @@ macro_rules! __create_decl_macro {
|
||||
$d( $rest_modules:ident $d( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
$macro_name!(
|
||||
$d crate::$macro_name!(
|
||||
$runtime;
|
||||
$d( $system )*;
|
||||
$d( $parsed_modules $d( <$parsed_generic> )* ),*;
|
||||
@@ -530,7 +521,7 @@ macro_rules! __create_decl_macro {
|
||||
$d( $parsed_modules:ident $d( <$parsed_generic:ident> )* ),*;
|
||||
;
|
||||
) => {
|
||||
$macro_outer_name! {
|
||||
$d crate::$macro_outer_name! {
|
||||
pub enum $macro_enum_name for $runtime where system = $d( $system )* {
|
||||
$d(
|
||||
$parsed_modules $d( <$parsed_generic> )*,
|
||||
@@ -560,7 +551,7 @@ macro_rules! __decl_all_modules {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_all_modules!(
|
||||
$crate::__decl_all_modules!(
|
||||
$runtime;
|
||||
$module;
|
||||
$( $parsed_modules :: $parsed_name ),*;
|
||||
@@ -582,7 +573,7 @@ macro_rules! __decl_all_modules {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_all_modules!(
|
||||
$crate::__decl_all_modules!(
|
||||
$runtime;
|
||||
$( $system )*;
|
||||
$( $parsed_modules :: $parsed_name, )* $module::$name;
|
||||
@@ -604,7 +595,7 @@ macro_rules! __decl_all_modules {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_all_modules!(
|
||||
$crate::__decl_all_modules!(
|
||||
$runtime;
|
||||
$( $system )*;
|
||||
$( $parsed_modules :: $parsed_name ),*;
|
||||
@@ -625,7 +616,7 @@ macro_rules! __decl_all_modules {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_all_modules!(
|
||||
$crate::__decl_all_modules!(
|
||||
$runtime;
|
||||
$( $system )*;
|
||||
$( $parsed_modules :: $parsed_name ),*;
|
||||
@@ -665,7 +656,7 @@ macro_rules! __decl_outer_dispatch {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_dispatch!(
|
||||
$crate::__decl_outer_dispatch!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name ),*;
|
||||
$(
|
||||
@@ -685,7 +676,7 @@ macro_rules! __decl_outer_dispatch {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_dispatch!(
|
||||
$crate::__decl_outer_dispatch!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name, )* $module::$name;
|
||||
$(
|
||||
@@ -705,7 +696,7 @@ macro_rules! __decl_outer_dispatch {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_dispatch!(
|
||||
$crate::__decl_outer_dispatch!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name ),*;
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* ),* }
|
||||
@@ -724,7 +715,7 @@ macro_rules! __decl_outer_dispatch {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_dispatch!(
|
||||
$crate::__decl_outer_dispatch!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name ),*;
|
||||
$(
|
||||
@@ -739,7 +730,7 @@ macro_rules! __decl_outer_dispatch {
|
||||
$( $parsed_modules:ident :: $parsed_name:ident ),*;
|
||||
;
|
||||
) => {
|
||||
impl_outer_dispatch!(
|
||||
$crate::impl_outer_dispatch!(
|
||||
pub enum Call for $runtime where origin: Origin {
|
||||
$( $parsed_modules::$parsed_name, )*
|
||||
}
|
||||
@@ -763,7 +754,7 @@ macro_rules! __decl_runtime_metadata {
|
||||
})*
|
||||
) => {
|
||||
|
||||
__decl_runtime_metadata!(@Module
|
||||
$crate::__decl_runtime_metadata!(@Module
|
||||
$runtime;
|
||||
$( $parsed_modules { $( $withs )* } )*;
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* )* }
|
||||
@@ -785,7 +776,7 @@ macro_rules! __decl_runtime_metadata {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* )*
|
||||
})*
|
||||
) => {
|
||||
__decl_runtime_metadata!(
|
||||
$crate::__decl_runtime_metadata!(
|
||||
$runtime;
|
||||
$( $parsed_modules { $( $withs )* } )*;
|
||||
$(
|
||||
@@ -806,7 +797,7 @@ macro_rules! __decl_runtime_metadata {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* )*
|
||||
})*
|
||||
) => {
|
||||
__decl_runtime_metadata!(
|
||||
$crate::__decl_runtime_metadata!(
|
||||
$runtime;
|
||||
$( $parsed_modules { $( $withs )* } )*
|
||||
$module {
|
||||
@@ -824,7 +815,7 @@ macro_rules! __decl_runtime_metadata {
|
||||
$runtime:ident;
|
||||
$( $parsed_modules:ident { $( $withs:ident )* } )*;
|
||||
) => {
|
||||
impl_runtime_metadata!(
|
||||
$crate::impl_runtime_metadata!(
|
||||
for $runtime with modules
|
||||
$( $parsed_modules::Module with $( $withs )* , )*
|
||||
);
|
||||
@@ -847,7 +838,7 @@ macro_rules! __decl_outer_log {
|
||||
$( $rest_modules:ident $( ( $( $rest_modules_args:ident )* ) )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_log!(
|
||||
$crate::__decl_outer_log!(
|
||||
$runtime;
|
||||
$log_internal < $( $log_genarg ),* >;
|
||||
$( $parsed_modules ( $( $parsed_args ),* ), )* $module ( $( $args ),* );
|
||||
@@ -870,7 +861,7 @@ macro_rules! __decl_outer_log {
|
||||
$( $rest_modules:ident $( ( $( $rest_modules_args:ident )* ) )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_log!(
|
||||
$crate::__decl_outer_log!(
|
||||
$runtime;
|
||||
$log_internal < $( $log_genarg ),* >;
|
||||
$( $parsed_modules ( $( $parsed_args ),* ) ),*;
|
||||
@@ -891,7 +882,7 @@ macro_rules! __decl_outer_log {
|
||||
$( $rest_modules:ident $( ( $( $rest_modules_args:ident )* ) )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_log!(
|
||||
$crate::__decl_outer_log!(
|
||||
$runtime;
|
||||
$log_internal < $( $log_genarg ),* >;
|
||||
$( $parsed_modules ( $( $parsed_args ),* ) ),*;
|
||||
@@ -908,7 +899,7 @@ macro_rules! __decl_outer_log {
|
||||
$( $parsed_modules:ident( $( $parsed_args:ident ),* ) ),*;
|
||||
;
|
||||
) => {
|
||||
impl_outer_log!(
|
||||
$crate::runtime_primitives::impl_outer_log!(
|
||||
pub enum Log($log_internal: DigestItem<$( $log_genarg ),*>) for $runtime {
|
||||
$( $parsed_modules ( $( $parsed_args ),* ) ),*
|
||||
}
|
||||
@@ -930,7 +921,7 @@ macro_rules! __decl_outer_config {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_config!(
|
||||
$crate::__decl_outer_config!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name $( < $parsed_generic > )*, )* $module::$name;
|
||||
$(
|
||||
@@ -950,7 +941,7 @@ macro_rules! __decl_outer_config {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_config!(
|
||||
$crate::__decl_outer_config!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name $( < $parsed_generic > )*, )* $module::$name<T>;
|
||||
$(
|
||||
@@ -970,7 +961,7 @@ macro_rules! __decl_outer_config {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_config!(
|
||||
$crate::__decl_outer_config!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name $( < $parsed_generic > )*),*;
|
||||
$name: $module::{ $( $modules $( <$modules_generic> )* ),* }
|
||||
@@ -989,7 +980,7 @@ macro_rules! __decl_outer_config {
|
||||
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_config!(
|
||||
$crate::__decl_outer_config!(
|
||||
$runtime;
|
||||
$( $parsed_modules :: $parsed_name $( < $parsed_generic > )*),*;
|
||||
$(
|
||||
@@ -1004,11 +995,11 @@ macro_rules! __decl_outer_config {
|
||||
$( $parsed_modules:ident :: $parsed_name:ident $( < $parsed_generic:ident > )* ),*;
|
||||
;
|
||||
) => {
|
||||
substrate_generate_ident_name! {
|
||||
impl_outer_config!(
|
||||
$crate::paste::item! {
|
||||
$crate::runtime_primitives::impl_outer_config!(
|
||||
pub struct GenesisConfig for $runtime {
|
||||
$(
|
||||
"config-ident" $parsed_name => $parsed_modules $( < $parsed_generic > )*,
|
||||
[< $parsed_name Config >] => $parsed_modules $( < $parsed_generic > )*,
|
||||
)*
|
||||
}
|
||||
);
|
||||
@@ -1032,7 +1023,7 @@ macro_rules! __decl_outer_inherent {
|
||||
$( $rest_modules:ident $( ( $( $rest_call:ident )* ) )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_inherent!(
|
||||
$crate::__decl_outer_inherent!(
|
||||
$runtime;
|
||||
$block;
|
||||
$uncheckedextrinsic;
|
||||
@@ -1056,7 +1047,7 @@ macro_rules! __decl_outer_inherent {
|
||||
$( $rest_modules:ident $( ( $( $rest_call:ident )* ) )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_inherent!(
|
||||
$crate::__decl_outer_inherent!(
|
||||
$runtime;
|
||||
$block;
|
||||
$uncheckedextrinsic;
|
||||
@@ -1081,7 +1072,7 @@ macro_rules! __decl_outer_inherent {
|
||||
$( $rest_modules:ident $( ( $( $rest_call:ident )* ) )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_inherent!(
|
||||
$crate::__decl_outer_inherent!(
|
||||
$runtime;
|
||||
$block;
|
||||
$uncheckedextrinsic;
|
||||
@@ -1104,7 +1095,7 @@ macro_rules! __decl_outer_inherent {
|
||||
$( $rest_modules:ident $( ( $( $rest_call:ident )* ) )* ),*
|
||||
})*;
|
||||
) => {
|
||||
__decl_outer_inherent!(
|
||||
$crate::__decl_outer_inherent!(
|
||||
$runtime;
|
||||
$block;
|
||||
$uncheckedextrinsic;
|
||||
@@ -1123,7 +1114,7 @@ macro_rules! __decl_outer_inherent {
|
||||
$( $parsed_name:ident :: $parsed_call:ident ),*;
|
||||
;
|
||||
) => {
|
||||
impl_outer_inherent!(
|
||||
$crate::impl_outer_inherent!(
|
||||
impl Inherents where Block = $block, UncheckedExtrinsic = $uncheckedextrinsic {
|
||||
$( $parsed_name : $parsed_call, )*
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user