From f72f8ece7dac53e69da0c32c4cb1ffa9853dd5c9 Mon Sep 17 00:00:00 2001 From: scruffy-dev Date: Mon, 12 Jul 2021 17:57:55 +0200 Subject: [PATCH 1/6] oracle first commit --- Cargo.lock | 870 +++++++++++++++++++++++------------- node/Cargo.toml | 3 +- node/src/chain_spec.rs | 5 +- node/src/service.rs | 19 + pallets/oracle/Cargo.toml | 50 +++ pallets/oracle/README.md | 14 + pallets/oracle/src/lib.rs | 638 ++++++++++++++++++++++++++ pallets/oracle/src/mock.rs | 201 +++++++++ pallets/oracle/src/tests.rs | 669 +++++++++++++++++++++++++++ runtime/Cargo.toml | 13 + runtime/src/lib.rs | 114 ++++- 11 files changed, 2271 insertions(+), 325 deletions(-) create mode 100644 pallets/oracle/Cargo.toml create mode 100644 pallets/oracle/README.md create mode 100644 pallets/oracle/src/lib.rs create mode 100644 pallets/oracle/src/mock.rs create mode 100644 pallets/oracle/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index a4a8ca9ceed..7f5895dbacb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,6 +85,17 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" +[[package]] +name = "ahash" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" +dependencies = [ + "getrandom 0.2.3", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -114,18 +125,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61" - -[[package]] -name = "approx" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278" -dependencies = [ - "num-traits", -] +checksum = "595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486" [[package]] name = "approx" @@ -212,12 +214,11 @@ dependencies = [ [[package]] name = "async-io" -version = "1.4.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bbfd5cf2794b1e908ea8457e6c45f8f8f1f6ec5f74617bf4662623f47503c3b" +checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" dependencies = [ "concurrent-queue", - "fastrand", "futures-lite", "libc", "log", @@ -287,7 +288,7 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "pin-utils", "slab", "wasm-bindgen-futures", @@ -334,7 +335,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", ] [[package]] @@ -347,7 +348,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", ] [[package]] @@ -696,9 +697,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" +checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" dependencies = [ "jobserver", ] @@ -854,19 +855,18 @@ checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" [[package]] name = "cpp_demangle" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44919ecaf6f99e8e737bc239408931c9a01e9a6c74814fee8242dd2506b65390" +checksum = "8ea47428dc9d2237f3c6bc134472edfd63ebba0af932e783506dcfd66f10d18a" dependencies = [ "cfg-if 1.0.0", - "glob", ] [[package]] name = "cpufeatures" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" dependencies = [ "libc", ] @@ -1182,13 +1182,14 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.14" +version = "0.99.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc7b9cef1e351660e5443924e4f43ab25fbbed3e9a5f052df3677deb4d6b320" +checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" dependencies = [ "convert_case", "proc-macro2", "quote", + "rustc_version 0.3.3", "syn", ] @@ -1541,13 +1542,13 @@ dependencies = [ "linregress", "log", "parity-scale-codec", - "paste", + "paste 1.0.5", "sp-api", "sp-io", "sp-runtime", - "sp-runtime-interface", - "sp-std", - "sp-storage", + "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -1565,9 +1566,9 @@ dependencies = [ "sc-executor", "sc-service", "serde", - "sp-core", - "sp-externalities", - "sp-keystore", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-state-machine", "structopt", @@ -1581,11 +1582,11 @@ dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", "sp-runtime", - "sp-std", - "sp-tracing", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -1595,8 +1596,8 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "serde", - "sp-core", - "sp-std", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -1612,18 +1613,18 @@ dependencies = [ "max-encoded-len", "once_cell", "parity-scale-codec", - "paste", + "paste 1.0.5", "serde", "smallvec 1.6.1", "sp-arithmetic", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-io", "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std", - "sp-tracing", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -1670,10 +1671,10 @@ dependencies = [ "log", "parity-scale-codec", "serde", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-version", ] @@ -1686,9 +1687,9 @@ dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -1826,7 +1827,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "waker-fn", ] @@ -1893,7 +1894,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -2073,7 +2074,16 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" dependencies = [ - "ahash", + "ahash 0.4.7", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.4", ] [[package]] @@ -2087,9 +2097,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] @@ -2102,9 +2112,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5af1f635ef1bc545d78392b136bfe1c9809e029023c84a3638a864a10b8819c8" +checksum = "76505e26b6ca3bbdbbb360b68472abbb80998c5fa5dc43672eca34f28258e138" [[package]] name = "hex_fmt" @@ -2236,7 +2246,7 @@ dependencies = [ "itoa", "log", "net2", - "rustc_version", + "rustc_version 0.2.3", "time", "tokio 0.1.22", "tokio-buf", @@ -2352,9 +2362,9 @@ dependencies = [ [[package]] name = "impl-codec" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df170efa359aebdd5cb7fe78edcc67107748e4737bdca8a8fb40d15ea7a877ed" +checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" dependencies = [ "parity-scale-codec", ] @@ -2381,20 +2391,20 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.11.2", "serde", ] [[package]] name = "instant" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" dependencies = [ "cfg-if 1.0.0", ] @@ -2699,9 +2709,9 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] name = "libc" -version = "0.2.97" +version = "0.2.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" [[package]] name = "libloading" @@ -3219,14 +3229,32 @@ dependencies = [ [[package]] name = "linregress" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1ff7f341d23e1275eec0656a9a07225fcc86216c4322392868adffe59023d1a" +checksum = "1e6e407dadb4ca4b31bc69c27aff00e7ca4534fdcee855159b039a7cebb5f395" dependencies = [ - "nalgebra 0.27.1", + "nalgebra", "statrs", ] +[[package]] +name = "lite-json" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0460d985423a026b4d9b828a7c6eed1bcf606f476322f3f9b507529686a61715" +dependencies = [ + "lite-parser", +] + +[[package]] +name = "lite-parser" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c50092e40e0ccd1bf2015a10333fde0502ff95b832b0895dc1ca0d7ac6c52f6" +dependencies = [ + "paste 0.1.18", +] + [[package]] name = "lock_api" version = "0.3.4" @@ -3261,7 +3289,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f374d42cdfc1d7dbf3d3dec28afab2eb97ffbf43a3234d795b5986dbf4b90ba" dependencies = [ - "hashbrown", + "hashbrown 0.9.1", ] [[package]] @@ -3386,7 +3414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "814bbecfc0451fc314eeea34f05bbcd5b98a7ad7af37faee088b86a1e633f1d4" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.9.1", "parity-util-mem", ] @@ -3581,36 +3609,21 @@ dependencies = [ "unsigned-varint 0.7.0", ] -[[package]] -name = "nalgebra" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476d1d59fe02fe54c86356e91650cd892f392782a1cb9fc524ec84f7aa9e1d06" -dependencies = [ - "approx 0.4.0", - "matrixmultiply", - "num-complex 0.3.1", - "num-rational 0.3.2", - "num-traits", - "rand 0.8.4", - "rand_distr", - "simba 0.4.0", - "typenum", -] - [[package]] name = "nalgebra" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" dependencies = [ - "approx 0.5.0", + "approx", "matrixmultiply", "nalgebra-macros", - "num-complex 0.4.0", + "num-complex", "num-rational 0.4.0", "num-traits", - "simba 0.5.1", + "rand 0.8.4", + "rand_distr", + "simba", "typenum", ] @@ -3672,9 +3685,10 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-aura", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-finality-grandpa", "sp-inherents", + "sp-keystore 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-runtime", "sp-timestamp", "sp-transaction-pool", @@ -3697,6 +3711,8 @@ dependencies = [ "pallet-aura", "pallet-balances", "pallet-grandpa", + "pallet-indices", + "pallet-oracle", "pallet-randomness-collective-flip", "pallet-sudo", "pallet-template", @@ -3707,12 +3723,12 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-consensus-aura", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-offchain", "sp-runtime", "sp-session", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -3751,15 +3767,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-complex" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" -dependencies = [ - "num-traits", -] - [[package]] name = "num-complex" version = "0.4.0" @@ -3791,17 +3798,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.0" @@ -3901,7 +3897,7 @@ dependencies = [ "sp-application-crypto", "sp-consensus-aura", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -3915,7 +3911,7 @@ dependencies = [ "parity-scale-codec", "sp-authorship", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -3930,7 +3926,7 @@ dependencies = [ "max-encoded-len", "parity-scale-codec", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -3946,13 +3942,47 @@ dependencies = [ "pallet-session", "parity-scale-codec", "sp-application-crypto", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-finality-grandpa", "sp-io", "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", +] + +[[package]] +name = "pallet-indices" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-io", + "sp-keyring", + "sp-runtime", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", +] + +[[package]] +name = "pallet-oracle" +version = "3.0.0" +dependencies = [ + "frame-support", + "frame-system", + "lite-json", + "log", + "pallet-balances", + "parity-scale-codec", + "serde", + "serde_json", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-io", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -3965,7 +3995,7 @@ dependencies = [ "parity-scale-codec", "safe-mix", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -3979,12 +4009,12 @@ dependencies = [ "log", "pallet-timestamp", "parity-scale-codec", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-trie", ] @@ -3998,7 +4028,7 @@ dependencies = [ "parity-scale-codec", "sp-io", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -4010,7 +4040,7 @@ dependencies = [ "frame-system", "parity-scale-codec", "serde", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", "sp-runtime", ] @@ -4029,7 +4059,7 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-timestamp", ] @@ -4043,10 +4073,10 @@ dependencies = [ "parity-scale-codec", "serde", "smallvec 1.6.1", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -4061,7 +4091,7 @@ dependencies = [ "parity-scale-codec", "sp-api", "sp-blockchain", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-rpc", "sp-runtime", ] @@ -4114,22 +4144,23 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b310f220c335f9df1b3d2e9fbe3890bbfeef5030dad771620f48c5c229877cd3" +checksum = "8975095a2a03bbbdc70a74ab11a4f76a6d0b84680d87c68d722531b0ac28e8a9" dependencies = [ "arrayvec 0.7.1", "bitvec", "byte-slice-cast", + "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", ] [[package]] name = "parity-scale-codec-derive" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81038e13ca2c32587201d544ea2e6b6c47120f1e4eae04478f9f60b6bcb89145" +checksum = "40dbbfef7f0a1143c5b06e0d76a6278e25dac0bc1af4be51a0fbb73f07e7ad09" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -4169,7 +4200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "664a8c6b8e62d8f9f2f937e391982eb433ab285b4cd9545b342441e04a906e42" dependencies = [ "cfg-if 1.0.0", - "hashbrown", + "hashbrown 0.9.1", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.11.1", @@ -4198,6 +4229,12 @@ dependencies = [ "byteorder", ] +[[package]] +name = "parity-wasm" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" + [[package]] name = "parity-wasm" version = "0.42.2" @@ -4206,9 +4243,9 @@ checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "parity-ws" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e02a625dd75084c2a7024f07c575b61b782f729d18702dabb3cdbf31911dc61" +checksum = "322d72dfe461b8b9e367d057ceace105379d64d5b03907d23c481ccf3fbf8aa4" dependencies = [ "byteorder", "bytes 0.4.12", @@ -4236,7 +4273,7 @@ checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ "lock_api 0.3.4", "parking_lot_core 0.6.2", - "rustc_version", + "rustc_version 0.2.3", ] [[package]] @@ -4270,7 +4307,7 @@ dependencies = [ "cloudabi", "libc", "redox_syscall 0.1.57", - "rustc_version", + "rustc_version 0.2.3", "smallvec 0.6.14", "winapi 0.3.9", ] @@ -4303,12 +4340,31 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "paste" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +dependencies = [ + "paste-impl", + "proc-macro-hack", +] + [[package]] name = "paste" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" +[[package]] +name = "paste-impl" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +dependencies = [ + "proc-macro-hack", +] + [[package]] name = "pbkdf2" version = "0.3.0" @@ -4453,9 +4509,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -4517,9 +4573,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "primitive-types" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2415937401cb030a2a0a4d922483f945fa068f52a7dbb22ce0fe5f2b6f6adace" +checksum = "06345ee39fbccfb06ab45f3a1a5798d9dafa04cb8921a76d227040003a234b0e" dependencies = [ "fixed-hash", "impl-codec", @@ -5075,6 +5131,15 @@ dependencies = [ "semver 0.9.0", ] +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + [[package]] name = "rustls" version = "0.18.1" @@ -5115,9 +5180,9 @@ dependencies = [ [[package]] name = "ruzstd" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d425143485a37727c7a46e689bbe3b883a00f42b4a52c4ac0f44855c1009b00" +checksum = "8cada0ef59efa6a5f4dc5e491f93d9f31e3fc7758df421ff1de8a706338e1100" dependencies = [ "byteorder", "twox-hash", @@ -5146,7 +5211,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d3d055a2582e6b00ed7a31c1524040aa391092bf636328350813f3a0605215c" dependencies = [ - "rustc_version", + "rustc_version 0.2.3", ] [[package]] @@ -5183,7 +5248,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-consensus", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-runtime", "sp-transaction-pool", @@ -5200,7 +5265,7 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-runtime", "sp-state-machine", @@ -5223,7 +5288,7 @@ dependencies = [ "serde_json", "sp-chain-spec", "sp-consensus-babe", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", ] @@ -5263,9 +5328,9 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-keyring", - "sp-keystore", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-panic-handler", "sp-runtime", "sp-utils", @@ -5294,15 +5359,15 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-consensus", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-database", - "sp-externalities", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", - "sp-keystore", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-state-machine", - "sp-std", - "sp-storage", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-transaction-pool", "sp-trie", "sp-utils", @@ -5332,7 +5397,7 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-database", "sp-runtime", "sp-state-machine", @@ -5375,10 +5440,10 @@ dependencies = [ "sp-consensus", "sp-consensus-aura", "sp-consensus-slots", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-io", - "sp-keystore", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-version", "substrate-prometheus-endpoint", @@ -5420,10 +5485,10 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-slots", "sp-consensus-vrf", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-io", - "sp-keystore", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-utils", "sp-version", @@ -5462,7 +5527,7 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-slots", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-runtime", "sp-state-machine", @@ -5498,17 +5563,17 @@ dependencies = [ "sc-executor-wasmi", "sc-executor-wasmtime", "sp-api", - "sp-core", - "sp-externalities", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", "sp-panic-handler", - "sp-runtime-interface", + "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-serializer", "sp-tasks", "sp-trie", "sp-version", - "sp-wasm-interface", - "wasmi", + "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "wasmi 0.9.0", ] [[package]] @@ -5520,12 +5585,12 @@ dependencies = [ "parity-scale-codec", "pwasm-utils", "sp-allocator", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-maybe-compressed-blob", "sp-serializer", - "sp-wasm-interface", + "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "thiserror", - "wasmi", + "wasmi 0.9.0", ] [[package]] @@ -5537,10 +5602,10 @@ dependencies = [ "parity-scale-codec", "sc-executor-common", "sp-allocator", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", - "wasmi", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "wasmi 0.9.0", ] [[package]] @@ -5556,9 +5621,9 @@ dependencies = [ "sc-executor-common", "scoped-tls", "sp-allocator", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "wasmtime", ] @@ -5593,10 +5658,10 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-finality-grandpa", "sp-inherents", - "sp-keystore", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-utils", "substrate-prometheus-endpoint", @@ -5636,8 +5701,8 @@ dependencies = [ "rand 0.7.3", "serde_json", "sp-application-crypto", - "sp-core", - "sp-keystore", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "subtle 2.4.0", ] @@ -5654,8 +5719,8 @@ dependencies = [ "sc-executor", "sp-api", "sp-blockchain", - "sp-core", - "sp-externalities", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-state-machine", ] @@ -5702,7 +5767,7 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-utils", "substrate-prometheus-endpoint", @@ -5751,7 +5816,7 @@ dependencies = [ "sc-keystore", "sc-network", "sp-api", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-offchain", "sp-runtime", "sp-utils", @@ -5802,14 +5867,14 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-chain-spec", - "sp-core", - "sp-keystore", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-offchain", "sp-rpc", "sp-runtime", "sp-session", "sp-state-machine", - "sp-tracing", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-transaction-pool", "sp-utils", "sp-version", @@ -5832,10 +5897,10 @@ dependencies = [ "serde", "serde_json", "sp-chain-spec", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-rpc", "sp-runtime", - "sp-tracing", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-transaction-pool", "sp-version", ] @@ -5901,15 +5966,15 @@ dependencies = [ "sp-block-builder", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-externalities", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-io", - "sp-keystore", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-session", "sp-state-machine", - "sp-tracing", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", @@ -5934,7 +5999,7 @@ dependencies = [ "parity-util-mem-derive", "parking_lot 0.11.1", "sc-client-api", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "thiserror", ] @@ -5981,11 +6046,11 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-rpc", "sp-runtime", - "sp-storage", - "sp-tracing", + "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "thiserror", "tracing", "tracing-log", @@ -6020,7 +6085,7 @@ dependencies = [ "retain_mut", "serde", "sp-blockchain", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-transaction-pool", "sp-utils", @@ -6043,9 +6108,9 @@ dependencies = [ "sc-transaction-graph", "sp-api", "sp-blockchain", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", - "sp-tracing", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-transaction-pool", "sp-utils", "substrate-prometheus-endpoint", @@ -6076,6 +6141,7 @@ dependencies = [ "merlin", "rand 0.7.3", "rand_core 0.5.1", + "serde", "sha2 0.8.2", "subtle 2.4.0", "zeroize", @@ -6327,21 +6393,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" - -[[package]] -name = "simba" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5132a955559188f3d13c9ba831e77c802ddc8782783f050ed0c52f5988b95f4c" -dependencies = [ - "approx 0.4.0", - "num-complex 0.3.1", - "num-traits", - "paste", -] +checksum = "c19772be3c4dd2ceaacf03cb41d5885f2a02c4d8804884918e3a258480803335" [[package]] name = "simba" @@ -6349,10 +6403,10 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" dependencies = [ - "approx 0.5.0", - "num-complex 0.4.0", + "approx", + "num-complex", "num-traits", - "paste", + "paste 1.0.5", ] [[package]] @@ -6397,7 +6451,7 @@ dependencies = [ "rand 0.7.3", "rand_core 0.5.1", "ring", - "rustc_version", + "rustc_version 0.2.3", "sha2 0.9.5", "subtle 2.4.0", "x25519-dalek", @@ -6446,9 +6500,9 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "log", - "sp-core", - "sp-std", - "sp-wasm-interface", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "thiserror", ] @@ -6461,10 +6515,10 @@ dependencies = [ "log", "parity-scale-codec", "sp-api-proc-macro", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-state-machine", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-version", "thiserror", ] @@ -6489,9 +6543,9 @@ dependencies = [ "max-encoded-len", "parity-scale-codec", "serde", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6503,8 +6557,8 @@ dependencies = [ "num-traits", "parity-scale-codec", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "static_assertions", ] @@ -6517,7 +6571,7 @@ dependencies = [ "parity-scale-codec", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6529,7 +6583,7 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6573,11 +6627,11 @@ dependencies = [ "parking_lot 0.11.1", "serde", "sp-api", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-trie", "sp-utils", "sp-version", @@ -6599,7 +6653,7 @@ dependencies = [ "sp-consensus-slots", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-timestamp", ] @@ -6617,11 +6671,11 @@ dependencies = [ "sp-consensus", "sp-consensus-slots", "sp-consensus-vrf", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", - "sp-keystore", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-timestamp", ] @@ -6642,9 +6696,54 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "schnorrkel", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", +] + +[[package]] +name = "sp-core" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abbc8d4e9b8a7d5819ed26f1374017bb32833ef4890e4ff065e1da30669876bc" +dependencies = [ + "base58", + "blake2-rfc", + "byteorder", + "dyn-clonable", + "ed25519-dalek", + "futures 0.3.15", + "hash-db", + "hash256-std-hasher", + "hex", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.11.1", + "primitive-types", + "rand 0.7.3", + "regex", + "schnorrkel", + "secrecy", + "serde", + "sha2 0.9.5", + "sp-debug-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "tiny-keccak", + "twox-hash", + "wasmi 0.6.2", + "zeroize", ] [[package]] @@ -6678,17 +6777,17 @@ dependencies = [ "secrecy", "serde", "sha2 0.9.5", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std", - "sp-storage", + "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "substrate-bip39", "thiserror", "tiny-bip39", "tiny-keccak", "twox-hash", - "wasmi", + "wasmi 0.9.0", "zeroize", ] @@ -6701,6 +6800,17 @@ dependencies = [ "parking_lot 0.11.1", ] +[[package]] +name = "sp-debug-derive" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e80275f23b4e7ba8f54dec5f90f016530e7307d2ee9445f617ab986cbe97f31e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sp-debug-derive" version = "3.0.0" @@ -6711,6 +6821,18 @@ dependencies = [ "syn", ] +[[package]] +name = "sp-externalities" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fdc625f8c7b13b9a136d334888b21b5743d2081cb666cb03efca1dc9b8f74d1" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sp-externalities" version = "0.9.0" @@ -6718,8 +6840,8 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "environmental", "parity-scale-codec", - "sp-std", - "sp-storage", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6733,10 +6855,10 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", - "sp-core", - "sp-keystore", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6747,9 +6869,9 @@ dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "thiserror", ] @@ -6764,16 +6886,16 @@ dependencies = [ "log", "parity-scale-codec", "parking_lot 0.11.1", - "sp-core", - "sp-externalities", - "sp-keystore", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-maybe-compressed-blob", - "sp-runtime-interface", + "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-state-machine", - "sp-std", - "sp-tracing", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-trie", - "sp-wasm-interface", + "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "tracing", "tracing-core", ] @@ -6784,11 +6906,29 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "lazy_static", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "strum", ] +[[package]] +name = "sp-keystore" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db6ccd2baf189112355338e8b224dc513cd239b974dbd717f12b3dc7a7248c3b" +dependencies = [ + "async-trait", + "derive_more", + "futures 0.3.15", + "merlin", + "parity-scale-codec", + "parking_lot 0.11.1", + "schnorrkel", + "serde", + "sp-core 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sp-keystore" version = "0.9.0" @@ -6802,8 +6942,8 @@ dependencies = [ "parking_lot 0.11.1", "schnorrkel", "serde", - "sp-core", - "sp-externalities", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6821,7 +6961,7 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "sp-api", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", ] @@ -6840,7 +6980,7 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "rustc-hash", "serde", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "tracing-core", ] @@ -6856,14 +6996,32 @@ dependencies = [ "max-encoded-len", "parity-scale-codec", "parity-util-mem", - "paste", + "paste 1.0.5", "rand 0.7.3", "serde", "sp-application-crypto", "sp-arithmetic", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", +] + +[[package]] +name = "sp-runtime-interface" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e5c88b4bc8d607e4e2ff767a85db58cf7101f3dd6064f06929342ea67fe8fb" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime-interface-proc-macro 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions", ] [[package]] @@ -6874,15 +7032,28 @@ dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities", - "sp-runtime-interface-proc-macro", - "sp-std", - "sp-storage", - "sp-tracing", - "sp-wasm-interface", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface-proc-macro 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "static_assertions", ] +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a6c7c2251512c9e533d15db8a863b06ece1cbee778130dd9adbe44b6b39aa9" +dependencies = [ + "Inflector", + "proc-macro-crate 0.1.5", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sp-runtime-interface-proc-macro" version = "3.0.0" @@ -6911,10 +7082,10 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "sp-api", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-staking", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6924,7 +7095,7 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6939,10 +7110,10 @@ dependencies = [ "parking_lot 0.11.1", "rand 0.7.3", "smallvec 1.6.1", - "sp-core", - "sp-externalities", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-panic-handler", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-trie", "thiserror", "tracing", @@ -6950,11 +7121,31 @@ dependencies = [ "trie-root", ] +[[package]] +name = "sp-std" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35391ea974fa5ee869cb094d5b437688fbf3d8127d64d1b9fed5822a1ed39b12" + [[package]] name = "sp-std" version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" +[[package]] +name = "sp-storage" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86af458d4a0251c490cdde9dcaaccb88d398f3b97ac6694cdd49ed9337e6b961" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sp-storage" version = "3.0.0" @@ -6964,8 +7155,8 @@ dependencies = [ "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6974,11 +7165,11 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "log", - "sp-core", - "sp-externalities", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-io", - "sp-runtime-interface", - "sp-std", + "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", ] [[package]] @@ -6993,11 +7184,25 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "thiserror", "wasm-timer", ] +[[package]] +name = "sp-tracing" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567382d8d4e14fb572752863b5cd57a78f9e9a6583332b590b726f061f3ea957" +dependencies = [ + "log", + "parity-scale-codec", + "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", + "tracing-core", + "tracing-subscriber", +] + [[package]] name = "sp-tracing" version = "3.0.0" @@ -7010,7 +7215,7 @@ dependencies = [ "serde", "serde_json", "slog", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "tracing", "tracing-core", "tracing-subscriber", @@ -7040,10 +7245,10 @@ dependencies = [ "async-trait", "log", "parity-scale-codec", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-trie", ] @@ -7055,8 +7260,8 @@ dependencies = [ "hash-db", "memory-db", "parity-scale-codec", - "sp-core", - "sp-std", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "trie-db", "trie-root", ] @@ -7082,7 +7287,7 @@ dependencies = [ "parity-scale-codec", "serde", "sp-runtime", - "sp-std", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-version-proc-macro", ] @@ -7098,6 +7303,18 @@ dependencies = [ "syn", ] +[[package]] +name = "sp-wasm-interface" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b214e125666a6416cf30a70cc6a5dacd34a4e5197f8a3d479f714af7e1dc7a47" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.6.2", +] + [[package]] name = "sp-wasm-interface" version = "3.0.0" @@ -7105,8 +7322,8 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sp-std", - "wasmi", + "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "wasmi 0.9.0", ] [[package]] @@ -7129,13 +7346,13 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "statrs" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0c1f144861fbfd2a8cc82d564ccbf7fb3b7834d4fa128b84e9c2a73371aead" +checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" dependencies = [ - "approx 0.4.0", + "approx", "lazy_static", - "nalgebra 0.26.2", + "nalgebra", "num-traits", "rand 0.8.4", ] @@ -7167,9 +7384,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" +checksum = "69b041cdcb67226aca307e6e7be44c8806423d83e018bd662360a93dabce4d71" dependencies = [ "clap", "lazy_static", @@ -7178,9 +7395,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" +checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10" dependencies = [ "heck", "proc-macro-error", @@ -7249,7 +7466,7 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core", + "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", "sp-runtime", "sp-transaction-pool", ] @@ -7309,9 +7526,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +checksum = "474aaa926faa1603c40b7885a9eaea29b444d1cb2850cb7c0e37bb1a4182f4fa" dependencies = [ "proc-macro2", "quote", @@ -7371,18 +7588,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" dependencies = [ "proc-macro2", "quote", @@ -7746,7 +7963,7 @@ checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.7", "tracing-attributes", "tracing-core", ] @@ -7804,9 +8021,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa5553bf0883ba7c9cbe493b085c29926bd41b66afc31ff72cf17ff4fb60dcd5" +checksum = "ab69019741fca4d98be3c62d2b75254528b5432233fd8a4d2739fec20278de48" dependencies = [ "ansi_term 0.12.1", "chrono", @@ -7826,12 +8043,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd81fe0c8bc2b528a51c9d2c31dae4483367a26a723a3c9a4a8120311d7774e3" +checksum = "9eac131e334e81b6b3be07399482042838adcd7957aa0010231d0813e39e02fa" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.11.2", "log", "rustc-hex", "smallvec 1.6.1", @@ -7920,9 +8137,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "uint" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" +checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f" dependencies = [ "byteorder", "crunchy", @@ -7959,9 +8176,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" @@ -8220,6 +8437,20 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmi" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" +dependencies = [ + "libc", + "memory_units", + "num-rational 0.2.4", + "num-traits", + "parity-wasm 0.41.0", + "wasmi-validation 0.3.0", +] + [[package]] name = "wasmi" version = "0.9.0" @@ -8232,7 +8463,16 @@ dependencies = [ "num-rational 0.2.4", "num-traits", "parity-wasm 0.42.2", - "wasmi-validation", + "wasmi-validation 0.4.0", +] + +[[package]] +name = "wasmi-validation" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" +dependencies = [ + "parity-wasm 0.41.0", ] [[package]] @@ -8265,7 +8505,7 @@ dependencies = [ "lazy_static", "libc", "log", - "paste", + "paste 1.0.5", "psm", "region", "rustc-demangle", diff --git a/node/Cargo.toml b/node/Cargo.toml index 5354a952221..9f97349239e 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,7 +1,7 @@ [features] default = [] runtime-benchmarks = ['node-template-runtime/runtime-benchmarks'] - +ocw = [] [[bin]] name = 'node-template' @@ -21,6 +21,7 @@ targets = ['x86_64-unknown-linux-gnu'] [dependencies] jsonrpc-core = '15.1.0' structopt = '0.3.8' +sp-keystore = '0.9' [dependencies.frame-benchmarking] git = 'https://github.com/paritytech/substrate.git' diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 5093a77b571..aa69c368004 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,6 +1,6 @@ use sp_core::{Pair, Public, sr25519}; use node_template_runtime::{ - AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, + AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, IndicesConfig, SudoConfig, SystemConfig, WASM_BINARY, Signature }; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -146,6 +146,9 @@ fn testnet_genesis( aura: AuraConfig { authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(), }, + indices: IndicesConfig { + indices: vec![], + }, grandpa: GrandpaConfig { authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(), }, diff --git a/node/src/service.rs b/node/src/service.rs index c19824e9eaa..2ec8555e608 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -12,6 +12,8 @@ use sc_finality_grandpa::SharedVoterState; use sc_keystore::LocalKeystore; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_consensus::SlotData; +#[cfg(feature = "ocw")] +use sp_core::crypto::KeyTypeId; // Our native executor instance. native_executor_instance!( @@ -137,6 +139,23 @@ pub fn new_full(mut config: Configuration) -> Result other: (block_import, grandpa_link, mut telemetry), } = new_partial(&config)?; + #[cfg(feature = "ocw")] + let keystore = keystore_container.sync_keystore(); + if config.offchain_worker.enabled { + // Initialize seed for signing transaction using off-chain workers. This is a convenience + // so learners can see the transactions submitted simply running the node. + // Typically these keys should be inserted with RPC calls to `author_insertKey`. + #[cfg(feature = "ocw")] + { + sp_keystore::SyncCryptoStore::sr25519_generate_new( + &*keystore, + KeyTypeId(*b"orac"), + Some("//Alice"), + ) + .expect("Creating key with account Alice should succeed."); + } + } + if let Some(url) = &config.keystore_remote { match remote_keystore(url) { Ok(k) => keystore_container.set_remote_keystore(k), diff --git a/pallets/oracle/Cargo.toml b/pallets/oracle/Cargo.toml new file mode 100644 index 00000000000..19da096dc95 --- /dev/null +++ b/pallets/oracle/Cargo.toml @@ -0,0 +1,50 @@ +[package] +authors = ['Substrate DevHub '] +description = 'The oracle, seriously read the name dude' +edition = '2018' +homepage = 'https://substrate.dev' +license = 'Unlicense' +name = 'pallet-oracle' +repository = 'https://github.com/substrate-developer-hub/substrate-node-template/' +version = '3.0.0' + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] + +# alias "parity-scale-code" to "codec" +[dependencies.codec] +default-features = false +features = ['derive'] +package = 'parity-scale-codec' +version = '2.0.0' + +[dependencies] +frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } +frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } +sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } +log = { version = "0.4.14", default-features = false } +sp-io = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } +sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } +lite-json = { version = "0.1", default-features = false } +sp-std = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } +serde_json = { version = '1.0.45', default-features = false, features = ['alloc'] } + +[dev-dependencies] +serde = { version = "1.0.119" } +pallet-balances = { version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } +sp-keystore = { version = "0.9.0", git = 'https://github.com/paritytech/substrate.git', rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' } + + +[features] +default = ['std'] +std = [ + 'codec/std', + 'log/std', + 'lite-json/std', + 'frame-support/std', + 'frame-system/std', + 'sp-runtime/std', + 'sp-io/std', + 'sp-core/std', + 'sp-std/std', +] diff --git a/pallets/oracle/README.md b/pallets/oracle/README.md new file mode 100644 index 00000000000..a0b20b380c8 --- /dev/null +++ b/pallets/oracle/README.md @@ -0,0 +1,14 @@ +TODO + +- [x] Set up granularity on threshold +- [] better setup and key rotation +- [x] local storage to pull for url +- [x] add events +- [x] general cleanup +- [x] In line TODOs (done for first handoff) + +Can Be after handoff +- [] Send back and check request and price id from runtime +- [] better asset count handling (hold actives in vec so you can turn them on and off) - actually idk I think the way we have it is better idk +- [] decide signed unsigned or free add price tx +- [] test events (can be done in benchmarks) \ No newline at end of file diff --git a/pallets/oracle/src/lib.rs b/pallets/oracle/src/lib.rs new file mode 100644 index 00000000000..695c8eb31b2 --- /dev/null +++ b/pallets/oracle/src/lib.rs @@ -0,0 +1,638 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +/// Edit this file to define custom logic or remove it if it is not needed. +/// Learn more about FRAME and the core library of Substrate FRAME pallets: +/// +pub use pallet::*; + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; + +#[frame_support::pallet] +pub mod pallet { + use frame_support::{ + dispatch::{DispatchResult, DispatchResultWithPostInfo, Vec}, + pallet_prelude::*, + traits::{ + Currency, EnsureOrigin, + ExistenceRequirement::{AllowDeath, KeepAlive}, + ReservableCurrency, + }, + }; + + use frame_system::pallet_prelude::*; + use frame_system::Config as SystemConfig; + use frame_system::{ + offchain::{ + AppCrypto, CreateSignedTransaction, SendSignedTransaction, + SignedPayload, Signer, SigningTypes, + }, + }; + use lite_json::json::JsonValue; + use sp_core::crypto::KeyTypeId; + use sp_runtime::{ + offchain::{ + http, + Duration, + }, + traits::{Saturating, Zero}, + Percent, PerThing, RuntimeDebug, + }; + use sp_std::{borrow::ToOwned, str}; + + pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"orac"); + + pub mod crypto { + use super::KEY_TYPE; + use sp_core::sr25519::Signature as Sr25519Signature; + use sp_runtime::{ + app_crypto::{app_crypto, sr25519}, + traits::Verify, + MultiSignature, MultiSigner, + }; + app_crypto!(sr25519, KEY_TYPE); + + pub struct TestAuthId; + // implemented for ocw-runtime + impl frame_system::offchain::AppCrypto for TestAuthId { + type RuntimeAppPublic = Public; + type GenericSignature = sp_core::sr25519::Signature; + type GenericPublic = sp_core::sr25519::Public; + } + + impl + frame_system::offchain::AppCrypto< + ::Signer, + Sr25519Signature, + > for TestAuthId + { + type RuntimeAppPublic = Public; + type GenericSignature = sp_core::sr25519::Signature; + type GenericPublic = sp_core::sr25519::Public; + } + } + + + #[pallet::config] + pub trait Config: CreateSignedTransaction> + frame_system::Config { + type Event: From> + IsType<::Event>; + /// The currency mechanism. + type Currency: ReservableCurrency; + type AuthorityId: AppCrypto; + type MinStake: Get>; + type StakeLock: Get; + type StalePrice: Get; + type AddOracle: EnsureOrigin; + type RequestCost: Get>; + type RewardAmount: Get>; + type SlashAmount: Get>; + } + + #[derive(Encode, Decode, Default, Debug, PartialEq)] + pub struct Withdraw { + pub stake: Balance, + pub unlock_block: BlockNumber, + } + + #[derive(Encode, Decode, Clone, Copy, Default, Debug, PartialEq)] + pub struct PrePrice { + pub price: u64, + pub block: BlockNumber, + pub who: AccountId, + } + + #[derive(Encode, Decode, Default, Debug, PartialEq)] + pub struct Price { + pub price: u64, + pub block: BlockNumber, + } + + #[derive(Encode, Decode, Default, Debug, PartialEq)] + pub struct Settlement { + pub who: AccountId, + pub truthful: bool, + } + + #[derive(Encode, Decode, Default, Debug, PartialEq)] + pub struct AssetInfo { + pub threshold: Percent, + pub min_answers: u64, + pub max_answers: u64, + } + + + type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + // The pallet's runtime storage items. + // https://substrate.dev/docs/en/knowledgebase/runtime/storage + #[pallet::storage] + #[pallet::getter(fn position_count)] + pub type AssetTypes = StorageValue<_, u128, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn settlements)] + pub type Settlements = StorageValue<_, Vec>, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn assets_count)] + pub type AssetsCount = StorageValue<_, u64, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn signer_to_controller)] + pub type SignerToController = + StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn controller_to_signer)] + pub type ControllerToSigner = + StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn declared_withdraws)] + pub type DeclaredWithdraws = + StorageMap<_, Blake2_128Concat, T::AccountId, Withdraw, T::BlockNumber>>; + + #[pallet::storage] + #[pallet::getter(fn oracle_stake)] + pub type OracleStake = StorageMap<_, Blake2_128Concat, T::AccountId, BalanceOf>; + + #[pallet::storage] + #[pallet::getter(fn prices)] + pub type Prices = + StorageMap<_, Blake2_128Concat, u64, Price, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn pre_prices)] + pub type PrePrices = StorageMap< + _, + Blake2_128Concat, + u64, + Vec>, + ValueQuery, + >; + + #[pallet::storage] + #[pallet::getter(fn accuracy_threshold)] + pub type AssetsInfo = StorageMap<_, Blake2_128Concat, u64, AssetInfo, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn requested)] + pub type Requested = StorageMap<_, Blake2_128Concat, u64, bool, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn request_id)] + pub type RequestedId = StorageMap<_, Blake2_128Concat, u64, u128, ValueQuery>; + + #[pallet::event] + #[pallet::metadata(T::AccountId = "AccountId", BalanceOf = "Balance", T::BlockNumber = "BlockNumber", Percent = "Percent")] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + NewAsset(u128), + AssetInfoChange(u64, Percent, u64, u64), + PriceRequested(T::AccountId, u64), + /// Who added it, the amount added and the total cumulative amount + StakeAdded(T::AccountId, BalanceOf, BalanceOf), + StakeRemoved(T::AccountId, BalanceOf, T::BlockNumber), + StakeReclaimed(T::AccountId, BalanceOf), + PriceSubmitted(T::AccountId, u64, u64), + UserSlashed(T::AccountId, u64, BalanceOf), + UserRewarded(T::AccountId, u64, BalanceOf), + AnswerPruned(T::AccountId, u64), + + } + + #[pallet::error] + pub enum Error { + Unknown, + NoPermission, + NoStake, + StakeLocked, + NotEnoughStake, + NotEnoughFunds, + InvalidAssetId, + AlreadySubmitted, + MaxPrices, + PriceNotRequested, + UnsetSigner, + AlreadySet, + UnsetController, + ControllerUsed, + SignerUsed, + } + + #[pallet::hooks] + impl Hooks> for Pallet { + fn on_initialize(block: T::BlockNumber) -> Weight { + for i in 0..AssetsCount::::get() { + let asset_info = AssetsInfo::::get(i); + // TODO maybe add a check if price is requested, is less operations? + let pre_pruned_prices = PrePrices::::get(i); + let mut pre_prices = Vec::new(); + if pre_pruned_prices.len() as u64 >= asset_info.min_answers { + pre_prices = Self::prune_old(pre_pruned_prices.clone(), block); + PrePrices::::insert(i, pre_prices.clone()); + } + if pre_prices.len() as u64 >= asset_info.min_answers { + let price = Self::get_median_price(&pre_prices); + let set_price = Price { price, block }; + Prices::::insert(i, set_price); + Requested::::insert(i, false); + PrePrices::::remove(i); + Self::handle_payout(&pre_prices, price, i); + } + } + 0 + } + + fn offchain_worker(_block_number: T::BlockNumber) { + log::info!("Hello World from offchain workers!"); + Self::check_requests(); + } + } + + #[pallet::call] + impl Pallet { + /// An example dispatchable that takes a singles value as a parameter, writes the value to + /// storage and emits an event. This function must be dispatched by a signed extrinsic. + #[pallet::weight(10_000)] + pub fn add_asset_and_info( + origin: OriginFor, + asset_id: u64, + threshold: Percent, + min_answers: u64, + max_answers: u64 + ) -> DispatchResultWithPostInfo { + T::AddOracle::ensure_origin(origin)?; + let asset_info = AssetInfo { + threshold, + min_answers, + max_answers + }; + AssetsInfo::::insert(asset_id, asset_info); + AssetsCount::::mutate(|a| *a += 1); + Self::deposit_event(Event::AssetInfoChange(asset_id, threshold, min_answers, max_answers)); + Ok(().into()) + } + + #[pallet::weight(10_000)] + pub fn request_price(origin: OriginFor, asset_id: u64) -> DispatchResultWithPostInfo { + //TODO talk about the security and if this should be protected + let who = ensure_signed(origin)?; + Self::do_request_price(&who, asset_id)?; + Ok(().into()) + } + + #[pallet::weight(10_000)] + pub fn set_signer( + origin: OriginFor, + signer: T::AccountId, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let current_controller = ControllerToSigner::::get(&who); + let current_signer = SignerToController::::get(&signer); + + ensure!(current_controller == None, Error::::ControllerUsed); + ensure!(current_signer == None, Error::::SignerUsed); + + Self::do_add_stake(who.clone(), signer.clone(), T::MinStake::get())?; + + ControllerToSigner::::insert(&who, signer.clone()); + SignerToController::::insert(signer, who); + + Ok(().into()) + } + + #[pallet::weight(10_000)] + pub fn add_stake(origin: OriginFor, stake: BalanceOf) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let signer = ControllerToSigner::::get(&who).ok_or(Error::::UnsetSigner)?; + + Self::do_add_stake(who, signer, stake)?; + + Ok(().into()) + } + + #[pallet::weight(10_000)] + pub fn remove_stake(origin: OriginFor) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let signer = ControllerToSigner::::get(&who).ok_or(Error::::UnsetSigner)?; + let block = frame_system::Pallet::::block_number(); + let unlock_block = block + T::StakeLock::get(); //TODO check type of add + let stake = Self::oracle_stake(signer.clone()).ok_or(Error::::NoStake)?; + let withdrawal = Withdraw { + stake, + unlock_block, + }; + OracleStake::::remove(&signer); + DeclaredWithdraws::::insert(signer.clone(), withdrawal); + Self::deposit_event(Event::StakeRemoved(signer, stake, unlock_block)); + Ok(().into()) + } + + #[pallet::weight(10_000)] + pub fn reclaim_stake(origin: OriginFor) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let signer = ControllerToSigner::::get(&who).ok_or(Error::::UnsetSigner)?; + let block = frame_system::Pallet::::block_number(); + let withdrawal = DeclaredWithdraws::::get(&signer).ok_or(Error::::Unknown)?; + ensure!(block > withdrawal.unlock_block, Error::::StakeLocked); + DeclaredWithdraws::::remove(&signer); + T::Currency::unreserve(&signer, withdrawal.stake.into()); + let _ = T::Currency::transfer(&signer, &who, withdrawal.stake.into(), AllowDeath); + + ControllerToSigner::::remove(&who); + SignerToController::::remove(&signer); + + Self::deposit_event(Event::StakeReclaimed(signer, withdrawal.stake)); + Ok(().into()) + } + + #[pallet::weight(10_000)] + pub fn submit_price( + origin: OriginFor, + price: u64, + asset_id: u64, + ) -> DispatchResultWithPostInfo { + log::info!("inside submit {:#?}, {:#?}", asset_id, price); + let who = ensure_signed(origin)?; + let author_stake = OracleStake::::get(&who).unwrap_or_else(Zero::zero); + ensure!(Requested::::get(asset_id), Error::::PriceNotRequested); + ensure!( + author_stake >= T::MinStake::get(), + Error::::NotEnoughStake + ); + + let set_price = PrePrice { + price, + block: frame_system::Pallet::::block_number(), + who: who.clone(), + }; + log::info!("inside submit 2 {:#?}, {:#?}", set_price, asset_id); + PrePrices::::try_mutate(asset_id, |current_prices| -> DispatchResult { + if current_prices + .into_iter() + .any(|candidate| candidate.who == who) + { + Err(Error::::AlreadySubmitted)? + } + if current_prices.len() as u64 >= AssetsInfo::::get(asset_id).max_answers { + Err(Error::::MaxPrices)? + } + current_prices.push(set_price); + Ok(()) + })?; + Self::deposit_event(Event::PriceSubmitted(who, asset_id, price)); + Ok(().into()) + } + } + + /// Payload used by this example crate to hold price + /// data required to submit a transaction. + #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] + pub struct PricePayload { + block_number: BlockNumber, + price: u32, + public: Public, + } + + impl SignedPayload for PricePayload { + fn public(&self) -> T::Public { + self.public.clone() + } + } + + impl Pallet { + + pub fn do_add_stake(who: T::AccountId, signer: T::AccountId, stake: BalanceOf) -> DispatchResult { + T::Currency::transfer(&who, &signer, stake, KeepAlive)?; + T::Currency::reserve(&signer, stake.into())?; + let amount_staked = Self::oracle_stake(signer.clone()).unwrap_or(0u32.into()) + stake; // TODO maybe use checked add? + OracleStake::::insert(&signer, amount_staked); + Self::deposit_event(Event::StakeAdded(signer, stake, amount_staked)); + Ok(()) + } + + + pub fn handle_payout(pre_prices: &Vec>, price: u64, asset_id: u64) { + // TODO only take prices up to max prices + for answer in pre_prices { + let accuracy: Percent; + if answer.price < price { + accuracy = PerThing::from_rational(answer.price, price); + } else { + let adjusted_number = price.saturating_sub(answer.price - price); + accuracy = PerThing::from_rational(adjusted_number, price); + } + let min_accuracy = AssetsInfo::::get(asset_id).threshold; + if accuracy < min_accuracy { + let slash_amount = T::SlashAmount::get(); + let try_slash = T::Currency::can_slash(&answer.who, slash_amount); + if !try_slash { + log::warn!("Failed to slash {:?}", answer.who); + } + T::Currency::slash(&answer.who, slash_amount); + Self::deposit_event(Event::UserSlashed(answer.who.clone(), asset_id, slash_amount)); + } else { + let reward_amount = T::RewardAmount::get(); + let controller = + SignerToController::::get(&answer.who).unwrap_or(answer.who.clone()); + // TODO: since inlflationary, burn a portion of tx fees of the chain to account for this + let _ = T::Currency::deposit_into_existing(&controller, reward_amount); + Self::deposit_event(Event::UserRewarded(answer.who.clone(), asset_id, reward_amount)); + } + } + } + pub fn do_request_price(who: &T::AccountId, asset_id: u64) -> DispatchResult { + ensure!(AssetsInfo::::get(asset_id).threshold != Percent::from_percent(0), Error::::InvalidAssetId); + if !Self::requested(asset_id) { + ensure!( + T::Currency::can_slash(who, T::RequestCost::get()), + Error::::NotEnoughFunds + ); + T::Currency::slash(who, T::RequestCost::get()); + RequestedId::::mutate(asset_id, |request_id| *request_id += 1); + Requested::::insert(asset_id, true); + } + Self::deposit_event(Event::PriceRequested(who.clone(), asset_id)); + Ok(()) + } + + pub fn prune_old( + mut pre_pruned_prices: Vec>, + block: T::BlockNumber + ) -> Vec> { + let stale_block = block.saturating_sub(T::StalePrice::get()); + if pre_pruned_prices.len() == 0 || pre_pruned_prices[0].block >= stale_block { + pre_pruned_prices + } else { + let pruned_price = loop { + if pre_pruned_prices.len() == 0 { + break pre_pruned_prices; + } + if pre_pruned_prices[0].block >= stale_block { + break pre_pruned_prices; + } else { + Self::deposit_event(Event::AnswerPruned(pre_pruned_prices[0].who.clone(), pre_pruned_prices[0].price)); + pre_pruned_prices.remove(0); + } + }; + pruned_price + } + } + + pub fn get_median_price(prices: &Vec>) -> u64 { + let mut numbers: Vec = prices + .iter() + .map(|current_prices| current_prices.price) + .collect(); + numbers.sort(); + let mid = numbers.len() / 2; + numbers[mid] + } + + pub fn check_requests() { + for i in 0..AssetsCount::::get() { + if Requested::::get(i) { + let _ = Self::fetch_price_and_send_signed(&i); + } + } + } + + pub fn fetch_price_and_send_signed(price_id: &u64) -> Result<(), &'static str> { + let signer = Signer::::all_accounts(); + log::info!("signer"); + if !signer.can_sign() { + log::info!("no signer"); + return Err( + "No local accounts available. Consider adding one via `author_insertKey` RPC.", + )?; + } + // Make an external HTTP request to fetch the current price. + // Note this call will block until response is received. + let price = Self::fetch_price(&price_id).map_err(|_| "Failed to fetch price")?; + log::info!("price {:#?}", price); + + // Using `send_signed_transaction` associated type we create and submit a transaction + // representing the call, we've just created. + // Submit signed will return a vector of results for all accounts that were found in the + // local keystore with expected `KEY_TYPE`. + let results = signer.send_signed_transaction(|_account| { + // Received price is wrapped into a call to `submit_price` public function of this pallet. + // This means that the transaction, when executed, will simply call that function passing + // `price` as an argument. + Call::submit_price(price, *price_id) + }); + + for (acc, res) in &results { + match res { + Ok(()) => log::info!("[{:?}] Submitted price of {} cents", acc.id, price), + Err(e) => log::error!("[{:?}] Failed to submit transaction: {:?}", acc.id, e), + } + } + + Ok(()) + } + + pub fn fetch_price(price_id: &u64) -> Result { + // We want to keep the offchain worker execution time reasonable, so we set a hard-coded + // deadline to 2s to complete the external call. + // You can also wait idefinitely for the response, however you may still get a timeout + // coming from the host machine. + let deadline = sp_io::offchain::timestamp().add(Duration::from_millis(2_000)); + // Initiate an external HTTP GET request. + // This is using high-level wrappers from `sp_runtime`, for the low-level calls that + // you can find in `sp_io`. The API is trying to be similar to `reqwest`, but + // since we are running in a custom WASM execution environment we can't simply + // import the library here.] + + let kind = sp_core::offchain::StorageKind::PERSISTENT; + let from_local = sp_io::offchain::local_storage_get(kind, b"ocw-url") + .unwrap_or(b"http://localhost:3001/price/".to_vec()); + let base = str::from_utf8(&from_local).unwrap_or("http://localhost:3001/price/"); + let string_id = serde_json::to_string(&price_id).map_err(|_| http::Error::IoError)?; + let request_id = RequestedId::::get(&price_id); + let string_request_id = + serde_json::to_string(&request_id).map_err(|_| http::Error::IoError)?; + let url = base.to_owned() + &string_id + "/" + &string_request_id; + let request = http::Request::get(&url); + + log::info!("request incoming {:#?}", request); + + // We set the deadline for sending of the request, note that awaiting response can + // have a separate deadline. Next we send the request, before that it's also possible + // to alter request headers or stream body content in case of non-GET requests. + let pending = request + .deadline(deadline) + .send() + .map_err(|_| http::Error::IoError)?; + + // The request is already being processed by the host, we are free to do anything + // else in the worker (we can send multiple concurrent requests too). + // At some point however we probably want to check the response though, + // so we can block current thread and wait for it to finish. + // Note that since the request is being driven by the host, we don't have to wait + // for the request to have it complete, we will just not read the response. + let response = pending + .try_wait(deadline) + .map_err(|_| http::Error::DeadlineReached)??; + // Let's check the status code before we proceed to reading the response. + if response.code != 200 { + log::warn!("Unexpected status code: {}", response.code); + return Err(http::Error::Unknown); + } + + // Next we want to fully read the response body and collect it to a vector of bytes. + // Note that the return object allows you to read the body in chunks as well + // with a way to control the deadline. + let body = response.body().collect::>(); + + // Create a str slice from the body. + let body_str = sp_std::str::from_utf8(&body).map_err(|_| { + log::warn!("No UTF8 body"); + http::Error::Unknown + })?; + + let price = match Self::parse_price(body_str) { + Some(price) => Ok(price), + None => { + log::warn!("Unable to extract price from the response: {:?}", body_str); + Err(http::Error::Unknown) + } + }?; + + log::warn!("Got price: {} cents", price); + + Ok(price) + } + + pub fn parse_price(price_str: &str) -> Option { + let val = lite_json::parse_json(price_str); + let price = match val.ok()? { + JsonValue::Object(obj) => { + let (_, v) = obj + .into_iter() + .find(|(k, _)| k.iter().copied().eq("USD".chars()))?; + match v { + JsonValue::Number(number) => number, + _ => return None, + } + } + _ => return None, + }; + + let exp = price.fraction_length.checked_sub(2).unwrap_or(0); + Some(price.integer as u64 * 100 + (price.fraction / 10_u64.pow(exp)) as u64) + } + } +} diff --git a/pallets/oracle/src/mock.rs b/pallets/oracle/src/mock.rs new file mode 100644 index 00000000000..5161e2508d1 --- /dev/null +++ b/pallets/oracle/src/mock.rs @@ -0,0 +1,201 @@ +use crate as pallet_oracle; +use crate::*; +use frame_support::{ord_parameter_types, parameter_types}; +use frame_system as system; +use frame_system::EnsureSignedBy; +use sp_core::{ + sr25519::Signature, + H256, +}; +use sp_keystore::{ + testing::KeyStore, + {SyncCryptoStore}, +}; +use sp_runtime::{ + testing::{Header, TestXt}, + traits::{BlakeTwo256, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify}, + RuntimeAppPublic, +}; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +// Configure a mock runtime to test the pallet. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + Oracle: pallet_oracle::{Pallet, Call, Storage, Event}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl system::Config for Test { + type BaseCallFilter = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = sp_core::sr25519::Public; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); +} + +parameter_types! { + pub const ExistentialDeposit: u64 = 1; +} + +impl pallet_balances::Config for Test { + type Balance = u64; + type Event = Event; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; +} + +parameter_types! { + pub const StakeLock: u64 = 1; + pub const MinStake: u64 = 1; + pub const StalePrice: u64 = 2; + pub const RequestCost: u64 = 1; + pub const RewardAmount: u64 = 5; + pub const SlashAmount: u64 = 5; + +} + +ord_parameter_types! { + pub const RootAccount: AccountId = get_account_2(); +} + +pub type Extrinsic = TestXt; +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; + +impl frame_system::offchain::SigningTypes for Test { + type Public = ::Signer; + type Signature = Signature; +} + +impl frame_system::offchain::SendTransactionTypes for Test +where + Call: From, +{ + type OverarchingCall = Call; + type Extrinsic = Extrinsic; +} + +impl frame_system::offchain::CreateSignedTransaction for Test +where + Call: From, +{ + fn create_transaction>( + call: Call, + _public: ::Signer, + _account: AccountId, + nonce: u64, + ) -> Option<(Call, ::SignaturePayload)> { + Some((call, (nonce, ()))) + } +} + +impl pallet_oracle::Config for Test { + type Event = Event; + type AuthorityId = crypto::TestAuthId; + type Currency = Balances; + type StakeLock = StakeLock; + type StalePrice = StalePrice; + type MinStake = MinStake; + type AddOracle = EnsureSignedBy; + type RequestCost = RequestCost; + type RewardAmount = RewardAmount; + type SlashAmount = SlashAmount; +} + +// Build genesis storage according to the mock runtime. +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = system::GenesisConfig::default() + .build_storage::() + .unwrap(); + let genesis = pallet_balances::GenesisConfig:: { + balances: vec![ + (Default::default(), 100), + (get_account_2(), 100), + (get_account_4(), 100), + (get_account_5(), 100), + ], + }; + genesis.assimilate_storage(&mut t).unwrap(); + t.into() +} + +pub fn get_account_2() -> AccountId { + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let keystore = KeyStore::new(); + SyncCryptoStore::sr25519_generate_new( + &keystore, + crate::crypto::Public::ID, + Some(&format!("{}/hunter1", PHRASE)), + ) + .unwrap() +} + +pub fn get_account_3() -> AccountId { + const PHRASE: &str = + "know keen dinner rigid attend sentence demise aunt chronic flash energy parrot"; + let keystore = KeyStore::new(); + SyncCryptoStore::sr25519_generate_new( + &keystore, + crate::crypto::Public::ID, + Some(&format!("{}/hunter1", PHRASE)), + ) + .unwrap() +} + +pub fn get_account_4() -> AccountId { + const PHRASE: &str = "wild fog rather logic flame media blade aerobic either toast cost damp"; + let keystore = KeyStore::new(); + SyncCryptoStore::sr25519_generate_new( + &keystore, + crate::crypto::Public::ID, + Some(&format!("{}/hunter1", PHRASE)), + ) + .unwrap() +} + +pub fn get_account_5() -> AccountId { + const PHRASE: &str = "topic say join drop loud labor little chest public squeeze fossil coil"; + let keystore = KeyStore::new(); + SyncCryptoStore::sr25519_generate_new( + &keystore, + crate::crypto::Public::ID, + Some(&format!("{}/hunter1", PHRASE)), + ) + .unwrap() +} diff --git a/pallets/oracle/src/tests.rs b/pallets/oracle/src/tests.rs new file mode 100644 index 00000000000..d0b7606cd3b --- /dev/null +++ b/pallets/oracle/src/tests.rs @@ -0,0 +1,669 @@ +use crate::mock::{AccountId, Call, Extrinsic}; +use crate::{mock::*, Error, PrePrice, Price, Withdraw, AssetInfo, *}; +use codec::Decode; +use frame_support::{ + assert_noop, assert_ok, + traits::{Currency, OnInitialize}, +}; +use pallet_balances::Error as BalancesError; +use sp_core::{ + offchain::{testing, OffchainWorkerExt, TransactionPoolExt}, +}; +use sp_keystore::{ + testing::KeyStore, + {KeystoreExt, SyncCryptoStore}, +}; +use sp_runtime::{Percent, RuntimeAppPublic}; +use std::sync::Arc; + +use sp_runtime::traits::{BadOrigin}; + +#[test] +fn add_asset_and_info() { + new_test_ext().execute_with(|| { + // passes + let account_2 = get_account_2(); + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 1, + Percent::from_percent(80), + 3, + 5, + )); + + let asset_info = AssetInfo { + threshold: Percent::from_percent(80), + min_answers: 3, + max_answers: 5 + }; + // id now activated and count incremented + assert_eq!(Oracle::accuracy_threshold(1), asset_info); + assert_eq!(Oracle::assets_count(), 1); + // fails with non permission + let account_1: AccountId = Default::default(); + assert_noop!( + Oracle::add_asset_and_info(Origin::signed(account_1), 1, Percent::from_percent(80), 3, 5), + BadOrigin + ); + }); +} + +#[test] +fn set_signer() { + new_test_ext().execute_with(|| { + let account_1: AccountId = Default::default(); + let account_2 = get_account_2(); + let account_3 = get_account_3(); + let account_4 = get_account_4(); + let account_5 = get_account_5(); + + assert_ok!(Oracle::set_signer(Origin::signed(account_2), account_1)); + assert_eq!(Oracle::controller_to_signer(account_2), Some(account_1)); + assert_eq!(Oracle::signer_to_controller(account_1), Some(account_2)); + + assert_ok!(Oracle::set_signer(Origin::signed(account_1), account_5)); + assert_eq!(Oracle::controller_to_signer(account_1), Some(account_5)); + assert_eq!(Oracle::signer_to_controller(account_5), Some(account_1)); + + assert_noop!(Oracle::set_signer(Origin::signed(account_3), account_4), BalancesError::::InsufficientBalance); + assert_noop!(Oracle::set_signer(Origin::signed(account_4), account_1), Error::::SignerUsed); + assert_noop!( + Oracle::set_signer(Origin::signed(account_1), account_2), + Error::::ControllerUsed + ); + }); +} + +#[test] +fn do_request_price() { + new_test_ext().execute_with(|| { + // sets ID to true first + let account_2 = get_account_2(); + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 1, + Percent::from_percent(80), + 3, + 5, + )); + + let account_3 = get_account_3(); + // fails on not enough funds + assert_noop!( + Oracle::do_request_price(&account_3, 1), + Error::::NotEnoughFunds + ); + // passes + let account_1: AccountId = Default::default(); + assert_ok!(Oracle::do_request_price(&account_1, 1)); + // takes the cost + assert_eq!(Balances::free_balance(account_1), 99); + // True and request ID incremented + assert_eq!(Oracle::requested(1), true); + assert_eq!(Oracle::request_id(1), 1); + + // fails on invalid ID + assert_noop!( + Oracle::do_request_price(&account_1, 2), + Error::::InvalidAssetId + ); + + // no funds taken if already true + let account_3 = get_account_3(); + assert_ok!(Oracle::do_request_price(&account_3, 1)); + + // True and request ID not incremented + assert_eq!(Oracle::requested(1), true); + assert_eq!(Oracle::request_id(1), 1); + }); +} + +#[test] +fn add_stake() { + new_test_ext().execute_with(|| { + let account_1: AccountId = Default::default(); + let account_2 = get_account_2(); + // fails no controller set + assert_noop!( + Oracle::add_stake(Origin::signed(account_1), 50), + Error::::UnsetSigner + ); + + assert_ok!(Oracle::set_signer(Origin::signed(account_1), account_2)); + + assert_eq!(Balances::free_balance(account_2), 100); + assert_eq!(Balances::free_balance(account_1), 99); + assert_ok!(Oracle::add_stake(Origin::signed(account_1), 50)); + assert_eq!(Balances::free_balance(account_1), 49); + assert_eq!(Balances::total_balance(&account_1), 49); + // funds were transferred to signer and locked + assert_eq!(Balances::free_balance(account_2), 100); + assert_eq!(Balances::total_balance(&account_2), 151); + + assert_eq!(Oracle::oracle_stake(account_2), Some(51)); + assert_eq!(Oracle::oracle_stake(account_1), None); + + assert_ok!(Oracle::add_stake(Origin::signed(account_1), 39)); + assert_eq!(Balances::free_balance(account_1), 10); + assert_eq!(Balances::total_balance(&account_1), 10); + assert_eq!(Balances::free_balance(account_2), 100); + assert_eq!(Balances::total_balance(&account_2), 190); + + assert_eq!(Oracle::oracle_stake(account_2), Some(90)); + assert_eq!(Oracle::oracle_stake(account_1), None); + + assert_noop!( + Oracle::add_stake(Origin::signed(account_1), 10), + BalancesError::::KeepAlive + ); + }); +} + +#[test] +fn remove_and_reclaim_stake() { + new_test_ext().execute_with(|| { + let account_1: AccountId = Default::default(); + let account_2 = get_account_2(); + let account_3 = get_account_3(); + + assert_ok!(Oracle::set_signer(Origin::signed(account_1), account_2)); + + assert_ok!(Oracle::add_stake(Origin::signed(account_1), 50)); + + assert_noop!( + Oracle::reclaim_stake(Origin::signed(account_1)), + Error::::Unknown + ); + + assert_ok!(Oracle::remove_stake(Origin::signed(account_1))); + let withdrawal = Withdraw { + stake: 51, + unlock_block: 1, + }; + assert_eq!(Oracle::declared_withdraws(account_2), Some(withdrawal)); + assert_eq!(Oracle::oracle_stake(account_2), None); + assert_noop!( + Oracle::remove_stake(Origin::signed(account_1)), + Error::::NoStake + ); + + assert_noop!( + Oracle::reclaim_stake(Origin::signed(account_1)), + Error::::StakeLocked + ); + + System::set_block_number(2); + assert_ok!(Oracle::reclaim_stake(Origin::signed(account_1))); + // everyone gets their funds back + assert_eq!(Balances::free_balance(account_1), 100); + assert_eq!(Balances::total_balance(&account_1), 100); + assert_eq!(Balances::free_balance(account_2), 100); + assert_eq!(Balances::total_balance(&account_2), 100); + + // signer controller pruned + assert_eq!(Oracle::controller_to_signer(account_1), None); + assert_eq!(Oracle::signer_to_controller(account_2), None); + + assert_noop!( + Oracle::reclaim_stake(Origin::signed(account_3)), + Error::::UnsetSigner + ); + }); +} + +#[test] +fn add_price() { + new_test_ext().execute_with(|| { + let account_1: AccountId = Default::default(); + let account_2 = get_account_2(); + let account_4 = get_account_4(); + let account_5 = get_account_5(); + + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 0, + Percent::from_percent(80), + 3, + 3, + )); + // fails price not requested + assert_noop!( + Oracle::submit_price(Origin::signed(account_1), 100u64, 0u64), + Error::::PriceNotRequested + ); + + assert_ok!(Oracle::do_request_price(&account_1, 0)); + // fails no stake + assert_noop!( + Oracle::submit_price(Origin::signed(account_1), 100u64, 0u64), + Error::::NotEnoughStake + ); + + assert_ok!(Oracle::set_signer(Origin::signed(account_2), account_1)); + assert_ok!(Oracle::set_signer(Origin::signed(account_1), account_2)); + assert_ok!(Oracle::set_signer(Origin::signed(account_5), account_4)); + assert_ok!(Oracle::set_signer(Origin::signed(account_4), account_5)); + + assert_ok!(Oracle::add_stake(Origin::signed(account_1), 50)); + assert_ok!(Oracle::add_stake(Origin::signed(account_2), 50)); + assert_ok!(Oracle::add_stake(Origin::signed(account_4), 50)); + assert_ok!(Oracle::add_stake(Origin::signed(account_5), 50)); + + assert_ok!(Oracle::submit_price( + Origin::signed(account_1), + 100u64, + 0u64 + )); + assert_ok!(Oracle::submit_price( + Origin::signed(account_2), + 100u64, + 0u64 + )); + assert_ok!(Oracle::submit_price( + Origin::signed(account_4), + 100u64, + 0u64 + )); + assert_noop!( + Oracle::submit_price(Origin::signed(account_5), 100u64, 0u64), + Error::::MaxPrices + ); + + assert_noop!( + Oracle::submit_price(Origin::signed(account_2), 100u64, 0u64), + Error::::AlreadySubmitted + ); + + let price = PrePrice { + price: 100u64, + block: 0, + who: account_1, + }; + + let price2 = PrePrice { + price: 100u64, + block: 0, + who: account_2, + }; + + let price4 = PrePrice { + price: 100u64, + block: 0, + who: account_4, + }; + + assert_eq!(Oracle::pre_prices(0), vec![price, price2, price4]); + }); +} + +#[test] +fn medianize_price() { + new_test_ext().execute_with(|| { + let account_1: AccountId = Default::default(); + for i in 0..3 { + let price = i as u64 + 100u64; + add_price_storage(price, 0, account_1, 0); + } + let price = Oracle::get_median_price(&Oracle::pre_prices(0)); + assert_eq!(price, 101); + }); +} + +#[test] +#[should_panic = "No `keystore` associated for the current context!"] +fn check_request() { + new_test_ext().execute_with(|| { + let account_2 = get_account_2(); + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 0, + Percent::from_percent(80), + 3, + 5, + )); + let account_1: AccountId = Default::default(); + assert_ok!(Oracle::do_request_price(&account_1, 0)); + Oracle::check_requests(); + }); +} + +#[test] +fn not_check_request() { + new_test_ext().execute_with(|| { + Oracle::check_requests(); + }); +} + +#[test] +fn test_payout_slash() { + new_test_ext().execute_with(|| { + let account_1 = Default::default(); + let account_2 = get_account_2(); + let account_3 = get_account_3(); + let account_4 = get_account_4(); + let account_5 = get_account_5(); + assert_ok!(Oracle::set_signer(Origin::signed(account_5), account_2)); + + let one = PrePrice { + price: 79, + block: 0, + who: account_1, + }; + let two = PrePrice { + price: 100, + block: 0, + who: account_2, + }; + let three = PrePrice { + price: 151, + block: 0, + who: account_3, + }; + let four = PrePrice { + price: 400, + block: 0, + who: account_4, + }; + + let five = PrePrice { + price: 100, + block: 0, + who: account_5, + }; + // doesn't panic when percent not set + Oracle::handle_payout(&vec![one, two, three, four, five], 100, 0); + assert_eq!(Balances::free_balance(account_1), 105); + + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 0, + Percent::from_percent(80), + 3, + 5, + )); + + Oracle::handle_payout(&vec![one, two, three, four, five], 100, 0); + // account 1 and 4 gets slashed 2 and 5 gets rewarded + assert_eq!(Balances::free_balance(account_1), 100); + // 5 gets 2's reward and its own + assert_eq!(Balances::free_balance(account_5), 119); + assert_eq!(Balances::free_balance(account_2), 100); + + assert_eq!(Balances::free_balance(account_3), 0); + assert_eq!(Balances::free_balance(account_4), 100); + + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 0, + Percent::from_percent(90), + 3, + 5, + )); + Oracle::handle_payout(&vec![one, two, three, four, five], 100, 0); + + // account 4 gets slashed 2 5 and 1 gets rewarded + assert_eq!(Balances::free_balance(account_1), 95); + // 5 gets 2's reward and its own + assert_eq!(Balances::free_balance(account_5), 129); + assert_eq!(Balances::free_balance(account_2), 100); + + assert_eq!(Balances::free_balance(account_3), 0); + assert_eq!(Balances::free_balance(account_4), 95); + }); +} + +#[test] +fn on_init() { + new_test_ext().execute_with(|| { + // no price fetch + Oracle::on_initialize(1); + let price = Price { price: 0, block: 0 }; + + assert_eq!(Oracle::prices(0), price); + + // add and request oracle id + let account_2 = get_account_2(); + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 0, + Percent::from_percent(80), + 3, + 5, + )); + let account_1: AccountId = Default::default(); + assert_ok!(Oracle::do_request_price(&account_1, 0)); + // set prices into storage + let account_1: AccountId = Default::default(); + for i in 0..3 { + let price = i as u64 + 100u64; + add_price_storage(price, 0, account_1, 2); + } + + Oracle::on_initialize(2); + let price = Price { + price: 101, + block: 2, + }; + + assert_eq!(Oracle::prices(0), price); + // prunes state + assert_eq!(Oracle::pre_prices(0), vec![]); + assert_eq!(Oracle::requested(0), false); + + // doesn't prune state if under min prices + assert_ok!(Oracle::do_request_price(&account_1, 0)); + + for i in 0..2 { + let price = i as u64 + 100u64; + add_price_storage(price, 0, account_1, 3); + } + + Oracle::on_initialize(3); + assert_eq!(Oracle::pre_prices(0).len(), 2); + assert_eq!(Oracle::requested(0), true); + }); +} + +#[test] +fn on_init_prune_scenerios() { + new_test_ext().execute_with(|| { + // add and request oracle id + let account_2 = get_account_2(); + assert_ok!(Oracle::add_asset_and_info( + Origin::signed(account_2), + 0, + Percent::from_percent(80), + 3, + 5, + )); + let account_1: AccountId = Default::default(); + assert_ok!(Oracle::do_request_price(&account_1, 0)); + // set prices into storage + let account_1: AccountId = Default::default(); + for i in 0..3 { + let price = i as u64 + 100u64; + add_price_storage(price, 0, account_1, 0); + } + // all pruned + Oracle::on_initialize(3); + let price = Price { price: 0, block: 0 }; + assert_eq!(Oracle::prices(0), price); + assert_eq!(Oracle::pre_prices(0).len(), 0); + + for i in 0..5 { + let price = i as u64 + 1u64; + add_price_storage(price, 0, account_1, 0); + } + + for i in 0..3 { + let price = i as u64 + 100u64; + add_price_storage(price, 0, account_1, 3); + } + + // more than half pruned + Oracle::on_initialize(3); + let price = Price { + price: 101, + block: 3, + }; + assert_eq!(Oracle::prices(0), price); + + for i in 0..5 { + let price = i as u64 + 1u64; + add_price_storage(price, 0, account_1, 0); + } + + for i in 0..2 { + let price = i as u64 + 300u64; + add_price_storage(price, 0, account_1, 3); + } + + // more than half pruned not enough for a price call, same as previous + Oracle::on_initialize(5); + let price = Price { + price: 101, + block: 3, + }; + assert_eq!(Oracle::pre_prices(0).len(), 2); + assert_eq!(Oracle::prices(0), price); + }); +} + +#[test] +fn prune_old_edgecase() { + new_test_ext().execute_with(|| { + Oracle::prune_old(vec![], 0); + }); +} + +// #[test] +// fn should_make_http_call_and_parse_result() { +// let (offchain, state) = testing::TestOffchainExt::new(); +// let mut t = sp_io::TestExternalities::default(); +// t.register_extension(OffchainWorkerExt::new(offchain)); + +// price_oracle_response(&mut state.write(), "0"); + +// t.execute_with(|| { +// // when +// let price = Oracle::fetch_price(&0).unwrap(); +// // then +// assert_eq!(price, 15523); +// }); +// } + +fn price_oracle_response(state: &mut testing::OffchainState, price_id: &str) { + let base: String = "http://localhost:3001/price/".to_owned(); + let url = base + price_id + "/0"; + + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: url.into(), + response: Some(br#"{"USD": 155.23}"#.to_vec()), + sent: true, + ..Default::default() + }); +} + +// #[test] +// fn knows_how_to_mock_several_http_calls() { +// let (offchain, state) = testing::TestOffchainExt::new(); +// let mut t = sp_io::TestExternalities::default(); +// t.register_extension(OffchainWorkerExt::new(offchain)); + +// { +// let mut state = state.write(); +// state.expect_request(testing::PendingRequest { +// method: "GET".into(), +// uri: "http://localhost:3001/price/0/0".into(), +// response: Some(br#"{"USD": 1}"#.to_vec()), +// sent: true, +// ..Default::default() +// }); + +// state.expect_request(testing::PendingRequest { +// method: "GET".into(), +// uri: "http://localhost:3001/price/0/0".into(), +// response: Some(br#"{"USD": 2}"#.to_vec()), +// sent: true, +// ..Default::default() +// }); + +// state.expect_request(testing::PendingRequest { +// method: "GET".into(), +// uri: "http://localhost:3001/price/0/0".into(), +// response: Some(br#"{"USD": 3}"#.to_vec()), +// sent: true, +// ..Default::default() +// }); +// } + +// t.execute_with(|| { +// let price1 = Oracle::fetch_price(&0).unwrap(); +// let price2 = Oracle::fetch_price(&0).unwrap(); +// let price3 = Oracle::fetch_price(&0).unwrap(); + +// assert_eq!(price1, 100); +// assert_eq!(price2, 200); +// assert_eq!(price3, 300); +// }) +// } + +// #[test] +// fn should_submit_signed_transaction_on_chain() { +// const PHRASE: &str = +// "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + +// let (offchain, offchain_state) = testing::TestOffchainExt::new(); +// let (pool, pool_state) = testing::TestTransactionPoolExt::new(); +// let keystore = KeyStore::new(); +// SyncCryptoStore::sr25519_generate_new( +// &keystore, +// crate::crypto::Public::ID, +// Some(&format!("{}/hunter1", PHRASE)), +// ) +// .unwrap(); + +// let mut t = sp_io::TestExternalities::default(); +// t.register_extension(OffchainWorkerExt::new(offchain)); +// t.register_extension(TransactionPoolExt::new(pool)); +// t.register_extension(KeystoreExt(Arc::new(keystore))); + +// price_oracle_response(&mut offchain_state.write(), "0"); + +// t.execute_with(|| { +// // when +// Oracle::fetch_price_and_send_signed(&0).unwrap(); +// // then +// let tx = pool_state.write().transactions.pop().unwrap(); +// assert!(pool_state.read().transactions.is_empty()); +// let tx = Extrinsic::decode(&mut &*tx).unwrap(); +// assert_eq!(tx.signature.unwrap().0, 0); +// assert_eq!(tx.call, Call::Oracle(crate::Call::submit_price(15523, 0))); +// }); +// } + +#[test] +fn parse_price_works() { + let test_data = vec![ + ("{\"USD\":6536.92}", Some(653692)), + ("{\"USD\":65.92}", Some(6592)), + ("{\"USD\":6536.924565}", Some(653692)), + ("{\"USD\":6536}", Some(653600)), + ("{\"USD2\":6536}", None), + ("{\"USD\":\"6432\"}", None), + ]; + + for (json, expected) in test_data { + assert_eq!(expected, Oracle::parse_price(json)); + } +} + +fn add_price_storage(price: u64, asset_id: u64, who: AccountId, block: u64) { + let price = PrePrice { + price: price, + block, + who, + }; + PrePrices::::mutate(asset_id, |current_prices| current_prices.push(price)); +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 75819d1f793..3870afebc4f 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -64,6 +64,12 @@ git = 'https://github.com/paritytech/substrate.git' rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' version = '3.1.0' +[dependencies.pallet-indices] +default-features = false +git = 'https://github.com/paritytech/substrate.git' +rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' +version = '3.0.0' + [dependencies.pallet-randomness-collective-flip] default-features = false git = 'https://github.com/paritytech/substrate.git' @@ -81,6 +87,11 @@ default-features = false path = '../pallets/template' version = '3.0.0' +[dependencies.pallet-oracle] +default-features = false +path = '../pallets/oracle' +version = '3.0.0' + [dependencies.pallet-timestamp] default-features = false git = 'https://github.com/paritytech/substrate.git' @@ -202,9 +213,11 @@ std = [ 'pallet-aura/std', 'pallet-balances/std', 'pallet-grandpa/std', + 'pallet-indices/std', 'pallet-randomness-collective-flip/std', 'pallet-sudo/std', 'pallet-template/std', + 'pallet-oracle/std', 'pallet-timestamp/std', 'pallet-transaction-payment-rpc-runtime-api/std', 'pallet-transaction-payment/std', diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 2ff4272747e..289c9d1a0a9 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -13,8 +13,14 @@ use sp_runtime::{ transaction_validity::{TransactionValidity, TransactionSource}, }; use sp_runtime::traits::{ - BlakeTwo256, Block as BlockT, AccountIdLookup, Verify, IdentifyAccount, NumberFor, + BlakeTwo256, Block as BlockT, Verify, IdentifyAccount, NumberFor, SaturatedConversion }; +use frame_system::{ + EnsureRoot, EnsureOneOf, +}; +use sp_runtime::generic::Era; +use sp_runtime::traits::StaticLookup; +use sp_core::Encode; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; @@ -30,7 +36,7 @@ pub use pallet_timestamp::Call as TimestampCall; pub use pallet_balances::Call as BalancesCall; pub use sp_runtime::{Permill, Perbill}; pub use frame_support::{ - construct_runtime, parameter_types, StorageValue, + construct_runtime, parameter_types, StorageValue, debug, traits::{KeyOwnerProofSystem, Randomness}, weights::{ Weight, IdentityFee, @@ -163,7 +169,7 @@ impl frame_system::Config for Runtime { /// The aggregated dispatch type that is available for extrinsics. type Call = Call; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. - type Lookup = AccountIdLookup; + type Lookup = Indices; /// The index type for storing how many extrinsics an account has signed. type Index = Index; /// The index type for blocks. @@ -274,9 +280,101 @@ impl pallet_sudo::Config for Runtime { type Call = Call; } -/// Configure the pallet-template in pallets/template. -impl pallet_template::Config for Runtime { +parameter_types! { + pub const IndexDeposit: Balance = 1 * 100000000000000; +} + +impl pallet_indices::Config for Runtime { + type AccountIndex = AccountIndex; + type Currency = Balances; + type Deposit = IndexDeposit; + type Event = Event; + type WeightInfo = pallet_indices::weights::SubstrateWeight; +} + +pub type SignedPayload = generic::SignedPayload; + +parameter_types! { + pub const StakeLock: BlockNumber = 50; + pub const MinStake: Balance = 1; + pub const RequestCost: Balance = 1; + pub const RewardAmount: Balance = 5; + pub const SlashAmount: Balance = 5; + pub const StalePrice: BlockNumber = 5; + +} + +impl pallet_oracle::Config for Runtime { + type Currency = Balances; type Event = Event; + type AuthorityId = pallet_oracle::crypto::TestAuthId; + type StakeLock = StakeLock; + type MinStake = MinStake; + type StalePrice = StalePrice; + type AddOracle = EnsureOneOf, EnsureRoot>; + type RequestCost = RequestCost; + type RewardAmount = RewardAmount; + type SlashAmount = SlashAmount; +} + +impl frame_system::offchain::CreateSignedTransaction for Runtime + where + Call: From, +{ + fn create_transaction>( + call: Call, + public: ::Signer, + account: AccountId, + nonce: Index, + ) -> Option<(Call, ::SignaturePayload)> { + let tip = 0; + // take the biggest period possible. + let period = BlockHashCount::get() + .checked_next_power_of_two() + .map(|c| c / 2) + .unwrap_or(2) as u64; + let current_block = System::block_number() + .saturated_into::() + // The `System::block_number` is initialized with `n+1`, + // so the actual block number is `n`. + .saturating_sub(1); + let era = Era::mortal(period, current_block); + let extra = ( + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(era), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + ); + let raw_payload = SignedPayload::new(call, extra) + .map_err(|_e| { + // log::warn!("Unable to create signed payload: {:?}", e); + }) + .ok()?; + let signature = raw_payload + .using_encoded(|payload| { + C::sign(payload, public) + })?; + let address = Indices::unlookup(account); + let (call, extra, _) = raw_payload.deconstruct(); + Some((call, (address, signature.into(), extra))) + } +} + + +impl frame_system::offchain::SigningTypes for Runtime { + type Public = ::Signer; + type Signature = Signature; +} + +impl frame_system::offchain::SendTransactionTypes for Runtime +where + Call: From, +{ + type OverarchingCall = Call; + type Extrinsic = UncheckedExtrinsic; } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -290,17 +388,17 @@ construct_runtime!( RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Aura: pallet_aura::{Pallet, Config}, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event}, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event}, - // Include the custom logic from the pallet-template in the runtime. - TemplateModule: pallet_template::{Pallet, Call, Storage, Event}, + Oracle: pallet_oracle::{Pallet, Call, Storage, Event}, } ); /// The address format for describing accounts. -pub type Address = sp_runtime::MultiAddress; +pub type Address = sp_runtime::MultiAddress; /// Block header type as expected by this runtime. pub type Header = generic::Header; /// Block type as expected by this runtime. From f3be0cb8dd8013602a586037464e92a3c51322ae Mon Sep 17 00:00:00 2001 From: scruffy-dev Date: Mon, 12 Jul 2021 18:48:57 +0200 Subject: [PATCH 2/6] setup --- .gitignore | 2 + Cargo.lock | 535 +++++++++++---------------------- docker/Dockerfile | 30 ++ docker/build.sh | 27 ++ node/Cargo.toml | 6 +- setup/index.js | 227 ++++++++++++++ setup/package.json | 15 + setup/priceFeed.js | 54 ++++ setup/requestPrice.js | 74 +++++ setup/yarn.lock | 667 ++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 1272 insertions(+), 365 deletions(-) create mode 100644 docker/Dockerfile create mode 100644 docker/build.sh create mode 100644 setup/index.js create mode 100644 setup/package.json create mode 100644 setup/priceFeed.js create mode 100644 setup/requestPrice.js create mode 100644 setup/yarn.lock diff --git a/.gitignore b/.gitignore index 0f23d8a7220..258a0a35e8f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ # direnv cache .direnv + +node_modules diff --git a/Cargo.lock b/Cargo.lock index 7f5895dbacb..de2c55785dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1546,9 +1546,9 @@ dependencies = [ "sp-api", "sp-io", "sp-runtime", - "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface", + "sp-std", + "sp-storage", ] [[package]] @@ -1566,9 +1566,9 @@ dependencies = [ "sc-executor", "sc-service", "serde", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", + "sp-keystore", "sp-runtime", "sp-state-machine", "structopt", @@ -1582,11 +1582,11 @@ dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", + "sp-tracing", ] [[package]] @@ -1596,8 +1596,8 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "serde", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-std", ] [[package]] @@ -1617,14 +1617,14 @@ dependencies = [ "serde", "smallvec 1.6.1", "sp-arithmetic", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-io", "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", + "sp-tracing", ] [[package]] @@ -1671,10 +1671,10 @@ dependencies = [ "log", "parity-scale-codec", "serde", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-version", ] @@ -1687,9 +1687,9 @@ dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -3685,10 +3685,10 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-aura", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-finality-grandpa", "sp-inherents", - "sp-keystore 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-keystore", "sp-runtime", "sp-timestamp", "sp-transaction-pool", @@ -3723,12 +3723,12 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-consensus-aura", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-offchain", "sp-runtime", "sp-session", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -3897,7 +3897,7 @@ dependencies = [ "sp-application-crypto", "sp-consensus-aura", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -3911,7 +3911,7 @@ dependencies = [ "parity-scale-codec", "sp-authorship", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -3926,7 +3926,7 @@ dependencies = [ "max-encoded-len", "parity-scale-codec", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -3942,13 +3942,13 @@ dependencies = [ "pallet-session", "parity-scale-codec", "sp-application-crypto", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-finality-grandpa", "sp-io", "sp-runtime", "sp-session", "sp-staking", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -3959,11 +3959,11 @@ dependencies = [ "frame-support", "frame-system", "parity-scale-codec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", "sp-keyring", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -3978,11 +3978,11 @@ dependencies = [ "parity-scale-codec", "serde", "serde_json", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -3995,7 +3995,7 @@ dependencies = [ "parity-scale-codec", "safe-mix", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -4009,12 +4009,12 @@ dependencies = [ "log", "pallet-timestamp", "parity-scale-codec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", "sp-runtime", "sp-session", "sp-staking", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-trie", ] @@ -4028,7 +4028,7 @@ dependencies = [ "parity-scale-codec", "sp-io", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -4040,7 +4040,7 @@ dependencies = [ "frame-system", "parity-scale-codec", "serde", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", "sp-runtime", ] @@ -4059,7 +4059,7 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-timestamp", ] @@ -4073,10 +4073,10 @@ dependencies = [ "parity-scale-codec", "serde", "smallvec 1.6.1", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -4091,7 +4091,7 @@ dependencies = [ "parity-scale-codec", "sp-api", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-rpc", "sp-runtime", ] @@ -4229,12 +4229,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "parity-wasm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" - [[package]] name = "parity-wasm" version = "0.42.2" @@ -5248,7 +5242,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-consensus", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-runtime", "sp-transaction-pool", @@ -5265,7 +5259,7 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-runtime", "sp-state-machine", @@ -5288,7 +5282,7 @@ dependencies = [ "serde_json", "sp-chain-spec", "sp-consensus-babe", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", ] @@ -5328,9 +5322,9 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-keyring", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-panic-handler", "sp-runtime", "sp-utils", @@ -5359,15 +5353,15 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-consensus", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-database", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities", "sp-inherents", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-runtime", "sp-state-machine", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", + "sp-storage", "sp-transaction-pool", "sp-trie", "sp-utils", @@ -5397,7 +5391,7 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-database", "sp-runtime", "sp-state-machine", @@ -5440,10 +5434,10 @@ dependencies = [ "sp-consensus", "sp-consensus-aura", "sp-consensus-slots", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-io", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-runtime", "sp-version", "substrate-prometheus-endpoint", @@ -5485,10 +5479,10 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-slots", "sp-consensus-vrf", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-io", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-runtime", "sp-utils", "sp-version", @@ -5527,7 +5521,7 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-slots", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-runtime", "sp-state-machine", @@ -5563,17 +5557,17 @@ dependencies = [ "sc-executor-wasmi", "sc-executor-wasmtime", "sp-api", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", "sp-io", "sp-panic-handler", - "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface", "sp-serializer", "sp-tasks", "sp-trie", "sp-version", - "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "wasmi 0.9.0", + "sp-wasm-interface", + "wasmi", ] [[package]] @@ -5585,12 +5579,12 @@ dependencies = [ "parity-scale-codec", "pwasm-utils", "sp-allocator", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-maybe-compressed-blob", "sp-serializer", - "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-wasm-interface", "thiserror", - "wasmi 0.9.0", + "wasmi", ] [[package]] @@ -5602,10 +5596,10 @@ dependencies = [ "parity-scale-codec", "sc-executor-common", "sp-allocator", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "wasmi 0.9.0", + "sp-core", + "sp-runtime-interface", + "sp-wasm-interface", + "wasmi", ] [[package]] @@ -5621,9 +5615,9 @@ dependencies = [ "sc-executor-common", "scoped-tls", "sp-allocator", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-runtime-interface", + "sp-wasm-interface", "wasmtime", ] @@ -5658,10 +5652,10 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-finality-grandpa", "sp-inherents", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-runtime", "sp-utils", "substrate-prometheus-endpoint", @@ -5701,8 +5695,8 @@ dependencies = [ "rand 0.7.3", "serde_json", "sp-application-crypto", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-keystore", "subtle 2.4.0", ] @@ -5719,8 +5713,8 @@ dependencies = [ "sc-executor", "sp-api", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", "sp-runtime", "sp-state-machine", ] @@ -5767,7 +5761,7 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", "sp-utils", "substrate-prometheus-endpoint", @@ -5816,7 +5810,7 @@ dependencies = [ "sc-keystore", "sc-network", "sp-api", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-offchain", "sp-runtime", "sp-utils", @@ -5867,14 +5861,14 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-chain-spec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-keystore", "sp-offchain", "sp-rpc", "sp-runtime", "sp-session", "sp-state-machine", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing", "sp-transaction-pool", "sp-utils", "sp-version", @@ -5897,10 +5891,10 @@ dependencies = [ "serde", "serde_json", "sp-chain-spec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-rpc", "sp-runtime", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing", "sp-transaction-pool", "sp-version", ] @@ -5966,15 +5960,15 @@ dependencies = [ "sp-block-builder", "sp-blockchain", "sp-consensus", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", "sp-inherents", "sp-io", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-runtime", "sp-session", "sp-state-machine", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", @@ -5999,7 +5993,7 @@ dependencies = [ "parity-util-mem-derive", "parking_lot 0.11.1", "sc-client-api", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "thiserror", ] @@ -6046,11 +6040,11 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-rpc", "sp-runtime", - "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-storage", + "sp-tracing", "thiserror", "tracing", "tracing-log", @@ -6085,7 +6079,7 @@ dependencies = [ "retain_mut", "serde", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", "sp-transaction-pool", "sp-utils", @@ -6108,9 +6102,9 @@ dependencies = [ "sc-transaction-graph", "sp-api", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-tracing", "sp-transaction-pool", "sp-utils", "substrate-prometheus-endpoint", @@ -6141,7 +6135,6 @@ dependencies = [ "merlin", "rand 0.7.3", "rand_core 0.5.1", - "serde", "sha2 0.8.2", "subtle 2.4.0", "zeroize", @@ -6500,9 +6493,9 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "log", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-std", + "sp-wasm-interface", "thiserror", ] @@ -6515,10 +6508,10 @@ dependencies = [ "log", "parity-scale-codec", "sp-api-proc-macro", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", "sp-state-machine", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-version", "thiserror", ] @@ -6543,9 +6536,9 @@ dependencies = [ "max-encoded-len", "parity-scale-codec", "serde", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -6557,8 +6550,8 @@ dependencies = [ "num-traits", "parity-scale-codec", "serde", - "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-debug-derive", + "sp-std", "static_assertions", ] @@ -6571,7 +6564,7 @@ dependencies = [ "parity-scale-codec", "sp-inherents", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -6583,7 +6576,7 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -6627,11 +6620,11 @@ dependencies = [ "parking_lot 0.11.1", "serde", "sp-api", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-trie", "sp-utils", "sp-version", @@ -6653,7 +6646,7 @@ dependencies = [ "sp-consensus-slots", "sp-inherents", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-timestamp", ] @@ -6671,11 +6664,11 @@ dependencies = [ "sp-consensus", "sp-consensus-slots", "sp-consensus-vrf", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-keystore", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-timestamp", ] @@ -6696,54 +6689,9 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "schnorrkel", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", -] - -[[package]] -name = "sp-core" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abbc8d4e9b8a7d5819ed26f1374017bb32833ef4890e4ff065e1da30669876bc" -dependencies = [ - "base58", - "blake2-rfc", - "byteorder", - "dyn-clonable", - "ed25519-dalek", - "futures 0.3.15", - "hash-db", - "hash256-std-hasher", - "hex", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin", - "num-traits", - "parity-scale-codec", - "parity-util-mem", - "parking_lot 0.11.1", - "primitive-types", - "rand 0.7.3", - "regex", - "schnorrkel", - "secrecy", - "serde", - "sha2 0.9.5", - "sp-debug-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "tiny-keccak", - "twox-hash", - "wasmi 0.6.2", - "zeroize", + "sp-std", ] [[package]] @@ -6777,17 +6725,17 @@ dependencies = [ "secrecy", "serde", "sha2 0.9.5", - "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", "substrate-bip39", "thiserror", "tiny-bip39", "tiny-keccak", "twox-hash", - "wasmi 0.9.0", + "wasmi", "zeroize", ] @@ -6800,17 +6748,6 @@ dependencies = [ "parking_lot 0.11.1", ] -[[package]] -name = "sp-debug-derive" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e80275f23b4e7ba8f54dec5f90f016530e7307d2ee9445f617ab986cbe97f31e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sp-debug-derive" version = "3.0.0" @@ -6821,18 +6758,6 @@ dependencies = [ "syn", ] -[[package]] -name = "sp-externalities" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fdc625f8c7b13b9a136d334888b21b5743d2081cb666cb03efca1dc9b8f74d1" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sp-externalities" version = "0.9.0" @@ -6840,8 +6765,8 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "environmental", "parity-scale-codec", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", + "sp-storage", ] [[package]] @@ -6855,10 +6780,10 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-keystore", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -6869,9 +6794,9 @@ dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "thiserror", ] @@ -6886,16 +6811,16 @@ dependencies = [ "log", "parity-scale-codec", "parking_lot 0.11.1", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-keystore 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", + "sp-keystore", "sp-maybe-compressed-blob", - "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface", "sp-state-machine", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", + "sp-tracing", "sp-trie", - "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-wasm-interface", "tracing", "tracing-core", ] @@ -6906,29 +6831,11 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "lazy_static", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", "strum", ] -[[package]] -name = "sp-keystore" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6ccd2baf189112355338e8b224dc513cd239b974dbd717f12b3dc7a7248c3b" -dependencies = [ - "async-trait", - "derive_more", - "futures 0.3.15", - "merlin", - "parity-scale-codec", - "parking_lot 0.11.1", - "schnorrkel", - "serde", - "sp-core 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sp-keystore" version = "0.9.0" @@ -6942,8 +6849,8 @@ dependencies = [ "parking_lot 0.11.1", "schnorrkel", "serde", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", ] [[package]] @@ -6961,7 +6868,7 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "sp-api", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", ] @@ -6980,7 +6887,7 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "rustc-hash", "serde", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "tracing-core", ] @@ -7001,27 +6908,9 @@ dependencies = [ "serde", "sp-application-crypto", "sp-arithmetic", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-io", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", -] - -[[package]] -name = "sp-runtime-interface" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e5c88b4bc8d607e4e2ff767a85db58cf7101f3dd6064f06929342ea67fe8fb" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime-interface-proc-macro 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-tracing 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-wasm-interface 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "static_assertions", + "sp-std", ] [[package]] @@ -7032,28 +6921,15 @@ dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-runtime-interface-proc-macro 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-storage 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-tracing 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-wasm-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", "static_assertions", ] -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a6c7c2251512c9e533d15db8a863b06ece1cbee778130dd9adbe44b6b39aa9" -dependencies = [ - "Inflector", - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sp-runtime-interface-proc-macro" version = "3.0.0" @@ -7082,10 +6958,10 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "sp-api", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", "sp-staking", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -7095,7 +6971,7 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "parity-scale-codec", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", ] [[package]] @@ -7110,10 +6986,10 @@ dependencies = [ "parking_lot 0.11.1", "rand 0.7.3", "smallvec 1.6.1", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", "sp-panic-handler", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-trie", "thiserror", "tracing", @@ -7121,31 +6997,11 @@ dependencies = [ "trie-root", ] -[[package]] -name = "sp-std" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35391ea974fa5ee869cb094d5b437688fbf3d8127d64d1b9fed5822a1ed39b12" - [[package]] name = "sp-std" version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" -[[package]] -name = "sp-storage" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86af458d4a0251c490cdde9dcaaccb88d398f3b97ac6694cdd49ed9337e6b961" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sp-storage" version = "3.0.0" @@ -7155,8 +7011,8 @@ dependencies = [ "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-debug-derive", + "sp-std", ] [[package]] @@ -7165,11 +7021,11 @@ version = "3.0.0" source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617#d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617" dependencies = [ "log", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-externalities 0.9.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-externalities", "sp-io", - "sp-runtime-interface 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-runtime-interface", + "sp-std", ] [[package]] @@ -7184,25 +7040,11 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "thiserror", "wasm-timer", ] -[[package]] -name = "sp-tracing" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567382d8d4e14fb572752863b5cd57a78f9e9a6583332b590b726f061f3ea957" -dependencies = [ - "log", - "parity-scale-codec", - "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tracing", - "tracing-core", - "tracing-subscriber", -] - [[package]] name = "sp-tracing" version = "3.0.0" @@ -7215,7 +7057,7 @@ dependencies = [ "serde", "serde_json", "slog", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "tracing", "tracing-core", "tracing-subscriber", @@ -7245,10 +7087,10 @@ dependencies = [ "async-trait", "log", "parity-scale-codec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-inherents", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-trie", ] @@ -7260,8 +7102,8 @@ dependencies = [ "hash-db", "memory-db", "parity-scale-codec", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", + "sp-std", "trie-db", "trie-root", ] @@ -7287,7 +7129,7 @@ dependencies = [ "parity-scale-codec", "serde", "sp-runtime", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-std", "sp-version-proc-macro", ] @@ -7303,18 +7145,6 @@ dependencies = [ "syn", ] -[[package]] -name = "sp-wasm-interface" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b214e125666a6416cf30a70cc6a5dacd34a4e5197f8a3d479f714af7e1dc7a47" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "sp-std 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.6.2", -] - [[package]] name = "sp-wasm-interface" version = "3.0.0" @@ -7322,8 +7152,8 @@ source = "git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sp-std 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", - "wasmi 0.9.0", + "sp-std", + "wasmi", ] [[package]] @@ -7466,7 +7296,7 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core 3.0.0 (git+https://github.com/paritytech/substrate.git?rev=d6c33e7ec313f9bd5e319dc0a5a3ace5543f9617)", + "sp-core", "sp-runtime", "sp-transaction-pool", ] @@ -8437,20 +8267,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wasmi" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" -dependencies = [ - "libc", - "memory_units", - "num-rational 0.2.4", - "num-traits", - "parity-wasm 0.41.0", - "wasmi-validation 0.3.0", -] - [[package]] name = "wasmi" version = "0.9.0" @@ -8463,16 +8279,7 @@ dependencies = [ "num-rational 0.2.4", "num-traits", "parity-wasm 0.42.2", - "wasmi-validation 0.4.0", -] - -[[package]] -name = "wasmi-validation" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" -dependencies = [ - "parity-wasm 0.41.0", + "wasmi-validation", ] [[package]] diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000000..0bd382a2fb0 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,30 @@ +FROM paritytech/ci-linux:production as builder +LABEL description="This is the build stage for Composable. Here we create the binary." + +ARG PROFILE=release +WORKDIR /composable + +COPY . /composable + +RUN pwd && ls && cd node && cargo build --$PROFILE + +# ===== SECOND STAGE ====== + +FROM debian:buster-slim +LABEL description="This is the 2nd stage: a very small image where we copy the Composable binary." +ARG PROFILE=release +COPY --from=builder /composable/target/$PROFILE/node-template /usr/local/bin + +RUN useradd -m -u 1000 -U -s /bin/sh -d /composable composable && \ + mkdir -p /composable/.local/share && \ + mkdir /data && \ + chown -R composable:composable /data && \ + chown -R composable:composable /composable/.local/share/local_testnet && \ + ln -s /data /composable/.local/share/local_testnet && \ + rm -rf /usr/bin /usr/sbin + +USER composable +EXPOSE 30333 9933 9944 +VOLUME ["/data"] + +CMD ["/usr/local/bin/node_template"] diff --git a/docker/build.sh b/docker/build.sh new file mode 100644 index 00000000000..998eee2df9b --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +#set -e + +pushd . + +# The following line ensure we run from the project root +PROJECT_ROOT=`git rev-parse --show-toplevel` +cd $PROJECT_ROOT + +# Find the current version from Cargo.toml +VERSION=`grep "^version" ./Cargo.toml | egrep -o "([0-9\.]+)"` +# REPLACE WITH USER / REPO +GITUSER=composablefi +GITREPO=composable + +# Build the image +echo "Building ${GITUSER}/${GITREPO}:latest docker image, hang on!" +time docker build -f ./docker/Dockerfile --build-arg RUSTC_WRAPPER= --build-arg PROFILE=release -t ${GITUSER}/${GITREPO}:latest . + +# Show the list of available images for this repo +echo "Image is ready" +docker images | grep ${GITREPO} + +echo -e "\nIf you just built version ${VERSION}, you may want to update your tag:" +echo " $ docker tag ${GITUSER}/${GITREPO}:$VERSION ${GITUSER}/${GITREPO}:${VERSION}" + +popd diff --git a/node/Cargo.toml b/node/Cargo.toml index 9f97349239e..f0063348c31 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -21,7 +21,11 @@ targets = ['x86_64-unknown-linux-gnu'] [dependencies] jsonrpc-core = '15.1.0' structopt = '0.3.8' -sp-keystore = '0.9' + +[dependencies.sp-keystore] +git = 'https://github.com/paritytech/substrate.git' +rev = 'd6c33e7ec313f9bd5e319dc0a5a3ace5543f9617' +version = '0.9' [dependencies.frame-benchmarking] git = 'https://github.com/paritytech/substrate.git' diff --git a/setup/index.js b/setup/index.js new file mode 100644 index 00000000000..9195980a72b --- /dev/null +++ b/setup/index.js @@ -0,0 +1,227 @@ +const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api"); +const chalk = require("chalk"); + +const keyring = new Keyring({ type: "sr25519" }); + +const nodes = [ + { + name: "Alice", + address: "5F6h9fXgSjPdmZDZQSsFyKUL1sPbuzTRn3TwbhGuSvPecB7d", + publicKey: + "0x8638cfb3584d75b38a0c10ed14fd5db134fa1764679b80c4f7a80a9c06895244", + derivation: + "van theme secret toddler rapid skirt pigeon hedgehog exhibit address guilt motor", + endpoint: "ws://172.28.1.1:9944", + initialized: false, + }, + { + name: "Bob", + address: "5Gc2R35GvWAJ2uSHcLUceJudMJftbVp6Y788xzRpv8qy86sD", + publicKey: + "0xc8d4036beca0c173a594419cf664e3812128a1aed5fc06880a090b20607ec73e", + derivation: + "prevent mushroom elevator thumb stable unfair alcohol find leg fly couple deny", + endpoint: "ws://172.28.1.2:9945", + initialized: false, + }, + { + name: "Charlie", + address: "5H1payfDS728ksrRi9D88RPQmyQFsZVdEFHYM4BKEiwfVJY9", + publicKey: + "0xdafa159e6e763f0183255ffbeab9de0ea617bc924273555cdd605c1362129177", + derivation: + "panda party toe child advance lawsuit meadow burden access below brown lift", + endpoint: "ws://172.28.1.3:9946", + initialized: false, + }, + { + name: "Dave", + address: "5FkQP1FCvGVRX9QXu4oyxW9EjroC8eaTbJ8GLRbbQXv7AZfj", + publicKey: + "0xa2fbaf101f96828932535d5dcc59c84dbb15657ee53403a70fc451faadad183b", + derivation: + "physical glance describe mandate consider cricket detail excuse steak artwork broccoli diesel", + endpoint: "ws://172.28.1.4:9947", + initialized: false, + }, + { + name: "Eve", + address: "5CXru9Vt1fPCnwyxqqcXwyvB6ibybjkAWBwzqaRgH5MV66Ax", + publicKey: + "0x14b6110477c9aa1851a005b9b030f72f3ebd1378af1f245048a3ae7d491c152b", + derivation: + "cruel join arch wrap stereo cement roast frame fog drill mandate loyal", + endpoint: "ws://172.28.1.5:9948", + initialized: false, + }, +]; + +// Inserts Keys +const insertKeys = async (api, seed, publicKey) => { + const insert = await api.rpc.author.insertKey("orac", seed, publicKey); + console.log( + chalk.bgBlack(chalk.red(" Insert Keys ")) + + chalk.red(` ${publicKey}`) + + chalk.green(" Successful") + ); +}; + +// Bonds the controller account +const bond = async (api, address, keyring) => { + const bondTx = api.tx.oracle.setSigner(address); + try { + await bondTx.signAndSend(keyring); + console.log( + chalk.bgBlack(chalk.red(" Bond ")) + + chalk.red(` ${address}`) + + chalk.green(" Successful") + ); + } catch { + console.log(chalk.bgGreen("Bond") + "tx failed..."); + } + await sleep(6000); +}; + +// Adds Stake to Node +const stake = async (api, amount, keyring) => { + const stakeTx = api.tx.oracle.addStake(amount); + try { + await stakeTx.signAndSend(keyring); + console.log( + chalk.bgBlack(chalk.red(" Stake ")) + + chalk.red(` ${amount}`) + + chalk.green(" Successful") + ); + } catch { + console.log(chalk.bgGreen("Stake") + "tx failed..."); + } + await sleep(6000); +}; + +// Sets price feed URL +const setURL = async (api) => { + const url = "http://172.28.1.13:3001/price/"; + const key = "0x6f63772d75726c"; + const value = + "0x687474703a2f2f3137322e32382e312e31333a333030312f70726963652f"; + await api.rpc.offchain.localStorageSet("PERSISTENT", key, value); + console.log( + chalk.bgBlack(chalk.red(" Set Feed ")) + + chalk.red(` ${url}`) + + chalk.green(" Successful") + ); +}; + +// Sends funds to the given account +const sendBalance = async (api, destinationAddress, amount) => { + const tx = await api.tx.balances.transfer(destinationAddress, amount); + try { + await tx.signAndSend(keyring.addFromUri("//Alice")); + console.log( + chalk.bgBlack(chalk.red(" Transfer ")) + + chalk.red(` ${destinationAddress}`) + + chalk.green(" Successful") + ); + } catch { + console.log(chalk.bgGreen("Transfer") + "transfer tx failed..."); + } + await sleep(6000); +}; + +// Connects to a provider endpoint and return returns the api provider instance with the unique chain types injected +const connect = async (endpoint) => { + const wsProvider = new WsProvider(endpoint); + const api = await ApiPromise.create({ + provider: wsProvider, + types: { + AssetTypes: "u128", + AssetCount: "u64", + AssetInfo: { + threshold: "Percent", + min_answers: "u64", + max_answers: "u64", + }, + AccountInfo: "AccountInfoWithDualRefCount", + Settlements: "Vec", + Withdraw: { + stake: "Balance", + unlock_block: "BlockNumber", + }, + PrePrice: { + price: "u64", + block: "BlockNumber", + who: "AccountId", + }, + Price: { + price: "u64", + block: "BlockNumber", + }, + Settlement: { + who: "AccountId", + truthful: "bool", + }, + }, + }); + return api; +}; + +// Registers an asset ID with a threshold from `sudo` origin +const addAsset = async (api) => { + const asset = 0; + const threshold = 10; + const minAnswers = 3; + const maxAnswers = 5; + const tx = api.tx.oracle.addAssetAndInfo( + asset, + threshold, + minAnswers, + maxAnswers + ); + const su = api.tx.sudo.sudo(tx); + await su.signAndSend(keyring.addFromUri("//Alice")); + console.log( + chalk.bgBlack(chalk.red(" Register Asset ")) + + chalk.red(` ID: ${asset} `) + + "with threshold" + + chalk.red(` ${threshold}% `) + + chalk.green(" Successful") + ); +}; + +const main = async () => { + console.log(chalk.bgBlack(chalk.blue(" Starting Setup "))); + + for (const node of nodes) { + console.log( + chalk.bgBlack(chalk.blue(" Initializing ")) + + chalk.bgBlack(chalk.red(`${node.name} `)) + ); + console.log( + chalk.bgBlack(chalk.blue(" Connecting to ")) + + chalk.bgBlack(chalk.red(`${node.endpoint} `)) + ); + const api = await connect(node.endpoint); + const key = keyring.addFromUri(node.derivation); + await sendBalance(api, node.address, 1234567891234); + await bond(api, node.address, key); + await stake(api, "10000000", key); + await insertKeys(api, node.derivation, node.publicKey); + await setURL(api); + await api.disconnect(); + console.log( + chalk.bgBlack(chalk.blue(" Disconnecting ")) + + chalk.bgBlack(chalk.red(`${node.endpoint} `)) + ); + } + + const api = await connect(nodes[0].endpoint); + await addAsset(api); + await api.disconnect(); +}; + +const sleep = (ms) => + new Promise((resolve) => { + setTimeout(() => resolve(), ms); + }); + +main(); diff --git a/setup/package.json b/setup/package.json new file mode 100644 index 00000000000..c87c8ee2eca --- /dev/null +++ b/setup/package.json @@ -0,0 +1,15 @@ +{ + "name": "setup", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@polkadot/api": "^4.16.2", + "chalk": "^4.1.1" + } +} diff --git a/setup/priceFeed.js b/setup/priceFeed.js new file mode 100644 index 00000000000..a0c9b43d03c --- /dev/null +++ b/setup/priceFeed.js @@ -0,0 +1,54 @@ +const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api"); +const chalk = require("chalk"); + +// Connects to a provider endpoint and return returns the api provider instance with the unique chain types injected +const connect = async (endpoint) => { + const wsProvider = new WsProvider(endpoint); + const api = await ApiPromise.create({ + provider: wsProvider, + types: { + AssetTypes: "u128", + AssetCount: "u64", + AssetInfo: { + threshold: "Percent", + min_answers: "u64", + max_answers: "u64", + }, + AccountInfo: "AccountInfoWithDualRefCount", + Settlements: "Vec", + Withdraw: { + stake: "Balance", + unlock_block: "BlockNumber", + }, + PrePrice: { + price: "u64", + block: "BlockNumber", + who: "AccountId", + }, + Price: { + price: "u64", + block: "BlockNumber", + }, + Settlement: { + who: "AccountId", + truthful: "bool", + }, + }, + }); + return api; +}; + +const main = async () => { + const api = await connect("ws://172.28.1.1:9944"); + + const unsub = api.query.oracle.prices(0, ({ price, block }) => { + console.log( + chalk.bgBlack(chalk.green(`Asset ID: 0 Price:`)) + + chalk.green(` $${price / 100} `) + + `at block #` + + chalk.red(`${block}`) + ); + }); +}; + +main(); diff --git a/setup/requestPrice.js b/setup/requestPrice.js new file mode 100644 index 00000000000..260ec00a94a --- /dev/null +++ b/setup/requestPrice.js @@ -0,0 +1,74 @@ +const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api"); +const chalk = require("chalk"); + +const keyring = new Keyring({ type: "sr25519" }); + +// Connects to a provider endpoint and return returns the api provider instance with the unique chain types injected +const connect = async (endpoint) => { + const wsProvider = new WsProvider(endpoint); + const api = await ApiPromise.create({ + provider: wsProvider, + types: { + AssetTypes: "u128", + AssetCount: "u64", + AssetInfo: { + threshold: "Percent", + min_answers: "u64", + max_answers: "u64", + }, + AccountInfo: "AccountInfoWithDualRefCount", + Settlements: "Vec", + Withdraw: { + stake: "Balance", + unlock_block: "BlockNumber", + }, + PrePrice: { + price: "u64", + block: "BlockNumber", + who: "AccountId", + }, + Price: { + price: "u64", + block: "BlockNumber", + }, + Settlement: { + who: "AccountId", + truthful: "bool", + }, + }, + }); + return api; +}; + +const sleep = (ms) => + new Promise((resolve) => { + setTimeout(() => resolve(), ms); + }); + +const requestPrice = async (api) => { + const asset = 0; + const tx = await api.tx.oracle.requestPrice(asset); + await tx.signAndSend(keyring.addFromUri("//Alice")); +}; + +const main = async () => { + const api = await connect("ws://172.28.1.5:9948"); + const rounds = 10; + for (let i = 1; i <= rounds; i++) { + console.log(chalk.bgBlack(chalk.red(` ${i} `))); + await requestPrice(api); + console.log( + chalk.bgBlack(chalk.red(" Request Price ")) + + chalk.red(` Asset ID: ${0}`) + + chalk.green(" Successful") + ); + await sleep(6000); + } + console.log(chalk.bgBlack(chalk.red(` DONE `))); + await api.disconnect(); + console.log( + chalk.bgBlack(chalk.red(` Disconnecting ws://172.28.1.5:9948 `)) + ); +}; + +main(); diff --git a/setup/yarn.lock b/setup/yarn.lock new file mode 100644 index 00000000000..75d9bd7a4df --- /dev/null +++ b/setup/yarn.lock @@ -0,0 +1,667 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/runtime@^7.14.6": + version "7.14.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.6.tgz#535203bc0892efc7dec60bdc27b2ecf6e409062d" + integrity sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg== + dependencies: + regenerator-runtime "^0.13.4" + +"@polkadot/api-derive@4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-4.17.1.tgz#7902ab73159f89a4f1a896ce856dd7377318d275" + integrity sha512-mgq57F1yAiZjuiA0vrR2zWidyyd+mGe7Kbs4SxVeDWLsNbLc9+eASIfX7Hch2SDHIn3CQpv6DQqJH00uDfw9Lw== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/api" "4.17.1" + "@polkadot/rpc-core" "4.17.1" + "@polkadot/types" "4.17.1" + "@polkadot/util" "^6.11.1" + "@polkadot/util-crypto" "^6.11.1" + "@polkadot/x-rxjs" "^6.11.1" + +"@polkadot/api@4.17.1", "@polkadot/api@^4.16.2": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-4.17.1.tgz#c9c8e7f5e33122aeb5b1345e43bc9579658720db" + integrity sha512-uuNIKWC+PjM+1AARRu4NLWOEudZE6DW8UOlaubx3uGhPywqPIP+HGWP2I6PqRGYKARBWxxOvca1Q7WoKzpYC8w== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/api-derive" "4.17.1" + "@polkadot/keyring" "^6.11.1" + "@polkadot/metadata" "4.17.1" + "@polkadot/rpc-core" "4.17.1" + "@polkadot/rpc-provider" "4.17.1" + "@polkadot/types" "4.17.1" + "@polkadot/types-known" "4.17.1" + "@polkadot/util" "^6.11.1" + "@polkadot/util-crypto" "^6.11.1" + "@polkadot/x-rxjs" "^6.11.1" + eventemitter3 "^4.0.7" + +"@polkadot/keyring@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-6.11.1.tgz#2510c349c965c74cc2f108f114f1048856940604" + integrity sha512-rW8INl7pO6Dmaffd6Df1yAYCRWa2RmWQ0LGfJeA/M6seVIkI6J3opZqAd4q2Op+h9a7z4TESQGk8yggOEL+Csg== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/util" "6.11.1" + "@polkadot/util-crypto" "6.11.1" + +"@polkadot/metadata@4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-4.17.1.tgz#4da9ee5b2b816493910abfd302a50b58141ceca2" + integrity sha512-219isiCWVfbu5JxZnOPj+cV4T+S0XHS4+Jal3t3xz9y4nbgr+25Pa4KInEsJPx0u8EZAxMeiUCX3vd5U7oe72g== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/types" "4.17.1" + "@polkadot/types-known" "4.17.1" + "@polkadot/util" "^6.11.1" + "@polkadot/util-crypto" "^6.11.1" + +"@polkadot/networks@6.11.1", "@polkadot/networks@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-6.11.1.tgz#8fd189593f6ee4f8bf64378d0aaae09e39a37d35" + integrity sha512-0C6Ha2kvr42se3Gevx6UhHzv3KnPHML0N73Amjwvdr4y0HLZ1Nfw+vcm5yqpz5gpiehqz97XqFrsPRauYdcksQ== + dependencies: + "@babel/runtime" "^7.14.6" + +"@polkadot/rpc-core@4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-4.17.1.tgz#b9fa739fa98e4355fdc2b8d2b43b3a4b9d32dac4" + integrity sha512-1gqYaYuSSQsRmt3ol55jmjBP/euKyAh4PwSj94I2wu0fngK/FZwVZNDJZn/Ib68X/s38TBIgqJ6+YdUdr3z1xw== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/metadata" "4.17.1" + "@polkadot/rpc-provider" "4.17.1" + "@polkadot/types" "4.17.1" + "@polkadot/util" "^6.11.1" + "@polkadot/x-rxjs" "^6.11.1" + +"@polkadot/rpc-provider@4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-4.17.1.tgz#1f99b8365d0f76f714f613423e6a1832b5d833b3" + integrity sha512-vlU1H5mnfP0Ej8PbjcxwF9ZlT7LtcpekOKI4iYfMnfdelSUKUVyaD5PC8yRGIg9fxkorA6OM5AZs116jAl3TLA== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/types" "4.17.1" + "@polkadot/util" "^6.11.1" + "@polkadot/util-crypto" "^6.11.1" + "@polkadot/x-fetch" "^6.11.1" + "@polkadot/x-global" "^6.11.1" + "@polkadot/x-ws" "^6.11.1" + eventemitter3 "^4.0.7" + +"@polkadot/types-known@4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-4.17.1.tgz#71c18dda4967a13ec34fbbf0c4ef264e882c2688" + integrity sha512-YkOwGrO+k9aVrBR8FgYHnfJKhOfpdgC5ZRYNL/xJ9oa7lBYqPts9ENAxeBmJS/5IGeDF9f32MNyrCP2umeCXWg== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/networks" "^6.11.1" + "@polkadot/types" "4.17.1" + "@polkadot/util" "^6.11.1" + +"@polkadot/types@4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-4.17.1.tgz#41d43621d53820ee930ba4036bfa8b16cf98ca6f" + integrity sha512-rjW4OFdwvFekzN3ATLibC2JPSd8AWt5YepJhmuCPdwH26r3zB8bEC6dM7YQExLVUmygVPvgXk5ffHI6RAdXBMg== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/metadata" "4.17.1" + "@polkadot/util" "^6.11.1" + "@polkadot/util-crypto" "^6.11.1" + "@polkadot/x-rxjs" "^6.11.1" + +"@polkadot/util-crypto@6.11.1", "@polkadot/util-crypto@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-6.11.1.tgz#7a36acf5c8bf52541609ec0b0b2a69af295d652e" + integrity sha512-fWA1Nz17FxWJslweZS4l0Uo30WXb5mYV1KEACVzM+BSZAvG5eoiOAYX6VYZjyw6/7u53XKrWQlD83iPsg3KvZw== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/networks" "6.11.1" + "@polkadot/util" "6.11.1" + "@polkadot/wasm-crypto" "^4.0.2" + "@polkadot/x-randomvalues" "6.11.1" + base-x "^3.0.8" + base64-js "^1.5.1" + blakejs "^1.1.1" + bn.js "^4.11.9" + create-hash "^1.2.0" + elliptic "^6.5.4" + hash.js "^1.1.7" + js-sha3 "^0.8.0" + scryptsy "^2.1.0" + tweetnacl "^1.0.3" + xxhashjs "^0.2.2" + +"@polkadot/util@6.11.1", "@polkadot/util@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-6.11.1.tgz#8950b038ba3e6ebfc0a7ff47feeb972e81b2626c" + integrity sha512-TEdCetr9rsdUfJZqQgX/vxLuV4XU8KMoKBMJdx+JuQ5EWemIdQkEtMBdL8k8udNGbgSNiYFA6rPppATeIxAScg== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/x-textdecoder" "6.11.1" + "@polkadot/x-textencoder" "6.11.1" + "@types/bn.js" "^4.11.6" + bn.js "^4.11.9" + camelcase "^5.3.1" + ip-regex "^4.3.0" + +"@polkadot/wasm-crypto-asmjs@^4.1.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-4.1.2.tgz#094b3eeeb5fd39a93db177583b48454511874cfc" + integrity sha512-3Q+vVUxDAC2tXgKMM3lKzx2JW+tarDpTjkvdxIKATyi8Ek69KkUqvMyJD0VL/iFZOFZED0YDX9UU4XOJ/astlg== + dependencies: + "@babel/runtime" "^7.14.6" + +"@polkadot/wasm-crypto-wasm@^4.1.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-4.1.2.tgz#773c78c1d65886671d3ba1d66c31afd86c93d02f" + integrity sha512-/l4IBEdQ41szHdHkuF//z1qr+XmWuLHlpBA7s9Eb221m1Fir6AKoCHoh1hp1r3v0ecZYLKvak1B225w6JAU3Fg== + dependencies: + "@babel/runtime" "^7.14.6" + +"@polkadot/wasm-crypto@^4.0.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-4.1.2.tgz#dead71ae5d2f7722d23aed5be2112e1732d315e9" + integrity sha512-2EKdOjIrD2xHP2rC+0G/3Qo6926nL/18vCFkd34lBd9zP9YNF2GDEtDY+zAeDIRFKe1sQHTpsKgNdYSWoV2eBg== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/wasm-crypto-asmjs" "^4.1.2" + "@polkadot/wasm-crypto-wasm" "^4.1.2" + +"@polkadot/x-fetch@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-6.11.1.tgz#97d44d78ef0285eec6f6dbc4006302308ec8e24c" + integrity sha512-qJyLLnm+4SQEZ002UDz2wWnXbnnH84rIS0mLKZ5k82H4lMYY+PQflvzv6sbu463e/lgiEao+6zvWS6DSKv1Yog== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/x-global" "6.11.1" + "@types/node-fetch" "^2.5.10" + node-fetch "^2.6.1" + +"@polkadot/x-global@6.11.1", "@polkadot/x-global@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-6.11.1.tgz#c292b3825fea60e9b33fff1790323fc57de1ca5d" + integrity sha512-lsBK/e4KbjfieyRmnPs7bTiGbP/6EoCZz7rqD/voNS5qsJAaXgB9LR+ilubun9gK/TDpebyxgO+J19OBiQPIRw== + dependencies: + "@babel/runtime" "^7.14.6" + +"@polkadot/x-randomvalues@6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-6.11.1.tgz#f006fa250c8e82c92ccb769976a45a8e7f3df28b" + integrity sha512-2MfUfGZSOkuPt7GF5OJkPDbl4yORI64SUuKM25EGrJ22o1UyoBnPOClm9eYujLMD6BfDZRM/7bQqqoLW+NuHVw== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/x-global" "6.11.1" + +"@polkadot/x-rxjs@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-rxjs/-/x-rxjs-6.11.1.tgz#5454708b61da70eea05708611d9148fce9372498" + integrity sha512-zIciEmij7SUuXXg9g/683Irx6GogxivrQS2pgBir2DI/YZq+um52+Dqg1mqsEZt74N4KMTMnzAZAP6LJOBOMww== + dependencies: + "@babel/runtime" "^7.14.6" + rxjs "^6.6.7" + +"@polkadot/x-textdecoder@6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-6.11.1.tgz#6cc314645681cc4639085c03b65328671c7f182c" + integrity sha512-DI1Ym2lyDSS/UhnTT2e9WutukevFZ0WGpzj4eotuG2BTHN3e21uYtYTt24SlyRNMrWJf5+TkZItmZeqs1nwAfQ== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/x-global" "6.11.1" + +"@polkadot/x-textencoder@6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-6.11.1.tgz#73e89da5b91954ae380042c19314c90472f59d9e" + integrity sha512-8ipjWdEuqFo+R4Nxsc3/WW9CSEiprX4XU91a37ZyRVC4e9R1bmvClrpXmRQLVcAQyhRvG8DKOOtWbz8xM+oXKg== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/x-global" "6.11.1" + +"@polkadot/x-ws@^6.11.1": + version "6.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-6.11.1.tgz#338adc7309e3a8e660fce8eb42f975426da48d10" + integrity sha512-GNu4ywrMlVi0QF6QSpKwYWMK6JRK+kadgN/zEhMoH1z5h8LwpqDLv128j5WspWbQti2teCQtridjf7t2Lzoe8Q== + dependencies: + "@babel/runtime" "^7.14.6" + "@polkadot/x-global" "6.11.1" + "@types/websocket" "^1.0.3" + websocket "^1.0.34" + +"@types/bn.js@^4.11.6": + version "4.11.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" + integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== + dependencies: + "@types/node" "*" + +"@types/node-fetch@^2.5.10": + version "2.5.11" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.11.tgz#ce22a2e65fc8999f4dbdb7ddbbcf187d755169e4" + integrity sha512-2upCKaqVZETDRb8A2VTaRymqFBEgH8u6yr96b/u3+1uQEPDRo3mJLEiPk7vdXBHRtjwkjqzFYMJXrt0Z9QsYjQ== + dependencies: + "@types/node" "*" + form-data "^3.0.0" + +"@types/node@*": + version "16.3.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.3.1.tgz#24691fa2b0c3ec8c0d34bfcfd495edac5593ebb4" + integrity sha512-N87VuQi7HEeRJkhzovao/JviiqKjDKMVKxKMfUvSKw+MbkbW8R0nA3fi/MQhhlxV2fQ+2ReM+/Nt4efdrJx3zA== + +"@types/websocket@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.3.tgz#49e09f939afd0ccdee4f7108d4712ec9feb0f153" + integrity sha512-ZdoTSwmDsKR7l1I8fpfQtmTI/hUwlOvE3q0iyJsp4tXU0MkdrYowimDzwxjhQvxU4qjhHLd3a6ig0OXRbLgIdw== + dependencies: + "@types/node" "*" + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +base-x@^3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d" + integrity sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +blakejs@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.1.tgz#bf313053978b2cd4c444a48795710be05c785702" + integrity sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg== + +bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + +bufferutil@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.3.tgz#66724b756bed23cd7c28c4d306d7994f9943cc6b" + integrity sha512-yEYTwGndELGvfXsImMBLop58eaGW+YdONi1fNjTINSY98tmMmFijBG6WXgdkfuLNt4imzQNtIE+eBp1PVpMCSw== + dependencies: + node-gyp-build "^4.2.0" + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +chalk@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" + integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +cipher-base@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +cuint@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" + integrity sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs= + +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + +debug@^2.2.0: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +elliptic@^6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + +es5-ext@^0.10.35, es5-ext@^0.10.50: + version "0.10.53" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== + dependencies: + es6-iterator "~2.0.3" + es6-symbol "~3.1.3" + next-tick "~1.0.0" + +es6-iterator@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-symbol@^3.1.1, es6-symbol@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +eventemitter3@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== + +ext@^1.1.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" + integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== + dependencies: + type "^2.0.0" + +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ip-regex@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" + integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== + +is-typedarray@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +js-sha3@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +mime-db@1.48.0: + version "1.48.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d" + integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ== + +mime-types@^2.1.12: + version "2.1.31" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.31.tgz#a00d76b74317c61f9c2db2218b8e9f8e9c5c9e6b" + integrity sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg== + dependencies: + mime-db "1.48.0" + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +next-tick@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= + +node-fetch@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + +node-gyp-build@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.2.3.tgz#ce6277f853835f718829efb47db20f3e4d9c4739" + integrity sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg== + +readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +regenerator-runtime@^0.13.4: + version "0.13.7" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" + integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== + +ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rxjs@^6.6.7: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +scryptsy@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/scryptsy/-/scryptsy-2.1.0.tgz#8d1e8d0c025b58fdd25b6fa9a0dc905ee8faa790" + integrity sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w== + +sha.js@^2.4.0: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +tslib@^1.9.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tweetnacl@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.0.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d" + integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw== + +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +utf-8-validate@^5.0.2: + version "5.0.5" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.5.tgz#dd32c2e82c72002dc9f02eb67ba6761f43456ca1" + integrity sha512-+pnxRYsS/axEpkrrEpzYfNZGXp0IjC/9RIxwM5gntY4Koi8SHmUGSfxfWqxZdRxrtaoVstuOzUp/rbs3JSPELQ== + dependencies: + node-gyp-build "^4.2.0" + +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +websocket@^1.0.34: + version "1.0.34" + resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" + integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== + dependencies: + bufferutil "^4.0.1" + debug "^2.2.0" + es5-ext "^0.10.50" + typedarray-to-buffer "^3.1.5" + utf-8-validate "^5.0.2" + yaeti "^0.0.6" + +xxhashjs@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/xxhashjs/-/xxhashjs-0.2.2.tgz#8a6251567621a1c46a5ae204da0249c7f8caa9d8" + integrity sha512-AkTuIuVTET12tpsVIQo+ZU6f/qDmKuRUcjaqR+OIvm+aCBsZ95i7UVY5WJ9TMsSaZ0DA2WxoZ4acu0sPH+OKAw== + dependencies: + cuint "^0.2.2" + +yaeti@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= From e42b22dc798969d41f12bca8d424e5093f3f8993 Mon Sep 17 00:00:00 2001 From: scruffy-dev Date: Mon, 12 Jul 2021 18:57:39 +0200 Subject: [PATCH 3/6] docker compose file --- docker/docker-compose.yml | 135 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 docker/docker-compose.yml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000000..05aa74d8318 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,135 @@ +version: '3' +services: + node_alice: + image: composablefi/composable + ports: + - "30333:30333" + - "9944:9944" + volumes: + - "polkadot-data-alice:/alice" + command: node-template --telemetry-url 'ws://172.28.1.10:8000/submit 0' --validator --unsafe-ws-external --rpc-methods Unsafe --unsafe-rpc-external --ws-port 9944 --rpc-cors all --pruning archive --alice --node-key aa788920201122290fc7d3faf00698d9a8e061d7173424da2a31a8130a882a5f + depends_on: + - telemetry-backend + networks: + testing_net: + ipv4_address: 172.28.1.1 + + node_bob: + image: composablefi/composable + ports: + - "30334:30334" + - "9945:9945" + volumes: + - "polkadot-data-bob:/bob" + command: node-template --telemetry-url 'ws://172.28.1.10:8000/submit 0' --validator --unsafe-ws-external --rpc-methods Unsafe --unsafe-rpc-external --rpc-cors all --ws-port 9945 --pruning archive --bob --bootnodes /ip4/172.28.1.1/tcp/30333/p2p/12D3KooWCJC43YRmb5WJcJmskPSxbkWY4Vp6jPKdFeggnXPxgBCw --port 30334 + depends_on: + - telemetry-backend + networks: + testing_net: + ipv4_address: 172.28.1.2 + + node_charlie: + image: composablefi/composable + ports: + - "30335:30335" + - "9946:9946" + volumes: + - "polkadot-data-charlie:/charlie" + command: node-template --telemetry-url 'ws://172.28.1.10:8000/submit 0' --validator --unsafe-ws-external --rpc-methods Unsafe --unsafe-rpc-external --rpc-cors all --ws-port 9946 --pruning archive --charlie --bootnodes /ip4/172.28.1.1/tcp/30333/p2p/12D3KooWCJC43YRmb5WJcJmskPSxbkWY4Vp6jPKdFeggnXPxgBCw --port 30335 + depends_on: + - telemetry-backend + networks: + testing_net: + ipv4_address: 172.28.1.3 + + node_dave: + image: composablefi/composable + ports: + - "30336:30336" + - "9947:9947" + volumes: + - "polkadot-data-dave:/dave" + command: node-template --telemetry-url 'ws://172.28.1.10:8000/submit 0' --validator --unsafe-ws-external --rpc-methods Unsafe --unsafe-rpc-external --rpc-cors all --ws-port 9947 --pruning archive --dave --bootnodes /ip4/172.28.1.1/tcp/30333/p2p/12D3KooWCJC43YRmb5WJcJmskPSxbkWY4Vp6jPKdFeggnXPxgBCw --port 30336 + depends_on: + - telemetry-backend + networks: + testing_net: + ipv4_address: 172.28.1.4 + + node_eve: + image: composablefi/composable + ports: + - "30337:30337" + - "9948:9948" + volumes: + - "polkadot-data-eve:/eve" + command: node-template --telemetry-url 'ws://172.28.1.10:8000/submit 0' --validator --unsafe-ws-external --rpc-methods Unsafe --unsafe-rpc-external --rpc-cors all --ws-port 9948 --pruning archive --eve --bootnodes /ip4/172.28.1.1/tcp/30333/p2p/12D3KooWCJC43YRmb5WJcJmskPSxbkWY4Vp6jPKdFeggnXPxgBCw --port 30337 + depends_on: + - telemetry-backend + networks: + testing_net: + ipv4_address: 172.28.1.5 + + node_ferdie: + image: composablefi/composable + ports: + - "30338:30338" + - "9949:9949" + volumes: + - "polkadot-data-ferdie:/ferdie" + command: node-template --telemetry-url 'ws://172.28.1.10:8000/submit 0' --validator --unsafe-ws-external --rpc-methods Unsafe --unsafe-rpc-external --rpc-cors all --ws-port 9949 --pruning archive --ferdie --bootnodes /ip4/172.28.1.1/tcp/30333/p2p/12D3KooWCJC43YRmb5WJcJmskPSxbkWY4Vp6jPKdFeggnXPxgBCw --port 30338 + depends_on: + - telemetry-backend + networks: + testing_net: + ipv4_address: 172.28.1.6 + + telemetry-backend: + image: parity/substrate-telemetry-backend + environment: + - PORT=8000 + ports: + - 8000:8000 + expose: + - 8000 + command: --listen 0.0.0.0:8000 + networks: + testing_net: + ipv4_address: 172.28.1.10 + + telemetry-frontend: + image: parity/substrate-telemetry-frontend + ports: + - 3000:80 + environment: + - SUBSTRATE_TELEMETRY_URL=ws://172.28.1.10:8000/feed + networks: + testing_net: + ipv4_address: 172.28.1.11 + + oracle: + build: + context: ./oracle + dockerfile: Dockerfile + volumes: + - ./oracle:/app + ports: + - "3001:3001" + networks: + testing_net: + ipv4_address: 172.28.1.13 + +volumes: + polkadot-data-alice: + polkadot-data-bob: + polkadot-data-charlie: + polkadot-data-dave: + polkadot-data-eve: + polkadot-data-ferdie: + +networks: + testing_net: + ipam: + driver: default + config: + - subnet: 172.28.0.0/16 From a7c97b209bf6aff08a78a0c35ec0ef7be56bbd68 Mon Sep 17 00:00:00 2001 From: scruffy-dev Date: Tue, 13 Jul 2021 10:08:10 +0200 Subject: [PATCH 4/6] panic tests --- pallets/oracle/README.md | 17 ++-- pallets/oracle/src/tests.rs | 187 ++++++++++++++++++------------------ 2 files changed, 104 insertions(+), 100 deletions(-) diff --git a/pallets/oracle/README.md b/pallets/oracle/README.md index a0b20b380c8..41be57d26e5 100644 --- a/pallets/oracle/README.md +++ b/pallets/oracle/README.md @@ -1,14 +1,15 @@ -TODO +TODO -- [x] Set up granularity on threshold -- [] better setup and key rotation -- [x] local storage to pull for url -- [x] add events +- [x] Set up granularity on threshold +- [] better setup and key rotation +- [x] local storage to pull for url +- [x] add events - [x] general cleanup - [x] In line TODOs (done for first handoff) Can Be after handoff -- [] Send back and check request and price id from runtime +- [] Send back and check request and price id from runtime - [] better asset count handling (hold actives in vec so you can turn them on and off) - actually idk I think the way we have it is better idk -- [] decide signed unsigned or free add price tx -- [] test events (can be done in benchmarks) \ No newline at end of file +- [] decide signed unsigned or free add price tx +- [] test events (can be done in benchmarks) +- [] Better testing of offchain worker with local storage get diff --git a/pallets/oracle/src/tests.rs b/pallets/oracle/src/tests.rs index d0b7606cd3b..c195371d482 100644 --- a/pallets/oracle/src/tests.rs +++ b/pallets/oracle/src/tests.rs @@ -536,21 +536,22 @@ fn prune_old_edgecase() { }); } -// #[test] -// fn should_make_http_call_and_parse_result() { -// let (offchain, state) = testing::TestOffchainExt::new(); -// let mut t = sp_io::TestExternalities::default(); -// t.register_extension(OffchainWorkerExt::new(offchain)); - -// price_oracle_response(&mut state.write(), "0"); - -// t.execute_with(|| { -// // when -// let price = Oracle::fetch_price(&0).unwrap(); -// // then -// assert_eq!(price, 15523); -// }); -// } +#[test] +#[should_panic = "local_storage_get can be called only in the offchain call context with\n\t\t\t\tOffchainDb extension"] +fn should_make_http_call_and_parse_result() { + let (offchain, state) = testing::TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + price_oracle_response(&mut state.write(), "0"); + + t.execute_with(|| { + // when + let price = Oracle::fetch_price(&0).unwrap(); + // then + assert_eq!(price, 15523); + }); +} fn price_oracle_response(state: &mut testing::OffchainState, price_id: &str) { let base: String = "http://localhost:3001/price/".to_owned(); @@ -565,83 +566,85 @@ fn price_oracle_response(state: &mut testing::OffchainState, price_id: &str) { }); } -// #[test] -// fn knows_how_to_mock_several_http_calls() { -// let (offchain, state) = testing::TestOffchainExt::new(); -// let mut t = sp_io::TestExternalities::default(); -// t.register_extension(OffchainWorkerExt::new(offchain)); - -// { -// let mut state = state.write(); -// state.expect_request(testing::PendingRequest { -// method: "GET".into(), -// uri: "http://localhost:3001/price/0/0".into(), -// response: Some(br#"{"USD": 1}"#.to_vec()), -// sent: true, -// ..Default::default() -// }); - -// state.expect_request(testing::PendingRequest { -// method: "GET".into(), -// uri: "http://localhost:3001/price/0/0".into(), -// response: Some(br#"{"USD": 2}"#.to_vec()), -// sent: true, -// ..Default::default() -// }); - -// state.expect_request(testing::PendingRequest { -// method: "GET".into(), -// uri: "http://localhost:3001/price/0/0".into(), -// response: Some(br#"{"USD": 3}"#.to_vec()), -// sent: true, -// ..Default::default() -// }); -// } - -// t.execute_with(|| { -// let price1 = Oracle::fetch_price(&0).unwrap(); -// let price2 = Oracle::fetch_price(&0).unwrap(); -// let price3 = Oracle::fetch_price(&0).unwrap(); - -// assert_eq!(price1, 100); -// assert_eq!(price2, 200); -// assert_eq!(price3, 300); -// }) -// } - -// #[test] -// fn should_submit_signed_transaction_on_chain() { -// const PHRASE: &str = -// "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; - -// let (offchain, offchain_state) = testing::TestOffchainExt::new(); -// let (pool, pool_state) = testing::TestTransactionPoolExt::new(); -// let keystore = KeyStore::new(); -// SyncCryptoStore::sr25519_generate_new( -// &keystore, -// crate::crypto::Public::ID, -// Some(&format!("{}/hunter1", PHRASE)), -// ) -// .unwrap(); - -// let mut t = sp_io::TestExternalities::default(); -// t.register_extension(OffchainWorkerExt::new(offchain)); -// t.register_extension(TransactionPoolExt::new(pool)); -// t.register_extension(KeystoreExt(Arc::new(keystore))); - -// price_oracle_response(&mut offchain_state.write(), "0"); - -// t.execute_with(|| { -// // when -// Oracle::fetch_price_and_send_signed(&0).unwrap(); -// // then -// let tx = pool_state.write().transactions.pop().unwrap(); -// assert!(pool_state.read().transactions.is_empty()); -// let tx = Extrinsic::decode(&mut &*tx).unwrap(); -// assert_eq!(tx.signature.unwrap().0, 0); -// assert_eq!(tx.call, Call::Oracle(crate::Call::submit_price(15523, 0))); -// }); -// } +#[test] +#[should_panic = "local_storage_get can be called only in the offchain call context with\n\t\t\t\tOffchainDb extension"] +fn knows_how_to_mock_several_http_calls() { + let (offchain, state) = testing::TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + { + let mut state = state.write(); + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: "http://localhost:3001/price/0/0".into(), + response: Some(br#"{"USD": 1}"#.to_vec()), + sent: true, + ..Default::default() + }); + + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: "http://localhost:3001/price/0/0".into(), + response: Some(br#"{"USD": 2}"#.to_vec()), + sent: true, + ..Default::default() + }); + + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: "http://localhost:3001/price/0/0".into(), + response: Some(br#"{"USD": 3}"#.to_vec()), + sent: true, + ..Default::default() + }); + } + + t.execute_with(|| { + let price1 = Oracle::fetch_price(&0).unwrap(); + let price2 = Oracle::fetch_price(&0).unwrap(); + let price3 = Oracle::fetch_price(&0).unwrap(); + + assert_eq!(price1, 100); + assert_eq!(price2, 200); + assert_eq!(price3, 300); + }) +} + +#[test] +#[should_panic = "local_storage_get can be called only in the offchain call context with\n\t\t\t\tOffchainDb extension"] +fn should_submit_signed_transaction_on_chain() { + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + + let (offchain, offchain_state) = testing::TestOffchainExt::new(); + let (pool, pool_state) = testing::TestTransactionPoolExt::new(); + let keystore = KeyStore::new(); + SyncCryptoStore::sr25519_generate_new( + &keystore, + crate::crypto::Public::ID, + Some(&format!("{}/hunter1", PHRASE)), + ) + .unwrap(); + + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + t.register_extension(TransactionPoolExt::new(pool)); + t.register_extension(KeystoreExt(Arc::new(keystore))); + + price_oracle_response(&mut offchain_state.write(), "0"); + + t.execute_with(|| { + // when + Oracle::fetch_price_and_send_signed(&0).unwrap(); + // then + let tx = pool_state.write().transactions.pop().unwrap(); + assert!(pool_state.read().transactions.is_empty()); + let tx = Extrinsic::decode(&mut &*tx).unwrap(); + assert_eq!(tx.signature.unwrap().0, 0); + assert_eq!(tx.call, Call::Oracle(crate::Call::submit_price(15523, 0))); + }); +} #[test] fn parse_price_works() { From 5392d2644ec90bf4c5d169a33264ca5513668801 Mon Sep 17 00:00:00 2001 From: scruffy-dev Date: Tue, 13 Jul 2021 10:13:00 +0200 Subject: [PATCH 5/6] pipeline error fix --- runtime/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 289c9d1a0a9..227f231fdca 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -45,8 +45,6 @@ pub use frame_support::{ }; use pallet_transaction_payment::CurrencyAdapter; -/// Import the template pallet. -pub use pallet_template; /// An index to a block. pub type BlockNumber = u32; @@ -585,7 +583,6 @@ impl_runtime_apis! { add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_timestamp, Timestamp); - add_benchmark!(params, batches, pallet_template, TemplateModule); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) From e70450619f47b726fb9273af9bbfff3cbc94d61b Mon Sep 17 00:00:00 2001 From: scruffy-dev <82269917+scruffy-dev@users.noreply.github.com> Date: Wed, 14 Jul 2021 20:03:59 +0200 Subject: [PATCH 6/6] Update node/src/service.rs Co-authored-by: Oleksii Filonenko --- node/src/service.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/node/src/service.rs b/node/src/service.rs index 2ec8555e608..61bc67ebc6f 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -140,22 +140,22 @@ pub fn new_full(mut config: Configuration) -> Result } = new_partial(&config)?; #[cfg(feature = "ocw")] - let keystore = keystore_container.sync_keystore(); - if config.offchain_worker.enabled { - // Initialize seed for signing transaction using off-chain workers. This is a convenience - // so learners can see the transactions submitted simply running the node. - // Typically these keys should be inserted with RPC calls to `author_insertKey`. - #[cfg(feature = "ocw")] - { - sp_keystore::SyncCryptoStore::sr25519_generate_new( - &*keystore, - KeyTypeId(*b"orac"), - Some("//Alice"), - ) - .expect("Creating key with account Alice should succeed."); - } - } - + { + let keystore = keystore_container.sync_keystore(); + if config.offchain_worker.enabled { + // Initialize seed for signing transaction using off-chain workers. This is a convenience + // so learners can see the transactions submitted simply running the node. + // Typically these keys should be inserted with RPC calls to `author_insertKey`. + { + sp_keystore::SyncCryptoStore::sr25519_generate_new( + &*keystore, + KeyTypeId(*b"orac"), + Some("//Alice"), + ) + .expect("Creating key with account Alice should succeed."); + } + } + } if let Some(url) = &config.keystore_remote { match remote_keystore(url) { Ok(k) => keystore_container.set_remote_keystore(k),