diff --git a/Cargo.lock b/Cargo.lock index 9b53e65c3f9c..894eeab6f4c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1285,7 +1285,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", ] @@ -1293,7 +1293,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -1310,7 +1310,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "Inflector", "frame-benchmarking", @@ -1329,7 +1329,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -1344,7 +1344,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "11.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "serde", @@ -1355,7 +1355,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bitmask", "frame-metadata", @@ -1380,7 +1380,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.18", @@ -1391,7 +1391,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1403,7 +1403,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1413,7 +1413,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1429,7 +1429,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -3409,7 +3409,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3425,7 +3425,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3440,7 +3440,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3465,7 +3465,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3479,7 +3479,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3510,7 +3510,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3525,7 +3525,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3541,7 +3541,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3561,7 +3561,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3577,7 +3577,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3597,7 +3597,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3613,7 +3613,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3627,7 +3627,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3642,7 +3642,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3656,7 +3656,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3671,7 +3671,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3692,7 +3692,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3707,7 +3707,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3720,7 +3720,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "enumflags2", "frame-support", @@ -3735,7 +3735,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3750,7 +3750,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3770,7 +3770,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3786,7 +3786,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -3833,7 +3833,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3847,7 +3847,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3865,7 +3865,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "frame-system", @@ -3880,7 +3880,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3898,7 +3898,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-support", "parity-scale-codec", @@ -3911,7 +3911,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3926,7 +3926,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-benchmarking", "frame-support", @@ -3942,7 +3942,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4943,6 +4943,7 @@ dependencies = [ "hex-literal", "libsecp256k1", "log 0.3.9", + "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-balances", @@ -4955,6 +4956,7 @@ dependencies = [ "pallet-session", "pallet-staking", "pallet-staking-reward-curve", + "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -4969,12 +4971,14 @@ dependencies = [ "serde_json", "smallvec 1.4.1", "sp-api", + "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", "sp-core", "sp-inherents", "sp-io", "sp-keyring", + "sp-offchain", "sp-runtime", "sp-session", "sp-staking", @@ -4996,6 +5000,7 @@ dependencies = [ "polkadot-primitives", "polkadot-runtime-common", "polkadot-test-runtime", + "polkadot-test-service", "sc-block-builder", "sc-client-api", "sc-consensus", @@ -5008,6 +5013,55 @@ dependencies = [ "substrate-test-client", ] +[[package]] +name = "polkadot-test-service" +version = "0.8.2" +dependencies = [ + "frame-benchmarking", + "frame-system", + "futures 0.1.29", + "futures 0.3.5", + "hex", + "log 0.4.8", + "pallet-balances", + "pallet-staking", + "pallet-transaction-payment", + "polkadot-availability-store", + "polkadot-network", + "polkadot-primitives", + "polkadot-rpc", + "polkadot-runtime-common", + "polkadot-service", + "polkadot-test-runtime", + "polkadot-validation", + "rand 0.7.3", + "sc-authority-discovery", + "sc-chain-spec", + "sc-client-api", + "sc-consensus", + "sc-consensus-babe", + "sc-executor", + "sc-finality-grandpa", + "sc-informant", + "sc-network", + "sc-service", + "sc-transaction-pool", + "serde_json", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core", + "sp-finality-grandpa", + "sp-inherents", + "sp-keyring", + "sp-runtime", + "sp-state-machine", + "substrate-test-client", + "tempfile", + "tokio 0.2.21", +] + [[package]] name = "polkadot-validation" version = "0.8.14" @@ -5820,7 +5874,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bytes 0.5.4", "derive_more 0.99.8", @@ -5847,7 +5901,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -5871,7 +5925,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5888,7 +5942,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5904,7 +5958,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -5915,7 +5969,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "ansi_term 0.12.1", "atty", @@ -5956,7 +6010,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "fnv", @@ -5992,7 +6046,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "blake2-rfc", "hash-db", @@ -6021,7 +6075,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6032,7 +6086,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "fork-tree", @@ -6074,7 +6128,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6098,7 +6152,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6111,7 +6165,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6134,7 +6188,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "sc-client-api", @@ -6148,7 +6202,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "lazy_static", @@ -6176,7 +6230,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -6193,7 +6247,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6208,7 +6262,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "cranelift-codegen", "cranelift-wasm", @@ -6229,7 +6283,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "assert_matches", "derive_more 0.99.8", @@ -6267,7 +6321,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "finality-grandpa", @@ -6284,7 +6338,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -6302,7 +6356,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "hex", @@ -6318,7 +6372,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "lazy_static", @@ -6337,7 +6391,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bitflags", "bs58", @@ -6389,7 +6443,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6404,7 +6458,7 @@ dependencies = [ [[package]] name = "sc-network-test" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "env_logger", "futures 0.3.5", @@ -6431,7 +6485,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "bytes 0.5.4", "fnv", @@ -6458,7 +6512,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "libp2p", @@ -6471,7 +6525,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "substrate-prometheus-endpoint", @@ -6480,7 +6534,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "hash-db", @@ -6512,7 +6566,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6536,7 +6590,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -6552,7 +6606,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "directories", @@ -6615,7 +6669,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6629,7 +6683,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6650,7 +6704,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "erased-serde", "log 0.4.8", @@ -6667,7 +6721,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -6687,7 +6741,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7094,7 +7148,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7106,7 +7160,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "parity-scale-codec", @@ -7121,7 +7175,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7133,7 +7187,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "serde", @@ -7145,7 +7199,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -7158,7 +7212,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7170,7 +7224,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7181,7 +7235,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7193,7 +7247,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "log 0.4.8", @@ -7209,7 +7263,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "serde", "serde_json", @@ -7218,7 +7272,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7242,7 +7296,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7256,7 +7310,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "merlin", "parity-scale-codec", @@ -7275,7 +7329,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7284,7 +7338,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -7296,7 +7350,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "base58", "blake2-rfc", @@ -7339,7 +7393,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -7348,7 +7402,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -7358,7 +7412,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "environmental", "parity-scale-codec", @@ -7369,7 +7423,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "finality-grandpa", "log 0.4.8", @@ -7385,7 +7439,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7395,7 +7449,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "parity-scale-codec", @@ -7407,7 +7461,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "hash-db", @@ -7428,7 +7482,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "lazy_static", "sp-core", @@ -7439,7 +7493,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "serde", @@ -7451,7 +7505,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -7462,7 +7516,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "sp-api", "sp-core", @@ -7472,7 +7526,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "backtrace", "log 0.4.8", @@ -7481,7 +7535,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "serde", "sp-core", @@ -7490,7 +7544,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "either", "hash256-std-hasher", @@ -7512,7 +7566,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "primitive-types", @@ -7527,7 +7581,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "Inflector", "proc-macro-crate", @@ -7539,7 +7593,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "serde", "serde_json", @@ -7548,7 +7602,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-api", @@ -7561,7 +7615,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -7571,7 +7625,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "itertools 0.9.0", @@ -7592,12 +7646,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" [[package]] name = "sp-storage" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -7609,7 +7663,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7623,7 +7677,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "log 0.4.8", "rental", @@ -7633,7 +7687,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "derive_more 0.99.8", "futures 0.3.5", @@ -7649,7 +7703,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "hash-db", "memory-db", @@ -7663,7 +7717,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "futures-core", @@ -7675,7 +7729,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7687,7 +7741,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7827,7 +7881,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "chrono", "clear_on_drop", @@ -7854,7 +7908,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "platforms", ] @@ -7862,7 +7916,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -7885,7 +7939,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "async-std", "derive_more 0.99.8", @@ -7899,7 +7953,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.1.29", "futures 0.3.5", @@ -7912,6 +7966,8 @@ dependencies = [ "sc-executor", "sc-light", "sc-service", + "serde", + "serde_json", "sp-blockchain", "sp-consensus", "sp-core", @@ -7923,7 +7979,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "cfg-if", "frame-executive", @@ -7963,7 +8019,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0-rc4" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" dependencies = [ "futures 0.3.5", "parity-scale-codec", @@ -7984,7 +8040,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/paritytech/substrate#e824e8ab0fadec9949ebb8b9e14d98703d6b8d44" +source = "git+https://github.com/paritytech/substrate#b9d96fabd2462cb42862fd0a117ed42bb98401aa" [[package]] name = "substrate-wasm-builder-runner" @@ -8419,6 +8475,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "slab", + "tokio-macros", "winapi 0.3.8", ] @@ -8497,6 +8554,17 @@ dependencies = [ "log 0.4.8", ] +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.31", +] + [[package]] name = "tokio-named-pipes" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index fa5fa1627970..fe5bbcf2f9bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ members = [ "node/service", "node/subsystem", "node/test-helpers/subsystem", + "node/test-service", "parachain/test-parachains", "parachain/test-parachains/adder", diff --git a/network/test/src/block_import.rs b/network/test/src/block_import.rs index ec848609cd4a..68b0291e5089 100644 --- a/network/test/src/block_import.rs +++ b/network/test/src/block_import.rs @@ -29,7 +29,7 @@ fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock) let mut client = polkadot_test_runtime_client::new(); let mut builder = client.new_block(Default::default()).unwrap(); - let extrinsics = polkadot_test_runtime_client::needed_extrinsics(vec![]); + let extrinsics = polkadot_test_runtime_client::needed_extrinsics(vec![], 0); for extrinsic in &extrinsics { builder.push(extrinsic.clone()).unwrap(); diff --git a/node/service/src/grandpa_support.rs b/node/service/src/grandpa_support.rs index a875c4b45a37..806a189d9fe5 100644 --- a/node/service/src/grandpa_support.rs +++ b/node/service/src/grandpa_support.rs @@ -250,17 +250,21 @@ mod tests { let mut push_blocks = { let mut client = client.clone(); + let mut base = 0; + move |n| { - for _ in 0..n { + for i in 0..n { let mut builder = client.new_block(Default::default()).unwrap(); - for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![]) { + for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![], base + i) { builder.push(extrinsic).unwrap() } let block = builder.build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); } + + base += n; } }; diff --git a/node/test-service/Cargo.toml b/node/test-service/Cargo.toml new file mode 100644 index 000000000000..db6328a9aac2 --- /dev/null +++ b/node/test-service/Cargo.toml @@ -0,0 +1,56 @@ +[package] +name = "polkadot-test-service" +version = "0.8.2" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +futures = "0.3.4" +futures01 = { package = "futures", version = "0.1.29" } +hex = "0.4" +log = "0.4.8" +rand = "0.7.3" +tempfile = "3.1.0" + +# Polkadot dependencies +av_store = { package = "polkadot-availability-store", path = "../../availability-store" } +consensus = { package = "polkadot-validation", path = "../../validation" } +polkadot-network = { path = "../../network" } +polkadot-primitives = { path = "../../primitives" } +polkadot-rpc = { path = "../../rpc" } +polkadot-runtime-common = { path = "../../runtime/common" } +polkadot-service = { path = "../../service" } +polkadot-test-runtime = { path = "../../runtime/test-runtime" } + +# Substrate dependencies +authority-discovery = { package = "sc-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master" } +babe = { package = "sc-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" } +babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" } +consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } +grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } +grandpa_primitives = { package = "sp-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } +inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-informant = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } +service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } + +[dev-dependencies] +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +serde_json = "1.0" +tokio = { version = "0.2", features = ["macros"] } diff --git a/node/test-service/src/chain_spec.rs b/node/test-service/src/chain_spec.rs new file mode 100644 index 000000000000..cbb08c470f07 --- /dev/null +++ b/node/test-service/src/chain_spec.rs @@ -0,0 +1,184 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use babe_primitives::AuthorityId as BabeId; +use grandpa::AuthorityId as GrandpaId; +use pallet_staking::Forcing; +use polkadot_primitives::{parachain::ValidatorId, AccountId}; +use polkadot_service::chain_spec::{get_account_id_from_seed, get_from_seed, Extensions}; +use polkadot_test_runtime::constants::currency::DOTS; +use sc_chain_spec::{ChainSpec, ChainType}; +use sp_core::{sr25519, ChangesTrieConfiguration}; +use sp_runtime::Perbill; + +const DEFAULT_PROTOCOL_ID: &str = "dot"; + +/// The `ChainSpec parametrised for polkadot runtime`. +pub type PolkadotChainSpec = + service::GenericChainSpec; + +/// Polkadot local testnet config (multivalidator Alice + Bob) +pub fn polkadot_local_testnet_config() -> PolkadotChainSpec { + PolkadotChainSpec::from_genesis( + "Local Testnet", + "local_testnet", + ChainType::Local, + || polkadot_local_testnet_genesis(None), + vec![], + None, + Some(DEFAULT_PROTOCOL_ID), + None, + Default::default(), + ) +} + +/// Polkadot local testnet genesis config (multivalidator Alice + Bob) +pub fn polkadot_local_testnet_genesis( + changes_trie_config: Option, +) -> polkadot_test_runtime::GenesisConfig { + polkadot_testnet_genesis( + vec![ + get_authority_keys_from_seed("Alice"), + get_authority_keys_from_seed("Bob"), + get_authority_keys_from_seed("Charlie"), + ], + get_account_id_from_seed::("Alice"), + None, + changes_trie_config, + ) +} + +/// Helper function to generate stash, controller and session key from seed +fn get_authority_keys_from_seed( + seed: &str, +) -> (AccountId, AccountId, BabeId, GrandpaId, ValidatorId) { + ( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + ) +} + +fn testnet_accounts() -> Vec { + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ] +} + +/// Helper function to create polkadot GenesisConfig for testing +fn polkadot_testnet_genesis( + initial_authorities: Vec<(AccountId, AccountId, BabeId, GrandpaId, ValidatorId)>, + root_key: AccountId, + endowed_accounts: Option>, + changes_trie_config: Option, +) -> polkadot_test_runtime::GenesisConfig { + use polkadot_test_runtime as polkadot; + + let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); + + const ENDOWMENT: u128 = 1_000_000 * DOTS; + const STASH: u128 = 100 * DOTS; + + polkadot::GenesisConfig { + system: Some(polkadot::SystemConfig { + code: polkadot::WASM_BINARY.to_vec(), + changes_trie_config, + }), + indices: Some(polkadot::IndicesConfig { indices: vec![] }), + balances: Some(polkadot::BalancesConfig { + balances: endowed_accounts + .iter() + .map(|k| (k.clone(), ENDOWMENT)) + .collect(), + }), + session: Some(polkadot::SessionConfig { + keys: initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + polkadot_test_runtime::SessionKeys { + babe: x.2.clone(), + grandpa: x.3.clone(), + parachain_validator: x.4.clone(), + }, + ) + }) + .collect::>(), + }), + staking: Some(polkadot::StakingConfig { + minimum_validator_count: 1, + validator_count: 2, + stakers: initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.1.clone(), + STASH, + polkadot::StakerStatus::Validator, + ) + }) + .collect(), + invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(), + force_era: Forcing::NotForcing, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }), + babe: Some(Default::default()), + grandpa: Some(Default::default()), + authority_discovery: Some(polkadot::AuthorityDiscoveryConfig { keys: vec![] }), + parachains: Some(polkadot::ParachainsConfig { + authorities: vec![], + }), + registrar: Some(polkadot::RegistrarConfig { + parachains: vec![], + _phdata: Default::default(), + }), + claims: Some(polkadot::ClaimsConfig { + claims: vec![], + vesting: vec![], + }), + vesting: Some(polkadot::VestingConfig { vesting: vec![] }), + sudo: Some(polkadot::SudoConfig { key: root_key }), + } +} + +/// Can be called for a `Configuration` to check if it is a configuration for the `Test` network. +pub trait IdentifyVariant { + /// Returns if this is a configuration for the `Test` network. + fn is_test(&self) -> bool; +} + +impl IdentifyVariant for Box { + fn is_test(&self) -> bool { + self.id().starts_with("test") + } +} diff --git a/node/test-service/src/lib.rs b/node/test-service/src/lib.rs new file mode 100644 index 000000000000..7fc75d9f3719 --- /dev/null +++ b/node/test-service/src/lib.rs @@ -0,0 +1,307 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Polkadot test service only. + +#![warn(missing_docs)] + +mod chain_spec; + +pub use chain_spec::*; +use consensus_common::{block_validation::Chain, SelectChain}; +use futures::future::Future; +use grandpa::FinalityProofProvider as GrandpaFinalityProofProvider; +use log::info; +use polkadot_network::{legacy::gossip::Known, protocol as network_protocol}; +use polkadot_primitives::{ + parachain::{self, CollatorId}, + Block, BlockId, Hash, +}; +use polkadot_runtime_common::{parachains, registrar, BlockHashCount}; +use polkadot_service::{ + new_full, new_full_start, FullNodeHandles, PolkadotClient, ServiceComponents, +}; +use polkadot_test_runtime::{RestrictFunctionality, Runtime, SignedExtra, SignedPayload, VERSION}; +use sc_chain_spec::ChainSpec; +use sc_client_api::{execution_extensions::ExecutionStrategies, BlockchainEvents}; +use sc_executor::native_executor_instance; +use sc_informant::OutputFormat; +use sc_network::{ + config::{NetworkConfiguration, TransportConfig}, + multiaddr, NetworkService, +}; +use service::{ + config::{DatabaseConfig, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod}, + error::Error as ServiceError, + RpcHandlers, TaskExecutor, TaskManager, +}; +use service::{BasePath, Configuration, Role, TFullBackend}; +use sp_arithmetic::traits::SaturatedConversion; +use sp_blockchain::HeaderBackend; +use sp_keyring::Sr25519Keyring; +use sp_runtime::{codec::Encode, generic}; +use sp_state_machine::BasicExternalities; +use std::sync::Arc; +use std::time::Duration; +use substrate_test_client::{BlockchainEventsExt, RpcHandlersExt, RpcTransactionOutput, RpcTransactionError}; + +native_executor_instance!( + pub PolkadotTestExecutor, + polkadot_test_runtime::api::dispatch, + polkadot_test_runtime::native_version, + frame_benchmarking::benchmarking::HostFunctions, +); + +/// Create a new Polkadot test service for a full node. +pub fn polkadot_test_new_full( + config: Configuration, + collating_for: Option<(CollatorId, parachain::Id)>, + max_block_data_size: Option, + authority_discovery_enabled: bool, + slot_duration: u64, +) -> Result< + ( + TaskManager, + Arc, polkadot_test_runtime::RuntimeApi>>, + FullNodeHandles, + Arc>, + Arc, + ), + ServiceError, +> { + let (task_manager, client, handles, network, rpc_handlers) = new_full!(test + config, + collating_for, + max_block_data_size, + authority_discovery_enabled, + slot_duration, + polkadot_test_runtime::RuntimeApi, + PolkadotTestExecutor, + ); + + Ok((task_manager, client, handles, network, rpc_handlers)) +} + +/// Create a Polkadot `Configuration`. By default an in-memory socket will be used, therefore you need to provide boot +/// nodes if you want the future node to be connected to other nodes. The `storage_update_func` can be used to make +/// adjustements to the runtime before the node starts. +pub fn node_config( + storage_update_func: impl Fn(), + task_executor: TaskExecutor, + key: Sr25519Keyring, + boot_nodes: Vec, +) -> Configuration { + let base_path = BasePath::new_temp_dir().expect("could not create temporary directory"); + let root = base_path.path(); + let role = Role::Authority { + sentry_nodes: Vec::new(), + }; + let key_seed = key.to_seed(); + let mut spec = polkadot_local_testnet_config(); + let mut storage = spec + .as_storage_builder() + .build_storage() + .expect("could not build storage"); + + BasicExternalities::execute_with_storage(&mut storage, storage_update_func); + spec.set_storage(storage); + + let mut network_config = NetworkConfiguration::new( + format!("Polkadot Test Node for: {}", key_seed), + "network/test/0.1", + Default::default(), + None, + ); + let informant_output_format = OutputFormat { + enable_color: false, + prefix: format!("[{}] ", key_seed), + }; + + network_config.boot_nodes = boot_nodes; + + network_config.allow_non_globals_in_dht = true; + + network_config + .listen_addresses + .push(multiaddr::Protocol::Memory(rand::random()).into()); + + network_config.transport = TransportConfig::MemoryOnly; + + Configuration { + impl_name: "polkadot-test-node".to_string(), + impl_version: "0.1".to_string(), + role, + task_executor, + transaction_pool: Default::default(), + network: network_config, + keystore: KeystoreConfig::Path { + path: root.join("key"), + password: None, + }, + database: DatabaseConfig::RocksDb { + path: root.join("db"), + cache_size: 128, + }, + state_cache_size: 16777216, + state_cache_child_ratio: None, + pruning: Default::default(), + chain_spec: Box::new(spec), + wasm_method: WasmExecutionMethod::Interpreted, + // NOTE: we enforce the use of the native runtime to make the errors more debuggable + execution_strategies: ExecutionStrategies { + syncing: sc_client_api::ExecutionStrategy::NativeWhenPossible, + importing: sc_client_api::ExecutionStrategy::NativeWhenPossible, + block_construction: sc_client_api::ExecutionStrategy::NativeWhenPossible, + offchain_worker: sc_client_api::ExecutionStrategy::NativeWhenPossible, + other: sc_client_api::ExecutionStrategy::NativeWhenPossible, + }, + rpc_http: None, + rpc_ws: None, + rpc_ipc: None, + rpc_ws_max_connections: None, + rpc_cors: None, + rpc_methods: Default::default(), + prometheus_config: None, + telemetry_endpoints: None, + telemetry_external_transport: None, + default_heap_pages: None, + offchain_worker: Default::default(), + force_authoring: false, + disable_grandpa: false, + dev_key_seed: Some(key_seed), + tracing_targets: None, + tracing_receiver: Default::default(), + max_runtime_instances: 8, + announce_block: true, + base_path: Some(base_path), + informant_output_format, + } +} + +/// Run a Polkadot test node using the Polkadot test runtime. The node will be using an in-memory socket, therefore you +/// need to provide boot nodes if you want it to be connected to other nodes. The `storage_update_func` can be used to +/// make adjustements to the runtime before the node starts. +pub fn run_test_node( + task_executor: TaskExecutor, + key: Sr25519Keyring, + storage_update_func: impl Fn(), + boot_nodes: Vec, +) -> PolkadotTestNode< + TaskManager, + impl PolkadotClient, polkadot_test_runtime::RuntimeApi>, +> { + let config = node_config(storage_update_func, task_executor, key, boot_nodes); + let multiaddr = config.network.listen_addresses[0].clone(); + let authority_discovery_enabled = false; + let (task_manager, client, handles, network, rpc_handlers) = + polkadot_test_new_full(config, None, None, authority_discovery_enabled, 6000) + .expect("could not create Polkadot test service"); + + let peer_id = network.local_peer_id().clone(); + let addr = MultiaddrWithPeerId { multiaddr, peer_id }; + + PolkadotTestNode { + task_manager, + client, + handles, + addr, + rpc_handlers, + } +} + +/// A Polkadot test node instance used for testing. +pub struct PolkadotTestNode { + /// TaskManager's instance. + pub task_manager: S, + /// Client's instance. + pub client: Arc, + /// Node's handles. + pub handles: FullNodeHandles, + /// The `MultiaddrWithPeerId` to this node. This is useful if you want to pass it as "boot node" to other nodes. + pub addr: MultiaddrWithPeerId, + /// RPCHandlers to make RPC queries. + pub rpc_handlers: Arc, +} + +impl PolkadotTestNode +where + C: HeaderBackend, +{ + /// Send a transaction through RPCHandlers to call a function. + pub async fn call_function( + &self, + function: polkadot_test_runtime::Call, + caller: Sr25519Keyring, + ) -> Result { + let current_block_hash = self.client.info().best_hash; + let current_block = self.client.info().best_number.saturated_into(); + let genesis_block = self.client.hash(0).unwrap().unwrap(); + let nonce = 0; + let period = BlockHashCount::get() + .checked_next_power_of_two() + .map(|c| c / 2) + .unwrap_or(2) as u64; + let tip = 0; + let extra: SignedExtra = ( + RestrictFunctionality, + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(generic::Era::mortal(period, current_block)), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + registrar::LimitParathreadCommits::::new(), + parachains::ValidateDoubleVoteReports::::new(), + ); + let raw_payload = SignedPayload::from_raw( + function.clone(), + extra.clone(), + ( + (), + VERSION.spec_version, + VERSION.transaction_version, + genesis_block, + current_block_hash, + (), + (), + (), + (), + (), + ), + ); + let signature = raw_payload.using_encoded(|e| caller.sign(e)); + let extrinsic = polkadot_test_runtime::UncheckedExtrinsic::new_signed( + function.clone(), + polkadot_test_runtime::Address::Id(caller.public().into()), + polkadot_primitives::Signature::Sr25519(signature.clone()), + extra.clone(), + ); + + self.rpc_handlers.send_transaction(extrinsic.into()).await + } +} + +impl PolkadotTestNode +where + C: BlockchainEvents, +{ + /// Wait for `count` blocks to be imported in the node and then exit. This function will not return if no blocks + /// are ever created, thus you should restrict the maximum amount of time of the test execution. + pub fn wait_for_blocks(&self, count: usize) -> impl Future { + self.client.wait_for_blocks(count) + } +} diff --git a/node/test-service/tests/build-blocks.rs b/node/test-service/tests/build-blocks.rs new file mode 100644 index 000000000000..65771dda0525 --- /dev/null +++ b/node/test-service/tests/build-blocks.rs @@ -0,0 +1,78 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use tokio::{time::delay_for as sleep, task::spawn}; +use futures::{future, pin_mut, select, FutureExt as _}; +use polkadot_test_service::*; +use service::TaskExecutor; +use sp_keyring::Sr25519Keyring; +use std::time::Duration; + +static INTEGRATION_TEST_ALLOWED_TIME: Option<&str> = option_env!("INTEGRATION_TEST_ALLOWED_TIME"); + +#[tokio::test] +async fn ensure_test_service_build_blocks() { + let task_executor: TaskExecutor = (move |fut, _| { + spawn(fut); + }) + .into(); + let mut alice = run_test_node( + task_executor.clone(), + Sr25519Keyring::Alice, + || {}, + Vec::new(), + ); + let mut bob = run_test_node( + task_executor.clone(), + Sr25519Keyring::Bob, + || {}, + vec![alice.addr.clone()], + ); + let t1 = sleep(Duration::from_secs( + INTEGRATION_TEST_ALLOWED_TIME + .and_then(|x| x.parse().ok()) + .unwrap_or(600), + )) + .fuse(); + let t2 = async { + { + let t1 = future::join(alice.wait_for_blocks(3), bob.wait_for_blocks(3)).fuse(); + let t2 = alice.task_manager.future().fuse(); + let t3 = bob.task_manager.future().fuse(); + + pin_mut!(t1, t2, t3); + + select! { + _ = t1 => {}, + _ = t2 => panic!("service Alice failed"), + _ = t3 => panic!("service Bob failed"), + } + } + + alice.task_manager.terminate(); + bob.task_manager.terminate(); + } + .fuse(); + + pin_mut!(t1, t2); + + select! { + _ = t1 => { + panic!("the test took too long, maybe no blocks have been produced"); + }, + _ = t2 => {}, + } +} diff --git a/node/test-service/tests/call-function.rs b/node/test-service/tests/call-function.rs new file mode 100644 index 000000000000..b7b191fdab96 --- /dev/null +++ b/node/test-service/tests/call-function.rs @@ -0,0 +1,73 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use tokio::{time::delay_for as sleep, task::spawn}; +use futures::{pin_mut, select, FutureExt as _}; +use polkadot_test_service::*; +use sp_keyring::Sr25519Keyring::{Alice, Bob}; +use std::time::Duration; + +static INTEGRATION_TEST_ALLOWED_TIME: Option<&str> = option_env!("INTEGRATION_TEST_ALLOWED_TIME"); + +#[tokio::test] +async fn call_function_actually_work() { + let mut alice = run_test_node( + (move |fut, _| { + spawn(fut); + }) + .into(), + Alice, + || {}, + Vec::new(), + ); + let t1 = sleep(Duration::from_secs( + INTEGRATION_TEST_ALLOWED_TIME + .and_then(|x| x.parse().ok()) + .unwrap_or(600), + )) + .fuse(); + let t2 = async { + let function = polkadot_test_runtime::Call::Balances(pallet_balances::Call::transfer( + Default::default(), + 1, + )); + let output = alice.call_function(function, Bob).await.unwrap(); + + let res = output.result.expect("return value expected"); + let json = serde_json::from_str::(res.as_str()).expect("valid JSON"); + let object = json.as_object().expect("JSON is an object"); + assert!(object.contains_key("jsonrpc"), "key jsonrpc exists"); + let result = object.get("result"); + let result = result.expect("key result exists"); + assert_eq!( + result.as_str().map(|x| x.starts_with("0x")), + Some(true), + "result starts with 0x" + ); + + alice.task_manager.terminate(); + } + .fuse(); + + pin_mut!(t1, t2); + + select! { + _ = t1 => { + panic!("the test took too long, maybe no blocks have been produced"); + }, + _ = t2 => {}, + } +} diff --git a/runtime/test-runtime/Cargo.toml b/runtime/test-runtime/Cargo.toml index c4bf27750a34..ceac5dc13421 100644 --- a/runtime/test-runtime/Cargo.toml +++ b/runtime/test-runtime/Cargo.toml @@ -14,9 +14,11 @@ serde = { version = "1.0.102", default-features = false } serde_derive = { version = "1.0.102", optional = true } smallvec = "1.4.1" +authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } rstd = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -27,6 +29,7 @@ version = { package = "sp-version", git = "https://github.com/paritytech/substra tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +authority-discovery = { package = "pallet-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } authorship = { package = "pallet-authorship", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } babe = { package = "pallet-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } balances = { package = "pallet-balances", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -46,6 +49,7 @@ pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", system = { package = "frame-system", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } system_rpc_runtime_api = { package = "frame-system-rpc-runtime-api", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sudo = { package = "pallet-sudo", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } vesting = { package = "pallet-vesting", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false } @@ -68,6 +72,8 @@ default = ["std"] no_std = [] only-staking = [] std = [ + "authority-discovery-primitives/std", + "authority-discovery/std", "bitvec/std", "primitives/std", "rustc-hex/std", @@ -78,6 +84,7 @@ std = [ "sp-api/std", "tx-pool-api/std", "block-builder-api/std", + "offchain-primitives/std", "rstd/std", "sp-io/std", "frame-support/std", diff --git a/runtime/test-runtime/client/Cargo.toml b/runtime/test-runtime/client/Cargo.toml index a9439e060968..7dbb7d5ec5a0 100644 --- a/runtime/test-runtime/client/Cargo.toml +++ b/runtime/test-runtime/client/Cargo.toml @@ -6,19 +6,24 @@ edition = "2018" license = "GPL-3.0" [dependencies] +futures = "0.3.1" +codec = { package = "parity-scale-codec", version = "1.0.0" } + +# Polkadot dependencies +polkadot-primitives = { path = "../../../primitives" } +polkadot-runtime-common = { path = "../../common" } +polkadot-test-runtime = { path = ".." } +polkadot-test-service = { path = "../../../node/test-service" } + +# Substrate dependencies +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-light = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["test-helpers"], default-features = false } -substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -polkadot-test-runtime = { path = ".." } -polkadot-runtime-common = { path = "../../common" } -polkadot-primitives = { path = "../../../primitives" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } -codec = { package = "parity-scale-codec", version = "1.0.0" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } -futures = "0.3.1" +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/runtime/test-runtime/client/src/lib.rs b/runtime/test-runtime/client/src/lib.rs index 2e026647195f..2554f4f1c824 100644 --- a/runtime/test-runtime/client/src/lib.rs +++ b/runtime/test-runtime/client/src/lib.rs @@ -20,13 +20,18 @@ use std::sync::Arc; use std::collections::BTreeMap; +use std::convert::TryFrom; pub use substrate_test_client::*; pub use polkadot_test_runtime as runtime; -use sp_core::{sr25519, ChangesTrieConfiguration, map, twox_128}; +use sp_core::{ChangesTrieConfiguration, map, twox_128}; use sp_core::storage::{ChildInfo, Storage, StorageChild}; -use polkadot_test_runtime::genesismap::GenesisConfig; -use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, HashFor}; +use polkadot_test_runtime::GenesisConfig; +use polkadot_test_service::polkadot_local_testnet_genesis; +use sp_runtime::{ + traits::{Block as BlockT, Header as HeaderT, Hash as HashT, HashFor}, + BuildStorage, +}; use sc_consensus::LongestChain; use sc_client_api::light::{RemoteCallRequest, RemoteBodyRequest}; use sc_service::client::{ @@ -89,16 +94,10 @@ pub struct GenesisParameters { impl GenesisParameters { fn genesis_config(&self) -> GenesisConfig { - GenesisConfig::new( - self.changes_trie_config.clone(), - vec![ - sr25519::Public::from(Sr25519Keyring::Alice).into(), - sr25519::Public::from(Sr25519Keyring::Bob).into(), - sr25519::Public::from(Sr25519Keyring::Charlie).into(), - ], - 1000, - self.extra_storage.clone(), - ) + let config = polkadot_local_testnet_genesis(self.changes_trie_config.clone()); + config.assimilate_storage(&mut self.extra_storage.clone()).expect("Adding `system::GensisConfig` to the genesis"); + + config } } @@ -112,7 +111,7 @@ impl substrate_test_client::GenesisInit for GenesisParameters { fn genesis_storage(&self) -> Storage { use codec::Encode; - let mut storage = self.genesis_config().genesis_map(); + let mut storage = self.genesis_config().build_storage().unwrap(); let child_roots = storage.children_default.iter().map(|(sk, child_content)| { let state_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( @@ -323,20 +322,28 @@ pub fn new_native_executor() -> sc_executor::NativeExecutor { } /// Extrinsics that must be included in each block. -pub fn needed_extrinsics(heads: Vec) -> Vec { +/// +/// The index of the block must be provided to calculate a valid timestamp for the block. The value starts at 0 and +/// should be incremented by one for every block produced. +pub fn needed_extrinsics( + heads: Vec, + i: u64, +) -> Vec { use polkadot_runtime_common::parachains; + let timestamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) + .expect("now always later than unix epoch; qed") + .as_millis() + (i * polkadot_test_runtime::constants::time::SLOT_DURATION / 2) as u128; + vec![ polkadot_test_runtime::UncheckedExtrinsic { function: polkadot_test_runtime::Call::Parachains(parachains::Call::set_heads(heads)), signature: None, }, polkadot_test_runtime::UncheckedExtrinsic { - function: polkadot_test_runtime::Call::Timestamp(pallet_timestamp::Call::set({ - std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) - .expect("now always later than unix epoch; qed") - .as_millis() as u64 - })), + function: polkadot_test_runtime::Call::Timestamp(pallet_timestamp::Call::set( + u64::try_from(timestamp).expect("unexpected big timestamp"), + )), signature: None, } ] diff --git a/runtime/test-runtime/src/genesismap.rs b/runtime/test-runtime/src/genesismap.rs deleted file mode 100644 index f3ae9693d149..000000000000 --- a/runtime/test-runtime/src/genesismap.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2020 Parity Technologies (UK) Ltd. -// This file is part of Substrate. - -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Substrate. If not, see . - -//! Tool for creating the genesis block. - -use std::collections::BTreeMap; -use super::{AccountId, WASM_BINARY, constants::currency}; -use sp_core::ChangesTrieConfiguration; -use sp_core::storage::Storage; -use sp_runtime::BuildStorage; - -/// Configuration of a general Substrate test genesis block. -pub struct GenesisConfig { - changes_trie_config: Option, - balances: Vec<(AccountId, u128)>, - /// Additional storage key pairs that will be added to the genesis map. - extra_storage: Storage, -} - -impl GenesisConfig { - pub fn new( - changes_trie_config: Option, - endowed_accounts: Vec, - balance: u128, - extra_storage: Storage, - ) -> Self { - GenesisConfig { - changes_trie_config, - balances: endowed_accounts.into_iter().map(|a| (a, balance * currency::DOLLARS)).collect(), - extra_storage, - } - } - - pub fn genesis_map(&self) -> Storage { - // Assimilate the system genesis config. - let mut storage = Storage { - top: BTreeMap::new(), - children_default: self.extra_storage.children_default.clone(), - }; - let config = crate::GenesisConfig { - system: Some(system::GenesisConfig { - changes_trie_config: self.changes_trie_config.clone(), - code: WASM_BINARY.to_vec(), - }), - babe: None, - indices: None, - balances: Some(balances::GenesisConfig { - balances: self.balances.clone() - }), - staking: None, - session: None, - grandpa: None, - claims: None, - parachains: None, - registrar: None, - vesting: None, - }; - config.assimilate_storage(&mut storage).expect("Adding `system::GensisConfig` to the genesis"); - - storage - } -} diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index 31b17002fe6f..57ceffa4a96f 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -55,6 +55,7 @@ use frame_support::{ traits::{KeyOwnerProofSystem, Randomness}, weights::Weight, }; +use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use session::historical as session_historical; @@ -69,8 +70,6 @@ pub use parachains::Call as ParachainsCall; /// Constant values used within the runtime. pub mod constants; -#[cfg(feature = "std")] -pub mod genesismap; use constants::{time::*, currency::*, fee::*}; // Make the WASM binary available. @@ -166,8 +165,8 @@ impl system::offchain::SendTransactionTypes for Runtime where } parameter_types! { - pub const EpochDuration: u64 = EPOCH_DURATION_IN_BLOCKS as u64; - pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; + pub storage EpochDuration: u64 = EPOCH_DURATION_IN_BLOCKS as u64; + pub storage ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; } impl babe::Trait for Runtime { @@ -193,7 +192,7 @@ impl babe::Trait for Runtime { } parameter_types! { - pub const IndexDeposit: Balance = 1 * DOLLARS; + pub storage IndexDeposit: Balance = 1 * DOLLARS; } impl indices::Trait for Runtime { @@ -205,7 +204,7 @@ impl indices::Trait for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * CENTS; + pub storage ExistentialDeposit: Balance = 1 * CENTS; } impl balances::Trait for Runtime { @@ -218,7 +217,7 @@ impl balances::Trait for Runtime { } parameter_types! { - pub const TransactionByteFee: Balance = 10 * MILLICENTS; + pub storage TransactionByteFee: Balance = 10 * MILLICENTS; } impl transaction_payment::Trait for Runtime { @@ -230,7 +229,8 @@ impl transaction_payment::Trait for Runtime { } parameter_types! { - pub const MinimumPeriod: u64 = 0; + pub storage SlotDuration: u64 = SLOT_DURATION; + pub storage MinimumPeriod: u64 = SlotDuration::get() / 2; } impl timestamp::Trait for Runtime { type Moment = u64; @@ -240,7 +240,7 @@ impl timestamp::Trait for Runtime { } parameter_types! { - pub const UncleGenerations: u32 = 0; + pub storage UncleGenerations: u32 = 0; } // TODO: substrate#2986 implement this properly @@ -252,8 +252,8 @@ impl authorship::Trait for Runtime { } parameter_types! { - pub const Period: BlockNumber = 10 * MINUTES; - pub const Offset: BlockNumber = 0; + pub storage Period: BlockNumber = 10 * MINUTES; + pub storage Offset: BlockNumber = 0; } impl_opaque_keys! { @@ -265,7 +265,7 @@ impl_opaque_keys! { } parameter_types! { - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); + pub storage DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); } impl session::Trait for Runtime { @@ -299,16 +299,16 @@ pallet_staking_reward_curve::build! { parameter_types! { // Six sessions in an era (6 hours). - pub const SessionsPerEra: SessionIndex = 6; + pub storage SessionsPerEra: SessionIndex = 6; // 28 eras for unbonding (7 days). - pub const BondingDuration: staking::EraIndex = 28; + pub storage BondingDuration: staking::EraIndex = 28; // 28 eras in which slashes can be cancelled (7 days). - pub const SlashDeferDuration: staking::EraIndex = 28; + pub storage SlashDeferDuration: staking::EraIndex = 28; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; - pub const MaxNominatorRewardedPerValidator: u32 = 64; - pub const ElectionLookahead: BlockNumber = 0; - pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2; - pub const MaxIterations: u32 = 10; + pub storage MaxNominatorRewardedPerValidator: u32 = 64; + pub storage ElectionLookahead: BlockNumber = 0; + pub storage StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2; + pub storage MaxIterations: u32 = 10; pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); } @@ -366,12 +366,12 @@ impl attestations::Trait for Runtime { } parameter_types! { - pub const MaxCodeSize: u32 = 10 * 1024 * 1024; // 10 MB - pub const MaxHeadDataSize: u32 = 20 * 1024; // 20 KB + pub storage MaxCodeSize: u32 = 10 * 1024 * 1024; // 10 MB + pub storage MaxHeadDataSize: u32 = 20 * 1024; // 20 KB - pub const ValidationUpgradeFrequency: BlockNumber = 2; - pub const ValidationUpgradeDelay: BlockNumber = 1; - pub const SlashPeriod: BlockNumber = 1 * MINUTES; + pub storage ValidationUpgradeFrequency: BlockNumber = 2; + pub storage ValidationUpgradeDelay: BlockNumber = 1; + pub storage SlashPeriod: BlockNumber = 1 * MINUTES; } impl parachains::Trait for Runtime { @@ -447,7 +447,7 @@ impl system::offchain::SigningTypes for Runtime { } parameter_types! { - pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); + pub storage OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); } impl offences::Trait for Runtime { @@ -458,10 +458,12 @@ impl offences::Trait for Runtime { type WeightInfo = (); } +impl authority_discovery::Trait for Runtime {} + parameter_types! { - pub const ParathreadDeposit: Balance = 5 * DOLLARS; + pub storage ParathreadDeposit: Balance = 5 * DOLLARS; pub const QueueSize: usize = 2; - pub const MaxRetries: u32 = 3; + pub storage MaxRetries: u32 = 3; } impl registrar::Trait for Runtime { @@ -475,8 +477,8 @@ impl registrar::Trait for Runtime { } parameter_types! { - pub const LeasePeriod: BlockNumber = 100_000; - pub const EndingPeriod: BlockNumber = 1000; + pub storage LeasePeriod: BlockNumber = 100_000; + pub storage EndingPeriod: BlockNumber = 1000; } impl slots::Trait for Runtime { @@ -500,7 +502,7 @@ impl claims::Trait for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 100 * DOLLARS; + pub storage MinVestedTransfer: Balance = 100 * DOLLARS; } impl vesting::Trait for Runtime { @@ -511,6 +513,11 @@ impl vesting::Trait for Runtime { type WeightInfo = (); } +impl sudo::Trait for Runtime { + type Event = Event; + type Call = Call; +} + construct_runtime! { pub enum Runtime where Block = Block, @@ -536,6 +543,7 @@ construct_runtime! { Historical: session_historical::{Module}, Session: session::{Module, Call, Storage, Event, Config}, Grandpa: grandpa::{Module, Call, Storage, Config, Event}, + AuthorityDiscovery: authority_discovery::{Module, Call, Config}, // Claims. Usable initially. Claims: claims::{Module, Call, Storage, Event, Config, ValidateUnsigned}, @@ -549,6 +557,9 @@ construct_runtime! { // Vesting. Usable initially, but removed once all vesting is finished. Vesting: vesting::{Module, Call, Storage, Event, Config}, + + // Sudo. Last module. + Sudo: sudo::{Module, Call, Storage, Config, Event}, } } @@ -642,6 +653,18 @@ sp_api::impl_runtime_apis! { } } + impl offchain_primitives::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { + fn authorities() -> Vec { + Vec::new() + } + } + impl parachain::ParachainHost for Runtime { fn validators() -> Vec { Parachains::authorities() diff --git a/service/src/grandpa_support.rs b/service/src/grandpa_support.rs index a875c4b45a37..794b4e4fc180 100644 --- a/service/src/grandpa_support.rs +++ b/service/src/grandpa_support.rs @@ -23,7 +23,7 @@ use sp_runtime::traits::{Block as BlockT, NumberFor}; /// same last finalized block) after a given block at height `N` has been /// finalized and for a delay of `M` blocks, i.e. until the best block reaches /// `N` + `M`, the voter will keep voting for block `N`. -pub(crate) struct PauseAfterBlockFor(pub(crate) N, pub(crate) N); +pub struct PauseAfterBlockFor(pub N, pub N); impl grandpa::VotingRule for PauseAfterBlockFor> where Block: BlockT, @@ -250,17 +250,21 @@ mod tests { let mut push_blocks = { let mut client = client.clone(); + let mut base = 0; + move |n| { - for _ in 0..n { + for i in 0..n { let mut builder = client.new_block(Default::default()).unwrap(); - for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![]) { + for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![], base + i) { builder.push(extrinsic).unwrap() } let block = builder.build().unwrap().block; client.import(BlockOrigin::Own, block).unwrap(); } + + base += n; } }; diff --git a/service/src/lib.rs b/service/src/lib.rs index 33d02f53154a..313791611b1c 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -17,7 +17,7 @@ //! Polkadot service. Specialized wrapper over substrate service. pub mod chain_spec; -mod grandpa_support; +pub mod grandpa_support; mod client; use std::sync::Arc; @@ -136,27 +136,20 @@ impl IdentifyVariant for Box { } } -// If we're using prometheus, use a registry with a prefix of `polkadot`. -fn set_prometheus_registry(config: &mut Configuration) -> Result<(), ServiceError> { - if let Some(PrometheusConfig { registry, .. }) = config.prometheus_config.as_mut() { - *registry = Registry::new_custom(Some("polkadot".into()), None)?; - } - - Ok(()) -} - /// Starts a `ServiceBuilder` for a full service. /// /// Use this macro if you don't actually need the full service, but just the builder in order to /// be able to perform chain operations. +#[macro_export] macro_rules! new_full_start { - ($config:expr, $runtime:ty, $executor:ty) => {{ - set_prometheus_registry(&mut $config)?; - - let mut import_setup = None; - let mut rpc_setup = None; - let inherent_data_providers = inherents::InherentDataProviders::new(); - let builder = service::ServiceBuilder::new_full::< + (prometheus_setup $config:expr) => {{ + // If we're using prometheus, use a registry with a prefix of `polkadot`. + if let Some(PrometheusConfig { registry, .. }) = $config.prometheus_config.as_mut() { + *registry = Registry::new_custom(Some("polkadot".into()), None)?; + } + }}; + (start_builder $config:expr, $runtime:ty, $executor:ty $(,)?) => {{ + service::ServiceBuilder::new_full::< Block, $runtime, $executor >($config)? .with_select_chain(|_, backend| { @@ -174,56 +167,58 @@ macro_rules! new_full_start { ); Ok(pool) })? - .with_import_queue(| - config, - client, - mut select_chain, - _, - spawn_task_handle, - registry, - | { - let select_chain = select_chain.take() - .ok_or_else(|| service::Error::SelectChainRequired)?; - - let grandpa_hard_forks = if config.chain_spec.is_kusama() { - grandpa_support::kusama_hard_forks() - } else { - Vec::new() - }; + }}; + (import_queue_setup + $builder:expr, $inherent_data_providers:expr, $import_setup:expr, $grandpa_hard_forks:expr, $(,)? + ) => {{ + $builder.with_import_queue(| + _config, + client, + mut select_chain, + _, + spawn_task_handle, + registry, + | { + let select_chain = select_chain.take() + .ok_or_else(|| service::Error::SelectChainRequired)?; + + let (grandpa_block_import, grandpa_link) = + grandpa::block_import_with_authority_set_hard_forks( + client.clone(), + &(client.clone() as Arc<_>), + select_chain.clone(), + $grandpa_hard_forks, + )?; - let (grandpa_block_import, grandpa_link) = - grandpa::block_import_with_authority_set_hard_forks( - client.clone(), - &(client.clone() as Arc<_>), - select_chain.clone(), - grandpa_hard_forks, - )?; + let justification_import = grandpa_block_import.clone(); - let justification_import = grandpa_block_import.clone(); + let (block_import, babe_link) = babe::block_import( + babe::Config::get_or_compute(&*client)?, + grandpa_block_import, + client.clone(), + )?; - let (block_import, babe_link) = babe::block_import( - babe::Config::get_or_compute(&*client)?, - grandpa_block_import, - client.clone(), - )?; + let import_queue = babe::import_queue( + babe_link.clone(), + block_import.clone(), + Some(Box::new(justification_import)), + None, + client, + select_chain, + $inherent_data_providers.clone(), + spawn_task_handle, + registry, + )?; - let import_queue = babe::import_queue( - babe_link.clone(), - block_import.clone(), - Some(Box::new(justification_import)), - None, - client, - select_chain, - inherent_data_providers.clone(), - spawn_task_handle, - registry, - )?; + $import_setup = Some((block_import, grandpa_link, babe_link)); + Ok(import_queue) + })? + }}; + (finish_builder_setup $builder:expr, $inherent_data_providers:expr, $import_setup:expr) => {{ + let mut rpc_setup = None; - import_setup = Some((block_import, grandpa_link, babe_link)); - Ok(import_queue) - })? - .with_rpc_extensions_builder(|builder| { - let grandpa_link = import_setup.as_ref().map(|s| &s.1) + let builder = $builder.with_rpc_extensions_builder(|builder| { + let grandpa_link = $import_setup.as_ref().map(|s| &s.1) .expect("GRANDPA LinkHalf is present for full services or set up failed; qed."); let shared_authority_set = grandpa_link.shared_authority_set().clone(); @@ -231,7 +226,7 @@ macro_rules! new_full_start { rpc_setup = Some((shared_voter_state.clone())); - let babe_link = import_setup.as_ref().map(|s| &s.2) + let babe_link = $import_setup.as_ref().map(|s| &s.2) .expect("BabeLink is present for full services or set up faile; qed."); let babe_config = babe_link.config().clone(); @@ -264,22 +259,47 @@ macro_rules! new_full_start { }) })?; - (builder, import_setup, inherent_data_providers, rpc_setup) - }} + (builder, $import_setup, $inherent_data_providers, rpc_setup) + }}; + ($config:expr, $runtime:ty, $executor:ty $(,)?) => {{ + let inherent_data_providers = inherents::InherentDataProviders::new(); + let mut import_setup = None; + new_full_start!(prometheus_setup $config); + let grandpa_hard_forks = if $config.chain_spec.is_kusama() { + $crate::grandpa_support::kusama_hard_forks() + } else { + Vec::new() + }; + let builder = new_full_start!(start_builder $config, $runtime, $executor); + let builder = new_full_start!(import_queue_setup + builder, inherent_data_providers, import_setup, grandpa_hard_forks, + ); + new_full_start!(finish_builder_setup builder, inherent_data_providers, import_setup) + }}; + (test $config:expr, $runtime:ty, $executor:ty $(,)?) => {{ + let inherent_data_providers = inherents::InherentDataProviders::new(); + let mut import_setup = None; + let grandpa_hard_forks = Vec::new(); + let builder = new_full_start!(start_builder $config, $runtime, $executor); + let builder = new_full_start!(import_queue_setup + builder, inherent_data_providers, import_setup, grandpa_hard_forks, + ); + new_full_start!(finish_builder_setup builder, inherent_data_providers, import_setup) + }}; } /// Builds a new service for a full client. #[macro_export] macro_rules! new_full { ( + with_full_start $config:expr, $collating_for:expr, $max_block_data_size:expr, $authority_discovery_enabled:expr, $slot_duration:expr, $grandpa_pause:expr, - $runtime:ty, - $dispatch:ty, + $new_full_start:expr $(,)? ) => {{ use sc_network::Event; use sc_client_api::ExecutorProvider; @@ -290,22 +310,21 @@ macro_rules! new_full { let role = $config.role.clone(); let is_authority = role.is_authority() && !is_collator; let force_authoring = $config.force_authoring; - let max_block_data_size = $max_block_data_size; let db_path = match $config.database.path() { Some(path) => std::path::PathBuf::from(path), None => return Err("Starting a Polkadot service with a custom database isn't supported".to_string().into()), }; + let max_block_data_size = $max_block_data_size; let disable_grandpa = $config.disable_grandpa; let name = $config.network.node_name.clone(); let authority_discovery_enabled = $authority_discovery_enabled; let slot_duration = $slot_duration; - let (builder, mut import_setup, inherent_data_providers, mut rpc_setup) = - new_full_start!($config, $runtime, $dispatch); + let (builder, mut import_setup, inherent_data_providers, mut rpc_setup) = $new_full_start; let ServiceComponents { client, network, select_chain, keystore, transaction_pool, prometheus_registry, - task_manager, telemetry_on_connect_sinks, .. + task_manager, telemetry_on_connect_sinks, rpc_handlers, .. } = builder .with_finality_proof_provider(|client, backend| { let provider = client as Arc>; @@ -510,7 +529,7 @@ macro_rules! new_full { ); grandpa::VotingRulesBuilder::default() - .add(grandpa_support::PauseAfterBlockFor(block, delay)) + .add($crate::grandpa_support::PauseAfterBlockFor(block, delay)) .build() }, None => @@ -542,15 +561,58 @@ macro_rules! new_full { } handles.polkadot_network = Some(polkadot_network_service); - (task_manager, client, handles) - }} + (task_manager, client, handles, network, rpc_handlers) + }}; + ( + $config:expr, + $collating_for:expr, + $max_block_data_size:expr, + $authority_discovery_enabled:expr, + $slot_duration:expr, + $grandpa_pause:expr, + $runtime:ty, + $dispatch:ty, + ) => {{ + new_full!(with_full_start + $config, + $collating_for, + $max_block_data_size, + $authority_discovery_enabled, + $slot_duration, + $grandpa_pause, + new_full_start!($config, $runtime, $dispatch), + ) + }}; + ( + test + $config:expr, + $collating_for:expr, + $max_block_data_size:expr, + $authority_discovery_enabled:expr, + $slot_duration:expr, + $runtime:ty, + $dispatch:ty, + ) => {{ + new_full!(with_full_start + $config, + $collating_for, + $max_block_data_size, + $authority_discovery_enabled, + $slot_duration, + None, + new_full_start!(test $config, $runtime, $dispatch), + ) + }}; } /// Builds a new service for a light client. #[macro_export] macro_rules! new_light { ($config:expr, $runtime:ty, $dispatch:ty) => {{ - crate::set_prometheus_registry(&mut $config)?; + // If we're using prometheus, use a registry with a prefix of `polkadot`. + if let Some(PrometheusConfig { registry, .. }) = $config.prometheus_config.as_mut() { + *registry = Registry::new_custom(Some("polkadot".into()), None)?; + } let inherent_data_providers = inherents::InherentDataProviders::new(); ServiceBuilder::new_light::($config)? @@ -646,7 +708,7 @@ macro_rules! new_light { /// Builds a new object suitable for chain operations. pub fn new_chain_ops(mut config: Configuration) -> Result< ( - Arc>, + Arc>, Arc>, consensus_common::import_queue::BasicQueue>, TaskManager, @@ -685,7 +747,7 @@ pub fn polkadot_new_full( FullNodeHandles, ), ServiceError> { - let (service, client, handles) = new_full!( + let (service, client, handles, _, _) = new_full!( config, collating_for, max_block_data_size, @@ -719,7 +781,7 @@ pub fn kusama_new_full( FullNodeHandles ), ServiceError> { - let (service, client, handles) = new_full!( + let (service, client, handles, _, _) = new_full!( config, collating_for, max_block_data_size, @@ -753,7 +815,7 @@ pub fn westend_new_full( FullNodeHandles, ), ServiceError> { - let (service, client, handles) = new_full!( + let (service, client, handles, _, _) = new_full!( config, collating_for, max_block_data_size,