diff --git a/Cargo.lock b/Cargo.lock index 290cad9e47119..1824e956ced36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -502,16 +502,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "bitvec" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" -dependencies = [ - "either", - "radium 0.3.0", -] - [[package]] name = "bitvec" version = "0.20.2" @@ -519,7 +509,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f682656975d3a682daff957be4ddeb65d6ad656737cd821f2d00685ae466af1" dependencies = [ "funty", - "radium 0.6.2", + "radium", "tap", "wyz", ] @@ -675,12 +665,6 @@ version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -[[package]] -name = "byte-slice-cast" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" - [[package]] name = "byte-slice-cast" version = "1.0.0" @@ -1668,7 +1652,7 @@ dependencies = [ "futures-timer 3.0.2", "log", "num-traits", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "rand 0.8.3", ] @@ -1714,7 +1698,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" name = "fork-tree" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", ] [[package]] @@ -1736,7 +1720,7 @@ dependencies = [ "hex-literal", "linregress", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "paste 1.0.4", "serde", "sp-api", @@ -1755,7 +1739,7 @@ dependencies = [ "chrono", "frame-benchmarking", "handlebars", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-cli", "sc-client-db", "sc-executor", @@ -1775,7 +1759,7 @@ version = "3.0.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-arithmetic", "sp-npos-elections", "sp-runtime", @@ -1792,7 +1776,7 @@ dependencies = [ "pallet-balances", "pallet-indices", "pallet-transaction-payment", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -1806,7 +1790,7 @@ dependencies = [ name = "frame-metadata" version = "13.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-std", @@ -1823,7 +1807,7 @@ dependencies = [ "impl-trait-for-tuples", "log", "once_cell", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "paste 1.0.4", "pretty_assertions", @@ -1878,7 +1862,7 @@ dependencies = [ "frame-metadata", "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "pretty_assertions", "rustversion", "serde", @@ -1899,7 +1883,7 @@ dependencies = [ "frame-support", "impl-trait-for-tuples", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-externalities", @@ -1917,7 +1901,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -1929,7 +1913,7 @@ dependencies = [ name = "frame-system-rpc-runtime-api" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", ] @@ -1938,7 +1922,7 @@ name = "frame-try-runtime" version = "0.9.0" dependencies = [ "frame-support", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-runtime", "sp-std", @@ -2660,7 +2644,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", ] [[package]] @@ -4120,7 +4104,7 @@ dependencies = [ "pallet-staking", "pallet-timestamp", "pallet-transaction-payment", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "platforms", "rand 0.7.3", @@ -4193,7 +4177,7 @@ dependencies = [ "pallet-timestamp", "pallet-transaction-payment", "pallet-treasury", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-executor", "sp-application-crypto", "sp-consensus-babe", @@ -4215,7 +4199,7 @@ version = "0.8.0" dependencies = [ "derive_more", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-cli", "sc-client-api", "sc-service", @@ -4230,7 +4214,7 @@ name = "node-primitives" version = "2.0.0" dependencies = [ "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "pretty_assertions", "sp-application-crypto", "sp-core", @@ -4337,7 +4321,7 @@ dependencies = [ "pallet-treasury", "pallet-utility", "pallet-vesting", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-api", "sp-authority-discovery", @@ -4416,7 +4400,7 @@ dependencies = [ "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-api", "sp-block-builder", @@ -4455,7 +4439,7 @@ dependencies = [ "pallet-timestamp", "pallet-transaction-payment", "pallet-treasury", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-block-builder", "sc-cli", "sc-client-api", @@ -4630,7 +4614,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4645,7 +4629,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4662,7 +4646,7 @@ dependencies = [ "lazy_static", "pallet-session", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "serde", "sp-application-crypto", @@ -4680,7 +4664,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-session", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-application-crypto", "sp-authority-discovery", @@ -4698,7 +4682,7 @@ dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-authorship", "sp-core", @@ -4724,7 +4708,7 @@ dependencies = [ "pallet-staking", "pallet-staking-reward-curve", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-application-crypto", "sp-consensus-babe", @@ -4746,7 +4730,7 @@ dependencies = [ "frame-system", "log", "pallet-transaction-payment", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4763,7 +4747,7 @@ dependencies = [ "frame-system", "pallet-balances", "pallet-treasury", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4782,7 +4766,7 @@ dependencies = [ "hex-literal", "log", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4805,7 +4789,7 @@ dependencies = [ "pallet-contracts-proc-macro", "pallet-randomness-collective-flip", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-wasm 0.41.0", "paste 1.0.4", "pretty_assertions", @@ -4827,7 +4811,7 @@ name = "pallet-contracts-primitives" version = "3.0.0" dependencies = [ "bitflags", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-runtime", "sp-std", ] @@ -4850,7 +4834,7 @@ dependencies = [ "jsonrpc-derive", "pallet-contracts-primitives", "pallet-contracts-rpc-runtime-api", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "serde_json", "sp-api", @@ -4865,7 +4849,7 @@ name = "pallet-contracts-rpc-runtime-api" version = "3.0.0" dependencies = [ "pallet-contracts-primitives", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-runtime", "sp-std", @@ -4881,7 +4865,7 @@ dependencies = [ "hex-literal", "pallet-balances", "pallet-scheduler", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4902,7 +4886,7 @@ dependencies = [ "hex-literal", "log", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "paste 1.0.4", "rand 0.7.3", @@ -4926,7 +4910,7 @@ dependencies = [ "frame-system", "hex-literal", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4944,7 +4928,7 @@ dependencies = [ "hex-literal", "log", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4963,7 +4947,7 @@ dependencies = [ "frame-system", "log", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4979,7 +4963,7 @@ dependencies = [ "frame-system", "lite-json", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -4994,7 +4978,7 @@ version = "2.0.1" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5011,7 +4995,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-arithmetic", "sp-core", @@ -5037,7 +5021,7 @@ dependencies = [ "pallet-staking", "pallet-staking-reward-curve", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-application-crypto", "sp-core", @@ -5059,7 +5043,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5077,7 +5061,7 @@ dependencies = [ "log", "pallet-authorship", "pallet-session", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-application-crypto", "sp-core", @@ -5095,7 +5079,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5113,7 +5097,7 @@ dependencies = [ "frame-support-test", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5127,7 +5111,7 @@ version = "3.0.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5146,7 +5130,7 @@ dependencies = [ "frame-system", "hex-literal", "pallet-mmr-primitives", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5162,7 +5146,7 @@ dependencies = [ "frame-system", "hex-literal", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-api", "sp-core", @@ -5178,7 +5162,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "pallet-mmr-primitives", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "serde_json", "sp-api", @@ -5196,7 +5180,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5211,7 +5195,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5226,7 +5210,7 @@ dependencies = [ "frame-support", "frame-system", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5242,7 +5226,7 @@ dependencies = [ "frame-system", "log", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5268,7 +5252,7 @@ dependencies = [ "pallet-staking", "pallet-staking-reward-curve", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5286,7 +5270,7 @@ dependencies = [ "frame-system", "pallet-balances", "pallet-utility", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5300,7 +5284,7 @@ version = "3.0.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "safe-mix", "serde", "sp-core", @@ -5317,7 +5301,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5333,7 +5317,7 @@ dependencies = [ "frame-support", "frame-system", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5349,7 +5333,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5366,7 +5350,7 @@ dependencies = [ "impl-trait-for-tuples", "lazy_static", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-application-crypto", "sp-core", @@ -5391,7 +5375,7 @@ dependencies = [ "pallet-staking", "pallet-staking-reward-curve", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "rand 0.7.3", "serde", "sp-core", @@ -5409,7 +5393,7 @@ dependencies = [ "frame-support-test", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "rand_chacha 0.2.2", "serde", "sp-core", @@ -5433,7 +5417,7 @@ dependencies = [ "pallet-session", "pallet-staking-reward-curve", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "paste 1.0.4", "rand_chacha 0.2.2", @@ -5475,7 +5459,7 @@ version = "3.0.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5490,7 +5474,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5506,7 +5490,7 @@ dependencies = [ "frame-system", "impl-trait-for-tuples", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-inherents", @@ -5525,7 +5509,7 @@ dependencies = [ "frame-system", "pallet-balances", "pallet-treasury", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5541,7 +5525,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "serde_json", "smallvec 1.6.1", @@ -5560,7 +5544,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "pallet-transaction-payment-rpc-runtime-api", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-blockchain", "sp-core", @@ -5573,7 +5557,7 @@ name = "pallet-transaction-payment-rpc-runtime-api" version = "3.0.0" dependencies = [ "pallet-transaction-payment", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-runtime", ] @@ -5587,7 +5571,7 @@ dependencies = [ "frame-system", "impl-trait-for-tuples", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5604,7 +5588,7 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5622,7 +5606,7 @@ dependencies = [ "frame-system", "hex-literal", "pallet-balances", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -5666,18 +5650,6 @@ dependencies = [ "url 2.2.1", ] -[[package]] -name = "parity-scale-codec" -version = "1.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b26b16c7687c3075982af47719e481815df30bc544f7a6690763a25ca16e9d" -dependencies = [ - "arrayvec 0.5.2", - "bitvec 0.17.4", - "byte-slice-cast 0.3.5", - "serde", -] - [[package]] name = "parity-scale-codec" version = "2.1.0" @@ -5685,8 +5657,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "731f4d179ed52b1c7eeb29baf29c604ea9301b889b23ce93660220a5465d5c6f" dependencies = [ "arrayvec 0.7.0", - "bitvec 0.20.2", - "byte-slice-cast 1.0.0", + "bitvec", + "byte-slice-cast", "parity-scale-codec-derive", "serde", ] @@ -6381,12 +6353,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" - [[package]] name = "radium" version = "0.6.2" @@ -6689,7 +6655,7 @@ dependencies = [ "jsonrpsee-proc-macros", "jsonrpsee-types", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-core", "sp-io", "sp-runtime", @@ -6894,7 +6860,7 @@ dependencies = [ "futures-timer 3.0.2", "libp2p", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "prost", "prost-build", "quickcheck", @@ -6921,7 +6887,7 @@ dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-block-builder", "sc-client-api", @@ -6943,7 +6909,7 @@ dependencies = [ name = "sc-block-builder" version = "0.9.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-client-api", "sp-api", "sp-block-builder", @@ -6961,7 +6927,7 @@ name = "sc-chain-spec" version = "3.0.0" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-chain-spec-derive", "sc-consensus-babe", "sc-consensus-epochs", @@ -6997,7 +6963,7 @@ dependencies = [ "libp2p", "log", "names", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "rand 0.7.3", "regex", "rpassword", @@ -7036,7 +7002,7 @@ dependencies = [ "kvdb-memorydb", "lazy_static", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-executor", "sp-api", @@ -7073,7 +7039,7 @@ dependencies = [ "linked-hash-map", "log", "parity-db", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "parking_lot 0.11.1", "quickcheck", @@ -7116,7 +7082,7 @@ dependencies = [ "futures-timer 3.0.2", "getrandom 0.2.2", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-block-builder", "sc-client-api", @@ -7162,7 +7128,7 @@ dependencies = [ "num-bigint", "num-rational", "num-traits", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "pdqselect", "rand 0.7.3", @@ -7238,7 +7204,7 @@ name = "sc-consensus-epochs" version = "0.9.0" dependencies = [ "fork-tree", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-client-api", "sc-consensus", "sp-blockchain", @@ -7257,7 +7223,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-basic-authorship", "sc-client-api", @@ -7293,7 +7259,7 @@ dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-client-api", "sp-api", @@ -7316,7 +7282,7 @@ dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-client-api", "sc-telemetry", "sp-api", @@ -7358,7 +7324,7 @@ dependencies = [ "lazy_static", "libsecp256k1", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-wasm 0.41.0", "parking_lot 0.11.1", "paste 1.0.4", @@ -7393,7 +7359,7 @@ name = "sc-executor-common" version = "0.9.0" dependencies = [ "derive_more", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-wasm 0.41.0", "pwasm-utils 0.14.0", "sp-allocator", @@ -7409,7 +7375,7 @@ name = "sc-executor-wasmi" version = "0.9.0" dependencies = [ "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-executor-common", "sp-allocator", "sp-core", @@ -7424,7 +7390,7 @@ version = "0.9.0" dependencies = [ "assert_matches", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-wasm 0.41.0", "pwasm-utils 0.14.0", "sc-executor-common", @@ -7450,7 +7416,7 @@ dependencies = [ "futures-timer 3.0.2", "linked-hash-map", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "pin-project 1.0.5", "rand 0.7.3", @@ -7497,7 +7463,7 @@ dependencies = [ "jsonrpc-pubsub", "lazy_static", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-block-builder", "sc-client-api", "sc-finality-grandpa", @@ -7523,7 +7489,7 @@ dependencies = [ "futures 0.3.13", "log", "num-traits", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "prost", "rand 0.8.3", @@ -7583,7 +7549,7 @@ version = "3.0.0" dependencies = [ "hash-db", "lazy_static", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-client-api", "sc-executor", @@ -7622,7 +7588,7 @@ dependencies = [ "log", "lru", "nohash-hasher", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "pin-project 1.0.5", "prost", @@ -7717,7 +7683,7 @@ dependencies = [ "lazy_static", "log", "num_cpus", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "rand 0.7.3", "sc-block-builder", @@ -7772,7 +7738,7 @@ dependencies = [ "jsonrpc-pubsub", "lazy_static", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-block-builder", "sc-cli", @@ -7813,7 +7779,7 @@ dependencies = [ "jsonrpc-derive", "jsonrpc-pubsub", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "serde", "serde_json", @@ -7872,7 +7838,7 @@ dependencies = [ "jsonrpc-pubsub", "lazy_static", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "parking_lot 0.11.1", "pin-project 1.0.5", @@ -7935,7 +7901,7 @@ dependencies = [ "futures 0.3.13", "hex-literal", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-block-builder", "sc-client-api", @@ -7967,7 +7933,7 @@ name = "sc-state-db" version = "0.9.0" dependencies = [ "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "parity-util-mem-derive", "parking_lot 0.11.1", @@ -8060,7 +8026,7 @@ dependencies = [ "futures 0.3.13", "linked-hash-map", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "parking_lot 0.11.1", "retain_mut", @@ -8085,7 +8051,7 @@ dependencies = [ "hex", "intervalier", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "parking_lot 0.11.1", "sc-block-builder", @@ -8513,7 +8479,7 @@ version = "3.0.0" dependencies = [ "hash-db", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api-proc-macro", "sp-core", "sp-runtime", @@ -8541,7 +8507,7 @@ version = "2.0.1" dependencies = [ "criterion", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "rustversion", "sc-block-builder", "sp-api", @@ -8560,7 +8526,7 @@ dependencies = [ name = "sp-application-crypto" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-core", "sp-io", @@ -8586,7 +8552,7 @@ dependencies = [ "criterion", "integer-sqrt", "num-traits", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "primitive-types", "rand 0.7.3", "serde", @@ -8610,7 +8576,7 @@ dependencies = [ name = "sp-authority-discovery" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-application-crypto", "sp-runtime", @@ -8621,7 +8587,7 @@ dependencies = [ name = "sp-authorship" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-inherents", "sp-runtime", "sp-std", @@ -8631,7 +8597,7 @@ dependencies = [ name = "sp-block-builder" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-inherents", "sp-runtime", @@ -8645,7 +8611,7 @@ dependencies = [ "futures 0.3.13", "log", "lru", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sp-api", "sp-consensus", @@ -8672,7 +8638,7 @@ dependencies = [ "futures-timer 3.0.2", "libp2p", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "serde", "sp-api", @@ -8694,7 +8660,7 @@ dependencies = [ name = "sp-consensus-aura" version = "0.9.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-application-crypto", "sp-consensus", @@ -8710,7 +8676,7 @@ name = "sp-consensus-babe" version = "0.9.0" dependencies = [ "merlin", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-api", "sp-application-crypto", @@ -8729,7 +8695,7 @@ dependencies = [ name = "sp-consensus-pow" version = "0.9.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-core", "sp-runtime", @@ -8740,7 +8706,7 @@ dependencies = [ name = "sp-consensus-slots" version = "0.9.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-arithmetic", "sp-runtime", ] @@ -8749,7 +8715,7 @@ dependencies = [ name = "sp-consensus-vrf" version = "0.9.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "schnorrkel", "sp-core", "sp-runtime", @@ -8777,7 +8743,7 @@ dependencies = [ "log", "merlin", "num-traits", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "parking_lot 0.11.1", "pretty_assertions", @@ -8827,7 +8793,7 @@ name = "sp-externalities" version = "0.9.0" dependencies = [ "environmental", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-std", "sp-storage", ] @@ -8838,7 +8804,7 @@ version = "3.0.0" dependencies = [ "finality-grandpa", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-api", "sp-application-crypto", @@ -8852,7 +8818,7 @@ dependencies = [ name = "sp-inherents" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sp-core", "sp-std", @@ -8867,7 +8833,7 @@ dependencies = [ "hash-db", "libsecp256k1", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sp-core", "sp-externalities", @@ -8900,7 +8866,7 @@ dependencies = [ "derive_more", "futures 0.3.13", "merlin", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "rand 0.7.3", "rand_chacha 0.2.2", @@ -8914,7 +8880,7 @@ dependencies = [ name = "sp-npos-elections" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "rand 0.7.3", "serde", "sp-arithmetic", @@ -8929,7 +8895,7 @@ dependencies = [ name = "sp-npos-elections-compact" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "proc-macro-crate 1.0.0", "proc-macro2", "quote", @@ -8944,7 +8910,7 @@ name = "sp-npos-elections-fuzzer" version = "2.0.0-alpha.5" dependencies = [ "honggfuzz", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "rand 0.7.3", "sp-arithmetic", "sp-npos-elections", @@ -8987,7 +8953,7 @@ dependencies = [ "hash256-std-hasher", "impl-trait-for-tuples", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "paste 1.0.4", "rand 0.7.3", @@ -9009,7 +8975,7 @@ name = "sp-runtime-interface" version = "3.0.0" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "primitive-types", "rustversion", "sp-core", @@ -9080,7 +9046,7 @@ name = "sp-sandbox" version = "0.9.0" dependencies = [ "assert_matches", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-core", "sp-io", "sp-std", @@ -9101,7 +9067,7 @@ dependencies = [ name = "sp-session" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-core", "sp-runtime", @@ -9113,7 +9079,7 @@ dependencies = [ name = "sp-staking" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-runtime", "sp-std", ] @@ -9126,7 +9092,7 @@ dependencies = [ "hex-literal", "log", "num-traits", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "pretty_assertions", "rand 0.7.3", @@ -9151,7 +9117,7 @@ name = "sp-storage" version = "3.0.0" dependencies = [ "impl-serde", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "ref-cast", "serde", "sp-debug-derive", @@ -9163,7 +9129,7 @@ name = "sp-tasks" version = "3.0.0" dependencies = [ "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-core", "sp-externalities", "sp-io", @@ -9175,7 +9141,7 @@ dependencies = [ name = "sp-test-primitives" version = "2.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "serde", "sp-application-crypto", @@ -9187,7 +9153,7 @@ dependencies = [ name = "sp-timestamp" version = "3.0.0" dependencies = [ - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-api", "sp-inherents", "sp-runtime", @@ -9200,7 +9166,7 @@ name = "sp-tracing" version = "3.0.0" dependencies = [ "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-std", "tracing", "tracing-core", @@ -9214,7 +9180,7 @@ dependencies = [ "derive_more", "futures 0.3.13", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-api", "sp-blockchain", @@ -9230,7 +9196,7 @@ dependencies = [ "hash-db", "hex-literal", "memory-db", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-core", "sp-runtime", "sp-std", @@ -9256,7 +9222,7 @@ name = "sp-version" version = "3.0.0" dependencies = [ "impl-serde", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "serde", "sp-runtime", "sp-std", @@ -9267,7 +9233,7 @@ name = "sp-wasm-interface" version = "3.0.0" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sp-std", "wasmi", ] @@ -9442,7 +9408,7 @@ dependencies = [ "futures 0.3.13", "jsonrpc-client-transports", "jsonrpc-core", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-rpc-api", "serde", "sp-storage", @@ -9459,7 +9425,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-client-api", "sc-rpc-api", "sc-transaction-pool", @@ -9496,7 +9462,7 @@ dependencies = [ "futures 0.3.13", "hash-db", "hex", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-client-api", "sc-client-db", "sc-consensus", @@ -9528,7 +9494,7 @@ dependencies = [ "memory-db", "pallet-babe", "pallet-timestamp", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parity-util-mem", "sc-block-builder", "sc-executor", @@ -9564,7 +9530,7 @@ name = "substrate-test-runtime-client" version = "2.0.0" dependencies = [ "futures 0.3.13", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "sc-block-builder", "sc-client-api", "sc-consensus", @@ -9585,7 +9551,7 @@ version = "2.0.0" dependencies = [ "derive_more", "futures 0.3.13", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "parking_lot 0.11.1", "sc-transaction-graph", "sp-blockchain", @@ -9719,20 +9685,14 @@ version = "0.9.0" dependencies = [ "env_logger 0.7.1", "frame-system", - "futures 0.1.31", "futures 0.3.13", "jsonrpc-core", "log", - "node-cli", - "parity-scale-codec 1.3.7", - "rand 0.7.3", "sc-basic-authorship", "sc-cli", "sc-client-api", - "sc-consensus-babe", "sc-consensus-manual-seal", "sc-executor", - "sc-finality-grandpa", "sc-informant", "sc-network", "sc-rpc", @@ -9744,7 +9704,6 @@ dependencies = [ "sp-block-builder", "sp-blockchain", "sp-consensus", - "sp-consensus-babe", "sp-core", "sp-externalities", "sp-inherents", @@ -9775,7 +9734,6 @@ dependencies = [ "pallet-balances", "pallet-sudo", "pallet-transaction-payment", - "rand 0.8.3", "sc-client-api", "sc-consensus", "sc-consensus-babe", @@ -10297,7 +10255,7 @@ dependencies = [ "hash-db", "keccak-hasher", "memory-db", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "trie-db", "trie-root", "trie-standardmap", @@ -10390,7 +10348,7 @@ version = "0.9.0" dependencies = [ "frame-try-runtime", "log", - "parity-scale-codec 2.1.0", + "parity-scale-codec", "remote-externalities", "sc-cli", "sc-client-api", diff --git a/bin/node/test-runner-example/Cargo.toml b/bin/node/test-runner-example/Cargo.toml index f94575e8e621b..9d810ddbcfde0 100644 --- a/bin/node/test-runner-example/Cargo.toml +++ b/bin/node/test-runner-example/Cargo.toml @@ -36,5 +36,4 @@ sp-api = { version = "3.0.0", path = "../../../primitives/api" } sp-inherents = { version = "3.0.0", path = "../../../primitives/inherents" } sp-keystore = { version = "0.9.0", path = "../../../primitives/keystore" } -rand = "0.8.3" log = "0.4.14" diff --git a/bin/node/test-runner-example/src/lib.rs b/bin/node/test-runner-example/src/lib.rs index 22cfffa7f23a7..ac589437248ee 100644 --- a/bin/node/test-runner-example/src/lib.rs +++ b/bin/node/test-runner-example/src/lib.rs @@ -18,9 +18,9 @@ //! Basic example of end to end runtime tests. -use test_runner::{Node, ChainInfo, SignatureVerificationOverride}; +use test_runner::{Node, ChainInfo, SignatureVerificationOverride, default_config}; use grandpa::GrandpaBlockImport; -use sc_service::{TFullBackend, TFullClient, Configuration, TaskManager, new_full_parts}; +use sc_service::{TFullBackend, TFullClient, Configuration, TaskManager, new_full_parts, TaskExecutor}; use std::sync::Arc; use sp_inherents::InherentDataProviders; use sc_consensus_babe::BabeBlockImport; @@ -29,6 +29,7 @@ use sp_keyring::sr25519::Keyring::Alice; use sp_consensus_babe::AuthorityId; use sc_consensus_manual_seal::{ConsensusDataProvider, consensus::babe::BabeConsensusDataProvider}; use sp_runtime::{traits::IdentifyAccount, MultiSigner, generic::Era}; +use node_cli::chain_spec::development_config; type BlockImport = BabeBlockImport>; @@ -71,6 +72,10 @@ impl ChainInfo for NodeTemplateChainInfo { ) } + fn config(task_executor: TaskExecutor) -> Configuration { + default_config(task_executor, Box::new(development_config())) + } + fn create_client_parts( config: &Configuration, ) -> Result< @@ -151,20 +156,10 @@ mod tests { use super::*; use test_runner::NodeConfig; use log::LevelFilter; - use sc_client_api::execution_extensions::ExecutionStrategies; - use node_cli::chain_spec::development_config; #[test] fn test_runner() { let config = NodeConfig { - execution_strategies: ExecutionStrategies { - syncing: sc_client_api::ExecutionStrategy::AlwaysWasm, - importing: sc_client_api::ExecutionStrategy::AlwaysWasm, - block_construction: sc_client_api::ExecutionStrategy::AlwaysWasm, - offchain_worker: sc_client_api::ExecutionStrategy::AlwaysWasm, - other: sc_client_api::ExecutionStrategy::AlwaysWasm, - }, - chain_spec: Box::new(development_config()), log_targets: vec![ ("yamux", LevelFilter::Off), ("multistream_select", LevelFilter::Off), diff --git a/test-utils/test-runner/Cargo.toml b/test-utils/test-runner/Cargo.toml index 4d9d6125bd4e4..9e1f9fee02189 100644 --- a/test-utils/test-runner/Cargo.toml +++ b/test-utils/test-runner/Cargo.toml @@ -43,18 +43,10 @@ sp-runtime-interface = { version = "3.0.0", path = "../../primitives/runtime-int # pallets frame-system = { version = "3.0.0", path = "../../frame/system" } -parity-scale-codec = "1.3.1" env_logger = "0.7.1" log = "0.4.8" -futures01 = { package = "futures", version = "0.1.29" } futures = { package = "futures", version = "0.3", features = ["compat"] } -rand = "0.7" tokio = { version = "0.2", features = ["full"] } # Calling RPC jsonrpc-core = "15.1" -[dev-dependencies] -sc-finality-grandpa = { version = "0.9.0", path = "../../client/finality-grandpa" } -sc-consensus-babe = { version = "0.9.0", path = "../../client/consensus/babe" } -sp-consensus-babe = { version = "0.9.0", path = "../../primitives/consensus/babe" } -node-cli = { version = "2.0.0", path = "../../bin/node/cli" } diff --git a/test-utils/test-runner/src/lib.rs b/test-utils/test-runner/src/lib.rs index 87ec4336d9523..f76083d281724 100644 --- a/test-utils/test-runner/src/lib.rs +++ b/test-utils/test-runner/src/lib.rs @@ -228,7 +228,7 @@ use manual_seal::consensus::ConsensusDataProvider; use sc_executor::NativeExecutionDispatch; -use sc_service::{Configuration, TFullBackend, TFullClient, TaskManager}; +use sc_service::{Configuration, TFullBackend, TFullClient, TaskManager, TaskExecutor}; use sp_api::{ConstructRuntimeApi, TransactionFor}; use sp_consensus::{BlockImport, SelectChain}; use sp_inherents::InherentDataProviders; @@ -242,6 +242,7 @@ mod host_functions; pub use host_functions::*; pub use node::*; +pub use utils::*; /// Wrapper trait for concrete type required by this testing framework. pub trait ChainInfo: Sized { @@ -279,6 +280,9 @@ pub trait ChainInfo: Sized { /// Signed extras, this function is caled in an externalities provided environment. fn signed_extras(from: ::AccountId) -> Self::SignedExtras; + /// config factory + fn config(task_executor: TaskExecutor) -> Configuration; + /// Attempt to create client parts, including block import, /// select chain strategy and consensus data provider. fn create_client_parts( diff --git a/test-utils/test-runner/src/node.rs b/test-utils/test-runner/src/node.rs index 6965c6a804dbe..2e6fc97c582a0 100644 --- a/test-utils/test-runner/src/node.rs +++ b/test-utils/test-runner/src/node.rs @@ -24,12 +24,10 @@ use manual_seal::{run_manual_seal, EngineCommand, ManualSealParams}; use sc_cli::build_runtime; use sc_client_api::{ backend::{self, Backend}, CallExecutor, ExecutorProvider, - execution_extensions::ExecutionStrategies, }; use sc_service::{ - build_network, spawn_tasks, BuildNetworkParams, SpawnTasksParams, TFullBackend, - TFullCallExecutor, TFullClient, TaskManager, TaskType, ChainSpec, BasePath, - Configuration, DatabaseConfig, KeepBlocks, TransactionStorageMode, config::KeystoreConfig, + build_network, spawn_tasks, BuildNetworkParams, SpawnTasksParams, + TFullBackend, TFullCallExecutor, TFullClient, TaskManager, TaskType, }; use sc_transaction_pool::BasicPool; use sp_api::{ApiExt, ConstructRuntimeApi, Core, Metadata, OverlayedChanges, StorageTransactionCache}; @@ -45,13 +43,8 @@ use sp_state_machine::Ext; use sp_transaction_pool::runtime_api::TaggedTransactionQueue; use sp_transaction_pool::TransactionPool; -pub use crate::utils::{logger, base_path}; -use crate::ChainInfo; +use crate::{ChainInfo, utils::logger}; use log::LevelFilter; -use sp_keyring::sr25519::Keyring::Alice; -use sc_network::{multiaddr, config::{NetworkConfiguration, TransportConfig, Role}}; -use sc_informant::OutputFormat; -use sc_executor::WasmExecutionMethod; /// This holds a reference to a running node on another thread, /// the node process is dropped when this struct is dropped @@ -91,12 +84,6 @@ pub struct Node { pub struct NodeConfig { /// A set of log targets you'd like to enable/disbale pub log_targets: Vec<(&'static str, LevelFilter)>, - - /// ChainSpec for the runtime - pub chain_spec: Box, - - /// wasm execution strategies. - pub execution_strategies: ExecutionStrategies, } type EventRecord = frame_system::EventRecord<::Event, ::Hash>; @@ -114,100 +101,20 @@ impl Node { + BlockBuilder + ApiExt as Backend>::State>, { - let NodeConfig { log_targets, mut chain_spec, execution_strategies } = node_config; + let NodeConfig { log_targets, } = node_config; let tokio_runtime = build_runtime().unwrap(); - - // unbounded logs, should be fine, test is shortlived. - let (log_sink, log_stream) = mpsc::unbounded(); - - logger(log_targets, tokio_runtime.handle().clone(), log_sink); let runtime_handle = tokio_runtime.handle().clone(); - let task_executor = move |fut, task_type| match task_type { TaskType::Async => runtime_handle.spawn(fut).map(drop), TaskType::Blocking => runtime_handle .spawn_blocking(move || futures::executor::block_on(fut)) .map(drop), }; + // unbounded logs, should be fine, test is shortlived. + let (log_sink, log_stream) = mpsc::unbounded(); - let base_path = if let Some(base) = base_path() { - BasePath::new(base) - } else { - BasePath::new_temp_dir().expect("couldn't create a temp dir") - }; - let root_path = base_path.path().to_path_buf().join("chains").join(chain_spec.id()); - - let key_seed = Alice.to_seed(); - let storage = chain_spec - .as_storage_builder() - .build_storage() - .expect("could not build storage"); - - chain_spec.set_storage(storage); - - let mut network_config = NetworkConfiguration::new( - format!("Test Node for: {}", key_seed), - "network/test/0.1", - Default::default(), - None, - ); - let informant_output_format = OutputFormat { enable_color: false }; - - network_config.allow_non_globals_in_dht = true; - - network_config - .listen_addresses - .push(multiaddr::Protocol::Memory(rand::random()).into()); - - network_config.transport = TransportConfig::MemoryOnly; - - let config = Configuration { - impl_name: "test-node".to_string(), - impl_version: "0.1".to_string(), - role: Role::Authority, - task_executor: task_executor.into(), - transaction_pool: Default::default(), - network: network_config, - keystore: KeystoreConfig::Path { - path: root_path.join("key"), - password: None, - }, - database: DatabaseConfig::RocksDb { - path: root_path.join("db"), - cache_size: 128, - }, - state_cache_size: 16777216, - state_cache_child_ratio: None, - chain_spec, - wasm_method: WasmExecutionMethod::Interpreted, - execution_strategies, - 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), - wasm_runtime_overrides: None, - informant_output_format, - disable_log_reloading: false, - keystore_remote: None, - keep_blocks: KeepBlocks::All, - state_pruning: Default::default(), - transaction_storage: TransactionStorageMode::BlockBody, - }; + logger(log_targets, tokio_runtime.handle().clone(), log_sink); + let config = T::config(task_executor.into()); let ( client, @@ -448,7 +355,7 @@ impl Node { /// Revert all blocks added since creation of the node. pub fn clean(&self) { // if a db path was specified, revert all blocks we've added - if let Some(_) = base_path() { + if let Some(_) = std::env::var("DB_BASE_PATH").ok() { let diff = self.client.info().best_number - self.initial_block_number; self.revert_blocks(diff); } diff --git a/test-utils/test-runner/src/utils.rs b/test-utils/test-runner/src/utils.rs index 7cd512e2d4869..d8ab3860f28a8 100644 --- a/test-utils/test-runner/src/utils.rs +++ b/test-utils/test-runner/src/utils.rs @@ -20,10 +20,21 @@ use futures::{Sink, SinkExt}; use std::fmt; use std::io::Write; use log::LevelFilter; +use sc_service::{BasePath, ChainSpec, Configuration, TaskExecutor, DatabaseConfig, KeepBlocks, TransactionStorageMode}; +use sp_keyring::sr25519::Keyring::Alice; +use sc_network::{multiaddr, config::{NetworkConfiguration, TransportConfig, Role}}; +use sc_informant::OutputFormat; +use sc_service::config::KeystoreConfig; +use sc_executor::WasmExecutionMethod; +use sc_client_api::execution_extensions::ExecutionStrategies; /// Base db path gotten from env -pub fn base_path() -> Option { - std::env::var("DB_BASE_PATH").ok() +pub fn base_path() -> BasePath { + if let Some(base) = std::env::var("DB_BASE_PATH").ok() { + BasePath::new(base) + } else { + BasePath::new_temp_dir().expect("couldn't create a temp dir") + } } /// Builds the global logger. @@ -54,3 +65,86 @@ where } let _ = builder.is_test(true).try_init(); } + +/// Produces a default configuration object, suitable for use with most set ups. +pub fn default_config(task_executor: TaskExecutor, mut chain_spec: Box) -> Configuration { + let base_path = base_path(); + let root_path = base_path.path().to_path_buf().join("chains").join(chain_spec.id()); + + let storage = chain_spec + .as_storage_builder() + .build_storage() + .expect("could not build storage"); + + chain_spec.set_storage(storage); + let key_seed = Alice.to_seed(); + + let mut network_config = NetworkConfiguration::new( + format!("Test Node for: {}", key_seed), + "network/test/0.1", + Default::default(), + None, + ); + let informant_output_format = OutputFormat { enable_color: false }; + network_config.allow_non_globals_in_dht = true; + + network_config + .listen_addresses + .push(multiaddr::Protocol::Memory(0).into()); + + network_config.transport = TransportConfig::MemoryOnly; + + Configuration { + impl_name: "test-node".to_string(), + impl_version: "0.1".to_string(), + role: Role::Authority, + task_executor: task_executor.into(), + transaction_pool: Default::default(), + network: network_config, + keystore: KeystoreConfig::Path { + path: root_path.join("key"), + password: None, + }, + database: DatabaseConfig::RocksDb { + path: root_path.join("db"), + cache_size: 128, + }, + state_cache_size: 16777216, + state_cache_child_ratio: None, + chain_spec, + wasm_method: WasmExecutionMethod::Interpreted, + execution_strategies: ExecutionStrategies { + syncing: sc_client_api::ExecutionStrategy::AlwaysWasm, + importing: sc_client_api::ExecutionStrategy::AlwaysWasm, + block_construction: sc_client_api::ExecutionStrategy::AlwaysWasm, + offchain_worker: sc_client_api::ExecutionStrategy::AlwaysWasm, + other: sc_client_api::ExecutionStrategy::AlwaysWasm, + }, + 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), + wasm_runtime_overrides: None, + informant_output_format, + disable_log_reloading: false, + keystore_remote: None, + keep_blocks: KeepBlocks::All, + state_pruning: Default::default(), + transaction_storage: TransactionStorageMode::BlockBody, + } +}