diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index d4f8299f3..000000000 --- a/Cargo.lock +++ /dev/null @@ -1,10250 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if 1.0.0", - "cipher", - "cpufeatures 0.2.2", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aes-gcm" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.6", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "anyhow" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" - -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "asn1_der" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" - -[[package]] -name = "assert_cmd" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c98233c6673d8601ab23e77eb38f999c51100d46c5703b17288c57fddf3a1ffe" -dependencies = [ - "bstr", - "doc-comment", - "predicates", - "predicates-core", - "predicates-tree", - "wait-timeout", -] - -[[package]] -name = "assert_matches" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" - -[[package]] -name = "asset-handler" -version = "1.0.0" -dependencies = [ - "chainbridge", - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-assets", - "pallet-balances", - "pallet-sudo", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "async-attributes" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "async-channel" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "once_cell", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd8b508d585e01084059b60f06ade4cb7415cd2e4084b71dd1cb44e7d3fb9880" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", -] - -[[package]] -name = "async-io" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07" -dependencies = [ - "concurrent-queue", - "futures-lite", - "libc", - "log", - "once_cell", - "parking", - "polling", - "slab", - "socket2 0.4.4", - "waker-fn", - "winapi 0.3.9", -] - -[[package]] -name = "async-lock" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-std" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" -dependencies = [ - "async-attributes", - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "num_cpus", - "once_cell", - "pin-project-lite 0.2.9", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-std-resolver" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf3e776afdf3a2477ef4854b85ba0dff3bd85792f685fb3c68948b4d304e4f0" -dependencies = [ - "async-std", - "async-trait", - "futures-io", - "futures-util", - "pin-utils", - "trust-dns-resolver", -] - -[[package]] -name = "async-task" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" - -[[package]] -name = "async-trait" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "asynchronous-codec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4401f0a3622dad2e0763fa79e0eb328bc70fb7dccfdd645341f00d671247d6" -dependencies = [ - "bytes 1.1.0", - "futures-sink", - "futures-util", - "memchr", - "pin-project-lite 0.2.9", -] - -[[package]] -name = "asynchronous-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" -dependencies = [ - "bytes 1.1.0", - "futures-sink", - "futures-util", - "memchr", - "pin-project-lite 0.2.9", -] - -[[package]] -name = "atomic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" -dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object 0.28.4", - "rustc-demangle", -] - -[[package]] -name = "base-x" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc19a4937b4fbd3fe3379793130e42060d10627a360f2127802b10b87e7baf74" - -[[package]] -name = "base58" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" - -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "beef" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" -dependencies = [ - "serde", -] - -[[package]] -name = "beefy-primitives" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "bimap" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bindgen" -version = "0.59.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitvec" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1489fcb93a5bb47da0462ca93ad252ad6af2145cce58d10d46a83931ba9f016b" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.3", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", -] - -[[package]] -name = "blake2b_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "constant_time_eq", -] - -[[package]] -name = "blake2s_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "constant_time_eq", -] - -[[package]] -name = "blake3" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding 0.1.5", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding 0.2.1", - "generic-array 0.14.5", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "blocking" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" -dependencies = [ - "async-channel", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata", -] - -[[package]] -name = "build-helper" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdce191bf3fa4995ce948c8c83b4640a1745457a149e73c6db75b4ffe36aad5f" -dependencies = [ - "semver 0.6.0", -] - -[[package]] -name = "bumpalo" -version = "3.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" - -[[package]] -name = "byte-slice-cast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - -[[package]] -name = "bytes" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - -[[package]] -name = "camino" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.10", - "serde", - "serde_json", -] - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chacha20" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee7ad89dc1128635074c268ee661f90c3f7e83d9fd12910608c36b47d6c3412" -dependencies = [ - "cfg-if 1.0.0", - "cipher", - "cpufeatures 0.1.5", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1580317203210c517b6d44794abfbe600698276db18127e37ad3e69bf5e848e5" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "chainbridge" -version = "0.0.3" -dependencies = [ - "blake2-rfc", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-balances", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "time", - "winapi 0.3.9", -] - -[[package]] -name = "cid" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff0e3bc0b6446b3f9663c1a6aba6ef06c5aeaa1bc92bd18077be337198ab9768" -dependencies = [ - "multibase", - "multihash 0.13.2", - "unsigned-varint 0.5.1", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "ckb-merkle-mountain-range" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f061f97d64fd1822664bdfb722f7ae5469a97b77567390f7442be5b5dc82a5b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "clang-sys" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" -dependencies = [ - "glob", - "libc", - "libloading 0.7.3", -] - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim 0.8.0", - "textwrap 0.11.0", - "unicode-width", - "vec_map", -] - -[[package]] -name = "clap" -version = "3.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" -dependencies = [ - "atty", - "bitflags", - "clap_derive", - "clap_lex", - "indexmap", - "lazy_static", - "strsim 0.10.0", - "termcolor", - "textwrap 0.15.0", -] - -[[package]] -name = "clap_derive" -version = "3.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" -dependencies = [ - "heck 0.4.0", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "concurrent-queue" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" -dependencies = [ - "cache-padded", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "cpp_demangle" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "cpufeatures" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" -dependencies = [ - "libc", -] - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-bforest" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62fc68cdb867b7d27b5f33cd65eb11376dfb41a2d09568a1a2c2bc1dc204f4ef" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31253a44ab62588f8235a996cc9b0636d98a299190069ced9628b8547329b47a" -dependencies = [ - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity", - "gimli", - "log", - "regalloc", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a20ab4627d30b702fb1b8a399882726d216b8164d3b3fa6189e3bf901506afe" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6687d9668dacfed4468361f7578d86bded8ca4db978f734d9b631494bebbb5b8" - -[[package]] -name = "cranelift-entity" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77c5d72db97ba2cb36f69037a709edbae0d29cb25503775891e7151c5c874bf" -dependencies = [ - "serde", -] - -[[package]] -name = "cranelift-frontend" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426dca83f63c7c64ea459eb569aadc5e0c66536c0042ed5d693f91830e8750d0" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-native" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8007864b5d0c49b026c861a15761785a2871124e401630c03ef1426e6d0d559e" -dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon", -] - -[[package]] -name = "cranelift-wasm" -version = "0.80.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cf12c071415ba261d897387ae5350c4d83c238376c8c5a96514ecfa2ea66a3" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "itertools", - "log", - "smallvec", - "wasmparser", - "wasmtime-types", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" -dependencies = [ - "cfg-if 1.0.0", - "lazy_static", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" -dependencies = [ - "generic-array 0.14.5", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "ct-logs" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" -dependencies = [ - "sct 0.6.1", -] - -[[package]] -name = "ctor" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher", -] - -[[package]] -name = "cuckoofilter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" -dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", -] - -[[package]] -name = "curve25519-dalek" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" -dependencies = [ - "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "data-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" - -[[package]] -name = "data-encoding-macro" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca" -dependencies = [ - "data-encoding", - "data-encoding-macro-internal", -] - -[[package]] -name = "data-encoding-macro-internal" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" -dependencies = [ - "data-encoding", - "syn", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version 0.4.0", - "syn", -] - -[[package]] -name = "diff" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" - -[[package]] -name = "difflib" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "directories" -version = "4.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if 1.0.0", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - -[[package]] -name = "dissimilar" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c97b9233581d84b8e1e689cdd3a47b6f69770084fc246e86a7f78b0d9c1d4a5" - -[[package]] -name = "dns-parser" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" -dependencies = [ - "byteorder", - "quick-error", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "dtoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" - -[[package]] -name = "dyn-clonable" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" -dependencies = [ - "dyn-clonable-impl", - "dyn-clone", -] - -[[package]] -name = "dyn-clonable-impl" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dyn-clone" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28" - -[[package]] -name = "ed25519" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek 3.2.0", - "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "enum-as-inner" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570d109b813e904becc80d8d5da38376818a143348413f7149f1340fe04754d4" -dependencies = [ - "heck 0.4.0", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "enumflags2" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" -dependencies = [ - "enumflags2_derive", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "environmental" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" - -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "event-listener" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" - -[[package]] -name = "exit-future" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" -dependencies = [ - "futures 0.3.21", -] - -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fastrand" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" -dependencies = [ - "instant", -] - -[[package]] -name = "fdlimit" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b" -dependencies = [ - "libc", -] - -[[package]] -name = "file-per-thread-logger" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" -dependencies = [ - "env_logger", - "log", -] - -[[package]] -name = "finality-grandpa" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9def033d8505edf199f6a5d07aa7e6d2d6185b164293b77f0efd108f4f3e11d" -dependencies = [ - "either", - "futures 0.3.21", - "futures-timer", - "log", - "num-traits", - "parity-scale-codec 3.1.2", - "parking_lot 0.11.2", - "scale-info 2.1.2", -] - -[[package]] -name = "fixed-hash" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fixedbitset" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" - -[[package]] -name = "flate2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" -dependencies = [ - "crc32fast", - "libz-sys", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fork-tree" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", -] - -[[package]] -name = "form_urlencoded" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" -dependencies = [ - "matches", - "percent-encoding 2.1.0", -] - -[[package]] -name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "linregress", - "log", - "parity-scale-codec 3.1.2", - "paste", - "scale-info 2.1.2", - "serde", - "sp-api", - "sp-application-crypto", - "sp-io", - "sp-runtime", - "sp-runtime-interface", - "sp-std", - "sp-storage", -] - -[[package]] -name = "frame-benchmarking-cli" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "Inflector", - "chrono", - "clap 3.1.18", - "frame-benchmarking", - "frame-support", - "frame-system", - "handlebars", - "hash-db", - "hex", - "itertools", - "kvdb", - "linked-hash-map", - "log", - "memory-db", - "parity-scale-codec 3.1.2", - "rand 0.8.5", - "sc-block-builder", - "sc-cli", - "sc-client-api", - "sc-client-db", - "sc-executor", - "sc-service", - "serde", - "serde_json", - "serde_nanos", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-database", - "sp-externalities", - "sp-inherents", - "sp-keystore", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-storage", - "sp-trie", - "thousands", -] - -[[package]] -name = "frame-election-provider-solution-type" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-election-provider-support" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-election-provider-solution-type", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-arithmetic", - "sp-npos-elections", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "frame-executive" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" -dependencies = [ - "cfg-if 1.0.0", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", -] - -[[package]] -name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "bitflags", - "frame-metadata", - "frame-support-procedural", - "impl-trait-for-tuples", - "log", - "once_cell", - "parity-scale-codec 3.1.2", - "paste", - "scale-info 2.1.2", - "serde", - "smallvec", - "sp-arithmetic", - "sp-core", - "sp-core-hashing-proc-macro", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-state-machine", - "sp-std", - "sp-tracing", - "tt-call", -] - -[[package]] -name = "frame-support-procedural" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "Inflector", - "frame-support-procedural-tools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-support-procedural-tools" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support-procedural-tools-derive", - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-support-procedural-tools-derive" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-support-test" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-support-test-pallet", - "frame-system", - "parity-scale-codec 3.1.2", - "pretty_assertions", - "rustversion", - "scale-info 2.1.2", - "serde", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", - "trybuild", -] - -[[package]] -name = "frame-support-test-pallet" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", -] - -[[package]] -name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", -] - -[[package]] -name = "frame-system-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "frame-system-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "sp-api", -] - -[[package]] -name = "frame-try-runtime" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "sp-api", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "fs-swap" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d47dad3685eceed8488986cad3d5027165ea5edb164331770e2059555f10a5" -dependencies = [ - "lazy_static", - "libc", - "libloading 0.5.2", - "winapi 0.3.9", -] - -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "fs_extra" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - -[[package]] -name = "futures" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" - -[[package]] -name = "futures-executor" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" - -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite 0.2.9", - "waker-fn", -] - -[[package]] -name = "futures-macro" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-rustls" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1387e07917c711fb4ee4f48ea0adb04a3c9739e53ef85bf43ae1edc2937a8b" -dependencies = [ - "futures-io", - "rustls 0.19.1", - "webpki 0.21.4", -] - -[[package]] -name = "futures-sink" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" - -[[package]] -name = "futures-task" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" - -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - -[[package]] -name = "futures-util" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" -dependencies = [ - "futures 0.1.31", - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite 0.2.9", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", -] - -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug 0.3.0", - "polyval", -] - -[[package]] -name = "gimli" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - -[[package]] -name = "globset" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" -dependencies = [ - "aho-corasick", - "bstr", - "fnv", - "log", - "regex", -] - -[[package]] -name = "gloo-timers" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "h2" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" -dependencies = [ - "bytes 1.1.0", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util 0.7.3", - "tracing", -] - -[[package]] -name = "handlebars" -version = "4.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66d0c1b6e3abfd1e72818798925e16e02ed77e1b47f6c25a95a23b377ee4299" -dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "hash-db" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" - -[[package]] -name = "hash256-std-hasher" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" -dependencies = [ - "crunchy", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hex-literal" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - -[[package]] -name = "hex_fmt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.5", - "hmac 0.8.1", -] - -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - -[[package]] -name = "http" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" -dependencies = [ - "bytes 1.1.0", - "fnv", - "itoa 1.0.2", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes 1.1.0", - "http", - "pin-project-lite 0.2.9", -] - -[[package]] -name = "httparse" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "hyper" -version = "0.14.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" -dependencies = [ - "bytes 1.1.0", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa 1.0.2", - "pin-project-lite 0.2.9", - "socket2 0.4.4", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" -dependencies = [ - "ct-logs", - "futures-util", - "hyper", - "log", - "rustls 0.19.1", - "rustls-native-certs 0.5.0", - "tokio", - "tokio-rustls 0.22.0", - "webpki 0.21.4", -] - -[[package]] -name = "ias-verify" -version = "0.1.5" -source = "git+https://github.com/Polkadex-Substrate/pallets?branch=polkadot-v0.9.19#d36627f81b7392eaac8e1d18551ecb1cb12bdf0a" -dependencies = [ - "base64 0.11.0", - "chrono", - "frame-support", - "parity-scale-codec 3.1.2", - "scale-info 1.0.0", - "serde_json", - "sp-core", - "sp-io", - "sp-std", - "webpki 0.21.0", -] - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "if-addrs" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2273e421f7c4f0fc99e1934fe4776f59d8df2972f4199d703fc0da9f2a9f73de" -dependencies = [ - "if-addrs-sys", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "if-addrs-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de74b9dd780476e837e5eb5ab7c88b49ed304126e412030a0adba99c8efe79ea" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "if-watch" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8ab7f67bad3240049cb24fb9cb0b4c2c6af4c245840917fbbdededeee91179" -dependencies = [ - "async-io", - "futures 0.3.21", - "futures-lite", - "if-addrs", - "ipnet", - "libc", - "log", - "winapi 0.3.9", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec 3.1.2", -] - -[[package]] -name = "impl-serde" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "indexmap" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" -dependencies = [ - "autocfg", - "hashbrown 0.11.2", - "serde", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "integer-sqrt" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" -dependencies = [ - "num-traits", -] - -[[package]] -name = "io-lifetimes" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ef6787e7f0faedc040f95716bdd0e62bcfcf4ba93da053b62dea2691c13864" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "ip_network" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" - -[[package]] -name = "ipconfig" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" -dependencies = [ - "socket2 0.3.19", - "widestring", - "winapi 0.3.9", - "winreg", -] - -[[package]] -name = "ipnet" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "jobserver" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "jsonrpc-client-transports" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a" -dependencies = [ - "derive_more", - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-pubsub", - "log", - "serde", - "serde_json", - "url 1.7.2", -] - -[[package]] -name = "jsonrpc-core" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" -dependencies = [ - "futures 0.3.21", - "futures-executor", - "futures-util", - "log", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "jsonrpc-core-client" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0" -dependencies = [ - "futures 0.3.21", - "jsonrpc-client-transports", -] - -[[package]] -name = "jsonrpc-derive" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b939a78fa820cdfcb7ee7484466746a7377760970f6f9c6fe19f9edcc8a38d2" -dependencies = [ - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "jsonrpc-http-server" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff" -dependencies = [ - "futures 0.3.21", - "hyper", - "jsonrpc-core", - "jsonrpc-server-utils", - "log", - "net2", - "parking_lot 0.11.2", - "unicase", -] - -[[package]] -name = "jsonrpc-ipc-server" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845" -dependencies = [ - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-server-utils", - "log", - "parity-tokio-ipc", - "parking_lot 0.11.2", - "tower-service", -] - -[[package]] -name = "jsonrpc-pubsub" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011" -dependencies = [ - "futures 0.3.21", - "jsonrpc-core", - "lazy_static", - "log", - "parking_lot 0.11.2", - "rand 0.7.3", - "serde", -] - -[[package]] -name = "jsonrpc-server-utils" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4" -dependencies = [ - "bytes 1.1.0", - "futures 0.3.21", - "globset", - "jsonrpc-core", - "lazy_static", - "log", - "tokio", - "tokio-stream", - "tokio-util 0.6.10", - "unicase", -] - -[[package]] -name = "jsonrpc-ws-server" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f892c7d766369475ab7b0669f417906302d7c0fb521285c0a0c92e52e7c8e946" -dependencies = [ - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-server-utils", - "log", - "parity-ws", - "parking_lot 0.11.2", - "slab", -] - -[[package]] -name = "jsonrpsee" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91dc760c341fa81173f9a434931aaf32baad5552b0230cc6c93e8fb7eaad4c19" -dependencies = [ - "jsonrpsee-core", - "jsonrpsee-proc-macros", - "jsonrpsee-types", - "jsonrpsee-ws-client", -] - -[[package]] -name = "jsonrpsee-client-transport" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765f7a36d5087f74e3b3b47805c2188fef8eb54afcb587b078d9f8ebfe9c7220" -dependencies = [ - "futures 0.3.21", - "http", - "jsonrpsee-core", - "jsonrpsee-types", - "pin-project 1.0.10", - "rustls-native-certs 0.6.2", - "soketto 0.7.1", - "thiserror", - "tokio", - "tokio-rustls 0.23.4", - "tokio-util 0.7.3", - "tracing", - "webpki-roots 0.22.3", -] - -[[package]] -name = "jsonrpsee-core" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82ef77ecd20c2254d54f5da8c0738eacca61e6b6511268a8f2753e3148c6c706" -dependencies = [ - "anyhow", - "arrayvec 0.7.2", - "async-trait", - "beef", - "futures-channel", - "futures-util", - "hyper", - "jsonrpsee-types", - "rustc-hash", - "serde", - "serde_json", - "soketto 0.7.1", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "jsonrpsee-proc-macros" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7291c72805bc7d413b457e50d8ef3e87aa554da65ecbbc278abb7dfc283e7f0" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "jsonrpsee-types" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b6aa52f322cbf20c762407629b8300f39bcc0cf0619840d9252a2f65fd2dd9" -dependencies = [ - "anyhow", - "beef", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "jsonrpsee-ws-client" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd66d18bab78d956df24dd0d2e41e4c00afbb818fda94a98264bdd12ce8506ac" -dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", -] - -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - -[[package]] -name = "kvdb" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" -dependencies = [ - "parity-util-mem", - "smallvec", -] - -[[package]] -name = "kvdb-memorydb" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" -dependencies = [ - "kvdb", - "parity-util-mem", - "parking_lot 0.12.1", -] - -[[package]] -name = "kvdb-rocksdb" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca7fbdfd71cd663dceb0faf3367a99f8cf724514933e9867cec4995b6027cbc1" -dependencies = [ - "fs-swap", - "kvdb", - "log", - "num_cpus", - "owning_ref", - "parity-util-mem", - "parking_lot 0.12.1", - "regex", - "rocksdb", - "smallvec", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libloading" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -dependencies = [ - "cc", - "winapi 0.3.9", -] - -[[package]] -name = "libloading" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" -dependencies = [ - "cfg-if 1.0.0", - "winapi 0.3.9", -] - -[[package]] -name = "libm" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" - -[[package]] -name = "libp2p" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bec54343492ba5940a6c555e512c6721139835d28c59bc22febece72dfd0d9d" -dependencies = [ - "atomic", - "bytes 1.1.0", - "futures 0.3.21", - "lazy_static", - "libp2p-core", - "libp2p-deflate", - "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", - "libp2p-identify", - "libp2p-kad", - "libp2p-mdns", - "libp2p-metrics", - "libp2p-mplex", - "libp2p-noise", - "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", - "libp2p-relay", - "libp2p-rendezvous", - "libp2p-request-response", - "libp2p-swarm", - "libp2p-swarm-derive", - "libp2p-tcp", - "libp2p-uds", - "libp2p-wasm-ext", - "libp2p-websocket", - "libp2p-yamux", - "multiaddr", - "parking_lot 0.11.2", - "pin-project 1.0.10", - "smallvec", - "wasm-timer", -] - -[[package]] -name = "libp2p-core" -version = "0.30.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86aad7d54df283db817becded03e611137698a6509d4237a96881976a162340c" -dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", - "either", - "fnv", - "futures 0.3.21", - "futures-timer", - "instant", - "lazy_static", - "libsecp256k1", - "log", - "multiaddr", - "multihash 0.14.0", - "multistream-select", - "parking_lot 0.11.2", - "pin-project 1.0.10", - "prost", - "prost-build", - "rand 0.8.5", - "ring 0.16.20", - "rw-stream-sink", - "sha2 0.9.9", - "smallvec", - "thiserror", - "unsigned-varint 0.7.1", - "void", - "zeroize", -] - -[[package]] -name = "libp2p-deflate" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51a800adb195f33de63f4b17b63fe64cfc23bf2c6a0d3d0d5321328664e65197" -dependencies = [ - "flate2", - "futures 0.3.21", - "libp2p-core", -] - -[[package]] -name = "libp2p-dns" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb8f89d15cb6e3c5bc22afff7513b11bab7856f2872d3cfba86f7f63a06bc498" -dependencies = [ - "async-std-resolver", - "futures 0.3.21", - "libp2p-core", - "log", - "smallvec", - "trust-dns-resolver", -] - -[[package]] -name = "libp2p-floodsub" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aab3d7210901ea51b7bae2b581aa34521797af8c4ec738c980bda4a06434067f" -dependencies = [ - "cuckoofilter", - "fnv", - "futures 0.3.21", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfeead619eb5dac46e65acc78c535a60aaec803d1428cca6407c3a4fc74d698d" -dependencies = [ - "asynchronous-codec 0.6.0", - "base64 0.13.0", - "byteorder", - "bytes 1.1.0", - "fnv", - "futures 0.3.21", - "hex_fmt", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.7.3", - "regex", - "sha2 0.9.9", - "smallvec", - "unsigned-varint 0.7.1", - "wasm-timer", -] - -[[package]] -name = "libp2p-identify" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca1275574183f288ff8b72d535d5ffa5ea9292ef7829af8b47dcb197c7b0dcd" -dependencies = [ - "futures 0.3.21", - "libp2p-core", - "libp2p-swarm", - "log", - "lru 0.6.6", - "prost", - "prost-build", - "smallvec", - "wasm-timer", -] - -[[package]] -name = "libp2p-kad" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2297dc0ca285f3a09d1368bde02449e539b46f94d32d53233f53f6625bcd3ba" -dependencies = [ - "arrayvec 0.5.2", - "asynchronous-codec 0.6.0", - "bytes 1.1.0", - "either", - "fnv", - "futures 0.3.21", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.7.3", - "sha2 0.9.9", - "smallvec", - "uint", - "unsigned-varint 0.7.1", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-mdns" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c864b64bdc8a84ff3910a0df88e6535f256191a450870f1e7e10cbf8e64d45" -dependencies = [ - "async-io", - "data-encoding", - "dns-parser", - "futures 0.3.21", - "if-watch", - "lazy_static", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.8.5", - "smallvec", - "socket2 0.4.4", - "void", -] - -[[package]] -name = "libp2p-metrics" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af432fcdd2f8ba4579b846489f8f0812cfd738ced2c0af39df9b1c48bbb6ab2" -dependencies = [ - "libp2p-core", - "libp2p-identify", - "libp2p-kad", - "libp2p-ping", - "libp2p-swarm", - "open-metrics-client", -] - -[[package]] -name = "libp2p-mplex" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2cd64ef597f40e14bfce0497f50ecb63dd6d201c61796daeb4227078834fbf" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.1.0", - "futures 0.3.21", - "libp2p-core", - "log", - "nohash-hasher", - "parking_lot 0.11.2", - "rand 0.7.3", - "smallvec", - "unsigned-varint 0.7.1", -] - -[[package]] -name = "libp2p-noise" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8772c7a99088221bb7ca9c5c0574bf55046a7ab4c319f3619b275f28c8fb87a" -dependencies = [ - "bytes 1.1.0", - "curve25519-dalek 3.2.0", - "futures 0.3.21", - "lazy_static", - "libp2p-core", - "log", - "prost", - "prost-build", - "rand 0.8.5", - "sha2 0.9.9", - "snow", - "static_assertions", - "x25519-dalek", - "zeroize", -] - -[[package]] -name = "libp2p-ping" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80ef7b0ec5cf06530d9eb6cf59ae49d46a2c45663bde31c25a12f682664adbcf" -dependencies = [ - "futures 0.3.21", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.7.3", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fba1a6ff33e4a274c89a3b1d78b9f34f32af13265cc5c46c16938262d4e945a" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.1.0", - "futures 0.3.21", - "libp2p-core", - "log", - "prost", - "prost-build", - "unsigned-varint 0.7.1", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1a458bbda880107b5b36fcb9b5a1ef0c329685da0e203ed692a8ebe64cc92c" -dependencies = [ - "futures 0.3.21", - "log", - "pin-project 1.0.10", - "rand 0.7.3", - "salsa20", - "sha3 0.9.1", -] - -[[package]] -name = "libp2p-relay" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2852b61c90fa8ce3c8fcc2aba76e6cefc20d648f9df29157d6b3a916278ef3e3" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.1.0", - "futures 0.3.21", - "futures-timer", - "libp2p-core", - "libp2p-swarm", - "log", - "pin-project 1.0.10", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec", - "unsigned-varint 0.7.1", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14a6d2b9e7677eff61dc3d2854876aaf3976d84a01ef6664b610c77a0c9407c5" -dependencies = [ - "asynchronous-codec 0.6.0", - "bimap", - "futures 0.3.21", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.8.5", - "sha2 0.9.9", - "thiserror", - "unsigned-varint 0.7.1", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-request-response" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a877a4ced6d46bf84677e1974e8cf61fb434af73b2e96fb48d6cb6223a4634d8" -dependencies = [ - "async-trait", - "bytes 1.1.0", - "futures 0.3.21", - "libp2p-core", - "libp2p-swarm", - "log", - "lru 0.7.6", - "rand 0.7.3", - "smallvec", - "unsigned-varint 0.7.1", - "wasm-timer", -] - -[[package]] -name = "libp2p-swarm" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f5184a508f223bc100a12665517773fb8730e9f36fc09eefb670bf01b107ae9" -dependencies = [ - "either", - "futures 0.3.21", - "libp2p-core", - "log", - "rand 0.7.3", - "smallvec", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-swarm-derive" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072c290f727d39bdc4e9d6d1c847978693d25a673bd757813681e33e5f6c00c2" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "libp2p-tcp" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7399c5b6361ef525d41c11fcf51635724f832baf5819b30d3d873eabb4fbae4b" -dependencies = [ - "async-io", - "futures 0.3.21", - "futures-timer", - "if-watch", - "ipnet", - "libc", - "libp2p-core", - "log", - "socket2 0.4.4", -] - -[[package]] -name = "libp2p-uds" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7563e46218165dfd60f64b96f7ce84590d75f53ecbdc74a7dd01450dc5973" -dependencies = [ - "async-std", - "futures 0.3.21", - "libp2p-core", - "log", -] - -[[package]] -name = "libp2p-wasm-ext" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1008a302b73c5020251f9708c653f5ed08368e530e247cc9cd2f109ff30042cf" -dependencies = [ - "futures 0.3.21", - "js-sys", - "libp2p-core", - "parity-send-wrapper", - "wasm-bindgen", - "wasm-bindgen-futures", -] - -[[package]] -name = "libp2p-websocket" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e12df82d1ed64969371a9e65ea92b91064658604cc2576c2757f18ead9a1cf" -dependencies = [ - "either", - "futures 0.3.21", - "futures-rustls", - "libp2p-core", - "log", - "quicksink", - "rw-stream-sink", - "soketto 0.7.1", - "url 2.2.2", - "webpki-roots 0.21.1", -] - -[[package]] -name = "libp2p-yamux" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7362abb8867d7187e7e93df17f460d554c997fc5c8ac57dc1259057f6889af" -dependencies = [ - "futures 0.3.21", - "libp2p-core", - "parking_lot 0.11.2", - "thiserror", - "yamux", -] - -[[package]] -name = "librocksdb-sys" -version = "0.6.1+6.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" -dependencies = [ - "bindgen", - "bzip2-sys", - "cc", - "glob", - "libc", - "libz-sys", - "tikv-jemalloc-sys", -] - -[[package]] -name = "libsecp256k1" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" -dependencies = [ - "arrayref", - "base64 0.13.0", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.8.5", - "serde", - "sha2 0.9.9", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libz-sys" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" - -[[package]] -name = "linked_hash_set" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "linregress" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" -dependencies = [ - "nalgebra", - "statrs", -] - -[[package]] -name = "linux-raw-sys" -version = "0.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a261afc61b7a5e323933b402ca6a1765183687c614789b1e4db7762ed4230bca" - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", - "value-bag", -] - -[[package]] -name = "lru" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea2d928b485416e8908cff2d97d621db22b27f7b3b6729e438bcf42c671ba91" -dependencies = [ - "hashbrown 0.11.2", -] - -[[package]] -name = "lru" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8015d95cb7b2ddd3c0d32ca38283ceb1eea09b4713ee380bceb942d85a244228" -dependencies = [ - "hashbrown 0.11.2", -] - -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "lz4" -version = "1.23.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4edcb94251b1c375c459e5abe9fb0168c1c826c3370172684844f8f3f8d1a885" -dependencies = [ - "libc", - "lz4-sys", -] - -[[package]] -name = "lz4-sys" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7be8908e2ed6f31c02db8a9fa962f03e36c53fbfde437363eae3306b85d7e17" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - -[[package]] -name = "matchers" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - -[[package]] -name = "matrixmultiply" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" -dependencies = [ - "rawpointer", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" -dependencies = [ - "libc", -] - -[[package]] -name = "memmap2" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5172b50c23043ff43dd53e51392f36519d9b35a8f3a410d30ece5d1aedd58ae" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memory-db" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" -dependencies = [ - "hash-db", - "hashbrown 0.12.1", - "parity-util-mem", -] - -[[package]] -name = "memory_units" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" - -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" -dependencies = [ - "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio 0.6.23", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "more-asserts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" - -[[package]] -name = "multiaddr" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ee4ea82141951ac6379f964f71b20876d43712bea8faf6dd1a375e08a46499" -dependencies = [ - "arrayref", - "bs58", - "byteorder", - "data-encoding", - "multihash 0.14.0", - "percent-encoding 2.1.0", - "serde", - "static_assertions", - "unsigned-varint 0.7.1", - "url 2.2.2", -] - -[[package]] -name = "multibase" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b78c60039650ff12e140ae867ef5299a58e19dded4d334c849dc7177083667e2" -dependencies = [ - "base-x", - "data-encoding", - "data-encoding-macro", -] - -[[package]] -name = "multihash" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab" -dependencies = [ - "blake2b_simd", - "blake2s_simd", - "blake3", - "digest 0.9.0", - "generic-array 0.14.5", - "multihash-derive", - "sha2 0.9.9", - "sha3 0.9.1", - "unsigned-varint 0.5.1", -] - -[[package]] -name = "multihash" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.5", - "multihash-derive", - "sha2 0.9.9", - "unsigned-varint 0.7.1", -] - -[[package]] -name = "multihash-derive" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - -[[package]] -name = "multistream-select" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56a336acba8bc87c8876f6425407dbbe6c417bf478b22015f8fb0994ef3bc0ab" -dependencies = [ - "bytes 1.1.0", - "futures 0.3.21", - "log", - "pin-project 1.0.10", - "smallvec", - "unsigned-varint 0.7.1", -] - -[[package]] -name = "nalgebra" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" -dependencies = [ - "approx", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational 0.4.0", - "num-traits", - "rand 0.8.5", - "rand_distr", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "names" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d66043b25d4a6cccb23619d10c19c25304b355a7dccd4a8e11423dd2382146" -dependencies = [ - "rand 0.8.5", -] - -[[package]] -name = "net2" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "nix" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", -] - -[[package]] -name = "node-executor" -version = "3.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "node-primitives", - "node-runtime", - "parity-scale-codec 3.1.2", - "sc-executor", - "scale-info 2.1.2", - "sp-core", - "sp-keystore", - "sp-state-machine", - "sp-tracing", - "sp-trie", -] - -[[package]] -name = "node-polkadex-runtime" -version = "3.0.0" -dependencies = [ - "asset-handler", - "chainbridge", - "frame-benchmarking", - "frame-election-provider-support", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "hex-literal", - "log", - "orml-vesting", - "pallet-assets", - "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", - "pallet-bags-list", - "pallet-balances", - "pallet-bounties", - "pallet-child-bounties", - "pallet-collective", - "pallet-conviction-voting", - "pallet-democracy", - "pallet-election-provider-multi-phase", - "pallet-elections-phragmen", - "pallet-grandpa", - "pallet-identity", - "pallet-im-online", - "pallet-indices", - "pallet-membership", - "pallet-multisig", - "pallet-ocex-lmp", - "pallet-offences", - "pallet-polkadex-ido-primitives", - "pallet-preimage", - "pallet-proxy", - "pallet-randomness-collective-flip", - "pallet-recovery", - "pallet-referenda", - "pallet-scheduler", - "pallet-session", - "pallet-society", - "pallet-staking", - "pallet-staking-reward-curve", - "pallet-sudo", - "pallet-timestamp", - "pallet-tips", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-treasury", - "pallet-utility", - "parity-scale-codec 3.1.2", - "pdex-migration", - "polkadex-ido", - "polkadex-ido-runtime-api", - "polkadex-primitives", - "scale-info 2.1.2", - "smallvec", - "sp-api", - "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-core", - "sp-inherents", - "sp-io", - "sp-npos-elections", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-transaction-pool", - "sp-version", - "static_assertions", - "substrate-wasm-builder", - "test-token-provider", -] - -[[package]] -name = "node-primitives" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-application-crypto", - "sp-core", - "sp-runtime", -] - -[[package]] -name = "node-runtime" -version = "3.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-election-provider-support", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "log", - "node-primitives", - "pallet-asset-tx-payment", - "pallet-assets", - "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", - "pallet-bags-list", - "pallet-balances", - "pallet-bounties", - "pallet-child-bounties", - "pallet-collective", - "pallet-contracts", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", - "pallet-conviction-voting", - "pallet-democracy", - "pallet-election-provider-multi-phase", - "pallet-elections-phragmen", - "pallet-gilt", - "pallet-grandpa", - "pallet-identity", - "pallet-im-online", - "pallet-indices", - "pallet-lottery", - "pallet-membership", - "pallet-mmr", - "pallet-multisig", - "pallet-offences", - "pallet-preimage", - "pallet-proxy", - "pallet-randomness-collective-flip", - "pallet-recovery", - "pallet-referenda", - "pallet-scheduler", - "pallet-session", - "pallet-society", - "pallet-staking", - "pallet-staking-reward-curve", - "pallet-state-trie-migration", - "pallet-sudo", - "pallet-timestamp", - "pallet-tips", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-transaction-storage", - "pallet-treasury", - "pallet-uniques", - "pallet-utility", - "pallet-vesting", - "pallet-whitelist", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-api", - "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-core", - "sp-inherents", - "sp-io", - "sp-offchain", - "sp-runtime", - "sp-sandbox", - "sp-session", - "sp-staking", - "sp-std", - "sp-transaction-pool", - "sp-version", - "static_assertions", - "substrate-wasm-builder", -] - -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "nom" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-format" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" -dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" -dependencies = [ - "crc32fast", - "indexmap", - "memchr", -] - -[[package]] -name = "object" -version = "0.28.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "open-metrics-client" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7337d80c23c2d8b1349563981bc4fb531220733743ba8115454a67b181173f0d" -dependencies = [ - "dtoa", - "itoa 0.4.8", - "open-metrics-client-derive-text-encode", - "owning_ref", -] - -[[package]] -name = "open-metrics-client-derive-text-encode" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c83b586f00268c619c1cb3340ec1a6f59dd9ba1d9833a273a68e6d5cd8ffc" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "orml-vesting" -version = "0.4.1-dev" -source = "git+https://github.com/Polkadex-Substrate/open-runtime-module-library.git?branch=polkadot-v0.9.19#47e4108a1b25c53576f397e49b2fd70f9b9fd0b3" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "os_str_bytes" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" - -[[package]] -name = "output_vt100" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "pallet-asset-tx-payment" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "pallet-transaction-payment", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-assets" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-authority-discovery" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "pallet-session", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-application-crypto", - "sp-authority-discovery", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-authorship", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-babe" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "pallet-session", - "pallet-timestamp", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-application-crypto", - "sp-consensus-babe", - "sp-consensus-vrf", - "sp-io", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", -] - -[[package]] -name = "pallet-bags-list" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-election-provider-support", - "frame-support", - "frame-system", - "log", - "pallet-balances", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing", -] - -[[package]] -name = "pallet-balances" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-bounties" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-treasury", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-child-bounties" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-bounties", - "pallet-treasury", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-collective" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-contracts" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "bitflags", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-contracts-primitives", - "pallet-contracts-proc-macro", - "parity-scale-codec 3.1.2", - "rand 0.8.5", - "scale-info 2.1.2", - "serde", - "smallvec", - "sp-core", - "sp-io", - "sp-runtime", - "sp-sandbox", - "sp-std", - "wasm-instrument", - "wasmi-validation", -] - -[[package]] -name = "pallet-contracts-primitives" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "bitflags", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-core", - "sp-rpc", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-contracts-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pallet-contracts-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", - "parity-scale-codec 3.1.2", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "pallet-contracts-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "pallet-contracts-primitives", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-api", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-conviction-voting" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "assert_matches", - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-democracy" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-election-provider-multi-phase" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-election-provider-support", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "rand 0.7.3", - "scale-info 2.1.2", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-npos-elections", - "sp-runtime", - "sp-std", - "static_assertions", - "strum", -] - -[[package]] -name = "pallet-elections-phragmen" -version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-npos-elections", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-gilt" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-arithmetic", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-grandpa" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "pallet-session", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-application-crypto", - "sp-core", - "sp-finality-grandpa", - "sp-io", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", -] - -[[package]] -name = "pallet-identity" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "enumflags2", - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-im-online" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", -] - -[[package]] -name = "pallet-indices" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-lottery" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-membership" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-mmr" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "ckb-merkle-mountain-range", - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-mmr-primitives", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-mmr-primitives" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "serde", - "sp-api", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-multisig" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-ocex-lmp" -version = "4.0.0-dev" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "ias-verify", - "log", - "pallet-assets", - "pallet-balances", - "pallet-timestamp", - "parity-scale-codec 3.1.2", - "polkadex-primitives", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-offences" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "log", - "pallet-balances", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-runtime", - "sp-staking", - "sp-std", -] - -[[package]] -name = "pallet-polkadex-ido-primitives" -version = "0.1.0" -dependencies = [ - "parity-scale-codec 3.1.2", - "polkadex-primitives", - "serde", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-preimage" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-proxy" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-randomness-collective-flip" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "safe-mix", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-recovery" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-referenda" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "assert_matches", - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-scheduler" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-session" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "log", - "pallet-timestamp", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-trie", -] - -[[package]] -name = "pallet-society" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "rand_chacha 0.2.2", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-staking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-election-provider-support", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "pallet-session", - "parity-scale-codec 3.1.2", - "rand_chacha 0.2.2", - "scale-info 2.1.2", - "serde", - "sp-application-crypto", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", -] - -[[package]] -name = "pallet-staking-reward-curve" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pallet-state-trie-migration" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-sudo" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-timestamp", -] - -[[package]] -name = "pallet-tips" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-treasury", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-transaction-payment" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "smallvec", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-transaction-payment-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "pallet-transaction-payment-rpc-runtime-api", - "parity-scale-codec 3.1.2", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "pallet-transaction-payment-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "pallet-transaction-payment", - "parity-scale-codec 3.1.2", - "sp-api", - "sp-runtime", -] - -[[package]] -name = "pallet-transaction-storage" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "pallet-balances", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-transaction-storage-proof", -] - -[[package]] -name = "pallet-treasury" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "pallet-balances", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-uniques" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-utility" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-vesting" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-whitelist" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-api", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "parity-db" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a7901b85874402471e131de3332dde0e51f38432c69a3853627c8e25433048" -dependencies = [ - "blake2-rfc", - "crc32fast", - "fs2", - "hex", - "libc", - "log", - "lz4", - "memmap2 0.2.3", - "parking_lot 0.11.2", - "rand 0.8.5", - "snap", -] - -[[package]] -name = "parity-scale-codec" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" -dependencies = [ - "arrayvec 0.7.2", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive 2.3.1", -] - -[[package]] -name = "parity-scale-codec" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8b44461635bbb1a0300f100a841e571e7d919c81c73075ef5d152ffdb521066" -dependencies = [ - "arrayvec 0.7.2", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive 3.1.2", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c45ed1f39709f5a89338fab50e59816b2e8815f5bb58276e7ddf9afd495f73f8" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "parity-send-wrapper" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" - -[[package]] -name = "parity-tokio-ipc" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6" -dependencies = [ - "futures 0.3.21", - "libc", - "log", - "rand 0.7.3", - "tokio", - "winapi 0.3.9", -] - -[[package]] -name = "parity-util-mem" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" -dependencies = [ - "cfg-if 1.0.0", - "hashbrown 0.12.1", - "impl-trait-for-tuples", - "parity-util-mem-derive", - "parking_lot 0.12.1", - "primitive-types", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", -] - -[[package]] -name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder", -] - -[[package]] -name = "parity-wasm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" - -[[package]] -name = "parity-ws" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5983d3929ad50f12c3eb9a6743f19d691866ecd44da74c0a3308c3f8a56df0c6" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio 0.6.23", - "mio-extras", - "rand 0.7.3", - "sha-1 0.8.2", - "slab", - "url 2.2.2", -] - -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core 0.9.3", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if 1.0.0", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "paste" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" - -[[package]] -name = "pbkdf2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac 0.8.0", -] - -[[package]] -name = "pbkdf2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" -dependencies = [ - "crypto-mac 0.11.1", -] - -[[package]] -name = "pdex-migration" -version = "1.1.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-balances", - "pallet-sudo", - "parity-scale-codec 3.1.2", - "rand 0.8.5", - "scale-info 2.1.2", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" -dependencies = [ - "maplit", - "pest", - "sha-1 0.8.2", -] - -[[package]] -name = "petgraph" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "pin-project" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909" -dependencies = [ - "pin-project-internal 0.4.29", -] - -[[package]] -name = "pin-project" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" -dependencies = [ - "pin-project-internal 1.0.10", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" - -[[package]] -name = "platforms" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989d43012e2ca1c4a02507c67282691a0a3207f9dc67cec596b43fe925b3d325" - -[[package]] -name = "polkadex-ido" -version = "0.1.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-support-test", - "frame-system", - "pallet-assets", - "pallet-balances", - "pallet-polkadex-ido-primitives", - "parity-scale-codec 3.1.2", - "polkadex-primitives", - "rand 0.8.5", - "rand_chacha 0.3.1", - "rustc-hex", - "scale-info 2.1.2", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "polkadex-ido-rpc" -version = "0.1.0" -dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "pallet-polkadex-ido-primitives", - "parity-scale-codec 3.1.2", - "polkadex-ido-runtime-api", - "polkadex-primitives", - "serde", - "sp-api", - "sp-blockchain", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "polkadex-ido-runtime-api" -version = "0.1.0" -dependencies = [ - "pallet-polkadex-ido-primitives", - "parity-scale-codec 3.1.2", - "polkadex-primitives", - "sp-api", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "polkadex-node" -version = "3.0.0" -dependencies = [ - "assert_cmd", - "async-std", - "clap 3.1.18", - "frame-benchmarking", - "frame-benchmarking-cli", - "frame-support", - "frame-system", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "futures 0.3.21", - "hex-literal", - "itertools", - "jsonrpc-core", - "log", - "nix", - "node-executor", - "node-polkadex-runtime", - "pallet-asset-tx-payment", - "pallet-contracts", - "pallet-contracts-rpc", - "pallet-im-online", - "pallet-staking", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc", - "parity-scale-codec 3.1.2", - "parking_lot 0.11.2", - "platforms", - "polkadex-ido-rpc", - "polkadex-primitives", - "rand 0.7.3", - "regex", - "sc-authority-discovery", - "sc-basic-authorship", - "sc-chain-spec", - "sc-cli", - "sc-client-api", - "sc-consensus", - "sc-consensus-babe", - "sc-consensus-babe-rpc", - "sc-consensus-epochs", - "sc-consensus-slots", - "sc-consensus-uncles", - "sc-executor", - "sc-finality-grandpa", - "sc-finality-grandpa-rpc", - "sc-keystore", - "sc-network", - "sc-rpc", - "sc-rpc-api", - "sc-service", - "sc-service-test", - "sc-sync-state-rpc", - "sc-telemetry", - "sc-transaction-pool", - "sc-transaction-pool-api", - "serde", - "serde_json", - "soketto 0.4.2", - "sp-api", - "sp-authority-discovery", - "sp-authorship", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-core", - "sp-finality-grandpa", - "sp-inherents", - "sp-keyring", - "sp-keystore", - "sp-runtime", - "sp-timestamp", - "sp-tracing", - "sp-transaction-pool", - "sp-trie", - "structopt", - "substrate-build-script-utils", - "substrate-frame-rpc-system", - "tempfile", - "try-runtime-cli", -] - -[[package]] -name = "polkadex-primitives" -version = "0.1.0" -source = "git+https://github.com/Polkadex-Substrate/polkadex-primitives.git?branch=polkadot-v0.9.19#c707a76ceaae43de478b965e3b37e0687412a5f4" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-application-crypto", - "sp-core", - "sp-runtime", -] - -[[package]] -name = "polling" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "log", - "wepoll-ffi", - "winapi 0.3.9", -] - -[[package]] -name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures 0.2.2", - "opaque-debug 0.3.0", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures 0.2.2", - "opaque-debug 0.3.0", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "predicates" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c" -dependencies = [ - "difflib", - "itertools", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1c2388b1513e1b605fcec39a95e0a9e8ef088f71443ef37099fa9ae6673fcb" - -[[package]] -name = "predicates-tree" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032" -dependencies = [ - "predicates-core", - "termtree", -] - -[[package]] -name = "pretty_assertions" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89f989ac94207d048d92db058e4f6ec7342b0971fc58d1271ca148b799b3563" -dependencies = [ - "ansi_term", - "ctor", - "diff", - "output_vt100", -] - -[[package]] -name = "primitive-types" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-serde", - "scale-info 2.1.2", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro-crate" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "prometheus" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cface98dfa6d645ea4c789839f176e4b072265d085bfcc48eaa8d137f58d3c39" -dependencies = [ - "cfg-if 1.0.0", - "fnv", - "lazy_static", - "memchr", - "parking_lot 0.12.1", - "thiserror", -] - -[[package]] -name = "prost" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" -dependencies = [ - "bytes 1.1.0", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" -dependencies = [ - "bytes 1.1.0", - "heck 0.3.3", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prost", - "prost-types", - "regex", - "tempfile", - "which 4.2.5", -] - -[[package]] -name = "prost-derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" -dependencies = [ - "bytes 1.1.0", - "prost", -] - -[[package]] -name = "psm" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871372391786ccec00d3c5d3d6608905b3d4db263639cfe075d3b60a736d115a" -dependencies = [ - "cc", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quicksink" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" -dependencies = [ - "futures-core", - "futures-sink", - "pin-project-lite 0.1.12", -] - -[[package]] -name = "quote" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom 0.2.6", -] - -[[package]] -name = "rand_distr" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.6", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "ref-cast" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685d58625b6c2b83e4cc88a27c4bf65adb7b6b16dbdc413e515c9405b47432ab" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a043824e29c94169374ac5183ac0ed43f5724dc4556b19568007486bd840fa1f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "regalloc" -version = "0.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d808cff91dfca7b239d40b972ba628add94892b1d9e19a842aedc5cfae8ab1a" -dependencies = [ - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" - -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi 0.3.9", -] - -[[package]] -name = "remote-externalities" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "env_logger", - "jsonrpsee", - "log", - "parity-scale-codec 3.1.2", - "serde", - "serde_json", - "sp-core", - "sp-io", - "sp-runtime", - "sp-version", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "resolv-conf" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" -dependencies = [ - "hostname", - "quick-error", -] - -[[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - -[[package]] -name = "ring" -version = "0.16.9" -source = "git+https://github.com/scs/webpki-nostd.git#935d31c36fa9b6d55a3226572eaf2b3ded7cf437" -dependencies = [ - "cc", - "libc", - "spin", - "untrusted", - "which 3.1.1", - "winapi 0.3.9", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi 0.3.9", -] - -[[package]] -name = "rocksdb" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" -dependencies = [ - "libc", - "librocksdb-sys", -] - -[[package]] -name = "rpassword" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -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 = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.10", -] - -[[package]] -name = "rustix" -version = "0.31.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2dcfc2778a90e38f56a708bfc90572422e11d6c7ee233d053d1f782cf9df6d2" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "winapi 0.3.9", -] - -[[package]] -name = "rustls" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" -dependencies = [ - "base64 0.13.0", - "log", - "ring 0.16.20", - "sct 0.6.1", - "webpki 0.21.4", -] - -[[package]] -name = "rustls" -version = "0.20.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" -dependencies = [ - "log", - "ring 0.16.20", - "sct 0.7.0", - "webpki 0.22.0", -] - -[[package]] -name = "rustls-native-certs" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" -dependencies = [ - "openssl-probe", - "rustls 0.19.1", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-native-certs" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" -dependencies = [ - "openssl-probe", - "rustls-pemfile", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" -dependencies = [ - "base64 0.13.0", -] - -[[package]] -name = "rustversion" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" - -[[package]] -name = "rw-stream-sink" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" -dependencies = [ - "futures 0.3.21", - "pin-project 0.4.29", - "static_assertions", -] - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "safe-mix" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d3d055a2582e6b00ed7a31c1524040aa391092bf636328350813f3a0605215c" -dependencies = [ - "rustc_version 0.2.3", -] - -[[package]] -name = "salsa20" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" -dependencies = [ - "cipher", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "sc-allocator" -version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "log", - "sp-core", - "sp-wasm-interface", - "thiserror", -] - -[[package]] -name = "sc-authority-discovery" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "futures 0.3.21", - "futures-timer", - "ip_network", - "libp2p", - "log", - "parity-scale-codec 3.1.2", - "prost", - "prost-build", - "rand 0.7.3", - "sc-client-api", - "sc-network", - "sp-api", - "sp-authority-discovery", - "sp-blockchain", - "sp-core", - "sp-keystore", - "sp-runtime", - "substrate-prometheus-endpoint", - "thiserror", -] - -[[package]] -name = "sc-basic-authorship" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "futures-timer", - "log", - "parity-scale-codec 3.1.2", - "sc-block-builder", - "sc-client-api", - "sc-proposer-metrics", - "sc-telemetry", - "sc-transaction-pool-api", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "substrate-prometheus-endpoint", -] - -[[package]] -name = "sc-block-builder" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "sc-client-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", -] - -[[package]] -name = "sc-chain-spec" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "impl-trait-for-tuples", - "memmap2 0.5.4", - "parity-scale-codec 3.1.2", - "sc-chain-spec-derive", - "sc-network", - "sc-telemetry", - "serde", - "serde_json", - "sp-core", - "sp-runtime", -] - -[[package]] -name = "sc-chain-spec-derive" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sc-cli" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "chrono", - "clap 3.1.18", - "fdlimit", - "futures 0.3.21", - "hex", - "libp2p", - "log", - "names", - "parity-scale-codec 3.1.2", - "rand 0.7.3", - "regex", - "rpassword", - "sc-client-api", - "sc-keystore", - "sc-network", - "sc-service", - "sc-telemetry", - "sc-tracing", - "sc-utils", - "serde", - "serde_json", - "sp-blockchain", - "sp-core", - "sp-keyring", - "sp-keystore", - "sp-panic-handler", - "sp-runtime", - "sp-version", - "thiserror", - "tiny-bip39", - "tokio", -] - -[[package]] -name = "sc-client-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "fnv", - "futures 0.3.21", - "hash-db", - "log", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "sc-executor", - "sc-transaction-pool-api", - "sc-utils", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-database", - "sp-externalities", - "sp-keystore", - "sp-runtime", - "sp-state-machine", - "sp-storage", - "sp-trie", - "substrate-prometheus-endpoint", -] - -[[package]] -name = "sc-client-db" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "hash-db", - "kvdb", - "kvdb-memorydb", - "kvdb-rocksdb", - "linked-hash-map", - "log", - "parity-db", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "sc-client-api", - "sc-state-db", - "sp-arithmetic", - "sp-blockchain", - "sp-core", - "sp-database", - "sp-runtime", - "sp-state-machine", - "sp-trie", -] - -[[package]] -name = "sc-consensus" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "futures 0.3.21", - "futures-timer", - "libp2p", - "log", - "parking_lot 0.12.1", - "sc-client-api", - "sc-utils", - "serde", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "sp-state-machine", - "substrate-prometheus-endpoint", - "thiserror", -] - -[[package]] -name = "sc-consensus-babe" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "fork-tree", - "futures 0.3.21", - "log", - "merlin", - "num-bigint", - "num-rational 0.2.4", - "num-traits", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "rand 0.7.3", - "retain_mut", - "sc-client-api", - "sc-consensus", - "sc-consensus-epochs", - "sc-consensus-slots", - "sc-keystore", - "sc-telemetry", - "schnorrkel", - "serde", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-consensus-slots", - "sp-consensus-vrf", - "sp-core", - "sp-inherents", - "sp-io", - "sp-keystore", - "sp-runtime", - "sp-version", - "substrate-prometheus-endpoint", - "thiserror", -] - -[[package]] -name = "sc-consensus-babe-rpc" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "sc-consensus-babe", - "sc-consensus-epochs", - "sc-rpc-api", - "serde", - "sp-api", - "sp-application-crypto", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-core", - "sp-keystore", - "sp-runtime", - "thiserror", -] - -[[package]] -name = "sc-consensus-epochs" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "fork-tree", - "parity-scale-codec 3.1.2", - "sc-client-api", - "sc-consensus", - "sp-blockchain", - "sp-runtime", -] - -[[package]] -name = "sc-consensus-slots" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "futures 0.3.21", - "futures-timer", - "log", - "parity-scale-codec 3.1.2", - "sc-client-api", - "sc-consensus", - "sc-telemetry", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-timestamp", - "thiserror", -] - -[[package]] -name = "sc-consensus-uncles" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "sc-client-api", - "sp-authorship", - "sp-runtime", - "thiserror", -] - -[[package]] -name = "sc-executor" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "lazy_static", - "lru 0.7.6", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "sc-executor-common", - "sc-executor-wasmi", - "sc-executor-wasmtime", - "sp-api", - "sp-core", - "sp-core-hashing-proc-macro", - "sp-externalities", - "sp-io", - "sp-panic-handler", - "sp-runtime-interface", - "sp-tasks", - "sp-trie", - "sp-version", - "sp-wasm-interface", - "tracing", - "wasmi", -] - -[[package]] -name = "sc-executor-common" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "environmental", - "parity-scale-codec 3.1.2", - "sc-allocator", - "sp-core", - "sp-maybe-compressed-blob", - "sp-serializer", - "sp-wasm-interface", - "thiserror", - "wasm-instrument", - "wasmi", -] - -[[package]] -name = "sc-executor-wasmi" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "log", - "parity-scale-codec 3.1.2", - "sc-allocator", - "sc-executor-common", - "scoped-tls", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", - "wasmi", -] - -[[package]] -name = "sc-executor-wasmtime" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "log", - "parity-scale-codec 3.1.2", - "parity-wasm 0.42.2", - "sc-allocator", - "sc-executor-common", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", - "wasmtime", -] - -[[package]] -name = "sc-finality-grandpa" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "ahash", - "async-trait", - "dyn-clone", - "finality-grandpa", - "fork-tree", - "futures 0.3.21", - "futures-timer", - "hex", - "log", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "rand 0.8.5", - "sc-block-builder", - "sc-chain-spec", - "sc-client-api", - "sc-consensus", - "sc-keystore", - "sc-network", - "sc-network-gossip", - "sc-telemetry", - "sc-utils", - "serde_json", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-finality-grandpa", - "sp-keystore", - "sp-runtime", - "substrate-prometheus-endpoint", - "thiserror", -] - -[[package]] -name = "sc-finality-grandpa-rpc" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "finality-grandpa", - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "jsonrpc-pubsub", - "log", - "parity-scale-codec 3.1.2", - "sc-client-api", - "sc-finality-grandpa", - "sc-rpc", - "serde", - "serde_json", - "sp-blockchain", - "sp-core", - "sp-runtime", - "thiserror", -] - -[[package]] -name = "sc-informant" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "ansi_term", - "futures 0.3.21", - "futures-timer", - "log", - "parity-util-mem", - "sc-client-api", - "sc-network", - "sc-transaction-pool-api", - "sp-blockchain", - "sp-runtime", -] - -[[package]] -name = "sc-keystore" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "hex", - "parking_lot 0.12.1", - "serde_json", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "thiserror", -] - -[[package]] -name = "sc-network" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "asynchronous-codec 0.5.0", - "bitflags", - "bytes 1.1.0", - "cid", - "either", - "fnv", - "fork-tree", - "futures 0.3.21", - "futures-timer", - "hex", - "ip_network", - "libp2p", - "linked-hash-map", - "linked_hash_set", - "log", - "lru 0.7.6", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "pin-project 1.0.10", - "prost", - "prost-build", - "rand 0.7.3", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sc-peerset", - "sc-utils", - "serde", - "serde_json", - "smallvec", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-finality-grandpa", - "sp-runtime", - "substrate-prometheus-endpoint", - "thiserror", - "unsigned-varint 0.6.0", - "void", - "zeroize", -] - -[[package]] -name = "sc-network-gossip" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "ahash", - "futures 0.3.21", - "futures-timer", - "libp2p", - "log", - "lru 0.7.6", - "sc-network", - "sp-runtime", - "substrate-prometheus-endpoint", - "tracing", -] - -[[package]] -name = "sc-offchain" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "bytes 1.1.0", - "fnv", - "futures 0.3.21", - "futures-timer", - "hex", - "hyper", - "hyper-rustls", - "num_cpus", - "once_cell", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "rand 0.7.3", - "sc-client-api", - "sc-network", - "sc-utils", - "sp-api", - "sp-core", - "sp-offchain", - "sp-runtime", - "threadpool", - "tracing", -] - -[[package]] -name = "sc-peerset" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "libp2p", - "log", - "sc-utils", - "serde_json", - "wasm-timer", -] - -[[package]] -name = "sc-proposer-metrics" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "log", - "substrate-prometheus-endpoint", -] - -[[package]] -name = "sc-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "hash-db", - "jsonrpc-core", - "jsonrpc-pubsub", - "log", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "sc-block-builder", - "sc-chain-spec", - "sc-client-api", - "sc-rpc-api", - "sc-tracing", - "sc-transaction-pool-api", - "sc-utils", - "serde_json", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-keystore", - "sp-offchain", - "sp-rpc", - "sp-runtime", - "sp-session", - "sp-version", -] - -[[package]] -name = "sc-rpc-api" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "jsonrpc-pubsub", - "log", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "sc-chain-spec", - "sc-transaction-pool-api", - "scale-info 2.1.2", - "serde", - "serde_json", - "sp-core", - "sp-rpc", - "sp-runtime", - "sp-tracing", - "sp-version", - "thiserror", -] - -[[package]] -name = "sc-rpc-server" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-http-server", - "jsonrpc-ipc-server", - "jsonrpc-pubsub", - "jsonrpc-ws-server", - "log", - "serde_json", - "substrate-prometheus-endpoint", - "tokio", -] - -[[package]] -name = "sc-service" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "directories", - "exit-future", - "futures 0.3.21", - "futures-timer", - "hash-db", - "jsonrpc-core", - "jsonrpc-pubsub", - "log", - "parity-scale-codec 3.1.2", - "parity-util-mem", - "parking_lot 0.12.1", - "pin-project 1.0.10", - "rand 0.7.3", - "sc-block-builder", - "sc-chain-spec", - "sc-client-api", - "sc-client-db", - "sc-consensus", - "sc-executor", - "sc-informant", - "sc-keystore", - "sc-network", - "sc-offchain", - "sc-rpc", - "sc-rpc-server", - "sc-telemetry", - "sc-tracing", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sc-utils", - "serde", - "serde_json", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-externalities", - "sp-inherents", - "sp-keystore", - "sp-runtime", - "sp-session", - "sp-state-machine", - "sp-storage", - "sp-tracing", - "sp-transaction-pool", - "sp-transaction-storage-proof", - "sp-trie", - "sp-version", - "substrate-prometheus-endpoint", - "tempfile", - "thiserror", - "tokio", - "tracing", - "tracing-futures", -] - -[[package]] -name = "sc-service-test" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "fdlimit", - "futures 0.3.21", - "hex", - "hex-literal", - "log", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "sc-block-builder", - "sc-client-api", - "sc-client-db", - "sc-consensus", - "sc-executor", - "sc-network", - "sc-service", - "sc-transaction-pool-api", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-runtime", - "sp-state-machine", - "sp-storage", - "sp-tracing", - "sp-trie", - "substrate-test-runtime", - "substrate-test-runtime-client", - "tempfile", - "tokio", -] - -[[package]] -name = "sc-state-db" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "log", - "parity-scale-codec 3.1.2", - "parity-util-mem", - "parity-util-mem-derive", - "parking_lot 0.12.1", - "sc-client-api", - "sp-core", -] - -[[package]] -name = "sc-sync-state-rpc" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "parity-scale-codec 3.1.2", - "sc-chain-spec", - "sc-client-api", - "sc-consensus-babe", - "sc-consensus-epochs", - "sc-finality-grandpa", - "serde", - "serde_json", - "sp-blockchain", - "sp-runtime", - "thiserror", -] - -[[package]] -name = "sc-telemetry" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "chrono", - "futures 0.3.21", - "libp2p", - "log", - "parking_lot 0.12.1", - "pin-project 1.0.10", - "rand 0.7.3", - "serde", - "serde_json", - "thiserror", - "wasm-timer", -] - -[[package]] -name = "sc-tracing" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "ansi_term", - "atty", - "chrono", - "lazy_static", - "libc", - "log", - "once_cell", - "parking_lot 0.12.1", - "regex", - "rustc-hash", - "sc-client-api", - "sc-rpc-server", - "sc-tracing-proc-macro", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", - "sp-tracing", - "thiserror", - "tracing", - "tracing-log", - "tracing-subscriber", -] - -[[package]] -name = "sc-tracing-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sc-transaction-pool" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "futures-timer", - "linked-hash-map", - "log", - "parity-scale-codec 3.1.2", - "parity-util-mem", - "parking_lot 0.12.1", - "retain_mut", - "sc-client-api", - "sc-transaction-pool-api", - "sc-utils", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-tracing", - "sp-transaction-pool", - "substrate-prometheus-endpoint", - "thiserror", -] - -[[package]] -name = "sc-transaction-pool-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "log", - "serde", - "sp-blockchain", - "sp-runtime", - "thiserror", -] - -[[package]] -name = "sc-utils" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "futures-timer", - "lazy_static", - "log", - "parking_lot 0.12.1", - "prometheus", -] - -[[package]] -name = "scale-info" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c55b744399c25532d63a0d2789b109df8d46fc93752d46b0782991a931a782f" -dependencies = [ - "cfg-if 1.0.0", - "derive_more", - "parity-scale-codec 2.3.1", - "scale-info-derive 1.0.0", -] - -[[package]] -name = "scale-info" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" -dependencies = [ - "bitvec", - "cfg-if 1.0.0", - "derive_more", - "parity-scale-codec 3.1.2", - "scale-info-derive 2.1.2", - "serde", -] - -[[package]] -name = "scale-info-derive" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baeb2780690380592f86205aa4ee49815feb2acad8c2f59e6dd207148c3f1fcd" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "scale-info-derive" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "schannel" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" -dependencies = [ - "lazy_static", - "windows-sys", -] - -[[package]] -name = "schnorrkel" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "curve25519-dalek 2.1.3", - "getrandom 0.1.16", - "merlin", - "rand 0.7.3", - "rand_core 0.5.1", - "sha2 0.8.2", - "subtle", - "zeroize", -] - -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "secp256k1" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" -dependencies = [ - "cc", -] - -[[package]] -name = "secrecy" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" -dependencies = [ - "zeroize", -] - -[[package]] -name = "security-framework" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" -dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", -] - -[[package]] -name = "semver" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" -dependencies = [ - "serde", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - -[[package]] -name = "serde" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" -dependencies = [ - "itoa 1.0.2", - "ryu", - "serde", -] - -[[package]] -name = "serde_nanos" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44969a61f5d316be20a42ff97816efb3b407a924d06824c3d8a49fa8450de0e" -dependencies = [ - "serde", -] - -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha-1" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures 0.2.2", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures 0.2.2", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha2" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures 0.2.2", - "digest 0.10.3", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha3" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86" -dependencies = [ - "digest 0.10.3", - "keccak", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "signature" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" - -[[package]] -name = "simba" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" -dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", -] - -[[package]] -name = "slab" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" - -[[package]] -name = "smallvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" - -[[package]] -name = "snap" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" - -[[package]] -name = "snow" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6142f7c25e94f6fd25a32c3348ec230df9109b463f59c8c7acc4bd34936babb7" -dependencies = [ - "aes-gcm", - "blake2 0.9.2", - "chacha20poly1305", - "rand 0.8.5", - "rand_core 0.6.3", - "ring 0.16.20", - "rustc_version 0.3.3", - "sha2 0.9.9", - "subtle", - "x25519-dalek", -] - -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "socket2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "soketto" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88" -dependencies = [ - "base64 0.12.3", - "bytes 0.5.6", - "futures 0.3.21", - "httparse", - "log", - "rand 0.7.3", - "sha-1 0.9.8", -] - -[[package]] -name = "soketto" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" -dependencies = [ - "base64 0.13.0", - "bytes 1.1.0", - "flate2", - "futures 0.3.21", - "httparse", - "log", - "rand 0.8.5", - "sha-1 0.9.8", -] - -[[package]] -name = "sp-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec 3.1.2", - "sp-api-proc-macro", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-version", - "thiserror", -] - -[[package]] -name = "sp-api-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "blake2 0.10.4", - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-core", - "sp-io", - "sp-std", -] - -[[package]] -name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-debug-derive", - "sp-std", - "static_assertions", -] - -[[package]] -name = "sp-authority-discovery" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-api", - "sp-application-crypto", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "parity-scale-codec 3.1.2", - "sp-inherents", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-block-builder" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-blockchain" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "log", - "lru 0.7.6", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "sp-api", - "sp-consensus", - "sp-database", - "sp-runtime", - "sp-state-machine", - "thiserror", -] - -[[package]] -name = "sp-consensus" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "futures 0.3.21", - "futures-timer", - "log", - "parity-scale-codec 3.1.2", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-version", - "thiserror", -] - -[[package]] -name = "sp-consensus-aura" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-api", - "sp-application-crypto", - "sp-consensus", - "sp-consensus-slots", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-timestamp", -] - -[[package]] -name = "sp-consensus-babe" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "merlin", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-api", - "sp-application-crypto", - "sp-consensus", - "sp-consensus-slots", - "sp-consensus-vrf", - "sp-core", - "sp-inherents", - "sp-keystore", - "sp-runtime", - "sp-std", - "sp-timestamp", -] - -[[package]] -name = "sp-consensus-slots" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-arithmetic", - "sp-runtime", - "sp-std", - "sp-timestamp", -] - -[[package]] -name = "sp-consensus-vrf" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "schnorrkel", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "base58", - "bitflags", - "blake2-rfc", - "byteorder", - "dyn-clonable", - "ed25519-dalek", - "futures 0.3.21", - "hash-db", - "hash256-std-hasher", - "hex", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin", - "num-traits", - "parity-scale-codec 3.1.2", - "parity-util-mem", - "parking_lot 0.12.1", - "primitive-types", - "rand 0.7.3", - "regex", - "scale-info 2.1.2", - "schnorrkel", - "secp256k1", - "secrecy", - "serde", - "sp-core-hashing", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std", - "sp-storage", - "ss58-registry", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "wasmi", - "zeroize", -] - -[[package]] -name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "blake2 0.10.4", - "byteorder", - "digest 0.10.3", - "sha2 0.10.2", - "sha3 0.10.1", - "sp-std", - "twox-hash", -] - -[[package]] -name = "sp-core-hashing-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro2", - "quote", - "sp-core-hashing", - "syn", -] - -[[package]] -name = "sp-database" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "kvdb", - "parking_lot 0.12.1", -] - -[[package]] -name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "environmental", - "parity-scale-codec 3.1.2", - "sp-std", - "sp-storage", -] - -[[package]] -name = "sp-finality-grandpa" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "finality-grandpa", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-inherents" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "impl-trait-for-tuples", - "parity-scale-codec 3.1.2", - "sp-core", - "sp-runtime", - "sp-std", - "thiserror", -] - -[[package]] -name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "hash-db", - "libsecp256k1", - "log", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "secp256k1", - "sp-core", - "sp-externalities", - "sp-keystore", - "sp-runtime-interface", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-trie", - "sp-wasm-interface", - "tracing", - "tracing-core", -] - -[[package]] -name = "sp-keyring" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "lazy_static", - "sp-core", - "sp-runtime", - "strum", -] - -[[package]] -name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "futures 0.3.21", - "merlin", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "schnorrkel", - "serde", - "sp-core", - "sp-externalities", - "thiserror", -] - -[[package]] -name = "sp-maybe-compressed-blob" -version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "thiserror", - "zstd", -] - -[[package]] -name = "sp-npos-elections" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "serde", - "sp-arithmetic", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-offchain" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "sp-api", - "sp-core", - "sp-runtime", -] - -[[package]] -name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "backtrace", - "lazy_static", - "regex", -] - -[[package]] -name = "sp-rpc" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "rustc-hash", - "serde", - "sp-core", -] - -[[package]] -name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "parity-scale-codec 3.1.2", - "parity-util-mem", - "paste", - "rand 0.7.3", - "scale-info 2.1.2", - "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-std", -] - -[[package]] -name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec 3.1.2", - "primitive-types", - "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 = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "Inflector", - "proc-macro-crate 1.1.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-sandbox" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "log", - "parity-scale-codec 3.1.2", - "sp-core", - "sp-io", - "sp-std", - "sp-wasm-interface", - "wasmi", -] - -[[package]] -name = "sp-serializer" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "sp-session" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-api", - "sp-core", - "sp-runtime", - "sp-staking", - "sp-std", -] - -[[package]] -name = "sp-staking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "hash-db", - "log", - "num-traits", - "parity-scale-codec 3.1.2", - "parking_lot 0.12.1", - "rand 0.7.3", - "smallvec", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-std", - "sp-trie", - "thiserror", - "tracing", - "trie-root", -] - -[[package]] -name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" - -[[package]] -name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "impl-serde", - "parity-scale-codec 3.1.2", - "ref-cast", - "serde", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "sp-tasks" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "log", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime-interface", - "sp-std", -] - -[[package]] -name = "sp-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "futures-timer", - "log", - "parity-scale-codec 3.1.2", - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", - "thiserror", -] - -[[package]] -name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "sp-std", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-transaction-pool" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "sp-api", - "sp-runtime", -] - -[[package]] -name = "sp-transaction-storage-proof" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "log", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-trie", -] - -[[package]] -name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "hash-db", - "memory-db", - "parity-scale-codec 3.1.2", - "scale-info 2.1.2", - "sp-core", - "sp-std", - "thiserror", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-version" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "impl-serde", - "parity-scale-codec 3.1.2", - "parity-wasm 0.42.2", - "scale-info 2.1.2", - "serde", - "sp-core-hashing-proc-macro", - "sp-runtime", - "sp-std", - "sp-version-proc-macro", - "thiserror", -] - -[[package]] -name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "parity-scale-codec 3.1.2", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "impl-trait-for-tuples", - "log", - "parity-scale-codec 3.1.2", - "sp-std", - "wasmi", - "wasmtime", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "ss58-registry" -version = "1.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d804c8d48aeab838be31570866fce1130d275b563d49af08b4927a0bd561e7c" -dependencies = [ - "Inflector", - "num-format", - "proc-macro2", - "quote", - "serde", - "serde_json", - "unicode-xid", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "statrs" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" -dependencies = [ - "approx", - "lazy_static", - "nalgebra", - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap 2.34.0", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "strum" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "substrate-bip39" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" -dependencies = [ - "hmac 0.11.0", - "pbkdf2 0.8.0", - "schnorrkel", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "substrate-build-script-utils" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd540ba72520174c2c73ce96bf507eeba3cc8a481f58be92525b69110e1fa645" -dependencies = [ - "platforms", -] - -[[package]] -name = "substrate-frame-rpc-system" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "frame-system-rpc-runtime-api", - "futures 0.3.21", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "log", - "parity-scale-codec 3.1.2", - "sc-client-api", - "sc-rpc-api", - "sc-transaction-pool-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-core", - "sp-runtime", -] - -[[package]] -name = "substrate-prometheus-endpoint" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures-util", - "hyper", - "log", - "prometheus", - "thiserror", - "tokio", -] - -[[package]] -name = "substrate-test-client" -version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "async-trait", - "futures 0.3.21", - "hex", - "parity-scale-codec 3.1.2", - "sc-client-api", - "sc-client-db", - "sc-consensus", - "sc-executor", - "sc-offchain", - "sc-service", - "serde", - "serde_json", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-keyring", - "sp-keystore", - "sp-runtime", - "sp-state-machine", -] - -[[package]] -name = "substrate-test-runtime" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "beefy-primitives", - "cfg-if 1.0.0", - "frame-support", - "frame-system", - "frame-system-rpc-runtime-api", - "log", - "memory-db", - "pallet-babe", - "pallet-timestamp", - "parity-scale-codec 3.1.2", - "parity-util-mem", - "sc-service", - "scale-info 2.1.2", - "serde", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-consensus-aura", - "sp-consensus-babe", - "sp-core", - "sp-externalities", - "sp-finality-grandpa", - "sp-inherents", - "sp-io", - "sp-keyring", - "sp-offchain", - "sp-runtime", - "sp-runtime-interface", - "sp-session", - "sp-state-machine", - "sp-std", - "sp-transaction-pool", - "sp-trie", - "sp-version", - "substrate-wasm-builder", - "trie-db", -] - -[[package]] -name = "substrate-test-runtime-client" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "futures 0.3.21", - "parity-scale-codec 3.1.2", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "substrate-test-client", - "substrate-test-runtime", -] - -[[package]] -name = "substrate-wasm-builder" -version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "ansi_term", - "build-helper", - "cargo_metadata", - "sp-maybe-compressed-blob", - "strum", - "tempfile", - "toml", - "walkdir", - "wasm-gc-api", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "target-lexicon" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" - -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if 1.0.0", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.9", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "termtree" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" - -[[package]] -name = "test-token-provider" -version = "1.1.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-assets", - "pallet-balances", - "parity-scale-codec 3.1.2", - "polkadex-primitives", - "scale-info 2.1.2", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-keystore", - "sp-runtime", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "textwrap" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thousands" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" - -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "tikv-jemalloc-sys" -version = "0.4.3+5.2.1-patched.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" -dependencies = [ - "cc", - "fs_extra", - "libc", -] - -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", -] - -[[package]] -name = "tiny-bip39" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" -dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "1.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" -dependencies = [ - "bytes 1.1.0", - "libc", - "memchr", - "mio 0.8.3", - "num_cpus", - "once_cell", - "parking_lot 0.12.1", - "pin-project-lite 0.2.9", - "signal-hook-registry", - "socket2 0.4.4", - "tokio-macros", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-macros" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls 0.19.1", - "tokio", - "webpki 0.21.4", -] - -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.6", - "tokio", - "webpki 0.22.0", -] - -[[package]] -name = "tokio-stream" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" -dependencies = [ - "futures-core", - "pin-project-lite 0.2.9", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes 1.1.0", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.2.9", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" -dependencies = [ - "bytes 1.1.0", - "futures-core", - "futures-io", - "futures-sink", - "pin-project-lite 0.2.9", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "tower-service" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" - -[[package]] -name = "tracing" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" -dependencies = [ - "cfg-if 1.0.0", - "pin-project-lite 0.2.9", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project 1.0.10", - "tracing", -] - -[[package]] -name = "tracing-log" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" -dependencies = [ - "ansi_term", - "chrono", - "lazy_static", - "matchers", - "parking_lot 0.11.2", - "regex", - "serde", - "serde_json", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", - "tracing-serde", -] - -[[package]] -name = "trie-db" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" -dependencies = [ - "hash-db", - "hashbrown 0.12.1", - "log", - "rustc-hex", - "smallvec", -] - -[[package]] -name = "trie-root" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" -dependencies = [ - "hash-db", -] - -[[package]] -name = "trust-dns-proto" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca94d4e9feb6a181c690c4040d7a24ef34018d8313ac5044a61d21222ae24e31" -dependencies = [ - "async-trait", - "cfg-if 1.0.0", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.2.3", - "ipnet", - "lazy_static", - "log", - "rand 0.8.5", - "smallvec", - "thiserror", - "tinyvec", - "url 2.2.2", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecae383baad9995efaa34ce8e57d12c3f305e545887472a492b838f4b5cfb77a" -dependencies = [ - "cfg-if 1.0.0", - "futures-util", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "parking_lot 0.11.2", - "resolv-conf", - "smallvec", - "thiserror", - "trust-dns-proto", -] - -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - -[[package]] -name = "try-runtime-cli" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.19#174735ea1bb5fc4513519c45181d8df63d86f613" -dependencies = [ - "clap 3.1.18", - "jsonrpsee", - "log", - "parity-scale-codec 3.1.2", - "remote-externalities", - "sc-chain-spec", - "sc-cli", - "sc-executor", - "sc-service", - "serde", - "sp-core", - "sp-externalities", - "sp-io", - "sp-keystore", - "sp-runtime", - "sp-state-machine", - "sp-version", - "zstd", -] - -[[package]] -name = "trybuild" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "764b9e244b482a9b81bde596aa37aa6f1347bf8007adab25e59f901b32b4e0a0" -dependencies = [ - "dissimilar", - "glob", - "once_cell", - "serde", - "serde_derive", - "serde_json", - "termcolor", - "toml", -] - -[[package]] -name = "tt-call" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if 1.0.0", - "digest 0.10.3", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "uint" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" - -[[package]] -name = "unicode-ident" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" - -[[package]] -name = "unicode-normalization" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "unicode-xid" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" - -[[package]] -name = "universal-hash" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "unsigned-varint" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" - -[[package]] -name = "unsigned-varint" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35581ff83d4101e58b582e607120c7f5ffb17e632a980b1f38334d76b36908b2" -dependencies = [ - "asynchronous-codec 0.5.0", - "bytes 1.1.0", - "futures-io", - "futures-util", -] - -[[package]] -name = "unsigned-varint" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.1.0", - "futures-io", - "futures-util", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - -[[package]] -name = "url" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" -dependencies = [ - "form_urlencoded", - "idna 0.2.3", - "matches", - "percent-encoding 2.1.0", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "value-bag" -version = "1.0.0-alpha.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" -dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" - -[[package]] -name = "wasm-gc-api" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" -dependencies = [ - "log", - "parity-wasm 0.32.0", - "rustc-demangle", -] - -[[package]] -name = "wasm-instrument" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962e5b0401bbb6c887f54e69b8c496ea36f704df65db73e81fd5ff8dc3e63a9f" -dependencies = [ - "parity-wasm 0.42.2", -] - -[[package]] -name = "wasm-timer" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" -dependencies = [ - "futures 0.3.21", - "js-sys", - "parking_lot 0.11.2", - "pin-utils", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "wasmi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" -dependencies = [ - "downcast-rs", - "libc", - "libm", - "memory_units", - "num-rational 0.2.4", - "num-traits", - "parity-wasm 0.42.2", - "wasmi-validation", -] - -[[package]] -name = "wasmi-validation" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" -dependencies = [ - "parity-wasm 0.42.2", -] - -[[package]] -name = "wasmparser" -version = "0.81.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98930446519f63d00a836efdc22f67766ceae8dbcc1571379f2bcabc6b2b9abc" - -[[package]] -name = "wasmtime" -version = "0.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9c724da92e39a85d2231d4c2a942c8be295211441dbca581c6c3f3f45a9f00" -dependencies = [ - "anyhow", - "backtrace", - "bincode", - "cfg-if 1.0.0", - "cpp_demangle", - "indexmap", - "lazy_static", - "libc", - "log", - "object 0.27.1", - "paste", - "psm", - "rayon", - "region", - "rustc-demangle", - "serde", - "target-lexicon", - "wasmparser", - "wasmtime-cache", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-jit", - "wasmtime-runtime", - "winapi 0.3.9", -] - -[[package]] -name = "wasmtime-cache" -version = "0.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4439d99100298344567c0eb6916ad5864e99e54760b8177c427e529077fb30" -dependencies = [ - "anyhow", - "base64 0.13.0", - "bincode", - "directories-next", - "file-per-thread-logger", - "log", - "rustix", - "serde", - "sha2 0.9.9", - "toml", - "winapi 0.3.9", - "zstd", -] - -[[package]] -name = "wasmtime-cranelift" -version = "0.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1762765dd69245f00e5d9783b695039e449a7be0f9c5383e4c78465dd6131aeb" -dependencies = [ - "anyhow", - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", - "gimli", - "log", - "more-asserts", - "object 0.27.1", - "target-lexicon", - "thiserror", - "wasmparser", - "wasmtime-environ", -] - -[[package]] -name = "wasmtime-environ" -version = "0.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4468301d95ec71710bb6261382efe27d1296447711645e3dbabaea6e4de3504" -dependencies = [ - "anyhow", - "cranelift-entity", - "gimli", - "indexmap", - "log", - "more-asserts", - "object 0.27.1", - "serde", - "target-lexicon", - "thiserror", - "wasmparser", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-jit" -version = "0.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab0ae6e581ff014b470ec35847ea3c0b4c3ace89a55df5a04c802a11f4574e7d" -dependencies = [ - "addr2line", - "anyhow", - "bincode", - "cfg-if 1.0.0", - "gimli", - "object 0.27.1", - "region", - "rustix", - "serde", - "target-lexicon", - "thiserror", - "wasmtime-environ", - "wasmtime-runtime", - "winapi 0.3.9", -] - -[[package]] -name = "wasmtime-runtime" -version = "0.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9c28877ae37a367cda7b52b8887589816152e95dde9b7c80cc686f52761961" -dependencies = [ - "anyhow", - "backtrace", - "cc", - "cfg-if 1.0.0", - "indexmap", - "lazy_static", - "libc", - "log", - "mach", - "memoffset", - "more-asserts", - "rand 0.8.5", - "region", - "rustix", - "thiserror", - "wasmtime-environ", - "winapi 0.3.9", -] - -[[package]] -name = "wasmtime-types" -version = "0.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395726e8f5dd8c57cb0db445627b842343f7e29ed7489467fdf7953ed9d3cd4f" -dependencies = [ - "cranelift-entity", - "serde", - "thiserror", - "wasmparser", -] - -[[package]] -name = "web-sys" -version = "0.3.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.21.0" -source = "git+https://github.com/scs/webpki-nostd.git#935d31c36fa9b6d55a3226572eaf2b3ded7cf437" -dependencies = [ - "ring 0.16.20", - "ring 0.16.9", - "untrusted", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" -dependencies = [ - "webpki 0.21.4", -] - -[[package]] -name = "webpki-roots" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" -dependencies = [ - "webpki 0.22.0", -] - -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - -[[package]] -name = "which" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" -dependencies = [ - "failure", - "libc", -] - -[[package]] -name = "which" -version = "4.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" -dependencies = [ - "either", - "lazy_static", - "libc", -] - -[[package]] -name = "widestring" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "wyz" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" -dependencies = [ - "tap", -] - -[[package]] -name = "x25519-dalek" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" -dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "yamux" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107" -dependencies = [ - "futures 0.3.21", - "log", - "nohash-hasher", - "parking_lot 0.11.2", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "zeroize" -version = "1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94693807d016b2f2d2e14420eb3bfcca689311ff775dcf113d74ea624b7cdf07" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zstd" -version = "0.9.2+zstd.1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2390ea1bf6c038c39674f22d95f0564725fc06034a47129179810b2fc58caa54" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "4.1.3+zstd.1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e99d81b99fb3c2c2c794e3fe56c305c63d5173a16a46b5850b07c935ffc7db79" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "1.6.2+zstd.1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2daf2f248d9ea44454bfcb2516534e8b8ad2fc91bf818a1885495fc42bc8ac9f" -dependencies = [ - "cc", - "libc", -] diff --git a/Cargo.toml b/Cargo.toml index 1f2476799..4f192fb66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,5 @@ members = [ [patch."https://github.com/open-web3-stack/open-runtime-module-library.git"] -orml-vesting = { git = "https://github.com/Polkadex-Substrate/open-runtime-module-library.git", branch="polkadot-v0.9.19"} +orml-vesting = { git = "https://github.com/Polkadex-Substrate/open-runtime-module-library.git", branch="polkadot-v0.9.28"} diff --git a/client/thea/Cargo.toml b/client/thea/Cargo.toml deleted file mode 100644 index 394d4cc28..000000000 --- a/client/thea/Cargo.toml +++ /dev/null @@ -1,55 +0,0 @@ -[package] -name = "thea-client" -version = "0.1.0" -edition = "2021" -build ="build.rs" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -futures = "0.3" -hex = "0.4" -log = "0.4" -parking_lot = "0.11" -thiserror = "1.0" - -codec = { version = "3.0.0", package = "parity-scale-codec", features = ["derive"] } -prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch ="polkadot-v0.9.19" } -frame-support = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-io = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-api = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-application-crypto = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-arithmetic = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-blockchain = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-consensus = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-core = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate', features = ["full_crypto"] } -sp-keystore = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-runtime = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-inherents = { branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -sc-client-api = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sc-keystore = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } - -multi-party-ecdsa = { git = "https://github.com/ZenGo-X/multi-party-ecdsa.git", branch = "master"} -curv = { package = "curv-kzen", version = "0.9", default-features = false } -round-based = { version = "0.1.0", features = [] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.64" -thea-primitives = { path = "../../primitives/thea" } -rand = "0.8.4" -lazy_static = "1.4.0" -async-trait = { version = "0.1.50"} -#libsecp256k1 = { version = "0.7", default-features = false } -secp256k1 = {version="0.22.1", features = ["recovery"]} - -[dev-dependencies] -strum = { version = "0.21", features = ["derive"] } -sc-network = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sc-network-test = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sc-consensus = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-tracing = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", package = "sc-finality-grandpa" } -sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", package = "sp-finality-grandpa" } -thea-primitives = { path = "../../primitives/thea" } -serde = { version = "1", features = ["derive"] } -substrate-test-runtime-client = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -tokio = { version = "1.17.0" } -tempfile = "*" diff --git a/client/thea/README.md b/client/thea/README.md deleted file mode 100644 index 552037840..000000000 --- a/client/thea/README.md +++ /dev/null @@ -1 +0,0 @@ -# Thea Client \ No newline at end of file diff --git a/client/thea/build.rs b/client/thea/build.rs deleted file mode 100644 index 24a7349c9..000000000 --- a/client/thea/build.rs +++ /dev/null @@ -1,24 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Benchmarking setup for pallet-thea - -fn main() { - // Required for gmp to work in Apple M1 chips, brew install gmp - println!(r"cargo:rustc-link-search=/opt/homebrew/Cellar/gmp/6.2.1_1/lib"); -} diff --git a/client/thea/rpc/Cargo.toml b/client/thea/rpc/Cargo.toml deleted file mode 100644 index f79c18a28..000000000 --- a/client/thea/rpc/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "thea-client-rpc" -version = "0.1.0" -edition = "2021" -authors = ["Polkadex Technology"] -license = "GPL-3.0" -description = "RPC for Thea client for substrate" - -[dependencies] -serde = { version = "1.0.132", features = ["derive"] } -jsonrpc-core = "18.0.0" -jsonrpc-core-client = "18.0.0" -jsonrpc-derive = "18.0.0" -codec = { version = "2.2.0", package = "parity-scale-codec", features = ["derive"] } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -thea-client = { path = ".." } -thea-primitives = { path = "../../../primitives/thea" } diff --git a/client/thea/rpc/src/lib.rs b/client/thea/rpc/src/lib.rs deleted file mode 100644 index 8af26326d..000000000 --- a/client/thea/rpc/src/lib.rs +++ /dev/null @@ -1,61 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use jsonrpc_core::Result as RpcResult; -use jsonrpc_derive::rpc; -use std::sync::{mpsc::Receiver, Arc, Mutex}; -use thea_client::worker::RoundInfo; - -#[rpc] -pub trait TheaRpcApi { - type Metadata; - - #[rpc(name = "theaInfo")] - fn thea_info(&self) -> RpcResult; -} - -pub struct TheaRpcApiHandler { - cache: Mutex, - // this wrapping is required by rpc boundaries - updater: Arc>>, -} - -impl TheaRpcApiHandler { - pub fn new(updater: Arc>>) -> Self { - Self { updater, cache: Mutex::new(RoundInfo::default()) } - } -} - -impl TheaRpcApi for TheaRpcApiHandler { - type Metadata = sc_rpc::Metadata; - - fn thea_info(&self) -> RpcResult { - // read latest from the channel - if let Ok(upd_ref) = self.updater.lock() { - if let Ok(mut inner) = self.cache.lock() { - // exhausting sent updates if any to get latest state - while let Ok(update) = upd_ref.recv_timeout(std::time::Duration::from_millis(50)) { - *inner = update; - } - } - } - - // send cached data - Ok(self.cache.lock().map_err(|_| jsonrpc_core::Error::internal_error())?.clone()) - } -} diff --git a/client/thea/src/error.rs b/client/thea/src/error.rs deleted file mode 100644 index 938263566..000000000 --- a/client/thea/src/error.rs +++ /dev/null @@ -1,148 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! THEA gadget specific errors -//! -//! Used for THEA gadget interal error handling only - -use log::error; -use multi_party_ecdsa::protocols::multi_party_ecdsa::gg_2020::state_machine::{ - keygen::Error as StateMachineKeygenError, - sign::{Error as StateMachineOfflineStageError, SignError}, -}; -use round_based::IsCritical; -use sp_api::ApiError; -use std::{fmt::Debug, num::ParseIntError}; -use thea_primitives::{SigningError, ValidatorSetId}; - -#[derive(Debug, thiserror::Error, PartialEq)] -pub enum Error { - #[error("Keystore error: {0}")] - Keystore(String), - #[error("Signature error: {0}")] - Signature(String), - #[error("UnableToFindAuthorityFromKeystore")] - UnableToFindAuthorityFromKeystore, - #[error("Round Not found error: {0}")] - RoundNotFound(ValidatorSetId), - #[error("Stage Not found")] - StageNotFound, - #[error("Local Party Not Initialized error")] - LocalPartyNotInitialized, - #[error("Offline Party Not Initialized error")] - OfflinePartyNotInitialized, - #[error("Attempted to Pick Output before protocol completion")] - ProtocolNotComplete, - #[error("Error in encoding/decoding: {0}")] - SerdeError(String), - #[error("No block in Queue with Unsigned Payload")] - NoBlockInQueue, - #[error("Critical StateMachine error")] - CriticalKeygenStateMachineError, - #[error("StateMachine error")] - StateKeygenMachineError, - #[error("Critical OfflineStage StateMachine error")] - CriticalOfflineStageStateMachineError, - #[error("OfflineStage StateMachine error")] - StateOfflineStageMachineError, - #[error("local key is not initialized yet")] - LocalKeyNotReady, - #[error("No Pending Payloads")] - NoPayloadPending, - #[error("Error calling runtime api: {0}")] - RuntimeApiError(String), - #[error("Thea Runtime Api Error: {0}")] - TheaRuntimeApiError(String), - #[error("Error during ECDSA Signature generation: {0}")] - ECDSASignatureError(String), - #[error("Unable to find signing session")] - UnableToFindSigningSession, - #[error("Integer overflow")] - IntegerOverflow, - #[error("Given vector/slice/btreeset overflows the bounded version's limit")] - BoundedVecOrSliceError, - #[error("Libsecp256k1 Error: {0}")] - Libsecp256k1error(String), - #[error("Error: {0}")] - Other(String), -} - -impl From for Error { - fn from(err: serde_json::Error) -> Self { - Self::SerdeError(err.to_string()) - } -} - -impl From for Error { - fn from(err: StateMachineKeygenError) -> Self { - if err.is_critical() { - error!(target: "thea", "Critical State machine error: {:?}", err); - Self::CriticalKeygenStateMachineError - } else { - error!(target: "thea", " State machine error: {:?}", err); - Self::StateKeygenMachineError - } - } -} - -impl From<()> for Error { - fn from(_x: ()) -> Self { - Self::BoundedVecOrSliceError - } -} - -impl From for Error { - fn from(err: StateMachineOfflineStageError) -> Self { - if err.is_critical() { - error!(target: "thea", "Critical State machine error: {:?}", err); - Self::CriticalOfflineStageStateMachineError - } else { - error!(target: "thea", " State machine error: {:?}", err); - Self::StateOfflineStageMachineError - } - } -} - -impl From for Error { - fn from(err: ApiError) -> Self { - Self::RuntimeApiError(err.to_string()) - } -} -impl From for Error { - fn from(err: SigningError) -> Self { - Self::TheaRuntimeApiError(err.to_string()) - } -} - -impl From for Error { - fn from(err: SignError) -> Self { - Self::ECDSASignatureError(err.to_string()) - } -} - -impl From for Error { - fn from(err: ParseIntError) -> Self { - Self::Other(err.to_string()) - } -} - -impl From for Error { - fn from(err: secp256k1::Error) -> Self { - Self::Libsecp256k1error(err.to_string()) - } -} diff --git a/client/thea/src/inherents.rs b/client/thea/src/inherents.rs deleted file mode 100644 index 5983f3ea1..000000000 --- a/client/thea/src/inherents.rs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (C) 2020-2022 Polkadex OU -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use lazy_static::lazy_static; -use log::error; -use parking_lot::Mutex; -use sp_inherents::{ - InherentData, InherentDataProvider as InherentDataProviderTrait, InherentIdentifier, -}; - -use std::{collections::HashMap, fmt::Debug, sync::Arc}; - -use sp_application_crypto::ecdsa::Public; -use thea_primitives::{ - inherents::{InherentError, TheaPublicKeyInherentDataType, INHERENT_IDENTIFIER}, - ValidatorSetId, GENESIS_AUTHORITY_SET_ID, -}; - -lazy_static! { - static ref INHERENT_DATA_STORAGE: Arc> = - Arc::new(Mutex::new(InherentDataProvider::new())); -} -#[derive(Debug, Clone, Default)] -pub struct InherentDataProvider { - pub(crate) public_keys: HashMap, - pub(crate) current_set_id: ValidatorSetId, -} - -impl InherentDataProvider { - pub fn new() -> Self { - Self { public_keys: HashMap::new(), current_set_id: GENESIS_AUTHORITY_SET_ID } - } - - pub fn update_shared_public_key( - &mut self, - set_id: ValidatorSetId, - key: sp_core::ecdsa::Public, - ) -> Option { - self.current_set_id = set_id; - self.public_keys.insert(set_id, key) - } -} - -#[async_trait::async_trait] -impl InherentDataProviderTrait for InherentDataProvider { - fn provide_inherent_data( - &self, - inherent_data: &mut InherentData, - ) -> Result<(), sp_inherents::Error> { - // We can insert any data that implements [`codec::Encode`]. - if let Some(public_key) = self.public_keys.get(&self.current_set_id) { - inherent_data.put_data( - INHERENT_IDENTIFIER, - &TheaPublicKeyInherentDataType { - public_key: Some(public_key.clone()), - set_id: self.current_set_id, - }, - ) - } else { - inherent_data.put_data( - INHERENT_IDENTIFIER, - &TheaPublicKeyInherentDataType { public_key: None, set_id: self.current_set_id }, - ) - } - } - - /// When validating the inherents, the runtime implementation can throw errors. We support - /// two error modes, fatal and non-fatal errors. A fatal error means that the block is invalid - /// and this function here should return `Err(_)` to not import the block. Non-fatal errors - /// are allowed to be handled here in this function and the function should return `Ok(())` - /// if it could be handled. A non-fatal error is for example that a block is in the future - /// from the point of view of the local node. In such a case the block import for example - /// should be delayed until the block is valid. - /// - /// If this functions returns `None`, it means that it is not responsible for this error or - /// that the error could not be interpreted. - async fn try_handle_error( - &self, - identifier: &InherentIdentifier, - error: &[u8], - ) -> Option> { - // Check if this error belongs to us. - if *identifier != INHERENT_IDENTIFIER { - return None - } - - match InherentError::try_from(&INHERENT_IDENTIFIER, error)? { - InherentError::InvalidPublicKey(wrong_key) => { - if let Some(public_key) = wrong_key.public_key.clone() { - error!(target: "thea", "Invalid Public Key: {:?} in Imported Block", public_key); - Some(Err(sp_inherents::Error::Application(Box::from( - InherentError::InvalidPublicKey(wrong_key), - )))) - } else { - error!(target: "thea", "No Public Key found in Imported Block"); - Some(Err(sp_inherents::Error::Application(Box::from( - InherentError::InvalidPublicKey(wrong_key), - )))) - } - }, - InherentError::WrongInherentCall => { - error!(target: "thea", "Invalid Call inserted in block"); - Some(Err(sp_inherents::Error::Application(Box::from( - InherentError::WrongInherentCall, - )))) - }, - } - } -} - -/// Returns the THEA Public key if it is available -pub fn get_thea_inherent_data() -> InherentDataProvider { - INHERENT_DATA_STORAGE.lock().clone() -} - -/// Sets the THEA public key -pub fn update_shared_public_key( - set_id: ValidatorSetId, - public_key: sp_core::ecdsa::Public, -) -> Option { - INHERENT_DATA_STORAGE.lock().update_shared_public_key(set_id, public_key) -} diff --git a/client/thea/src/keystore.rs b/client/thea/src/keystore.rs deleted file mode 100644 index 65a2f45b3..000000000 --- a/client/thea/src/keystore.rs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (C) 2020-2022 Polkadex OU -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// This is file is modified from beefy-gadget from Parity Technologies (UK) Ltd. - -use std::convert::{From, TryInto}; - -use sp_application_crypto::{Public, RuntimeAppPublic}; -use sp_core::{keccak_256, Pair}; -use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; - -use log::warn; - -use thea_primitives::{ - crypto::{Public as TheaPublic, Signature}, - KEY_TYPE, -}; - -use crate::error; - -#[cfg(test)] -#[path = "keystore_tests.rs"] -pub mod tests; - -/// A Thea specific keystore implemented as a `Newtype`. This is basically a -/// wrapper around [`sp_keystore::SyncCryptoStore`] and allows to customize -/// common cryptographic functionality. -#[derive(Clone)] -pub struct TheaKeystore(Option); - -impl TheaKeystore { - /// Check if the keystore contains a private key for one of the public keys - /// contained in `keys`. A public key with a matching private key is known - /// as a local authority id. - /// - /// Return the public key for which we also do have a private key. If no - /// matching private key is found, `None` will be returned. - pub fn authority_id(&self, keys: &[TheaPublic]) -> Option { - let store = self.0.clone()?; - - // we do check for multiple private keys as a key store sanity check. - let public: Vec = keys - .iter() - .filter(|k| SyncCryptoStore::has_keys(&*store, &[(k.to_raw_vec(), KEY_TYPE)])) - .cloned() - .collect(); - - if public.len() > 1 { - warn!(target: "beefy", "🥩 Multiple private keys found for: {:?} ({})", public, public.len()); - } - - public.get(0).cloned() - } - - /// Sign `message` with the `public` key. - /// - /// Note that `message` usually will be pre-hashed before being signed. - /// - /// Return the message signature or an error in case of failure. - pub fn sign(&self, public: &TheaPublic, message: &[u8]) -> Result { - let store = self.0.clone().ok_or_else(|| error::Error::Keystore("no Keystore".into()))?; - - let msg = keccak_256(message); - let public = public.to_public_crypto_pair(); - - let sig = SyncCryptoStore::sign_with(&*store, KEY_TYPE, &public, &msg) - .map_err(|e| error::Error::Keystore(e.to_string()))? - .ok_or_else(|| error::Error::Signature("sign_with() failed".to_string()))?; - - // check that `sig` has the expected result type - let sig = sig.clone().try_into().map_err(|_| { - error::Error::Signature(format!("invalid signature {:?} for key {:?}", sig, public)) - })?; - - Ok(sig) - } - - /// Returns a vector of [`thea_primitives::crypto::Public`] keys which are currently supported - /// (i.e. found in the keystore). - pub fn public_keys(&self) -> Result, error::Error> { - let store = self.0.clone().ok_or_else(|| error::Error::Keystore("no Keystore".into()))?; - - let pk: Vec = SyncCryptoStore::sr25519_public_keys(&*store, KEY_TYPE) - .iter() - .map(|k| TheaPublic::from(*k)) - .collect(); - - Ok(pk) - } - - /// Use the `public` key to verify that `sig` is a valid signature for `message`. - /// - /// Return `true` if the signature is authentic, `false` otherwise. - pub fn verify(public: &TheaPublic, sig: &Signature, message: &[u8]) -> bool { - let msg = keccak_256(message); - let sig = sig.as_ref(); - let public = public.as_ref(); - - sp_core::sr25519::Pair::verify(sig, &msg, public) - } -} - -impl From> for TheaKeystore { - fn from(store: Option) -> TheaKeystore { - TheaKeystore(store) - } -} diff --git a/client/thea/src/keystore_tests.rs b/client/thea/src/keystore_tests.rs deleted file mode 100644 index d79517565..000000000 --- a/client/thea/src/keystore_tests.rs +++ /dev/null @@ -1,272 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use std::sync::Arc; - -use sc_keystore::LocalKeystore; -use sp_core::{ed25519, keccak_256, sr25519, Pair}; -use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; - -use thea_primitives::{crypto, KEY_TYPE}; - -use crate::{error::Error, keystore::TheaKeystore}; - -/// Set of test accounts using [`thea_primitives::crypto`] types. -#[allow(missing_docs)] -#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::Display, strum::EnumIter)] -pub(crate) enum Keyring { - Alice, - Bob, - Charlie, - Dave, - Eve, - Ferdie, - One, - Two, -} - -impl Keyring { - /// Sign `msg`. - pub fn sign(self, msg: &[u8]) -> crypto::Signature { - let msg = keccak_256(msg); - sr25519::Pair::from(self).sign(&msg).into() - } - - /// Return key pair. - pub fn pair(self) -> crypto::Pair { - sr25519::Pair::from_string(self.to_seed().as_str(), None).unwrap().into() - } - - /// Return public key. - pub fn public(self) -> crypto::Public { - self.pair().public() - } - - /// Return seed string. - pub fn to_seed(self) -> String { - format!("//{}", self) - } -} - -impl From for crypto::Pair { - fn from(k: Keyring) -> Self { - k.pair() - } -} - -impl From for sr25519::Pair { - fn from(k: Keyring) -> Self { - k.pair().into() - } -} - -impl From for ed25519::Pair { - fn from(k: Keyring) -> Self { - k.into() - } -} - -fn keystore() -> SyncCryptoStorePtr { - Arc::new(LocalKeystore::in_memory()) -} - -#[test] -fn verify_should_work() { - let msg = keccak_256(b"I am Alice!"); - let sig = Keyring::Alice.sign(b"I am Alice!"); - - assert!(sr25519::Pair::verify(&sig.clone().into(), &msg, &Keyring::Alice.public().into(),)); - - // different public key -> fail - assert!(!sr25519::Pair::verify(&sig.clone().into(), &msg, &Keyring::Bob.public().into(),)); - - let msg = keccak_256(b"I am not Alice!"); - - // different msg -> fail - assert!(!sr25519::Pair::verify(&sig.into(), &msg, &Keyring::Alice.public().into())); -} - -#[test] -fn pair_works() { - let want = crypto::Pair::from_string("//Alice", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::Alice.pair().to_raw_vec(); - assert_eq!(want, got); - - let want = crypto::Pair::from_string("//Bob", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::Bob.pair().to_raw_vec(); - assert_eq!(want, got); - - let want = crypto::Pair::from_string("//Charlie", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::Charlie.pair().to_raw_vec(); - assert_eq!(want, got); - - let want = crypto::Pair::from_string("//Dave", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::Dave.pair().to_raw_vec(); - assert_eq!(want, got); - - let want = crypto::Pair::from_string("//Eve", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::Eve.pair().to_raw_vec(); - assert_eq!(want, got); - - let want = crypto::Pair::from_string("//Ferdie", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::Ferdie.pair().to_raw_vec(); - assert_eq!(want, got); - - let want = crypto::Pair::from_string("//One", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::One.pair().to_raw_vec(); - assert_eq!(want, got); - - let want = crypto::Pair::from_string("//Two", None).expect("Pair failed").to_raw_vec(); - let got = Keyring::Two.pair().to_raw_vec(); - assert_eq!(want, got); -} - -#[test] -fn authority_id_works() { - let store = keystore(); - - let alice: crypto::Public = - SyncCryptoStore::sr25519_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) - .ok() - .unwrap() - .into(); - - let bob = Keyring::Bob.public(); - let charlie = Keyring::Charlie.public(); - - let store: TheaKeystore = Some(store).into(); - - let mut keys = vec![bob, charlie]; - - let id = store.authority_id(keys.as_slice()); - assert!(id.is_none()); - - keys.push(alice.clone()); - - let id = store.authority_id(keys.as_slice()).unwrap(); - assert_eq!(id, alice); -} - -// TODO: This test doesn't work, fix it. -fn sign_works() { - let store = keystore(); - - let alice: crypto::Public = - SyncCryptoStore::sr25519_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) - .ok() - .unwrap() - .into(); - - let store: TheaKeystore = Some(store).into(); - - let msg = b"are you involved or commited?"; - - let sig1 = store.sign(&alice, msg).unwrap(); - let sig2 = Keyring::Alice.sign(msg); - - assert_eq!(sig1, sig2); -} - -#[test] -fn sign_error() { - let store = keystore(); - - let _ = SyncCryptoStore::sr25519_generate_new(&*store, KEY_TYPE, Some(&Keyring::Bob.to_seed())) - .ok() - .unwrap(); - - let store: TheaKeystore = Some(store).into(); - - let alice = Keyring::Alice.public(); - - let msg = b"are you involved or commited?"; - let sig = store.sign(&alice, msg).err().unwrap(); - let err = Error::Signature("sign_with() failed".to_string()); - - assert_eq!(sig, err); -} - -#[test] -fn sign_no_keystore() { - let store: TheaKeystore = None.into(); - - let alice = Keyring::Alice.public(); - let msg = b"are you involved or commited"; - - let sig = store.sign(&alice, msg).err().unwrap(); - let err = Error::Keystore("no Keystore".to_string()); - assert_eq!(sig, err); -} - -#[test] -fn verify_works() { - let store = keystore(); - - let alice: crypto::Public = - SyncCryptoStore::sr25519_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) - .ok() - .unwrap() - .into(); - - let store: TheaKeystore = Some(store).into(); - - // `msg` and `sig` match - let msg = b"are you involved or commited?"; - let sig = store.sign(&alice, msg).unwrap(); - assert!(TheaKeystore::verify(&alice, &sig, msg)); - - // `msg and `sig` don't match - let msg = b"you are just involved"; - assert!(!TheaKeystore::verify(&alice, &sig, msg)); -} - -// Note that we use keys with and without a seed for this test. -#[test] -fn public_keys_works() { - const TEST_TYPE: sp_application_crypto::KeyTypeId = sp_application_crypto::KeyTypeId(*b"test"); - - let store = keystore(); - - let add_key = |key_type, seed: Option<&str>| { - SyncCryptoStore::sr25519_generate_new(&*store, key_type, seed).unwrap() - }; - - // test keys - let _ = add_key(TEST_TYPE, Some(Keyring::Alice.to_seed().as_str())); - let _ = add_key(TEST_TYPE, Some(Keyring::Bob.to_seed().as_str())); - - let _ = add_key(TEST_TYPE, None); - let _ = add_key(TEST_TYPE, None); - - // BEEFY keys - let _ = add_key(KEY_TYPE, Some(Keyring::Dave.to_seed().as_str())); - let _ = add_key(KEY_TYPE, Some(Keyring::Eve.to_seed().as_str())); - - let key1: crypto::Public = add_key(KEY_TYPE, None).into(); - let key2: crypto::Public = add_key(KEY_TYPE, None).into(); - - let store: TheaKeystore = Some(store).into(); - - let keys = store.public_keys().ok().unwrap(); - - assert!(keys.len() == 4); - assert!(keys.contains(&Keyring::Dave.public())); - assert!(keys.contains(&Keyring::Eve.public())); - assert!(keys.contains(&key1)); - assert!(keys.contains(&key2)); -} diff --git a/client/thea/src/lib.rs b/client/thea/src/lib.rs deleted file mode 100644 index 256ff8de4..000000000 --- a/client/thea/src/lib.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2020-2021 Polkadex OU -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// This is file is modified from beefy-gadget from Parity Technologies (UK) Ltd. - -use log::*; -use sc_client_api::{Backend, BlockchainEvents, Finalizer}; -use sp_api::ProvideRuntimeApi; -use sp_blockchain::HeaderBackend; -use sp_keystore::SyncCryptoStorePtr; -use sp_runtime::traits::Block; -use std::sync::{Arc, Mutex}; -use thea_primitives::TheaApi; - -pub mod error; -pub mod inherents; -pub mod keystore; -mod rounds; -mod utils; -pub mod worker; -pub use rounds::RoundTracker; - -#[cfg(test)] -mod tests; - -/// A convenience THEA client trait that defines all the type bounds a THEA client -/// has to satisfy. Ideally that should actually be a trait alias. Unfortunately as -/// of today, Rust does not allow a type alias to be used as a trait bound. Tracking -/// issue is . -pub trait Client: - BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync -where - B: Block, - BE: Backend, -{ - // empty -} - -impl Client for T -where - B: Block, - BE: Backend, - T: BlockchainEvents - + HeaderBackend - + Finalizer - + ProvideRuntimeApi - + Send - + Sync, -{ - // empty -} - -/// t-ECDSA Initialization Params -pub struct TheaParams { - /// THEA client - pub client: Arc, - pub backend: Arc, - pub runtime: Arc, - /// Local key store - pub key_store: Option, - pub rpc_send: Arc>>, -} - -/// Start the THEA gadget. -/// -/// This is a thin shim around running and awaiting a THEA worker. -pub async fn start_thea_gadget(thea_params: TheaParams) -where - B: Block, - BE: Backend, - C: Client, - R: ProvideRuntimeApi, - R::Api: TheaApi, -{ - let TheaParams { client, backend, runtime, key_store, rpc_send } = thea_params; - - let worker_params = worker::WorkerParams { client, backend, runtime, key_store, rpc_send }; - - let mut worker = worker::TheaWorker::<_, _, _, _>::new(worker_params); - debug!(target: "thea", "Thea Worker Started!"); - worker.run().await -} diff --git a/client/thea/src/rounds.rs b/client/thea/src/rounds.rs deleted file mode 100644 index 7c5af3cf9..000000000 --- a/client/thea/src/rounds.rs +++ /dev/null @@ -1,511 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use curv::elliptic::curves::{ECPoint, Secp256k1}; -use std::collections::HashMap; - -use log::*; -use multi_party_ecdsa::protocols::multi_party_ecdsa::gg_2020::state_machine::{ - keygen::{Keygen, LocalKey, ProtocolMessage}, - sign::{CompletedOfflineStage, OfflineStage}, - traits::RoundBlame, -}; -use round_based::{IsCritical, Msg, StateMachine}; - -use thea_primitives::ValidatorSetId; - -use crate::{error, error::Error, inherents::update_shared_public_key}; - -pub struct RoundTracker { - rounds: HashMap, - active_set_id: ValidatorSetId, -} - -impl RoundTracker { - pub(crate) fn new() -> RoundTracker { - RoundTracker { rounds: HashMap::new(), active_set_id: 0 } - } - pub(crate) fn new_round(&mut self, validator_set_id: ValidatorSetId) -> Option { - self.rounds.insert( - validator_set_id, - Round { - local_party: None, - local_key: None, - mpc_local_key: None, - offline_party: HashMap::new(), - offline_stage: HashMap::new(), - active_validator_len: 0, - validator_idx: 0, - keygen_not_started: true, - keygen_completed: false, - }, - ) - } - - pub(crate) fn set_active_round_id(&mut self, id: ValidatorSetId) { - self.active_set_id = id; - } - - pub(crate) fn active_round_id(&self) -> ValidatorSetId { - self.active_set_id - } - - /// Executes the first step of Keygen state machine - pub(crate) fn start_keygen( - &mut self, - id: ValidatorSetId, - ) -> Option<(Vec>, u16)> { - let local_party = self.mutable_local_party(id).ok()?; - match local_party.proceed() { - Ok(()) => { - let messages = local_party.message_queue().clone(); - local_party.message_queue().clear(); - debug!(target: "thea", "successfully executed keygen round0"); - return Some((messages, local_party.current_round())) - }, - Err(err) => { - if err.is_critical() { - error!(target: "thea", "Crititcal Error in MPC State machine: {:?}", err); - } - warn!(target: "thea", "Error reported by MPC State machine: {:?}", err) - }, - } - None - } - pub(crate) fn set_local_party( - &mut self, - id: &ValidatorSetId, - local_party: Option, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - round.local_party = local_party; - Ok(()) - } - - pub(crate) fn mutable_local_party(&mut self, id: ValidatorSetId) -> Result<&mut Keygen, Error> { - let round = self.rounds.get_mut(&id).ok_or(Error::RoundNotFound(id))?; - round.local_party.as_mut().ok_or(Error::LocalPartyNotInitialized) - } - - pub(crate) fn local_party(&self, id: ValidatorSetId) -> Result<&Keygen, Error> { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - round.local_party.as_ref().ok_or(Error::LocalPartyNotInitialized) - } - - pub(crate) fn set_offline_party( - &mut self, - id: &ValidatorSetId, - offline_party: OfflineStage, - submission_block: u32, - payload: &Payload, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - round.offline_party.insert(*payload, (submission_block, offline_party)); - Ok(()) - } - - pub(crate) fn submission_block( - &self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result { - Ok(self - .rounds - .get(&id) - .ok_or(Error::RoundNotFound(id))? - .offline_party - .get(payload) - .ok_or(Error::OfflinePartyNotInitialized)? - .0) - } - - pub(crate) fn mutable_offline_party( - &mut self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result<&mut OfflineStage, Error> { - Ok(&mut self - .rounds - .get_mut(&id) - .ok_or(Error::RoundNotFound(id))? - .offline_party - .get_mut(payload) - .ok_or(Error::OfflinePartyNotInitialized)? - .1) - } - - pub(crate) fn offline_party( - &self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result<&OfflineStage, Error> { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - match &round.offline_party.get(payload) { - Some(p) => Ok(&p.1), - None => Err(Error::RoundNotFound(id)), - } - } - - pub(crate) fn is_finished(&self, id: ValidatorSetId) -> Result { - Ok(self.local_party(id)?.is_finished()) - } - - pub(crate) fn is_offline_finished( - &self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result { - Ok(self.offline_party(id, payload)?.is_finished()) - } - - pub(crate) fn pick_output(&mut self, id: ValidatorSetId) -> Result, Error> { - Ok(self - .mutable_local_party(id)? - .pick_output() - .ok_or(Error::ProtocolNotComplete)??) - } - - pub(crate) fn pick_offline_output( - &mut self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result { - Ok(self - .mutable_offline_party(id, payload)? - .pick_output() - .ok_or(Error::ProtocolNotComplete)??) - } - - pub fn keygen_status(&self, id: ValidatorSetId) -> Result<(u16, Vec), Error> { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - let local_party = round.local_party.as_ref().ok_or(Error::LocalPartyNotInitialized)?; - Ok(local_party.round_blame()) - } - - pub fn offline_status( - &self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result<(u16, Vec), Error> { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - Ok(round - .offline_party - .get(payload) - .ok_or(Error::OfflinePartyNotInitialized)? - .1 - .round_blame()) - } - - pub fn current_round(&self, id: ValidatorSetId) -> Result { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - let local_party = round.local_party.as_ref().ok_or(Error::LocalPartyNotInitialized)?; - Ok(local_party.current_round()) - } - - pub fn offline_current_round( - &self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - Ok(round - .offline_party - .get(payload) - .ok_or(Error::RoundNotFound(id))? - .1 - .current_round()) - } - - pub(crate) fn set_local_key( - &mut self, - id: ValidatorSetId, - local_key: LocalKey, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(&id).ok_or(Error::RoundNotFound(id))?; - match sp_core::ecdsa::Public::from_full( - &local_key.public_key().as_raw().serialize_compressed(), - ) { - Ok(ecdsa_pubk) => { - round.set_local_key(ecdsa_pubk.clone()); - round.set_mpc_local_key(local_key); - if update_shared_public_key(id, ecdsa_pubk).is_some() { - warn!(target: "thea", "ECDSA Public key already existed for given set_id: {:?}",id); - }; - }, - Err(err) => { - error!(target: "thea","Unable to convert to compressed ecdsa public key: {:?}",err); - }, - } - Ok(()) - } - - pub(crate) fn set_completed_offline_stage( - &mut self, - id: ValidatorSetId, - completed_offline_stage: CompletedOfflineStage, - payload: &Payload, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(&id).ok_or(Error::RoundNotFound(id))?; - round.set_completed_offline_stage(completed_offline_stage, payload); - Ok(()) - } - - pub(crate) fn get_completed_offline_stage( - &self, - id: ValidatorSetId, - payload: &Payload, - ) -> Result { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - round.get_completed_offline_stage(payload).ok_or(Error::LocalKeyNotReady) - } - - pub(crate) fn rng_increment(&mut self, id: &ValidatorSetId, payload: &Payload) -> u64 { - let mut not = 0; - let counter: &mut u64 = match self.rounds.get_mut(id) { - Some(os) => match os.offline_stage.get_mut(payload) { - Some(oss) => &mut oss.2, - None => &mut not, - }, - None => &mut not, - }; - *counter += 1; - *counter - } - - pub(crate) fn get_local_key( - &self, - id: ValidatorSetId, - ) -> Result { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - round.get_local_key().ok_or(Error::LocalKeyNotReady) - } - - pub(crate) fn get_mpc_local_key( - &self, - id: ValidatorSetId, - ) -> Result, Error> { - let round = self.rounds.get(&id).ok_or(Error::RoundNotFound(id))?; - round.get_mpc_local_key().ok_or(Error::LocalKeyNotReady) - } - - // TODO @ZK use generics for these getter functions - pub fn set_active_validator_len( - &mut self, - id: &ValidatorSetId, - length: usize, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - round.active_validator_len = length; - Ok(()) - } - - pub fn set_validator_idx( - &mut self, - id: &ValidatorSetId, - validator_idx: u16, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - round.validator_idx = validator_idx; - Ok(()) - } - - pub fn set_keygen_not_started( - &mut self, - id: &ValidatorSetId, - keygen_not_started: bool, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - round.keygen_not_started = keygen_not_started; - Ok(()) - } - - pub fn set_keygen_completed( - &mut self, - id: &ValidatorSetId, - keygen_completed: bool, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - round.keygen_completed = keygen_completed; - Ok(()) - } - - pub fn set_offline_stage_started( - &mut self, - id: &ValidatorSetId, - offline_stage_started: bool, - payload: &Payload, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - if let Some(os) = round.offline_stage.get_mut(payload) { - os.0 = offline_stage_started; - } - Ok(()) - } - - pub fn set_offline_stage_completed( - &mut self, - id: &ValidatorSetId, - offline_stage_completed: bool, - payload: &Payload, - ) -> Result<(), Error> { - let round = self.rounds.get_mut(id).ok_or(Error::RoundNotFound(*id))?; - if let Some(os) = round.offline_stage.get_mut(payload) { - os.1 = offline_stage_completed; - } - Ok(()) - } - - pub fn get_active_validator_len(&self, id: &ValidatorSetId) -> Result { - let round = self.rounds.get(id).ok_or_else(|| Error::RoundNotFound(*id))?; - Ok(round.active_validator_len) - } - - pub fn get_validator_idx(&self, id: &ValidatorSetId) -> Result { - let round = self.rounds.get(id).ok_or_else(|| Error::RoundNotFound(*id))?; - Ok(round.validator_idx) - } - - pub fn get_keygen_not_started(&self, id: &ValidatorSetId) -> bool { - if let Some(round) = self.rounds.get(id) { - round.keygen_not_started - } else { - true - } - } - - pub fn get_keygen_completed(&self, id: &ValidatorSetId) -> Result { - let round = self.rounds.get(id).ok_or(Error::RoundNotFound(*id))?; - Ok(round.keygen_completed) - } - - pub fn get_offline_party(&self, id: &ValidatorSetId) -> Result, Error> { - let round = self.rounds.get(id).ok_or_else(|| Error::RoundNotFound(*id))?; - Ok(round.offline_party.iter().map(|(k, _)| *k).collect()) - } - - pub fn get_offline_stage_started( - &self, - id: &ValidatorSetId, - payload: &Payload, - ) -> Result { - let round = self.rounds.get(id).ok_or(Error::RoundNotFound(*id))?; - match round.offline_stage.get(payload) { - Some(rnd) => Ok(rnd.0), - // required for new stage - None => Ok(false), - } - } - - pub fn get_offline_stage_completed( - &self, - id: &ValidatorSetId, - payload: &Payload, - ) -> Result { - let round = self.rounds.get(id).ok_or(Error::RoundNotFound(*id))?; - match round.offline_stage.get(payload) { - Some(rnd) => Ok(rnd.1), - // required for new stage - None => Ok(false), - } - } - - pub(crate) fn remove_offline_stage(&mut self, validator_set_id: &u64, payload: &[u8; 32]) { - if let Some(round) = self.rounds.get_mut(validator_set_id) { - if round.remove_offline_stage(payload).is_some() { - debug!(target: "thea", "Removed offline stage for: {:?}", payload); - } else { - debug!(target: "thea", "Tried to remove not existing offline stage for: {:?}", payload); - } - } - } - - pub(crate) fn remove_completed_stage(&mut self, validator_set_id: &u64, payload: &[u8; 32]) { - if let Some(round) = self.rounds.get_mut(validator_set_id) { - if round.remove_completed_stage(payload) { - debug!(target: "thea", "Removed offline stage for: {:?}", payload); - } else { - debug!(target: "thea", "Tried to remove not existing offline stage for: {:?}", payload); - } - } - } -} - -pub type Payload = [u8; 32]; - -pub(crate) struct Round { - /// mpe instance for current round - local_party: Option, - /// Generated local key for current round - local_key: Option, - /// MPC local_key, - mpc_local_key: Option>, - /// Offline Party - offline_party: HashMap, - /// Completed Offline Stage started completed msg_count - offline_stage: HashMap, - /// To be Documented - active_validator_len: usize, - validator_idx: u16, - keygen_not_started: bool, - keygen_completed: bool, -} - -impl Round { - fn remove_offline_stage(&mut self, payload: &Payload) -> Option { - Some(self.offline_stage.remove(payload)?.0) - } - - fn remove_completed_stage(&mut self, payload: &Payload) -> bool { - self.offline_party.remove(payload).is_some() - } - - pub(crate) fn set_local_key(&mut self, local_key: sp_core::ecdsa::Public) { - self.local_key = Some(local_key) - } - - pub(crate) fn set_mpc_local_key(&mut self, local_key: LocalKey) { - self.mpc_local_key = Some(local_key) - } - - pub(crate) fn set_completed_offline_stage( - &mut self, - completed_offline: CompletedOfflineStage, - payload: &Payload, - ) { - let old = match self.offline_stage.get(payload) { - Some((_, _, old, _)) => *old, - None => 0_u64, - }; - self.offline_stage.insert(*payload, (true, true, old, completed_offline)); - } - - pub(crate) fn get_local_key(&self) -> Option { - self.local_key.clone() - } - - pub(crate) fn get_mpc_local_key(&self) -> Option> { - self.mpc_local_key.clone() - } - - pub(crate) fn get_completed_offline_stage( - &self, - payload: &Payload, - ) -> Option { - Some(self.offline_stage.get(payload)?.3.clone()) - } -} diff --git a/client/thea/src/tests/mod.rs b/client/thea/src/tests/mod.rs deleted file mode 100644 index 001c5e9c8..000000000 --- a/client/thea/src/tests/mod.rs +++ /dev/null @@ -1,233 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Thea client testing - -use crate::utils::{convert_all_keygen_messages, convert_back_keygen_messages, convert_signature}; -use curv::{ - arithmetic::{BigInt, Converter}, - elliptic::curves::ECPoint, -}; -use frame_support::traits::Len; - -use multi_party_ecdsa::protocols::multi_party_ecdsa::gg_2020::{ - party_i::{verify, SignatureRecid}, - state_machine::{ - keygen::{Keygen, ProtocolMessage}, - sign::{OfflineStage, SignManual}, - }, -}; -use round_based::StateMachine; -use sp_core::blake2_256; -use sp_runtime::app_crypto::RuntimePublic; -use thea_primitives::keygen::{KeygenRound, TheaPayload}; - -// test of thea protocol on runtime level -pub(crate) mod protocol_tests; - -#[test] -pub fn test_encode_decode() { - let mut local_party = Keygen::new(1, 2, 3).unwrap(); - local_party.proceed().unwrap(); - - let messages = local_party.message_queue(); - - let encoded_messages = convert_all_keygen_messages(messages.clone()).unwrap(); - assert_eq!(encoded_messages.len(), messages.len()); - let payload = TheaPayload { - messages: encoded_messages, - set_id: 0, - auth_idx: 0, - round: KeygenRound::Unknown, - ..Default::default() - }; - let decoded_messages = - convert_back_keygen_messages::(payload).unwrap(); - - assert_eq!(decoded_messages.len(), messages.len()); - for i in 0..messages.len() { - assert_eq!(messages[i].sender, decoded_messages[i].sender); - assert_eq!(messages[i].receiver, decoded_messages[i].receiver); - // assert_eq!(messages[i].body,decoded_messages[i].body); - } -} - -#[test] -pub fn test_public_key_conversion() { - let mut alice = Keygen::new(1, 1, 2).unwrap(); - let mut bob = Keygen::new(2, 1, 2).unwrap(); - - while !alice.is_finished() && !bob.is_finished() { - if alice.wants_to_proceed() { - alice.proceed().unwrap(); - } - if bob.wants_to_proceed() { - bob.proceed().unwrap(); - } - - let alice_messages = alice.message_queue().clone(); - alice.message_queue().clear(); - let bob_messages = bob.message_queue().clone(); - bob.message_queue().clear(); - - for msg in bob_messages { - alice.handle_incoming(msg.clone()).unwrap(); - } - - for msg in alice_messages { - bob.handle_incoming(msg.clone()).unwrap(); - } - - println!("Status => Alice: {:?}, Bob: {:?}", alice.current_round(), bob.current_round()); - } - let alice_pubk = alice.pick_output().unwrap().unwrap(); - let bob_pubk = bob.pick_output().unwrap().unwrap(); - - // We check if the raw uncompressed public keys are equal - assert_eq!(alice_pubk.public_key(), bob_pubk.public_key()); - - // sp_core::ecdsa::Public::from_full creates a compressed ecdsa public key - let converted_key = sp_core::ecdsa::Public::from_full( - &alice_pubk.public_key().into_raw().serialize_compressed(), - ) - .unwrap(); - // alice_pubk.public_key().bytes_compressed_to_big_int() returns a compressed public key - // alice_pubk.public_key().pk_to_key_slice() returns a uncompressed public key - assert_eq!( - alice_pubk.public_key().into_raw().serialize_compressed().to_vec(), - RuntimePublic::to_raw_vec(&converted_key) - ); -} - -#[test] -pub fn test_signature_conversion() { - // Keygen Stage - let mut alice = Keygen::new(1, 1, 2).unwrap(); - let mut bob = Keygen::new(2, 1, 2).unwrap(); - - while !alice.is_finished() && !bob.is_finished() { - if alice.wants_to_proceed() { - alice.proceed().unwrap(); - } - if bob.wants_to_proceed() { - bob.proceed().unwrap(); - } - - let alice_messages = alice.message_queue().clone(); - alice.message_queue().clear(); - let bob_messages = bob.message_queue().clone(); - bob.message_queue().clear(); - - for msg in bob_messages { - alice.handle_incoming(msg.clone()).unwrap(); - } - - for msg in alice_messages { - bob.handle_incoming(msg.clone()).unwrap(); - } - - println!("Status => Alice: {:?}, Bob: {:?}", alice.current_round(), bob.current_round()); - } - let alice_pubk = alice.pick_output().unwrap().unwrap(); - let bob_pubk = bob.pick_output().unwrap().unwrap(); - - // We check if the raw uncompressed public keys are equal - assert_eq!( - alice_pubk.public_key().into_raw().serialize_compressed(), - bob_pubk.public_key().into_raw().serialize_compressed() - ); - - // sp_core::ecdsa::Public::from_full creates a compressed ecdsa public key - let converted_key = sp_core::ecdsa::Public::from_full( - &alice_pubk.public_key().into_raw().serialize_compressed(), - ) - .unwrap(); - - // Offline Stage - let mut alice = OfflineStage::new(1, vec![1, 2], alice_pubk).unwrap(); - let mut bob = OfflineStage::new(2, vec![1, 2], bob_pubk).unwrap(); - while !alice.is_finished() && !bob.is_finished() { - if alice.wants_to_proceed() { - alice.proceed().unwrap(); - } - if bob.wants_to_proceed() { - bob.proceed().unwrap(); - } - - let alice_messages = alice.message_queue().clone(); - alice.message_queue().clear(); - let bob_messages = bob.message_queue().clone(); - bob.message_queue().clear(); - - for msg in bob_messages { - alice.handle_incoming(msg.clone()).unwrap(); - } - - for msg in alice_messages { - bob.handle_incoming(msg.clone()).unwrap(); - } - - println!("Status => Alice: {:?}, Bob: {:?}", alice.current_round(), bob.current_round()); - } - let alice_offline_completed = alice.pick_output().unwrap().unwrap(); - let bob_offline_completed = bob.pick_output().unwrap().unwrap(); - - let data: Vec = vec![ - 12, 13, 246, 187, 233, 143, 138, 109, 82, 88, 208, 207, 179, 101, 234, 17, 248, 96, 70, - 158, 195, 155, 200, 25, 83, 70, 7, 177, 132, 223, 246, 85, - ]; - let data_to_sign: [u8; 32] = blake2_256(&data); - - let (alice_sign, alice_msg) = - SignManual::new(BigInt::from_bytes(&data_to_sign), alice_offline_completed.clone()) - .unwrap(); - let (bob_sign, bob_msg) = - SignManual::new(BigInt::from_bytes(&data_to_sign), bob_offline_completed.clone()).unwrap(); - - let alice_signature: SignatureRecid = alice_sign.complete(&vec![bob_msg]).unwrap(); - let bob_signature = bob_sign.complete(&vec![alice_msg]).unwrap(); - - assert_eq!(alice_signature.r, bob_signature.r); - assert_eq!(alice_signature.s, bob_signature.s); - assert_eq!(alice_signature.recid, bob_signature.recid); - - assert!(verify( - &alice_signature, - alice_offline_completed.public_key(), - &BigInt::from_bytes(&data_to_sign) - ) - .is_ok()); - assert!(verify( - &bob_signature, - bob_offline_completed.public_key(), - &BigInt::from_bytes(&data_to_sign) - ) - .is_ok()); - - let converted_alice_signature = convert_signature(&alice_signature).unwrap(); - println!("{:?}", converted_alice_signature); - - assert!( - thea_primitives::runtime::crypto::verify_ecdsa_prehashed( - &converted_alice_signature, - &converted_key, - &data_to_sign - ), - "Converted Signature failed" - ); -} diff --git a/client/thea/src/tests/protocol_tests.rs b/client/thea/src/tests/protocol_tests.rs deleted file mode 100644 index 30008cc13..000000000 --- a/client/thea/src/tests/protocol_tests.rs +++ /dev/null @@ -1,865 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Thea client testing - -use crate::{ - keystore::tests::{Keyring as TheaKeyring, Keyring}, - start_thea_gadget, TheaParams, -}; -use codec::{Decode, Encode}; -use futures::{future, stream::FuturesUnordered, Future, FutureExt, StreamExt}; -use parking_lot::{Mutex, RwLock}; -use sc_consensus::BoxJustificationImport; -use sc_finality_grandpa::{ - run_grandpa_voter, Config, GenesisAuthoritySetProvider, GrandpaParams, LinkHalf, - SharedVoterState, -}; -use sc_keystore::LocalKeystore; -use sc_network::config::{ProtocolConfig, Role}; -use sc_network_test::{ - Block, BlockImportAdapter, FullPeerConfig, Hash, PassThroughVerifier, Peer, PeersClient, - PeersFullClient, TestNetFactory, -}; -use serde::{Deserialize, Serialize}; -use sp_api::{ApiRef, BlockId, ProvideRuntimeApi}; -use sp_application_crypto::Pair as SPPair; -use sp_consensus::BlockOrigin; -use sp_core::{crypto::key_types::GRANDPA, sr25519::Pair}; -use sp_finality_grandpa::{ - AuthorityList, EquivocationProof, GrandpaApi, OpaqueKeyOwnershipProof, SetId, -}; -use sp_runtime::{traits::Header as HeaderT, BuildStorage, DigestItem}; -use std::{ - pin::Pin, - sync::{Arc, Mutex as StdMutex}, - task::Poll, - thread::sleep, - time::Duration, -}; -use substrate_test_runtime_client::{ - runtime::Header, Ed25519Keyring, LongestChain, SyncCryptoStore, SyncCryptoStorePtr, -}; -use thea_primitives::{ - constants::{MsgLimit, MsgVecLimit, PartialSignatureLimit, PartialSignatureVecLimit}, - crypto::Signature, - keygen::{KeygenRound, OfflineStageRound, SigningSessionPayload, TheaPayload}, - payload::{SignedTheaPayload, UnsignedTheaPayload}, - AuthorityId, AuthorityIndex, ConsensusLog, PartyIndex, TheaApi, ValidatorSet, - KEY_TYPE as TheaKeyType, THEA_ENGINE_ID, -}; -use tokio::runtime::{Handle, Runtime}; - -type TestLinkHalf = - LinkHalf>; -type GrandpaPeerData = Mutex>; -type GrandpaBlockImport = sc_finality_grandpa::GrandpaBlockImport< - substrate_test_runtime_client::Backend, - Block, - PeersFullClient, - LongestChain, ->; -type GrandpaPeer = Peer; - -pub(crate) struct TheaTestNet { - peers: Vec, - test_net: Arc, -} - -// same as runtime -pub(crate) type BlockNumber = u32; -pub(crate) type GrandpaBlockNumber = u64; - -const THEA_PROTOCOL_NAME: &str = "THEA"; -const GRANDPA_PROTOCOL_NAME: &str = "/paritytech/grandpa/1"; -const TEST_GOSSIP_DURATION: Duration = Duration::from_millis(500); - -impl TheaTestNet { - pub(crate) fn new(n_authority: usize, n_full: usize, test_net: Arc) -> Self { - let capacity = n_authority + n_full; - let mut net = TheaTestNet { peers: Vec::with_capacity(capacity), test_net }; - for _ in 0..n_authority { - net.add_authority_peer(); - } - for _ in 0..n_full { - net.add_full_peer(); - } - net - } - - pub(crate) fn add_authority_peer(&mut self) { - self.add_full_peer_with_config(FullPeerConfig { - notifications_protocols: vec![GRANDPA_PROTOCOL_NAME.into(), THEA_PROTOCOL_NAME.into()], - is_authority: true, - ..Default::default() - }) - } - - pub(crate) fn add_full_peer(&mut self) { - self.add_full_peer_with_config(FullPeerConfig { - notifications_protocols: vec![GRANDPA_PROTOCOL_NAME.into(), THEA_PROTOCOL_NAME.into()], - is_authority: false, - ..Default::default() - }) - } - pub(crate) fn generate_blocks( - &mut self, - count: usize, - session_length: u64, - validator_set: &ValidatorSet, - ) { - self.peer(0).generate_blocks(count, BlockOrigin::File, |builder| { - let mut block = builder.build().unwrap().block; - - if *block.header.number() % session_length == 0 { - add_auth_change_digest(&mut block.header, validator_set.clone()); - } - - block - }); - } -} - -impl TestNetFactory for TheaTestNet { - type Verifier = PassThroughVerifier; - type BlockImport = GrandpaBlockImport; - type PeerData = GrandpaPeerData; - - fn from_config(_config: &ProtocolConfig) -> Self { - TheaTestNet { peers: Vec::new(), test_net: Default::default() } - } - - fn make_verifier( - &self, - _client: PeersClient, - _cfg: &ProtocolConfig, - _: &GrandpaPeerData, - ) -> Self::Verifier { - PassThroughVerifier::new(false) // use non-instant finality. - } - - fn make_block_import( - &self, - client: PeersClient, - ) -> ( - BlockImportAdapter, - Option>, - GrandpaPeerData, - ) { - let (client, backend) = (client.as_client(), client.as_backend()); - let (import, link) = sc_finality_grandpa::block_import( - client.clone(), - &*self.test_net, - LongestChain::new(backend.clone()), - None, - ) - .expect("Could not create block import for fresh peer."); - let justification_import = Box::new(import.clone()); - (BlockImportAdapter::new(import), Some(justification_import), Mutex::new(Some(link))) - } - - fn peer(&mut self, i: usize) -> &mut GrandpaPeer { - &mut self.peers[i] - } - - fn peers(&self) -> &Vec { - &self.peers - } - - fn mut_peers)>(&mut self, closure: F) { - closure(&mut self.peers); - } - - fn add_full_peer(&mut self) { - self.add_full_peer_with_config(FullPeerConfig { - notifications_protocols: vec![GRANDPA_PROTOCOL_NAME.into(), THEA_PROTOCOL_NAME.into()], - is_authority: false, - ..Default::default() - }) - } -} - -fn add_auth_change_digest(header: &mut Header, new_auth_set: ValidatorSet) { - header.digest_mut().push(DigestItem::Consensus( - THEA_ENGINE_ID, - ConsensusLog::::AuthoritiesChange(new_auth_set).encode(), - )); -} - -#[derive(Serialize, Deserialize, Debug)] -struct Genesis(std::collections::BTreeMap); - -impl BuildStorage for Genesis { - fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> { - storage - .top - .extend(self.0.iter().map(|(a, b)| (a.clone().into_bytes(), b.clone().into_bytes()))); - Ok(()) - } -} - -pub(crate) fn make_thea_ids(keys: &[TheaKeyring]) -> Vec { - keys.iter().map(|key| Pair::from(key.clone()).public().into()).collect() -} - -pub(crate) fn create_thea_keystore(authority: TheaKeyring) -> SyncCryptoStorePtr { - let keystore = Arc::new(LocalKeystore::in_memory()); - SyncCryptoStore::sr25519_generate_new(&*keystore, TheaKeyType, Some(&authority.to_seed())) - .expect("Creates authority key"); - keystore -} - -#[derive(Clone, Default)] -pub(crate) struct TestApi { - genesys_validator_set: Vec, - next_validator_set: Vec, - keygen_messages: - Arc>>>, - signed_payloads: Arc>>, - signing_payloads: Arc< - StdMutex< - Vec< - SigningSessionPayload, - >, - >, - >, - unsigned_payloads: Arc>>, - offline_messages: - Arc>>>, - genesis_authorities: AuthorityList, - last_keygen_round: Arc>, - validator_set_changed: Arc>, -} - -// compiler gets confused and warns us about unused inner -#[allow(dead_code)] -pub(crate) struct RuntimeApi { - inner: TestApi, -} - -impl ProvideRuntimeApi for TestApi { - type Api = RuntimeApi; - fn runtime_api<'a>(&'a self) -> ApiRef<'a, Self::Api> { - RuntimeApi { inner: self.clone() }.into() - } -} - -sp_api::mock_impl_runtime_apis! { - impl GrandpaApi for RuntimeApi { - fn grandpa_authorities(&self) -> AuthorityList { - self.inner.genesis_authorities.clone() - } - - fn current_set_id(&self) -> SetId { - 0 - } - - fn submit_report_equivocation_unsigned_extrinsic( - _equivocation_proof: EquivocationProof, - _key_owner_proof: OpaqueKeyOwnershipProof, - ) -> Option<()> { - None - } - - fn generate_key_ownership_proof( - _set_id: SetId, - _authority_id: sp_finality_grandpa::AuthorityId, - ) -> Option { - None - } - } - - impl TheaApi for RuntimeApi { - fn validator_set(&self) -> thea_primitives::ValidatorSet { - ValidatorSet::new(make_thea_ids(&self.inner.genesys_validator_set), 0) - } - - fn next_validator_set(&self) -> thea_primitives::ValidatorSet { - ValidatorSet::new(make_thea_ids(&self.inner.next_validator_set), 1) - } - - fn submit_keygen_message(&self, payload: TheaPayload, - _signature: thea_primitives::AuthoritySignature, _rng: u64) -> Result<(), thea_primitives::SigningError>{ - *self.inner.last_keygen_round.lock().unwrap() = payload.round; - self.inner.keygen_messages.lock().unwrap().push(payload); - Ok(()) - } - - fn submit_offline_message(payload: TheaPayload, - _signature: thea_primitives::AuthoritySignature, _rng: u64, _payload_array: &[u8; 32]) -> Result<(), thea_primitives::SigningError>{ - self.inner.offline_messages.lock().unwrap().push(payload); - Ok(()) - } - - fn submit_signing_message(_at: BlockNumber, payload: SigningSessionPayload, - _signature: thea_primitives::AuthoritySignature, _rng: u64) -> Result<(), thea_primitives::SigningError>{ - Ok(self.inner.signing_payloads.lock().unwrap().push(payload)) - } - - fn submit_signed_payload(&self, payload: SignedTheaPayload, _rng: u64) -> Result<(), thea_primitives::SigningError>{ - Ok(self.inner.signed_payloads.lock().unwrap().push(payload)) - } - - fn keygen_messages_api(party_idx: thea_primitives::PartyIndex, round: thea_primitives::keygen::KeygenRound) -> TheaPayload{ - match self.inner.keygen_messages.lock().unwrap().iter().find(|m| m.auth_idx == party_idx && m.round == round) { - Some(v) => v.clone(), - None => TheaPayload { round: KeygenRound::Unknown, ..Default::default() } - } - } - - fn offline_messages_api(party_idx: PartyIndex, round: OfflineStageRound, _payload: &[u8; 32]) -> TheaPayload{ - match self.inner.offline_messages.lock().unwrap().iter().find(|m| m.auth_idx == party_idx && m.round == round) { - Some(v) => v.clone(), - None => TheaPayload {round: OfflineStageRound::Unknown, ..Default::default()} - } - } - - fn signing_messages_api(_at: BlockNumber) -> Vec>{ - self.inner.signing_payloads.lock().unwrap().clone() - } - - fn unsigned_payloads_api(_at: BlockNumber) -> Vec{ - self.inner.unsigned_payloads.lock().unwrap().clone() - } - fn signed_payloads_api(_at: BlockNumber) -> Vec{ - self.inner.signed_payloads.lock().unwrap().clone() - } - - fn clean_keygen_messages(&self, _auth_idx: AuthorityIndex, _signature: thea_primitives::AuthoritySignature, _rng: u64) -> Result<(),thea_primitives::SigningError>{ - *self.inner.keygen_messages.lock().unwrap() = vec![]; - //*self.inner.signed_payloads.lock().unwrap() = vec![]; - //*self.inner.signing_payloads.lock().unwrap() = vec![]; - Ok(()) - } - - fn is_validator_set_changed(&self) -> bool { - *self.inner.validator_set_changed.lock().unwrap() - } - fn register_offence(signature: thea_primitives::AuthoritySignature, offence: thea_primitives::keygen::OffenseReport) -> Result<(),thea_primitives::SigningError>{ - Ok(()) - } - - } -} - -impl GenesisAuthoritySetProvider for TestApi { - fn get(&self) -> sp_blockchain::Result { - Ok(self.genesis_authorities.clone()) - } -} - -fn create_keystore(authority: Ed25519Keyring) -> (SyncCryptoStorePtr, tempfile::TempDir) { - let keystore_path = tempfile::tempdir().expect("Creates keystore path"); - let keystore = - Arc::new(LocalKeystore::open(keystore_path.path(), None).expect("Creates keystore")); - SyncCryptoStore::ed25519_generate_new(&*keystore, GRANDPA, Some(&authority.to_seed())) - .expect("Creates authority key"); - - (keystore, keystore_path) -} - -// Spawns grandpa voters. Returns a future to spawn on the runtime. -fn initialize_grandpa( - net: &mut TheaTestNet, - grandpa_peers: &[Ed25519Keyring], -) -> impl Future { - let voters = FuturesUnordered::new(); - - // initializing grandpa gadget per peer - for (peer_id, key) in grandpa_peers.iter().enumerate() { - let (keystore, _) = create_keystore(*key); - - let (net_service, link) = { - // temporary needed for some reason - let link = - net.peers[peer_id].data.lock().take().expect("link initialized at startup; qed"); - (net.peers[peer_id].network_service().clone(), link) - }; - - let grandpa_params = GrandpaParams { - config: Config { - gossip_duration: TEST_GOSSIP_DURATION, - justification_period: 32, - keystore: Some(keystore), - name: Some(format!("peer#{}", peer_id)), - local_role: Role::Authority, - observer_enabled: true, - telemetry: None, - protocol_name: GRANDPA_PROTOCOL_NAME.into(), - }, - link, - network: net_service, - voting_rule: (), - prometheus_registry: None, - shared_voter_state: SharedVoterState::empty(), - telemetry: None, - }; - let voter = - run_grandpa_voter(grandpa_params).expect("all in order with client and network"); - - fn assert_send(_: &T) {} - assert_send(&voter); - - voters.push(voter); - } - - voters.for_each(|_| async move {}) -} - -// Spawns thea workers. Returns a future to spawn on the runtime. -fn initialize_thea( - net: &mut TheaTestNet, - peers: Vec<(usize, &TheaKeyring, Arc)>, -) -> impl Future -where - API: ProvideRuntimeApi + Send + Sync + Default, - API::Api: TheaApi, -{ - let thea_workers = FuturesUnordered::new(); - - let (sender, _) = std::sync::mpsc::channel(); - let rpc_send = Arc::new(std::sync::Mutex::new(sender)); - - // initializing thea gadget per peer - for (peer_id, key, api) in peers.into_iter() { - let peer = &net.peers[peer_id]; - - let keystore = create_thea_keystore(*key); - - let rpc_send = rpc_send.clone(); - let thea_params = TheaParams { - client: peer.client().as_client(), - backend: peer.client().as_backend(), - runtime: api.clone(), - key_store: Some(keystore), - rpc_send, - }; - let gadget = start_thea_gadget::<_, _, _, _>(thea_params); - - fn assert_send(_: &T) {} - assert_send(&gadget); - thea_workers.push(gadget); - } - - thea_workers.for_each(|_| async move {}) -} - -fn block_until_complete( - future: impl Future + Unpin, - net: &Arc>, - runtime: &mut Runtime, -) { - let drive_to_completion = futures::future::poll_fn(|cx| { - net.lock().poll(cx); - Poll::<()>::Pending - }); - runtime.block_on(future::select(future, drive_to_completion)); -} - -// run the voters to completion. provide a closure to be invoked after -// the voters are spawned but before blocking on them. -fn run_to_completion_with( - runtime: &mut Runtime, - blocks: u64, - net: Arc>, - peers: &[TheaKeyring], - with: F, -) -> u64 -where - F: FnOnce(Handle) -> Option>>>, -{ - let mut wait_for = Vec::new(); - - let highest_finalized = Arc::new(RwLock::new(0)); - - if let Some(f) = (with)(runtime.handle().clone()) { - wait_for.push(f); - }; - - for (peer_id, _) in peers.iter().enumerate() { - let highest_finalized = highest_finalized.clone(); - let client = net.lock().peers[peer_id].client().clone(); - - wait_for.push(Box::pin( - client - .finality_notification_stream() - .take_while(move |n| { - let mut highest_finalized = highest_finalized.write(); - if *n.header.number() > *highest_finalized { - *highest_finalized = *n.header.number(); - } - future::ready(n.header.number() < &blocks) - }) - .collect::>() - .map(|_| ()), - )); - } - - // wait for all finalized on each. - let wait_for = ::futures::future::join_all(wait_for); - - block_until_complete(wait_for, &net, runtime); - let highest_finalized = *highest_finalized.read(); - highest_finalized -} - -fn run_to_completion( - runtime: &mut Runtime, - blocks: u64, - net: Arc>, - peers: &[TheaKeyring], -) -> u64 { - run_to_completion_with(runtime, blocks, net, peers, |_| None) -} - -fn make_gradpa_ids(keys: &[Ed25519Keyring]) -> AuthorityList { - keys.iter().map(|key| key.clone().public().into()).map(|id| (id, 1)).collect() -} - -fn full_keygen_cycle( - net: Arc>, - thea_api: Arc, - runtime: &mut Runtime, - validator_set: ValidatorSet, - peers: &[Keyring], - start_block: u64, -) { - let sleep_time_sec = Duration::from_secs(5); - // first block - net.lock().generate_blocks(1, 10, &validator_set); - net.lock().block_until_sync(); - // Verify all peers synchronized - for i in 0..3 { - assert_eq!( - net.lock().peer(i).client().info().best_number, - start_block, - "Peer #{} failed to sync", - i - ); - } - - run_to_completion(runtime, start_block, net.clone(), peers); - - for i in 0..3 { - assert_eq!( - net.lock().peer(i).client().info().finalized_number, - start_block, - "Peer #{} failed to finalize", - i - ); - } - sleep(sleep_time_sec); - assert_ne!(*thea_api.last_keygen_round.lock().unwrap(), KeygenRound::Unknown); - - // second block - net.lock().generate_blocks(1, 10, &validator_set); - net.lock().block_until_sync(); - let mut next_block = start_block + 1; - // Verify all peers synchronized - for i in 0..3 { - // checking if all three validator submitted first round payloads - assert_ne!( - thea_api - .runtime_api() - .keygen_messages_api( - &BlockId::Number(next_block), - i as u16 as PartyIndex, - KeygenRound::Round1 - ) - .unwrap(), - TheaPayload { round: KeygenRound::Unknown, ..Default::default() } - ); - assert_eq!( - net.lock().peer(i).client().info().best_number, - next_block, - "Peer #{} failed to sync", - i - ); - } - - run_to_completion(runtime, next_block, net.clone(), peers); - - for i in 0..3 { - assert_eq!( - net.lock().peer(i).client().info().finalized_number, - next_block, - "Peer #{} failed to finalize", - i - ); - } - sleep(sleep_time_sec); - - // third block - net.lock().generate_blocks(1, 10, &validator_set); - net.lock().block_until_sync(); - next_block += 1; - // Verify all peers synchronized - for i in 0..3 { - // checking if all three validator submitted second round payloads - assert_ne!( - thea_api - .runtime_api() - .keygen_messages_api( - &BlockId::Number(next_block), - i as u16 as PartyIndex, - KeygenRound::Round2 - ) - .unwrap(), - TheaPayload { round: KeygenRound::Unknown, ..Default::default() } - ); - assert_eq!( - net.lock().peer(i).client().info().best_number, - next_block, - "Peer #{} failed to sync", - i - ); - } - - run_to_completion(runtime, next_block, net.clone(), peers); - - for i in 0..3 { - assert_eq!( - net.lock().peer(i).client().info().finalized_number, - next_block, - "Peer #{} failed to finalize", - i - ); - } - sleep(sleep_time_sec); - - // fourth block - net.lock().generate_blocks(1, 10, &validator_set); - net.lock().block_until_sync(); - next_block += 1; - // Verify all peers synchronized - for i in 0..3 { - // checking if all three validator submitted second round payloads - assert_ne!( - thea_api - .runtime_api() - .keygen_messages_api( - &BlockId::Number(next_block), - i as u16 as PartyIndex, - KeygenRound::Round3 - ) - .unwrap(), - TheaPayload { round: KeygenRound::Unknown, ..Default::default() } - ); - assert_eq!( - net.lock().peer(i).client().info().best_number, - next_block, - "Peer #{} failed to sync", - i - ); - } - - run_to_completion(runtime, next_block, net.clone(), peers); - - for i in 0..3 { - assert_eq!( - net.lock().peer(i).client().info().finalized_number, - next_block, - "Peer #{} failed to finalize", - i - ); - } - sleep(sleep_time_sec); - - // fifth block - keygen should be completed by now - net.lock().generate_blocks(1, 10, &validator_set); - net.lock().block_until_sync(); - next_block += 1; - - // Verify all peers synchronized - for i in 0..3 { - // checking if all three validator submitted second round payloads - assert_ne!( - thea_api - .runtime_api() - .keygen_messages_api( - &BlockId::Number(next_block), - i as u16 as PartyIndex, - KeygenRound::Round4 - ) - .unwrap(), - TheaPayload { round: KeygenRound::Unknown, ..Default::default() } - ); - assert_eq!( - net.lock().peer(i).client().info().best_number, - next_block, - "Peer #{} failed to sync", - i - ); - } - - run_to_completion(runtime, next_block, net.clone(), peers); - - for i in 0..3 { - assert_eq!( - net.lock().peer(i).client().info().finalized_number, - next_block, - "Peer #{} failed to finalize", - i - ); - } - sleep(sleep_time_sec); - - // few more blocks to see all is good and to finish the session - net.lock().generate_blocks(5, 10, &validator_set); - net.lock().block_until_sync(); - // cleaning up our keygen payloads - thea_api - .runtime_api() - .clean_keygen_messages( - &BlockId::Number(next_block), - 0, - Signature::decode(&mut [0u8; 64].as_ref()).unwrap(), - 0, - ) - .unwrap(); - // let it soack in - sleep(sleep_time_sec); -} - -#[test] -fn thea_keygen_completes() { - // TODO: uncomment this after CI can filter out Grandpa stopped errors - // Uncomment to get sp_tracing errors output - //sp_tracing::try_init_simple(); - - // our runtime for the test chain - let mut runtime = Runtime::new().unwrap(); - - // creating 3 validators - let peers = &[TheaKeyring::Alice, TheaKeyring::Bob, TheaKeyring::Charlie]; - let grandpa_peers = &[Ed25519Keyring::Alice, Ed25519Keyring::Bob, Ed25519Keyring::Charlie]; - let voters = make_gradpa_ids(grandpa_peers); - - // setting initial thea id to 0 - let validator_set = ValidatorSet::new(make_thea_ids(peers), 0); - let thea_api = Arc::new(TestApi { - genesys_validator_set: vec![TheaKeyring::Alice, TheaKeyring::Bob, TheaKeyring::Charlie], - next_validator_set: vec![TheaKeyring::Alice, TheaKeyring::Charlie, TheaKeyring::Dave], - genesis_authorities: voters, - ..Default::default() - }); - - // our thea network with 3 authorities and 1 full peer - let mut network = TheaTestNet::new(3, 1, thea_api.clone()); - let thea_peers = peers - .iter() - .enumerate() - .map(|(id, p)| (id, p, thea_api.clone())) - .collect::>(); - - runtime.spawn(initialize_grandpa(&mut network, grandpa_peers)); - runtime.spawn(initialize_thea(&mut network, thea_peers)); - - // Pushing 20 block - thea keygen should be done after this point - network.generate_blocks(20, 10, &validator_set); - network.block_until_sync(); - - // Verify all peers synchronized - for i in 0..3 { - assert_eq!(network.peer(i).client().info().best_number, 20, "Peer #{} failed to sync", i); - } - - let net = Arc::new(Mutex::new(network)); - - run_to_completion(&mut runtime, 20, net.clone(), peers); - - for i in 0..3 { - assert_eq!( - net.lock().peer(i).client().info().finalized_number, - 20, - "Peer #{} failed to finalize", - i - ); - } - - // we need this as otherwise we'll end up checking storage before actual work is done in async - // tasks - sleep(Duration::from_secs(300)); -} - -#[test] -fn thea_keygen_block_by_block() { - // TODO: uncomment this after CI can filter out Grandpa stopped errors - // Uncomment to get sp_tracing errors output - //sp_tracing::try_init_simple(); - - // our runtime for the test chain - let mut runtime = Runtime::new().unwrap(); - - // creating 3 validators - let peers = &[TheaKeyring::Alice, TheaKeyring::Bob, TheaKeyring::Charlie, TheaKeyring::Dave]; - let grandpa_peers = &[ - Ed25519Keyring::Alice, - Ed25519Keyring::Bob, - Ed25519Keyring::Charlie, - Ed25519Keyring::Dave, - ]; - let voters = make_gradpa_ids(grandpa_peers); - - // setting initial thea id to 0 - let validator_set = ValidatorSet::new(make_thea_ids(peers), 0); - let thea_api = Arc::new(TestApi { - genesys_validator_set: vec![TheaKeyring::Alice, TheaKeyring::Bob, TheaKeyring::Charlie], - next_validator_set: vec![TheaKeyring::Alice, TheaKeyring::Charlie, TheaKeyring::Dave], - genesis_authorities: voters, - ..Default::default() - }); - - // our thea network with 3 authorities and 1 full peer - let mut network = TheaTestNet::new(4, 0, thea_api.clone()); - let thea_peers = peers - .iter() - .enumerate() - .map(|(id, p)| (id, p, thea_api.clone())) - .collect::>(); - - runtime.spawn(initialize_grandpa(&mut network, grandpa_peers)); - runtime.spawn(initialize_thea(&mut network, thea_peers)); - - let net = Arc::new(Mutex::new(network)); - - // run first keygen block by block - // we start with block 1 - full_keygen_cycle( - net.clone(), - thea_api.clone(), - &mut runtime, - validator_set.clone(), - peers, - 1u64, - ); - - sleep(Duration::from_secs(20)); - - // confirming we went through all rounds - assert_eq!(*thea_api.last_keygen_round.lock().unwrap(), KeygenRound::Round4); - - // Now rotating validators - *thea_api.validator_set_changed.lock().unwrap() = true; - - // now we've set validator set changed and start from block 11 - full_keygen_cycle(net.clone(), thea_api.clone(), &mut runtime, validator_set, peers, 11u64); - - sleep(Duration::from_secs(20)); - // Here if no errors? we are good with validator change! -} diff --git a/client/thea/src/utils.rs b/client/thea/src/utils.rs deleted file mode 100644 index 118bf6639..000000000 --- a/client/thea/src/utils.rs +++ /dev/null @@ -1,199 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use codec::Codec; -use curv::arithmetic::Converter; -use frame_support::BoundedVec; -use log::*; -use multi_party_ecdsa::protocols::multi_party_ecdsa::gg_2020::{ - party_i::SignatureRecid, state_machine::traits::RoundBlame, -}; -use round_based::{Msg, StateMachine}; -use serde::{de::DeserializeOwned, Serialize}; - -use sp_runtime::{ - generic::OpaqueDigestItemId, - traits::{Block, Header}, -}; - -use thea_primitives::{ - keygen, keygen::TheaPayload, payload::SignedTheaPayload, AuthorityId, ConsensusLog, PartyIndex, - ValidatorSet, THEA_ENGINE_ID, -}; - -use crate::{error, error::Error}; - -/// Scan the `header` digest log for a THEA validator set change. Return either the new -/// validator set or `None` in case no validator set change has been signaled. -pub fn find_authorities_change(header: &B::Header) -> Option> -where - B: Block, - Id: Codec, -{ - let id = OpaqueDigestItemId::Consensus(&THEA_ENGINE_ID); - - let filter = |log: ConsensusLog| match log { - ConsensusLog::AuthoritiesChange(validator_set) => Some(validator_set), - _ => None, - }; - - header.digest().convert_first(|l| l.try_to(id).and_then(filter)) -} - -/// Thea protocol needs threshold to be greater than 1 and less than n -/// Also, the current implementation of mpc expects threshold to be greater than 50% -pub fn threshold_parties(n: u16) -> u16 { - (2 * n + 1) / 3 -} - -pub fn convert_keygen_message( - msg: &Msg, -) -> Result, Error> -where - S: Serialize, -{ - if let Ok(messages) = serde_json::to_vec(&msg.body) { - Ok(keygen::Msg { - sender: msg.sender, - receiver: msg.receiver, - message: BoundedVec::try_from(messages)?, - }) - } else { - log::error!(target:"thea","Unable to encode keygen message, silently ignoring!"); - Err(Error::SerdeError(String::from("Unable to serialize message body"))) - } -} - -pub fn convert_all_keygen_messages( - msgs: impl AsRef<[Msg]>, -) -> Result, thea_primitives::MsgVecLimit>, Error> -where - S: Serialize, -{ - // TODO: I don't like this solution, does anyone have a better idea? - let messages: Vec> = msgs - .as_ref() - .iter() - .map(convert_keygen_message) - .filter(|res| res.is_ok()) - .map(|res| res.unwrap()) - .collect(); - - Ok(BoundedVec::try_from(messages)?) -} - -/// Converts a thea payload to it's original multi-party-ecdsa types -/// It will fail even if one of the messages failed to deserialize -pub fn convert_back_keygen_messages( - payload: TheaPayload, -) -> Result, thea_primitives::MsgVecLimit>, Error> -where - R: Codec + Default, - S: DeserializeOwned, -{ - let mut converted_msgs = vec![]; - for msg in payload.messages { - converted_msgs.push(Msg { - sender: msg.sender, - receiver: msg.receiver, - body: serde_json::from_slice(&msg.message)?, // TODO: Fix a better lifetime - }); - } - - Ok(BoundedVec::try_from(converted_msgs)?) -} - -pub fn generate_party_index_sequence(n: PartyIndex) -> Vec { - let x = (1..n + 1).into_iter().collect(); - debug!(target:"thea", "S_l sequence: {:?}, total parties: {:?}", x, n); - x -} - -pub(crate) fn handling_incoming_messages( - msgs: BoundedVec, thea_primitives::MsgVecLimit>, - local_instance: &mut K, -) -> Result<(Vec>, u16), Error> -where - K: StateMachine + RoundBlame, - error::Error: From<::Err>, - S: Clone, -{ - for message in msgs { - match message.receiver { - // We should only process messages meant for us - Some(receiver) if receiver == local_instance.party_ind() => { - // This is an expensive computation - local_instance.handle_incoming(message)?; - }, - // or meant for everyone - None => { - // This is an expensive computation - local_instance.handle_incoming(message)?; - }, - _ => {}, - } - } - debug!(target: "thea", "State Machine Status(round blame): {:?}", local_instance.round_blame()); - if local_instance.wants_to_proceed() { - // This is an expensive computation - local_instance.proceed()?; - } - let messages = local_instance.message_queue().clone(); - local_instance.message_queue().clear(); - Ok((messages, local_instance.current_round())) -} - -pub fn convert_signature(signature: &SignatureRecid) -> Result { - let recid = secp256k1::ecdsa::RecoveryId::from_i32(signature.recid as i32)?; - let mut signature_template = signature.r.to_bigint().to_bytes(); - signature_template.append(&mut signature.s.to_bigint().to_bytes()); - let signature_converted = - secp256k1::ecdsa::RecoverableSignature::from_compact(&signature_template, recid)?; - - // TODO: Inbuilt conversion is not working for some reason., copy pasted the code here - let mut r = sp_core::ecdsa::Signature::default(); - let (recid, sig) = signature_converted.serialize_compact(); - r.0[..64].copy_from_slice(&sig); - // This is safe due to the limited range of possible valid ids. - r.0[64] = recid.to_i32() as u8; - - Ok(r) -} - -pub fn handle_error(result: Result<(), Error>, tag: &str) { - if let Err(err) = result { - error!(target: "thea", "{:?}, {:?}", tag, err) - } -} - -pub fn verify_payload( - pubk: &sp_core::ecdsa::Public, - signed_payloads: &[SignedTheaPayload], -) -> Result<(), Error> { - for payload in signed_payloads { - if !thea_primitives::runtime::crypto::verify_ecdsa_prehashed( - &payload.signature, - pubk, - &payload.payload.payload, - ) { - error!(target:"thea", "Failed to verify Thea ecdsa key"); - return Err(Error::ECDSASignatureError(String::from("Signature verification Failed"))); - } - } - Ok(()) -} diff --git a/client/thea/src/worker.rs b/client/thea/src/worker.rs deleted file mode 100644 index 159d3c340..000000000 --- a/client/thea/src/worker.rs +++ /dev/null @@ -1,1061 +0,0 @@ -// Copyright (C) 2020-2022 Polkadex OU -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// This is file is modified from beefy-gadget from Parity Technologies (UK) Ltd. - -use codec::Encode; -use curv::{arithmetic::Converter, elliptic::curves::Secp256k1, BigInt}; -use frame_support::BoundedVec; -use futures::{FutureExt, StreamExt}; -use log::*; -use multi_party_ecdsa::protocols::multi_party_ecdsa::gg_2020::{ - party_i::SignatureRecid, - state_machine::{ - keygen::{Keygen, LocalKey, ProtocolMessage}, - sign::{OfflineProtocolMessage, OfflineStage, PartialSignature, SignManual}, - traits::RoundBlame, - }, -}; -use round_based::{IsCritical, Msg, StateMachine}; -use sc_client_api::{Backend, FinalityNotification, FinalityNotifications}; -use serde::{Deserialize, Serialize}; -use sp_api::{BlockId, ProvideRuntimeApi}; -use std::{ - collections::{HashMap, VecDeque}, - fmt::Debug, - marker::PhantomData, - str::FromStr, - sync::{mpsc::Sender, Arc, Mutex}, -}; - -use sp_core::ecdsa::Signature; -use sp_keystore::SyncCryptoStorePtr; -use sp_runtime::traits::{Block, Header}; - -use thea_primitives::{ - crypto::Public, - keygen::{ - KeygenRound, OfflineStageRound, ProvideSubProtocol, SigningSessionPayload, SubProtocol, - TheaPayload, - }, - payload::{Network, SignedTheaPayload, UnsignedTheaPayload}, - AuthorityId, TheaApi, ValidatorSet, ValidatorSetId, GENESIS_AUTHORITY_SET_ID, -}; - -use crate::{ - error::{self, Error}, - keystore::TheaKeystore, - rounds::RoundTracker, - utils::{ - convert_all_keygen_messages, convert_back_keygen_messages, convert_signature, - find_authorities_change, generate_party_index_sequence, handle_error, - handling_incoming_messages, threshold_parties, verify_payload, - }, - Client, -}; - -/// Struct returning satate of round -/// Aggregates outputs from `keygen_status()` and `offline_status()` -#[derive(Serialize, Deserialize, Debug, Default, Clone)] -pub struct RoundInfo { - pub current_round: u16, - pub offline_rounds: Vec, - pub keygen_status: (u16, Vec), - pub offline_statuses: Vec<(u16, Vec)>, - pub signing_session_info: HashMap>, -} - -#[derive(Serialize, Deserialize, Debug, Default, Clone)] -pub struct SigningSessionInfo { - pub unsigned_payload: UnsignedTheaPayload, - /* TODO: export inner `LocalSignature` from `SignManual` - *pub local_signature: LocalSignature, */ -} - -impl From for SigningSessionInfo { - fn from(ss: SigningSession) -> Self { - Self { unsigned_payload: ss.payload } - } -} - -pub(crate) struct WorkerParams { - pub client: Arc, - pub backend: Arc, - pub runtime: Arc, - pub rpc_send: Arc>>, - pub key_store: Option, -} - -/// A THEA worker plays protocol -pub struct TheaWorker -where - B: Block, - BE: Backend, - C: Client, - R: ProvideRuntimeApi, - R::Api: TheaApi, -{ - _client: Arc, - #[allow(dead_code)] - backend: Arc, - runtime: Arc, - key_store: TheaKeystore, - finality_notifications: FinalityNotifications, - rounds: Arc, - rpc_send: Arc>>, - /// Note the Vec is indexed in the same order as unsigned payloads - signing_sessions: HashMap>, - blocks_containing_payloads: VecDeque, - msg_counter: u64, - _be: PhantomData, -} -//is_first_keygen_generation: bool, -#[derive(Clone)] -pub struct SigningSession { - pub payload: UnsignedTheaPayload, - pub sign_manual: SignManual, -} - -impl TheaWorker -where - B: Block, - BE: Backend, - C: Client, - R: ProvideRuntimeApi, - R::Api: TheaApi, -{ - /// Return a new Thea worker instance. - /// - /// Note that a Thea worker is only fully functional if a corresponding - /// Thea pallet has been deployed on-chain. - /// - /// The Thea pallet is needed in order to keep track of the Thea authority set. - pub(crate) fn new(worker_params: WorkerParams) -> Self { - let WorkerParams { client, backend, runtime, rpc_send, key_store } = worker_params; - - TheaWorker { - _client: client.clone(), - backend, - runtime, - key_store: key_store.into(), - finality_notifications: client.finality_notification_stream(), - rounds: Arc::new(RoundTracker::new()), - rpc_send, - signing_sessions: HashMap::new(), - blocks_containing_payloads: VecDeque::new(), - msg_counter: u64::MIN, - _be: PhantomData::default(), - } - } -} - -impl TheaWorker -where - B: Block, - BE: Backend, - C: Client, - R: ProvideRuntimeApi, - R::Api: TheaApi, -{ - /// Return the current active validator set at header `header`. - /// - /// Note that the validator set could be `None`. This is the case if we don't find - /// a THEA authority set change and we can't fetch the authority set from the - /// THEA on-chain state. - /// - /// Such a failure is usually an indication that the THEA pallet has not been deployed (yet). - fn validator_set(&self, header: &B::Header) -> Option> { - find_authorities_change::(header).or_else(|| { - let at = BlockId::hash(header.hash()); - self.runtime.runtime_api().validator_set(&at).ok() - }) - } - - /// Return true if New validators are going to be selected for Next Era - fn is_validator_changed(&self, header: &B::Header) -> Option { - let at = BlockId::hash(header.hash()); - self.runtime.runtime_api().is_validator_set_changed(&at).ok() - } - - /// Return the next active validator set at header `header`. - fn next_validator_set(&self, header: &B::Header) -> Option> { - let at = BlockId::hash(header.hash()); - self.runtime.runtime_api().next_validator_set(&at).ok() - } - - /// Refs current `signing_sessions` state - pub fn get_current_signing_sessions(&self) -> &HashMap> { - &self.signing_sessions - } - - fn collect_unsigned_payloads( - &self, - block_id: &<::Header as Header>::Number, - ) -> Result, Error> { - let at = BlockId::Number(*block_id); - let blk_num: u32 = u32::from_str(&block_id.to_string())?; - Ok(self.runtime.runtime_api().unsigned_payloads_api(&at, blk_num)?) - } - - fn collect_round_info( - &self, - validator_set_id: ValidatorSetId, - // TODO: should this be for current block? - block_id: &<::Header as Header>::Number, - ) -> Result { - let current_round = self.rounds.current_round(validator_set_id)?; - let unsigned_payload: Vec = - self.collect_unsigned_payloads(block_id)?; - let mut offline_rounds = vec![]; - let mut offline_statuses = vec![]; - for unsigned in unsigned_payload { - offline_rounds - .push(self.rounds.offline_current_round(validator_set_id, &unsigned.payload)?); - offline_statuses.push(self.rounds.offline_status(validator_set_id, &unsigned.payload)?); - } - let keygen_status = self.rounds.keygen_status(validator_set_id)?; - let signing_session_info = self - .get_current_signing_sessions() - .iter() - .map(|(k, v)| (*k, v.clone().into_iter().map(SigningSessionInfo::from).collect())) - .collect(); - Ok(RoundInfo { - current_round, - offline_rounds, - keygen_status, - offline_statuses, - signing_session_info, - }) - } - - // when keygen is finished or set id updated but no keygen happened, we need to update the round - // tracker - fn collect_keygen_payload(&mut self, id: u64) { - if let Some(rounds) = - self.get_mut_rounds_or_log("Failed to get mut ref to rounds for thea output pick up") - { - match rounds.pick_output(id) { - Ok(local_key) => { - if rounds.set_local_key(id, local_key).is_err() { - error!(target: "thea", "Error setting thea's local key"); - return; - } - handle_error(rounds.set_keygen_completed(&id, true), "set_keygen_completed"); - }, - Err(err) => { - error!(target: "thea", "Unable to get local key: {:?}",err); - return; - }, - } - info!(target: "thea", "🎂 New key set complete"); - } - } - - /// Note Thea protocol progresses only with each finalized block, so if finality fails then thea - /// will not progress. We need to make sure every action taken by thea protocol must be only - /// after the cause of that action is finalized in Polkadex. - pub fn handle_finality_notification(&mut self, notification: FinalityNotification) { - debug!(target: "thea", "🥩 Got New Finality notification: {:?}", notification.header.number()); - let validator_changed = self.is_validator_changed(¬ification.header).unwrap_or(false); - debug!(target: "thea", "Validator changed? {}", validator_changed); - if let Some(active) = if validator_changed { - debug!(target: "thea", "Using next validator set"); - self.next_validator_set(¬ification.header) - } else { - debug!(target: "thea", "Using current validator set"); - self.validator_set(¬ification.header) - } { - if let Some(authority) = self.has_thea_key(&active) { - let mut rng = (authority.0 as u64) + 100; - // skip first keygen if one is started already - if (active.id == GENESIS_AUTHORITY_SET_ID || validator_changed) - && self.rounds.get_keygen_not_started(&active.id) - { - debug!(target: "thea", "Thea Party index: {:?}", authority.0); - debug!(target: "thea", "Thea AuthorityID: {:?}", authority.1); - debug!(target: "thea", "🥩 New active validator set id: {:?}", active); - if let Some(rounds) = self.get_mut_rounds_or_log( - "FATAL: failed to obtain mutable rounds for thea keygen. terminating", - ) { - rounds.new_round(active.id); - debug!(target: "thea", "🥩 New Rounds for id: {:?}", active.id); - if rounds - .set_active_validator_len(&active.id, active.validators.len()) - .is_err() - { - log::error!(target:"thea", "unable to set active validator length: id: {:?}, len: {:?}",active.id,active.validators.len()); - return; - } - rounds.set_active_round_id(active.id); - handle_error( - rounds.set_keygen_not_started(&active.id, false), - "set_keygen_not_started", - ); - handle_error( - rounds.set_validator_idx(&active.id, (authority.0 + 1) as u16), - "set_validator_idx", - ); - if let Err(err) = self.initialize_new_local_party( - &active.id, - active.validators.len() as u16, - (authority.0 + 1) as u16, - ) { - error!(target:"thea", "Unable to initialize new local party: id: {:?}, err: {:?}",active.id,err); - return; - } - match self.start_keygen(active.id) { - None => { - error!(target: "thea", "Error in Keygen subp-protocol"); - return; - }, - Some((messages, current_round)) => { - info!(target: "thea", "Sending first key generation message"); - match self - .generate_payload_and_submit::( - messages.as_ref(), - current_round, - &active, - notification.hash, - authority.clone(), - &[0u8; 32], // no mater what's here - rng, - ) { - Ok(_) => {}, - Err(err) => { - error!(target: "thea", "Error while submitting thea payload: {:?}",err); - return; - }, - } - }, - } - } - } else if let Ok(is_finished) = self.rounds.is_finished(active.id) { - if let Ok(is_keygen_completed) = self.rounds.get_keygen_completed(&active.id) { - if !is_finished && !is_keygen_completed { - rng += 1; - if let Err(err) = - self.progress_keygen_stage(&active, notification.hash, rng) - { - error!(target: "thea", "Error in progressing keygen stage: {:?}",err); - return; - } - debug!(target: "thea", "Progressing for {:?}", &active); - } else if is_finished && !is_keygen_completed { - debug!(target: "thea", "Keygen Protocol Finished, pick the output"); - self.collect_keygen_payload(active.id); - // cleaning up keygen payloads - rng += 1; - debug!(target: "thea", "Cleaning up after keygen"); - handle_error( - self.generate_clean_keygen_onchain_submit( - authority.0 as u16, - authority.1.clone(), - notification.hash, - rng, - ), - "generate_clean_keygen_onchain_submit", - ); - } - } else { - error!(target:"thea","Unable to get keygen completed flag: id: {:?}",active.id); - return; - } - } - - if let Ok(payloads) = self.rounds.get_offline_party(&active.id) { - for op in payloads { - debug!(target: "thea", "processing existing offline stage for: {:?}", &op); - if let Ok(is_offline_finished) = - self.rounds.is_offline_finished(active.id, &op) - { - if let Ok(is_offline_stage_completed) = - self.rounds.get_offline_stage_completed(&active.id, &op) - { - if !is_offline_stage_completed && !is_offline_finished { - let rng_increment = self.rng(&active.id, &op); - if let Err(err) = self.progress_offline_stage( - &active, - notification.hash, - &op, - rng_increment, - ) { - error!(target:"thea", "Error progressing offline stage: {:?}", err); - return; - } - } - } else { - error!(target:"thea","Unable to get offline stage completed flag: id: {:?}, op: {:?}",active.id,op); - return; - } - - if let Ok(is_offline_stage_completed) = - self.rounds.get_offline_stage_completed(&active.id, &op) - { - // Offline stage completed, pick the output - if !is_offline_stage_completed && is_offline_finished { - // TODO: Start from here - debug!(target: "thea", "Offline Stage Completed, pick the output"); - if let Some(rounds) = Arc::get_mut(&mut self.rounds) { - match rounds.pick_offline_output(active.id, &op) { - Ok(completed_offline_stage) => { - if rounds - .set_completed_offline_stage( - active.id, - completed_offline_stage, - &op, - ) - .is_err() - { - error!(target: "thea", "Error setting thea's local key"); - return; - } - if rounds - .set_offline_stage_completed( - &active.id, true, &op, - ) - .is_err() - { - error!(target:"thea","Unable to set offline stage completed to true: id: {:?} , payload: {:?}",active.id,op); - return; - } - // now it's time to sign and clean up - let rng_increment = self.rng(&active.id, &op); - - if let Ok(submission_blk) = - self.rounds.submission_block(active.id, &op) - { - handle_error( - self.start_signing_for_payload( - notification.header.number(), - &active, - UnsignedTheaPayload { - network: Network::ETHEREUM, - payload: op, - submission_blk, - }, - rng_increment, - ), - "start_signing_for_payload", - ); - } else { - error!(target:"thea","Unable to find submission_blk: {:?}",self - .rounds - .submission_block(active.id, &op) ); - return; - } - - // TODO: implement cleanup per offline payload only - }, - Err(err) => { - error!(target: "thea", "Unable to pick offline stage output: {:?}",err); - return; - }, - } - } - } - } else { - error!(target:"thea","Unable to get offline stage completed flag: id: {:?}, op: {:?}",active.id,op); - } - } - } - } - - if let Ok(unsigned_payloads) = - self.collect_unsigned_payloads(notification.header.number()) - { - if unsigned_payloads.len() > 0 { - debug!(target: "thea", "found {} unsigned payloads", unsigned_payloads.len()); - if let Ok(is_keygen_completed) = - self.rounds.get_keygen_completed(&active.id) - { - for up in unsigned_payloads { - if let Ok(is_offline_stage_started) = - self.rounds.get_offline_stage_started(&active.id, &up.payload) - { - if is_keygen_completed && !is_offline_stage_started { - match self.rounds.get_mpc_local_key(active.id) { - Err(err) => { - error!(target: "thea", "unable to get local key: {:?}",err); - return; - }, - Ok(local_key) => { - debug!(target: "thea", "starting offline stage for: {:?}", &up.payload); - let rng_increment = - self.rng(&active.id, &up.payload); - if let Err(err) = self.start_offline_stage( - &active, - local_key.clone(), - notification.hash, - authority.clone(), - &(up.submission_blk, up.payload), - rng_increment, // need to store block number - ) { - error!(target:"thea","Unable to start new offline stage: id: {:?}, err: {:?}",active.id,err); - return; - } - }, - } - } - } else { - error!(target:"thea","unable to get offline stage started flag: id: {:?} payload: {:?}",active.id,up.payload); - return; - } - } - } else { - error!(target:"thea","unable to get keygen stage completed flag: id: {:?}",active.id); - return; - } - } - } - - // Signing module is ready - let _ = self.check_pending_signing_session( - notification.header.number(), - active.id, - rng, - ); - - // rpc report section - let report = match self.collect_round_info(active.id, notification.header.number()) - { - Ok(data) => data, - Err(e) => { - debug!(target: "thea", "failed to collect round info for RPC. Details: {}", e.to_string()); - Default::default() - }, - }; - match self.rpc_send.lock() { - Ok(sender) => match sender.send(report) { - Ok(_) => debug!(target: "thea", "RPC round info sent successfully"), - Err(e) => { - debug!(target: "thea", "failed to send round info into channel. Details: {}", e.to_string()) - }, - }, - Err(e) => { - debug!(target: "thea", "failed to lock sender for RPC round info update. Details: {}", e.to_string()) - }, - } - } - } - - // resetting counter for the next block's rng - self.msg_counter = u64::MIN; - } - - // Start signing process for given payload - // In parallel, sign payload and create a single broadcast message - // Submit to runtime - //fn check_new_payloads_for_signing( - fn start_signing_for_payload( - &mut self, - current_block_number: &<::Header as Header>::Number, - active: &ValidatorSet, - payload: UnsignedTheaPayload, - rng: u64, - ) -> Result<(), Error> { - let at = BlockId::Number(*current_block_number); - let blk_num: u32 = u32::from_str(¤t_block_number.to_string())?; - - let authority_public_key = - self.has_thea_key(active).ok_or(Error::UnableToFindAuthorityFromKeystore)?.1; - let mut sessions = vec![]; - let mut signing_session_payload = SigningSessionPayload { - partial_signatures: BoundedVec::default(), - signer: Some(authority_public_key.clone()), - set_id: active.id, - auth_idx: self.rounds.get_validator_idx(&active.id)? - 1, - }; - let cos = self.rounds.get_completed_offline_stage(active.id, &payload.payload)?; - let (sign_manual, msg) = SignManual::new(BigInt::from_bytes(&payload.payload), cos)?; - sessions.push(SigningSession { payload, sign_manual }); - signing_session_payload - .partial_signatures - .try_push(BoundedVec::try_from(serde_json::to_vec(&msg)?)?)?; - if !sessions.is_empty() { - let signature = - self.key_store.sign(&authority_public_key, &signing_session_payload.encode())?; - // Submit signed_payloads to runtime - self.runtime.runtime_api().submit_signing_message( - &at, - blk_num, - signing_session_payload, - signature, - rng, - )??; - self.blocks_containing_payloads.push_back(blk_num); - self.signing_sessions.insert(blk_num, sessions); - } - - Ok(()) - } - - // Check if there are any previous signing session to complete if so, complete the signature - fn check_pending_signing_session( - &mut self, - current_block_number: &<::Header as Header>::Number, - id: ValidatorSetId, - rng: u64, - ) -> Result<(), Error> { - let at = BlockId::Number(*current_block_number); - let earliest_block_with_incomplete_sign_session = - self.blocks_containing_payloads.get(0).ok_or(Error::NoPayloadPending)?; - let others_partial_signatures = self - .runtime - .runtime_api() - .signing_messages_api(&at, *earliest_block_with_incomplete_sign_session)?; - - // If we got less than the required number of signatures, then exit - if others_partial_signatures.len() - < threshold_parties(self.rounds.get_active_validator_len(&id)? as u16).into() - { - debug!(target: "thea", "Waiting for more partial signatures for payloads in blk: {:?} at finalized block: {:?}",earliest_block_with_incomplete_sign_session,current_block_number); - return Ok(()); - } - // others_partial_signatures is formatted as Vec - // SigningSessionPayload is contains a vector of PartialSignatures from a single party for - // all payloads at a given block - // - // We need to reformat that to Vec>, where Vec - // contains partial signs from all parties for a given payload - let num_payloads: usize = others_partial_signatures[0].partial_signatures.len(); - let mut vec_signs: Vec> = vec![vec![]; num_payloads]; - let mut auth_idx = 0; - for signing_session in others_partial_signatures { - if auth_idx == self.rounds.get_validator_idx(&id)? { - continue; - } - for (payload_idx, vec_signs_item) in - vec_signs.iter_mut().enumerate().take(signing_session.partial_signatures.len()) - { - let partial_sign: PartialSignature = - serde_json::from_slice(&signing_session.partial_signatures[payload_idx])?; - // vec_signs[payload_idx].push(partial_sign); - vec_signs_item.push(partial_sign); - } - auth_idx += 1; - } - let sessions = self - .signing_sessions - .get(earliest_block_with_incomplete_sign_session) - .ok_or(Error::UnableToFindSigningSession)?; - - let mut signed_payloads: Vec = vec![]; - for session_idx in 0..sessions.len() { - let session = sessions[session_idx].clone(); - let mpc_signature: SignatureRecid = - session.sign_manual.complete(&vec_signs[session_idx])?.clone(); - let signature: Signature = convert_signature(&mpc_signature)?; - // Create a SignedTheaPayload with the signature - signed_payloads.push(SignedTheaPayload { payload: session.payload, signature }); - } - let public_key = self.rounds.get_local_key(id)?; - debug!(target: "thea", "verifying using local key: {:?}", &public_key); - verify_payload(&public_key, &signed_payloads)?; - // cleanup offline stage for this payload - if let Some(tracker) = self.get_mut_rounds_or_log( - "Failed to obtain mut ref to rounds tracker for signed payload OS cleanup", - ) { - for sp in signed_payloads.iter() { - tracker.remove_offline_stage(&id, &sp.payload.payload); - tracker.remove_completed_stage(&id, &sp.payload.payload); - } - } - if !signed_payloads.is_empty() { - // Submit signed_payloads to runtime - // as we might have more then one unsigned payload from prev blocks (network delays or - // whatnot) - need to loop - for payload in signed_payloads { - self.runtime.runtime_api().submit_signed_payload(&at, payload, rng)??; - } - let blk = self.blocks_containing_payloads.pop_front().ok_or(Error::NoBlockInQueue)?; - // self.blocks_containing_payloads.push_front(blk); // TODO: FOR DEBUG - self.signing_sessions.remove(&blk); - debug!(target: "thea", "Signing Completed for first unsigned payload in block: {:?}",blk); - } - Ok(()) - } - - fn progress_keygen_stage( - &mut self, - active: &ValidatorSet, - at_hash: ::Hash, - rng: u64, - ) -> Result<(), Error> { - let at = BlockId::hash(at_hash); - let (auth_idx, authority_public_key) = - self.has_thea_key(active).ok_or(Error::UnableToFindAuthorityFromKeystore)?; - - let (count, blames) = self.rounds.keygen_status(active.id)?; - debug!(target: "thea", "Blames: {:?}, Count: {:?}",blames,count); - let current_round = self.rounds.current_round(active.id)?; - debug!(target: "thea", "Local party status: {:?}",current_round); - for blame in blames { - match self.runtime.runtime_api().keygen_messages_api( - &at, - blame - 1, - current_round.into(), - ) { - // Note round can never be Unknown, if it is Unknown then it's - // considered Default value - Ok(payload) if payload.round != KeygenRound::Unknown => { - // if we fail here - which should not happen ever - // we can still progress on next block when some unknown locks are released - if let Some(rounds) = self.get_mut_rounds_or_log( - "failed to acquire mut ref rounds for progress_keygen_stage", - ) { - // debug!(target: "thea", "Read payload from sender: {:?}, - // payload: \n {:?}",blame-1,payload); - let payload = - convert_back_keygen_messages::(payload)?; - let (messages, current_round) = - handling_incoming_messages::( - payload, - rounds.mutable_local_party(active.id)?, - )?; - if !messages.is_empty() { - self.generate_payload_and_submit::( - &messages, - current_round, - active, - at_hash, - (auth_idx, authority_public_key.clone()), - &[0u8; 32], - rng, - )?; - } - } - }, - _ => { - debug!(target: "thea", "ignoring irrelevant payload for - sender: {:?} from runtime at: {:?}",blame,at); - }, - } - } - - Ok(()) - } - - /// Once keygen is completed, we start the offline stage protocol - /// that will set up the signing module. - fn start_offline_stage( - &mut self, - active: &ValidatorSet, - local_key: LocalKey, - at_hash: ::Hash, - authority: (usize, Public), - payload_details: &(u32, [u8; 32]), - rng: u64, - ) -> Result<(), Error> { - let mlp = self - .get_mut_rounds_or_log("failed to acquire mut ref tracker for start_offline_stage") - .map(|tracker| tracker.mutable_local_party(active.id)); - if let Some(Ok(local_party)) = mlp { - match OfflineStage::new( - local_party.party_ind(), - generate_party_index_sequence(local_party.parties()), - local_key, - ) { - Err(err) => error!(target: "thea", "Error in initializing offline stage: {:?}",err), - Ok(mut offline_stage) => { - if offline_stage.wants_to_proceed() { - match offline_stage.proceed() { - Ok(_) => { - debug!(target: "thea", "Offline stage for {:?} started and proceeded", payload_details); - }, - Err(err) => { - if err.is_critical() { - error!(target:"thea", "Critical Error in OfflineStage StateMachine: {:?}", err); - } else { - warn!(target:"thea", "Error in OfflineStage StateMachine: {:?}", err); - } - }, - } - } - - // WARN: needs additional review after changes if logic is not intact! - self.generate_payload_and_submit::( - &offline_stage.message_queue().to_owned(), - offline_stage.current_round(), - active, - at_hash, - authority, - &payload_details.1, - rng, - )?; - offline_stage.message_queue().clear(); - - debug!(target: "thea", "Offline Stage Status: {:?}/7, RoundBlame: {:?}", offline_stage.current_round(),offline_stage.round_blame()); - if let Some(tracker) = self.get_mut_rounds_or_log("failed to acquire mut ref tracekir for set offline party and stage started") { - tracker.set_offline_party(&active.id, offline_stage, payload_details.0, &payload_details.1)?; - handle_error(tracker.set_offline_stage_started(&active.id, true, &payload_details.1), "set_offline_stage_started"); - } - }, - } - } - Ok(()) - } - - fn progress_offline_stage( - &mut self, - active: &ValidatorSet, - at_hash: ::Hash, - pd: &[u8; 32], - rng: u64, - ) -> Result<(), Error> { - let at = BlockId::hash(at_hash); - let (auth_idx, authority_public_key) = - self.has_thea_key(active).ok_or(Error::UnableToFindAuthorityFromKeystore)?; - let (count, blames) = self.rounds.offline_status(active.id, pd)?; - let current_round = self.rounds.offline_current_round(active.id, pd)?; - debug!(target: "thea", "Offline Stage for {:?} => Blames: {:?}, Count: {:?}", &pd, blames, count); - debug!(target: "thea", "Offline Stage for {:?} status: {:?}/7", &pd, current_round); - - for blame in blames { - match self.runtime.runtime_api().offline_messages_api( - &at, - blame - 1, - current_round.into(), - pd, - ) { - // Note round can never be Unknown, if it is Unknown then it's - // considered Default value - Ok(payload) if payload.round != OfflineStageRound::Unknown => { - if let Some(tracker) = self.get_mut_rounds_or_log( - "failed to acquire mut ref tracker for progress_offline_stage", - ) { - // debug!(target: "thea", "Read payload from sender: {:?}, - // payload: \n {:?}",blame-1,payload); - let payload = convert_back_keygen_messages::< - OfflineStageRound, - OfflineProtocolMessage, - >(payload)?; - let (messages, current_round) = - handling_incoming_messages::( - payload, - tracker.mutable_offline_party(active.id, pd)?, - )?; - if !messages.is_empty() { - self.generate_payload_and_submit::( - &messages, - current_round, - active, - at_hash, - (auth_idx, authority_public_key.clone()), - pd, - rng, - )?; - } - } - }, - _ => { - debug!(target: "thea", "skipping irrelevant thea payload for - sender: {:?} from runtime at: {:?}", blame, at); - }, - } - } - - Ok(()) - } - - // this method should be called each time it's output is used to properly increment it in the - // cached store - fn rng(&mut self, id: &u64, op: &[u8; 32]) -> u64 { - let set_id = self.rounds.active_round_id(); - if let Some(tracker) = self.get_mut_rounds_or_log( - "failed to obtain mut ref to round tracker for payload rng. using default value", - ) { - let generated = tracker.rng_increment(id, op) + 105 + set_id + self.msg_counter; // 105 here to prevent clash - // of new payload message - debug!(target: "thea", "generated rng: {} for set: {}", generated, set_id); - self.msg_counter += 1; - generated - } else { - let def = 140 + set_id + self.msg_counter; - debug!(target: "thea", "using default value {} for set {}", def, set_id); - self.msg_counter += 1; - def - } - } - - fn generate_clean_keygen_onchain_submit( - &self, - auth_idx: thea_primitives::AuthorityIndex, - authority_public_key: Public, - at_hash: ::Hash, - rng: u64, - ) -> Result<(), error::Error> { - let at = BlockId::hash(at_hash); - let signature = self.key_store.sign(&authority_public_key, &auth_idx.encode())?; - match self.runtime.runtime_api().clean_keygen_messages(&at, auth_idx, signature, rng) { - Ok(res) => match res { - Ok(()) => { - debug!(target: "thea", "successfully submitted the {:?} messages", auth_idx); - }, - Err(err) => { - error!(target: "thea", "Unable to sign transaction; {:?}", err); - }, - }, - Err(err) => { - error!(target: "thea", "Error in runtime api call: {:?}", err); - }, - } - Ok(()) - } - - #[allow(clippy::too_many_arguments)] - fn generate_payload_and_submit( - &self, - messages: &[Msg], - current_round: u16, - active: &ValidatorSet, - at_hash: ::Hash, - authority_details: (usize, Public), - payload_array: &[u8; 32], - rng: u64, - ) -> Result<(), error::Error> - where - S: Serialize, - U: Debug + PartialEq + ProvideSubProtocol, - { - debug!(target: "thea", "generating payload for {:?}", &authority_details.1); - let at = BlockId::hash(at_hash); - if U::subprotocol() == SubProtocol::Keygen { - let payload = TheaPayload { - messages: convert_all_keygen_messages(messages)?, - signer: Some(authority_details.1.clone()), - set_id: active.id, - auth_idx: authority_details.0 as u16, - round: current_round.into(), - }; - - let signature = self.key_store.sign(&authority_details.1, &payload.encode())?; - match self.runtime.runtime_api().submit_keygen_message(&at, payload, signature, rng) { - Ok(res) => match res { - Ok(()) => { - debug!(target: "thea", "successfully submitted the {:?} messages for round {}", U::subprotocol(), current_round); - }, - Err(err) => { - error!(target: "thea", "Unable to sign transaction; {:?}", err); - }, - }, - Err(err) => { - error!(target: "thea", "Error in runtime api call: {:?}", err); - }, - }; - } else { - let payload = TheaPayload { - messages: convert_all_keygen_messages(messages)?, - signer: Some(authority_details.1.clone()), - set_id: active.id, - auth_idx: authority_details.0 as u16, - round: current_round.into(), - }; - - let signature = self.key_store.sign(&authority_details.1, &payload.encode())?; - match self.runtime.runtime_api().submit_offline_message( - &at, - payload, - signature, - rng, - payload_array, - ) { - Ok(res) => match res { - Ok(()) => { - debug!(target: "thea", "successfully submitted the {:?} messages", U::subprotocol()); - }, - Err(err) => { - error!(target: "thea", "Unable to sign transaction; {:?}", err); - }, - }, - Err(err) => { - error!(target: "thea", "Error in runtime api call: {:?}", err); - }, - }; - } - Ok(()) - } - - /// Steps the internal state machine and blocks the current thread while doing so - fn start_keygen(&mut self, id: ValidatorSetId) -> Option<(Vec>, u16)> { - if let Some(tracker) = self.get_mut_rounds_or_log(&format!( - "failed to get mutable ref to Arc'ed rounds for validator set:{} ", - id - )) { - tracker.start_keygen(id) - } else { - None - } - } - - fn initialize_new_local_party( - &mut self, - id: &ValidatorSetId, - n: u16, - i: u16, - ) -> Result<(), Error> { - // NOTE: index is convert from 0..n-1 to 1..n - // ok() is okay since we expect the thea pallet to take care of corner cases - let local_party = Keygen::new(i, threshold_parties(n), n).ok(); - if let Some(tracker) = self.get_mut_rounds_or_log(&format!( - "failed to acquire mutable ref to round tracker for id: {}, n: {}, i: {}", - id, n, i - )) { - tracker.set_local_party(id, local_party) - } else { - Err(Error::RoundNotFound(*id)) - } - } - - /// Returns the authority key from keystore and index if available - fn has_thea_key( - &self, - vaidator_set: &ValidatorSet, - ) -> Option<(usize, thea_primitives::crypto::Public)> { - if let Some(authority_id) = self.key_store.authority_id(&vaidator_set.validators[..]) { - vaidator_set - .validators - .iter() - .position(|id| &authority_id == id) - .map(|auth_idx| (auth_idx, authority_id)) - } else { - None - } - } - - fn get_mut_rounds_or_log(&mut self, message: &str) -> Option<&mut RoundTracker> { - match Arc::get_mut(&mut self.rounds) { - Some(rounds) => Some(rounds), - None => { - error!(target: "thea", "{}", message); - None - }, - } - } - - pub(crate) async fn run(&mut self) { - loop { - futures::select! { - notification = self.finality_notifications.next().fuse() => { - if let Some(notification) = notification { - self.handle_finality_notification(notification); - } else { - return; - } - }, - } - } - } -} diff --git a/node/Cargo.toml b/node/Cargo.toml index dcb65c481..de7538ccc 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -28,75 +28,76 @@ rand = "0.7.2" clap = { version = "3.0", features = ["derive"] } parking_lot = "0.11.1" itertools = "0.10.1" +jsonrpsee = { version = "0.15.1", features = ["server"] } # local dependencies node-polkadex-runtime = { path = "../runtime", version = "3.0.0" } polkadex-ido-rpc = {path = "../pallets/polkadex-ido/rpc"} +pallet-ocex-rpc = {path = "../pallets/ocex/rpc"} # Substrate dependencies -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-contracts = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-sync-state-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus-uncles = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" ,package="sc-finality-grandpa"} -sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -grandpa-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" , package="sp-finality-grandpa"} -sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-service-test = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-contracts = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-sync-state-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus-uncles = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28"} +sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +grandpa-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" , package="sp-finality-grandpa"} +sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-service-test = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } #Primitives -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch = "polkadot-v0.9.19"} -sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } - - -sc-cli = { git = "https://github.com/paritytech/substrate",branch = "polkadot-v0.9.19", features = ["wasmtime"] } -node-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", features = ["wasmtime"] } -sc-service = { git = "https://github.com/paritytech/substrate",branch = "polkadot-v0.9.19", features = ["wasmtime"]} -sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features= false, features = [ +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-cli = { git = "https://github.com/paritytech/substrate",branch = "polkadot-v0.9.28", features = ["wasmtime"] } +node-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", features = ["wasmtime"] } +sc-service = { git = "https://github.com/paritytech/substrate",branch = "polkadot-v0.9.28", features = ["wasmtime"]} +sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features= false, features = [ "memory-tracker", ] } -frame-try-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.19", optional = true } -try-runtime-cli = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.19", optional = true } +frame-try-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28", optional = true } +try-runtime-cli = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28", optional = true } @@ -110,11 +111,11 @@ regex = "1" platforms = "1.1" async-std = { version = "1.6.5", features = ["attributes"] } soketto = "0.4.2" -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } [features] default = [] diff --git a/node/src/benchmarking.rs b/node/src/benchmarking.rs new file mode 100644 index 000000000..60be5054c --- /dev/null +++ b/node/src/benchmarking.rs @@ -0,0 +1,123 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Setup code for [`super::command`] which would otherwise bloat that module. +//! +//! Should only be used for benchmarking as it may break in other contexts. + +use crate::service::{create_extrinsic, FullClient}; + +use node_polkadex_runtime::{BalancesCall, SystemCall}; +use polkadex_primitives::{AccountId, Balance}; +use sc_cli::Result; +use sp_inherents::{InherentData, InherentDataProvider}; +use sp_keyring::Sr25519Keyring; +use sp_runtime::OpaqueExtrinsic; + +use std::{sync::Arc, time::Duration}; + +/// Generates `System::Remark` extrinsics for the benchmarks. +/// +/// Note: Should only be used for benchmarking. +pub struct RemarkBuilder { + client: Arc, +} + +impl RemarkBuilder { + /// Creates a new [`Self`] from the given client. + pub fn new(client: Arc) -> Self { + Self { client } + } +} + +impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { + fn pallet(&self) -> &str { + "system" + } + + fn extrinsic(&self) -> &str { + "remark" + } + + fn build(&self, nonce: u32) -> std::result::Result { + let acc = Sr25519Keyring::Bob.pair(); + let extrinsic: OpaqueExtrinsic = create_extrinsic( + self.client.as_ref(), + acc, + SystemCall::remark { remark: vec![] }, + Some(nonce), + ) + .into(); + + Ok(extrinsic) + } +} + +/// Generates `Balances::TransferKeepAlive` extrinsics for the benchmarks. +/// +/// Note: Should only be used for benchmarking. +pub struct TransferKeepAliveBuilder { + client: Arc, + dest: AccountId, + value: Balance, +} + +impl TransferKeepAliveBuilder { + /// Creates a new [`Self`] from the given client. + pub fn new(client: Arc, dest: AccountId, value: Balance) -> Self { + Self { client, dest, value } + } +} + +impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { + fn pallet(&self) -> &str { + "balances" + } + + fn extrinsic(&self) -> &str { + "transfer_keep_alive" + } + + fn build(&self, nonce: u32) -> std::result::Result { + let acc = Sr25519Keyring::Bob.pair(); + let extrinsic: OpaqueExtrinsic = create_extrinsic( + self.client.as_ref(), + acc, + BalancesCall::transfer_keep_alive { + dest: self.dest.clone().into(), + value: self.value.into(), + }, + Some(nonce), + ) + .into(); + + Ok(extrinsic) + } +} + +/// Generates inherent data for the `benchmark overhead` command. +pub fn inherent_benchmark_data() -> Result { + let mut inherent_data = InherentData::new(); + let d = Duration::from_millis(0); + let timestamp = sp_timestamp::InherentDataProvider::new(d.into()); + + timestamp + .provide_inherent_data(&mut inherent_data) + .map_err(|e| format!("creating inherent data: {:?}", e))?; + Ok(inherent_data) +} \ No newline at end of file diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 8eb9d4001..dfc7f29b8 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -11,7 +11,7 @@ use sc_telemetry::TelemetryEndpoints; use serde::{Deserialize, Serialize}; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; -use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public, H160}; +use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public}; use sp_runtime::{ traits::{AccountIdConversion, IdentifyAccount, Verify}, Perbill, @@ -106,8 +106,13 @@ fn udon_testnet_config_genesis() -> GenesisConfig { "c2ddb84ed7692123f5f6746c81cd0850932553416515ecd71fbe66c128eafa73" ] .into(); - - testnet_genesis(initial_authorities, vec![], root_key) + let enclave_developement_account: AccountId = hex![ + "90ea3ff124ecd5732b9e95a85f6bf17258e735be5dd950351f4269956de0b976" + ] + .into(); + testnet_genesis(initial_authorities, vec![], + Some(vec![enclave_developement_account]), + root_key) } /// Staging testnet config. @@ -160,9 +165,18 @@ pub fn authority_keys_from_seed( } fn development_config_genesis() -> GenesisConfig { + let enclave_developement_account: AccountId = hex![ + "90ea3ff124ecd5732b9e95a85f6bf17258e735be5dd950351f4269956de0b976" + ] + .into(); + + let orderbook_test_main_account: AccountId = hex! [ + "6e9fb6f4db2e7efcb189ae75b98705976bf10a419edbce4b9a6a7a065826b82c" + ].into(); testnet_genesis( vec![authority_keys_from_seed("Alice")], vec![], + Some(vec![enclave_developement_account,orderbook_test_main_account]), get_account_id_from_seed::("Alice"), ) } @@ -184,9 +198,17 @@ pub fn development_config() -> ChainSpec { } fn soba_testnet_genesis() -> GenesisConfig { + let enclave_developement_account: AccountId = hex![ + "90ea3ff124ecd5732b9e95a85f6bf17258e735be5dd950351f4269956de0b976" + ] + .into(); + let orderbook_test_main_account: AccountId = hex! [ + "6e9fb6f4db2e7efcb189ae75b98705976bf10a419edbce4b9a6a7a065826b82c" + ].into(); testnet_genesis( vec![authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob")], vec![], + Some(vec![enclave_developement_account,orderbook_test_main_account]), get_account_id_from_seed::("Alice"), ) } @@ -254,7 +276,8 @@ fn mainnet_genesis_constuctor() -> GenesisConfig { ), ]; let root_key = hex!["70a5f4e786b47baf52d5a34742bb8312139cfe1c747fbeb3912c197d38c53332"].into(); - testnet_genesis(initial_authorities, vec![], root_key) + testnet_genesis(initial_authorities, vec![], + None, root_key) } pub fn mainnet_testnet_config() -> ChainSpec { @@ -296,6 +319,7 @@ pub fn testnet_genesis( AuthorityDiscoveryId, )>, _initial_nominators: Vec, + development_accounts: Option>, root_key: AccountId, ) -> GenesisConfig { const ENDOWMENT: u128 = 100 * PDEX; @@ -309,7 +333,7 @@ pub fn testnet_genesis( // Treasury Account Id pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry"); - let treasury_account: AccountId = TREASURY_PALLET_ID.into_account(); + let treasury_account: AccountId = TREASURY_PALLET_ID.into_account_truncating(); let mut inital_validators_endowment = initial_authorities.iter().map(|k| (k.0.clone(), ENDOWMENT)).collect_vec(); @@ -319,6 +343,13 @@ pub fn testnet_genesis( // Treasury Funds (treasury_account, treasury_funds), ]; + + // This is for developement only + if let Some(dev_accounts) = &development_accounts { + for acc in dev_accounts { + endowed_accounts.push((acc.clone(),100*ENDOWMENT)) + } + } // Get rest of the stake holders let mut claims = get_stakeholder_tokens(); @@ -338,11 +369,19 @@ pub fn testnet_genesis( total_supply = total_supply + balance.clone() } - assert_eq!( - total_supply + ERC20_PDEX_SUPPLY, - 20_000_000 * PDEX, - "Total Supply Not equal to 20 million" - ); + if development_accounts.is_none() { + assert_eq!( + total_supply + ERC20_PDEX_SUPPLY, + 20_000_000 * PDEX, + "Total Supply Not equal to 20 million" + ); + }else { + assert_eq!( + total_supply + ERC20_PDEX_SUPPLY, + 20_020_000 * PDEX, + "Total Supply Not equal to 20 million" + ); + } let vesting = get_vesting_terms(); GenesisConfig { @@ -1127,6 +1166,7 @@ pub(crate) mod tests { testnet_genesis( vec![authority_keys_from_seed("Alice")], vec![], + None, get_account_id_from_seed::("Alice"), ) } diff --git a/node/src/command.rs b/node/src/command.rs index e97b5787e..376b9215a 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -13,7 +13,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -use frame_benchmarking_cli::BenchmarkCmd; +use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; use std::sync::Arc; // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -24,11 +24,11 @@ use crate::{ service::{new_partial, FullClient}, }; use node_executor::ExecutorDispatch; -use node_polkadex_runtime::Block; -use polkadex_node::command_helper::{inherent_benchmark_data, BenchmarkExtrinsicBuilder}; +use node_polkadex_runtime::{Block, ExistentialDeposit}; use sc_cli::{ChainSpec, Result, RuntimeVersion, SubstrateCli}; use sc_service::PartialComponents; -// use node_polkadex_runtime::RuntimeApi; +use sp_keyring::Sr25519Keyring; +use polkadex_node::benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder}; impl SubstrateCli for Cli { fn impl_name() -> String { @@ -97,9 +97,6 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| { - let PartialComponents { client, backend, .. } = - crate::service::new_partial(&config)?; - // This switch needs to be in the client, since the client decides // which sub-commands it wants to support. match cmd { @@ -114,18 +111,39 @@ pub fn run() -> Result<()> { cmd.run::(config) }, - BenchmarkCmd::Block(cmd) => cmd.run(client), + BenchmarkCmd::Block(cmd) => { + let PartialComponents {client, ..} = new_partial(&config)?; + cmd.run(client) + }, BenchmarkCmd::Storage(cmd) => { + let PartialComponents {client, backend, ..} = new_partial(&config)?; let db = backend.expose_db(); let storage = backend.expose_storage(); cmd.run(config, client, db, storage) }, BenchmarkCmd::Overhead(cmd) => { - let ext_builder = BenchmarkExtrinsicBuilder::new(client.clone()); - - cmd.run(config, client, inherent_benchmark_data()?, Arc::new(ext_builder)) + let PartialComponents {client, ..} = new_partial(&config)?; + let ext_builder = RemarkBuilder::new(client.clone()); + cmd.run(config, client, inherent_benchmark_data()?, &ext_builder) }, + BenchmarkCmd::Machine(cmd) => { + cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()) + } + BenchmarkCmd::Extrinsic(cmd) => { + let PartialComponents { client, .. } = service::new_partial(&config)?; + // Register the *Remark* and *TKA* builders. + let ext_factory = ExtrinsicFactory(vec![ + Box::new(RemarkBuilder::new(client.clone())), + Box::new(TransferKeepAliveBuilder::new( + client.clone(), + Sr25519Keyring::Alice.to_account_id(), + ExistentialDeposit::get(), + )), + ]); + + cmd.run(client, inherent_benchmark_data()?, &ext_factory) + } } }) }, @@ -177,7 +195,7 @@ pub fn run() -> Result<()> { let PartialComponents { client, task_manager, backend, .. } = new_partial(&config)?; let aux_revert = Box::new(move |client: Arc, backend, blocks| { sc_consensus_babe::revert(client.clone(), backend, blocks)?; - grandpa::revert(client, blocks)?; + sc_finality_grandpa::revert(client, blocks)?; Ok(()) }); Ok((cmd.run(client, backend, Some(aux_revert)), task_manager)) diff --git a/node/src/command_helper.rs b/node/src/command_helper.rs deleted file mode 100644 index c16c89170..000000000 --- a/node/src/command_helper.rs +++ /dev/null @@ -1,69 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2022 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Contains code to setup the command invocations in [`super::command`] which would -//! otherwise bloat that module. - -use crate::service::{create_extrinsic, FullClient}; - -use node_polkadex_runtime::SystemCall; -use sc_cli::Result; -use sp_inherents::{InherentData, InherentDataProvider}; -use sp_keyring::Sr25519Keyring; -use sp_runtime::OpaqueExtrinsic; - -use std::{sync::Arc, time::Duration}; - -/// Generates extrinsics for the `benchmark overhead` command. -pub struct BenchmarkExtrinsicBuilder { - client: Arc, -} - -impl BenchmarkExtrinsicBuilder { - /// Creates a new [`Self`] from the given client. - pub fn new(client: Arc) -> Self { - Self { client } - } -} - -impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkExtrinsicBuilder { - fn remark(&self, nonce: u32) -> std::result::Result { - let acc = Sr25519Keyring::Bob.pair(); - let extrinsic: OpaqueExtrinsic = create_extrinsic( - self.client.as_ref(), - acc, - SystemCall::remark { remark: vec![] }, - Some(nonce), - ) - .into(); - - Ok(extrinsic) - } -} - -/// Generates inherent data for the `benchmark overhead` command. -pub fn inherent_benchmark_data() -> Result { - let mut inherent_data = InherentData::new(); - let d = Duration::from_millis(0); - let timestamp = sp_timestamp::InherentDataProvider::new(d.into()); - - timestamp - .provide_inherent_data(&mut inherent_data) - .map_err(|e| format!("creating inherent data: {:?}", e))?; - Ok(inherent_data) -} diff --git a/node/src/lib.rs b/node/src/lib.rs index ef50d0e37..45fa3d4e0 100644 --- a/node/src/lib.rs +++ b/node/src/lib.rs @@ -1,4 +1,4 @@ pub mod chain_spec; -pub mod command_helper; +pub mod benchmarking; pub mod rpc; pub mod service; diff --git a/node/src/rpc.rs b/node/src/rpc.rs index ab15528da..8a27156f3 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -32,15 +32,13 @@ use std::sync::Arc; -use grandpa::{ - FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState, -}; -use polkadex_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Index}; +use jsonrpsee::RpcModule; use sc_client_api::AuxStore; use sc_consensus_babe::{Config, Epoch}; -use sc_consensus_babe_rpc::BabeRpcHandler; use sc_consensus_epochs::SharedEpochChanges; -use sc_finality_grandpa_rpc::GrandpaRpcHandler; +use sc_finality_grandpa::{ + FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState, +}; use sc_rpc::SubscriptionTaskExecutor; pub use sc_rpc_api::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; @@ -51,6 +49,9 @@ use sp_consensus::SelectChain; use sp_consensus_babe::BabeApi; use sp_keystore::SyncCryptoStorePtr; +use polkadex_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Index}; + + /// Extra dependencies for BABE. pub struct BabeDeps { /// BABE protocol config. @@ -93,37 +94,40 @@ pub struct FullDeps { pub grandpa: GrandpaDeps, } -/// A IO handler that uses all Full RPC extensions. -pub type IoHandler = jsonrpc_core::IoHandler; - /// Instantiate all Full RPC extensions. pub fn create_full( deps: FullDeps, -) -> Result, Box> +) -> Result, Box> where C: ProvideRuntimeApi - + HeaderBackend - + AuxStore - + HeaderMetadata - + Sync - + Send - + 'static, + + sc_client_api::BlockBackend + + HeaderBackend + + AuxStore + + HeaderMetadata + + Sync + + Send + + 'static, C::Api: substrate_frame_rpc_system::AccountNonceApi, - // C::Api: pallet_mmr_rpc::MmrRuntimeApi::Hash>, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: BabeApi, C::Api: BlockBuilder, - C::Api: polkadex_ido_rpc::PolkadexIdoRuntimeApi, P: TransactionPool + 'static, SC: SelectChain + 'static, B: sc_client_api::Backend + Send + Sync + 'static, B::State: sc_client_api::backend::StateBackend>, + C::Api: polkadex_ido_rpc::PolkadexIdoRuntimeApi, + C::Api: pallet_ocex_rpc::PolkadexOcexRuntimeApi, { - use substrate_frame_rpc_system::{FullSystem, SystemApi}; - // use pallet_mmr_rpc::{MmrApi, Mmr}; - use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; - - let mut io = jsonrpc_core::IoHandler::default(); + use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; + use sc_consensus_babe_rpc::{Babe, BabeApiServer}; + use sc_finality_grandpa_rpc::{Grandpa, GrandpaApiServer}; + use sc_rpc::dev::{Dev, DevApiServer}; + use sc_sync_state_rpc::{SyncState, SyncStateApiServer}; + use substrate_frame_rpc_system::{System, SystemApiServer}; + use pallet_ocex_rpc::{PolkadexOcexRpc, PolkadexOcexRpcApiServer}; + // use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer}; + + let mut io = RpcModule::new(()); let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa } = deps; let BabeDeps { keystore, babe_config, shared_epoch_changes } = babe; @@ -135,40 +139,41 @@ where finality_provider, } = grandpa; - io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe))); - // Making synchronous calls in light client freezes the browser currently, - // more context: https://github.com/paritytech/substrate/pull/3480 - // These RPCs should use an asynchronous caller instead. - - io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone()))); - io.extend_with(sc_consensus_babe_rpc::BabeApi::to_delegate(BabeRpcHandler::new( - client.clone(), - shared_epoch_changes.clone(), - keystore, - babe_config, - select_chain, - deny_unsafe, - ))); - io.extend_with(sc_finality_grandpa_rpc::GrandpaApi::to_delegate(GrandpaRpcHandler::new( - shared_authority_set.clone(), - shared_voter_state, - justification_stream, - subscription_executor, - finality_provider, - ))); - - io.extend_with(sc_sync_state_rpc::SyncStateRpcApi::to_delegate( - sc_sync_state_rpc::SyncStateRpcHandler::new( - chain_spec, + io.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; + io.merge(TransactionPayment::new(client.clone()).into_rpc())?; + io.merge( + Babe::new( client.clone(), - shared_authority_set, - shared_epoch_changes, - )?, - )); - - io.extend_with(polkadex_ido_rpc::PolkadexIdoRpcApi::to_delegate( - polkadex_ido_rpc::PolkadexIdoRpc::new(client), - )); - + shared_epoch_changes.clone(), + keystore, + babe_config, + select_chain, + deny_unsafe, + ) + .into_rpc(), + )?; + io.merge( + Grandpa::new( + subscription_executor, + shared_authority_set.clone(), + shared_voter_state, + justification_stream, + finality_provider, + ) + .into_rpc(), + )?; + + io.merge( + SyncState::new(chain_spec, client.clone(), shared_authority_set, shared_epoch_changes)? + .into_rpc(), + )?; + + // io.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?; + io.merge(Dev::new(client.clone(), deny_unsafe).into_rpc())?; + // TODO: Upgrade IDO RPC to match latest commit + // io.merge(polkadex_ido_rpc::PolkadexIdoRpcApi::to_delegate( + // polkadex_ido_rpc::PolkadexIdoRpc::new(client), + // ))?; + io.merge(PolkadexOcexRpc::new(client.clone()).into_rpc())?; Ok(io) } diff --git a/node/src/service.rs b/node/src/service.rs index 6b769611b..d3f56c0b9 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -29,7 +29,7 @@ use sc_client_api::{BlockBackend, ExecutorProvider}; use sc_executor::NativeElseWasmExecutor; use sc_network::{Event, NetworkService}; use sc_service::{ - config::Configuration, error::Error as ServiceError, RpcExtensionBuilder, TaskManager, + config::Configuration, error::Error as ServiceError, TaskManager, }; use sp_runtime::traits::Block as BlockT; use std::sync::Arc; @@ -45,7 +45,7 @@ pub type FullClient = type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; type FullGrandpaBlockImport = - grandpa::GrandpaBlockImport; + sc_finality_grandpa::GrandpaBlockImport; /// Fetch the nonce of the given `account` from the chain state. /// @@ -121,26 +121,28 @@ pub fn create_extrinsic( extra.clone(), ) } +use sc_network_common::service::NetworkEventStream; -type PartialComponents = sc_service::PartialComponents< +pub fn new_partial(config: &Configuration) -> Result, sc_transaction_pool::FullPool, ( - Box + Send>, + impl Fn( + node_rpc::DenyUnsafe, + sc_rpc::SubscriptionTaskExecutor, + ) -> Result, sc_service::Error>, ( sc_consensus_babe::BabeBlockImport, - grandpa::LinkHalf, + sc_finality_grandpa::LinkHalf, sc_consensus_babe::BabeLink, ), - grandpa::SharedVoterState, + sc_finality_grandpa::SharedVoterState, Option, ), ->; - -pub fn new_partial(config: &Configuration) -> Result { +>, ServiceError> { let telemetry = config .telemetry_endpoints .clone() @@ -182,7 +184,7 @@ pub fn new_partial(config: &Configuration) -> Result), select_chain.clone(), @@ -230,10 +232,10 @@ pub fn new_partial(config: &Configuration) -> Result T::AccountId { - MODULE_ID.into_account() + MODULE_ID.into_account_truncating() } /// Asserts if a resource is registered @@ -693,7 +693,7 @@ pub mod pallet { impl EnsureOrigin for EnsureBridge { type Success = T::AccountId; fn try_origin(o: T::Origin) -> Result { - let bridge_id = MODULE_ID.into_account(); + let bridge_id: T::AccountId = MODULE_ID.into_account_truncating(); o.into().and_then(|o| match o { system::RawOrigin::Signed(who) if who == bridge_id => Ok(bridge_id), r => Err(T::Origin::from(r)), diff --git a/pallets/ocex/Cargo.toml b/pallets/ocex/Cargo.toml index c5e2c5fb6..7de95ef30 100644 --- a/pallets/ocex/Cargo.toml +++ b/pallets/ocex/Cargo.toml @@ -13,25 +13,28 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3", default-features = false } log = { version = "0.4.14", default-features = false } scale-info = { version = "2.0.1", default-features = false, features = ["derive"] } - -frame-benchmarking = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git', optional = true } -frame-support = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } -frame-system = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } -sp-io = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } -sp-runtime = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } -sp-std = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } -polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.19", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } -#polkadex-primitives = { default-features = false, path = "../../../polkadex-primitives" } -sp-core = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git', default-features = false } -pallet-timestamp = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -ias-verify = { version = "0.1.5", default-features = false, branch = "polkadot-v0.9.19", git = "https://github.com/Polkadex-Substrate/pallets" } +frame-support = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +frame-system = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +sp-runtime = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +sp-std = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } +pallet-timestamp = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +ias-verify = { default-features = false,version = "0.1.4", branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/pallets" } +pallet-ocex-primitives = { path = "../../pallets/ocex/common", default-features = false} [dev-dependencies] -pallet-balances = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } -pallet-assets = { branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } +pallet-balances = { branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +pallet-assets = { branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +pallet-timestamp = { branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +sp-application-crypto = { branch="polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate'} +sp-keystore = { branch = "polkadot-v0.9.28",git = 'https://github.com/paritytech/substrate' } +frame-benchmarking = { branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +ckb-merkle-mountain-range = "0.5.0" +anyhow = "1.0.56" +sp-io = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } [features] default = ["std"] @@ -39,14 +42,14 @@ std = [ "codec/std", "log/std", "scale-info/std", - "frame-benchmarking/std", "frame-support/std", "frame-system/std", - "sp-io/std", "sp-runtime/std", "sp-std/std", - "sp-core/std", - "polkadex-primitives/std" + "polkadex-primitives/std", + "pallet-timestamp/std", + "ias-verify/std", + "pallet-ocex-primitives/std" ] #TODO: [#435] Currently broken, will be fixed in different issue #runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] diff --git a/pallets/ocex/common/Cargo.toml b/pallets/ocex/common/Cargo.toml new file mode 100644 index 000000000..1b61b56b8 --- /dev/null +++ b/pallets/ocex/common/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "pallet-ocex-primitives" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +codec = { version = "3.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +serde = { version = "1.0.68", features = ["derive"], optional = true } + +# Substrate Dependencies (This crate should not rely on frame) +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } + +[features] +default = ["std"] +std = [ + "codec/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", + "serde", +] \ No newline at end of file diff --git a/pallets/ocex/common/src/lib.rs b/pallets/ocex/common/src/lib.rs new file mode 100644 index 000000000..a3b0191a0 --- /dev/null +++ b/pallets/ocex/common/src/lib.rs @@ -0,0 +1,54 @@ +#![cfg_attr(not(feature = "std"), no_std)] +use codec::{Decode, Encode}; +use polkadex_primitives::assets::AssetId; +pub use polkadex_primitives::{AccountId, Balance, BlockNumber, Hash}; +#[cfg(feature = "std")] +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use sp_std::vec::Vec; + +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)] +#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] +pub struct WithdrawalWithPrimitives { + pub main_account: AccountId, + #[cfg_attr(feature = "std", serde(serialize_with = "serialize_as_string"))] + #[cfg_attr(feature = "std", serde(deserialize_with = "deserialize_from_string"))] + pub amount: Balance, + pub asset: StringAssetId, +} + +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)] +#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] +pub enum StringAssetId { + POLKADEX, + #[cfg_attr(feature = "std", serde(serialize_with = "serialize_as_string"))] + #[cfg_attr(feature = "std", serde(deserialize_with = "deserialize_from_string"))] + Asset(u128), +} + +impl From for StringAssetId { + fn from(asset: AssetId) -> Self { + match asset { + AssetId::polkadex => StringAssetId::POLKADEX, + AssetId::asset(num) => StringAssetId::Asset(num.into()), + } + } +} + + +#[cfg(feature = "std")] +fn serialize_as_string( + t: &T, + serializer: S, +) -> Result { + serializer.serialize_str(&t.to_string()) +} + +#[cfg(feature = "std")] +fn deserialize_from_string<'de, D: Deserializer<'de>, T: std::str::FromStr>( + deserializer: D, +) -> Result { + let s = String::deserialize(deserializer)?; + s.parse::().map_err(|_| serde::de::Error::custom("Parse from string failed")) +} diff --git a/pallets/ocex/rpc/Cargo.toml b/pallets/ocex/rpc/Cargo.toml new file mode 100644 index 000000000..91599dfb4 --- /dev/null +++ b/pallets/ocex/rpc/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "pallet-ocex-rpc" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +codec = { version = "3.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +serde = { version = "1.0.68", optional = true } +jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } +sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28",default-features = false } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +pallet-ocex-primitives = {path = "../common", default-features = false} +pallet-ocex-runtime-api = {path = "runtime-api" } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } \ No newline at end of file diff --git a/pallets/ocex/rpc/runtime-api/Cargo.toml b/pallets/ocex/rpc/runtime-api/Cargo.toml new file mode 100644 index 000000000..17e7d81e0 --- /dev/null +++ b/pallets/ocex/rpc/runtime-api/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "pallet-ocex-runtime-api" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } + +# Substrate Dependencies +pallet-ocex-primitives= { default-features = false, path = "../../common" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } +[features] +default = ["std"] +std = [ + "sp-api/std", + "codec/std", + "sp-std/std", + "sp-runtime/std", + "pallet-ocex-primitives/std" +] \ No newline at end of file diff --git a/primitives/thea/src/traits.rs b/pallets/ocex/rpc/runtime-api/src/lib.rs similarity index 59% rename from primitives/thea/src/traits.rs rename to pallets/ocex/rpc/runtime-api/src/lib.rs index 30a8f0f53..b6b745429 100644 --- a/primitives/thea/src/traits.rs +++ b/pallets/ocex/rpc/runtime-api/src/lib.rs @@ -16,10 +16,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::SignedTheaPayload; - -/// This trait should be installed by all pallets using Thea. -pub trait HandleSignedPayloadTrait { - /// Handles the signed payload - fn handle_signed_payload(payload: SignedTheaPayload); -} +#![cfg_attr(not(feature = "std"), no_std)] +use codec::Codec; +use codec::Decode; +use polkadex_primitives::assets::AssetId; +use sp_std::vec::Vec; +use polkadex_primitives::withdrawal::Withdrawal; +use sp_runtime::traits::Zero; +use pallet_ocex_primitives::WithdrawalWithPrimitives; +use polkadex_primitives::Balance; +sp_api::decl_runtime_apis! { + pub trait PolkadexOcexRuntimeApi where AccountId: Codec, Hash : Codec{ + fn return_withdrawals(snapshot_ids: Vec,account: AccountId) -> Vec>; + } +} \ No newline at end of file diff --git a/pallets/ocex/rpc/src/lib.rs b/pallets/ocex/rpc/src/lib.rs new file mode 100644 index 000000000..524e40cc5 --- /dev/null +++ b/pallets/ocex/rpc/src/lib.rs @@ -0,0 +1,97 @@ +use std::{marker::PhantomData, sync::Arc}; + +use codec::Codec; +use jsonrpsee::{ + core::{async_trait, Error as JsonRpseeError, RpcResult}, + proc_macros::rpc, + types::error::{CallError, ErrorCode, ErrorObject}, +}; +pub use pallet_ocex_runtime_api::PolkadexOcexRuntimeApi; +use pallet_ocex_primitives::WithdrawalWithPrimitives; +use sp_runtime::{ + generic::BlockId, + traits::{Block as BlockT, Header as HeaderT}, +}; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::HeaderBackend; +use sp_rpc::number::NumberOrHex; + +const RUNTIME_ERROR: i32 = 1; + +/// OCEX RPC methods. +#[rpc(client, server)] +pub trait PolkadexOcexRpcApi +{ + #[method(name = "pallet_ocex_return_withdrawals")] + fn return_withdrawals(&self, snapshot_ids: Vec,account: AccountId, at: Option) -> RpcResult>>; +} + +pub struct PolkadexOcexRpc { + client: Arc, + _marker: std::marker::PhantomData, +} + +impl PolkadexOcexRpc { + pub fn new(client: Arc) -> Self { + Self { client, _marker: Default::default() } + } +} + +#[async_trait] +impl + PolkadexOcexRpcApiServer< + ::Hash, + AccountId, + Hash, + > for PolkadexOcexRpc +where + Block: BlockT, + Client: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend, + Client::Api: PolkadexOcexRuntimeApi< + Block, + AccountId, + Hash, + >, + AccountId: Codec, + Hash: Codec, +{ + fn return_withdrawals( + &self, + snapshot_ids: Vec, + account: AccountId, + at: Option<::Hash>, + ) -> RpcResult>> { + let api = self.client.runtime_api(); + let at = BlockId::hash(at.unwrap_or_else(|| + // If the block hash is not supplied assume the best block. + self.client.info().best_hash)); + + api.return_withdrawals(&at, snapshot_ids, account).map_err(runtime_error_into_rpc_err) + } + +} +/* +fn return_withdrawals( + &self, + snapshot_ids: Vec, + account: AccountId, + at: Option<::Hash>, + ) -> RpcResult>> { + let api = self.client.runtime_api(); + let at = BlockId::hash(at.unwrap_or_else(|| + // If the block hash is not supplied assume the best block. + self.client.info().best_hash)); + + api.return_withdrawals(&at, snapshot_ids, account).map_err(runtime_error_into_rpc_err) + } +*/ + +/// Converts a runtime trap into an RPC error. +fn runtime_error_into_rpc_err(err: impl std::fmt::Debug) -> JsonRpseeError { + CallError::Custom(ErrorObject::owned( + RUNTIME_ERROR, + "Runtime error", + Some(format!("{:?}", err)), + )) + .into() +} diff --git a/pallets/ocex/src/lib.rs b/pallets/ocex/src/lib.rs index be46e7537..6a4146702 100644 --- a/pallets/ocex/src/lib.rs +++ b/pallets/ocex/src/lib.rs @@ -21,8 +21,10 @@ use frame_support::{ pallet_prelude::Get, traits::{fungibles::Mutate, Currency, ExistenceRequirement}, }; -use frame_system::ensure_signed; +use frame_system::ensure_signed; +use pallet_ocex_primitives::{WithdrawalWithPrimitives, StringAssetId}; +use sp_runtime::SaturatedConversion; use polkadex_primitives::assets::AssetId; use pallet_timestamp::{self as timestamp}; @@ -32,12 +34,14 @@ use sp_std::prelude::*; // Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; +#[cfg(test)] +mod mock; + #[cfg(test)] mod tests; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -mod types; pub mod weights; pub use weights::*; @@ -52,9 +56,9 @@ type BalanceOf = pub mod pallet { // Import various types used to declare pallet in scope. use super::*; - use crate::types::TradingPairStatus; use frame_support::{ pallet_prelude::*, + storage::bounded_btree_map::BoundedBTreeMap, traits::{ fungibles::{Inspect, Mutate}, Currency, ReservableCurrency, @@ -65,13 +69,17 @@ pub mod pallet { use ias_verify::{verify_ias_report, SgxStatus}; use polkadex_primitives::{ assets::AssetId, - ocex::{AccountInfo, EnclaveSnapshot, TradingPairInfo, Withdrawal}, - ProxyLimit, Signature, SnapshotAccLimit, WithdrawalLimit, + ocex::{AccountInfo, TradingPairConfig}, + snapshot::{EnclaveSnapshot, Fees}, + withdrawal::Withdrawal, + AccountId, AssetsLimit, ProxyLimit, SnapshotAccLimit, WithdrawalLimit, + }; + use sp_runtime::{ + traits::{IdentifyAccount, Verify}, + SaturatedConversion, }; - use sp_core::{crypto::AccountId32, H256}; - use sp_io::hashing::blake2_256; - use sp_runtime::traits::{IdentifyAccount, Member, Verify}; use sp_std::vec::Vec; + // use polkadex_primitives::SnapshotAccLimit; /// Our pallet's configuration trait. All our types and constants go in here. If the /// pallet is dependent on specific other pallets, then their configuration traits @@ -122,6 +130,9 @@ pub mod pallet { // enclave's report validity time. // standard 24h in ms = 86_400_000 type MsPerDay: Get; + + /// Governance Origin + type GovernanceOrigin: EnsureOrigin<::Origin>; } // Simple declaration of the `Pallet` type. It is placeholder we use to implement traits and @@ -134,6 +145,10 @@ pub mod pallet { #[pallet::error] pub enum Error { RegisterationShouldBeSignedByMainAccount, + /// Caller is not authorized to claim the withdrawal. + /// Normally, when Sender != main_account. + SenderNotAuthorizedToWithdraw, + InvalidWithdrawalIndex, TradingPairIsNotOperational, MainAccountAlreadyRegistered, SnapshotNonceError, @@ -162,12 +177,30 @@ pub mod pallet { /// What to do at the end of each block. /// /// Clean IngressMessages - fn on_initialize(n: T::BlockNumber) -> Weight { + fn on_initialize(_n: T::BlockNumber) -> Weight { // When block's been initialized - clean up expired registrations of enclaves - Self::unregister_timed_out_enclaves(); - >::put(Vec::< - polkadex_primitives::ocex::IngressMessages>, - >::new()); + //Self::unregister_timed_out_enclaves(); FIXME: Commented out for testing. Should be + // restored before mainnet launch + if let Some(snapshot_nonce) = >::get() { + if let Some(snapshot) = >::get(snapshot_nonce.saturating_sub(1)) { + >::put(Vec::< + polkadex_primitives::ingress::IngressMessages>, + >::from([ + polkadex_primitives::ingress::IngressMessages::LastestSnapshot( + snapshot.merkle_root, + snapshot.snapshot_number, + ), + ])); + } else { + >::put(Vec::< + polkadex_primitives::ingress::IngressMessages>, + >::new()); + } + } else { + >::put(Vec::< + polkadex_primitives::ingress::IngressMessages>, + >::new()); + } // TODO: Benchmark on initialize 0 } @@ -183,9 +216,13 @@ pub mod pallet { !>::contains_key(&main_account), Error::::MainAccountAlreadyRegistered ); - >::insert(&main_account, AccountInfo::new(proxy.clone())); + + let mut account_info = AccountInfo::new(main_account.clone()); + ensure!(account_info.add_proxy(proxy.clone()).is_ok(), Error::::ProxyLimitExceeded); + >::insert(&main_account, account_info); + >::mutate(|ingress_messages| { - ingress_messages.push(polkadex_primitives::ocex::IngressMessages::RegisterUser( + ingress_messages.push(polkadex_primitives::ingress::IngressMessages::RegisterUser( main_account.clone(), proxy.clone(), )); @@ -206,7 +243,7 @@ pub mod pallet { ); >::mutate(|ingress_messages| { - ingress_messages.push(polkadex_primitives::ocex::IngressMessages::AddProxy( + ingress_messages.push(polkadex_primitives::ingress::IngressMessages::AddProxy( main_account.clone(), proxy.clone(), )); @@ -218,25 +255,75 @@ pub mod pallet { } /// Registers a new trading pair - #[pallet::weight(::WeightInfo::register_trading_pair())] + #[pallet::weight(10000)] + pub fn close_trading_pair( + origin: OriginFor, + base: AssetId, + quote: AssetId, + ) -> DispatchResult { + T::GovernanceOrigin::ensure_origin(origin)?; + ensure!(base != quote, Error::::BothAssetsCannotBeSame); + ensure!( + >::contains_key(&base, "e), + Error::::TradingPairNotFound + ); + + if let Some(trading_pair) = >::get(&base, "e) { + >::mutate(&base, "e, |status| *status = false); + >::mutate(|ingress_messages| { + ingress_messages.push( + polkadex_primitives::ingress::IngressMessages::CloseTradingPair( + trading_pair.clone(), + ), + ); + }); + Self::deposit_event(Event::ShutdownTradingPair { pair: trading_pair }); + } + Ok(()) + } + + /// Registers a new trading pair + #[pallet::weight(10000)] + pub fn open_trading_pair( + origin: OriginFor, + base: AssetId, + quote: AssetId, + ) -> DispatchResult { + T::GovernanceOrigin::ensure_origin(origin)?; + ensure!(base != quote, Error::::BothAssetsCannotBeSame); + ensure!( + >::contains_key(&base, "e), + Error::::TradingPairNotFound + ); + + if let Some(trading_pair) = >::get(&base, "e) { + >::mutate(&base, "e, |status| *status = true); + >::mutate(|ingress_messages| { + ingress_messages.push( + polkadex_primitives::ingress::IngressMessages::OpenTradingPair( + trading_pair.clone(), + ), + ); + }); + Self::deposit_event(Event::OpenTradingPair { pair: trading_pair }); + } + Ok(()) + } + + /// Registers a new trading pair + #[pallet::weight(10000)] pub fn register_trading_pair( origin: OriginFor, base: AssetId, quote: AssetId, - minimum_trade_amount: BalanceOf, - maximum_trade_amount: BalanceOf, - minimum_qty_amount: BalanceOf, - minimum_withdrawal_amount: BalanceOf, - minimum_deposit_amount: BalanceOf, - maximum_withdrawal_amount: BalanceOf, - maximum_deposit_amount: BalanceOf, - base_withdrawal_fee: BalanceOf, - quote_withdrawal_fee: BalanceOf, - enclave_id: T::AccountId, - min_depth: BalanceOf, + min_trade_amount: BalanceOf, + max_trade_amount: BalanceOf, + min_order_qty: BalanceOf, + max_order_qty: BalanceOf, max_spread: BalanceOf, + min_depth: BalanceOf, ) -> DispatchResult { - ensure_root(origin)?; + T::GovernanceOrigin::ensure_origin(origin)?; ensure!(base != quote, Error::::BothAssetsCannotBeSame); ensure!( !>::contains_key(&base, "e), @@ -247,28 +334,25 @@ pub mod pallet { Error::::TradingPairAlreadyRegistered ); - let trading_pair_info = TradingPairInfo::new( - base, - quote, - minimum_trade_amount, - maximum_trade_amount, - minimum_qty_amount, - minimum_withdrawal_amount, - minimum_deposit_amount, - maximum_withdrawal_amount, - maximum_deposit_amount, - base_withdrawal_fee, - quote_withdrawal_fee, - enclave_id, - min_depth, + // TODO: Check if base and quote assets are enabled for deposits + let trading_pair_info = TradingPairConfig { + base_asset: base, + quote_asset: quote, + min_trade_amount, + max_trade_amount, + min_order_qty, + max_order_qty, max_spread, - ); + min_depth, + }; >::insert(&base, "e, trading_pair_info.clone()); - >::insert(&base, "e, TradingPairStatus::new()); + >::insert(&base, "e, true); >::mutate(|ingress_messages| { - ingress_messages.push(polkadex_primitives::ocex::IngressMessages::StartEnclave( - trading_pair_info, - )); + ingress_messages.push( + polkadex_primitives::ingress::IngressMessages::OpenTradingPair( + trading_pair_info, + ), + ); }); Self::deposit_event(Event::TradingPairRegistered { base, quote }); Ok(()) @@ -278,28 +362,20 @@ pub mod pallet { #[pallet::weight(::WeightInfo::deposit())] pub fn deposit( origin: OriginFor, - base: AssetId, - quote: AssetId, + asset: AssetId, amount: BalanceOf, - is_base: bool, ) -> DispatchResult { - let main = ensure_signed(origin)?; - ensure!(base != quote, Error::::BothAssetsCannotBeSame); - ensure!( - >::contains_key(&base, "e), - Error::::TradingPairNotFound - ); - let trading_pair_status = >::get(&base, "e) - .ok_or(Error::::TradingPairNotFound)?; - ensure!(trading_pair_status.is_active, Error::::TradingPairIsNotOperational); - - let asset = if is_base { base } else { quote }; - Self::transfer_asset(&main, &Self::get_custodian_account(), amount, asset)?; + let user = ensure_signed(origin)?; + // TODO: Check if asset is enabled for deposit + Self::transfer_asset(&user, &Self::get_custodian_account(), amount, asset)?; >::mutate(|ingress_messages| { - ingress_messages - .push(polkadex_primitives::ocex::IngressMessages::Deposit(main, asset, amount)); + ingress_messages.push(polkadex_primitives::ingress::IngressMessages::Deposit( + user.clone(), + asset, + amount, + )); }); - Self::deposit_event(Event::DepositSuccessful { pair: (base, quote), asset, amount }); + Self::deposit_event(Event::DepositSuccessful { user, asset, amount }); Ok(()) } @@ -307,97 +383,133 @@ pub mod pallet { #[pallet::weight(::WeightInfo::submit_snapshot())] pub fn submit_snapshot( origin: OriginFor, - base: AssetId, - quote: AssetId, mut snapshot: EnclaveSnapshot< T::AccountId, BalanceOf, - SnapshotAccLimit, WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, >, signature: T::Signature, ) -> DispatchResult { - let _ = ensure_signed(origin)?; - ensure!(base != quote, Error::::BothAssetsCannotBeSame); + let enclave = ensure_signed(origin)?; ensure!( - >::contains_key(&base, "e), - Error::::TradingPairNotFound + >::contains_key(&enclave), + Error::::SenderIsNotAttestedEnclave ); + let last_snapshot_serial_number = - if let Some(last_snapshot) = >::get(&base, "e) { - last_snapshot.snapshot_number + if let Some(last_snapshot_number) = >::get() { + last_snapshot_number } else { 0 }; ensure!( - snapshot.snapshot_number.eq(&last_snapshot_serial_number.saturating_add(1)), + snapshot.snapshot_number.eq(&(last_snapshot_serial_number+1)), Error::::SnapshotNonceError ); - let trading_pair_info = - >::get(&base, "e).ok_or(Error::::TradingPairNotFound)?; - let bytes = snapshot.encode(); - ensure!( - signature.verify(bytes.as_slice(), &(trading_pair_info.enclave_id)), + signature.verify(bytes.as_slice(), &enclave), Error::::EnclaveSignatureVerificationFailed ); - >::insert((base, quote), snapshot.snapshot_number, snapshot.withdrawals); - snapshot.withdrawals = - BoundedVec::>, WithdrawalLimit>::default(); - >::insert(&base, "e, snapshot); + let current_snapshot_nonce = snapshot.snapshot_number; + >::insert(current_snapshot_nonce, snapshot.withdrawals); + >::insert(current_snapshot_nonce,snapshot.fees.clone()); + snapshot.withdrawals = Default::default(); + >::insert(current_snapshot_nonce, snapshot); + >::put(current_snapshot_nonce); Ok(()) } - /// Extrinsic used to emit a shutdown request of an Enclave - #[pallet::weight(::WeightInfo::shutdown_enclave())] - pub fn shutdown_enclave( + // FIXME Only for testing will be removed before mainnet launch + /// Insert Enclave + #[doc(hidden)] + #[pallet::weight(10000 + T::DbWeight::get().writes(1))] + pub fn insert_enclave(origin: OriginFor, encalve: T::AccountId) -> DispatchResult { + T::GovernanceOrigin::ensure_origin(origin)?; + >::insert( + encalve, + T::Moment::from(T::MsPerDay::get() * T::Moment::from(10000u32)), + ); + Ok(()) + } + + /// Withdraws Fees Collected + /// + /// params: snapshot_number: u32 + #[pallet::weight(10000 + T::DbWeight::get().writes(1))] + pub fn collect_fees( origin: OriginFor, - base: AssetId, - quote: AssetId, + snapshot_id: u32, + beneficiary: T::AccountId, ) -> DispatchResult { - ensure_root(origin)?; - ensure!(base != quote, Error::::BothAssetsCannotBeSame); - ensure!( - >::contains_key(&base, "e), - Error::::TradingPairNotFound - ); - ensure!( - >::contains_key("e, &base), - Error::::TradingPairNotFound - ); + // TODO: The caller should be of operational council + let _sender = ensure_signed(origin)?; + + let fees: Vec>> = + >::get(snapshot_id).iter().cloned().collect(); + for fee in fees { + Self::transfer_asset( + &Self::get_custodian_account(), + &beneficiary, + fee.amount, + fee.asset, + )?; + } + Self::deposit_event(Event::FeesClaims { beneficiary, snapshot_id }); + Ok(()) + } - let trading_pair_info = - >::get(&base, "e).ok_or(Error::::TradingPairNotFound)?; - - >::mutate("e, &base, |status_option| { - if let Some(status) = status_option { - status.is_active = false; - >::mutate(|ingress_messages| { - ingress_messages.push( - polkadex_primitives::ocex::IngressMessages::ShutdownEnclave( - trading_pair_info.enclave_id.clone(), - ), - ) - }); - Self::deposit_event(Event::EnclaveShutdownRequest { - id: trading_pair_info.enclave_id, - }); - Some(status.clone()) - } else { - None - } + /// Extrinsic used to shutdown the orderbook + #[pallet::weight(10000)] + pub fn shutdown(origin: OriginFor) -> DispatchResult { + T::GovernanceOrigin::ensure_origin(origin)?; + >::put(false); + >::mutate(|ingress_messages| { + ingress_messages.push(polkadex_primitives::ingress::IngressMessages::Shutdown); }); Ok(()) } + /// Withdraws user balance + /// + /// params: pair: (base,quote), snapshot_number: u32 + #[pallet::weight(10000 + T::DbWeight::get().writes(1))] + pub fn withdraw(origin: OriginFor, snapshot_id: u32) -> DispatchResult { + // Anyone can claim the withdrawal for any user + // This is to build services that can enable free withdrawals similar to CEXes. + let sender = ensure_signed(origin)?; + + let mut withdrawals: BoundedBTreeMap< + T::AccountId, + BoundedVec>, WithdrawalLimit>, + SnapshotAccLimit, + > = >::get(snapshot_id); + ensure!(withdrawals.contains_key(&sender), Error::::InvalidWithdrawalIndex); + if let Some(withdrawal_vector) = withdrawals.get(&sender) { + for x in withdrawal_vector.iter() { + Self::transfer_asset( + &Self::get_custodian_account(), + &x.main_account, + x.amount, + x.asset, + )?; + } + Self::deposit_event(Event::WithdrawalClaimed { + main: sender.clone(), + withdrawals: withdrawal_vector.to_owned(), + }); + } + withdrawals.remove(&sender); + >::insert(snapshot_id, withdrawals); + Ok(()) + } + /// In order to register itself - enclave must send it's own report to this extrinsic #[pallet::weight(::WeightInfo::register_enclave())] pub fn register_enclave(origin: OriginFor, ias_report: Vec) -> DispatchResult { - let _relayer = ensure_signed(origin)?; - - use sp_runtime::SaturatedConversion; - + let relayer = ensure_signed(origin)?; let report = verify_ias_report(&ias_report) .map_err(|_| >::RemoteAttestationVerificationFailed)?; @@ -408,21 +520,11 @@ pub mod pallet { // TODO: any other checks we want to run? ensure!( (report.status == SgxStatus::Ok) | - (report.status == SgxStatus::ConfigurationNeeded), + (report.status == SgxStatus::ConfigurationNeeded), >::InvalidSgxReportStatus ); - let new_enclave = (enclave_signer.clone(), T::Moment::saturated_from(report.timestamp)); - >::mutate(|v| { - if let Some(v) = v { - if let Some(existing) = v.iter().position(|(e, _)| e == &enclave_signer) { - v[existing] = new_enclave; - } else { - v.push(new_enclave); - } - Some(v.clone()) - } else { - Some(sp_std::vec![new_enclave]) - } + >::mutate(&enclave_signer, |v| { + *v = Some(T::Moment::saturated_from(report.timestamp)); }); Self::deposit_event(Event::EnclaveRegistered(enclave_signer)); Ok(()) @@ -433,15 +535,19 @@ pub mod pallet { // clean-up function - should be called on each block fn unregister_timed_out_enclaves() { use sp_runtime::traits::CheckedSub; - >::mutate(|v| { - if let Some(v) = v { - v.retain(|(_, attested_ts)| { - >::get().checked_sub(&attested_ts).unwrap() < - T::MsPerDay::get() - }); + let mut enclave_to_remove = sp_std::vec![]; + let iter = >::iter(); + iter.for_each(|(enclave, attested_ts)| { + if >::get().checked_sub(&attested_ts).unwrap() >= + T::MsPerDay::get() + { + enclave_to_remove.push(enclave); } }); - Self::deposit_event(Event::EnclaveCleanup); + for enclave in &enclave_to_remove { + >::remove(enclave); + } + Self::deposit_event(Event::EnclaveCleanup(enclave_to_remove)); } } @@ -451,13 +557,36 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - MainAccountRegistered { main: T::AccountId, proxy: T::AccountId }, - TradingPairRegistered { base: AssetId, quote: AssetId }, - DepositSuccessful { pair: (AssetId, AssetId), asset: AssetId, amount: BalanceOf }, - EnclaveShutdownRequest { id: T::AccountId }, + FeesClaims { + beneficiary: T::AccountId, + snapshot_id: u32, + }, + MainAccountRegistered { + main: T::AccountId, + proxy: T::AccountId, + }, + TradingPairRegistered { + base: AssetId, + quote: AssetId, + }, + DepositSuccessful { + user: T::AccountId, + asset: AssetId, + amount: BalanceOf, + }, + ShutdownTradingPair { + pair: TradingPairConfig>, + }, + OpenTradingPair { + pair: TradingPairConfig>, + }, EnclaveRegistered(T::AccountId), - EnclaveCleanup, + EnclaveCleanup(Vec), TradingPairIsNotOperational, + WithdrawalClaimed { + main: T::AccountId, + withdrawals: BoundedVec>, WithdrawalLimit>, + }, } // A map that has enumerable entries. @@ -480,46 +609,60 @@ pub mod pallet { AssetId, Blake2_128Concat, AssetId, - TradingPairInfo>, + TradingPairConfig>, OptionQuery, >; // Operational Status of registered trading pairs #[pallet::storage] #[pallet::getter(fn trading_pairs_status)] - pub(super) type TradingPairsStatus = StorageDoubleMap< + pub(super) type TradingPairsStatus = + StorageDoubleMap<_, Blake2_128Concat, AssetId, Blake2_128Concat, AssetId, bool, ValueQuery>; + + // Snapshots Storage + #[pallet::storage] + #[pallet::getter(fn snapshots)] + pub(super) type Snapshots = StorageMap< _, Blake2_128Concat, - AssetId, - Blake2_128Concat, - AssetId, - TradingPairStatus, + u32, + EnclaveSnapshot, WithdrawalLimit, AssetsLimit, SnapshotAccLimit>, OptionQuery, >; - // Snapshots of all trading pairs + // Snapshots Nonce #[pallet::storage] - #[pallet::getter(fn snapshots)] - pub(super) type Snapshots = StorageDoubleMap< + #[pallet::getter(fn snapshot_nonce)] + pub(super) type SnapshotNonce = StorageValue<_, u32, OptionQuery>; + + // Exchange Operation State + #[pallet::storage] + #[pallet::getter(fn orderbook_operational_state)] + pub(super) type ExchangeState = StorageValue<_, bool, ValueQuery>; + + // Fees collected + #[pallet::storage] + #[pallet::getter(fn fees_collected)] + pub(super) type FeesCollected = StorageMap< _, Blake2_128Concat, - AssetId, - Blake2_128Concat, - AssetId, - EnclaveSnapshot, SnapshotAccLimit, WithdrawalLimit>, - OptionQuery, + u32, + BoundedVec>, AssetsLimit>, + ValueQuery, >; // Withdrawals mapped by their trading pairs and snapshot numbers #[pallet::storage] #[pallet::getter(fn withdrawals)] - pub(super) type Withdrawals = StorageDoubleMap< + pub(super) type Withdrawals = StorageMap< _, Blake2_128Concat, - (AssetId, AssetId), - Blake2_128Concat, u32, - BoundedVec>, WithdrawalLimit>, + BoundedBTreeMap< + T::AccountId, + BoundedVec>, WithdrawalLimit>, + SnapshotAccLimit, + >, ValueQuery, >; @@ -528,17 +671,15 @@ pub mod pallet { #[pallet::getter(fn ingress_messages)] pub(super) type IngressMessages = StorageValue< _, - Vec>>, + Vec>>, ValueQuery, >; // Vector of registered enclaves #[pallet::storage] #[pallet::getter(fn get_registered_enclaves)] - pub(super) type RegisteredEnclaves = StorageValue< - _, - Vec<(::AccountId, ::Moment)>, - >; + pub(super) type RegisteredEnclaves = + StorageMap<_, Blake2_128Concat, T::AccountId, T::Moment, OptionQuery>; } // The main implementation block for the pallet. Functions here fall into three broad @@ -550,7 +691,7 @@ impl Pallet { /// Returns the AccountId to hold user funds, note this account has no private keys and /// can accessed using on-chain logic. fn get_custodian_account() -> T::AccountId { - T::PalletId::get().into_account() + T::PalletId::get().into_account_truncating() } fn transfer_asset( @@ -575,7 +716,26 @@ impl Pallet { Ok(()) } - fn _submit_state() -> Result<(), Error> { - todo!() + pub fn return_withdrawals( + snapshot_ids: Vec, + account: T::AccountId + ) -> Vec>{ + let mut withdrawals_vector: Vec> = vec![]; + for x in snapshot_ids{ + if let Some(withdrawals) = >::get(x).get(&account){ + let mut snapshot_withdrawals: Vec> = vec![]; + for y in withdrawals.iter(){ + snapshot_withdrawals.push( + WithdrawalWithPrimitives{ + main_account: y.main_account.clone(), + amount: y.amount.saturated_into(), + asset: StringAssetId::from(y.asset) + } + ); + } + withdrawals_vector.append(&mut snapshot_withdrawals.clone()) + } + } + withdrawals_vector } } diff --git a/pallets/ocex/src/mock.rs b/pallets/ocex/src/mock.rs new file mode 100644 index 000000000..752165218 --- /dev/null +++ b/pallets/ocex/src/mock.rs @@ -0,0 +1,164 @@ +// This file is part of Polkadex. + +// Copyright (C) 2020-2022 Polkadex oü. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +//! Tests for pallet-ocex + +use crate::*; +use frame_support::{ + parameter_types, + traits::{ConstU128, ConstU64, OnTimestampSet}, + PalletId, +}; +use frame_system::EnsureRoot; +use polkadex_primitives::{Moment, Signature}; +use sp_application_crypto::sp_core::H256; +use sp_std::cell::RefCell; +// The testing primitives are very useful for avoiding having to work with signatures +// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required. +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, +}; +// Reexport crate as its pallet name for construct_runtime. + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +// For testing the pallet, we construct a mock runtime. +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}, + Assets: pallet_assets::{Pallet, Call, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + OCEX: crate::{Pallet, Call, Storage, Event}, + } +); + +parameter_types! { + pub BlockWeights: frame_system::limits::BlockWeights = + frame_system::limits::BlockWeights::simple_max(1024); +} +impl frame_system::Config for Test { + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Call = Call; + type Hashing = BlakeTwo256; + type AccountId = sp_runtime::AccountId32; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = ConstU64<250>; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +impl pallet_balances::Config for Test { + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type Balance = u128; + type DustRemoval = (); + type Event = Event; + type ExistentialDeposit = ConstU128<1>; + type AccountStore = System; + type WeightInfo = (); +} + +thread_local! { + pub static CAPTURED_MOMENT: RefCell> = RefCell::new(None); +} + +pub struct MockOnTimestampSet; +impl OnTimestampSet for MockOnTimestampSet { + fn on_timestamp_set(moment: Moment) { + CAPTURED_MOMENT.with(|x| *x.borrow_mut() = Some(moment)); + } +} + +impl pallet_timestamp::Config for Test { + type Moment = Moment; + type OnTimestampSet = MockOnTimestampSet; + type MinimumPeriod = ConstU64<5>; + type WeightInfo = (); +} + +parameter_types! { + pub const ProxyLimit: u32 = 2; + pub const OcexPalletId: PalletId = PalletId(*b"OCEX_LMP"); + pub const MsPerDay: u64 = 86_400_000; +} + +impl Config for Test { + type Event = Event; + type PalletId = OcexPalletId; + type GovernanceOrigin = EnsureRoot; + type NativeCurrency = Balances; + type OtherAssets = Assets; + type EnclaveOrigin = EnsureRoot; + type WeightInfo = (); + type Public = ::Signer; + type Signature = Signature; + type MsPerDay = MsPerDay; +} + +parameter_types! { + pub const AssetDeposit: u128 = 100; + pub const ApprovalDeposit: u128 = 1; + pub const StringLimit: u32 = 50; + pub const MetadataDepositBase: u128 = 10; + pub const MetadataDepositPerByte: u128 = 1; +} + +impl pallet_assets::Config for Test { + type Event = Event; + type Balance = u128; + type AssetId = u128; + type Currency = Balances; + type ForceOrigin = EnsureRoot; + type AssetDeposit = AssetDeposit; + type AssetAccountDeposit = AssetDeposit; + type MetadataDepositBase = MetadataDepositBase; + type MetadataDepositPerByte = MetadataDepositPerByte; + type ApprovalDeposit = ApprovalDeposit; + type StringLimit = StringLimit; + type Freezer = (); + type Extra = (); + type WeightInfo = (); +} + +pub fn new_test_ext() -> sp_io::TestExternalities { + let t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext +} diff --git a/pallets/ocex/src/tests.rs b/pallets/ocex/src/tests.rs index 8c1171be1..c6a5d22b7 100644 --- a/pallets/ocex/src/tests.rs +++ b/pallets/ocex/src/tests.rs @@ -13,120 +13,1101 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -//! Tests for pallet-example-basic. +//! Tests for pallet-ocex. use crate::*; use frame_support::{ - parameter_types, - traits::{ConstU128, ConstU64}, + assert_noop, assert_ok, bounded_vec, parameter_types, + traits::{ConstU128, ConstU64, OnTimestampSet}, PalletId, }; use frame_system::EnsureRoot; -use sp_core::H256; +use polkadex_primitives::{ + assets::AssetId, ingress::IngressMessages, withdrawal::Withdrawal, Moment, Signature, + SnapshotAccLimit, +}; +use sp_application_crypto::sp_core::H256; +use sp_std::cell::RefCell; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are required. +use crate::mock::*; +use ckb_merkle_mountain_range::{util::MemStore, Merge, MMR}; +use codec::Encode; +use frame_system::EventRecord; +use polkadex_primitives::{ + ocex::AccountInfo, + snapshot::{EnclaveSnapshot, Fees}, + AccountId, AssetsLimit, Balance, ProxyLimit, WithdrawalLimit, +}; +use sp_application_crypto::RuntimePublic; +use sp_keystore::{testing::KeyStore, KeystoreExt, SyncCryptoStore}; use sp_runtime::{ testing::Header, - traits::{BlakeTwo256, IdentityLookup}, + traits::{BlakeTwo256, IdentityLookup, Verify}, + AccountId32, BoundedBTreeMap, BoundedVec, + DispatchError::BadOrigin, + TokenError, +}; +use std::{ + collections::{btree_map::Values, BTreeMap}, + sync::Arc, }; -// Reexport crate as its pallet name for construct_runtime. - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; - -// For testing the pallet, we construct a mock runtime. -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}, - Assets: pallet_assets::{Pallet, Call, Storage, Event}, - OCEX: crate::{Pallet, Call, Storage, Event}, + +pub const KEY_TYPE: sp_application_crypto::KeyTypeId = sp_application_crypto::KeyTypeId(*b"ocex"); + +fn assert_last_event(generic_event: ::Event) { + let events = frame_system::Pallet::::events(); + let system_event: ::Event = generic_event.into(); + // compare to the last event record + let EventRecord { event, .. } = &events[events.len() - 1]; + assert_eq!(event, &system_event); +} + +#[test] +fn test_register_main_account() { + let account_id = create_account_id(); + + new_test_ext().execute_with(|| { + assert_eq!(Accounts::::contains_key::(account_id.clone().into()), false); + assert_ok!(OCEX::register_main_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + assert_eq!(Accounts::::contains_key::(account_id.clone().into()), true); + let account_info = Accounts::::get(account_id.clone()).unwrap(); + assert_eq!(account_info.proxies.len(), 1); + assert_eq!(account_info.proxies[0], account_id.clone()); + assert_last_event::( + crate::Event::MainAccountRegistered { + main: account_id.clone(), + proxy: account_id.clone(), + } + .into(), + ); + let event: IngressMessages> = + IngressMessages::RegisterUser(account_id.clone(), account_id.clone()); + assert_eq!(OCEX::ingress_messages()[0], event); + }); +} + +#[test] +fn test_register_main_account_main_account_already_exists() { + let account_id = create_account_id(); + + new_test_ext().execute_with(|| { + assert_ok!(OCEX::register_main_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + assert_eq!(Accounts::::contains_key::(account_id.clone().into()), true); + assert_noop!( + OCEX::register_main_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + ), + Error::::MainAccountAlreadyRegistered + ); + }); +} + +#[test] +fn test_register_main_account_bad_origin() { + let account_id = create_account_id(); + + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::register_main_account(Origin::root(), account_id.clone().into()), + BadOrigin + ); + assert_noop!( + OCEX::register_main_account(Origin::none(), account_id.clone().into()), + BadOrigin + ); + }); +} + +#[test] +fn test_add_proxy_account_main_account_not_found() { + let account_id = create_account_id(); + + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::add_proxy_account(Origin::signed(account_id.clone().into()), account_id.into()), + Error::::MainAccountNotFound + ); + }); +} + +#[test] +fn test_add_proxy_account_proxy_limit_exceeded() { + let account_id = create_account_id(); + let proxy_account = create_proxy_account(); + new_test_ext().execute_with(|| { + assert_ok!(OCEX::register_main_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + assert_ok!(OCEX::add_proxy_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + assert_ok!(OCEX::add_proxy_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + assert_noop!( + OCEX::add_proxy_account( + Origin::signed(account_id.clone().into()), + proxy_account.clone().into() + ), + Error::::ProxyLimitExceeded + ); + }) +} + +#[test] +fn test_add_proxy_account_bad_origin() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!(OCEX::add_proxy_account(Origin::root(), account_id.clone().into()), BadOrigin); + + assert_noop!(OCEX::add_proxy_account(Origin::none(), account_id.clone().into()), BadOrigin); + }); +} + +#[test] +fn test_add_proxy_account() { + let account_id = create_account_id(); + + new_test_ext().execute_with(|| { + assert_ok!(OCEX::register_main_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + assert_ok!(OCEX::add_proxy_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + assert_last_event::( + crate::Event::MainAccountRegistered { + main: account_id.clone(), + proxy: account_id.clone(), + } + .into(), + ); + let event: IngressMessages> = + IngressMessages::AddProxy(account_id.clone(), account_id.clone()); + assert_eq!(OCEX::ingress_messages()[1], event); + }); +} + +#[test] +fn test_register_trading_pair_both_assets_cannot_be_same() { + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::register_trading_pair( + Origin::root(), + AssetId::polkadex, + AssetId::polkadex, + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into(), + ), + Error::::BothAssetsCannotBeSame + ); + }); +} + +#[test] +fn test_register_trading_pair_bad_origin() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::register_trading_pair( + Origin::none(), + AssetId::polkadex, + AssetId::polkadex, + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into(), + ), + BadOrigin + ); + + assert_noop!( + OCEX::register_trading_pair( + Origin::signed(account_id.into()), + AssetId::polkadex, + AssetId::polkadex, + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into(), + ), + BadOrigin + ); + }); +} + +#[test] +fn test_register_trading_pair() { + new_test_ext().execute_with(|| { + assert_ok!(OCEX::register_trading_pair( + Origin::root(), + AssetId::asset(10), + AssetId::asset(20), + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into() + )); + + assert_eq!( + TradingPairs::::contains_key(AssetId::asset(10), AssetId::asset(20)), + true + ); + assert_eq!(TradingPairsStatus::::get(AssetId::asset(10), AssetId::asset(20)), true); + assert_last_event::( + crate::Event::TradingPairRegistered { + base: AssetId::asset(10), + quote: AssetId::asset(20), + } + .into(), + ); + let trading_pair = + TradingPairs::::get(AssetId::asset(10), AssetId::asset(20)).unwrap(); + let event: IngressMessages> = + IngressMessages::OpenTradingPair(trading_pair); + assert_eq!(OCEX::ingress_messages()[0], event); + }); +} + +#[test] +fn test_register_trading_pair_trading_pair_already_registered() { + new_test_ext().execute_with(|| { + assert_ok!(OCEX::register_trading_pair( + Origin::root(), + AssetId::asset(10), + AssetId::asset(20), + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into() + )); + + assert_noop!( + OCEX::register_trading_pair( + Origin::root(), + AssetId::asset(10), + AssetId::asset(20), + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into() + ), + Error::::TradingPairAlreadyRegistered + ); + + assert_noop!( + OCEX::register_trading_pair( + Origin::root(), + AssetId::asset(20), + AssetId::asset(10), + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into() + ), + Error::::TradingPairAlreadyRegistered + ); + }); +} + +#[test] +fn test_deposit_unknown_asset() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::deposit( + Origin::signed(account_id.clone().into()), + AssetId::asset(10), + 100_u128.into() + ), + TokenError::UnknownAsset + ); + }); +} + +#[test] +fn test_deposit_bad_origin() { + new_test_ext().execute_with(|| { + assert_noop!(OCEX::deposit(Origin::root(), AssetId::asset(10), 100_u128.into()), BadOrigin); + + assert_noop!(OCEX::deposit(Origin::none(), AssetId::asset(10), 100_u128.into()), BadOrigin); + }); +} + +#[test] +fn test_deposit() { + let account_id = create_account_id(); + let custodian_account = OCEX::get_custodian_account(); + new_test_ext().execute_with(|| { + mint_into_account(account_id.clone()); + // Balances before deposit + assert_eq!( + ::NativeCurrency::free_balance(account_id.clone()), + 100000000000000 + ); + assert_eq!(::NativeCurrency::free_balance(custodian_account.clone()), 0); + assert_ok!(OCEX::deposit( + Origin::signed(account_id.clone().into()), + AssetId::polkadex, + 100_u128.into() + )); + // Balances after deposit + assert_eq!( + ::NativeCurrency::free_balance(account_id.clone()), + 99999999999900 + ); + assert_eq!(::NativeCurrency::free_balance(custodian_account.clone()), 100); + assert_last_event::( + crate::Event::DepositSuccessful { + user: account_id.clone(), + asset: AssetId::polkadex, + amount: 100_u128, + } + .into(), + ); + let event: IngressMessages> = + IngressMessages::Deposit(account_id, AssetId::polkadex, 100_u128); + assert_eq!(OCEX::ingress_messages()[0], event); + }); +} + +#[test] +fn test_open_trading_pair_both_assets_cannot_be_same() { + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::open_trading_pair(Origin::root(), AssetId::asset(10), AssetId::asset(10)), + Error::::BothAssetsCannotBeSame + ); + + assert_eq!(OCEX::ingress_messages().len(), 0); + }); +} + +#[test] +fn test_open_trading_pair_trading_pair_not_found() { + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::open_trading_pair(Origin::root(), AssetId::asset(10), AssetId::asset(20)), + Error::::TradingPairNotFound + ); + + assert_eq!(OCEX::ingress_messages().len(), 0); + }); +} + +#[test] +fn test_open_trading_pair_bad_origin() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::open_trading_pair(Origin::none(), AssetId::asset(10), AssetId::asset(20)), + BadOrigin + ); + + assert_noop!( + OCEX::open_trading_pair( + Origin::signed(account_id.into()), + AssetId::asset(10), + AssetId::asset(20) + ), + BadOrigin + ); + }); +} + +#[test] +fn test_open_trading_pair() { + new_test_ext().execute_with(|| { + assert_ok!(OCEX::register_trading_pair( + Origin::root(), + AssetId::asset(10), + AssetId::asset(20), + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into() + )); + assert_ok!(OCEX::open_trading_pair(Origin::root(), AssetId::asset(10), AssetId::asset(20))); + assert_eq!(TradingPairsStatus::::get(AssetId::asset(10), AssetId::asset(20)), true); + let trading_pair = OCEX::trading_pairs(AssetId::asset(10), AssetId::asset(20)).unwrap(); + assert_last_event::( + crate::Event::OpenTradingPair { pair: trading_pair.clone() }.into(), + ); + let event: IngressMessages> = + IngressMessages::OpenTradingPair(trading_pair); + assert_eq!(OCEX::ingress_messages()[0], event); + }) +} + +#[test] +fn test_close_trading_pair_both_assets_cannot_be_same() { + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::close_trading_pair(Origin::root(), AssetId::asset(10), AssetId::asset(10)), + Error::::BothAssetsCannotBeSame + ); + + assert_eq!(OCEX::ingress_messages().len(), 0); + }); +} + +#[test] +fn test_close_trading_trading_pair_not_found() { + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::close_trading_pair(Origin::root(), AssetId::asset(10), AssetId::asset(20)), + Error::::TradingPairNotFound + ); + + assert_eq!(OCEX::ingress_messages().len(), 0); + }); +} + +#[test] +fn test_close_trading_trading_bad_origin() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::close_trading_pair(Origin::none(), AssetId::asset(10), AssetId::asset(20)), + BadOrigin + ); + + assert_noop!( + OCEX::close_trading_pair( + Origin::signed(account_id.into()), + AssetId::asset(10), + AssetId::asset(20) + ), + BadOrigin + ); + }); +} + +#[test] +fn test_close_trading_pair() { + new_test_ext().execute_with(|| { + assert_ok!(OCEX::register_trading_pair( + Origin::root(), + AssetId::asset(10), + AssetId::asset(20), + 1_u128.into(), + 100_u128.into(), + 1_u128.into(), + 100_u128.into(), + 100_u128.into(), + 10_u128.into() + )); + assert_ok!(OCEX::close_trading_pair( + Origin::root(), + AssetId::asset(10), + AssetId::asset(20) + )); + assert_eq!(TradingPairsStatus::::get(AssetId::asset(10), AssetId::asset(20)), false); + let trading_pair = OCEX::trading_pairs(AssetId::asset(10), AssetId::asset(20)).unwrap(); + assert_last_event::( + crate::Event::ShutdownTradingPair { pair: trading_pair.clone() }.into(), + ); + let event: IngressMessages> = + IngressMessages::CloseTradingPair(trading_pair); + assert_eq!(OCEX::ingress_messages()[1], event); + }) +} + +#[test] +fn collect_fees_unexpected_behaviour() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + // TODO! Discuss if this is expected behaviour, if not then could this be a potential DDOS? + assert_ok!(OCEX::collect_fees( + Origin::signed(account_id.clone().into()), + 100, + account_id.clone().into() + )); + + assert_last_event::( + crate::Event::FeesClaims { beneficiary: account_id, snapshot_id: 100 }.into(), + ); + }); +} + +#[test] +fn collect_fees() { + let account_id = create_account_id(); + let custodian_account = OCEX::get_custodian_account(); + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let public_key_store = KeyStore::new(); + let public_key = SyncCryptoStore::sr25519_generate_new( + &public_key_store, + KEY_TYPE, + Some(&format!("{}/hunter1", PHRASE)), + ) + .expect("Unable to create sr25519 key pair"); + let mut t = new_test_ext(); + t.register_extension(KeystoreExt(Arc::new(public_key_store))); + t.execute_with(|| { + mint_into_account(account_id.clone()); + mint_into_account(custodian_account.clone()); + // Initial Balances + assert_eq!( + ::NativeCurrency::free_balance(account_id.clone()), + 100000000000000 + ); + assert_eq!( + ::NativeCurrency::free_balance(custodian_account.clone()), + 100000000000000 + ); + let fees = create_fees::(); + + let mmr_root: H256 = create_mmr_with_one_account(); + let mut snapshot = EnclaveSnapshot::< + AccountId32, + Balance, + WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, + > { + snapshot_number: 0, + merkle_root: mmr_root, + withdrawals: Default::default(), + fees: bounded_vec![fees], + }; + assert_ok!(OCEX::insert_enclave(Origin::root(), account_id.clone().into())); + let bytes = snapshot.encode(); + let signature = public_key.sign(KEY_TYPE, &bytes).unwrap(); + + assert_ok!(OCEX::submit_snapshot( + Origin::signed(account_id.clone().into()), + snapshot, + signature.clone().into() + ),); + + assert_ok!(OCEX::collect_fees( + Origin::signed(account_id.clone().into()), + 0, + account_id.clone().into() + )); + // Balances after collect fees + assert_eq!( + ::NativeCurrency::free_balance(account_id.clone()), + 100000000000100 + ); + assert_eq!( + ::NativeCurrency::free_balance(custodian_account.clone()), + 99999999999900 + ); + }); +} + +#[test] +fn test_collect_fees_bad_origin() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!(OCEX::collect_fees(Origin::root(), 100, account_id.clone().into()), BadOrigin); + + assert_noop!(OCEX::collect_fees(Origin::none(), 100, account_id.into()), BadOrigin); + }); +} + +// P.S. This was to apply a DDOS attack and see the response in the mock environment +/* #[test] +fn collect_fees_ddos(){ + let account_id = create_account_id(); + new_test_ext().execute_with(||{ + // TODO! Discuss if this is expected behaviour, if not then could this be a potential DDOS? + for x in 0..10000000 { + assert_ok!( + OCEX::collect_fees( + Origin::signed(account_id.clone().into()), + x, + account_id.clone().into() + ) + ); + } + }); +} */ + +#[test] +fn test_submit_snapshot_sender_is_not_attested_enclave() { + let account_id = create_account_id(); + let payl: [u8; 64] = [0; 64]; + let sig = sp_application_crypto::sr25519::Signature::from_raw(payl); + new_test_ext().execute_with(|| { + let mmr_root: H256 = create_mmr_with_one_account(); + let mut snapshot = EnclaveSnapshot::< + AccountId32, + Balance, + WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, + > { + snapshot_number: 1, + merkle_root: mmr_root, + withdrawals: Default::default(), + fees: bounded_vec![], + }; + assert_noop!( + OCEX::submit_snapshot(Origin::signed(account_id.into()), snapshot, sig.clone().into()), + Error::::SenderIsNotAttestedEnclave + ); + // There is an existing ingress message which holds RegisterUser + assert_eq!(OCEX::ingress_messages().len(), 1); + }); +} + +#[test] +fn test_submit_snapshot_snapshot_nonce_error() { + let account_id = create_account_id(); + let payl: [u8; 64] = [0; 64]; + let sig = sp_application_crypto::sr25519::Signature::from_raw(payl); + new_test_ext().execute_with(|| { + let mmr_root: H256 = create_mmr_with_one_account(); + let mut snapshot = EnclaveSnapshot::< + AccountId32, + Balance, + WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, + > { + snapshot_number: 1, + merkle_root: mmr_root, + withdrawals: Default::default(), + fees: bounded_vec![], + }; + assert_ok!(OCEX::insert_enclave(Origin::root(), account_id.clone().into())); + assert_noop!( + OCEX::submit_snapshot(Origin::signed(account_id.into()), snapshot, sig.clone().into()), + Error::::SnapshotNonceError + ); + + assert_eq!(OCEX::ingress_messages().len(), 1); + }); +} + +#[test] +fn test_submit_snapshot_enclave_signature_verification_failed() { + let account_id = create_account_id(); + let payl: [u8; 64] = [0; 64]; + let sig = sp_application_crypto::sr25519::Signature::from_raw(payl); + new_test_ext().execute_with(|| { + let mmr_root: H256 = create_mmr_with_one_account(); + let mut snapshot = EnclaveSnapshot::< + AccountId32, + Balance, + WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, + > { + snapshot_number: 0, + merkle_root: mmr_root, + withdrawals: Default::default(), + fees: bounded_vec![], + }; + assert_ok!(OCEX::insert_enclave(Origin::root(), account_id.clone().into())); + assert_noop!( + OCEX::submit_snapshot(Origin::signed(account_id.into()), snapshot, sig.clone().into()), + Error::::EnclaveSignatureVerificationFailed + ); + + assert_eq!(OCEX::ingress_messages().len(), 1); + }); +} + +#[test] +fn test_submit_snapshot_bad_origin() { + let payl: [u8; 64] = [0; 64]; + let sig = sp_application_crypto::sr25519::Signature::from_raw(payl); + new_test_ext().execute_with(|| { + let mmr_root: H256 = create_mmr_with_one_account(); + let mut snapshot = EnclaveSnapshot::< + AccountId32, + Balance, + WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, + > { + snapshot_number: 0, + merkle_root: mmr_root, + withdrawals: Default::default(), + fees: bounded_vec![], + }; + assert_noop!( + OCEX::submit_snapshot(Origin::root(), snapshot.clone(), sig.clone().into()), + BadOrigin + ); + + assert_noop!( + OCEX::submit_snapshot(Origin::root(), snapshot, sig.clone().into()), + BadOrigin + ); + }); +} + +#[test] +fn test_submit_snapshot() { + let account_id = create_account_id(); + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let public_key_store = KeyStore::new(); + let public_key = SyncCryptoStore::sr25519_generate_new( + &public_key_store, + KEY_TYPE, + Some(&format!("{}/hunter1", PHRASE)), + ) + .expect("Unable to create sr25519 key pair"); + let mut t = new_test_ext(); + t.register_extension(KeystoreExt(Arc::new(public_key_store))); + t.execute_with(|| { + let withdrawal = create_withdrawal::(); + let mmr_root: H256 = create_mmr_with_one_account(); + let mut withdrawal_map: BoundedBTreeMap< + AccountId, + BoundedVec, WithdrawalLimit>, + SnapshotAccLimit, + > = BoundedBTreeMap::new(); + withdrawal_map.try_insert(account_id.clone(), bounded_vec![withdrawal]); + let mut snapshot = EnclaveSnapshot::< + AccountId32, + Balance, + WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, + > { + snapshot_number: 0, + merkle_root: mmr_root, + withdrawals: withdrawal_map.clone(), + fees: bounded_vec![], + }; + assert_ok!(OCEX::insert_enclave(Origin::root(), account_id.clone().into())); + let bytes = snapshot.encode(); + let signature = public_key.sign(KEY_TYPE, &bytes).unwrap(); + + assert_ok!(OCEX::submit_snapshot( + Origin::signed(account_id.into()), + snapshot.clone(), + signature.clone().into() + ),); + assert_eq!(Withdrawals::::contains_key(0), true); + assert_eq!(Withdrawals::::get(0), withdrawal_map.clone()); + assert_eq!(FeesCollected::::contains_key(0), true); + assert_eq!(Snapshots::::contains_key(0), true); + assert_eq!(Snapshots::::get(0).unwrap(), snapshot.clone()); + assert_eq!(SnapshotNonce::::get().unwrap(), 1); + }) +} + +#[test] +fn test_register_enclave() { + let account_id = create_account_id(); + let ias_report = vec![ + 19, 19, 2, 7, 255, 128, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, 157, 113, 31, 38, 134, 1, 92, 170, 202, 207, 84, 214, 193, 115, 135, 89, + 228, 23, 80, 184, 116, 61, 170, 171, 159, 47, 5, 32, 99, 126, 11, 13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 183, 141, + 57, 75, 101, 149, 246, 85, 227, 219, 71, 14, 143, 143, 79, 2, 209, 127, 165, 117, 206, 185, + 73, 81, 228, 1, 225, 150, 116, 242, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 95, + 159, 233, 74, 113, 162, 222, 24, 218, 134, 159, 15, 74, 157, 188, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 69, 66, 236, 163, 63, 254, 74, 251, 172, 254, 123, 233, 19, 175, + 193, 204, + ]; + new_test_ext().execute_with(|| { + assert_noop!(OCEX::register_enclave(Origin::signed(account_id.clone()), ias_report), + Error::::RemoteAttestationVerificationFailed + ); + }); +} + +#[test] +fn test_register_enclave_empty_report() { + let account_id = create_account_id(); + let ias_report = vec![]; + new_test_ext().execute_with(|| { + assert_noop!(OCEX::register_enclave(Origin::signed(account_id), ias_report), + Error::::RemoteAttestationVerificationFailed + ); + }); +} + +#[test] +fn test_reigster_enclave_bad_origin() { + new_test_ext().execute_with(|| { + assert_noop!(OCEX::register_enclave(Origin::root(), vec![]), BadOrigin); + + assert_noop!(OCEX::register_enclave(Origin::none(), vec![]), BadOrigin); + }); +} + +#[test] +fn test_withdrawal_invalid_withdrawal_index() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!( + OCEX::withdraw(Origin::signed(account_id.clone().into()), 1,), + Error::::InvalidWithdrawalIndex + ); + }); +} + +#[test] +fn test_withdrawal() { + let account_id = create_account_id(); + let custodian_account = OCEX::get_custodian_account(); + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let public_key_store = KeyStore::new(); + let public_key = SyncCryptoStore::sr25519_generate_new( + &public_key_store, + KEY_TYPE, + Some(&format!("{}/hunter1", PHRASE)), + ) + .expect("Unable to create sr25519 key pair"); + let mut t = new_test_ext(); + t.register_extension(KeystoreExt(Arc::new(public_key_store))); + t.execute_with(|| { + mint_into_account(account_id.clone()); + mint_into_account(custodian_account.clone()); + // Initial Balances + assert_eq!( + ::NativeCurrency::free_balance(account_id.clone()), + 100000000000000 + ); + assert_eq!( + ::NativeCurrency::free_balance(custodian_account.clone()), + 100000000000000 + ); + let withdrawal = create_withdrawal::(); + let mut withdrawal_map: BoundedBTreeMap< + AccountId, + BoundedVec, WithdrawalLimit>, + SnapshotAccLimit, + > = BoundedBTreeMap::new(); + withdrawal_map.try_insert(account_id.clone(), bounded_vec![withdrawal]); + + let mmr_root: H256 = create_mmr_with_one_account(); + let mut snapshot = EnclaveSnapshot::< + AccountId32, + Balance, + WithdrawalLimit, + AssetsLimit, + SnapshotAccLimit, + > { + snapshot_number: 0, + merkle_root: mmr_root, + withdrawals: withdrawal_map, + fees: bounded_vec![], + }; + assert_ok!(OCEX::insert_enclave(Origin::root(), account_id.clone().into())); + let bytes = snapshot.encode(); + let signature = public_key.sign(KEY_TYPE, &bytes).unwrap(); + + assert_ok!(OCEX::submit_snapshot( + Origin::signed(account_id.clone().into()), + snapshot, + signature.clone().into() + ),); + + assert_ok!(OCEX::withdraw(Origin::signed(account_id.clone().into()), 0,)); + // Balances after withdrawal + assert_eq!( + ::NativeCurrency::free_balance(account_id.clone()), + 100000000000100 + ); + assert_eq!( + ::NativeCurrency::free_balance(custodian_account.clone()), + 99999999999900 + ); + }); +} + +#[test] +fn test_withdrawal_bad_origin() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!(OCEX::withdraw(Origin::root(), 1,), BadOrigin); + + assert_noop!(OCEX::withdraw(Origin::none(), 1,), BadOrigin); + }); +} + +#[test] +fn test_shutdown() { + new_test_ext().execute_with(|| { + assert_ok!(OCEX::shutdown(Origin::root())); + + let ingress_message: IngressMessages> = + IngressMessages::Shutdown; + assert_eq!(OCEX::ingress_messages()[0], ingress_message); + assert_eq!(ExchangeState::::get(), false); + }); +} + +#[test] +fn test_shutdown_bad_origin() { + let account_id = create_account_id(); + new_test_ext().execute_with(|| { + assert_noop!(OCEX::shutdown(Origin::signed(account_id.into())), BadOrigin); + + assert_noop!(OCEX::shutdown(Origin::none()), BadOrigin); + }); +} + +fn mint_into_account(account_id: AccountId32) { + Balances::deposit_creating(&account_id, 100000000000000); +} + +fn create_asset_and_credit(asset_id: u128, account_id: AccountId32) { + assert_ok!(Assets::create( + Origin::signed(account_id.clone().into()), + asset_id.into(), + account_id.clone().into(), + 100_u128 + )); +} + +fn create_account_id() -> AccountId32 { + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let keystore = KeyStore::new(); + let account_id: AccountId32 = SyncCryptoStore::sr25519_generate_new( + &keystore, + KEY_TYPE, + Some(&format!("{}/hunter1", PHRASE)), + ) + .expect("Unable to create sr25519 key pair") + .try_into() + .expect("Unable to convert to AccountId32"); + + return account_id +} + +fn create_proxy_account() -> AccountId32 { + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let keystore = KeyStore::new(); + let account_id: AccountId32 = SyncCryptoStore::sr25519_generate_new( + &keystore, + KEY_TYPE, + Some(&format!("{}/hunter2", PHRASE)), + ) + .expect("Unable to create sr25519 key pair") + .try_into() + .expect("Unable to convert to AccountId32"); + + return account_id +} + +fn create_public_key() -> sp_application_crypto::sr25519::Public { + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let keystore = KeyStore::new(); + let account_id = SyncCryptoStore::sr25519_generate_new( + &keystore, + KEY_TYPE, + Some(&format!("{}/hunter1", PHRASE)), + ) + .expect("Unable to create sr25519 key pair"); + + return account_id +} + +fn create_mmr_with_one_account() -> H256 { + let account_id = create_account_id(); + let mut snapshot: BTreeMap> = + Default::default(); + assert_ok!(OCEX::register_main_account( + Origin::signed(account_id.clone().into()), + account_id.clone().into() + )); + let account_info = Accounts::::get::(account_id.clone().into()).unwrap(); + snapshot.insert(account_id.clone().into(), account_info.clone().into()); + let mmr_root = calculate_mmr_root(&mut snapshot.values()).unwrap(); + // panic!("{:?}", mmr_root.0); + mmr_root +} + +#[derive(Eq, PartialEq, Clone, Debug, Default)] +pub struct MergeAccountInfo(pub [u8; 32]); +impl Merge for MergeAccountInfo { + type Item = MergeAccountInfo; + fn merge( + lhs: &Self::Item, + rhs: &Self::Item, + ) -> Result { + let mut bytes = Vec::::with_capacity(64); + lhs.0.map(|byte| bytes.push(byte)); + rhs.0.map(|byte| bytes.push(byte)); + Ok(MergeAccountInfo(sp_application_crypto::sp_core::blake2_256(&bytes))) } -); - -parameter_types! { - pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(1024); -} -impl frame_system::Config for Test { - type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = (); - type Origin = Origin; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Call = Call; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type Event = Event; - type BlockHashCount = ConstU64<250>; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -impl pallet_balances::Config for Test { - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; - type Balance = u128; - type DustRemoval = (); - type Event = Event; - type ExistentialDeposit = ConstU128<1>; - type AccountStore = System; - type WeightInfo = (); -} - -parameter_types! { - pub const ProxyLimit: u32 = 2; - pub const OcexPalletId: PalletId = PalletId(*b"OCEX_LMP"); -} - -impl Config for Test { - type Event = Event; - type ProxyLimit = ProxyLimit; - type PalletId = OcexPalletId; - type NativeCurrency = Balances; - type OtherAssets = Assets; - type EnclaveOrigin = EnsureRoot; - type WeightInfo = (); -} - -parameter_types! { - pub const AssetDeposit: u128 = 100; - pub const ApprovalDeposit: u128 = 1; - pub const StringLimit: u32 = 50; - pub const MetadataDepositBase: u128 = 10; - pub const MetadataDepositPerByte: u128 = 1; -} - -impl pallet_assets::Config for Test { - type Event = Event; - type Balance = u128; - type AssetId = u128; - type Currency = Balances; - type ForceOrigin = EnsureRoot; - type AssetDeposit = AssetDeposit; - type AssetAccountDeposit = AssetDeposit; - type MetadataDepositBase = MetadataDepositBase; - type MetadataDepositPerByte = MetadataDepositPerByte; - type ApprovalDeposit = ApprovalDeposit; - type StringLimit = StringLimit; - type Freezer = (); - type Extra = (); - type WeightInfo = (); +} + +/// Calculates the MMR root for a given vector of accounts +pub fn calculate_mmr_root( + accounts: &mut Values>, +) -> anyhow::Result { + let store = MemStore::default(); + let mut mmr = MMR::<_, MergeAccountInfo, _>::new(0, &store); + accounts.by_ref().for_each(|value| { + let bytes = value.encode(); + if let Err(err) = + mmr.push(MergeAccountInfo(sp_application_crypto::sp_core::blake2_256(&bytes))) + { + log::error!(target: "mmr", "Unable to push account into MMR calculator: {:?}", err); + } + }); + + match mmr.get_root() { + Ok(root) => Ok(H256::from(root.0)), + Err(err) => Err(anyhow::Error::msg(format!("unable to calculate MMR root: {:?}", err))), + } +} + +pub fn create_withdrawal() -> Withdrawal> { + let account_id = create_account_id(); + let withdrawal: Withdrawal> = + Withdrawal { main_account: account_id, asset: AssetId::polkadex, amount: 100_u32.into() }; + return withdrawal +} + +pub fn create_fees() -> Fees> { + let fees: Fees> = Fees { asset: AssetId::polkadex, amount: 100_u32.into() }; + return fees } diff --git a/pallets/pdex-migration/Cargo.toml b/pallets/pdex-migration/Cargo.toml index f5faaf35b..5fcfafaf0 100644 --- a/pallets/pdex-migration/Cargo.toml +++ b/pallets/pdex-migration/Cargo.toml @@ -13,20 +13,20 @@ targets = ['x86_64-unknown-linux-gnu'] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } scale-info = { version = "2.0.1", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false, optional = true } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -rand = {default-features = false, version = '0.8.0'} -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false, optional = true } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } + +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19"} +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28"} [features] default = ['std'] @@ -38,7 +38,6 @@ std = [ 'sp-runtime/std', 'pallet-balances/std', 'pallet-sudo/std', - 'rand/std' ] #TODO: [#463] Currently broken, will be fixed in different issue #runtime-benchmarks = [ diff --git a/pallets/polkadex-ido/Cargo.toml b/pallets/polkadex-ido/Cargo.toml index d1ce11226..1f84c6849 100644 --- a/pallets/polkadex-ido/Cargo.toml +++ b/pallets/polkadex-ido/Cargo.toml @@ -12,22 +12,23 @@ codec = { version = "3.0.0", package = "parity-scale-codec", default-features = hex = { version = "2.1.0", package = "rustc-hex", default-features = false } serde = { version = "1.0.127", optional = true } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19",default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", optional = true } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.19" , default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28",default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", optional = true } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +#polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.28" , default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } rand = {default-features = false, version = '0.8.0'} rand_chacha = {default-features = false, version = '0.3.0'} pallet-polkadex-ido-primitives = { path = "../../pallets/polkadex-ido/common", default-features = false} [dev-dependencies] -frame-support-test = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -pallet-assets = { default-features = false, branch = "polkadot-v0.9.19", git = "https://github.com/paritytech/substrate" } +frame-support-test = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +pallet-assets = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/paritytech/substrate" } [features] default = ["std"] diff --git a/pallets/polkadex-ido/common/Cargo.toml b/pallets/polkadex-ido/common/Cargo.toml index 293beaa5d..53cda4971 100644 --- a/pallets/polkadex-ido/common/Cargo.toml +++ b/pallets/polkadex-ido/common/Cargo.toml @@ -10,10 +10,11 @@ codec = { version = "3.0.0", package = "parity-scale-codec", default-features = serde = { version = "1.0.68", features = ["derive"], optional = true } # Substrate Dependencies (This crate should not rely on frame) -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.19", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +#polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.28", default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } [features] default = ["std"] diff --git a/pallets/polkadex-ido/rpc/Cargo.toml b/pallets/polkadex-ido/rpc/Cargo.toml index c80831041..50ba80610 100644 --- a/pallets/polkadex-ido/rpc/Cargo.toml +++ b/pallets/polkadex-ido/rpc/Cargo.toml @@ -11,10 +11,10 @@ serde = { version = "1.0.68", optional = true } jsonrpc-core = "18.0.0" jsonrpc-core-client = "18.0.0" jsonrpc-derive = "18.0.0" -sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19",default-features = false } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } +sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28",default-features = false } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } pallet-polkadex-ido-primitives = {path = "../common", default-features = false} polkadex-ido-runtime-api = {path = "runtime-api" } -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.19" , default-features = false } \ No newline at end of file +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } \ No newline at end of file diff --git a/pallets/polkadex-ido/rpc/runtime-api/Cargo.toml b/pallets/polkadex-ido/rpc/runtime-api/Cargo.toml index 9b754ada4..6a4c73089 100644 --- a/pallets/polkadex-ido/rpc/runtime-api/Cargo.toml +++ b/pallets/polkadex-ido/rpc/runtime-api/Cargo.toml @@ -10,10 +10,11 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = # Substrate Dependencies pallet-polkadex-ido-primitives= { default-features = false, path = "../../common" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.19" , default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +#polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.28" , default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } [features] default = ["std"] std = [ diff --git a/pallets/polkadex-ido/src/lib.rs b/pallets/polkadex-ido/src/lib.rs index 422a38dc3..a3b677a90 100644 --- a/pallets/polkadex-ido/src/lib.rs +++ b/pallets/polkadex-ido/src/lib.rs @@ -1369,7 +1369,7 @@ pub mod pallet { impl Pallet { /// module wallet account pub fn get_wallet_account() -> T::AccountId { - T::ModuleId::get().into_account() + T::ModuleId::get().into_account_truncating() } /// converts block to balance @@ -1383,7 +1383,7 @@ impl Pallet { /// # Parameters /// * hash : Round id pub fn round_account_id(hash: T::Hash) -> T::AccountId { - T::ModuleId::get().into_sub_account(hash) + T::ModuleId::get().into_sub_account_truncating(hash) } /// Increments and return a nonce @@ -1396,7 +1396,7 @@ impl Pallet { /// module wallet account pub fn pallet_account_id() -> T::AccountId { - T::ModuleId::get().into_account() + T::ModuleId::get().into_account_truncating() } /// Returns rounds an investor has invested in diff --git a/pallets/test-token-provider/Cargo.toml b/pallets/test-token-provider/Cargo.toml index dfd507d64..4d1169443 100644 --- a/pallets/test-token-provider/Cargo.toml +++ b/pallets/test-token-provider/Cargo.toml @@ -13,24 +13,25 @@ targets = ['x86_64-unknown-linux-gnu'] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } scale-info = { version = "2.0.1", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false, optional = true } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false, optional = true } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } - -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.19" , default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } +#polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.28" , default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19"} -pallet-assets = { default-features = false, branch = "polkadot-v0.9.19", git = "https://github.com/paritytech/substrate" } -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.19" , default-features = false } -sp-keystore = {default-features = false, optional=false,branch = "polkadot-v0.9.19",git = 'https://github.com/paritytech/substrate' } -sp-application-crypto = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28"} +pallet-assets = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/paritytech/substrate" } +#polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch="polkadot-v0.9.28" , default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } +sp-keystore = {default-features = false, optional=false,branch = "polkadot-v0.9.28",git = 'https://github.com/paritytech/substrate' } +sp-application-crypto = {default-features = false, branch="polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate'} [features] diff --git a/pallets/test-token-provider/src/lib.rs b/pallets/test-token-provider/src/lib.rs index 956861dfe..a7359a77f 100644 --- a/pallets/test-token-provider/src/lib.rs +++ b/pallets/test-token-provider/src/lib.rs @@ -9,25 +9,43 @@ mod test; pub use pallet::*; // use sp_core::H160; +#[derive(PartialEq, PartialOrd, Ord, Eq)] +pub enum Assets { + TestDot = 1, + TestEth = 2, + TestBTC = 3, + TestDoge = 4, + TestBNB = 5, + Unknown, +} +impl Assets { + fn from_u8(origin: u8) -> Self { + match origin { + 1 => Assets::TestDot, + 2 => Assets::TestEth, + 3 => Assets::TestBTC, + 4 => Assets::TestDoge, + 5 => Assets::TestBNB, + _ => Assets::Unknown, + } + } +} + #[frame_support::pallet] pub mod pallet { - use codec::{Decode, Encode, MaxEncodedLen}; + use crate::Assets; use frame_support::{ pallet_prelude::*, traits::{ tokens::fungibles::{Create, Inspect, Mutate}, - Currency, Get, LockableCurrency, ReservableCurrency, WithdrawReasons, + Currency, Get, ReservableCurrency, }, PalletId, }; use frame_system::pallet_prelude::*; - use scale_info::TypeInfo; pub use sp_core::H160; use sp_runtime::{ - traits::{ - AccountIdConversion, AtLeast32BitUnsigned, BlockNumberProvider, Dispatchable, One, - Saturating, UniqueSaturatedInto, Zero, - }, + traits::{AccountIdConversion, AtLeast32BitUnsigned, One, UniqueSaturatedInto}, SaturatedConversion, }; // use core::str::FromStr; @@ -67,6 +85,7 @@ pub mod pallet { #[pallet::error] pub enum Error { AccountAlreadyCredited, + NotAllowed, } const BLOCK_THRESHOLD: u64 = (24 * 60 * 60) / 6; @@ -78,10 +97,18 @@ pub mod pallet { fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { // Need to create Block treshold let current_block_no: T::BlockNumber = >::block_number(); - let valid_tx = |account: &T::AccountId| { - let last_block_number: T::BlockNumber = >::get(account); - if (last_block_number == 0_u64.saturated_into()) || - (current_block_no - last_block_number >= BLOCK_THRESHOLD.saturated_into()) + let valid_tx = |account: &T::AccountId, asset_id: u128| { + let mut last_block_number: T::BlockNumber; + if let Some(block) = Self::fetch_block_number(&account, asset_id){ + last_block_number = block; + } else { + return TransactionValidity::Err(TransactionValidityError::Invalid( + InvalidTransaction::ExhaustsResources, + )); + } + // let last_block_number: T::BlockNumber = Self::fetch_block_number(&account, asset_id).unwrap(); + if (last_block_number == 0_u64.saturated_into()) + || (current_block_no - last_block_number >= BLOCK_THRESHOLD.saturated_into()) { ValidTransaction::with_tag_prefix("token-faucet") .priority(100) @@ -97,8 +124,8 @@ pub mod pallet { }; let valid_native_tx = |account: &T::AccountId| { let last_block_number: T::BlockNumber = >::get(account); - if (last_block_number == 0_u64.saturated_into()) || - (current_block_no - last_block_number >= BLOCK_THRESHOLD.saturated_into()) + if (last_block_number == 0_u64.saturated_into()) + || (current_block_no - last_block_number >= BLOCK_THRESHOLD.saturated_into()) { ValidTransaction::with_tag_prefix("native-token") .priority(100) @@ -112,11 +139,13 @@ pub mod pallet { )) } }; - match call { - Call::credit_account_with_tokens_unsigned { account } => valid_tx(&account), - Call::credit_account_with_native_tokens_unsigned { account } => - valid_native_tx(&account), + Call::credit_account_with_tokens_unsigned { account, asset_id } => { + valid_tx(&account, *asset_id as u128) + }, + Call::credit_account_with_native_tokens_unsigned { account } => { + valid_native_tx(&account) + }, _ => InvalidTransaction::Call.into(), } } @@ -128,26 +157,23 @@ pub mod pallet { pub fn credit_account_with_tokens_unsigned( origin: OriginFor, account: T::AccountId, + asset_id: u16, ) -> DispatchResultWithPostInfo { let _ = ensure_none(origin)?; - if let Err(e) = T::AssetManager::mint_into(Self::asset_id(), &account, 1000000000000000) - { - // Handling Unknown Asset by creating the Asset - T::AssetManager::create( - Self::asset_id(), - Self::account_id(), - true, - BalanceOf::::one().unique_saturated_into(), - )?; - // Minting Test Ether into the Account - T::AssetManager::mint_into(Self::asset_id(), &account, 1000000000000000)?; + if asset_id < 1 || asset_id > 5 { + return Err(Error::::NotAllowed.into()); + } + let asset: Assets = Assets::from_u8(asset_id as u8); + if asset == Assets::Unknown { + return Err(Error::::NotAllowed.into()); } - TokenFaucetMap::::insert(&account, >::block_number()); + Self::transfer_assets(&account, asset_id as u128); Self::deposit_event(Event::AccountCredited(account)); // Code here to mint tokens Ok(().into()) } + #[pallet::weight((10_000, DispatchClass::Normal))] pub fn credit_account_with_native_tokens_unsigned( origin: OriginFor, @@ -167,6 +193,31 @@ pub mod pallet { pub(super) type TokenFaucetMap = StorageMap<_, Blake2_128Concat, T::AccountId, T::BlockNumber, ValueQuery>; + #[pallet::storage] + #[pallet::getter(fn token_btc)] + pub(super) type TokenBTC = + StorageMap<_, Blake2_128Concat, T::AccountId, T::BlockNumber, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn token_eth)] + pub(super) type TokenEth = + StorageMap<_, Blake2_128Concat, T::AccountId, T::BlockNumber, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn token_doge)] + pub(super) type TokenDoge = + StorageMap<_, Blake2_128Concat, T::AccountId, T::BlockNumber, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn token_dot)] + pub(super) type TokenDot = + StorageMap<_, Blake2_128Concat, T::AccountId, T::BlockNumber, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn token_bnb)] + pub(super) type TokenBNB = + StorageMap<_, Blake2_128Concat, T::AccountId, T::BlockNumber, ValueQuery>; + #[pallet::storage] #[pallet::getter(fn native_token_map)] pub(super) type NativeTokenMap = @@ -184,14 +235,72 @@ pub mod pallet { /// Provides an AccountId for the pallet. /// This is used both as an origin check and deposit/withdrawal account. pub fn account_id() -> T::AccountId { - MODULE_ID.into_account() + MODULE_ID.into_account_truncating() + } + + pub fn transfer_assets(account: &T::AccountId, asset_id: u128) { + if let Err(_e) = T::AssetManager::mint_into(asset_id, &account, 1000000000000000) { + // Handling Unknown Asset by creating the Asset + T::AssetManager::create( + asset_id, + Self::account_id(), + true, + BalanceOf::::one().unique_saturated_into(), + ); + // Minting Test Ether into the Account + T::AssetManager::mint_into(asset_id, &account, 1000000000000000); + } + match asset_id { + 1_u128 => { + TokenDot::::insert(&account, >::block_number()); + }, + 2_u128 => { + TokenEth::::insert(&account, >::block_number()); + }, + 3_u128 => { + TokenBTC::::insert(&account, >::block_number()); + }, + 4_u128 => { + TokenDoge::::insert(&account, >::block_number()); + }, + 5_u128 => { + TokenBNB::::insert(&account, >::block_number()); + }, + _ => { + // Do nothing + }, + } + } + pub fn fetch_block_number(account: &T::AccountId, asset: u128) -> Option { + match asset { + 1_u128 => Some(>::get(account)), + 2_u128 => Some(>::get(account)), + 3_u128 => Some(>::get(account)), + 4_u128 => Some(>::get(account)), + 5_u128 => Some(>::get(account)), + _ => None, + } } /// Provides Ethers Asset Id for Test Ether pub fn asset_id() -> u128 { - // Currently Hardcoding this value created from address - // "0xF59ae934f6fe444afC309586cC60a84a0F89Aaee" 100 } + + pub fn asset_id_test_eth() -> u128 { + 101 + } + + pub fn asset_id_test_bnb() -> u128 { + 102 + } + + pub fn asset_id_test_doge() -> u128 { + 103 + } + + pub fn asset_id_test_dot() -> u128 { + 104 + } } } diff --git a/pallets/thea/Cargo.toml b/pallets/thea/Cargo.toml index 8f3ecd7e0..d7181b80f 100644 --- a/pallets/thea/Cargo.toml +++ b/pallets/thea/Cargo.toml @@ -10,23 +10,23 @@ codec = { version = "3.0.0", package = "parity-scale-codec", default-features = scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { version = "1.0.136", optional = true } -frame-support = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -frame-system = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -frame-benchmarking = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-io = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate.git' } -sp-runtime = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-runtime-interface = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-std = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-core = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-staking = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -sp-keystore = {default-features = false, optional=true,branch = "polkadot-v0.9.19",git = 'https://github.com/paritytech/substrate' } -sp-application-crypto = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} +frame-support = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +frame-system = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +frame-benchmarking = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +sp-io = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate.git' } +sp-runtime = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +sp-runtime-interface = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +sp-std = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +sp-core = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +sp-staking = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +sp-keystore = {default-features = false, optional=true,branch = "polkadot-v0.9.28",git = 'https://github.com/paritytech/substrate' } +sp-application-crypto = {default-features = false, branch="polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate'} thea-primitives = { path = "../../primitives/thea", default-features = false } [dev-dependencies] -sp-staking = { default-features = false, branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } -pallet-session = {branch = "polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate' } +sp-staking = { default-features = false, branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } +pallet-session = {branch = "polkadot-v0.9.28", git = 'https://github.com/paritytech/substrate' } [features] default = ["std"] diff --git a/primitives/src/common_types.rs b/primitives/src/common_types.rs deleted file mode 100644 index e0ccd0353..000000000 --- a/primitives/src/common_types.rs +++ /dev/null @@ -1,24 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2021 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use sp_runtime::{MultiSignature,traits::{ - IdentifyAccount, Verify, -}}; -pub type Signature = MultiSignature; -pub type AccountId = <::Signer as IdentifyAccount>::AccountId; -pub type Balance = u128; diff --git a/primitives/thea/Cargo.toml b/primitives/thea/Cargo.toml deleted file mode 100644 index 84d422387..000000000 --- a/primitives/thea/Cargo.toml +++ /dev/null @@ -1,46 +0,0 @@ -[package] -name = "thea-primitives" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -codec = { version = "3.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -sp-api = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -sp-application-crypto = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -sp-core = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -sp-runtime = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -sp-std = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -sp-inherents = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -frame-system = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -frame-support = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch = 'polkadot-v0.9.19', default-features = false } -libsecp256k1 = { version = "0.6", default-features = false, features = ["static-context"] } -sp-runtime-interface = {default-features = false, branch="polkadot-v0.9.19", git = 'https://github.com/paritytech/substrate'} -thiserror = { version = "1.0.26", optional = true } -serde = { version = "1", default-features = false, features = ["derive", "alloc"] } - -[dev-dependencies] -hex-literal = "0.3" - -[features] -default = ["std"] -std = [ - "libsecp256k1/std", - "sp-runtime-interface/std", - "codec/std", -# "bitcoin/std", - "sp-api/std", - "sp-application-crypto/std", - "sp-core/std", - "sp-runtime/std", - "sp-std/std", - "sp-inherents/std", - "thiserror", - "scale-info/std", - "frame-system/std", - "frame-support/std", - "polkadex-primitives/std" -] \ No newline at end of file diff --git a/primitives/thea/src/constants.rs b/primitives/thea/src/constants.rs deleted file mode 100644 index ad61145d0..000000000 --- a/primitives/thea/src/constants.rs +++ /dev/null @@ -1,62 +0,0 @@ - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Constants for pallet-thea - -use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::traits::Get; -use scale_info::TypeInfo; - -// TODO: Implement the types below using a macro - -#[derive(Clone, Copy, PartialEq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] -pub struct MsgLimit; -impl Get for MsgLimit { - fn get() -> u32 { - 20000 // TODO got from test_encode_decode in thea client, probably wrong. needs fix - } -} - -#[derive(Clone, Copy, PartialEq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] -pub struct MsgVecLimit; -impl Get for MsgVecLimit { - fn get() -> u32 { - 600 // 100 validators * 6 rounds - } -} -#[derive(Clone, Copy, PartialEq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] -pub struct PartialSignatureLimit; -impl Get for PartialSignatureLimit { - fn get() -> u32 { - 600 // 100 validators * 6 rounds - } -} -#[derive(Clone, Copy, PartialEq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] -pub struct PartialSignatureVecLimit; -impl Get for PartialSignatureVecLimit { - fn get() -> u32 { - 600 // 100 validators * 6 rounds - } -} - -#[derive(Clone, Copy, PartialEq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] -pub struct OffenceReportBTreeSetLimit; -impl Get for OffenceReportBTreeSetLimit { - fn get() -> u32 { - 100 - } -} diff --git a/primitives/thea/src/inherents.rs b/primitives/thea/src/inherents.rs deleted file mode 100644 index 9cc366367..000000000 --- a/primitives/thea/src/inherents.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2020-2022 Polkadex OU -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::ValidatorSetId; -use codec::{Decode, Encode}; -use sp_inherents::{InherentIdentifier, IsFatalError}; - -/// Thea Inherents -pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"theapubk"; - -#[derive(Encode, Decode, sp_runtime::RuntimeDebug)] -pub struct TheaPublicKeyInherentDataType { - pub public_key: Option, - pub set_id: ValidatorSetId, -} - -/// Errors that can occur while checking the Thea inherent. -#[derive(Encode, sp_runtime::RuntimeDebug)] -#[cfg_attr(feature = "std", derive(Decode, thiserror::Error))] -pub enum InherentError { - /// This is a fatal-error and will stop block import. - #[cfg_attr(feature = "std", error("The inserted shared public key is invalid."))] - InvalidPublicKey(TheaPublicKeyInherentDataType), - /// This is a fatal-error and will stop block import. - #[cfg_attr(feature = "std", error("Wrong Inherent Call in Block"))] - WrongInherentCall, -} - -impl IsFatalError for InherentError { - fn is_fatal_error(&self) -> bool { - match self { - InherentError::InvalidPublicKey(_) => true, - InherentError::WrongInherentCall => true, - } - } -} - -impl InherentError { - /// Try to create an instance ouf of the given identifier and data. - #[cfg(feature = "std")] - pub fn try_from(id: &InherentIdentifier, data: &[u8]) -> Option { - if id == &INHERENT_IDENTIFIER { - ::decode(&mut &data[..]).ok() - } else { - None - } - } -} diff --git a/primitives/thea/src/keygen.rs b/primitives/thea/src/keygen.rs deleted file mode 100644 index e024c4726..000000000 --- a/primitives/thea/src/keygen.rs +++ /dev/null @@ -1,256 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{AuthorityIndex, ValidatorSetId}; -use codec::{Codec, Decode, Encode, MaxEncodedLen}; -use frame_support::{storage::bounded_btree_set::BoundedBTreeSet, traits::Get, BoundedVec}; -use scale_info::TypeInfo; - -#[derive(Encode, Decode, PartialEq, Debug, TypeInfo, Clone, MaxEncodedLen)] -pub enum SubProtocol { - Keygen, - OfflineStage, -} - -pub trait ProvideSubProtocol { - fn subprotocol() -> SubProtocol; -} - -/// Struct containing MPC messages -#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Debug, MaxEncodedLen)] -pub struct Msg> { - pub receiver: Option, - pub message: BoundedVec, - pub sender: u16, -} - -/// Thea Signing Round -#[derive(Encode, Decode, TypeInfo, Clone, Copy, PartialEq, Debug, MaxEncodedLen)] -pub enum SigningRound { - Round0, -} - -impl Default for SigningRound { - fn default() -> Self { - Self::Round0 - } -} - -/// Different stages of Keygen sub protocol -#[derive(Encode, Decode, TypeInfo, Clone, Copy, PartialEq, Debug, MaxEncodedLen)] -pub enum KeygenRound { - Round0, - // Won't be used in Msg - Round1, - Round2, - Round3, - Round4, - Round5, - // Won't be used in Msg - Unknown, -} - -impl Default for KeygenRound { - fn default() -> Self { - Self::Unknown - } -} - -impl Into for KeygenRound { - fn into(self) -> u8 { - match self { - KeygenRound::Round0 => 0, - KeygenRound::Round1 => 1, - KeygenRound::Round2 => 2, - KeygenRound::Round3 => 3, - KeygenRound::Round4 => 4, - KeygenRound::Round5 => 5, - KeygenRound::Unknown => u8::MAX, - } - } -} - -impl ProvideSubProtocol for KeygenRound { - fn subprotocol() -> SubProtocol { - SubProtocol::Keygen - } -} - -/// Different stages of OfflineStage sub protocol -#[derive(Encode, Decode, TypeInfo, Clone, Copy, PartialEq, Debug, MaxEncodedLen)] -pub enum OfflineStageRound { - Round0, - // Won't be used in Msg - Round1, - Round2, - Round3, - Round4, - Round5, - Round6, - Round7, - // Won't be used in Msg - Unknown, -} - -impl Into for OfflineStageRound { - fn into(self) -> u8 { - match self { - OfflineStageRound::Round0 => 0, - OfflineStageRound::Round1 => 1, - OfflineStageRound::Round2 => 2, - OfflineStageRound::Round3 => 3, - OfflineStageRound::Round4 => 4, - OfflineStageRound::Round5 => 5, - OfflineStageRound::Round6 => 6, - OfflineStageRound::Round7 => 7, - OfflineStageRound::Unknown => u8::MAX, - } - } -} - -impl From for OfflineStageRound { - fn from(data: u8) -> Self { - match data { - 0 => Self::Round0, - 1 => Self::Round1, - 2 => Self::Round2, - 3 => Self::Round3, - 4 => Self::Round4, - 5 => Self::Round5, - 6 => Self::Round6, - 7 => Self::Round7, - _ => Self::Unknown, - } - } -} - -impl Default for OfflineStageRound { - fn default() -> Self { - Self::Unknown - } -} - -/// Keygen Payload for unsigned transaction with signed payload -#[derive(Encode, Decode, Clone, PartialEq, Debug, TypeInfo, MaxEncodedLen)] -pub struct TheaPayload< - AuthorityId, - SubProtocolRound: Codec + Default, - MsgLimit: Get + Clone, - MsgVecLimit: Get + Clone, -> { - pub messages: BoundedVec, MsgVecLimit>, - pub signer: Option, - pub set_id: ValidatorSetId, - pub auth_idx: AuthorityIndex, - pub round: SubProtocolRound, -} - -impl< - AuthorityId, - SubProtocolRound: Codec + Default, - MsgLimit: Get + Clone, - MsgVecLimit: Get + Clone, - > Default for TheaPayload -{ - fn default() -> Self { - Self { - messages: BoundedVec::default(), - signer: None, - set_id: 0, - auth_idx: 0, - round: SubProtocolRound::default(), - } - } -} - -pub type PartialSignature = BoundedVec; - -#[derive(Encode, Decode, Clone, PartialEq, Debug, TypeInfo, MaxEncodedLen)] -pub struct SigningSessionPayload< - AuthorityId, - PartialSignatureLimit: Get + Clone, - PartialSignatureVecLimit: Get + Clone, -> { - /// Here each element is serialized partial signature - /// - /// Also, lenght of list should be equal to unsignedPayloads in that block - pub partial_signatures: - BoundedVec, PartialSignatureVecLimit>, - pub signer: Option, - pub set_id: ValidatorSetId, - pub auth_idx: AuthorityIndex, -} -impl< - AuthorityId, - PartialSignatureLimit: Get + Clone, - PartialSignatureVecLimit: Get + Clone, - > Default for SigningSessionPayload -{ - fn default() -> Self { - Self { partial_signatures: BoundedVec::default(), signer: None, set_id: 0, auth_idx: 0 } - } -} - -impl From for KeygenRound { - fn from(round: u16) -> Self { - match round { - 0 => KeygenRound::Round0, - 1 => KeygenRound::Round1, - 2 => KeygenRound::Round2, - 3 => KeygenRound::Round3, - 4 => KeygenRound::Round4, - 5 => KeygenRound::Round5, - _ => KeygenRound::Unknown, - } - } -} - -impl From for OfflineStageRound { - fn from(round: u16) -> Self { - match round { - 0 => OfflineStageRound::Round0, - 1 => OfflineStageRound::Round1, - 2 => OfflineStageRound::Round2, - 3 => OfflineStageRound::Round3, - 4 => OfflineStageRound::Round4, - 5 => OfflineStageRound::Round5, - 6 => OfflineStageRound::Round6, - 7 => OfflineStageRound::Round7, - _ => OfflineStageRound::Unknown, - } - } -} - -impl ProvideSubProtocol for OfflineStageRound { - fn subprotocol() -> SubProtocol { - SubProtocol::OfflineStage - } -} - -/// An offense report to be submitted by validators -#[derive(Decode, Encode, Debug, PartialEq, Clone, TypeInfo, MaxEncodedLen)] -pub struct OffenseReport { - /// The offender - pub offender: AuthorityId, - /// The block at which the message had to be sent - pub offense_blk: u32, - /// The round at which the message had to be sent - pub protocol: SubProtocol, - /// The validator that authored this report - pub author: AuthorityId -} diff --git a/primitives/thea/src/lib.rs b/primitives/thea/src/lib.rs deleted file mode 100644 index ae4cbbdc2..000000000 --- a/primitives/thea/src/lib.rs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (C) 2020-2022 Polkadex OU -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// This is pallet is modified beefy-primitives from Parity Technologies (UK) Ltd. -#![cfg_attr(not(feature = "std"), no_std)] -// NOTE: needed to silence warnings about generated code in `decl_runtime_apis` -#![allow(clippy::too_many_arguments, clippy::unnecessary_mut_passed, clippy::redundant_slicing)] - -pub mod constants; -pub mod inherents; -pub mod keygen; -pub mod payload; -pub mod runtime; -pub mod traits; - -pub use constants::*; - -use crate::{ - keygen::{KeygenRound, OfflineStageRound, SigningSessionPayload, TheaPayload}, - payload::*, -}; -use codec::{Codec, Decode, Encode}; -use polkadex_primitives::BlockNumber; -use scale_info::TypeInfo; -use sp_core::ecdsa::Public; -use sp_runtime::{ - traits::{IdentifyAccount, Verify}, - MultiSignature, -}; -use sp_std::prelude::*; - -/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. -pub type Signature = MultiSignature; - -/// Some way of identifying an account on the chain. We intentionally make it equivalent -/// to the public key of our transaction signing scheme. -pub type AccountId = <::Signer as IdentifyAccount>::AccountId; - -/// Key type for THEA module. -pub const KEY_TYPE: sp_application_crypto::KeyTypeId = sp_application_crypto::KeyTypeId(*b"thea"); - -/// Authority set id starts with zero at genesis -pub const GENESIS_AUTHORITY_SET_ID: u64 = 0; - -/// A typedef for validator set id. -pub type ValidatorSetId = u64; - -#[derive(Decode, Encode, Debug, PartialEq, Copy, Clone, TypeInfo)] -pub enum KeyGenStage { - /// Keygen is yet to start - NotStarted, - /// Keygen Failed - Failed, - /// Keygen completed successfully - Completed, -} - -impl Default for KeyGenStage { - fn default() -> Self { - KeyGenStage::NotStarted - } -} - -/// A set of THEA authorities, a.k.a. validators. -#[derive(Decode, Encode, Debug, PartialEq, Clone, TypeInfo)] -pub struct ValidatorSet { - /// Public keys of the validator set elements - pub validators: Vec, - /// Identifier of the validator set - pub id: ValidatorSetId, - /// Thea ECDSA Public key - pub public_key: Option, -} - -impl ValidatorSet { - pub fn new(validators: Vec, id: ValidatorSetId) -> Self { - ValidatorSet { validators, id, public_key: None } - } -} - -impl ValidatorSet { - /// Return an empty validator set with id of 0. - pub fn empty() -> Self { - Self { validators: Default::default(), id: Default::default(), public_key: None } - } -} - -/// THEA application-specific crypto types using sr25519. -pub mod crypto { - use sp_application_crypto::{app_crypto, sr25519}; - - app_crypto!(sr25519, crate::KEY_TYPE); -} - -sp_application_crypto::with_pair! { - /// A THEA authority keypair using sr25519 as its crypto. - pub type AuthorityPair = crypto::Pair; -} - -/// Identity of a THEA authority using sr25519 as its crypto. -pub type AuthorityId = crypto::Public; - -/// Signature for a THEA authority using sr25519 as its crypto. -pub type AuthoritySignature = crypto::Signature; - -/// The index of an authority. -pub type AuthorityIndex = u16; - -/// Index of a Thea party -pub type PartyIndex = u16; - -/// The `ConsensusEngineId` of THEA. -pub const THEA_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"THEA"; - -/// A consensus log item for THEA. -#[derive(Decode, Encode, TypeInfo)] -pub enum ConsensusLog { - /// The authorities have changed. - #[codec(index = 1)] - AuthoritiesChange(ValidatorSet), - /// Disable the authority with given index. - #[codec(index = 2)] - OnDisabled(AuthorityIndex), -} - -sp_api::decl_runtime_apis! { - /// API necessary for THEA voters. - pub trait TheaApi { - /// Return the current active THEA validator set - fn validator_set() -> ValidatorSet; - /// Return the next active THEA validator set - fn next_validator_set() -> ValidatorSet; - /// Submit keygen message to on-chain - fn submit_keygen_message(payload: TheaPayload, signature: AuthoritySignature, rng: u64) -> Result<(),SigningError>; - /// Submit offline message to on-chain - fn submit_offline_message(payload: TheaPayload, signature: AuthoritySignature, rng: u64, payload_array: &[u8; 32]) -> Result<(),SigningError>; - /// Submit signing message to on-chain - fn submit_signing_message(at: BlockNumber,payload: SigningSessionPayload, signature: AuthoritySignature, rng: u64) -> Result<(),SigningError>; - /// Submit signed payload to on-chain - fn submit_signed_payload(payload: SignedTheaPayload, rng: u64) -> Result<(),SigningError>; - /// Get's other party keygen broadcast messages - fn keygen_messages_api(party_idx: PartyIndex, round: KeygenRound) -> TheaPayload; - /// Get's other party offline broadcast messages - fn offline_messages_api(party_idx: PartyIndex, round: OfflineStageRound, payload: &[u8; 32]) -> TheaPayload; - /// Get's other party signing broadcast messages - fn signing_messages_api(at: BlockNumber) -> Vec>; - /// Returns unsigned payload - fn unsigned_payloads_api(at: BlockNumber) -> Vec; - /// Returns signed payload for given network - fn signed_payloads_api(at: BlockNumber) -> Vec; - /// Return True if Validator Set Changes - fn is_validator_set_changed() -> bool; - /// Cleans Keygen and Offline messages On-Chain - fn clean_keygen_messages(auth_idx: AuthorityIndex, signature: AuthoritySignature, rng: u64) -> Result<(),SigningError>; - fn register_offence(signature: AuthoritySignature, offence: crate::keygen::OffenseReport) -> Result<(),SigningError>; - - } -} -// Add fn Proto here - -/// Possible Errors in On-chain signing -#[derive(Decode, Encode, TypeInfo, PartialEq, Debug)] -pub enum SigningError { - OffchainUnsignedTxError, -} - -impl core::fmt::Display for SigningError { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(f, "OffchainUnsignedTxError") - } -} - -//sp_api::decl_runtime_apis! { -// pub trait TheaApi { -// fn current_round_info(&self) -> FutureResult<()>; -// fn offline_stage_info(&self) -> FutureResult<()>; -// } -//} diff --git a/primitives/thea/src/payload.rs b/primitives/thea/src/payload.rs deleted file mode 100644 index 8c439c162..000000000 --- a/primitives/thea/src/payload.rs +++ /dev/null @@ -1,81 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use codec::{Decode, Encode, MaxEncodedLen}; -use scale_info::TypeInfo; -use serde::{Deserialize, Serialize}; -use sp_core::ecdsa::Signature; - -#[derive( - Encode, - Decode, - Copy, - Clone, - Eq, - PartialEq, - Debug, - TypeInfo, - Serialize, - Deserialize, - MaxEncodedLen, -)] -pub enum Network { - /// ETHEREUM Mainnet - ETHEREUM, - /// Not Supported - NONE, -} - -impl Default for Network { - fn default() -> Self { - Self::NONE - } -} - -/// Contains all the details for signing -/// -/// Thea assumes that payload doesn't need to be processed again -#[derive( - Encode, - Decode, - Debug, - Clone, - PartialEq, - TypeInfo, - Serialize, - Deserialize, - Default, - MaxEncodedLen, -)] -pub struct UnsignedTheaPayload { - /// Network Type - pub network: Network, - /// Payload for signing - pub payload: [u8; 32], - /// Payload submitted on block - pub submission_blk: u32, -} - -/// Contains both payload and valid signature -#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, Default, MaxEncodedLen)] -pub struct SignedTheaPayload { - /// Unsigned Payload - pub payload: UnsignedTheaPayload, - /// Valid Signature - pub signature: Signature, -} diff --git a/primitives/thea/src/runtime.rs b/primitives/thea/src/runtime.rs deleted file mode 100644 index 21f3d8b4d..000000000 --- a/primitives/thea/src/runtime.rs +++ /dev/null @@ -1,57 +0,0 @@ -// This file is part of Polkadex. - -// Copyright (C) 2020-2022 Polkadex oü. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use sp_runtime_interface::runtime_interface; - -/// Verifies the signature with given public key and message. -/// -/// Note message is not hashed for verify_ecdsa and is prehashed for verify_ecdsa_prehashed -#[runtime_interface] -pub trait Crypto { - fn verify_ecdsa( - signature: &sp_core::ecdsa::Signature, - public_key: &sp_core::ecdsa::Public, - message: &[u8; 32], - ) -> bool { - if let Some(pubk) = signature.recover(message) { - &pubk == public_key - } else { - false - } - // let message = libsecp256k1::Message::parse(message); - // let sig: (libsecp256k1::Signature, libsecp256k1::RecoveryId) = match signature.try_into() - // { Ok(x) => x, - // _ => return false, - // }; - // match libsecp256k1::recover(&message, &sig.0, &sig.1) { - // Ok(actual) => public_key.0[..] == actual.serialize_compressed()[..], - // _ => false, - // } - } - fn verify_ecdsa_prehashed( - signature: &sp_core::ecdsa::Signature, - public_key: &sp_core::ecdsa::Public, - message: &[u8; 32], - ) -> bool { - if let Some(pubk) = signature.recover_prehashed(message) { - &pubk == public_key - } else { - false - } - } -} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 3ad2a7608..3be0a4684 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -17,170 +17,172 @@ hex-literal = { version = "0.3.3", optional = true } static_assertions = "1.1.0" log = { version = "0.4.14", default-features = false } smallvec = "1.6.1" -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-babe = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-grandpa = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-im-online = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-offences = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-staking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-staking-reward-curve = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-bounties = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-bags-list = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-indices = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-recovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-election-provider-multi-phase = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-authority-discovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-child-bounties = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } +#pallets +#added +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-babe = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-grandpa = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-im-online = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-offences = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-staking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-staking-reward-curve = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-bounties = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-bags-list = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-indices = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-recovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-election-provider-multi-phase = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-authority-discovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-child-bounties = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } #frame -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } #sp -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } #added -sp-authority-discovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-consensus-babe = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-staking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -sp-npos-elections = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -frame-election-provider-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-randomness-collective-flip = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } -pallet-assets = { default-features = false, branch = "polkadot-v0.9.19", git = "https://github.com/paritytech/substrate" } -pallet-conviction-voting= { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", optional = true } -pallet-referenda = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", optional = true } +sp-authority-discovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-consensus-babe = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-staking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +sp-npos-elections = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +frame-election-provider-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-randomness-collective-flip = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } +pallet-assets = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/paritytech/substrate" } #end added -# Used for the node template"s RPCs -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } +# Used for the node template's RPCs +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } # Used for runtime benchmarking -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", optional = true } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", optional = true } -pallet-society = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", optional = true } - - +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", optional = true } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", optional = true } +pallet-society = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", optional = true } # ORML Pallets -orml-vesting = { git = "https://github.com/Polkadex-Substrate/open-runtime-module-library.git", branch="polkadot-v0.9.19", default-features = false } +orml-vesting = { git = "https://github.com/Polkadex-Substrate/open-runtime-module-library.git", branch="polkadot-v0.9.28", default-features = false } # Local Dependecies -polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch = "polkadot-v0.9.19", default-features = false } +#polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch = 'polkadot-v0.9.28', default-features = false } +polkadex-primitives = { default-features = false, branch = "polkadot-v0.9.28", git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git" } pdex-migration = { path = "../pallets/pdex-migration", default-features = false } -chainbridge = { path = "../pallets/chainbridge", default-features = false } -asset-handler = { path = "../pallets/asset-handler", default-features = false } polkadex-ido = { path = "../pallets/polkadex-ido", default-features = false } test-token-provider = { path = "../pallets/test-token-provider", default-features = false } -pallet-ocex-lmp = {path = "../pallets/ocex", default-features = false} +asset-handler = { path = "../pallets/asset-handler", default-features = false} +chainbridge = { path ="../pallets/chainbridge", default-features = false} +# Orderbook +pallet-ocex-lmp = {path = "../pallets/ocex", default-features = false} # Try Runtime -frame-try-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.19", optional = true, default-features = false } +frame-try-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28", optional = true, default-features = false } polkadex-ido-runtime-api = {path = "../pallets/polkadex-ido/rpc/runtime-api", default-features = false} -pallet-polkadex-ido-primitives = {path = "../pallets/polkadex-ido/common", default-features = false} # Used for runtime benchmarking +pallet-ocex-runtime-api = {path = "../pallets/ocex/rpc/runtime-api", default-features = false} +pallet-polkadex-ido-primitives = {path = "../pallets/polkadex-ido/common", default-features = false} +pallet-ocex-primitives = {path = "../pallets/ocex/common", default-features = false} # Used for runtime benchmarking [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false } -pallet-society = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19"} +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28", default-features = false } +pallet-society = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28"} [features] default = ["std"] std = [ - "codec/std", - "log/std", - "frame-executive/std", - "frame-support/std", - "frame-system/std", - "frame-system-rpc-runtime-api/std", - "pallet-authorship/std", - "pallet-babe/std", - "pallet-balances/std", - "pallet-grandpa/std", - "pallet-im-online/std", - "pallet-offences/std", - "pallet-session/std", - "pallet-staking/std", - "pallet-preimage/std", - "pallet-bags-list/std", - "pallet-authority-discovery/std", - "pallet-multisig/std", - "pallet-sudo/std", - "pallet-indices/std", - "pallet-child-bounties/std", - "pallet-identity/std", - "pallet-proxy/std", - "pallet-recovery/std", - "pallet-democracy/std", - "pallet-utility/std", + 'codec/std', + 'log/std', + 'frame-executive/std', + 'frame-support/std', + 'frame-system/std', + 'frame-system-rpc-runtime-api/std', + 'pallet-authorship/std', + 'pallet-babe/std', + 'pallet-balances/std', + 'pallet-grandpa/std', + 'pallet-im-online/std', + 'pallet-offences/std', + 'pallet-session/std', + 'pallet-staking/std', + 'pallet-preimage/std', + 'pallet-bags-list/std', + 'pallet-authority-discovery/std', + 'pallet-multisig/std', + 'pallet-sudo/std', + 'pallet-indices/std', + 'pallet-child-bounties/std', + 'pallet-identity/std', + 'pallet-proxy/std', + 'pallet-recovery/std', + 'pallet-democracy/std', + 'pallet-utility/std', "pallet-bounties/std", - "pallet-tips/std", - "pallet-timestamp/std", - "pallet-transaction-payment/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-treasury/std", - "pallet-collective/std", - "pallet-elections-phragmen/std", - "frame-election-provider-support/std", - "pallet-membership/std", - "pallet-scheduler/std", + 'pallet-tips/std', + 'pallet-timestamp/std', + 'pallet-transaction-payment/std', + 'pallet-transaction-payment-rpc-runtime-api/std', + 'pallet-treasury/std', + 'pallet-collective/std', + 'pallet-elections-phragmen/std', + 'frame-election-provider-support/std', + 'pallet-membership/std', + 'pallet-scheduler/std', "pallet-election-provider-multi-phase/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-babe/std", - "sp-core/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-staking/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", + 'sp-api/std', + 'sp-block-builder/std', + 'sp-consensus-babe/std', + 'sp-core/std', + 'sp-inherents/std', + 'sp-offchain/std', + 'sp-runtime/std', + 'sp-session/std', + 'sp-staking/std', + 'sp-std/std', + 'sp-transaction-pool/std', + 'sp-version/std', "sp-npos-elections/std", - "pallet-assets/std", + 'pallet-assets/std', + "orml-vesting/std", "polkadex-primitives/std", "pdex-migration/std", - "polkadex-ido/std", + 'polkadex-ido/std', "frame-try-runtime/std", - "chainbridge/std", + "pallet-ocex-lmp/std", "asset-handler/std", - "test-token-provider/std", - "pallet-ocex-lmp/std" + "chainbridge/std" ] runtime-benchmarks = [ "frame-benchmarking", @@ -205,7 +207,7 @@ runtime-benchmarks = [ "pallet-multisig/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", - "pallet-society/runtime-benchmarks", + 'pallet-society/runtime-benchmarks', "pallet-staking/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-tips/runtime-benchmarks", @@ -216,10 +218,7 @@ runtime-benchmarks = [ "orml-vesting/runtime-benchmarks", "hex-literal", "frame-election-provider-support/runtime-benchmarks", -# "pdex-migration/runtime-benchmarks", - "asset-handler/runtime-benchmarks", - "pallet-conviction-voting/runtime-benchmarks", - "pallet-referenda/runtime-benchmarks" + #"pdex-migration/runtime-benchmarks" ] @@ -245,7 +244,7 @@ try-runtime = [ "pallet-multisig/try-runtime", "pallet-proxy/try-runtime", "pallet-scheduler/try-runtime", - "pallet-society/try-runtime", + 'pallet-society/try-runtime', "pallet-staking/try-runtime", "pallet-timestamp/try-runtime", "pallet-tips/try-runtime", @@ -255,4 +254,4 @@ try-runtime = [ "orml-vesting/try-runtime", "pdex-migration/try-runtime", "test-token-provider/try-runtime" -] +] \ No newline at end of file diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d9f1cf342..1157470d7 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -22,7 +22,7 @@ #![recursion_limit = "256"] use codec::{Decode, Encode, MaxEncodedLen}; -use frame_election_provider_support::{onchain, SequentialPhragmen}; +use frame_election_provider_support::{ElectionDataProvider, onchain, SequentialPhragmen}; use frame_support::{ construct_runtime, parameter_types, traits::{ @@ -38,11 +38,12 @@ use frame_support::{ use frame_support::{ pallet_prelude::ConstU32, traits::{ - ConstU16, EnsureOneOf, EqualPrivilegeOnly, Everything, Get, InstanceFilter, OnUnbalanced, + ConstU16, EitherOfDiverse, EqualPrivilegeOnly, Everything, Get, InstanceFilter, OnUnbalanced }, weights::{ConstantMultiplier, WeightToFeeCoefficient}, PalletId, }; + #[cfg(any(feature = "std", test))] pub use frame_system::Call as SystemCall; use frame_system::{ @@ -88,6 +89,7 @@ use sp_version::RuntimeVersion; use static_assertions::const_assert; use pallet_polkadex_ido_primitives::{FundingRoundWithPrimitives, VoteStat}; +use pallet_ocex_primitives::WithdrawalWithPrimitives; use constants::{currency::*, time::*}; use frame_support::weights::{WeightToFeeCoefficients, WeightToFeePolynomial}; @@ -298,7 +300,7 @@ impl InstanceFilter for ProxyType { c, Call::Council(..) | Call::TechnicalCommittee(..) | - Call::Elections(..) | Call::Treasury(..) + Call::Elections(..) | Call::Treasury(..) | Call::OrderbookCommittee(..) ), ProxyType::Staking => matches!(c, Call::Staking(..)), } @@ -457,12 +459,13 @@ impl WeightToFeePolynomial for WeightToFee { } impl pallet_transaction_payment::Config for Runtime { + type Event = Event; type OnChargeTransaction = CurrencyAdapter; type OperationalFeeMultiplier = OperationalFeeMultiplier; type WeightToFee = WeightToFee; + type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = TargetedFeeAdjustment; - type LengthToFee = ConstantMultiplier; } parameter_types! { @@ -543,26 +546,29 @@ impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig { } pub struct OnChainSeqPhragmen; -impl onchain::ExecutionConfig for OnChainSeqPhragmen { +impl onchain::Config for OnChainSeqPhragmen { type System = Runtime; type Solver = SequentialPhragmen< AccountId, pallet_election_provider_multi_phase::SolutionAccuracyOf, >; type DataProvider = ::DataProvider; + type WeightInfo = frame_election_provider_support::weights::SubstrateWeight; } -impl onchain::BoundedExecutionConfig for OnChainSeqPhragmen { - type VotersBound = ConstU32<20_000>; +impl onchain::BoundedConfig for OnChainSeqPhragmen { + type VotersBound = MaxElectingVoters; type TargetsBound = ConstU32<2_000>; } impl pallet_staking::Config for Runtime { type Currency = Balances; + type CurrencyBalance = Balance; type UnixTime = Timestamp; type CurrencyToVote = U128CurrencyToVote; type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = onchain::UnboundedExecution; + type MaxNominations = MaxNominations; type RewardRemainder = Treasury; type Event = Event; type Slash = Treasury; @@ -571,7 +577,7 @@ impl pallet_staking::Config for Runtime { type BondingDuration = BondingDuration; type SlashDeferDuration = SlashDeferDuration; /// A super-majority of the council can cancel the slash. - type SlashCancelOrigin = EnsureOneOf< + type SlashCancelOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; @@ -579,12 +585,12 @@ impl pallet_staking::Config for Runtime { type EraPayout = pallet_staking::ConvertCurve; type NextNewSession = Session; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; - type WeightInfo = pallet_staking::weights::SubstrateWeight; - type MaxNominations = MaxNominations; type OffendingValidatorsThreshold = OffendingValidatorsThreshold; - type BenchmarkingConfig = StakingBenchmarkingConfig; type VoterList = pallet_staking::UseNominatorsAndValidatorsMap; type MaxUnlockingChunks = ConstU32<32>; + type OnStakerSlash = (); + type BenchmarkingConfig = StakingBenchmarkingConfig; + type WeightInfo = pallet_staking::weights::SubstrateWeight; } parameter_types! { @@ -600,7 +606,8 @@ parameter_types! { pub const SignedDepositByte: Balance = deposit(0, 10) / 1024; // Each good submission will get 1 DOT as reward pub SignedRewardBase: Balance = UNITS; - pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(5u32, 10_000); + // pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(5u32, 10_000); + pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); pub const MultiPhaseUnsignedPriority: TransactionPriority = StakingUnsignedPriority::get() - 1u64; @@ -673,42 +680,65 @@ impl Get> for OffchainRandomBalancing { Some((iters, 0)) } } + +impl pallet_election_provider_multi_phase::MinerConfig for Runtime { + type AccountId = AccountId; + type Solution = NposSolution16; + type MaxVotesPerVoter = + <::DataProvider as ElectionDataProvider>::MaxVotesPerVoter; + type MaxLength = MinerMaxLength; + type MaxWeight = MinerMaxWeight; + + // The unsigned submissions have to respect the weight of the submit_unsigned call, thus their + // weight estimate function is wired to this call's weight. + fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight { + < + ::WeightInfo + as + pallet_election_provider_multi_phase::WeightInfo + >::submit_unsigned(v, t, a, d) + } +} impl pallet_election_provider_multi_phase::Config for Runtime { type Event = Event; type Currency = Balances; type EstimateCallFee = TransactionPayment; - type SignedPhase = SignedPhase; type UnsignedPhase = UnsignedPhase; + type SignedPhase = SignedPhase; + type BetterSignedThreshold = (); + type BetterUnsignedThreshold = BetterUnsignedThreshold; + // nothing to do upon rewards + // type SolutionImprovementThreshold = SolutionImprovementThreshold; + // type MinerMaxWeight = MinerMaxWeight; + // type MinerMaxLength = MinerMaxLength; + type OffchainRepeat = OffchainRepeat; + type MinerTxPriority = MultiPhaseUnsignedPriority; + type MinerConfig = Self; type SignedMaxSubmissions = SignedMaxSubmissions; + type SignedMaxWeight = MinerMaxWeight; + type SignedMaxRefunds = ConstU32<3>; type SignedRewardBase = SignedRewardBase; type SignedDepositBase = SignedDepositBase; type SignedDepositByte = SignedDepositByte; type SignedDepositWeight = (); - type SignedMaxWeight = Self::MinerMaxWeight; - type SlashHandler = (); // burn slashes - type RewardHandler = (); // nothing to do upon rewards - type SolutionImprovementThreshold = SolutionImprovementThreshold; - type MinerMaxWeight = MinerMaxWeight; - type MinerMaxLength = MinerMaxLength; - type OffchainRepeat = OffchainRepeat; - type MinerTxPriority = MultiPhaseUnsignedPriority; + type MaxElectingVoters = MaxElectingVoters; + type MaxElectableTargets = ConstU16<{ u16::MAX }>; + type SlashHandler = (); + // burn slashes + type RewardHandler = (); type DataProvider = Staking; type Fallback = onchain::BoundedExecution; - type BenchmarkingConfig = ElectionProviderBenchmarkConfig; - type ForceOrigin = EnsureOneOf< + // type Solution = NposSolution16 + type GovernanceFallback = onchain::BoundedExecution; + type Solver = SequentialPhragmen< + AccountId, + pallet_election_provider_multi_phase::SolutionAccuracyOf>; + type ForceOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; + type BenchmarkingConfig = ElectionProviderBenchmarkConfig; type WeightInfo = pallet_election_provider_multi_phase::weights::SubstrateWeight; - type Solution = NposSolution16; - type GovernanceFallback = onchain::BoundedExecution; - type Solver = frame_election_provider_support::SequentialPhragmen< - AccountId, - pallet_election_provider_multi_phase::SolutionAccuracyOf, - OffchainRandomBalancing, - >; - type MaxElectingVoters = MaxElectingVoters; - type MaxElectableTargets = ConstU16<{ u16::MAX }>; } parameter_types! { @@ -739,6 +769,8 @@ parameter_types! { pub const DesiredMembers: u32 = 5; pub const DesiredRunnersUp: u32 = 5; pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect"; + pub const MaxCandidates: u32 = 1000; + pub const MaxVoters: u32 = 10*1000; } // Make sure that there are no more than `MaxMembers` members elected via elections-phragmen. @@ -761,6 +793,8 @@ impl pallet_elections_phragmen::Config for Runtime { type DesiredMembers = DesiredMembers; type DesiredRunnersUp = DesiredRunnersUp; type TermDuration = TermDuration; + type MaxCandidates = MaxCandidates; + type MaxVoters = MaxVoters; type WeightInfo = pallet_elections_phragmen::weights::SubstrateWeight; } @@ -782,11 +816,34 @@ impl pallet_collective::Config for Runtime { type WeightInfo = pallet_collective::weights::SubstrateWeight; } -type EnsureRootOrHalfCouncil = EnsureOneOf< +parameter_types! { + pub const OrderbookMotionDuration: BlockNumber = 1 * DAYS; + pub const OrderbookMaxProposals: u32 = 100; + pub const OrderbookMaxMembers: u32 = 3; +} + +type OrderbookCollective = pallet_collective::Instance3; +impl pallet_collective::Config for Runtime { + type Origin = Origin; + type Proposal = Call; + type Event = Event; + type MotionDuration = OrderbookMotionDuration; + type MaxProposals = OrderbookMaxProposals; + type MaxMembers = OrderbookMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = pallet_collective::weights::SubstrateWeight; +} + +type EnsureRootOrHalfCouncil = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionMoreThan, >; +type EnsureRootOrHalfOrderbookCouncil = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; + impl pallet_membership::Config for Runtime { type Event = Event; type AddOrigin = EnsureRootOrHalfCouncil; @@ -849,7 +906,7 @@ impl pallet_child_bounties::Config for Runtime { impl pallet_treasury::Config for Runtime { type PalletId = TreasuryPalletId; type Currency = Balances; - type ApproveOrigin = EnsureOneOf< + type ApproveOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; @@ -865,6 +922,7 @@ impl pallet_treasury::Config for Runtime { type WeightInfo = pallet_treasury::weights::SubstrateWeight; type MaxApprovals = MaxApprovals; type ProposalBondMaximum = (); + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; } parameter_types! { @@ -900,42 +958,42 @@ impl pallet_democracy::Config for Runtime { type VoteLockingPeriod = VoteLockingPeriod; type MinimumDeposit = MinimumDeposit; /// A straight majority of the council can decide what their next motion is. - type ExternalOrigin = EnsureOneOf< + type ExternalOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; /// A majority can have the next scheduled referendum be a straight majority-carries vote. - type ExternalMajorityOrigin = EnsureOneOf< + type ExternalMajorityOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; /// A unanimous council can have the next scheduled referendum be a straight default-carries /// (NTB) vote. - type ExternalDefaultOrigin = EnsureOneOf< + type ExternalDefaultOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote /// be tabled immediately and with a shorter voting/enactment period. - type FastTrackOrigin = EnsureOneOf< + type FastTrackOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; - type InstantOrigin = EnsureOneOf< + type InstantOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; type InstantAllowed = InstantAllowed; type FastTrackVotingPeriod = FastTrackVotingPeriod; // To cancel a proposal which has been passed, 2/3 of the council must agree to it. - type CancellationOrigin = EnsureOneOf< + type CancellationOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; type BlacklistOrigin = EnsureRoot; // To cancel a proposal before it has been passed, the technical committee must be unanimous or // Root must agree. - type CancelProposalOrigin = EnsureOneOf< + type CancelProposalOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; @@ -1128,6 +1186,7 @@ parameter_types! { impl pallet_recovery::Config for Runtime { type Event = Event; + type WeightInfo = pallet_recovery::weights::SubstrateWeight; type Call = Call; type Currency = Balances; type ConfigDepositBase = ConfigDepositBase; @@ -1169,9 +1228,9 @@ impl EnsureOrigin for EnsureRootOrTreasury { fn try_origin(o: Origin) -> Result { Into::, Origin>>::into(o).and_then(|o| match o { - RawOrigin::Root => Ok(TreasuryPalletId::get().into_account()), + RawOrigin::Root => Ok(TreasuryPalletId::get().into_account_truncating()), RawOrigin::Signed(caller) => - if caller == TreasuryPalletId::get().into_account() { + if caller == TreasuryPalletId::get().into_account_truncating() { Ok(caller) } else { Err(Origin::from(Some(caller))) @@ -1209,7 +1268,7 @@ impl pdex_migration::pallet::Config for Runtime { parameter_types! { pub const PolkadexTreasuryModuleId: PalletId = PalletId(*b"polka/tr"); - pub TreasuryModuleAccount: AccountId = PolkadexTreasuryModuleId::get().into_account(); + pub TreasuryModuleAccount: AccountId = PolkadexTreasuryModuleId::get().into_account_truncating(); } impl pallet_randomness_collective_flip::Config for Runtime {} @@ -1255,6 +1314,7 @@ impl pallet_ocex_lmp::Config for Runtime { // TODO: Change origin to SGX attested origin type EnclaveOrigin = EnsureSigned; type Public = ::Signer; + type GovernanceOrigin = EnsureRootOrHalfOrderbookCouncil; type Signature = Signature; type WeightInfo = (); type MsPerDay = MsPerDay; @@ -1296,7 +1356,7 @@ construct_runtime!( Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent} = 4, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 5, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 6, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 7, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 7, ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event, ValidateUnsigned} = 8, Staking: pallet_staking::{Pallet, Call, Config, Storage, Event} = 9, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 10, @@ -1326,9 +1386,10 @@ construct_runtime!( Assets: pallet_assets::{Pallet, Call, Storage, Event} = 34, PolkadexIdo: polkadex_ido::{Pallet, Call, Event, Storage} = 35, OCEX: pallet_ocex_lmp::{Pallet, Call, Storage, Event} = 36, - Token: test_token_provider::{Pallet, Call, Event, ValidateUnsigned} = 37, - ChainBridge: chainbridge::{Pallet, Storage, Call, Event} = 38, - AssetHandler: asset_handler::pallet::{Pallet, Call, Storage, Event} = 39 + Token: test_token_provider::{Pallet, Call, Event, ValidateUnsigned} = 37, + OrderbookCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event} = 38, + ChainBridge: chainbridge::{Pallet, Storage, Call, Event} = 39, + AssetHandler: asset_handler::pallet::{Pallet, Call, Storage, Event} = 40 } ); /// Digest item type. @@ -1430,7 +1491,14 @@ impl_runtime_apis! { fn account_balances(assets : Vec, account_id : AccountId) -> Vec { PolkadexIdo::account_balances(assets, account_id) } - } + } + + impl pallet_ocex_runtime_api::PolkadexOcexRuntimeApi for Runtime{ + fn return_withdrawals(snapshot_ids: Vec,account: AccountId) -> Vec>{ + OCEX::return_withdrawals(snapshot_ids, account) + } + } + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( @@ -1623,7 +1691,7 @@ impl_runtime_apis! { list_benchmark!(list,extra, pallet_election_provider_multi_phase, ElectionProviderMultiPhase); //TODO: [#463] Currently broken, will be fixed in different issue // list_benchmark!(list,extra, pdex_migration, PDEXMigration); - list_benchmark!(list,extra, asset_handler, AssetHandler); + // list_benchmark!(list,extra, asset_handler, AssetHandler); let storage_info = AllPalletsWithSystem::storage_info(); return (list, storage_info) @@ -1685,7 +1753,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_utility, Utility); //TODO: [#463] Currently broken, will be fixed in different issue // add_benchmark!(params, batches, pdex_migration, PDEXMigration); - add_benchmark!(params, batches, asset_handler, AssetHandler); + // add_benchmark!(params, batches, asset_handler, AssetHandler); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) }