From 9aa1f2a97d930f9afe7e26140e43424abddeb25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Mon, 19 Oct 2020 12:54:17 +0100 Subject: [PATCH 001/109] Initial project setup and skeleton (#4) * initial project setup for beefy gadget client * update editorconfig * update gitignore * add initial skeleton for beefy gadget worker * add skeleton for gossip processing * add app crypto * move around some code * add basic flow for voting * add logic for picking blocks to sign * add rustfmt config * add example node with beefy gadget * use u32::next_power_of_two * make maximum periodicity configurable * add copyright header * rename max_periodicity to min_interval --- client/beefy/Cargo.lock | 4321 +++++++++++++++++++++++++++++++++++++++ client/beefy/Cargo.toml | 22 + client/beefy/src/lib.rs | 410 ++++ 3 files changed, 4753 insertions(+) create mode 100644 client/beefy/Cargo.lock create mode 100644 client/beefy/Cargo.toml create mode 100644 client/beefy/src/lib.rs diff --git a/client/beefy/Cargo.lock b/client/beefy/Cargo.lock new file mode 100644 index 0000000000000..101228bed64d0 --- /dev/null +++ b/client/beefy/Cargo.lock @@ -0,0 +1,4321 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[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.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "aes" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" +dependencies = [ + "aes-soft", + "aesni", + "block-cipher", +] + +[[package]] +name = "aes-gcm" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" +dependencies = [ + "aead", + "aes", + "block-cipher", + "ghash", + "subtle 2.3.0", +] + +[[package]] +name = "aes-soft" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" +dependencies = [ + "block-cipher", + "byteorder", + "opaque-debug 0.2.3", +] + +[[package]] +name = "aesni" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" +dependencies = [ + "block-cipher", + "opaque-debug 0.2.3", +] + +[[package]] +name = "ahash" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3" +dependencies = [ + "const-random", +] + +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" + +[[package]] +name = "aho-corasick" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +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.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" + +[[package]] +name = "arc-swap" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" + +[[package]] +name = "asn1_der" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" +dependencies = [ + "asn1_der_derive", +] + +[[package]] +name = "asn1_der_derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "async-channel" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21279cfaa4f47df10b1816007e738ca3747ef2ee53ffc51cdbf57a8bb266fee3" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801" +dependencies = [ + "async-task 4.0.2", + "concurrent-queue", + "fastrand", + "futures-lite", + "once_cell", + "vec-arena", +] + +[[package]] +name = "async-global-executor" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5586e693d02f9b439742e9d5d68bd64d923c6861954f7d78f91001a0e152d589" +dependencies = [ + "async-executor", + "async-io", + "futures-lite", + "num_cpus", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33be191d05a54ec120e4667375e2ad49fe506b846463df384460ab801c7ae5dc" +dependencies = [ + "concurrent-queue", + "fastrand", + "futures-lite", + "log", + "nb-connect", + "once_cell", + "parking", + "polling", + "vec-arena", + "waker-fn", +] + +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-std" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c92085acfce8b32e5b261d0b59b8f3309aee69fea421ea3f271f8b93225754f" +dependencies = [ + "async-global-executor", + "async-io", + "async-mutex", + "async-task 3.0.0", + "blocking", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "num_cpus", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" + +[[package]] +name = "async-task" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ab27c1aa62945039e44edaeee1dc23c74cc0c303dd5fe0fb462a184f1c3a518" + +[[package]] +name = "async-tls" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634" +dependencies = [ + "futures", + "rustls", + "webpki", + "webpki-roots 0.19.0", +] + +[[package]] +name = "async-trait" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687c230d85c0a52504709705fc8a53e4a692b83a2184f03dae73e38e1e93a783" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f46ca51dca4837f1520754d1c8c36636356b81553d928dc9c177025369a06e" + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + +[[package]] +name = "autocfg" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "backtrace" +version = "0.3.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base58" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bitvec" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" +dependencies = [ + "either", + "radium", +] + +[[package]] +name = "blake2" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84ce5b6108f8e154604bd4eb76a2f726066c3464d5a552a4229262a18c9bb471" +dependencies = [ + "byte-tools", + "byteorder", + "crypto-mac 0.8.0", + "digest 0.9.0", + "opaque-debug 0.2.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.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" +dependencies = [ + "arrayref", + "arrayvec 0.5.1", + "constant_time_eq", +] + +[[package]] +name = "blake2s_simd" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab9e07352b829279624ceb7c64adb4f585dacdb81d35cafae81139ccd617cf44" +dependencies = [ + "arrayref", + "arrayvec 0.5.1", + "constant_time_eq", +] + +[[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.3", +] + +[[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.4", +] + +[[package]] +name = "block-cipher" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" +dependencies = [ + "generic-array 0.14.4", +] + +[[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.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2640778f8053e72c11f621b0a5175a0560a269282aa98ed85107773ab8e2a556" +dependencies = [ + "async-channel", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell", + "waker-fn", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bumpalo" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" + +[[package]] +name = "byte-slice-cast" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" + +[[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.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" + +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "c_linked_list" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" + +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + +[[package]] +name = "cc" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "chacha20" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086c0f07ac275808b7bf9a39f2fd013aae1498be83632814c8c4e0bd53f2dc58" +dependencies = [ + "stream-cipher", + "zeroize", +] + +[[package]] +name = "chacha20poly1305" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18b0c90556d8e3fec7cf18d84a2f53d27b21288f2fe481b830fadcf809e48205" +dependencies = [ + "aead", + "chacha20", + "poly1305", + "stream-cipher", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d021fddb7bd3e734370acfa4a83f34095571d8570c039f1420d77540f68d5772" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi 0.3.9", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "cloudabi" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" +dependencies = [ + "bitflags", +] + +[[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 = "const-random" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f1af9ac737b2dd2d577701e59fd09ba34822f6f2ebdb30a7647405d9e55e16a" +dependencies = [ + "const-random-macro", + "proc-macro-hack", +] + +[[package]] +name = "const-random-macro" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e4c606eb459dd29f7c57b2e0879f2b6f14ee130918c2b78ccb58a9624e6c7a" +dependencies = [ + "getrandom", + "proc-macro-hack", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg 1.0.1", + "cfg-if", + "lazy_static", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-mac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +dependencies = [ + "generic-array 0.12.3", + "subtle 1.0.0", +] + +[[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.4", + "subtle 2.3.0", +] + +[[package]] +name = "curve25519-dalek" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" +dependencies = [ + "byteorder", + "digest 0.8.1", + "rand_core", + "subtle 2.3.0", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle 2.3.0", + "zeroize", +] + +[[package]] +name = "data-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d0e2d24e5ee3b23a01de38eefdcd978907890701f08ffffd4cb457ca4ee8d6" + +[[package]] +name = "derive_more" +version = "0.99.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dcfabdab475c16a93d669dddfc393027803e347d09663f524447f642fbb84ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.3", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[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 = "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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c53dc3a653e0f64081026e4bf048d48fec9fce90c66e8326ca7292df0ff2d82" + +[[package]] +name = "ed25519" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07dfc993ea376e864fe29a4099a61ca0bb994c6d7745a61bf60ddb3d64e05237" +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.0.0", + "ed25519", + "rand", + "serde", + "sha2 0.9.1", + "zeroize", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "environmental" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4" + +[[package]] +name = "erased-serde" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ca8b296792113e1500fd935ae487be6e00ce318952a6880555554824d6ebf38" +dependencies = [ + "serde", +] + +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "failure" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" +dependencies = [ + "backtrace", + "failure_derive", +] + +[[package]] +name = "failure_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fastrand" +version = "1.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c85295147490b8fcf2ea3d104080a105a8b2c63f9c319e82c02d8e952388919" + +[[package]] +name = "fixed-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixedbitset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" + +[[package]] +name = "flate2" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" +dependencies = [ + "cfg-if", + "crc32fast", + "libc", + "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 = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98d7f1c606d158d5af4479f2971f259d8dd262f03f6f7b5b37e92eec7b8de396" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "futures" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" + +[[package]] +name = "futures-executor" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" + +[[package]] +name = "futures-lite" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0db18c5f58083b54b0c416638ea73066722c2815c1e54dd8ba85ee3def593c3a" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd" + +[[package]] +name = "futures-task" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94" +dependencies = [ + "once_cell", +] + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "futures_codec" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" +dependencies = [ + "bytes", + "futures", + "memchr", + "pin-project", +] + +[[package]] +name = "gcc" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" + +[[package]] +name = "generic-array" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "get_if_addrs" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abddb55a898d32925f3148bd281174a68eeb68bbfd9a5938a57b18f506ee4ef7" +dependencies = [ + "c_linked_list", + "get_if_addrs-sys", + "libc", + "winapi 0.2.8", +] + +[[package]] +name = "get_if_addrs-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48" +dependencies = [ + "gcc", + "libc", +] + +[[package]] +name = "getrandom" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "ghash" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" +dependencies = [ + "polyval", +] + +[[package]] +name = "gimli" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" + +[[package]] +name = "gloo-timers" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "h2" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[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.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" +dependencies = [ + "ahash 0.2.18", + "autocfg 0.1.7", +] + +[[package]] +name = "hashbrown" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" +dependencies = [ + "ahash 0.3.8", + "autocfg 1.0.1", +] + +[[package]] +name = "hashbrown" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" + +[[package]] +name = "hex-literal" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5af1f635ef1bc545d78392b136bfe1c9809e029023c84a3638a864a10b8819c8" + +[[package]] +name = "hmac" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +dependencies = [ + "crypto-mac 0.7.0", + "digest 0.8.1", +] + +[[package]] +name = "hmac-drbg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" +dependencies = [ + "digest 0.8.1", + "generic-array 0.12.3", + "hmac", +] + +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] +name = "hyper" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-serde" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indexmap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +dependencies = [ + "autocfg 1.0.1", + "hashbrown 0.9.0", +] + +[[package]] +name = "instant" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" +dependencies = [ + "cfg-if", +] + +[[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 = "ip_network" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee15951c035f79eddbef745611ec962f63f4558f1dadf98ab723cc603487c6f" + +[[package]] +name = "ipnet" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" + +[[package]] +name = "itertools" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" + +[[package]] +name = "js-sys" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" + +[[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.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a" +dependencies = [ + "parity-util-mem", + "smallvec 1.4.2", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" + +[[package]] +name = "libp2p" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "571f5a4604c1a40d75651da141dfde29ad15329f537a779528803297d2220274" +dependencies = [ + "atomic", + "bytes", + "futures", + "lazy_static", + "libp2p-core", + "libp2p-core-derive", + "libp2p-dns", + "libp2p-identify", + "libp2p-kad", + "libp2p-mdns", + "libp2p-mplex", + "libp2p-noise", + "libp2p-ping", + "libp2p-request-response", + "libp2p-swarm", + "libp2p-tcp", + "libp2p-wasm-ext", + "libp2p-websocket", + "libp2p-yamux", + "multihash", + "parity-multiaddr", + "parking_lot 0.10.2", + "pin-project", + "smallvec 1.4.2", + "wasm-timer", +] + +[[package]] +name = "libp2p-core" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f13ba8c7df0768af2eb391696d562c7de88cc3a35122531aaa6a7d77754d25" +dependencies = [ + "asn1_der", + "bs58", + "ed25519-dalek", + "either", + "fnv", + "futures", + "futures-timer", + "lazy_static", + "libsecp256k1", + "log", + "multihash", + "multistream-select", + "parity-multiaddr", + "parking_lot 0.10.2", + "pin-project", + "prost", + "prost-build", + "rand", + "ring", + "rw-stream-sink", + "sha2 0.8.2", + "smallvec 1.4.2", + "thiserror", + "unsigned-varint 0.4.0", + "void", + "zeroize", +] + +[[package]] +name = "libp2p-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "libp2p-dns" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cf319822e08dd65c8e060d2354e9f952895bbc433f5706c75ed010c152aee5e" +dependencies = [ + "futures", + "libp2p-core", + "log", +] + +[[package]] +name = "libp2p-identify" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56396ee63aa9164eacf40c2c5d2bda8c4133c2f57e1b0425d51d3a4e362583b1" +dependencies = [ + "futures", + "libp2p-core", + "libp2p-swarm", + "log", + "prost", + "prost-build", + "smallvec 1.4.2", + "wasm-timer", +] + +[[package]] +name = "libp2p-kad" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7fa9047f8b8f544278a35c2d9d45d3b2c1785f2d86d4e1629d6edf97be3955" +dependencies = [ + "arrayvec 0.5.1", + "bytes", + "either", + "fnv", + "futures", + "futures_codec", + "libp2p-core", + "libp2p-swarm", + "log", + "multihash", + "prost", + "prost-build", + "rand", + "sha2 0.8.2", + "smallvec 1.4.2", + "uint", + "unsigned-varint 0.4.0", + "void", + "wasm-timer", +] + +[[package]] +name = "libp2p-mdns" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3173b5a6b2f690c29ae07798d85b9441a131ac76ddae9015ef22905b623d0c69" +dependencies = [ + "async-std", + "data-encoding", + "dns-parser", + "either", + "futures", + "lazy_static", + "libp2p-core", + "libp2p-swarm", + "log", + "net2", + "rand", + "smallvec 1.4.2", + "void", + "wasm-timer", +] + +[[package]] +name = "libp2p-mplex" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a73a799cc8410b36e40b8f4c4b6babbcb9efd3727111bf517876e4acfa612d3" +dependencies = [ + "bytes", + "fnv", + "futures", + "futures_codec", + "libp2p-core", + "log", + "parking_lot 0.10.2", + "unsigned-varint 0.4.0", +] + +[[package]] +name = "libp2p-noise" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef6c490042f549fb1025f2892dfe6083d97a77558f450c1feebe748ca9eb15a" +dependencies = [ + "bytes", + "curve25519-dalek 2.1.0", + "futures", + "lazy_static", + "libp2p-core", + "log", + "prost", + "prost-build", + "rand", + "sha2 0.8.2", + "snow", + "static_assertions", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "libp2p-ping" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad063c21dfcea4518ac9e8bd4119d33a5b26c41e674f602f41f05617a368a5c8" +dependencies = [ + "futures", + "libp2p-core", + "libp2p-swarm", + "log", + "rand", + "void", + "wasm-timer", +] + +[[package]] +name = "libp2p-request-response" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c0c9e8a4cd69d97e9646c54313d007512f411aba8c5226cfcda16df6a6e84a3" +dependencies = [ + "async-trait", + "bytes", + "futures", + "libp2p-core", + "libp2p-swarm", + "log", + "lru 0.6.0", + "minicbor", + "rand", + "smallvec 1.4.2", + "unsigned-varint 0.5.1", + "wasm-timer", +] + +[[package]] +name = "libp2p-swarm" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7193e444210132237b81b755ec7fe53f1c4bd2f53cf719729b94c0c72eb6eaa1" +dependencies = [ + "either", + "futures", + "libp2p-core", + "log", + "rand", + "smallvec 1.4.2", + "void", + "wasm-timer", +] + +[[package]] +name = "libp2p-tcp" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f42ec130d7a37a7e47bf4398026b7ad9185c08ed26972e2720f8b94112796f" +dependencies = [ + "async-std", + "futures", + "futures-timer", + "get_if_addrs", + "ipnet", + "libp2p-core", + "log", + "socket2", +] + +[[package]] +name = "libp2p-wasm-ext" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34c1faac6f92c21fbe155417957863ea822fba9e9fd5eb24c0912336a100e63f" +dependencies = [ + "futures", + "js-sys", + "libp2p-core", + "parity-send-wrapper", + "wasm-bindgen", + "wasm-bindgen-futures", +] + +[[package]] +name = "libp2p-websocket" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d650534ebd99f48f6fa292ed5db10d30df2444943afde4407ceeddab8e513fca" +dependencies = [ + "async-tls", + "either", + "futures", + "libp2p-core", + "log", + "quicksink", + "rustls", + "rw-stream-sink", + "soketto", + "url", + "webpki", + "webpki-roots 0.18.0", +] + +[[package]] +name = "libp2p-yamux" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781d9b9f043dcdabc40640807125368596b849fd4d96cdca2dcf052fdf6f33fd" +dependencies = [ + "futures", + "libp2p-core", + "parking_lot 0.11.0", + "thiserror", + "yamux", +] + +[[package]] +name = "libsecp256k1" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" +dependencies = [ + "arrayref", + "crunchy", + "digest 0.8.1", + "hmac-drbg", + "rand", + "sha2 0.8.2", + "subtle 2.3.0", + "typenum", +] + +[[package]] +name = "libz-sys" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" + +[[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 = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "lock_api" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "lru" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0609345ddee5badacf857d4f547e0e5a2e987db77085c24cd887f73573a04237" +dependencies = [ + "hashbrown 0.6.3", +] + +[[package]] +name = "lru" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111b945ac72ec09eb7bc62a0fbdc3cc6e80555a7245f52a69d3921a75b53b153" +dependencies = [ + "hashbrown 0.8.2", +] + +[[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.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" + +[[package]] +name = "memory-db" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" +dependencies = [ + "hash-db", + "hashbrown 0.8.2", + "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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + +[[package]] +name = "minicbor" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc03ad6f8f548db7194a5ff5a6f96342ecae4e3ef67d2bf18bacc0e245cd041" +dependencies = [ + "minicbor-derive", +] + +[[package]] +name = "minicbor-derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c214bf3d90099b52f3e4b328ae0fe34837fd0fab683ad1e10fceb4629106df48" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" +dependencies = [ + "adler", + "autocfg 1.0.1", +] + +[[package]] +name = "multihash" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567122ab6492f49b59def14ecc36e13e64dca4188196dd0cd41f9f3f979f3df6" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "digest 0.9.0", + "sha-1", + "sha2 0.9.1", + "sha3", + "unsigned-varint 0.5.1", +] + +[[package]] +name = "multimap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" + +[[package]] +name = "multistream-select" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9157e87afbc2ef0d84cc0345423d715f445edde00141c93721c162de35a05e5" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec 1.4.2", + "unsigned-varint 0.4.0", +] + +[[package]] +name = "nb-connect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e847c76b390f44529c2071ef06d0b52fbb4bdb04cc8987a5cfa63954c000abca" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "net2" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" +dependencies = [ + "cfg-if", + "libc", + "winapi 0.3.9", +] + +[[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 = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg 1.0.1", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +dependencies = [ + "autocfg 1.0.1", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +dependencies = [ + "autocfg 1.0.1", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +dependencies = [ + "autocfg 1.0.1", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" + +[[package]] +name = "once_cell" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" +dependencies = [ + "parking_lot 0.11.0", +] + +[[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 = "parity-multiaddr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2165a93382a93de55868dcbfa11e4a8f99676a9164eee6a2b4a9479ad319c257" +dependencies = [ + "arrayref", + "bs58", + "byteorder", + "data-encoding", + "multihash", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint 0.4.0", + "url", +] + +[[package]] +name = "parity-scale-codec" +version = "1.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c740e5fbcb6847058b40ac7e5574766c6388f585e184d769910fe0d3a2ca861" +dependencies = [ + "arrayvec 0.5.1", + "bitvec", + "byte-slice-cast", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db82bb1c18fc00176004462dd809b2a6d851669550aa17af6dacd21ae0c14" +dependencies = [ + "proc-macro-crate", + "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-util-mem" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c" +dependencies = [ + "cfg-if", + "hashbrown 0.8.2", + "impl-trait-for-tuples", + "parity-util-mem-derive", + "parking_lot 0.10.2", + "primitive-types", + "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.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" + +[[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.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.2", +] + +[[package]] +name = "parking_lot" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +dependencies = [ + "instant", + "lock_api 0.4.1", + "parking_lot_core 0.8.0", +] + +[[package]] +name = "parking_lot_core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +dependencies = [ + "cfg-if", + "cloudabi 0.0.3", + "libc", + "redox_syscall", + "smallvec 1.4.2", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +dependencies = [ + "cfg-if", + "cloudabi 0.1.0", + "instant", + "libc", + "redox_syscall", + "smallvec 1.4.2", + "winapi 0.3.9", +] + +[[package]] +name = "paste" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +dependencies = [ + "paste-impl", + "proc-macro-hack", +] + +[[package]] +name = "paste-impl" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +dependencies = [ + "proc-macro-hack", +] + +[[package]] +name = "pbkdf2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" +dependencies = [ + "byteorder", + "crypto-mac 0.7.0", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "petgraph" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f48fad7cfbff853437be7cf54d7b993af21f53be7f0988cbfe4a51535aa77205" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24c6d293bdd3ca5a1697997854c6cf7855e43fb6a0ba1c47af57a5bcafd158ae" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71f349a4f0e70676ffb2dbafe16d0c992382d02f0a952e3ddf584fc289dac6b3" + +[[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.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" + +[[package]] +name = "polling" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0720e0b9ea9d52451cf29d3413ba8a9303f8815d9d9653ef70e03ff73e65566" +dependencies = [ + "cfg-if", + "libc", + "log", + "wepoll-sys-stjepang", + "winapi 0.3.9", +] + +[[package]] +name = "poly1305" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b42192ab143ed7619bf888a7f9c6733a9a2153b218e2cd557cfdb52fbf9bb1" +dependencies = [ + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc" +dependencies = [ + "cfg-if", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" + +[[package]] +name = "primitive-types" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-serde", + "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-hack" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" + +[[package]] +name = "proc-macro-nested" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" + +[[package]] +name = "proc-macro2" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "prometheus" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d70cf4412832bcac9cffe27906f4a66e450d323525e977168c70d1b36120ae" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "parking_lot 0.11.0", + "regex", + "thiserror", +] + +[[package]] +name = "prost" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" +dependencies = [ + "bytes", + "heck", + "itertools", + "log", + "multimap", + "petgraph", + "prost", + "prost-types", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" +dependencies = [ + "bytes", + "prost", +] + +[[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", +] + +[[package]] +name = "quote" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", + "rand_pcg", +] + +[[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", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "ref-cast" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-automata" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +dependencies = [ + "byteorder", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" + +[[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 = "ring" +version = "0.16.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi 0.3.9", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" + +[[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", +] + +[[package]] +name = "rustls" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +dependencies = [ + "base64", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rw-stream-sink" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "sc-beefy-gadget" +version = "0.1.0" +dependencies = [ + "futures", + "log", + "parity-scale-codec", + "parking_lot 0.11.0", + "sc-client-api", + "sc-keystore", + "sc-network", + "sc-network-gossip", + "sp-application-crypto", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "sc-block-builder" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bee59dc560f30e72ee95c224e3e75299b53b619e659a38af9db2639803c08ee" +dependencies = [ + "parity-scale-codec", + "sc-client-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", +] + +[[package]] +name = "sc-client-api" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fafb2b2861e847657c4656d2ae2249c9f3f6a76fb92a22f750325b77e1fb4c8" +dependencies = [ + "derive_more", + "fnv", + "futures", + "hash-db", + "hex-literal", + "kvdb", + "lazy_static", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "sc-executor", + "sc-telemetry", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-database", + "sp-externalities", + "sp-inherents", + "sp-keyring", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-trie", + "sp-utils", + "sp-version", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-executor" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af77c7fda9659559e257fe330af26e7c2e8f61583c2a5c45f4c9db73d58a902b" +dependencies = [ + "derive_more", + "lazy_static", + "libsecp256k1", + "log", + "parity-scale-codec", + "parity-wasm", + "parking_lot 0.10.2", + "sc-executor-common", + "sc-executor-wasmi", + "sp-api", + "sp-core", + "sp-externalities", + "sp-io", + "sp-panic-handler", + "sp-runtime-interface", + "sp-serializer", + "sp-trie", + "sp-version", + "sp-wasm-interface", + "wasmi", +] + +[[package]] +name = "sc-executor-common" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6663e4d1d2f8255e6c1994ce548365a7631a82f7ab231d0b8a122cc2a0011949" +dependencies = [ + "derive_more", + "log", + "parity-scale-codec", + "parity-wasm", + "sp-allocator", + "sp-core", + "sp-runtime-interface", + "sp-serializer", + "sp-wasm-interface", + "wasmi", +] + +[[package]] +name = "sc-executor-wasmi" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78aeea37a28b83af11fe621ee047758e125341db96efaf7f553a4180fe48d6b8" +dependencies = [ + "log", + "parity-scale-codec", + "sc-executor-common", + "sp-allocator", + "sp-core", + "sp-runtime-interface", + "sp-wasm-interface", + "wasmi", +] + +[[package]] +name = "sc-keystore" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bbf8b58ed80e1d375aaa8ee5dedf17f68fea30c900440a695fb630a1757283" +dependencies = [ + "derive_more", + "hex", + "merlin", + "parking_lot 0.10.2", + "rand", + "serde_json", + "sp-application-crypto", + "sp-core", + "subtle 2.3.0", +] + +[[package]] +name = "sc-network" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e58ccd69ea8dd0c1e1d98e5e7ed2969aaf14d45dcf98416c679a968e752850" +dependencies = [ + "async-std", + "async-trait", + "bitflags", + "bs58", + "bytes", + "derive_more", + "either", + "erased-serde", + "fnv", + "fork-tree", + "futures", + "futures-timer", + "futures_codec", + "hex", + "ip_network", + "libp2p", + "linked-hash-map", + "linked_hash_set", + "log", + "lru 0.4.3", + "nohash-hasher", + "parity-scale-codec", + "parking_lot 0.10.2", + "pin-project", + "prost", + "prost-build", + "rand", + "sc-block-builder", + "sc-client-api", + "sc-peerset", + "serde", + "serde_json", + "slog", + "slog_derive", + "smallvec 0.6.13", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "sp-utils", + "substrate-prometheus-endpoint", + "thiserror", + "unsigned-varint 0.4.0", + "void", + "wasm-timer", + "zeroize", +] + +[[package]] +name = "sc-network-gossip" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ddb2a1cb6cd53b46e76f61c662d1561da4a7dc16a375c37849fd1f429b6803" +dependencies = [ + "futures", + "futures-timer", + "libp2p", + "log", + "lru 0.4.3", + "sc-network", + "sp-runtime", + "wasm-timer", +] + +[[package]] +name = "sc-peerset" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfaa3d62db8ad549e6d21b6e353e00e2e7338c8623c01c79e8f36b035266a4b" +dependencies = [ + "futures", + "libp2p", + "log", + "serde_json", + "sp-utils", + "wasm-timer", +] + +[[package]] +name = "sc-telemetry" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5883219d0ccec3e4d50079ba63f8accc71659b93537cff66de326a382b138c4b" +dependencies = [ + "futures", + "futures-timer", + "libp2p", + "log", + "parking_lot 0.10.2", + "pin-project", + "rand", + "serde", + "slog", + "slog-json", + "slog-scope", + "take_mut", + "void", + "wasm-timer", +] + +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec 0.5.1", + "curve25519-dalek 2.1.0", + "getrandom", + "merlin", + "rand", + "rand_core", + "sha2 0.8.2", + "subtle 2.3.0", + "zeroize", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "secrecy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" +dependencies = [ + "zeroize", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", + "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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[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 = "sharded-slab" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signature" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "slog" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cc9c640a4adbfbcc11ffb95efe5aa7af7309e002adab54b185507dbf2377b99" +dependencies = [ + "erased-serde", +] + +[[package]] +name = "slog-json" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" +dependencies = [ + "chrono", + "erased-serde", + "serde", + "serde_json", + "slog", +] + +[[package]] +name = "slog-scope" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c44c89dd8b0ae4537d1ae318353eaf7840b4869c536e31c41e963d1ea523ee6" +dependencies = [ + "arc-swap", + "lazy_static", + "slog", +] + +[[package]] +name = "slog_derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "smallvec" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +dependencies = [ + "maybe-uninit", +] + +[[package]] +name = "smallvec" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" + +[[package]] +name = "snow" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32bf8474159a95551661246cda4976e89356999e3cbfef36f493dacc3fae1e8e" +dependencies = [ + "aes-gcm", + "blake2", + "chacha20poly1305", + "rand", + "rand_core", + "ring", + "rustc_version", + "sha2 0.9.1", + "subtle 2.3.0", + "x25519-dalek", +] + +[[package]] +name = "socket2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "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", + "bytes", + "flate2", + "futures", + "httparse", + "log", + "rand", + "sha-1", +] + +[[package]] +name = "sp-allocator" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e79a1db780708b6b71e9914e2b1d11b3e61c9bfb492c88b1024115e1a6661da" +dependencies = [ + "derive_more", + "log", + "sp-core", + "sp-std", + "sp-wasm-interface", +] + +[[package]] +name = "sp-api" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953a3296335d9761311763dbe6855109ea4bea915e27cf5633d8b01057898302" +dependencies = [ + "hash-db", + "parity-scale-codec", + "sp-api-proc-macro", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-version", +] + +[[package]] +name = "sp-api-proc-macro" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8247ca24a2a881af2ac675c8ec33584944965d6d45645bbec16fe327ce42dce6" +dependencies = [ + "blake2-rfc", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-application-crypto" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "885eca124aa6ce0bba57c08bc48c4357096996d630a77f572580ef8e2e4df034" +dependencies = [ + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-arithmetic" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "667775bc50eb214225df18c92e4ec57acc7e2dc78d7d210eb4dd930db1a73995" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-block-builder" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07d7fca8aa126a9d295843d592f44b48d8cf93880862baeff2968164598ab26c" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-inherents", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-blockchain" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37387284973e2edceefaa673930282801ea238e5892a2cc6aa02f7f2e7601df" +dependencies = [ + "derive_more", + "log", + "lru 0.4.3", + "parity-scale-codec", + "parking_lot 0.10.2", + "sp-block-builder", + "sp-consensus", + "sp-database", + "sp-runtime", + "sp-state-machine", +] + +[[package]] +name = "sp-consensus" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b460103293bbf2f4193e43c4f031fdc099c5e27c782369bbb4dacc7765e84057" +dependencies = [ + "derive_more", + "futures", + "futures-timer", + "libp2p", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "serde", + "sp-api", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "sp-utils", + "sp-version", + "substrate-prometheus-endpoint", + "wasm-timer", +] + +[[package]] +name = "sp-core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e92ac5c674ee2cd9219d084301b4cbb82b28a94a0f3087bf4bea0ef3067ebb5c" +dependencies = [ + "base58", + "blake2-rfc", + "byteorder", + "derive_more", + "dyn-clonable", + "ed25519-dalek", + "futures", + "hash-db", + "hash256-std-hasher", + "hex", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.10.2", + "primitive-types", + "rand", + "regex", + "schnorrkel", + "secrecy", + "serde", + "sha2 0.8.2", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "substrate-bip39", + "tiny-bip39", + "tiny-keccak", + "twox-hash", + "wasmi", + "zeroize", +] + +[[package]] +name = "sp-database" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c1c352eceefe5bcdfc27f13a2fd038fc571b7aca5146f2cd651d40e9d2457dd" +dependencies = [ + "kvdb", + "parking_lot 0.10.2", +] + +[[package]] +name = "sp-debug-derive" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a3750b084e0f4677f6e834a974f30b1ba97fc2fe00185c9d03611a2228446dc" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d87fcd0e0fc5e025459cfe769803488d4894e36d0f8cef80b5239d2e7ef6580" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-inherents" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "365e5aee23640631e63e8634f1d804e33c8fcb521f4052910f29abaa2df1c1cf" +dependencies = [ + "derive_more", + "parity-scale-codec", + "parking_lot 0.10.2", + "sp-core", + "sp-std", +] + +[[package]] +name = "sp-io" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e1dee9244eb6cba1bef9b3a4ec288185e1380e455f1fd348b60252592c1cf0" +dependencies = [ + "futures", + "hash-db", + "libsecp256k1", + "log", + "parity-scale-codec", + "parking_lot 0.10.2", + "sp-core", + "sp-externalities", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", + "sp-wasm-interface", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keyring" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f76feeb27b218d58523931ea2d708b622c3bd96a3be1c3a5895bba0f7a54c13" +dependencies = [ + "lazy_static", + "sp-core", + "sp-runtime", + "strum", +] + +[[package]] +name = "sp-panic-handler" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "492126eb766b3b6740e4e4929d6527d37708598b7296a664f3680c0f0c1fc573" +dependencies = [ + "backtrace", + "log", +] + +[[package]] +name = "sp-runtime" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62542f8ce9d5fcb43a4dd3c3a53326d33aacf9b0bc9d353d6fe9fd5ff3031747" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "parity-util-mem", + "paste", + "rand", + "serde", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-inherents", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-runtime-interface" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7e363c480cc8c9019b84f85d10c0b56a184079d5d840d2d1d55087ad835dc6" +dependencies = [ + "parity-scale-codec", + "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 = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cf56a38544293e54dbe0aa7b6aed1e046bfc704b6fc3de7255897dca98ccb1" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-serializer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643933e971979094c9d4b27b015c7250985a262e405bb9ad090336d8ceb5b2b9" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "sp-state-machine" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f58335de98bca196683a8ef22195a8a43b457b8bc705dba3124138ffc2ee720" +dependencies = [ + "hash-db", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot 0.10.2", + "rand", + "smallvec 1.4.2", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-std", + "sp-trie", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-std" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa2d6e166cead2d3b1d3d8fe0e787d076b7d0296b1760a0d7d340846d0ba42c5" + +[[package]] +name = "sp-storage" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f4625e6f8f40995939560f48f89028f658b7929657c68d01c571c81ab5619ff" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-tracing" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9a5c42c5450991ca3a28c190e75122f5ccedbcb024953e7c357e7aa2afd8534" +dependencies = [ + "log", + "parity-scale-codec", + "sp-std", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-transaction-pool" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83b34ee48341c17c6e2f1e55f6076918f46b0c4505a99ad69ab1edda8b45bbd8" +dependencies = [ + "derive_more", + "futures", + "log", + "parity-scale-codec", + "serde", + "sp-api", + "sp-blockchain", + "sp-runtime", +] + +[[package]] +name = "sp-trie" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3aae57c8ae81ba978503137a8c625d2963eb425dd90dec0d96b4ed18d8bfd55" +dependencies = [ + "hash-db", + "memory-db", + "parity-scale-codec", + "sp-core", + "sp-std", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-utils" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84310a02e2ac89b5e288d7af980414fd88753e3caba92aab1983cd2819991150" +dependencies = [ + "futures", + "futures-core", + "futures-timer", + "lazy_static", + "prometheus", +] + +[[package]] +name = "sp-version" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21935199c8765f0d02facc718f9c83149a70ea684fb03612e5161c682b38a301" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "serde", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-wasm-interface" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c28225e8b7ec7e260f8b46443f8731abda206334cb75c740d2407693f38167" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-std", + "wasmi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stream-cipher" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f8ed9974042b8c3672ff3030a69fcc03b74c47c3d1ecb7755e8a3626011e88" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "strum" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6138f8f88a16d90134763314e3fc76fa3ed6a7db4725d6acf9a3ef95a3188d22" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "substrate-bip39" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bed6646a0159b9935b5d045611560eeef842b78d7adc3ba36f5ca325a13a0236" +dependencies = [ + "hmac", + "pbkdf2", + "schnorrkel", + "sha2 0.8.2", + "zeroize", +] + +[[package]] +name = "substrate-prometheus-endpoint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3e361741d066bfc29554b9f1bc8e4ac927eb4bd33dd8bb0486969edd8b0b5a" +dependencies = [ + "async-std", + "derive_more", + "futures-util", + "hyper", + "log", + "prometheus", + "tokio", +] + +[[package]] +name = "subtle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" + +[[package]] +name = "subtle" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" + +[[package]] +name = "syn" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +dependencies = [ + "cfg-if", + "libc", + "rand", + "redox_syscall", + "remove_dir_all", + "winapi 0.3.9", +] + +[[package]] +name = "thiserror" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +dependencies = [ + "lazy_static", +] + +[[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.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0165e045cc2ae1660270ca65e1676dbaab60feb0f91b10f7d0665e9b47e31f2" +dependencies = [ + "failure", + "hmac", + "once_cell", + "pbkdf2", + "rand", + "rustc-hash", + "sha2 0.8.2", + "unicode-normalization", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" + +[[package]] +name = "tokio" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "memchr", + "pin-project-lite", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "tracing" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" +dependencies = [ + "cfg-if", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-log" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82bb5079aa76438620837198db8a5c529fb9878c730bc2b28179b0241cf04c10" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec 1.4.2", + "thread_local", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "trie-db" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" +dependencies = [ + "hash-db", + "hashbrown 0.8.2", + "log", + "rustc-hex", + "smallvec 1.4.2", +] + +[[package]] +name = "trie-root" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" +dependencies = [ + "hash-db", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "twox-hash" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56" +dependencies = [ + "rand", +] + +[[package]] +name = "typenum" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" + +[[package]] +name = "uint" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" +dependencies = [ + "byteorder", + "crunchy", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "universal-hash" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +dependencies = [ + "generic-array 0.14.4", + "subtle 2.3.0", +] + +[[package]] +name = "unsigned-varint" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" +dependencies = [ + "bytes", + "futures-io", + "futures-util", + "futures_codec", +] + +[[package]] +name = "unsigned-varint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" +dependencies = [ + "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 = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +dependencies = [ + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" + +[[package]] +name = "vec-arena" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" + +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[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 = "wasm-bindgen" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" + +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.0", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmi" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" +dependencies = [ + "libc", + "memory_units", + "num-rational", + "num-traits", + "parity-wasm", + "wasmi-validation", +] + +[[package]] +name = "wasmi-validation" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "web-sys" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" +dependencies = [ + "webpki", +] + +[[package]] +name = "webpki-roots" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" +dependencies = [ + "webpki", +] + +[[package]] +name = "wepoll-sys-stjepang" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fdfbb03f290ca0b27922e8d48a0997b4ceea12df33269b9f75e713311eb178d" +dependencies = [ + "cc", +] + +[[package]] +name = "which" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +dependencies = [ + "libc", +] + +[[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-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[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 = "x25519-dalek" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "637ff90c9540fa3073bb577e65033069e4bae7c79d49d74aa3ffdf5342a53217" +dependencies = [ + "curve25519-dalek 2.1.0", + "rand_core", + "zeroize", +] + +[[package]] +name = "yamux" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aeb8c4043cac71c3c299dff107171c220d179492350ea198e109a414981b83c" +dependencies = [ + "futures", + "log", + "nohash-hasher", + "parking_lot 0.11.0", + "rand", + "static_assertions", +] + +[[package]] +name = "zeroize" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml new file mode 100644 index 0000000000000..0600951adb779 --- /dev/null +++ b/client/beefy/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "sc-beefy-gadget" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +futures = "0.3" +log = "0.4" +parity-scale-codec = "1.3.4" +parking_lot = "0.11" + +sp-application-crypto = "2.0.0" +sp-blockchain = "2.0.0" +sp-consensus = "0.8.0" +sp-core = "2.0.0" +sp-runtime = "2.0.0" + +sc-keystore = "2.0.0" +sc-client-api = "2.0.0" +sc-network = "0.8.0" +sc-network-gossip = "0.8.0" diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs new file mode 100644 index 0000000000000..5a799de7e0288 --- /dev/null +++ b/client/beefy/src/lib.rs @@ -0,0 +1,410 @@ +// Copyright (C) 2020 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::collections::BTreeMap; +use std::convert::TryInto; +use std::fmt::Debug; +use std::sync::Arc; + +use futures::{future, FutureExt, Stream, StreamExt}; +use log::{debug, error, info, trace, warn}; +use parity_scale_codec::{Codec, Decode, Encode}; +use parking_lot::Mutex; + +use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; +use sc_network_gossip::{ + GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, + Validator as GossipValidator, ValidatorContext as GossipValidatorContext, +}; +use sp_application_crypto::Ss58Codec; +use sp_blockchain::HeaderBackend; +use sp_consensus::SyncOracle as SyncOracleT; +use sp_core::{traits::BareCryptoStorePtr, Public}; +use sp_runtime::{ + traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}, + ConsensusEngineId, KeyTypeId, +}; + +pub const BEEFY_ENGINE_ID: ConsensusEngineId = *b"BEEF"; +pub const BEEFY_PROTOCOL_NAME: &'static str = "/paritytech/beefy/1"; + +/// Key type for BEEFY module. +pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"beef"); + +mod app { + use sp_application_crypto::{app_crypto, ecdsa}; + app_crypto!(ecdsa, super::KEY_TYPE); +} + +sp_application_crypto::with_pair! { + /// The BEEFY crypto scheme defined via the keypair type. + pub type AuthorityPair = app::Pair; +} + +/// Identity of a BEEFY authority. +pub type AuthorityId = app::Public; + +/// Signature for a BEEFY authority. +pub type AuthoritySignature = app::Signature; + +/// Allows all gossip messages to get through. +struct AllowAll { + topic: Hash, +} + +impl GossipValidator for AllowAll +where + Block: BlockT, +{ + fn validate( + &self, + _context: &mut dyn GossipValidatorContext, + _sender: &sc_network::PeerId, + _data: &[u8], + ) -> GossipValidationResult { + GossipValidationResult::ProcessAndKeep(self.topic) + } +} + +struct RoundTracker { + votes: Vec<(Id, Signature)>, +} + +impl Default for RoundTracker { + fn default() -> Self { + RoundTracker { + votes: Vec::new(), + } + } +} + +impl RoundTracker +where + Id: PartialEq, + Signature: PartialEq, +{ + fn add_vote(&mut self, vote: (Id, Signature)) -> bool { + // this needs to handle equivocations in the future + if self.votes.contains(&vote) { + return false; + } + + self.votes.push(vote); + true + } + + fn is_done(&self, threshold: usize) -> bool { + self.votes.len() >= threshold + } +} + +fn threshold(voters: usize) -> usize { + let faulty = voters.saturating_sub(1) / 3; + voters - faulty +} + +struct Rounds { + rounds: BTreeMap>, + voters: Vec, +} + +impl Rounds +where + Hash: Ord, +{ + fn new(voters: Vec) -> Self { + Rounds { + rounds: BTreeMap::new(), + voters, + } + } +} + +impl Rounds +where + Hash: Ord, + Id: PartialEq, + Signature: PartialEq, +{ + fn add_vote(&mut self, round: Hash, vote: (Id, Signature)) -> bool { + self.rounds.entry(round).or_default().add_vote(vote) + } + + fn is_done(&self, round: &Hash) -> bool { + self.rounds + .get(round) + .map(|tracker| tracker.is_done(threshold(self.voters.len()))) + .unwrap_or(false) + } + + fn drop(&mut self, round: &Hash) { + self.rounds.remove(round); + } +} + +fn topic() -> Block::Hash { + <::Hashing as HashT>::hash("beefy".as_bytes()) +} + +#[derive(Debug, Decode, Encode)] +struct VoteMessage { + block: Hash, + id: Id, + signature: Signature, +} + +struct BeefyWorker { + local_id: Id, + key_store: BareCryptoStorePtr, + min_interval: u32, + rounds: Rounds, + finality_notifications: FinalityNotifications, + gossip_engine: Arc>>, + best_finalized_block: NumberFor, + best_block_voted_on: NumberFor, +} + +impl + BeefyWorker +where + Block: BlockT, +{ + fn new( + local_id: Id, + key_store: BareCryptoStorePtr, + voters: Vec, + finality_notifications: FinalityNotifications, + gossip_engine: GossipEngine, + best_finalized_block: NumberFor, + best_block_voted_on: NumberFor, + ) -> Self { + BeefyWorker { + local_id, + key_store, + min_interval: 2, + rounds: Rounds::new(voters), + finality_notifications, + gossip_engine: Arc::new(Mutex::new(gossip_engine)), + best_finalized_block, + best_block_voted_on, + } + } +} + +impl + BeefyWorker +where + Block: BlockT, + Id: Codec + Debug + PartialEq + Public, + Signature: Codec + Debug + PartialEq + std::convert::TryFrom>, + FinalityNotifications: Stream> + Unpin, +{ + fn should_vote_on(&self, number: NumberFor) -> bool { + use sp_runtime::traits::Saturating; + use sp_runtime::SaturatedConversion; + + let diff = self.best_finalized_block.saturating_sub(self.best_block_voted_on); + let diff = diff.saturated_into::(); + let next_power_of_two = (diff / 2).next_power_of_two(); + let next_block_to_vote_on = self.best_block_voted_on + self.min_interval.max(next_power_of_two).into(); + + trace!( + target: "beefy", + "should_vote_on: #{:?}, diff: {:?}, next_power_of_two: {:?}, next_block_to_vote_on: #{:?}", + number, + diff, + next_power_of_two, + next_block_to_vote_on, + ); + + number == next_block_to_vote_on + } + + fn handle_finality_notification(&mut self, notification: FinalityNotification) { + info!(target: "beefy", "Finality notification: {:?}", notification); + + if self.should_vote_on(*notification.header.number()) { + let signature = match self + .key_store + .read() + .sign_with( + KEY_TYPE, + &self.local_id.to_public_crypto_pair(), + ¬ification.header.hash().encode(), + ) + .map_err(|_| ()) + .and_then(|res| res.try_into().map_err(|_| ())) + { + Ok(sig) => sig, + Err(err) => { + warn!(target: "beefy", "Error signing: {:?}", err); + return; + } + }; + + self.best_block_voted_on = *notification.header.number(); + + let message = VoteMessage { + block: notification.header.hash(), + id: self.local_id.clone(), + signature, + }; + + self.gossip_engine.lock().gossip_message(topic::(), message.encode(), false); + debug!(target: "beefy", "Sent vote message: {:?}", message); + + self.handle_vote(message.block, (message.id, message.signature)); + } + + self.best_finalized_block = *notification.header.number(); + } + + fn handle_vote(&mut self, round: Block::Hash, vote: (Id, Signature)) { + // TODO: validate signature + + if self.rounds.add_vote(round.clone(), vote) { + if self.rounds.is_done(&round) { + info!(target: "beefy", "Round {:?} concluded.", round); + self.rounds.drop(&round); + } + } + } + + async fn run(mut self) { + let mut votes = + Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( + |notification| async move { + debug!(target: "beefy", "Got vote message: {:?}", notification); + + VoteMessage::::decode( + &mut ¬ification.message[..], + ) + .ok() + }, + )); + + loop { + let engine = self.gossip_engine.clone(); + let gossip_engine = future::poll_fn(|cx| engine.lock().poll_unpin(cx)); + + futures::select! { + notification = self.finality_notifications.next().fuse() => { + if let Some(notification) = notification { + self.handle_finality_notification(notification); + } else { + return; + } + }, + vote = votes.next() => { + if let Some(vote) = vote { + self.handle_vote(vote.block, (vote.id, vote.signature)); + } else { + return; + } + }, + _ = gossip_engine.fuse() => { + error!(target: "beefy", "Gossip engine has terminated."); + return; + } + } + } + } +} + +pub async fn start_beefy_gadget( + client: Arc, + key_store: BareCryptoStorePtr, + network: Network, + _sync_oracle: SyncOracle, +) where + Block: BlockT, + Backend: BackendT, + Client: + BlockchainEvents + HeaderBackend + Finalizer + Send + Sync, + Network: GossipNetwork + Clone + Send + 'static, + SyncOracle: SyncOracleT + Send + 'static, +{ + let gossip_engine = GossipEngine::new( + network, + BEEFY_ENGINE_ID, + BEEFY_PROTOCOL_NAME, + Arc::new(AllowAll { + topic: topic::(), + }), + ); + + // ECDSA KEYS + // Secret phrase `history unique love spell mixed scrub expose retreat lawn jungle envelope spoon` is account: + // Secret seed: 0x996ed8439b50c50a94e5ca2254cde3d6d310f2babe39697fa51eb1bc65649fdb + // Public key (hex): 0x026a47a82cd7f0655a3bc9108fcf87c7ec444c5e2e7d44b826d9467635fe9b147e + // Account ID: 0xcba579b19a7e89087144c98b259d74465016f064ec2be5f45f2a632c2ffc1b14 + // SS58 Address: 5GfijY8EJs724J7uujqqpNtJ4R4sUZxHTSGn4zMczaLt95eY + // + // curl -H 'Content-Type: application/json' --data '{"id":1,"jsonrpc":"2.0","method":"author_insertKey","params":["beef","0x996ed8439b50c50a94e5ca2254cde3d6d310f2babe39697fa51eb1bc65649fdb","0x026a47a82cd7f0655a3bc9108fcf87c7ec444c5e2e7d44b826d9467635fe9b147e"]}' http://localhost:9933 + // + // Secret phrase `cage olympic bone detect control alert side off proud lucky rotate turkey` is account: + // Secret seed: 0x99eac69a6545d4c454c54232d8afe47dc16a8483b9d155663f52b7ccabe0d284 + // Public key (hex): 0x03df6630e91b0309fa0986fcf52f83fcf437091c58534bd2f398d6e9aeb475de82 + // Account ID: 0xa9b4c177c0d11d97a7123553d90f4ba265461c1217f544c2e787400c4a7478d6 + // SS58 Address: 5FuDePC3XmirUqSvjxziwZzop4vVN8pBkzszdabQ8Pj7oRCW + // + // curl -H 'Content-Type: application/json' --data '{"id":1,"jsonrpc":"2.0","method":"author_insertKey","params":["beef","0x99eac69a6545d4c454c54232d8afe47dc16a8483b9d155663f52b7ccabe0d284","0x03df6630e91b0309fa0986fcf52f83fcf437091c58534bd2f398d6e9aeb475de82"]}' http://localhost:9933 + + let voters = vec![ + "0x026a47a82cd7f0655a3bc9108fcf87c7ec444c5e2e7d44b826d9467635fe9b147e", + "0x03df6630e91b0309fa0986fcf52f83fcf437091c58534bd2f398d6e9aeb475de82", + ]; + + let voters = voters + .into_iter() + .map(|address| AuthorityId::from_string(address).unwrap()) + .collect::>(); + + let local_id = + match voters.iter().find(|id| key_store.read().has_keys(&[(id.to_raw_vec(), KEY_TYPE)])) { + Some(id) => { + info!(target: "beefy", "Starting BEEFY worker with local id: {:?}", id); + id.clone() + } + None => { + info!(target: "beefy", "No local id found, not starting BEEFY worker."); + return futures::future::pending().await; + } + }; + + let best_finalized_block = client.info().finalized_number; + let best_block_voted_on = Zero::zero(); + + let worker = BeefyWorker::<_, AuthorityId, AuthoritySignature, _>::new( + local_id, + key_store, + voters, + client.finality_notification_stream(), + gossip_engine, + best_finalized_block, + best_block_voted_on, + ); + + worker.run().await +} + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} From 539c62d19e58fbba16e4c4e2007fd90ac9a51a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 20 Oct 2020 14:09:02 +0200 Subject: [PATCH 002/109] CI stuff (#5) * CI stuff. * Fix workspace. * cargo fmt --all * Add license for beefy-gadget * One toolchain to rule them all. * Clippy. * Fix clippy. * Clippy in the runtime. * Fix clippy grumbles. * cargo fmt --all --- client/beefy/Cargo.toml | 1 + client/beefy/src/lib.rs | 77 +++++++++++++++++++---------------------- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 0600951adb779..8259d4aa6eb23 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -3,6 +3,7 @@ name = "sc-beefy-gadget" version = "0.1.0" authors = ["Parity Technologies "] edition = "2018" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = "0.3" diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 5a799de7e0288..9170471004a3f 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -26,8 +26,8 @@ use parking_lot::Mutex; use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; use sc_network_gossip::{ - GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, - Validator as GossipValidator, ValidatorContext as GossipValidatorContext, + GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, Validator as GossipValidator, + ValidatorContext as GossipValidatorContext, }; use sp_application_crypto::Ss58Codec; use sp_blockchain::HeaderBackend; @@ -39,7 +39,7 @@ use sp_runtime::{ }; pub const BEEFY_ENGINE_ID: ConsensusEngineId = *b"BEEF"; -pub const BEEFY_PROTOCOL_NAME: &'static str = "/paritytech/beefy/1"; +pub const BEEFY_PROTOCOL_NAME: &str = "/paritytech/beefy/1"; /// Key type for BEEFY module. pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"beef"); @@ -85,9 +85,7 @@ struct RoundTracker { impl Default for RoundTracker { fn default() -> Self { - RoundTracker { - votes: Vec::new(), - } + RoundTracker { votes: Vec::new() } } } @@ -156,7 +154,7 @@ where } fn topic() -> Block::Hash { - <::Hashing as HashT>::hash("beefy".as_bytes()) + <::Hashing as HashT>::hash(b"beefy") } #[derive(Debug, Decode, Encode)] @@ -177,8 +175,7 @@ struct BeefyWorker { best_block_voted_on: NumberFor, } -impl - BeefyWorker +impl BeefyWorker where Block: BlockT, { @@ -204,8 +201,7 @@ where } } -impl - BeefyWorker +impl BeefyWorker where Block: BlockT, Id: Codec + Debug + PartialEq + Public, @@ -263,7 +259,9 @@ where signature, }; - self.gossip_engine.lock().gossip_message(topic::(), message.encode(), false); + self.gossip_engine + .lock() + .gossip_message(topic::(), message.encode(), false); debug!(target: "beefy", "Sent vote message: {:?}", message); self.handle_vote(message.block, (message.id, message.signature)); @@ -274,27 +272,21 @@ where fn handle_vote(&mut self, round: Block::Hash, vote: (Id, Signature)) { // TODO: validate signature - - if self.rounds.add_vote(round.clone(), vote) { - if self.rounds.is_done(&round) { - info!(target: "beefy", "Round {:?} concluded.", round); - self.rounds.drop(&round); - } + let vote_added = self.rounds.add_vote(round, vote); + if vote_added && self.rounds.is_done(&round) { + info!(target: "beefy", "Round {:?} concluded.", round); + self.rounds.drop(&round); } } async fn run(mut self) { - let mut votes = - Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( - |notification| async move { - debug!(target: "beefy", "Got vote message: {:?}", notification); - - VoteMessage::::decode( - &mut ¬ification.message[..], - ) - .ok() - }, - )); + let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( + |notification| async move { + debug!(target: "beefy", "Got vote message: {:?}", notification); + + VoteMessage::::decode(&mut ¬ification.message[..]).ok() + }, + )); loop { let engine = self.gossip_engine.clone(); @@ -332,8 +324,7 @@ pub async fn start_beefy_gadget( ) where Block: BlockT, Backend: BackendT, - Client: - BlockchainEvents + HeaderBackend + Finalizer + Send + Sync, + Client: BlockchainEvents + HeaderBackend + Finalizer + Send + Sync, Network: GossipNetwork + Clone + Send + 'static, SyncOracle: SyncOracleT + Send + 'static, { @@ -373,17 +364,19 @@ pub async fn start_beefy_gadget( .map(|address| AuthorityId::from_string(address).unwrap()) .collect::>(); - let local_id = - match voters.iter().find(|id| key_store.read().has_keys(&[(id.to_raw_vec(), KEY_TYPE)])) { - Some(id) => { - info!(target: "beefy", "Starting BEEFY worker with local id: {:?}", id); - id.clone() - } - None => { - info!(target: "beefy", "No local id found, not starting BEEFY worker."); - return futures::future::pending().await; - } - }; + let local_id = match voters + .iter() + .find(|id| key_store.read().has_keys(&[(id.to_raw_vec(), KEY_TYPE)])) + { + Some(id) => { + info!(target: "beefy", "Starting BEEFY worker with local id: {:?}", id); + id.clone() + } + None => { + info!(target: "beefy", "No local id found, not starting BEEFY worker."); + return futures::future::pending().await; + } + }; let best_finalized_block = client.info().finalized_number; let best_block_voted_on = Zero::zero(); From f3ab45d066113d9a70cda6b1889bda75a91e6cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 22 Oct 2020 17:31:56 +0200 Subject: [PATCH 003/109] Primitives & Light Client examples (#8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Primitives. * Docs. * Document primitives. * Simple tests. * Light client examples. * Fix stuff. * cargo fmt --all * Add a bunch of tests for imports. * Add more examples. * cargo fmt --all * Fix clippy. * cargo fmt --all * Apply suggestions from code review Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Add GRANDPA / FG clarifications. * Fix min number of signatures. Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> --- client/beefy/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 8259d4aa6eb23..18a0b9015c26f 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sc-beefy-gadget" +name = "beefy-gadget" version = "0.1.0" authors = ["Parity Technologies "] edition = "2018" From ea541f9175e338979b2836eefc7243a8044011a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Wed, 18 Nov 2020 13:09:45 +0000 Subject: [PATCH 004/109] Update to substrate master (#22) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update to substrate master * update dependencies * fix clippy issues Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/Cargo.toml | 21 +++++++++++---------- client/beefy/src/lib.rs | 31 +++++++++++++++---------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 18a0b9015c26f..e21e38a899e4c 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -6,18 +6,19 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] +codec = { version = "1.3.5", package = "parity-scale-codec", features = ["derive"] } futures = "0.3" log = "0.4" -parity-scale-codec = "1.3.4" parking_lot = "0.11" -sp-application-crypto = "2.0.0" -sp-blockchain = "2.0.0" -sp-consensus = "0.8.0" -sp-core = "2.0.0" -sp-runtime = "2.0.0" +sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-keystore = "2.0.0" -sc-client-api = "2.0.0" -sc-network = "0.8.0" -sc-network-gossip = "0.8.0" +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 9170471004a3f..581e0dd5633ed 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -19,9 +19,9 @@ use std::convert::TryInto; use std::fmt::Debug; use std::sync::Arc; +use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, Stream, StreamExt}; use log::{debug, error, info, trace, warn}; -use parity_scale_codec::{Codec, Decode, Encode}; use parking_lot::Mutex; use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; @@ -32,7 +32,8 @@ use sc_network_gossip::{ use sp_application_crypto::Ss58Codec; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle as SyncOracleT; -use sp_core::{traits::BareCryptoStorePtr, Public}; +use sp_core::Public; +use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use sp_runtime::{ traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}, ConsensusEngineId, KeyTypeId, @@ -166,7 +167,7 @@ struct VoteMessage { struct BeefyWorker { local_id: Id, - key_store: BareCryptoStorePtr, + key_store: SyncCryptoStorePtr, min_interval: u32, rounds: Rounds, finality_notifications: FinalityNotifications, @@ -181,7 +182,7 @@ where { fn new( local_id: Id, - key_store: BareCryptoStorePtr, + key_store: SyncCryptoStorePtr, voters: Vec, finality_notifications: FinalityNotifications, gossip_engine: GossipEngine, @@ -233,16 +234,14 @@ where info!(target: "beefy", "Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { - let signature = match self - .key_store - .read() - .sign_with( - KEY_TYPE, - &self.local_id.to_public_crypto_pair(), - ¬ification.header.hash().encode(), - ) - .map_err(|_| ()) - .and_then(|res| res.try_into().map_err(|_| ())) + let signature = match SyncCryptoStore::sign_with( + &*self.key_store, + KEY_TYPE, + &self.local_id.to_public_crypto_pair(), + ¬ification.header.hash().encode(), + ) + .map_err(|_| ()) + .and_then(|res| res.try_into().map_err(|_| ())) { Ok(sig) => sig, Err(err) => { @@ -318,7 +317,7 @@ where pub async fn start_beefy_gadget( client: Arc, - key_store: BareCryptoStorePtr, + key_store: SyncCryptoStorePtr, network: Network, _sync_oracle: SyncOracle, ) where @@ -366,7 +365,7 @@ pub async fn start_beefy_gadget( let local_id = match voters .iter() - .find(|id| key_store.read().has_keys(&[(id.to_raw_vec(), KEY_TYPE)])) + .find(|id| SyncCryptoStore::has_keys(&*key_store, &[(id.to_raw_vec(), KEY_TYPE)])) { Some(id) => { info!(target: "beefy", "Starting BEEFY worker with local id: {:?}", id); From cbda2812a9059d97455ae67f42d4cd2736c4f8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Fri, 20 Nov 2020 15:35:49 +0000 Subject: [PATCH 005/109] Add beefy pallet (#25) * move beefy application crypto to primitives * make primitives compile under no_std * add beefy pallet that maintains authority set * add beefy pallet to node example runtime * tabify node-example cargo.toml files * use double quotes in Cargo.toml files * add missing hex-literal dependency * add runtime api to fetch BEEFY authorities * fix clippy warnings * rename beefy-pallet to pallet-beefy * sort dependencies in node-example/runtime/Cargo.toml --- client/beefy/Cargo.toml | 3 ++ client/beefy/src/lib.rs | 80 +++++++++++++---------------------------- 2 files changed, 27 insertions(+), 56 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index e21e38a899e4c..34d80fdafd40f 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -11,6 +11,9 @@ futures = "0.3" log = "0.4" parking_lot = "0.11" +beefy-primitives = { path = "../primitives" } + +sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 581e0dd5633ed..86fb110b7f65c 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -24,43 +24,25 @@ use futures::{future, FutureExt, Stream, StreamExt}; use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; +use beefy_primitives::{ + ecdsa::{AuthorityId, AuthoritySignature}, + BeefyApi, BEEFY_ENGINE_ID, KEY_TYPE, +}; + use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; use sc_network_gossip::{ GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, Validator as GossipValidator, ValidatorContext as GossipValidatorContext, }; -use sp_application_crypto::Ss58Codec; +use sp_api::{BlockId, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle as SyncOracleT; use sp_core::Public; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; -use sp_runtime::{ - traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}, - ConsensusEngineId, KeyTypeId, -}; +use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}; -pub const BEEFY_ENGINE_ID: ConsensusEngineId = *b"BEEF"; pub const BEEFY_PROTOCOL_NAME: &str = "/paritytech/beefy/1"; -/// Key type for BEEFY module. -pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"beef"); - -mod app { - use sp_application_crypto::{app_crypto, ecdsa}; - app_crypto!(ecdsa, super::KEY_TYPE); -} - -sp_application_crypto::with_pair! { - /// The BEEFY crypto scheme defined via the keypair type. - pub type AuthorityPair = app::Pair; -} - -/// Identity of a BEEFY authority. -pub type AuthorityId = app::Public; - -/// Signature for a BEEFY authority. -pub type AuthoritySignature = app::Signature; - /// Allows all gossip messages to get through. struct AllowAll { topic: Hash, @@ -231,7 +213,7 @@ where } fn handle_finality_notification(&mut self, notification: FinalityNotification) { - info!(target: "beefy", "Finality notification: {:?}", notification); + info!(target: "beefy", "🥩 Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { let signature = match SyncCryptoStore::sign_with( @@ -261,6 +243,7 @@ where self.gossip_engine .lock() .gossip_message(topic::(), message.encode(), false); + debug!(target: "beefy", "Sent vote message: {:?}", message); self.handle_vote(message.block, (message.id, message.signature)); @@ -273,7 +256,7 @@ where // TODO: validate signature let vote_added = self.rounds.add_vote(round, vote); if vote_added && self.rounds.is_done(&round) { - info!(target: "beefy", "Round {:?} concluded.", round); + info!(target: "beefy", "🥩 Round {:?} concluded.", round); self.rounds.drop(&round); } } @@ -323,7 +306,13 @@ pub async fn start_beefy_gadget( ) where Block: BlockT, Backend: BackendT, - Client: BlockchainEvents + HeaderBackend + Finalizer + Send + Sync, + Client: BlockchainEvents + + HeaderBackend + + Finalizer + + ProvideRuntimeApi + + Send + + Sync, + Client::Api: BeefyApi, Network: GossipNetwork + Clone + Send + 'static, SyncOracle: SyncOracleT + Send + 'static, { @@ -336,43 +325,22 @@ pub async fn start_beefy_gadget( }), ); - // ECDSA KEYS - // Secret phrase `history unique love spell mixed scrub expose retreat lawn jungle envelope spoon` is account: - // Secret seed: 0x996ed8439b50c50a94e5ca2254cde3d6d310f2babe39697fa51eb1bc65649fdb - // Public key (hex): 0x026a47a82cd7f0655a3bc9108fcf87c7ec444c5e2e7d44b826d9467635fe9b147e - // Account ID: 0xcba579b19a7e89087144c98b259d74465016f064ec2be5f45f2a632c2ffc1b14 - // SS58 Address: 5GfijY8EJs724J7uujqqpNtJ4R4sUZxHTSGn4zMczaLt95eY - // - // curl -H 'Content-Type: application/json' --data '{"id":1,"jsonrpc":"2.0","method":"author_insertKey","params":["beef","0x996ed8439b50c50a94e5ca2254cde3d6d310f2babe39697fa51eb1bc65649fdb","0x026a47a82cd7f0655a3bc9108fcf87c7ec444c5e2e7d44b826d9467635fe9b147e"]}' http://localhost:9933 - // - // Secret phrase `cage olympic bone detect control alert side off proud lucky rotate turkey` is account: - // Secret seed: 0x99eac69a6545d4c454c54232d8afe47dc16a8483b9d155663f52b7ccabe0d284 - // Public key (hex): 0x03df6630e91b0309fa0986fcf52f83fcf437091c58534bd2f398d6e9aeb475de82 - // Account ID: 0xa9b4c177c0d11d97a7123553d90f4ba265461c1217f544c2e787400c4a7478d6 - // SS58 Address: 5FuDePC3XmirUqSvjxziwZzop4vVN8pBkzszdabQ8Pj7oRCW - // - // curl -H 'Content-Type: application/json' --data '{"id":1,"jsonrpc":"2.0","method":"author_insertKey","params":["beef","0x99eac69a6545d4c454c54232d8afe47dc16a8483b9d155663f52b7ccabe0d284","0x03df6630e91b0309fa0986fcf52f83fcf437091c58534bd2f398d6e9aeb475de82"]}' http://localhost:9933 - - let voters = vec![ - "0x026a47a82cd7f0655a3bc9108fcf87c7ec444c5e2e7d44b826d9467635fe9b147e", - "0x03df6630e91b0309fa0986fcf52f83fcf437091c58534bd2f398d6e9aeb475de82", - ]; - - let voters = voters - .into_iter() - .map(|address| AuthorityId::from_string(address).unwrap()) - .collect::>(); + let at = BlockId::hash(client.info().best_hash); + let voters = client + .runtime_api() + .authorities(&at) + .expect("Failed to get BEEFY authorities"); let local_id = match voters .iter() .find(|id| SyncCryptoStore::has_keys(&*key_store, &[(id.to_raw_vec(), KEY_TYPE)])) { Some(id) => { - info!(target: "beefy", "Starting BEEFY worker with local id: {:?}", id); + info!(target: "beefy", "🥩 Starting BEEFY worker with local id: {:?}", id); id.clone() } None => { - info!(target: "beefy", "No local id found, not starting BEEFY worker."); + info!(target: "beefy", "🥩 No local id found, not starting BEEFY worker."); return futures::future::pending().await; } }; From 89c151d2e1f3f73cd36b284400aca40dc804f3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Mon, 23 Nov 2020 14:59:33 +0000 Subject: [PATCH 006/109] Signed commitments rpc pubsub (#26) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * move beefy application crypto to primitives * make primitives compile under no_std * add beefy pallet that maintains authority set * add beefy pallet to node example runtime * tabify node-example cargo.toml files * use double quotes in Cargo.toml files * add missing hex-literal dependency * add runtime api to fetch BEEFY authorities * fix clippy warnings * gadget: use commitment and signedcommitment * gadget: send notifications for signed commitments * gadget: add rpc pubsub for signed commitments * node-example: enable beefy rpc * gadget: fix clippy warnings * rename beefy-pallet to pallet-beefy * sort dependencies in node-example/runtime/Cargo.toml * gadget: add documentation on SignedCommitment rpc wrapper type * gadget: add todos about dummy beefy commitments * gadget: remove redundant closure Co-authored-by: Tomasz DrwiÄ™ga Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/Cargo.toml | 1 + client/beefy/rpc/Cargo.toml | 23 +++++ client/beefy/rpc/src/lib.rs | 119 ++++++++++++++++++++++ client/beefy/rpc/src/notification.rs | 38 ++++++++ client/beefy/src/lib.rs | 141 ++++++++++++++++++--------- client/beefy/src/notification.rs | 106 ++++++++++++++++++++ 6 files changed, 384 insertions(+), 44 deletions(-) create mode 100644 client/beefy/rpc/Cargo.toml create mode 100644 client/beefy/rpc/src/lib.rs create mode 100644 client/beefy/rpc/src/notification.rs create mode 100644 client/beefy/src/notification.rs diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 34d80fdafd40f..ee3ec59504c6d 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -20,6 +20,7 @@ sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "mast sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml new file mode 100644 index 0000000000000..9d65ea97e2826 --- /dev/null +++ b/client/beefy/rpc/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "beefy-gadget-rpc" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" + +[dependencies] +beefy-gadget = { path = "../." } +beefy-primitives = { path = "../../primitives" } + +codec = { version = "1.3.5", package = "parity-scale-codec", features = ["derive"] } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +jsonrpc-core = "15.1.0" +jsonrpc-core-client = "15.1.0" +jsonrpc-derive = "15.1.0" +jsonrpc-pubsub = "15.1.0" +futures = { version = "0.3.4", features = ["compat"] } +serde = { version = "1.0.105", features = ["derive"] } +serde_json = "1.0.50" +log = "0.4.8" diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs new file mode 100644 index 0000000000000..95cfae45b5826 --- /dev/null +++ b/client/beefy/rpc/src/lib.rs @@ -0,0 +1,119 @@ +// Copyright (C) 2020 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 . + +//! RPC API for BEEFY. + +#![warn(missing_docs)] + +use codec::Encode; +use futures::{StreamExt, TryStreamExt}; +use jsonrpc_core::futures::{ + future::Executor as Executor01, future::Future as Future01, sink::Sink as Sink01, stream::Stream as Stream01, +}; +use jsonrpc_derive::rpc; +use jsonrpc_pubsub::{manager::SubscriptionManager, typed::Subscriber, SubscriptionId}; +use log::warn; +use std::sync::Arc; + +mod notification; + +use sp_runtime::traits::Block as BlockT; + +use beefy_gadget::notification::BeefySignedCommitmentStream; + +/// Provides RPC methods for interacting with BEEFY. +#[allow(clippy::needless_return)] +#[rpc] +pub trait BeefyApi { + /// RPC Metadata + type Metadata; + + /// Returns the block most recently finalized by BEEFY, alongside side its justification. + #[pubsub( + subscription = "beefy_justifications", + subscribe, + name = "beefy_subscribeJustifications" + )] + fn subscribe_justifications(&self, metadata: Self::Metadata, subscriber: Subscriber); + + /// Unsubscribe from receiving notifications about recently finalized blocks. + #[pubsub( + subscription = "beefy_justifications", + unsubscribe, + name = "beefy_unsubscribeJustifications" + )] + fn unsubscribe_justifications( + &self, + metadata: Option, + id: SubscriptionId, + ) -> jsonrpc_core::Result; +} + +/// Implements the BeefyApi RPC trait for interacting with BEEFY. +pub struct BeefyRpcHandler { + signed_commitment_stream: BeefySignedCommitmentStream, + manager: SubscriptionManager, +} + +impl BeefyRpcHandler { + /// Creates a new BeefyRpcHandler instance. + pub fn new(signed_commitment_stream: BeefySignedCommitmentStream, executor: E) -> Self + where + E: Executor01 + Send>> + Send + Sync + 'static, + { + let manager = SubscriptionManager::new(Arc::new(executor)); + Self { + signed_commitment_stream, + manager, + } + } +} + +impl BeefyApi for BeefyRpcHandler +where + Block: BlockT, + Signature: Clone + Encode + Send + 'static, +{ + type Metadata = sc_rpc::Metadata; + + fn subscribe_justifications( + &self, + _metadata: Self::Metadata, + subscriber: Subscriber, + ) { + let stream = self + .signed_commitment_stream + .subscribe() + .map(|x| Ok::<_, ()>(notification::SignedCommitment::new::(x))) + .map_err(|e| warn!("Notification stream error: {:?}", e)) + .compat(); + + self.manager.add(subscriber, |sink| { + let stream = stream.map(Ok); + sink.sink_map_err(|e| warn!("Error sending notifications: {:?}", e)) + .send_all(stream) + .map(|_| ()) + }); + } + + fn unsubscribe_justifications( + &self, + _metadata: Option, + id: SubscriptionId, + ) -> jsonrpc_core::Result { + Ok(self.manager.cancel(id)) + } +} diff --git a/client/beefy/rpc/src/notification.rs b/client/beefy/rpc/src/notification.rs new file mode 100644 index 0000000000000..8e77eb2209663 --- /dev/null +++ b/client/beefy/rpc/src/notification.rs @@ -0,0 +1,38 @@ +// Copyright (C) 2020 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 codec::Encode; +use serde::{Deserialize, Serialize}; + +use sp_runtime::traits::Block as BlockT; + +/// An encoded signed commitment proving that the given header has been finalized. +/// The given bytes should be the SCALE-encoded representation of a +/// `beefy_primitives::SignedCommitment`. +#[derive(Clone, Serialize, Deserialize)] +pub struct SignedCommitment(sp_core::Bytes); + +impl SignedCommitment { + pub fn new( + signed_commitment: beefy_gadget::notification::SignedCommitment, + ) -> Self + where + Block: BlockT, + Signature: Encode, + { + SignedCommitment(signed_commitment.encode().into()) + } +} diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 86fb110b7f65c..fdc5c6b7d2a30 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -15,7 +15,7 @@ // along with this program. If not, see . use std::collections::BTreeMap; -use std::convert::TryInto; +use std::convert::{TryFrom, TryInto}; use std::fmt::Debug; use std::sync::Arc; @@ -24,10 +24,7 @@ use futures::{future, FutureExt, Stream, StreamExt}; use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; -use beefy_primitives::{ - ecdsa::{AuthorityId, AuthoritySignature}, - BeefyApi, BEEFY_ENGINE_ID, KEY_TYPE, -}; +use beefy_primitives::{BeefyApi, Commitment, SignedCommitment, BEEFY_ENGINE_ID, KEY_TYPE}; use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; use sc_network_gossip::{ @@ -35,12 +32,16 @@ use sc_network_gossip::{ ValidatorContext as GossipValidatorContext, }; use sp_api::{BlockId, ProvideRuntimeApi}; +use sp_application_crypto::{AppPublic, Public}; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle as SyncOracleT; -use sp_core::Public; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}; +pub mod notification; + +use notification::BeefySignedCommitmentSender; + pub const BEEFY_PROTOCOL_NAME: &str = "/paritytech/beefy/1"; /// Allows all gossip messages to get through. @@ -92,47 +93,60 @@ where } } -fn threshold(voters: usize) -> usize { - let faulty = voters.saturating_sub(1) / 3; - voters - faulty +fn threshold(authorities: usize) -> usize { + let faulty = authorities.saturating_sub(1) / 3; + authorities - faulty } -struct Rounds { - rounds: BTreeMap>, - voters: Vec, +struct Rounds { + rounds: BTreeMap<(Hash, Number), RoundTracker>, + authorities: Vec, } -impl Rounds +impl Rounds where Hash: Ord, + Number: Ord, { - fn new(voters: Vec) -> Self { + fn new(authorities: Vec) -> Self { Rounds { rounds: BTreeMap::new(), - voters, + authorities, } } } -impl Rounds +impl Rounds where Hash: Ord, + Number: Ord, Id: PartialEq, - Signature: PartialEq, + Signature: Clone + PartialEq, { - fn add_vote(&mut self, round: Hash, vote: (Id, Signature)) -> bool { + fn add_vote(&mut self, round: (Hash, Number), vote: (Id, Signature)) -> bool { self.rounds.entry(round).or_default().add_vote(vote) } - fn is_done(&self, round: &Hash) -> bool { + fn is_done(&self, round: &(Hash, Number)) -> bool { self.rounds .get(round) - .map(|tracker| tracker.is_done(threshold(self.voters.len()))) + .map(|tracker| tracker.is_done(threshold(self.authorities.len()))) .unwrap_or(false) } - fn drop(&mut self, round: &Hash) { - self.rounds.remove(round); + fn drop(&mut self, round: &(Hash, Number)) -> Option>> { + let signatures = self.rounds.remove(round)?.votes; + + Some( + self.authorities + .iter() + .map(|authority_id| { + signatures + .iter() + .find_map(|(id, sig)| if id == authority_id { Some(sig.clone()) } else { None }) + }) + .collect(), + ) } } @@ -141,8 +155,8 @@ fn topic() -> Block::Hash { } #[derive(Debug, Decode, Encode)] -struct VoteMessage { - block: Hash, +struct VoteMessage { + commitment: Commitment, id: Id, signature: Signature, } @@ -151,9 +165,10 @@ struct BeefyWorker { local_id: Id, key_store: SyncCryptoStorePtr, min_interval: u32, - rounds: Rounds, + rounds: Rounds, Id, Signature>, finality_notifications: FinalityNotifications, gossip_engine: Arc>>, + signed_commitment_sender: BeefySignedCommitmentSender, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, } @@ -162,12 +177,14 @@ impl BeefyWorker, + authorities: Vec, finality_notifications: FinalityNotifications, gossip_engine: GossipEngine, + signed_commitment_sender: BeefySignedCommitmentSender, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, ) -> Self { @@ -175,9 +192,10 @@ where local_id, key_store, min_interval: 2, - rounds: Rounds::new(voters), + rounds: Rounds::new(authorities), finality_notifications, gossip_engine: Arc::new(Mutex::new(gossip_engine)), + signed_commitment_sender, best_finalized_block, best_block_voted_on, } @@ -188,7 +206,7 @@ impl BeefyWorker>, + Signature: Clone + Codec + Debug + PartialEq + std::convert::TryFrom>, FinalityNotifications: Stream> + Unpin, { fn should_vote_on(&self, number: NumberFor) -> bool { @@ -213,14 +231,23 @@ where } fn handle_finality_notification(&mut self, notification: FinalityNotification) { - info!(target: "beefy", "🥩 Finality notification: {:?}", notification); + debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { + // TODO: this needs to be properly populated by signing an MMR root as the payload + // (and/or abstracting the "thing to sign") and with support for validator set changes. + let commitment = Commitment { + payload: notification.header.hash(), + block_number: notification.header.number(), + validator_set_id: 0, + is_set_transition_block: false, + }; + let signature = match SyncCryptoStore::sign_with( &*self.key_store, KEY_TYPE, &self.local_id.to_public_crypto_pair(), - ¬ification.header.hash().encode(), + &commitment.encode(), ) .map_err(|_| ()) .and_then(|res| res.try_into().map_err(|_| ())) @@ -235,7 +262,7 @@ where self.best_block_voted_on = *notification.header.number(); let message = VoteMessage { - block: notification.header.hash(), + commitment, id: self.local_id.clone(), signature, }; @@ -246,18 +273,36 @@ where debug!(target: "beefy", "Sent vote message: {:?}", message); - self.handle_vote(message.block, (message.id, message.signature)); + self.handle_vote( + (message.commitment.payload, *message.commitment.block_number), + (message.id, message.signature), + ); } self.best_finalized_block = *notification.header.number(); } - fn handle_vote(&mut self, round: Block::Hash, vote: (Id, Signature)) { + fn handle_vote(&mut self, round: (Block::Hash, NumberFor), vote: (Id, Signature)) { // TODO: validate signature let vote_added = self.rounds.add_vote(round, vote); + if vote_added && self.rounds.is_done(&round) { - info!(target: "beefy", "🥩 Round {:?} concluded.", round); - self.rounds.drop(&round); + if let Some(signatures) = self.rounds.drop(&round) { + // TODO: this needs to be properly populated by signing an MMR root as the payload + // (and/or abstracting the "thing to sign") and with support for validator set changes. + let commitment = Commitment { + payload: round.0, + block_number: round.1, + validator_set_id: 0, + is_set_transition_block: false, + }; + + let signed_commitment = SignedCommitment { commitment, signatures }; + + info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); + + self.signed_commitment_sender.notify(signed_commitment); + } } } @@ -266,7 +311,7 @@ where |notification| async move { debug!(target: "beefy", "Got vote message: {:?}", notification); - VoteMessage::::decode(&mut ¬ification.message[..]).ok() + VoteMessage::, Id, Signature>::decode(&mut ¬ification.message[..]).ok() }, )); @@ -284,7 +329,10 @@ where }, vote = votes.next() => { if let Some(vote) = vote { - self.handle_vote(vote.block, (vote.id, vote.signature)); + self.handle_vote( + (vote.commitment.payload, vote.commitment.block_number), + (vote.id, vote.signature), + ); } else { return; } @@ -298,13 +346,17 @@ where } } -pub async fn start_beefy_gadget( +pub async fn start_beefy_gadget( client: Arc, key_store: SyncCryptoStorePtr, network: Network, + signed_commitment_sender: BeefySignedCommitmentSender, _sync_oracle: SyncOracle, ) where Block: BlockT, + Pair: sp_core::Pair, + Pair::Public: AppPublic + Codec, + Pair::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, Backend: BackendT, Client: BlockchainEvents + HeaderBackend @@ -312,7 +364,7 @@ pub async fn start_beefy_gadget( + ProvideRuntimeApi + Send + Sync, - Client::Api: BeefyApi, + Client::Api: BeefyApi, Network: GossipNetwork + Clone + Send + 'static, SyncOracle: SyncOracleT + Send + 'static, { @@ -326,12 +378,12 @@ pub async fn start_beefy_gadget( ); let at = BlockId::hash(client.info().best_hash); - let voters = client + let authorities = client .runtime_api() .authorities(&at) .expect("Failed to get BEEFY authorities"); - let local_id = match voters + let local_id = match authorities .iter() .find(|id| SyncCryptoStore::has_keys(&*key_store, &[(id.to_raw_vec(), KEY_TYPE)])) { @@ -348,12 +400,13 @@ pub async fn start_beefy_gadget( let best_finalized_block = client.info().finalized_number; let best_block_voted_on = Zero::zero(); - let worker = BeefyWorker::<_, AuthorityId, AuthoritySignature, _>::new( - local_id, + let worker = BeefyWorker::<_, Pair::Public, Pair::Signature, _>::new( + local_id.clone(), key_store, - voters, + authorities, client.finality_notification_stream(), gossip_engine, + signed_commitment_sender, best_finalized_block, best_block_voted_on, ); diff --git a/client/beefy/src/notification.rs b/client/beefy/src/notification.rs new file mode 100644 index 0000000000000..33506ff886f24 --- /dev/null +++ b/client/beefy/src/notification.rs @@ -0,0 +1,106 @@ +// Copyright (C) 2020 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 parking_lot::Mutex; +use std::sync::Arc; + +use sp_runtime::traits::{Block as BlockT, NumberFor}; +use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; + +/// Stream of signed commitments returned when subscribing. +pub type SignedCommitment = + beefy_primitives::SignedCommitment, ::Hash, Signature>; + +/// Stream of signed commitments returned when subscribing. +type SignedCommitmentStream = TracingUnboundedReceiver>; + +/// Sending endpoint for notifying about signed commitments. +type SignedCommitmentSender = TracingUnboundedSender>; + +/// Collection of channel sending endpoints shared with the receiver side so they can register +/// themselves. +type SharedSignedCommitmentSenders = Arc>>>; + +/// The sending half of the signed commitment channel(s). +/// +/// Used to send notifications about signed commitments generated at the end of a BEEFY round. +#[derive(Clone)] +pub struct BeefySignedCommitmentSender { + subscribers: SharedSignedCommitmentSenders, +} + +impl BeefySignedCommitmentSender +where + Block: BlockT, + Signature: Clone, +{ + /// The `subscribers` should be shared with a corresponding `SignedCommitmentSender`. + fn new(subscribers: SharedSignedCommitmentSenders) -> Self { + Self { subscribers } + } + + /// Send out a notification to all subscribers that a new signed commitment is available for a + /// block. + pub fn notify(&self, signed_commitment: SignedCommitment) { + let mut subscribers = self.subscribers.lock(); + + // do an initial prune on closed subscriptions + subscribers.retain(|n| !n.is_closed()); + + if !subscribers.is_empty() { + subscribers.retain(|n| n.unbounded_send(signed_commitment.clone()).is_ok()); + } + } +} + +/// The receiving half of the signed commitments channel. +/// +/// Used to receive notifications about signed commitments generated at the end of a BEEFY round. +/// The `BeefySignedCommitmentStream` entity stores the `SharedSignedCommitmentSenders` so it can be +/// used to add more subscriptions. +#[derive(Clone)] +pub struct BeefySignedCommitmentStream { + subscribers: SharedSignedCommitmentSenders, +} + +impl BeefySignedCommitmentStream +where + Block: BlockT, + Signature: Clone, +{ + /// Creates a new pair of receiver and sender of signed commitment notifications. + pub fn channel() -> (BeefySignedCommitmentSender, Self) { + let subscribers = Arc::new(Mutex::new(vec![])); + let receiver = BeefySignedCommitmentStream::new(subscribers.clone()); + let sender = BeefySignedCommitmentSender::new(subscribers); + (sender, receiver) + } + + /// Create a new receiver of signed commitment notifications. + /// + /// The `subscribers` should be shared with a corresponding `BeefySignedCommitmentSender`. + fn new(subscribers: SharedSignedCommitmentSenders) -> Self { + Self { subscribers } + } + + /// Subscribe to a channel through which signed commitments are sent at the end of each BEEFY + /// voting round. + pub fn subscribe(&self) -> SignedCommitmentStream { + let (sender, receiver) = tracing_unbounded("mpsc_signed_commitments_notification_stream"); + self.subscribers.lock().push(sender); + receiver + } +} From 3a4cfa88fdbc9e1620cee9d7f735194149a59756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 23 Nov 2020 18:43:02 +0100 Subject: [PATCH 007/109] Integrate MMR and deposit root into the digest. (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add basic MMR. * Deposit digest item. * cargo fmt --all * Merge with primitives. * cargo fmt --all * Fix extra spaces. * cargo fmt --all * Switch branch. * remove stray whitespace * update to latest td-mmr commit * fix clippy error Co-authored-by: André Silva --- client/beefy/Cargo.toml | 24 ++++++++++++------------ client/beefy/rpc/Cargo.toml | 6 +++--- client/beefy/src/lib.rs | 3 +-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index ee3ec59504c6d..3b9c79b9cb175 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -13,16 +13,16 @@ parking_lot = "0.11" beefy-primitives = { path = "../primitives" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-utils = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 9d65ea97e2826..7c3a2145083e9 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -10,9 +10,9 @@ beefy-gadget = { path = "../." } beefy-primitives = { path = "../../primitives" } codec = { version = "1.3.5", package = "parity-scale-codec", features = ["derive"] } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } jsonrpc-core = "15.1.0" jsonrpc-core-client = "15.1.0" jsonrpc-derive = "15.1.0" diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index fdc5c6b7d2a30..31202fd4741d6 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -24,7 +24,7 @@ use futures::{future, FutureExt, Stream, StreamExt}; use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; -use beefy_primitives::{BeefyApi, Commitment, SignedCommitment, BEEFY_ENGINE_ID, KEY_TYPE}; +use beefy_primitives::{BeefyApi, Commitment, SignedCommitment, KEY_TYPE}; use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; use sc_network_gossip::{ @@ -370,7 +370,6 @@ pub async fn start_beefy_gadget(), From e34daeed8f566355f71bed121acc0bbca369737c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:52:10 +0000 Subject: [PATCH 008/109] use new mmr root as commitment payload (#27) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use new mmr root as commitment payload * fix mmr root codec index * warn on MMR root digest not found Co-authored-by: Tomasz DrwiÄ™ga * add type alias for MMR root hash Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/src/lib.rs | 45 ++++++++++++++++++++++++-------- client/beefy/src/notification.rs | 2 +- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 31202fd4741d6..144bd1605bfb0 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -24,7 +24,7 @@ use futures::{future, FutureExt, Stream, StreamExt}; use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; -use beefy_primitives::{BeefyApi, Commitment, SignedCommitment, KEY_TYPE}; +use beefy_primitives::{BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, BEEFY_ENGINE_ID, KEY_TYPE}; use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; use sc_network_gossip::{ @@ -36,7 +36,10 @@ use sp_application_crypto::{AppPublic, Public}; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle as SyncOracleT; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; -use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}; +use sp_runtime::{ + generic::OpaqueDigestItemId, + traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}, +}; pub mod notification; @@ -165,7 +168,7 @@ struct BeefyWorker { local_id: Id, key_store: SyncCryptoStorePtr, min_interval: u32, - rounds: Rounds, Id, Signature>, + rounds: Rounds, Id, Signature>, finality_notifications: FinalityNotifications, gossip_engine: Arc>>, signed_commitment_sender: BeefySignedCommitmentSender, @@ -231,13 +234,20 @@ where } fn handle_finality_notification(&mut self, notification: FinalityNotification) { - debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); + debug!(target: "beefy", "Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { - // TODO: this needs to be properly populated by signing an MMR root as the payload - // (and/or abstracting the "thing to sign") and with support for validator set changes. + let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { + hash + } else { + warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); + return; + }; + + // TODO: this needs added support for validator set changes (and abstracting the + // "thing to sign" would be nice). let commitment = Commitment { - payload: notification.header.hash(), + payload: mmr_root, block_number: notification.header.number(), validator_set_id: 0, is_set_transition_block: false, @@ -282,14 +292,14 @@ where self.best_finalized_block = *notification.header.number(); } - fn handle_vote(&mut self, round: (Block::Hash, NumberFor), vote: (Id, Signature)) { + fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (Id, Signature)) { // TODO: validate signature let vote_added = self.rounds.add_vote(round, vote); if vote_added && self.rounds.is_done(&round) { if let Some(signatures) = self.rounds.drop(&round) { - // TODO: this needs to be properly populated by signing an MMR root as the payload - // (and/or abstracting the "thing to sign") and with support for validator set changes. + // TODO: this needs added support for validator set changes (and abstracting the + // "thing to sign" would be nice). let commitment = Commitment { payload: round.0, block_number: round.1, @@ -311,7 +321,7 @@ where |notification| async move { debug!(target: "beefy", "Got vote message: {:?}", notification); - VoteMessage::, Id, Signature>::decode(&mut ¬ification.message[..]).ok() + VoteMessage::, Id, Signature>::decode(&mut ¬ification.message[..]).ok() }, )); @@ -413,6 +423,19 @@ pub async fn start_beefy_gadget(header: &Block::Header) -> Option +where + Id: Codec, +{ + header.digest().logs().iter().find_map(|log| { + match log.try_to::>(OpaqueDigestItemId::Consensus(&BEEFY_ENGINE_ID)) { + Some(ConsensusLog::MmrRoot(root)) => Some(root), + _ => None, + } + }) +} + #[cfg(test)] mod tests { #[test] diff --git a/client/beefy/src/notification.rs b/client/beefy/src/notification.rs index 33506ff886f24..be034442626fa 100644 --- a/client/beefy/src/notification.rs +++ b/client/beefy/src/notification.rs @@ -22,7 +22,7 @@ use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnbound /// Stream of signed commitments returned when subscribing. pub type SignedCommitment = - beefy_primitives::SignedCommitment, ::Hash, Signature>; + beefy_primitives::SignedCommitment, beefy_primitives::MmrRootHash, Signature>; /// Stream of signed commitments returned when subscribing. type SignedCommitmentStream = TracingUnboundedReceiver>; From 0b8fb24f604f228f4df0dd7433bd2e0a7c1a1f7b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Dec 2020 03:16:23 +0000 Subject: [PATCH 009/109] Bump serde_json from 1.0.59 to 1.0.60 (#28) --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 7c3a2145083e9..cd443b23e49b9 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -19,5 +19,5 @@ jsonrpc-derive = "15.1.0" jsonrpc-pubsub = "15.1.0" futures = { version = "0.3.4", features = ["compat"] } serde = { version = "1.0.105", features = ["derive"] } -serde_json = "1.0.50" +serde_json = "1.0.60" log = "0.4.8" From 7aef40cebe5e56f487fa1cd0708f9528d4b6498a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Fri, 11 Dec 2020 14:36:33 +0100 Subject: [PATCH 010/109] Update to latest substrate. (#32) * Update to latest substrate. * Fix tests. * cargo fmt --all * Switch to master. --- client/beefy/Cargo.toml | 24 ++++++++++++------------ client/beefy/rpc/Cargo.toml | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 3b9c79b9cb175..ee3ec59504c6d 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -13,16 +13,16 @@ parking_lot = "0.11" beefy-primitives = { path = "../primitives" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-utils = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index cd443b23e49b9..41e2195d7c59b 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -10,9 +10,9 @@ beefy-gadget = { path = "../." } beefy-primitives = { path = "../../primitives" } codec = { version = "1.3.5", package = "parity-scale-codec", features = ["derive"] } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "td-mmr" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } jsonrpc-core = "15.1.0" jsonrpc-core-client = "15.1.0" jsonrpc-derive = "15.1.0" From 4b021a2b53e80bcc74510d0b6feea30cad48d1f6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 14 Dec 2020 13:26:49 +0100 Subject: [PATCH 011/109] Bump serde from 1.0.117 to 1.0.118 (#29) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump serde from 1.0.117 to 1.0.118 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.117 to 1.0.118. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.117...v1.0.118) Signed-off-by: dependabot-preview[bot] * Bump arc-swap. Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Tomasz DrwiÄ™ga Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 41e2195d7c59b..dd68db25a5d7f 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -18,6 +18,6 @@ jsonrpc-core-client = "15.1.0" jsonrpc-derive = "15.1.0" jsonrpc-pubsub = "15.1.0" futures = { version = "0.3.4", features = ["compat"] } -serde = { version = "1.0.105", features = ["derive"] } +serde = { version = "1.0.118", features = ["derive"] } serde_json = "1.0.60" log = "0.4.8" From 741eb29f41520294a2d687269db0a03ecce99d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 4 Jan 2021 15:13:05 +0100 Subject: [PATCH 012/109] Remove transition flag (#35) * Get rid of is_set_transition_flag * Fix tests. * cargo fmt --all --- client/beefy/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 144bd1605bfb0..0729178149f54 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -250,7 +250,6 @@ where payload: mmr_root, block_number: notification.header.number(), validator_set_id: 0, - is_set_transition_block: false, }; let signature = match SyncCryptoStore::sign_with( @@ -304,7 +303,6 @@ where payload: round.0, block_number: round.1, validator_set_id: 0, - is_set_transition_block: false, }; let signed_commitment = SignedCommitment { commitment, signatures }; From 04faa42a440faef0cc87a0fb94169718d4dc14c3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 Jan 2021 03:04:40 +0000 Subject: [PATCH 013/109] Bump futures from 0.3.9 to 0.3.12 (#50) --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index dd68db25a5d7f..d44d5c7bd2bd9 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -17,7 +17,7 @@ jsonrpc-core = "15.1.0" jsonrpc-core-client = "15.1.0" jsonrpc-derive = "15.1.0" jsonrpc-pubsub = "15.1.0" -futures = { version = "0.3.4", features = ["compat"] } +futures = { version = "0.3.12", features = ["compat"] } serde = { version = "1.0.118", features = ["derive"] } serde_json = "1.0.60" log = "0.4.8" From d81a358febcda94a9f0b602cc6fe02e587900727 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 18 Jan 2021 03:04:43 +0000 Subject: [PATCH 014/109] Bump log from 0.4.11 to 0.4.13 (#52) --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index d44d5c7bd2bd9..53743ca5be1ab 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -20,4 +20,4 @@ jsonrpc-pubsub = "15.1.0" futures = { version = "0.3.12", features = ["compat"] } serde = { version = "1.0.118", features = ["derive"] } serde_json = "1.0.60" -log = "0.4.8" +log = "0.4.13" From a1ed94a455d3850a89db0eb64d1ccfe49c66b30a Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 18 Jan 2021 17:33:48 +0100 Subject: [PATCH 015/109] Bump Substrate and Deps (#57) --- client/beefy/rpc/Cargo.toml | 4 ++-- client/beefy/src/lib.rs | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 53743ca5be1ab..3c4f6185e08c2 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -18,6 +18,6 @@ jsonrpc-core-client = "15.1.0" jsonrpc-derive = "15.1.0" jsonrpc-pubsub = "15.1.0" futures = { version = "0.3.12", features = ["compat"] } -serde = { version = "1.0.118", features = ["derive"] } -serde_json = "1.0.60" +serde = { version = "1.0.119", features = ["derive"] } +serde_json = "1.0.61" log = "0.4.13" diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 0729178149f54..ba455eeb2ebd3 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -382,6 +382,7 @@ pub async fn start_beefy_gadget(), }), + None, ); let at = BlockId::hash(client.info().best_hash); @@ -433,11 +434,3 @@ where } }) } - -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - assert_eq!(2 + 2, 4); - } -} From e1f86a49b3bcb2e4845400b578579fcbf32bce9f Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Tue, 19 Jan 2021 18:58:28 +0100 Subject: [PATCH 016/109] Update README (#58) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update README * Apply suggestions from code review Co-authored-by: Tomasz DrwiÄ™ga * address review comments * missed a typo Co-authored-by: Tomasz DrwiÄ™ga --- frame/beefy/Cargo.toml | 31 +++++++++++ frame/beefy/src/lib.rs | 121 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 frame/beefy/Cargo.toml create mode 100644 frame/beefy/src/lib.rs diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml new file mode 100644 index 0000000000000..0fa5e717c6af6 --- /dev/null +++ b/frame/beefy/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "pallet-beefy" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" + +[dependencies] +codec = { version = "1.3.5", package = "parity-scale-codec", default-features = false, features = ["derive"] } +serde = { version = "1.0.119", optional = true } + +beefy-primitives = { path = "../primitives", default-features = false } + +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +[features] +default = ["std"] +std = [ + "codec/std", + "serde", + "beefy-primitives/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "pallet-session/std", +] diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs new file mode 100644 index 0000000000000..51e16c0772c9a --- /dev/null +++ b/frame/beefy/src/lib.rs @@ -0,0 +1,121 @@ +// Copyright (C) 2020 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 . + +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::Encode; + +use beefy_primitives::{AuthorityIndex, ConsensusLog, BEEFY_ENGINE_ID}; +use frame_support::{decl_module, decl_storage, Parameter}; +use sp_runtime::{ + generic::DigestItem, + traits::{IsMember, Member}, + RuntimeAppPublic, +}; +use sp_std::prelude::*; + +pub trait Config: frame_system::Config { + /// The identifier type for an authority. + type AuthorityId: Member + Parameter + RuntimeAppPublic + Default; +} + +decl_storage! { + trait Store for Module as Beefy { + /// The current list of authorities. + pub Authorities get(fn authorities): Vec; + /// Authorities scheduled for the next session. + pub NextAuthorities get(fn next_authorities): Vec; + } + add_extra_genesis { + config(authorities): Vec; + build(|config| Module::::initialize_authorities(&config.authorities)) + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { } +} + +impl Module { + fn change_authorities(new: Vec, queued: Vec) { + // As in GRANDPA, we don't trigger validator set change if the set actually + // remains the same. + if new != Self::authorities() { + >::put(&new); + let log: DigestItem = + DigestItem::Consensus(BEEFY_ENGINE_ID, ConsensusLog::AuthoritiesChange(new).encode()); + >::deposit_log(log); + } + + >::put(&queued); + } + + fn initialize_authorities(authorities: &[T::AuthorityId]) { + if !authorities.is_empty() { + assert!( + >::get().is_empty(), + "Authorities are already initialized!" + ); + >::put(authorities); + // for consistency we initialize the next validator set as well. + // Note it's an assumption in the `pallet_session` as well. + >::put(authorities); + } + } +} + +impl sp_runtime::BoundToRuntimeAppPublic for Module { + type Public = T::AuthorityId; +} + +impl pallet_session::OneSessionHandler for Module { + type Key = T::AuthorityId; + + fn on_genesis_session<'a, I: 'a>(validators: I) + where + I: Iterator, + { + let authorities = validators.map(|(_, k)| k).collect::>(); + Self::initialize_authorities(&authorities); + } + + fn on_new_session<'a, I: 'a>(changed: bool, validators: I, queued_validators: I) + where + I: Iterator, + { + if changed { + let next_authorities = validators.map(|(_, k)| k).collect::>(); + let next_queued_authorities = queued_validators.map(|(_, k)| k).collect::>(); + + Self::change_authorities(next_authorities, next_queued_authorities); + } + } + + fn on_disabled(i: usize) { + let log: DigestItem = DigestItem::Consensus( + BEEFY_ENGINE_ID, + ConsensusLog::::OnDisabled(i as AuthorityIndex).encode(), + ); + + >::deposit_log(log); + } +} + +impl IsMember for Module { + fn is_member(authority_id: &T::AuthorityId) -> bool { + Self::authorities().iter().any(|id| id == authority_id) + } +} From 4f9bd95de78a4f6a3ab142368671219a955db062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Fri, 22 Jan 2021 17:39:12 +0100 Subject: [PATCH 017/109] Add validator set to the pallet. (#65) --- frame/beefy/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index 51e16c0772c9a..ff4f9c2dddd4c 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -36,6 +36,8 @@ decl_storage! { trait Store for Module as Beefy { /// The current list of authorities. pub Authorities get(fn authorities): Vec; + /// The current validator set id. + pub ValidatorSetId get(fn validator_set_id): beefy_primitives::ValidatorSetId; /// Authorities scheduled for the next session. pub NextAuthorities get(fn next_authorities): Vec; } @@ -55,6 +57,7 @@ impl Module { // remains the same. if new != Self::authorities() { >::put(&new); + ::put(Self::validator_set_id() + 1); let log: DigestItem = DigestItem::Consensus(BEEFY_ENGINE_ID, ConsensusLog::AuthoritiesChange(new).encode()); >::deposit_log(log); @@ -70,6 +73,7 @@ impl Module { "Authorities are already initialized!" ); >::put(authorities); + ::put(0); // for consistency we initialize the next validator set as well. // Note it's an assumption in the `pallet_session` as well. >::put(authorities); From 7bd2795f90b6a09694fa46a850b270592fb1ac89 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 25 Jan 2021 15:36:49 +0100 Subject: [PATCH 018/109] Bump Substrate and Deps (#71) * Bump Substrate and Deps * pin serde and syn * bump Substrate again for '__Nonexhaustive' fix * add cargo deny ignore --- client/beefy/Cargo.lock | 4321 --------------------------------------- 1 file changed, 4321 deletions(-) delete mode 100644 client/beefy/Cargo.lock diff --git a/client/beefy/Cargo.lock b/client/beefy/Cargo.lock deleted file mode 100644 index 101228bed64d0..0000000000000 --- a/client/beefy/Cargo.lock +++ /dev/null @@ -1,4321 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[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.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - -[[package]] -name = "aead" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" -dependencies = [ - "generic-array 0.14.4", -] - -[[package]] -name = "aes" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" -dependencies = [ - "aes-soft", - "aesni", - "block-cipher", -] - -[[package]] -name = "aes-gcm" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" -dependencies = [ - "aead", - "aes", - "block-cipher", - "ghash", - "subtle 2.3.0", -] - -[[package]] -name = "aes-soft" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" -dependencies = [ - "block-cipher", - "byteorder", - "opaque-debug 0.2.3", -] - -[[package]] -name = "aesni" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" -dependencies = [ - "block-cipher", - "opaque-debug 0.2.3", -] - -[[package]] -name = "ahash" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3" -dependencies = [ - "const-random", -] - -[[package]] -name = "ahash" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" - -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -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.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" - -[[package]] -name = "arc-swap" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" - -[[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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" - -[[package]] -name = "asn1_der" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" -dependencies = [ - "asn1_der_derive", -] - -[[package]] -name = "asn1_der_derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "async-channel" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21279cfaa4f47df10b1816007e738ca3747ef2ee53ffc51cdbf57a8bb266fee3" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801" -dependencies = [ - "async-task 4.0.2", - "concurrent-queue", - "fastrand", - "futures-lite", - "once_cell", - "vec-arena", -] - -[[package]] -name = "async-global-executor" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5586e693d02f9b439742e9d5d68bd64d923c6861954f7d78f91001a0e152d589" -dependencies = [ - "async-executor", - "async-io", - "futures-lite", - "num_cpus", - "once_cell", -] - -[[package]] -name = "async-io" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33be191d05a54ec120e4667375e2ad49fe506b846463df384460ab801c7ae5dc" -dependencies = [ - "concurrent-queue", - "fastrand", - "futures-lite", - "log", - "nb-connect", - "once_cell", - "parking", - "polling", - "vec-arena", - "waker-fn", -] - -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-std" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c92085acfce8b32e5b261d0b59b8f3309aee69fea421ea3f271f8b93225754f" -dependencies = [ - "async-global-executor", - "async-io", - "async-mutex", - "async-task 3.0.0", - "blocking", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "num_cpus", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-task" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" - -[[package]] -name = "async-task" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ab27c1aa62945039e44edaeee1dc23c74cc0c303dd5fe0fb462a184f1c3a518" - -[[package]] -name = "async-tls" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634" -dependencies = [ - "futures", - "rustls", - "webpki", - "webpki-roots 0.19.0", -] - -[[package]] -name = "async-trait" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "687c230d85c0a52504709705fc8a53e4a692b83a2184f03dae73e38e1e93a783" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atomic" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f46ca51dca4837f1520754d1c8c36636356b81553d928dc9c177025369a06e" - -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "backtrace" -version = "0.3.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base58" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "bitvec" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" -dependencies = [ - "either", - "radium", -] - -[[package]] -name = "blake2" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84ce5b6108f8e154604bd4eb76a2f726066c3464d5a552a4229262a18c9bb471" -dependencies = [ - "byte-tools", - "byteorder", - "crypto-mac 0.8.0", - "digest 0.9.0", - "opaque-debug 0.2.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.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" -dependencies = [ - "arrayref", - "arrayvec 0.5.1", - "constant_time_eq", -] - -[[package]] -name = "blake2s_simd" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9e07352b829279624ceb7c64adb4f585dacdb81d35cafae81139ccd617cf44" -dependencies = [ - "arrayref", - "arrayvec 0.5.1", - "constant_time_eq", -] - -[[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.3", -] - -[[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.4", -] - -[[package]] -name = "block-cipher" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" -dependencies = [ - "generic-array 0.14.4", -] - -[[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.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2640778f8053e72c11f621b0a5175a0560a269282aa98ed85107773ab8e2a556" -dependencies = [ - "async-channel", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", - "waker-fn", -] - -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "bumpalo" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "byte-slice-cast" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" - -[[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.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - -[[package]] -name = "c_linked_list" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" - -[[package]] -name = "cache-padded" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" - -[[package]] -name = "cc" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "chacha20" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c0f07ac275808b7bf9a39f2fd013aae1498be83632814c8c4e0bd53f2dc58" -dependencies = [ - "stream-cipher", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18b0c90556d8e3fec7cf18d84a2f53d27b21288f2fe481b830fadcf809e48205" -dependencies = [ - "aead", - "chacha20", - "poly1305", - "stream-cipher", - "zeroize", -] - -[[package]] -name = "chrono" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d021fddb7bd3e734370acfa4a83f34095571d8570c039f1420d77540f68d5772" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "time", - "winapi 0.3.9", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - -[[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 = "const-random" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f1af9ac737b2dd2d577701e59fd09ba34822f6f2ebdb30a7647405d9e55e16a" -dependencies = [ - "const-random-macro", - "proc-macro-hack", -] - -[[package]] -name = "const-random-macro" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25e4c606eb459dd29f7c57b2e0879f2b6f14ee130918c2b78ccb58a9624e6c7a" -dependencies = [ - "getrandom", - "proc-macro-hack", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg 1.0.1", - "cfg-if", - "lazy_static", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-mac" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -dependencies = [ - "generic-array 0.12.3", - "subtle 1.0.0", -] - -[[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.4", - "subtle 2.3.0", -] - -[[package]] -name = "curve25519-dalek" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" -dependencies = [ - "byteorder", - "digest 0.8.1", - "rand_core", - "subtle 2.3.0", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", - "subtle 2.3.0", - "zeroize", -] - -[[package]] -name = "data-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d0e2d24e5ee3b23a01de38eefdcd978907890701f08ffffd4cb457ca4ee8d6" - -[[package]] -name = "derive_more" -version = "0.99.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dcfabdab475c16a93d669dddfc393027803e347d09663f524447f642fbb84ba" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.3", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.4", -] - -[[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 = "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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c53dc3a653e0f64081026e4bf048d48fec9fce90c66e8326ca7292df0ff2d82" - -[[package]] -name = "ed25519" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07dfc993ea376e864fe29a4099a61ca0bb994c6d7745a61bf60ddb3d64e05237" -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.0.0", - "ed25519", - "rand", - "serde", - "sha2 0.9.1", - "zeroize", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "environmental" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4" - -[[package]] -name = "erased-serde" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ca8b296792113e1500fd935ae487be6e00ce318952a6880555554824d6ebf38" -dependencies = [ - "serde", -] - -[[package]] -name = "event-listener" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" - -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fastrand" -version = "1.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c85295147490b8fcf2ea3d104080a105a8b2c63f9c319e82c02d8e952388919" - -[[package]] -name = "fixed-hash" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" -dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fixedbitset" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" - -[[package]] -name = "flate2" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" -dependencies = [ - "cfg-if", - "crc32fast", - "libc", - "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 = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98d7f1c606d158d5af4479f2971f259d8dd262f03f6f7b5b37e92eec7b8de396" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "futures" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" - -[[package]] -name = "futures-executor" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" - -[[package]] -name = "futures-lite" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0db18c5f58083b54b0c416638ea73066722c2815c1e54dd8ba85ee3def593c3a" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - -[[package]] -name = "futures-macro" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd" - -[[package]] -name = "futures-task" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94" -dependencies = [ - "once_cell", -] - -[[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.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - -[[package]] -name = "futures_codec" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" -dependencies = [ - "bytes", - "futures", - "memchr", - "pin-project", -] - -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" - -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "get_if_addrs" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abddb55a898d32925f3148bd281174a68eeb68bbfd9a5938a57b18f506ee4ef7" -dependencies = [ - "c_linked_list", - "get_if_addrs-sys", - "libc", - "winapi 0.2.8", -] - -[[package]] -name = "get_if_addrs-sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48" -dependencies = [ - "gcc", - "libc", -] - -[[package]] -name = "getrandom" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "ghash" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" -dependencies = [ - "polyval", -] - -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" - -[[package]] -name = "gloo-timers" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "h2" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[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.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" -dependencies = [ - "ahash 0.2.18", - "autocfg 0.1.7", -] - -[[package]] -name = "hashbrown" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" -dependencies = [ - "ahash 0.3.8", - "autocfg 1.0.1", -] - -[[package]] -name = "hashbrown" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" - -[[package]] -name = "hex-literal" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5af1f635ef1bc545d78392b136bfe1c9809e029023c84a3638a864a10b8819c8" - -[[package]] -name = "hmac" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" -dependencies = [ - "crypto-mac 0.7.0", - "digest 0.8.1", -] - -[[package]] -name = "hmac-drbg" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" -dependencies = [ - "digest 0.8.1", - "generic-array 0.12.3", - "hmac", -] - -[[package]] -name = "http" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "httparse" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" - -[[package]] -name = "httpdate" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" - -[[package]] -name = "hyper" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "idna" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "impl-codec" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-serde" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "indexmap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" -dependencies = [ - "autocfg 1.0.1", - "hashbrown 0.9.0", -] - -[[package]] -name = "instant" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" -dependencies = [ - "cfg-if", -] - -[[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 = "ip_network" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee15951c035f79eddbef745611ec962f63f4558f1dadf98ab723cc603487c6f" - -[[package]] -name = "ipnet" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" - -[[package]] -name = "itertools" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "js-sys" -version = "0.3.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" - -[[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.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a" -dependencies = [ - "parity-util-mem", - "smallvec 1.4.2", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" - -[[package]] -name = "libp2p" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f5a4604c1a40d75651da141dfde29ad15329f537a779528803297d2220274" -dependencies = [ - "atomic", - "bytes", - "futures", - "lazy_static", - "libp2p-core", - "libp2p-core-derive", - "libp2p-dns", - "libp2p-identify", - "libp2p-kad", - "libp2p-mdns", - "libp2p-mplex", - "libp2p-noise", - "libp2p-ping", - "libp2p-request-response", - "libp2p-swarm", - "libp2p-tcp", - "libp2p-wasm-ext", - "libp2p-websocket", - "libp2p-yamux", - "multihash", - "parity-multiaddr", - "parking_lot 0.10.2", - "pin-project", - "smallvec 1.4.2", - "wasm-timer", -] - -[[package]] -name = "libp2p-core" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f13ba8c7df0768af2eb391696d562c7de88cc3a35122531aaa6a7d77754d25" -dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", - "either", - "fnv", - "futures", - "futures-timer", - "lazy_static", - "libsecp256k1", - "log", - "multihash", - "multistream-select", - "parity-multiaddr", - "parking_lot 0.10.2", - "pin-project", - "prost", - "prost-build", - "rand", - "ring", - "rw-stream-sink", - "sha2 0.8.2", - "smallvec 1.4.2", - "thiserror", - "unsigned-varint 0.4.0", - "void", - "zeroize", -] - -[[package]] -name = "libp2p-core-derive" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "libp2p-dns" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cf319822e08dd65c8e060d2354e9f952895bbc433f5706c75ed010c152aee5e" -dependencies = [ - "futures", - "libp2p-core", - "log", -] - -[[package]] -name = "libp2p-identify" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56396ee63aa9164eacf40c2c5d2bda8c4133c2f57e1b0425d51d3a4e362583b1" -dependencies = [ - "futures", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "smallvec 1.4.2", - "wasm-timer", -] - -[[package]] -name = "libp2p-kad" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7fa9047f8b8f544278a35c2d9d45d3b2c1785f2d86d4e1629d6edf97be3955" -dependencies = [ - "arrayvec 0.5.1", - "bytes", - "either", - "fnv", - "futures", - "futures_codec", - "libp2p-core", - "libp2p-swarm", - "log", - "multihash", - "prost", - "prost-build", - "rand", - "sha2 0.8.2", - "smallvec 1.4.2", - "uint", - "unsigned-varint 0.4.0", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-mdns" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3173b5a6b2f690c29ae07798d85b9441a131ac76ddae9015ef22905b623d0c69" -dependencies = [ - "async-std", - "data-encoding", - "dns-parser", - "either", - "futures", - "lazy_static", - "libp2p-core", - "libp2p-swarm", - "log", - "net2", - "rand", - "smallvec 1.4.2", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-mplex" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a73a799cc8410b36e40b8f4c4b6babbcb9efd3727111bf517876e4acfa612d3" -dependencies = [ - "bytes", - "fnv", - "futures", - "futures_codec", - "libp2p-core", - "log", - "parking_lot 0.10.2", - "unsigned-varint 0.4.0", -] - -[[package]] -name = "libp2p-noise" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef6c490042f549fb1025f2892dfe6083d97a77558f450c1feebe748ca9eb15a" -dependencies = [ - "bytes", - "curve25519-dalek 2.1.0", - "futures", - "lazy_static", - "libp2p-core", - "log", - "prost", - "prost-build", - "rand", - "sha2 0.8.2", - "snow", - "static_assertions", - "x25519-dalek", - "zeroize", -] - -[[package]] -name = "libp2p-ping" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad063c21dfcea4518ac9e8bd4119d33a5b26c41e674f602f41f05617a368a5c8" -dependencies = [ - "futures", - "libp2p-core", - "libp2p-swarm", - "log", - "rand", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-request-response" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0c9e8a4cd69d97e9646c54313d007512f411aba8c5226cfcda16df6a6e84a3" -dependencies = [ - "async-trait", - "bytes", - "futures", - "libp2p-core", - "libp2p-swarm", - "log", - "lru 0.6.0", - "minicbor", - "rand", - "smallvec 1.4.2", - "unsigned-varint 0.5.1", - "wasm-timer", -] - -[[package]] -name = "libp2p-swarm" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7193e444210132237b81b755ec7fe53f1c4bd2f53cf719729b94c0c72eb6eaa1" -dependencies = [ - "either", - "futures", - "libp2p-core", - "log", - "rand", - "smallvec 1.4.2", - "void", - "wasm-timer", -] - -[[package]] -name = "libp2p-tcp" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f42ec130d7a37a7e47bf4398026b7ad9185c08ed26972e2720f8b94112796f" -dependencies = [ - "async-std", - "futures", - "futures-timer", - "get_if_addrs", - "ipnet", - "libp2p-core", - "log", - "socket2", -] - -[[package]] -name = "libp2p-wasm-ext" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34c1faac6f92c21fbe155417957863ea822fba9e9fd5eb24c0912336a100e63f" -dependencies = [ - "futures", - "js-sys", - "libp2p-core", - "parity-send-wrapper", - "wasm-bindgen", - "wasm-bindgen-futures", -] - -[[package]] -name = "libp2p-websocket" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d650534ebd99f48f6fa292ed5db10d30df2444943afde4407ceeddab8e513fca" -dependencies = [ - "async-tls", - "either", - "futures", - "libp2p-core", - "log", - "quicksink", - "rustls", - "rw-stream-sink", - "soketto", - "url", - "webpki", - "webpki-roots 0.18.0", -] - -[[package]] -name = "libp2p-yamux" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781d9b9f043dcdabc40640807125368596b849fd4d96cdca2dcf052fdf6f33fd" -dependencies = [ - "futures", - "libp2p-core", - "parking_lot 0.11.0", - "thiserror", - "yamux", -] - -[[package]] -name = "libsecp256k1" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" -dependencies = [ - "arrayref", - "crunchy", - "digest 0.8.1", - "hmac-drbg", - "rand", - "sha2 0.8.2", - "subtle 2.3.0", - "typenum", -] - -[[package]] -name = "libz-sys" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" - -[[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 = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "lock_api" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "lru" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0609345ddee5badacf857d4f547e0e5a2e987db77085c24cd887f73573a04237" -dependencies = [ - "hashbrown 0.6.3", -] - -[[package]] -name = "lru" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111b945ac72ec09eb7bc62a0fbdc3cc6e80555a7245f52a69d3921a75b53b153" -dependencies = [ - "hashbrown 0.8.2", -] - -[[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.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memory-db" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a" -dependencies = [ - "hash-db", - "hashbrown 0.8.2", - "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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" -dependencies = [ - "byteorder", - "keccak", - "rand_core", - "zeroize", -] - -[[package]] -name = "minicbor" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc03ad6f8f548db7194a5ff5a6f96342ecae4e3ef67d2bf18bacc0e245cd041" -dependencies = [ - "minicbor-derive", -] - -[[package]] -name = "minicbor-derive" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c214bf3d90099b52f3e4b328ae0fe34837fd0fab683ad1e10fceb4629106df48" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" -dependencies = [ - "adler", - "autocfg 1.0.1", -] - -[[package]] -name = "multihash" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567122ab6492f49b59def14ecc36e13e64dca4188196dd0cd41f9f3f979f3df6" -dependencies = [ - "blake2b_simd", - "blake2s_simd", - "digest 0.9.0", - "sha-1", - "sha2 0.9.1", - "sha3", - "unsigned-varint 0.5.1", -] - -[[package]] -name = "multimap" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" - -[[package]] -name = "multistream-select" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9157e87afbc2ef0d84cc0345423d715f445edde00141c93721c162de35a05e5" -dependencies = [ - "bytes", - "futures", - "log", - "pin-project", - "smallvec 1.4.2", - "unsigned-varint 0.4.0", -] - -[[package]] -name = "nb-connect" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e847c76b390f44529c2071ef06d0b52fbb4bdb04cc8987a5cfa63954c000abca" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "net2" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.9", -] - -[[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 = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg 1.0.1", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -dependencies = [ - "autocfg 1.0.1", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg 1.0.1", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" -dependencies = [ - "autocfg 1.0.1", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" - -[[package]] -name = "once_cell" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" -dependencies = [ - "parking_lot 0.11.0", -] - -[[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 = "parity-multiaddr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2165a93382a93de55868dcbfa11e4a8f99676a9164eee6a2b4a9479ad319c257" -dependencies = [ - "arrayref", - "bs58", - "byteorder", - "data-encoding", - "multihash", - "percent-encoding", - "serde", - "static_assertions", - "unsigned-varint 0.4.0", - "url", -] - -[[package]] -name = "parity-scale-codec" -version = "1.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c740e5fbcb6847058b40ac7e5574766c6388f585e184d769910fe0d3a2ca861" -dependencies = [ - "arrayvec 0.5.1", - "bitvec", - "byte-slice-cast", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198db82bb1c18fc00176004462dd809b2a6d851669550aa17af6dacd21ae0c14" -dependencies = [ - "proc-macro-crate", - "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-util-mem" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c" -dependencies = [ - "cfg-if", - "hashbrown 0.8.2", - "impl-trait-for-tuples", - "parity-util-mem-derive", - "parking_lot 0.10.2", - "primitive-types", - "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.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" - -[[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.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", -] - -[[package]] -name = "parking_lot" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" -dependencies = [ - "instant", - "lock_api 0.4.1", - "parking_lot_core 0.8.0", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if", - "cloudabi 0.0.3", - "libc", - "redox_syscall", - "smallvec 1.4.2", - "winapi 0.3.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if", - "cloudabi 0.1.0", - "instant", - "libc", - "redox_syscall", - "smallvec 1.4.2", - "winapi 0.3.9", -] - -[[package]] -name = "paste" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -dependencies = [ - "paste-impl", - "proc-macro-hack", -] - -[[package]] -name = "paste-impl" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -dependencies = [ - "proc-macro-hack", -] - -[[package]] -name = "pbkdf2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" -dependencies = [ - "byteorder", - "crypto-mac 0.7.0", -] - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "petgraph" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "pin-project" -version = "0.4.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f48fad7cfbff853437be7cf54d7b993af21f53be7f0988cbfe4a51535aa77205" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24c6d293bdd3ca5a1697997854c6cf7855e43fb6a0ba1c47af57a5bcafd158ae" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71f349a4f0e70676ffb2dbafe16d0c992382d02f0a952e3ddf584fc289dac6b3" - -[[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.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" - -[[package]] -name = "polling" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0720e0b9ea9d52451cf29d3413ba8a9303f8815d9d9653ef70e03ff73e65566" -dependencies = [ - "cfg-if", - "libc", - "log", - "wepoll-sys-stjepang", - "winapi 0.3.9", -] - -[[package]] -name = "poly1305" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b42192ab143ed7619bf888a7f9c6733a9a2153b218e2cd557cfdb52fbf9bb1" -dependencies = [ - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc" -dependencies = [ - "cfg-if", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" - -[[package]] -name = "primitive-types" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-serde", - "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-hack" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" - -[[package]] -name = "proc-macro-nested" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" - -[[package]] -name = "proc-macro2" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "prometheus" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d70cf4412832bcac9cffe27906f4a66e450d323525e977168c70d1b36120ae" -dependencies = [ - "cfg-if", - "fnv", - "lazy_static", - "parking_lot 0.11.0", - "regex", - "thiserror", -] - -[[package]] -name = "prost" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" -dependencies = [ - "bytes", - "heck", - "itertools", - "log", - "multimap", - "petgraph", - "prost", - "prost-types", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" -dependencies = [ - "bytes", - "prost", -] - -[[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", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", - "rand_pcg", -] - -[[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", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "ref-cast" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-automata" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -dependencies = [ - "byteorder", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - -[[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 = "ring" -version = "0.16.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi 0.3.9", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - -[[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", -] - -[[package]] -name = "rustls" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" -dependencies = [ - "base64", - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rw-stream-sink" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" -dependencies = [ - "futures", - "pin-project", - "static_assertions", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "sc-beefy-gadget" -version = "0.1.0" -dependencies = [ - "futures", - "log", - "parity-scale-codec", - "parking_lot 0.11.0", - "sc-client-api", - "sc-keystore", - "sc-network", - "sc-network-gossip", - "sp-application-crypto", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", -] - -[[package]] -name = "sc-block-builder" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bee59dc560f30e72ee95c224e3e75299b53b619e659a38af9db2639803c08ee" -dependencies = [ - "parity-scale-codec", - "sc-client-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", -] - -[[package]] -name = "sc-client-api" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fafb2b2861e847657c4656d2ae2249c9f3f6a76fb92a22f750325b77e1fb4c8" -dependencies = [ - "derive_more", - "fnv", - "futures", - "hash-db", - "hex-literal", - "kvdb", - "lazy_static", - "log", - "parity-scale-codec", - "parking_lot 0.10.2", - "sc-executor", - "sc-telemetry", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-database", - "sp-externalities", - "sp-inherents", - "sp-keyring", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-storage", - "sp-transaction-pool", - "sp-trie", - "sp-utils", - "sp-version", - "substrate-prometheus-endpoint", -] - -[[package]] -name = "sc-executor" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af77c7fda9659559e257fe330af26e7c2e8f61583c2a5c45f4c9db73d58a902b" -dependencies = [ - "derive_more", - "lazy_static", - "libsecp256k1", - "log", - "parity-scale-codec", - "parity-wasm", - "parking_lot 0.10.2", - "sc-executor-common", - "sc-executor-wasmi", - "sp-api", - "sp-core", - "sp-externalities", - "sp-io", - "sp-panic-handler", - "sp-runtime-interface", - "sp-serializer", - "sp-trie", - "sp-version", - "sp-wasm-interface", - "wasmi", -] - -[[package]] -name = "sc-executor-common" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6663e4d1d2f8255e6c1994ce548365a7631a82f7ab231d0b8a122cc2a0011949" -dependencies = [ - "derive_more", - "log", - "parity-scale-codec", - "parity-wasm", - "sp-allocator", - "sp-core", - "sp-runtime-interface", - "sp-serializer", - "sp-wasm-interface", - "wasmi", -] - -[[package]] -name = "sc-executor-wasmi" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78aeea37a28b83af11fe621ee047758e125341db96efaf7f553a4180fe48d6b8" -dependencies = [ - "log", - "parity-scale-codec", - "sc-executor-common", - "sp-allocator", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", - "wasmi", -] - -[[package]] -name = "sc-keystore" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bbf8b58ed80e1d375aaa8ee5dedf17f68fea30c900440a695fb630a1757283" -dependencies = [ - "derive_more", - "hex", - "merlin", - "parking_lot 0.10.2", - "rand", - "serde_json", - "sp-application-crypto", - "sp-core", - "subtle 2.3.0", -] - -[[package]] -name = "sc-network" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e58ccd69ea8dd0c1e1d98e5e7ed2969aaf14d45dcf98416c679a968e752850" -dependencies = [ - "async-std", - "async-trait", - "bitflags", - "bs58", - "bytes", - "derive_more", - "either", - "erased-serde", - "fnv", - "fork-tree", - "futures", - "futures-timer", - "futures_codec", - "hex", - "ip_network", - "libp2p", - "linked-hash-map", - "linked_hash_set", - "log", - "lru 0.4.3", - "nohash-hasher", - "parity-scale-codec", - "parking_lot 0.10.2", - "pin-project", - "prost", - "prost-build", - "rand", - "sc-block-builder", - "sc-client-api", - "sc-peerset", - "serde", - "serde_json", - "slog", - "slog_derive", - "smallvec 0.6.13", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "sp-utils", - "substrate-prometheus-endpoint", - "thiserror", - "unsigned-varint 0.4.0", - "void", - "wasm-timer", - "zeroize", -] - -[[package]] -name = "sc-network-gossip" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ddb2a1cb6cd53b46e76f61c662d1561da4a7dc16a375c37849fd1f429b6803" -dependencies = [ - "futures", - "futures-timer", - "libp2p", - "log", - "lru 0.4.3", - "sc-network", - "sp-runtime", - "wasm-timer", -] - -[[package]] -name = "sc-peerset" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfaa3d62db8ad549e6d21b6e353e00e2e7338c8623c01c79e8f36b035266a4b" -dependencies = [ - "futures", - "libp2p", - "log", - "serde_json", - "sp-utils", - "wasm-timer", -] - -[[package]] -name = "sc-telemetry" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5883219d0ccec3e4d50079ba63f8accc71659b93537cff66de326a382b138c4b" -dependencies = [ - "futures", - "futures-timer", - "libp2p", - "log", - "parking_lot 0.10.2", - "pin-project", - "rand", - "serde", - "slog", - "slog-json", - "slog-scope", - "take_mut", - "void", - "wasm-timer", -] - -[[package]] -name = "schnorrkel" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" -dependencies = [ - "arrayref", - "arrayvec 0.5.1", - "curve25519-dalek 2.1.0", - "getrandom", - "merlin", - "rand", - "rand_core", - "sha2 0.8.2", - "subtle 2.3.0", - "zeroize", -] - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "secrecy" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" -dependencies = [ - "zeroize", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha-1" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpuid-bool", - "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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpuid-bool", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[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 = "sharded-slab" -version = "0.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signature" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - -[[package]] -name = "slog" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cc9c640a4adbfbcc11ffb95efe5aa7af7309e002adab54b185507dbf2377b99" -dependencies = [ - "erased-serde", -] - -[[package]] -name = "slog-json" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" -dependencies = [ - "chrono", - "erased-serde", - "serde", - "serde_json", - "slog", -] - -[[package]] -name = "slog-scope" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c44c89dd8b0ae4537d1ae318353eaf7840b4869c536e31c41e963d1ea523ee6" -dependencies = [ - "arc-swap", - "lazy_static", - "slog", -] - -[[package]] -name = "slog_derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "smallvec" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -dependencies = [ - "maybe-uninit", -] - -[[package]] -name = "smallvec" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" - -[[package]] -name = "snow" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32bf8474159a95551661246cda4976e89356999e3cbfef36f493dacc3fae1e8e" -dependencies = [ - "aes-gcm", - "blake2", - "chacha20poly1305", - "rand", - "rand_core", - "ring", - "rustc_version", - "sha2 0.9.1", - "subtle 2.3.0", - "x25519-dalek", -] - -[[package]] -name = "socket2" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "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", - "bytes", - "flate2", - "futures", - "httparse", - "log", - "rand", - "sha-1", -] - -[[package]] -name = "sp-allocator" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79a1db780708b6b71e9914e2b1d11b3e61c9bfb492c88b1024115e1a6661da" -dependencies = [ - "derive_more", - "log", - "sp-core", - "sp-std", - "sp-wasm-interface", -] - -[[package]] -name = "sp-api" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953a3296335d9761311763dbe6855109ea4bea915e27cf5633d8b01057898302" -dependencies = [ - "hash-db", - "parity-scale-codec", - "sp-api-proc-macro", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-version", -] - -[[package]] -name = "sp-api-proc-macro" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8247ca24a2a881af2ac675c8ec33584944965d6d45645bbec16fe327ce42dce6" -dependencies = [ - "blake2-rfc", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-application-crypto" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "885eca124aa6ce0bba57c08bc48c4357096996d630a77f572580ef8e2e4df034" -dependencies = [ - "parity-scale-codec", - "serde", - "sp-core", - "sp-io", - "sp-std", -] - -[[package]] -name = "sp-arithmetic" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667775bc50eb214225df18c92e4ec57acc7e2dc78d7d210eb4dd930db1a73995" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "serde", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "sp-block-builder" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d7fca8aa126a9d295843d592f44b48d8cf93880862baeff2968164598ab26c" -dependencies = [ - "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-blockchain" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37387284973e2edceefaa673930282801ea238e5892a2cc6aa02f7f2e7601df" -dependencies = [ - "derive_more", - "log", - "lru 0.4.3", - "parity-scale-codec", - "parking_lot 0.10.2", - "sp-block-builder", - "sp-consensus", - "sp-database", - "sp-runtime", - "sp-state-machine", -] - -[[package]] -name = "sp-consensus" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b460103293bbf2f4193e43c4f031fdc099c5e27c782369bbb4dacc7765e84057" -dependencies = [ - "derive_more", - "futures", - "futures-timer", - "libp2p", - "log", - "parity-scale-codec", - "parking_lot 0.10.2", - "serde", - "sp-api", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "sp-utils", - "sp-version", - "substrate-prometheus-endpoint", - "wasm-timer", -] - -[[package]] -name = "sp-core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92ac5c674ee2cd9219d084301b4cbb82b28a94a0f3087bf4bea0ef3067ebb5c" -dependencies = [ - "base58", - "blake2-rfc", - "byteorder", - "derive_more", - "dyn-clonable", - "ed25519-dalek", - "futures", - "hash-db", - "hash256-std-hasher", - "hex", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin", - "num-traits", - "parity-scale-codec", - "parity-util-mem", - "parking_lot 0.10.2", - "primitive-types", - "rand", - "regex", - "schnorrkel", - "secrecy", - "serde", - "sha2 0.8.2", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std", - "sp-storage", - "substrate-bip39", - "tiny-bip39", - "tiny-keccak", - "twox-hash", - "wasmi", - "zeroize", -] - -[[package]] -name = "sp-database" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c1c352eceefe5bcdfc27f13a2fd038fc571b7aca5146f2cd651d40e9d2457dd" -dependencies = [ - "kvdb", - "parking_lot 0.10.2", -] - -[[package]] -name = "sp-debug-derive" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3750b084e0f4677f6e834a974f30b1ba97fc2fe00185c9d03611a2228446dc" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-externalities" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d87fcd0e0fc5e025459cfe769803488d4894e36d0f8cef80b5239d2e7ef6580" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std", - "sp-storage", -] - -[[package]] -name = "sp-inherents" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "365e5aee23640631e63e8634f1d804e33c8fcb521f4052910f29abaa2df1c1cf" -dependencies = [ - "derive_more", - "parity-scale-codec", - "parking_lot 0.10.2", - "sp-core", - "sp-std", -] - -[[package]] -name = "sp-io" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e1dee9244eb6cba1bef9b3a4ec288185e1380e455f1fd348b60252592c1cf0" -dependencies = [ - "futures", - "hash-db", - "libsecp256k1", - "log", - "parity-scale-codec", - "parking_lot 0.10.2", - "sp-core", - "sp-externalities", - "sp-runtime-interface", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-trie", - "sp-wasm-interface", - "tracing", - "tracing-core", -] - -[[package]] -name = "sp-keyring" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f76feeb27b218d58523931ea2d708b622c3bd96a3be1c3a5895bba0f7a54c13" -dependencies = [ - "lazy_static", - "sp-core", - "sp-runtime", - "strum", -] - -[[package]] -name = "sp-panic-handler" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "492126eb766b3b6740e4e4929d6527d37708598b7296a664f3680c0f0c1fc573" -dependencies = [ - "backtrace", - "log", -] - -[[package]] -name = "sp-runtime" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62542f8ce9d5fcb43a4dd3c3a53326d33aacf9b0bc9d353d6fe9fd5ff3031747" -dependencies = [ - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "parity-util-mem", - "paste", - "rand", - "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-inherents", - "sp-io", - "sp-std", -] - -[[package]] -name = "sp-runtime-interface" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7e363c480cc8c9019b84f85d10c0b56a184079d5d840d2d1d55087ad835dc6" -dependencies = [ - "parity-scale-codec", - "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 = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cf56a38544293e54dbe0aa7b6aed1e046bfc704b6fc3de7255897dca98ccb1" -dependencies = [ - "Inflector", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-serializer" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643933e971979094c9d4b27b015c7250985a262e405bb9ad090336d8ceb5b2b9" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "sp-state-machine" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58335de98bca196683a8ef22195a8a43b457b8bc705dba3124138ffc2ee720" -dependencies = [ - "hash-db", - "log", - "num-traits", - "parity-scale-codec", - "parking_lot 0.10.2", - "rand", - "smallvec 1.4.2", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-std", - "sp-trie", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-std" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2d6e166cead2d3b1d3d8fe0e787d076b7d0296b1760a0d7d340846d0ba42c5" - -[[package]] -name = "sp-storage" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4625e6f8f40995939560f48f89028f658b7929657c68d01c571c81ab5619ff" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "sp-tracing" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9a5c42c5450991ca3a28c190e75122f5ccedbcb024953e7c357e7aa2afd8534" -dependencies = [ - "log", - "parity-scale-codec", - "sp-std", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-transaction-pool" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b34ee48341c17c6e2f1e55f6076918f46b0c4505a99ad69ab1edda8b45bbd8" -dependencies = [ - "derive_more", - "futures", - "log", - "parity-scale-codec", - "serde", - "sp-api", - "sp-blockchain", - "sp-runtime", -] - -[[package]] -name = "sp-trie" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3aae57c8ae81ba978503137a8c625d2963eb425dd90dec0d96b4ed18d8bfd55" -dependencies = [ - "hash-db", - "memory-db", - "parity-scale-codec", - "sp-core", - "sp-std", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-utils" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84310a02e2ac89b5e288d7af980414fd88753e3caba92aab1983cd2819991150" -dependencies = [ - "futures", - "futures-core", - "futures-timer", - "lazy_static", - "prometheus", -] - -[[package]] -name = "sp-version" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21935199c8765f0d02facc718f9c83149a70ea684fb03612e5161c682b38a301" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "serde", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-wasm-interface" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c28225e8b7ec7e260f8b46443f8731abda206334cb75c740d2407693f38167" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "sp-std", - "wasmi", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stream-cipher" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f8ed9974042b8c3672ff3030a69fcc03b74c47c3d1ecb7755e8a3626011e88" -dependencies = [ - "generic-array 0.14.4", -] - -[[package]] -name = "strum" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6138f8f88a16d90134763314e3fc76fa3ed6a7db4725d6acf9a3ef95a3188d22" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "substrate-bip39" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bed6646a0159b9935b5d045611560eeef842b78d7adc3ba36f5ca325a13a0236" -dependencies = [ - "hmac", - "pbkdf2", - "schnorrkel", - "sha2 0.8.2", - "zeroize", -] - -[[package]] -name = "substrate-prometheus-endpoint" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3e361741d066bfc29554b9f1bc8e4ac927eb4bd33dd8bb0486969edd8b0b5a" -dependencies = [ - "async-std", - "derive_more", - "futures-util", - "hyper", - "log", - "prometheus", - "tokio", -] - -[[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - -[[package]] -name = "subtle" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" - -[[package]] -name = "syn" -version = "1.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "synstructure" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" - -[[package]] -name = "tempfile" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -dependencies = [ - "cfg-if", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.9", -] - -[[package]] -name = "thiserror" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] - -[[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.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0165e045cc2ae1660270ca65e1676dbaab60feb0f91b10f7d0665e9b47e31f2" -dependencies = [ - "failure", - "hmac", - "once_cell", - "pbkdf2", - "rand", - "rustc-hash", - "sha2 0.8.2", - "unicode-normalization", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinyvec" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" - -[[package]] -name = "tokio" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "memchr", - "pin-project-lite", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" -dependencies = [ - "serde", -] - -[[package]] -name = "tower-service" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" - -[[package]] -name = "tracing" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" -dependencies = [ - "cfg-if", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "tracing-log" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" -dependencies = [ - "serde", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82bb5079aa76438620837198db8a5c529fb9878c730bc2b28179b0241cf04c10" -dependencies = [ - "ansi_term", - "chrono", - "lazy_static", - "matchers", - "regex", - "serde", - "serde_json", - "sharded-slab", - "smallvec 1.4.2", - "thread_local", - "tracing-core", - "tracing-log", - "tracing-serde", -] - -[[package]] -name = "trie-db" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0" -dependencies = [ - "hash-db", - "hashbrown 0.8.2", - "log", - "rustc-hex", - "smallvec 1.4.2", -] - -[[package]] -name = "trie-root" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" -dependencies = [ - "hash-db", -] - -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - -[[package]] -name = "twox-hash" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56" -dependencies = [ - "rand", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "uint" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" -dependencies = [ - "byteorder", - "crunchy", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "universal-hash" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" -dependencies = [ - "generic-array 0.14.4", - "subtle 2.3.0", -] - -[[package]] -name = "unsigned-varint" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5" -dependencies = [ - "bytes", - "futures-io", - "futures-util", - "futures_codec", -] - -[[package]] -name = "unsigned-varint" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" -dependencies = [ - "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 = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" -dependencies = [ - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "vcpkg" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" - -[[package]] -name = "vec-arena" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - -[[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 = "wasm-bindgen" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" - -[[package]] -name = "wasm-timer" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" -dependencies = [ - "futures", - "js-sys", - "parking_lot 0.11.0", - "pin-utils", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "wasmi" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" -dependencies = [ - "libc", - "memory_units", - "num-rational", - "num-traits", - "parity-wasm", - "wasmi-validation", -] - -[[package]] -name = "wasmi-validation" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "web-sys" -version = "0.3.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" -dependencies = [ - "webpki", -] - -[[package]] -name = "webpki-roots" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" -dependencies = [ - "webpki", -] - -[[package]] -name = "wepoll-sys-stjepang" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fdfbb03f290ca0b27922e8d48a0997b4ceea12df33269b9f75e713311eb178d" -dependencies = [ - "cc", -] - -[[package]] -name = "which" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" -dependencies = [ - "libc", -] - -[[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-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[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 = "x25519-dalek" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637ff90c9540fa3073bb577e65033069e4bae7c79d49d74aa3ffdf5342a53217" -dependencies = [ - "curve25519-dalek 2.1.0", - "rand_core", - "zeroize", -] - -[[package]] -name = "yamux" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aeb8c4043cac71c3c299dff107171c220d179492350ea198e109a414981b83c" -dependencies = [ - "futures", - "log", - "nohash-hasher", - "parking_lot 0.11.0", - "rand", - "static_assertions", -] - -[[package]] -name = "zeroize" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] From 85d81b23d0b43b54ddf87b4cb1051c430c4333ca Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Tue, 2 Feb 2021 17:20:27 +0100 Subject: [PATCH 019/109] Beefy pallet test (#74) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * setup mock * test session change * silence beefy * clippy still * no change - no log * clippy again * Apply suggestions from code review Co-authored-by: Tomasz DrwiÄ™ga * code review changes, added additional test Co-authored-by: Tomasz DrwiÄ™ga --- frame/beefy/Cargo.toml | 7 ++ frame/beefy/src/lib.rs | 6 ++ frame/beefy/src/mock.rs | 161 +++++++++++++++++++++++++++++++++++++++ frame/beefy/src/tests.rs | 103 +++++++++++++++++++++++++ 4 files changed, 277 insertions(+) create mode 100644 frame/beefy/src/mock.rs create mode 100644 frame/beefy/src/tests.rs diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 0fa5e717c6af6..1d34323815090 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -13,10 +13,17 @@ beefy-primitives = { path = "../primitives", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +[dev-dependencies] +sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-staking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } + [features] default = ["std"] std = [ diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index ff4f9c2dddd4c..df47755eee6a2 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -27,6 +27,12 @@ use sp_runtime::{ }; use sp_std::prelude::*; +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + pub trait Config: frame_system::Config { /// The identifier type for an authority. type AuthorityId: Member + Parameter + RuntimeAppPublic + Default; diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs new file mode 100644 index 0000000000000..c01ef64b74ea2 --- /dev/null +++ b/frame/beefy/src/mock.rs @@ -0,0 +1,161 @@ +// Copyright (C) 2020 - 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::vec; + +use frame_support::{parameter_types, sp_io::TestExternalities, BasicExternalities}; + +use sp_core::H256; +use sp_runtime::{ + app_crypto::ecdsa::Public, + impl_opaque_keys, + testing::Header, + traits::{BlakeTwo256, ConvertInto, IdentityLookup, OpaqueKeys}, + Perbill, +}; + +use crate as pallet_beefy; + +pub use beefy_primitives::{ecdsa::AuthorityId as BeefyId, ConsensusLog, BEEFY_ENGINE_ID}; + +impl_opaque_keys! { + pub struct MockSessionKeys { + pub dummy: pallet_beefy::Module, + } +} + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Module, Call, Config, Storage, Event}, + Beefy: pallet_beefy::{Module, Call, Config, Storage}, + Session: pallet_session::{Module, Call, Storage, Event, Config}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl frame_system::Config for Test { + type BaseCallFilter = (); + 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 = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; +} + +impl pallet_beefy::Config for Test { + type AuthorityId = BeefyId; +} + +parameter_types! { + pub const Period: u64 = 1; + pub const Offset: u64 = 0; + pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33); +} + +impl pallet_session::Config for Test { + type Event = Event; + type ValidatorId = u64; + type ValidatorIdOf = ConvertInto; + type ShouldEndSession = pallet_session::PeriodicSessions; + type NextSessionRotation = pallet_session::PeriodicSessions; + type SessionManager = MockSessionManager; + type SessionHandler = ::KeyTypeIdProviders; + type Keys = MockSessionKeys; + type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); +} + +pub struct MockSessionManager; + +impl pallet_session::SessionManager for MockSessionManager { + fn end_session(_: sp_staking::SessionIndex) {} + fn start_session(_: sp_staking::SessionIndex) {} + fn new_session(idx: sp_staking::SessionIndex) -> Option> { + if idx == 0 || idx == 1 { + Some(vec![1, 2]) + } else if idx == 2 { + Some(vec![3, 4]) + } else { + None + } + } +} + +// Note, that we can't use `UintAuthorityId` here. Reason is that the implementation +// of `to_public_key()` assumes, that a public key is 32 bytes long. This is true for +// ed25519 and sr25519 but *not* for ecdsa. An ecdsa public key is 33 bytes. +pub fn mock_beefy_id(id: u8) -> BeefyId { + let buf: [u8; 33] = [id; 33]; + let pk = Public::from_raw(buf); + BeefyId::from(pk) +} + +pub fn mock_authorities(vec: Vec) -> Vec<(u64, BeefyId)> { + vec.into_iter().map(|id| ((id as u64), mock_beefy_id(id))).collect() +} + +pub fn new_test_ext(ids: Vec) -> TestExternalities { + new_test_ext_raw_authorities(mock_authorities(ids)) +} + +pub fn new_test_ext_raw_authorities(authorities: Vec<(u64, BeefyId)>) -> TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + let session_keys: Vec<_> = authorities + .iter() + .enumerate() + .map(|(_, id)| (id.0 as u64, id.0 as u64, MockSessionKeys { dummy: id.1.clone() })) + .collect(); + + BasicExternalities::execute_with_storage(&mut t, || { + for (ref id, ..) in &session_keys { + frame_system::Module::::inc_providers(id); + } + }); + + pallet_session::GenesisConfig:: { keys: session_keys } + .assimilate_storage(&mut t) + .unwrap(); + + t.into() +} diff --git a/frame/beefy/src/tests.rs b/frame/beefy/src/tests.rs new file mode 100644 index 0000000000000..ee10bbc66f559 --- /dev/null +++ b/frame/beefy/src/tests.rs @@ -0,0 +1,103 @@ +// Copyright (C) 2020 - 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::vec; + +use codec::Encode; + +use sp_core::H256; +use sp_runtime::DigestItem; + +use frame_support::traits::OnInitialize; + +use crate::mock::*; + +fn init_block(block: u64) { + System::set_block_number(block); + Session::on_initialize(block); +} + +pub fn beefy_log(log: ConsensusLog) -> DigestItem { + DigestItem::Consensus(BEEFY_ENGINE_ID, log.encode()) +} + +#[test] +fn genesis_session_initializes_authorities() { + let want = vec![mock_beefy_id(1), mock_beefy_id(2), mock_beefy_id(3), mock_beefy_id(4)]; + + new_test_ext(vec![1, 2, 3, 4]).execute_with(|| { + let authorities = Beefy::authorities(); + + assert!(authorities.len() == 2); + assert_eq!(want[0], authorities[0]); + assert_eq!(want[1], authorities[1]); + + assert!(Beefy::validator_set_id() == 0); + + let next_authorities = Beefy::next_authorities(); + + assert!(next_authorities.len() == 2); + assert_eq!(want[0], next_authorities[0]); + assert_eq!(want[1], next_authorities[1]); + }); +} + +#[test] +fn session_change_updates_authorities() { + new_test_ext(vec![1, 2, 3, 4]).execute_with(|| { + init_block(1); + + assert!(0 == Beefy::validator_set_id()); + + // no change - no log + assert!(System::digest().logs.is_empty()); + + init_block(2); + + assert!(1 == Beefy::validator_set_id()); + + let want = beefy_log(ConsensusLog::AuthoritiesChange(vec![ + mock_beefy_id(3), + mock_beefy_id(4), + ])); + + let log = System::digest().logs[0].clone(); + + assert_eq!(want, log); + }); +} +#[test] +fn session_change_updates_next_authorities() { + let want = vec![mock_beefy_id(1), mock_beefy_id(2), mock_beefy_id(3), mock_beefy_id(4)]; + + new_test_ext(vec![1, 2, 3, 4]).execute_with(|| { + init_block(1); + + let next_authorities = Beefy::next_authorities(); + + assert!(next_authorities.len() == 2); + assert_eq!(want[0], next_authorities[0]); + assert_eq!(want[1], next_authorities[1]); + + init_block(2); + + let next_authorities = Beefy::next_authorities(); + + assert!(next_authorities.len() == 2); + assert_eq!(want[2], next_authorities[0]); + assert_eq!(want[3], next_authorities[1]); + }); +} From ad86b0ea323ba3896cc1af8cd93a3adf0689dfc0 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 3 Feb 2021 17:28:55 +0100 Subject: [PATCH 020/109] Beefy node cleanup (#75) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * bump serde * bump substrate, scale-codec 2.0.0 * we need a proper beefy node * rename primitives as well * Sort members. Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/Cargo.toml | 5 +- client/beefy/rpc/Cargo.toml | 24 +- frame/beefy/Cargo.toml | 8 +- frame/beefy/src/lib.rs | 8 +- primitives/beefy/Cargo.toml | 29 ++ primitives/beefy/src/commitment.rs | 198 ++++++++++ primitives/beefy/src/lib.rs | 98 +++++ primitives/beefy/src/witness.rs | 134 +++++++ primitives/beefy/tests/basic_lc_operations.rs | 358 ++++++++++++++++++ .../beefy/tests/bridge_parachain_flow.rs | 111 ++++++ .../beefy/tests/light_client/merkle_tree.rs | 70 ++++ primitives/beefy/tests/light_client/mod.rs | 249 ++++++++++++ .../beefy/tests/light_client/validator_set.rs | 36 ++ 13 files changed, 1309 insertions(+), 19 deletions(-) create mode 100644 primitives/beefy/Cargo.toml create mode 100644 primitives/beefy/src/commitment.rs create mode 100644 primitives/beefy/src/lib.rs create mode 100644 primitives/beefy/src/witness.rs create mode 100644 primitives/beefy/tests/basic_lc_operations.rs create mode 100644 primitives/beefy/tests/bridge_parachain_flow.rs create mode 100644 primitives/beefy/tests/light_client/merkle_tree.rs create mode 100644 primitives/beefy/tests/light_client/mod.rs create mode 100644 primitives/beefy/tests/light_client/validator_set.rs diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index ee3ec59504c6d..1adbab6b8d789 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -6,12 +6,11 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -codec = { version = "1.3.5", package = "parity-scale-codec", features = ["derive"] } futures = "0.3" log = "0.4" parking_lot = "0.11" -beefy-primitives = { path = "../primitives" } +codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -26,3 +25,5 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } + +beefy-primitives = { path = "../beefy-primitives" } \ No newline at end of file diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 3c4f6185e08c2..fdd5f32d4ad0c 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -6,18 +6,22 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -beefy-gadget = { path = "../." } -beefy-primitives = { path = "../../primitives" } +futures = { version = "0.3.12", features = ["compat"] } +log = "0.4" +serde = { version = "1.0.123", features = ["derive"] } +serde_json = "1.0.61" -codec = { version = "1.3.5", package = "parity-scale-codec", features = ["derive"] } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } jsonrpc-core = "15.1.0" jsonrpc-core-client = "15.1.0" jsonrpc-derive = "15.1.0" jsonrpc-pubsub = "15.1.0" -futures = { version = "0.3.12", features = ["compat"] } -serde = { version = "1.0.119", features = ["derive"] } -serde_json = "1.0.61" -log = "0.4.13" + +codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } + +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } + +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } + +beefy-gadget = { path = "../." } +beefy-primitives = { path = "../../beefy-primitives" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 1d34323815090..9b37279c1b9d2 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -6,10 +6,8 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -codec = { version = "1.3.5", package = "parity-scale-codec", default-features = false, features = ["derive"] } -serde = { version = "1.0.119", optional = true } - -beefy-primitives = { path = "../primitives", default-features = false } +codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +serde = { version = "1.0.123", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -19,6 +17,8 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +beefy-primitives = { path = "../beefy-primitives", default-features = false } + [dev-dependencies] sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master" } diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index df47755eee6a2..fe2197944b7f4 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -18,8 +18,8 @@ use codec::Encode; -use beefy_primitives::{AuthorityIndex, ConsensusLog, BEEFY_ENGINE_ID}; -use frame_support::{decl_module, decl_storage, Parameter}; +use frame_support::{decl_module, decl_storage, traits::OneSessionHandler, Parameter}; + use sp_runtime::{ generic::DigestItem, traits::{IsMember, Member}, @@ -27,6 +27,8 @@ use sp_runtime::{ }; use sp_std::prelude::*; +use beefy_primitives::{AuthorityIndex, ConsensusLog, BEEFY_ENGINE_ID}; + #[cfg(test)] mod mock; @@ -91,7 +93,7 @@ impl sp_runtime::BoundToRuntimeAppPublic for Module { type Public = T::AuthorityId; } -impl pallet_session::OneSessionHandler for Module { +impl OneSessionHandler for Module { type Key = T::AuthorityId; fn on_genesis_session<'a, I: 'a>(validators: I) diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml new file mode 100644 index 0000000000000..2cc4f33cc4ca0 --- /dev/null +++ b/primitives/beefy/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "beefy-primitives" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" + +[dependencies] +codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } + +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +[dev-dependencies] +hex-literal = "0.3" + +[features] +default = ["std"] +std = [ + "codec/std", + "sp-api/std", + "sp-application-crypto/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", +] diff --git a/primitives/beefy/src/commitment.rs b/primitives/beefy/src/commitment.rs new file mode 100644 index 0000000000000..0e682fbff56e9 --- /dev/null +++ b/primitives/beefy/src/commitment.rs @@ -0,0 +1,198 @@ +// Copyright (C) 2020 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 sp_std::{cmp, prelude::*}; + +use crate::ValidatorSetId; + +/// A commitment signed by GRANDPA validators as part of BEEFY protocol. +/// +/// The commitment contains a [payload] extracted from the finalized block at height [block_number]. +/// GRANDPA validators collect signatures on commitments and a stream of such signed commitments +/// (see [SignedCommitment]) forms the BEEFY protocol. +#[derive(Clone, Debug, PartialEq, Eq, codec::Encode, codec::Decode)] +pub struct Commitment { + /// The payload being signed. + /// + /// This should be some form of cumulative representation of the chain (think MMR root hash). + /// The payload should also contain some details that allow the light client to verify next + /// validator set. The protocol does not enforce any particular format of this data, + /// nor how often it should be present in commitments, however the light client has to be + /// provided with full validator set whenever it performs the transition (i.e. importing first + /// block with [validator_set_id] incremented). + pub payload: TPayload, + + /// Finalized block number this commitment is for. + /// + /// GRANDPA validators agree on a block they create a commitment for and start collecting + /// signatures. This process is called a round. + /// There might be multiple rounds in progress (depending on the block choice rule), however + /// since the payload is supposed to be cumulative, it is not required to import all + /// commitments. + /// BEEFY light client is expected to import at least one commitment per epoch, + /// but is free to import as many as it requires. + pub block_number: TBlockNumber, + + /// BEEFY validator set supposed to sign this commitment. + /// + /// Validator set is changing once per epoch. The Light Client must be provided by details about + /// the validator set whenever it's importing first commitment with a new `validator_set_id`. + /// Validator set data MUST be verifiable, for instance using [payload] information. + pub validator_set_id: ValidatorSetId, +} + +impl cmp::PartialOrd for Commitment +where + TBlockNumber: cmp::Ord, + TPayload: cmp::Eq, +{ + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl cmp::Ord for Commitment +where + TBlockNumber: cmp::Ord, + TPayload: cmp::Eq, +{ + fn cmp(&self, other: &Self) -> cmp::Ordering { + self.validator_set_id + .cmp(&other.validator_set_id) + .then_with(|| self.block_number.cmp(&other.block_number)) + } +} + +/// A commitment with matching GRANDPA validators' signatures. +#[derive(Clone, Debug, PartialEq, Eq, codec::Encode, codec::Decode)] +pub struct SignedCommitment { + /// The commitment signatures are collected for. + pub commitment: Commitment, + /// GRANDPA validators' signatures for the commitment. + /// + /// The length of this `Vec` must match number of validators in the current set (see + /// [Commitment::validator_set_id]). + pub signatures: Vec>, +} + +impl SignedCommitment { + /// Return the number of collected signatures. + pub fn no_of_signatures(&self) -> usize { + self.signatures.iter().filter(|x| x.is_some()).count() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use codec::Decode; + + type TestCommitment = Commitment; + type TestSignedCommitment = SignedCommitment>; + + #[test] + fn commitment_encode_decode() { + // given + let commitment: TestCommitment = Commitment { + payload: "Hello World!".into(), + block_number: 5, + validator_set_id: 0, + }; + + // when + let encoded = codec::Encode::encode(&commitment); + let decoded = TestCommitment::decode(&mut &*encoded); + + // then + assert_eq!(decoded, Ok(commitment)); + assert_eq!( + encoded, + hex_literal::hex!("3048656c6c6f20576f726c6421050000000000000000000000000000000000000000000000") + ); + } + + #[test] + fn signed_commitment_encode_decode() { + // given + let commitment: TestCommitment = Commitment { + payload: "Hello World!".into(), + block_number: 5, + validator_set_id: 0, + }; + let signed = SignedCommitment { + commitment, + signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + }; + + // when + let encoded = codec::Encode::encode(&signed); + let decoded = TestSignedCommitment::decode(&mut &*encoded); + + // then + assert_eq!(decoded, Ok(signed)); + assert_eq!( + encoded, + hex_literal::hex!( + "3048656c6c6f20576f726c6421050000000000000000000000000000000000000000000000100000011001020304011005060708" + ) + ); + } + + #[test] + fn signed_commitment_count_signatures() { + // given + let commitment: TestCommitment = Commitment { + payload: "Hello World!".into(), + block_number: 5, + validator_set_id: 0, + }; + let mut signed = SignedCommitment { + commitment, + signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + }; + assert_eq!(signed.no_of_signatures(), 2); + + // when + signed.signatures[2] = None; + + // then + assert_eq!(signed.no_of_signatures(), 1); + } + + #[test] + fn commitment_ordering() { + fn commitment(block_number: u128, validator_set_id: crate::ValidatorSetId) -> TestCommitment { + Commitment { + payload: "Hello World!".into(), + block_number, + validator_set_id, + } + } + + // given + let a = commitment(1, 0); + let b = commitment(2, 1); + let c = commitment(10, 0); + let d = commitment(10, 1); + + // then + assert!(a < b); + assert!(a < c); + assert!(c < b); + assert!(c < d); + assert!(b < d); + } +} diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs new file mode 100644 index 0000000000000..0ddfd0fa46f41 --- /dev/null +++ b/primitives/beefy/src/lib.rs @@ -0,0 +1,98 @@ +// Copyright (C) 2020 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 . + +#![cfg_attr(not(feature = "std"), no_std)] +#![warn(missing_docs)] +// NOTE: needed to silence warnings about generated code in `decl_runtime_apis` +#![allow(clippy::too_many_arguments, clippy::unnecessary_mut_passed)] + +//! Primitives for BEEFY protocol. +//! +//! The crate contains shared data types used by BEEFY protocol and documentation (in a form of +//! code) for building a BEEFY light client. +//! +//! BEEFY is a gadget that runs alongside another finality gadget (for instance GRANDPA). +//! For simplicity (and the initially intended use case) the documentation says GRANDPA in places +//! where a more abstract "Finality Gadget" term could be used, but there is no reason why BEEFY +//! wouldn't run with some other finality scheme. +//! BEEFY validator set is supposed to be tracking the Finality Gadget validator set, but note that +//! it will use a different set of keys. For Polkadot use case we plan to use `secp256k1` for BEEFY, +//! while GRANDPA uses `ed25519`. + +mod commitment; +pub mod witness; + +pub use commitment::{Commitment, SignedCommitment}; + +use codec::{Codec, Decode, Encode}; +use sp_core::H256; +use sp_std::prelude::*; + +/// Key type for BEEFY module. +pub const KEY_TYPE: sp_application_crypto::KeyTypeId = sp_application_crypto::KeyTypeId(*b"beef"); + +/// BEEFY application-specific crypto types using ECDSA. +pub mod ecdsa { + mod app_ecdsa { + use sp_application_crypto::{app_crypto, ecdsa}; + app_crypto!(ecdsa, crate::KEY_TYPE); + } + + sp_application_crypto::with_pair! { + /// A BEEFY authority keypair using ECDSA as its crypto. + pub type AuthorityPair = app_ecdsa::Pair; + } + + /// Identity of a BEEFY authority using ECDSA as its crypto. + pub type AuthorityId = app_ecdsa::Public; + + /// Signature for a BEEFY authority using ECDSA as its crypto. + pub type AuthoritySignature = app_ecdsa::Signature; +} + +/// The `ConsensusEngineId` of BEEFY. +pub const BEEFY_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"BEEF"; + +/// A typedef for validator set id. +pub type ValidatorSetId = u64; + +/// The index of an authority. +pub type AuthorityIndex = u32; + +/// The type used to represent an MMR root hash. +pub type MmrRootHash = H256; + +/// A consensus log item for BEEFY. +#[derive(Decode, Encode)] +pub enum ConsensusLog { + /// The authorities have changed. + #[codec(index = 1)] + AuthoritiesChange(Vec), + /// Disable the authority with given index. + #[codec(index = 2)] + OnDisabled(AuthorityIndex), + /// MMR root hash. + #[codec(index = 3)] + MmrRoot(MmrRootHash), +} + +sp_api::decl_runtime_apis! { + /// API necessary for BEEFY voters. + pub trait BeefyApi { + /// Return the current set of authorities. + fn authorities() -> Vec; + } +} diff --git a/primitives/beefy/src/witness.rs b/primitives/beefy/src/witness.rs new file mode 100644 index 0000000000000..1928a38dd08fe --- /dev/null +++ b/primitives/beefy/src/witness.rs @@ -0,0 +1,134 @@ +// Copyright (C) 2020 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 . + +//! Primitives for light, 2-phase interactive verification protocol. +//! +//! Instead of submitting full list of signatures, it's possible to submit first a witness +//! form of [SignedCommitment]. +//! This can later be verified by the client requesting only some (out of all) signatures for +//! verification. This allows lowering the data and computation cost of verifying the +//! signed commitment. + +use sp_std::prelude::*; + +use crate::commitment::{Commitment, SignedCommitment}; + +/// A light form of [SignedCommitment]. +/// +/// This is a light ("witness") form of the signed commitment. Instead of containing full list of +/// signatures, which might be heavy and expensive to verify, it only contains a bit vector of +/// validators which signed the original [SignedCommitment] and a merkle root of all signatures. +/// +/// This can be used by light clients for 2-phase interactive verification (for instance for +/// Ethereum Mainnet), in a commit-reveal like scheme, where first we submit only the signed +/// commitment witness and later on, the client picks only some signatures to verify at random. +#[derive(Debug, PartialEq, Eq, codec::Encode, codec::Decode)] +pub struct SignedCommitmentWitness { + /// The full content of the commitment. + pub commitment: Commitment, + + /// The bit vector of validators who signed the commitment. + pub signed_by: Vec, // TODO [ToDr] Consider replacing with bitvec crate + + /// A merkle root of signatures in the original signed commitment. + pub signatures_merkle_root: TMerkleRoot, +} + +impl SignedCommitmentWitness { + /// Convert [SignedCommitment] into [SignedCommitmentWitness]. + /// + /// This takes a [SignedCommitment], which contains full signatures + /// and converts it into a witness form, which does not contain full signatures, + /// only a bit vector indicating which validators have signed the original [SignedCommitment] + /// and a merkle root of all signatures. + /// + /// Returns the full list of signatures along with the witness. + pub fn from_signed( + signed: SignedCommitment, + merkelize: TMerkelize, + ) -> (Self, Vec>) + where + TMerkelize: FnOnce(&[Option]) -> TMerkleRoot, + { + let SignedCommitment { commitment, signatures } = signed; + let signed_by = signatures.iter().map(|s| s.is_some()).collect(); + let signatures_merkle_root = merkelize(&signatures); + + ( + Self { + commitment, + signed_by, + signatures_merkle_root, + }, + signatures, + ) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use codec::Decode; + + type TestCommitment = Commitment; + type TestSignedCommitment = SignedCommitment>; + type TestSignedCommitmentWitness = SignedCommitmentWitness>>>; + + fn signed_commitment() -> TestSignedCommitment { + let commitment: TestCommitment = Commitment { + payload: "Hello World!".into(), + block_number: 5, + validator_set_id: 0, + }; + + SignedCommitment { + commitment, + signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + } + } + + #[test] + fn should_convert_signed_commitment_to_witness() { + // given + let signed = signed_commitment(); + + // when + let (witness, signatures) = TestSignedCommitmentWitness::from_signed(signed, |sigs| sigs.to_vec()); + + // then + assert_eq!(witness.signatures_merkle_root, signatures); + } + + #[test] + fn should_encode_and_decode_witness() { + // given + let signed = signed_commitment(); + let (witness, _) = TestSignedCommitmentWitness::from_signed(signed, |sigs| sigs.to_vec()); + + // when + let encoded = codec::Encode::encode(&witness); + let decoded = TestSignedCommitmentWitness::decode(&mut &*encoded); + + // then + assert_eq!(decoded, Ok(witness)); + assert_eq!( + encoded, + hex_literal::hex!( + "3048656c6c6f20576f726c64210500000000000000000000000000000000000000000000001000000101100000011001020304011005060708" + ) + ); + } +} diff --git a/primitives/beefy/tests/basic_lc_operations.rs b/primitives/beefy/tests/basic_lc_operations.rs new file mode 100644 index 0000000000000..8445507374567 --- /dev/null +++ b/primitives/beefy/tests/basic_lc_operations.rs @@ -0,0 +1,358 @@ +// Copyright (C) 2020 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 . + +mod light_client; + +use self::light_client::{validator_set, Commitment, Error, Payload, SignedCommitment}; + +#[test] +fn light_client_should_make_progress() { + // given + let mut lc = light_client::new(); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 2, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }); + + // then + assert_eq!(result, Ok(())); + assert_eq!(lc.last_payload(), &Payload::new(1)); +} + +#[test] +fn should_verify_mmr_proof() { + // given + let mut lc = light_client::new(); + lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 2, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }) + .unwrap(); + + // when + let result = lc.verify_proof(light_client::merkle_tree::Proof::ValidFor(1.into(), ())); + + // then + assert_eq!(result, Ok(())); +} + +#[test] +fn should_reject_invalid_mmr_proof() { + // given + let mut lc = light_client::new(); + lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 2, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }) + .unwrap(); + + // when + let result = lc.verify_proof(light_client::merkle_tree::Proof::Invalid(())); + + // then + assert_eq!(result, Err(Error::InvalidMmrProof)); +} + +#[test] +fn light_client_should_reject_invalid_validator_set() { + // given + let mut lc = light_client::new(); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 1, + validator_set_id: 1, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }); + + // then + assert_eq!(result, Err(Error::InvalidValidatorSetId { expected: 0, got: 1 })); + assert_eq!(lc.last_commitment(), None); +} + +#[test] +fn light_client_should_reject_set_transitions_without_validator_proof() { + // given + let mut lc = light_client::new(); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 1, + validator_set_id: 1, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }); + + // then + assert_eq!(result, Err(Error::InvalidValidatorSetId { expected: 0, got: 1 })); + assert_eq!(lc.last_commitment(), None); +} + +#[test] +fn light_client_should_reject_older_block() { + // given + let mut lc = light_client::new(); + // jump to 10 + lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 10, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }) + .unwrap(); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 5, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }); + + // then + assert_eq!(result, Err(Error::OldBlock { best_known: 10, got: 5 })); +} + +#[test] +fn light_client_should_reject_if_not_enough_signatures() { + // given + let mut lc = light_client::new(); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 5, + validator_set_id: 0, + }, + signatures: vec![None], + }); + + // then + assert_eq!( + result, + Err(Error::NotEnoughValidSignatures { + expected: 1, + got: 0, + valid: None, + }) + ); +} + +#[test] +fn light_client_should_reject_if_too_many_or_too_little_signatures() { + // given + let mut lc = light_client::new(); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 5, + validator_set_id: 0, + }, + signatures: vec![None, None], + }); + let result2 = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 5, + validator_set_id: 0, + }, + signatures: vec![], + }); + + // then + assert_eq!(result, Err(Error::InvalidNumberOfSignatures { expected: 1, got: 2 })); + assert_eq!(result2, Err(Error::InvalidNumberOfSignatures { expected: 1, got: 0 })); +} + +#[test] +fn light_client_should_reject_if_not_enough_valid_signatures() { + // given + let mut lc = light_client::new(); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 5, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(1.into()))], + }); + + // then + assert_eq!( + result, + Err(Error::NotEnoughValidSignatures { + expected: 1, + got: 1, + valid: Some(0), + }) + ); + + // when + let result = lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload::new(1), + block_number: 5, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::Invalid)], + }); + + // then + assert_eq!( + result, + Err(Error::NotEnoughValidSignatures { + expected: 1, + got: 1, + valid: Some(0), + }) + ); +} + +#[test] +fn light_client_should_perform_set_transition() { + // given + let mut lc = light_client::new(); + lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload { + next_validator_set: Some(2.into()), + mmr: 1.into(), + }, + block_number: 5, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }) + .unwrap(); + + let commitment = SignedCommitment { + commitment: Commitment { + payload: Payload { + next_validator_set: None, + mmr: 1.into(), + }, + block_number: 6, + validator_set_id: 1, + }, + signatures: vec![ + Some(validator_set::Signature::ValidFor(1.into())), + Some(validator_set::Signature::ValidFor(2.into())), + ], + }; + + // when + let result = lc.import_set_transition( + commitment, + light_client::merkle_tree::Proof::ValidFor(2.into(), vec![1.into(), 2.into()]), + ); + + // then + assert_eq!(result, Ok(())); + assert_eq!(lc.validator_set(), &(1, vec![1.into(), 2.into()],)); +} + +#[test] +fn light_client_reject_set_transition_with_invalid_payload() { + // given + let mut lc = light_client::new(); + let commitment = SignedCommitment { + commitment: Commitment { + payload: Payload { + // missing validator set in the payload + next_validator_set: None, + mmr: 1.into(), + }, + block_number: 5, + validator_set_id: 1, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }; + + // when + let result = lc.import_set_transition( + commitment, + light_client::merkle_tree::Proof::ValidFor(2.into(), vec![0.into(), 1.into(), 2.into()]), + ); + + // then + assert_eq!(result, Err(Error::MissingNextValidatorSetData)); +} + +#[test] +fn light_client_reject_set_transition_with_invalid_proof() { + // given + let mut lc = light_client::new(); + lc.import(SignedCommitment { + commitment: Commitment { + payload: Payload { + next_validator_set: Some(1.into()), + mmr: 0.into(), + }, + block_number: 3, + validator_set_id: 0, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }) + .unwrap(); + let commitment = SignedCommitment { + commitment: Commitment { + payload: Payload { + next_validator_set: None, + mmr: 1.into(), + }, + block_number: 5, + validator_set_id: 1, + }, + signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + }; + + // when + let result = lc.import_set_transition( + commitment, + light_client::merkle_tree::Proof::ValidFor(2.into(), vec![0.into(), 1.into(), 2.into()]), + ); + + // then + assert_eq!(result, Err(Error::InvalidValidatorSetProof)); +} diff --git a/primitives/beefy/tests/bridge_parachain_flow.rs b/primitives/beefy/tests/bridge_parachain_flow.rs new file mode 100644 index 0000000000000..38c41c264eed8 --- /dev/null +++ b/primitives/beefy/tests/bridge_parachain_flow.rs @@ -0,0 +1,111 @@ +// Copyright (C) 2020 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 . + +//! A set of examples how the bridge would operate. + +// struct MerkleMountainRangeLeaf( +// ( +// /// This is populated only for epoch blocks and contains a merkle root of the NEXT +// /// validator set. +// Option, +// /// +// MerkleRootOfParaHeads, +// /// +// ParentBlockHash, +// ), +// ) +// +// #[test] +// fn light_client_andres_case() { +// // we submit block 10 (1st phase) +// +// // an app submitting a mmr proof against this hash from block10 +// +// +// // we are at block 10 doing second phase for it. (validatorset=1) +// .. +// +// // we got block 20 (validatorset=1) +// +// .. +// } +// +// #[test] +// fn solidity_light_client_makes_progress() { +// let lc = SolidityContractOnEthereum; +// // +// lc.submit(PartialSignedCommitment {}); +// +// // For epoch blocks +// lc.submit(PartialSignedCommitment {}, MMMProofOfMerkleProofOfPublicKeys); +// +// //TODO: 2nd phase verification +// lc.submit_signatures( +// Vec<(idx, PublicKey)>, +// Vec<(idx, Signature)>, +// MerkleProofOfPublicKeys, +// MerkleProofOfSignatures, +// ); +// } +// +// #[test] +// fn light_client_makes_progress() { +// let lc = ...; +// +// lc.submit(SignedCommitment, None); +// +// // if the validator_set_id_changes we require an extra proof. +// lc.submit(SignedCommitment, Some(Vec + MMRProofForTheValidatorMerkleRoot)); +// } +// +// #[test] +// fn can_process_bridge_messages() { +// // ParachainY -HRMP->ParachainX +// // ParachainX -> SmartContractX +// // +// // +// // +// // RelayChain -> BridgeSmartContract +// // +// // +// // x +// // ........................... Relay Chian Blocks +// // c c c c c c | c c c c c c c Generated comittment (by BEEFY) +// // ^ ^ ^ ^ Commitment seen by the light client +// // * 2nd-phase proven commitments. +// // l l +// // +// // x +// // ....a...................... +// // c c c c c c | c c c c c c c +// // ^ ^ +// // * +// +// +// +// let heavy_proof = ( +// ParachainSpecificProof, // for instance storage proof on a parachain +// ParachainHead, +// MerkleProofOfParachainHeadAtTheRelayChainBlockXWhenParachainHeadGotIncluded, +// //MmrProofOfRelayChainBlock, +// Block10 +// ); +// +// let lighter_proof = ( +// MmrProofOfRelayChainBlock, +// +// ); +// } diff --git a/primitives/beefy/tests/light_client/merkle_tree.rs b/primitives/beefy/tests/light_client/merkle_tree.rs new file mode 100644 index 0000000000000..cdd2fd87dd04d --- /dev/null +++ b/primitives/beefy/tests/light_client/merkle_tree.rs @@ -0,0 +1,70 @@ +// Copyright (C) 2020 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::marker::PhantomData; + +#[derive(Debug)] +pub struct Root { + root: u32, + _data: PhantomData, +} + +impl Clone for Root { + fn clone(&self) -> Self { + Self::new(self.root) + } +} + +impl Root { + pub fn new(root: u32) -> Self { + Self { + root, + _data: Default::default(), + } + } +} + +impl From for Root { + fn from(root: u32) -> Self { + Self::new(root) + } +} + +impl Eq for Root {} +impl PartialEq for Root { + fn eq(&self, other: &Self) -> bool { + self.root == other.root + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum Proof { + ValidFor(Root, X), + Invalid(X), +} + +impl Proof { + pub fn is_valid(&self, root: &Root) -> bool { + matches!(self, Self::ValidFor(ref expected, _) if expected == root) + } + + pub fn into_data(self) -> X { + match self { + Self::ValidFor(_, d) => d, + Self::Invalid(d) => d, + } + } +} diff --git a/primitives/beefy/tests/light_client/mod.rs b/primitives/beefy/tests/light_client/mod.rs new file mode 100644 index 0000000000000..8825a4f2dc0d1 --- /dev/null +++ b/primitives/beefy/tests/light_client/mod.rs @@ -0,0 +1,249 @@ +// Copyright (C) 2020 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 beefy_primitives::{self as bp, ValidatorSetId}; + +pub mod merkle_tree; +pub mod validator_set; + +/// A marker struct for validator set merkle tree. +#[derive(Debug)] +pub struct ValidatorSetTree; + +/// A marker struct for the MMR. +#[derive(Debug)] +pub struct Mmr; + +#[derive(Debug, PartialEq, Eq)] +pub struct Payload { + pub next_validator_set: Option>, + pub mmr: merkle_tree::Root, +} + +impl Payload { + pub fn new(root: u32) -> Self { + Self { + next_validator_set: None, + mmr: root.into(), + } + } +} + +pub type BlockNumber = u64; +pub type Commitment = bp::Commitment; +pub type SignedCommitment = bp::SignedCommitment; + +#[derive(Debug, PartialEq, Eq)] +pub enum Error { + /// [Commitment] can't be imported, cause it's signed by either past or future validator set. + InvalidValidatorSetId { + expected: ValidatorSetId, + got: ValidatorSetId, + }, + /// [Commitment] can't be imported, cause it's a set transition block and the proof is missing. + InvalidValidatorSetProof, + /// [Commitment] is not useful, cause it's made for an older block than we know of. + /// + /// In practice it's okay for the light client to import such commitments (if the validator set + /// matches), but it doesn't provide any more value, since the payload is meant to be + /// cumulative. + /// It might be useful however, if we want to verify proofs that were generated against this + /// specific block number. + OldBlock { + /// Best block currently known by the light client. + best_known: BlockNumber, + /// Block in the commitment. + got: BlockNumber, + }, + /// There are too many signatures in the commitment - more than validators. + InvalidNumberOfSignatures { + /// Number of validators in the set. + expected: usize, + /// Numbers of signatures in the commitment. + got: usize, + }, + /// [SignedCommitment] doesn't have enough valid signatures. + NotEnoughValidSignatures { + expected: usize, + got: usize, + valid: Option, + }, + /// Next validator set has not been provided by any of the previous commitments. + MissingNextValidatorSetData, + /// Couldn't verify the proof against MMR root of the latest commitment. + InvalidMmrProof, +} + +type ValidatorSet = (ValidatorSetId, Vec); + +pub struct LightClient { + validator_set: ValidatorSet, + next_validator_set: Option>, + last_commitment: Option, +} + +impl LightClient { + pub fn import(&mut self, signed: SignedCommitment) -> Result<(), Error> { + // Make sure it's not a set transition block (see [import_set_transition]). + if signed.commitment.validator_set_id != self.validator_set.0 { + return Err(Error::InvalidValidatorSetId { + expected: self.validator_set.0, + got: signed.commitment.validator_set_id, + }); + } + + let commitment = self.validate_commitment(signed, &self.validator_set)?; + if let Some(ref next_validator_set) = commitment.payload.next_validator_set { + self.next_validator_set = Some(next_validator_set.clone()); + } + self.last_commitment = Some(commitment); + + Ok(()) + } + + pub fn import_set_transition( + &mut self, + signed: SignedCommitment, + validator_set_proof: merkle_tree::Proof>, + ) -> Result<(), Error> { + // Make sure it is a set transition block (see [import]). + if signed.commitment.validator_set_id != self.validator_set.0 + 1 { + return Err(Error::InvalidValidatorSetId { + expected: self.validator_set.0 + 1, + got: signed.commitment.validator_set_id, + }); + } + + // verify validator set proof + let validator_set_root = self + .next_validator_set + .as_ref() + .ok_or(Error::MissingNextValidatorSetData)?; + if !validator_set_proof.is_valid(validator_set_root) { + return Err(Error::InvalidValidatorSetProof); + } + let set = validator_set_proof.into_data(); + let new_id = self.validator_set.0 + 1; + let new_validator_set = (new_id, set); + + let commitment = self.validate_commitment(signed, &new_validator_set)?; + + self.validator_set = new_validator_set; + self.next_validator_set = commitment.payload.next_validator_set.clone(); + self.last_commitment = Some(commitment); + + Ok(()) + } + + pub fn verify_proof(&self, proof: merkle_tree::Proof) -> Result { + if proof.is_valid(&self.last_payload().mmr) { + Ok(proof.into_data()) + } else { + Err(Error::InvalidMmrProof) + } + } + + pub fn validator_set(&self) -> &ValidatorSet { + &self.validator_set + } + + pub fn last_commitment(&self) -> Option<&Commitment> { + self.last_commitment.as_ref() + } + + pub fn last_payload(&self) -> &Payload { + &self + .last_commitment() + .expect("Genesis doesn't contain commitment.") + .payload + } + + fn validate_commitment( + &self, + commitment: SignedCommitment, + validator_set: &ValidatorSet, + ) -> Result { + let no_of_non_empty_signatures = commitment.no_of_signatures(); + let SignedCommitment { commitment, signatures } = commitment; + // Make sure it's signed by the current validator set we know of. + if validator_set.0 != commitment.validator_set_id { + return Err(Error::InvalidValidatorSetId { + expected: validator_set.0, + got: commitment.validator_set_id, + }); + } + + // Make sure it's not worse than what we already have. + let best_block = self.last_commitment().map(|c| c.block_number).unwrap_or(0); + if commitment.block_number <= best_block { + return Err(Error::OldBlock { + best_known: best_block, + got: commitment.block_number, + }); + } + + // check number of signatures + let validator_set_count = validator_set.1.len(); + if signatures.len() != validator_set_count { + return Err(Error::InvalidNumberOfSignatures { + expected: validator_set_count, + got: signatures.len(), + }); + } + + // check the validity of signatures + let minimal_number_of_signatures = Self::minimal_number_of_signatures(validator_set); + if no_of_non_empty_signatures < minimal_number_of_signatures { + return Err(Error::NotEnoughValidSignatures { + expected: minimal_number_of_signatures, + got: no_of_non_empty_signatures, + valid: None, + }); + } + + let mut valid = 0; + for (signature, public) in signatures.into_iter().zip(validator_set.1.iter()) { + match signature { + Some(signature) if signature.is_valid_for(&public) => { + valid += 1; + } + _ => {} + } + } + + if valid < minimal_number_of_signatures { + return Err(Error::NotEnoughValidSignatures { + expected: minimal_number_of_signatures, + got: no_of_non_empty_signatures, + valid: Some(valid), + }); + } + + Ok(commitment) + } + + fn minimal_number_of_signatures(set: &ValidatorSet) -> usize { + 2 * set.1.len() / 3 + 1 + } +} + +pub fn new() -> LightClient { + LightClient { + validator_set: (0, vec![validator_set::Public(0)]), + next_validator_set: None, + last_commitment: None, + } +} diff --git a/primitives/beefy/tests/light_client/validator_set.rs b/primitives/beefy/tests/light_client/validator_set.rs new file mode 100644 index 0000000000000..67fe03bf0d8e1 --- /dev/null +++ b/primitives/beefy/tests/light_client/validator_set.rs @@ -0,0 +1,36 @@ +// Copyright (C) 2020 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 . + +#[derive(Debug, PartialEq, Eq)] +pub struct Public(pub u8); + +impl From for Public { + fn from(public: u8) -> Self { + Self(public) + } +} + +#[derive(Debug)] +pub enum Signature { + ValidFor(Public), + Invalid, +} + +impl Signature { + pub fn is_valid_for(&self, public: &Public) -> bool { + matches!(self, Self::ValidFor(ref p) if p == public) + } +} From 162cc4cd2e9a302c47d99b5655b6be7df5e5780c Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Thu, 4 Feb 2021 08:50:00 +0100 Subject: [PATCH 021/109] Migrate beefy-pallet to FRAMEv2 (#76) * migrate beefy-pallet to FRAMEv2 * Code review Co-authored-by: Hernando Castano Co-authored-by: Hernando Castano --- frame/beefy/src/lib.rs | 106 ++++++++++++++++++++++++++++------------- 1 file changed, 72 insertions(+), 34 deletions(-) diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index fe2197944b7f4..82f6ee277b2d3 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020-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 @@ -18,7 +18,7 @@ use codec::Encode; -use frame_support::{decl_module, decl_storage, traits::OneSessionHandler, Parameter}; +use frame_support::{traits::OneSessionHandler, Parameter}; use sp_runtime::{ generic::DigestItem, @@ -35,37 +35,73 @@ mod mock; #[cfg(test)] mod tests; -pub trait Config: frame_system::Config { - /// The identifier type for an authority. - type AuthorityId: Member + Parameter + RuntimeAppPublic + Default; -} +pub use pallet::*; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Authority identifier type + type AuthorityId: Member + Parameter + RuntimeAppPublic + Default + MaybeSerializeDeserialize; + } + + #[pallet::pallet] + pub struct Pallet(PhantomData); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet {} + + /// The current authorities set + #[pallet::storage] + #[pallet::getter(fn authorities)] + pub(super) type Authorities = StorageValue<_, Vec, ValueQuery>; + + /// The current validator set id + #[pallet::storage] + #[pallet::getter(fn validator_set_id)] + pub(super) type ValidatorSetId = StorageValue<_, beefy_primitives::ValidatorSetId, ValueQuery>; -decl_storage! { - trait Store for Module as Beefy { - /// The current list of authorities. - pub Authorities get(fn authorities): Vec; - /// The current validator set id. - pub ValidatorSetId get(fn validator_set_id): beefy_primitives::ValidatorSetId; - /// Authorities scheduled for the next session. - pub NextAuthorities get(fn next_authorities): Vec; + /// Authorities set scheduled to be used with the next session + #[pallet::storage] + #[pallet::getter(fn next_authorities)] + pub(super) type NextAuthorities = StorageValue<_, Vec, ValueQuery>; + + #[pallet::genesis_config] + pub struct GenesisConfig { + pub authorities: Vec, } - add_extra_genesis { - config(authorities): Vec; - build(|config| Module::::initialize_authorities(&config.authorities)) + + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + Self { + authorities: Vec::new(), + } + } } -} -decl_module! { - pub struct Module for enum Call where origin: T::Origin { } + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + Pallet::::initialize_authorities(&self.authorities); + } + } } -impl Module { +impl Pallet { fn change_authorities(new: Vec, queued: Vec) { - // As in GRANDPA, we don't trigger validator set change if the set actually - // remains the same. + // As in GRANDPA, we trigger a validator set change only if the the validator + // set has actually changed. if new != Self::authorities() { >::put(&new); - ::put(Self::validator_set_id() + 1); + >::put(Self::validator_set_id() + 1); let log: DigestItem = DigestItem::Consensus(BEEFY_ENGINE_ID, ConsensusLog::AuthoritiesChange(new).encode()); >::deposit_log(log); @@ -75,17 +111,19 @@ impl Module { } fn initialize_authorities(authorities: &[T::AuthorityId]) { - if !authorities.is_empty() { - assert!( - >::get().is_empty(), - "Authorities are already initialized!" - ); - >::put(authorities); - ::put(0); - // for consistency we initialize the next validator set as well. - // Note it's an assumption in the `pallet_session` as well. - >::put(authorities); + if authorities.is_empty() { + return; } + + assert!( + >::get().is_empty(), + "Authorities are already initialized!" + ); + + >::put(authorities); + >::put(0); + // Like `pallet_session`, initialize the next validator set as well. + >::put(authorities); } } From bb093c9359721205f217868b92a98327bab6fafa Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 5 Feb 2021 15:48:13 +0100 Subject: [PATCH 022/109] Run BEEFY worker as non-validator (#77) * run BEEFY worker as non-validator * don't check for roloe.is_authority * change enum type name --- client/beefy/src/lib.rs | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index ba455eeb2ebd3..b57c40784bafe 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -164,8 +164,13 @@ struct VoteMessage { signature: Signature, } +enum BeefyId { + Validator(Id), + None, +} + struct BeefyWorker { - local_id: Id, + local_id: BeefyId, key_store: SyncCryptoStorePtr, min_interval: u32, rounds: Rounds, Id, Signature>, @@ -182,7 +187,7 @@ where { #[allow(clippy::too_many_arguments)] fn new( - local_id: Id, + local_id: BeefyId, key_store: SyncCryptoStorePtr, authorities: Vec, finality_notifications: FinalityNotifications, @@ -216,6 +221,11 @@ where use sp_runtime::traits::Saturating; use sp_runtime::SaturatedConversion; + // we only vote as a validator + if let BeefyId::None = self.local_id { + return false; + } + let diff = self.best_finalized_block.saturating_sub(self.best_block_voted_on); let diff = diff.saturated_into::(); let next_power_of_two = (diff / 2).next_power_of_two(); @@ -237,6 +247,13 @@ where debug!(target: "beefy", "Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { + let local_id = if let BeefyId::Validator(id) = &self.local_id { + id + } else { + warn!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); + return; + }; + let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { hash } else { @@ -255,7 +272,7 @@ where let signature = match SyncCryptoStore::sign_with( &*self.key_store, KEY_TYPE, - &self.local_id.to_public_crypto_pair(), + &local_id.to_public_crypto_pair(), &commitment.encode(), ) .map_err(|_| ()) @@ -272,7 +289,7 @@ where let message = VoteMessage { commitment, - id: self.local_id.clone(), + id: local_id.clone(), signature, }; @@ -397,11 +414,11 @@ pub async fn start_beefy_gadget { info!(target: "beefy", "🥩 Starting BEEFY worker with local id: {:?}", id); - id.clone() + BeefyId::Validator(id.clone()) } None => { - info!(target: "beefy", "🥩 No local id found, not starting BEEFY worker."); - return futures::future::pending().await; + info!(target: "beefy", "🥩 No local id found, BEEFY worker will be gossip only."); + BeefyId::None } }; @@ -409,7 +426,7 @@ pub async fn start_beefy_gadget::new( - local_id.clone(), + local_id, key_store, authorities, client.finality_notification_stream(), From a0706aabca80d2f9488d40b56230800707e2145b Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 8 Feb 2021 11:56:49 +0100 Subject: [PATCH 023/109] Bump Substrate and Deps (#79) --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index fdd5f32d4ad0c..721b800553e5a 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" futures = { version = "0.3.12", features = ["compat"] } log = "0.4" serde = { version = "1.0.123", features = ["derive"] } -serde_json = "1.0.61" +serde_json = "1.0.62" jsonrpc-core = "15.1.0" jsonrpc-core-client = "15.1.0" From 152e58880388e5b5a2b13e1c0ef02359e10124aa Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 8 Feb 2021 21:31:11 +0100 Subject: [PATCH 024/109] Add BEEFY gadget as extra peer set (#80) * Add BEEFY gadget as extra peer set * use BEEFY protocol --- client/beefy/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index b57c40784bafe..25ee4a266578e 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -47,6 +47,21 @@ use notification::BeefySignedCommitmentSender; pub const BEEFY_PROTOCOL_NAME: &str = "/paritytech/beefy/1"; +/// Returns the configuration value to put in +/// [`sc_network::config::NetworkConfiguration::extra_sets`]. +pub fn beefy_peers_set_config() -> sc_network::config::NonDefaultSetConfig { + sc_network::config::NonDefaultSetConfig { + notifications_protocol: BEEFY_PROTOCOL_NAME.into(), + max_notification_size: 1024 * 1024, + set_config: sc_network::config::SetConfig { + in_peers: 25, + out_peers: 25, + reserved_nodes: Vec::new(), + non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept, + }, + } +} + /// Allows all gossip messages to get through. struct AllowAll { topic: Hash, From 442c741a9ed66ef56de1c553178471655404ccb1 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 15 Feb 2021 15:03:48 +0100 Subject: [PATCH 025/109] Add ValidatorSetId to BEEFY digest (#85) * add ValidatorSetId to BEEFY digest * apply review changes --- frame/beefy/src/lib.rs | 15 ++++++++++++--- frame/beefy/src/tests.rs | 8 ++++---- primitives/beefy/src/lib.rs | 7 ++++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index 82f6ee277b2d3..41ad926fe8aa1 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -101,9 +101,18 @@ impl Pallet { // set has actually changed. if new != Self::authorities() { >::put(&new); - >::put(Self::validator_set_id() + 1); - let log: DigestItem = - DigestItem::Consensus(BEEFY_ENGINE_ID, ConsensusLog::AuthoritiesChange(new).encode()); + + let next = Self::validator_set_id() + 1u64; + >::put(next); + + let log: DigestItem = DigestItem::Consensus( + BEEFY_ENGINE_ID, + ConsensusLog::AuthoritiesChange { + new_validator_set: new, + new_validator_set_id: next, + } + .encode(), + ); >::deposit_log(log); } diff --git a/frame/beefy/src/tests.rs b/frame/beefy/src/tests.rs index ee10bbc66f559..2e41683ed33b1 100644 --- a/frame/beefy/src/tests.rs +++ b/frame/beefy/src/tests.rs @@ -69,10 +69,10 @@ fn session_change_updates_authorities() { assert!(1 == Beefy::validator_set_id()); - let want = beefy_log(ConsensusLog::AuthoritiesChange(vec![ - mock_beefy_id(3), - mock_beefy_id(4), - ])); + let want = beefy_log(ConsensusLog::AuthoritiesChange { + new_validator_set: vec![mock_beefy_id(3), mock_beefy_id(4)], + new_validator_set_id: 1, + }); let log = System::digest().logs[0].clone(); diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 0ddfd0fa46f41..1b3395c46a47b 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -80,7 +80,12 @@ pub type MmrRootHash = H256; pub enum ConsensusLog { /// The authorities have changed. #[codec(index = 1)] - AuthoritiesChange(Vec), + AuthoritiesChange { + /// Set of new validators to be used + new_validator_set: Vec, + /// Id for this new set of validators + new_validator_set_id: ValidatorSetId, + }, /// Disable the authority with given index. #[codec(index = 2)] OnDisabled(AuthorityIndex), From 66b2b8d058dd44cd46c88e4e9d0dfe5ba8f5c73f Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Sat, 27 Feb 2021 07:29:39 +0100 Subject: [PATCH 026/109] Bump Substrate and Deps (#91) * Bump Substrate and Deps * Bump Substrate again in order to include a hot-fix * redo again * use CryptoStore issue * cargo fmt --- client/beefy/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 25ee4a266578e..ab97cca5c2ce3 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -284,6 +284,7 @@ where validator_set_id: 0, }; + // TODO #92 let signature = match SyncCryptoStore::sign_with( &*self.key_store, KEY_TYPE, @@ -291,8 +292,11 @@ where &commitment.encode(), ) .map_err(|_| ()) - .and_then(|res| res.try_into().map_err(|_| ())) - { + .and_then(|res| { + res.expect("closure won't be called in case of an error; qed") + .try_into() + .map_err(|_| ()) + }) { Ok(sig) => sig, Err(err) => { warn!(target: "beefy", "Error signing: {:?}", err); From 5aef902f12a0da222b1b69baee61bf22e51acd53 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 05:13:41 +0000 Subject: [PATCH 027/109] Bump serde_json from 1.0.63 to 1.0.64 (#93) --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 721b800553e5a..91258ad484015 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" futures = { version = "0.3.12", features = ["compat"] } log = "0.4" serde = { version = "1.0.123", features = ["derive"] } -serde_json = "1.0.62" +serde_json = "1.0.64" jsonrpc-core = "15.1.0" jsonrpc-core-client = "15.1.0" From 639790abc20542aa1784ba6fc612b40490de0e2c Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 3 Mar 2021 15:42:34 +0100 Subject: [PATCH 028/109] Track BEEFY validator set (#94) * Track BEEFY validator set * Add validator_set_id to BeefyWorker * Make validattor_set_id optional --- client/beefy/src/lib.rs | 59 +++++++++++++++++++++++++++++-------- frame/beefy/src/lib.rs | 14 ++++----- frame/beefy/src/tests.rs | 10 ++++--- primitives/beefy/src/lib.rs | 16 ++++++---- 4 files changed, 70 insertions(+), 29 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index ab97cca5c2ce3..0722f00d0797b 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -24,7 +24,10 @@ use futures::{future, FutureExt, Stream, StreamExt}; use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; -use beefy_primitives::{BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, BEEFY_ENGINE_ID, KEY_TYPE}; +use beefy_primitives::{ + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, + KEY_TYPE, +}; use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; use sc_network_gossip::{ @@ -194,6 +197,7 @@ struct BeefyWorker { signed_commitment_sender: BeefySignedCommitmentSender, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, + validator_set_id: Option, } impl BeefyWorker @@ -210,6 +214,7 @@ where signed_commitment_sender: BeefySignedCommitmentSender, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, + validator_set_id: Option, ) -> Self { BeefyWorker { local_id, @@ -221,6 +226,7 @@ where signed_commitment_sender, best_finalized_block, best_block_voted_on, + validator_set_id, } } } @@ -259,7 +265,7 @@ where } fn handle_finality_notification(&mut self, notification: FinalityNotification) { - debug!(target: "beefy", "Finality notification: {:?}", notification); + debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { let local_id = if let BeefyId::Validator(id) = &self.local_id { @@ -276,12 +282,22 @@ where return; }; - // TODO: this needs added support for validator set changes (and abstracting the - // "thing to sign" would be nice). + if let Some(new) = find_authorities_change::(¬ification.header) { + debug!(target: "beefy", "🥩 New validator set: {:?}", new); + self.validator_set_id = Some(new.id); + }; + + let current_set_id = if let Some(set_id) = self.validator_set_id { + set_id + } else { + warn!(target: "beefy", "🥩 Unknown validator set id - can't vote for: {:?}", notification.header.hash()); + return; + }; + let commitment = Commitment { payload: mmr_root, block_number: notification.header.number(), - validator_set_id: 0, + validator_set_id: current_set_id, }; // TODO #92 @@ -299,7 +315,7 @@ where }) { Ok(sig) => sig, Err(err) => { - warn!(target: "beefy", "Error signing: {:?}", err); + warn!(target: "beefy", "🥩 Error signing: {:?}", err); return; } }; @@ -316,7 +332,7 @@ where .lock() .gossip_message(topic::(), message.encode(), false); - debug!(target: "beefy", "Sent vote message: {:?}", message); + debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); self.handle_vote( (message.commitment.payload, *message.commitment.block_number), @@ -333,12 +349,12 @@ where if vote_added && self.rounds.is_done(&round) { if let Some(signatures) = self.rounds.drop(&round) { - // TODO: this needs added support for validator set changes (and abstracting the - // "thing to sign" would be nice). let commitment = Commitment { payload: round.0, block_number: round.1, - validator_set_id: 0, + validator_set_id: self + .validator_set_id + .expect("We voted only in case of a valid validator_set_id; qed"), }; let signed_commitment = SignedCommitment { commitment, signatures }; @@ -353,7 +369,7 @@ where async fn run(mut self) { let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( |notification| async move { - debug!(target: "beefy", "Got vote message: {:?}", notification); + debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); VoteMessage::, Id, Signature>::decode(&mut ¬ification.message[..]).ok() }, @@ -382,7 +398,7 @@ where } }, _ = gossip_engine.fuse() => { - error!(target: "beefy", "Gossip engine has terminated."); + error!(target: "beefy", "🥩 Gossip engine has terminated."); return; } } @@ -453,6 +469,8 @@ pub async fn start_beefy_gadget(header: &B::Header) -> Option> +where + B: BlockT, + Id: Codec, +{ + let id = OpaqueDigestItemId::Consensus(&BEEFY_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)) +} diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index 41ad926fe8aa1..7ecf93fcde536 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -27,7 +27,7 @@ use sp_runtime::{ }; use sp_std::prelude::*; -use beefy_primitives::{AuthorityIndex, ConsensusLog, BEEFY_ENGINE_ID}; +use beefy_primitives::{AuthorityIndex, ConsensusLog, ValidatorSet, BEEFY_ENGINE_ID}; #[cfg(test)] mod mock; @@ -102,15 +102,15 @@ impl Pallet { if new != Self::authorities() { >::put(&new); - let next = Self::validator_set_id() + 1u64; - >::put(next); + let next_id = Self::validator_set_id() + 1u64; + >::put(next_id); let log: DigestItem = DigestItem::Consensus( BEEFY_ENGINE_ID, - ConsensusLog::AuthoritiesChange { - new_validator_set: new, - new_validator_set_id: next, - } + ConsensusLog::AuthoritiesChange(ValidatorSet { + validators: new, + id: next_id, + }) .encode(), ); >::deposit_log(log); diff --git a/frame/beefy/src/tests.rs b/frame/beefy/src/tests.rs index 2e41683ed33b1..186334f362450 100644 --- a/frame/beefy/src/tests.rs +++ b/frame/beefy/src/tests.rs @@ -16,6 +16,7 @@ use std::vec; +use beefy_primitives::ValidatorSet; use codec::Encode; use sp_core::H256; @@ -69,16 +70,17 @@ fn session_change_updates_authorities() { assert!(1 == Beefy::validator_set_id()); - let want = beefy_log(ConsensusLog::AuthoritiesChange { - new_validator_set: vec![mock_beefy_id(3), mock_beefy_id(4)], - new_validator_set_id: 1, - }); + let want = beefy_log(ConsensusLog::AuthoritiesChange(ValidatorSet { + validators: vec![mock_beefy_id(3), mock_beefy_id(4)], + id: 1, + })); let log = System::digest().logs[0].clone(); assert_eq!(want, log); }); } + #[test] fn session_change_updates_next_authorities() { let want = vec![mock_beefy_id(1), mock_beefy_id(2), mock_beefy_id(3), mock_beefy_id(4)]; diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 1b3395c46a47b..fcc21590ff5ce 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -69,6 +69,15 @@ pub const BEEFY_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"BEEF"; /// A typedef for validator set id. pub type ValidatorSetId = u64; +/// A set of BEEFY authorities, a.k.a. validators. +#[derive(Decode, Encode, Debug)] +pub struct ValidatorSet { + /// Public keys of the validator set elements + pub validators: Vec, + /// Identifier of the validator set + pub id: ValidatorSetId, +} + /// The index of an authority. pub type AuthorityIndex = u32; @@ -80,12 +89,7 @@ pub type MmrRootHash = H256; pub enum ConsensusLog { /// The authorities have changed. #[codec(index = 1)] - AuthoritiesChange { - /// Set of new validators to be used - new_validator_set: Vec, - /// Id for this new set of validators - new_validator_set_id: ValidatorSetId, - }, + AuthoritiesChange(ValidatorSet), /// Disable the authority with given index. #[codec(index = 2)] OnDisabled(AuthorityIndex), From 314fa206c2a9b8df66f1e63867fa8d4f1a106e89 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Thu, 4 Mar 2021 06:38:55 +0100 Subject: [PATCH 029/109] Ad 92 (#97) * sign_commitment() * Error handling todo --- client/beefy/src/lib.rs | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 0722f00d0797b..4cd2aa6e67a1e 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -264,6 +264,17 @@ where number == next_block_to_vote_on } + fn sign_commitment(&self, id: &Id, commitment: &[u8]) -> Option { + let sig = SyncCryptoStore::sign_with(&*self.key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) + .ok() + .flatten()? + .try_into() + .ok()?; + + // TODO #98 - return errors as well + Some(sig) + } + fn handle_finality_notification(&mut self, notification: FinalityNotification) { debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); @@ -300,22 +311,10 @@ where validator_set_id: current_set_id, }; - // TODO #92 - let signature = match SyncCryptoStore::sign_with( - &*self.key_store, - KEY_TYPE, - &local_id.to_public_crypto_pair(), - &commitment.encode(), - ) - .map_err(|_| ()) - .and_then(|res| { - res.expect("closure won't be called in case of an error; qed") - .try_into() - .map_err(|_| ()) - }) { - Ok(sig) => sig, - Err(err) => { - warn!(target: "beefy", "🥩 Error signing: {:?}", err); + let signature = match self.sign_commitment(local_id, commitment.encode().as_ref()) { + Some(sig) => sig, + None => { + warn!(target: "beefy", "🥩 Error signing commitment: {:?}", commitment); return; } }; From 4e2f63aed4b62f696f56fa4f4e4d71aee860f33b Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 5 Mar 2021 14:36:12 +0100 Subject: [PATCH 030/109] Add error type (#99) * Add error type * Address review --- client/beefy/Cargo.toml | 2 ++ client/beefy/src/error.rs | 32 ++++++++++++++++++++++++++++++++ client/beefy/src/lib.rs | 35 +++++++++++++++++++++-------------- 3 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 client/beefy/src/error.rs diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 1adbab6b8d789..9ab9a36881c5f 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -7,8 +7,10 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = "0.3" +hex = "0.4" log = "0.4" parking_lot = "0.11" +thiserror = "1.0" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } diff --git a/client/beefy/src/error.rs b/client/beefy/src/error.rs new file mode 100644 index 0000000000000..b5bddd665108e --- /dev/null +++ b/client/beefy/src/error.rs @@ -0,0 +1,32 @@ +// Copyright (C) 2020-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::fmt::Debug; + +use sp_core::crypto::Public; + +/// BEEFY gadget specific errors +/// Note that this type is currently used for BEEFY gadget internal +/// error handling only. +#[derive(Debug, thiserror::Error)] +pub(crate) enum Error { + /// Check signature error + #[error("Message signature {0} by {1:?} is invalid.")] + InvalidSignature(String, Id), + /// Sign commitment error + #[error("Failed to sign comitment using key: {0:?}. Reason: {1}")] + CannotSign(Id, String), +} diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 4cd2aa6e67a1e..3d14e3af346f6 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020-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 @@ -19,10 +19,13 @@ use std::convert::{TryFrom, TryInto}; use std::fmt::Debug; use std::sync::Arc; -use codec::{Codec, Decode, Encode}; -use futures::{future, FutureExt, Stream, StreamExt}; -use log::{debug, error, info, trace, warn}; -use parking_lot::Mutex; +use { + codec::{Codec, Decode, Encode}, + futures::{future, FutureExt, Stream, StreamExt}, + hex::ToHex, + log::{debug, error, info, trace, warn}, + parking_lot::Mutex, +}; use beefy_primitives::{ BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, @@ -44,6 +47,8 @@ use sp_runtime::{ traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}, }; +mod error; + pub mod notification; use notification::BeefySignedCommitmentSender; @@ -264,15 +269,17 @@ where number == next_block_to_vote_on } - fn sign_commitment(&self, id: &Id, commitment: &[u8]) -> Option { + fn sign_commitment(&self, id: &Id, commitment: &[u8]) -> Result> { let sig = SyncCryptoStore::sign_with(&*self.key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) - .ok() - .flatten()? + .map_err(|e| error::Error::CannotSign((*id).clone(), e.to_string()))? + .ok_or_else(|| error::Error::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; + + let sig = sig + .clone() .try_into() - .ok()?; + .map_err(|_| error::Error::InvalidSignature(sig.encode_hex(), (*id).clone()))?; - // TODO #98 - return errors as well - Some(sig) + Ok(sig) } fn handle_finality_notification(&mut self, notification: FinalityNotification) { @@ -312,9 +319,9 @@ where }; let signature = match self.sign_commitment(local_id, commitment.encode().as_ref()) { - Some(sig) => sig, - None => { - warn!(target: "beefy", "🥩 Error signing commitment: {:?}", commitment); + Ok(sig) => sig, + Err(err) => { + warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err); return; } }; From ab1039dc1bc671b5a170d9c49b2c648557a5237d Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 5 Mar 2021 16:17:34 +0100 Subject: [PATCH 031/109] Extract worker and round logic (#104) --- client/beefy/src/lib.rs | 411 +++---------------------------------- client/beefy/src/round.rs | 104 ++++++++++ client/beefy/src/worker.rs | 310 ++++++++++++++++++++++++++++ 3 files changed, 438 insertions(+), 387 deletions(-) create mode 100644 client/beefy/src/round.rs create mode 100644 client/beefy/src/worker.rs diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 3d14e3af346f6..152d574564981 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -14,45 +14,35 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::collections::BTreeMap; -use std::convert::{TryFrom, TryInto}; -use std::fmt::Debug; -use std::sync::Arc; +use std::{convert::TryFrom, fmt::Debug, sync::Arc}; -use { - codec::{Codec, Decode, Encode}, - futures::{future, FutureExt, Stream, StreamExt}, - hex::ToHex, - log::{debug, error, info, trace, warn}, - parking_lot::Mutex, -}; +use {codec::Codec, log::info}; -use beefy_primitives::{ - BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, - KEY_TYPE, -}; +use beefy_primitives::{BeefyApi, KEY_TYPE}; -use sc_client_api::{Backend as BackendT, BlockchainEvents, FinalityNotification, Finalizer}; -use sc_network_gossip::{ - GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, Validator as GossipValidator, - ValidatorContext as GossipValidatorContext, +use { + sc_client_api::{Backend as BackendT, BlockchainEvents, Finalizer}, + sc_network_gossip::{ + GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, + Validator as GossipValidator, ValidatorContext as GossipValidatorContext, + }, }; -use sp_api::{BlockId, ProvideRuntimeApi}; -use sp_application_crypto::{AppPublic, Public}; -use sp_blockchain::HeaderBackend; -use sp_consensus::SyncOracle as SyncOracleT; -use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; -use sp_runtime::{ - generic::OpaqueDigestItemId, - traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor, Zero}, + +use { + sp_api::{BlockId, ProvideRuntimeApi}, + sp_application_crypto::{AppPublic, Public}, + sp_blockchain::HeaderBackend, + sp_consensus::SyncOracle as SyncOracleT, + sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}, + sp_runtime::traits::{Block as BlockT, Zero}, }; mod error; +mod round; +mod worker; pub mod notification; -use notification::BeefySignedCommitmentSender; - pub const BEEFY_PROTOCOL_NAME: &str = "/paritytech/beefy/1"; /// Returns the configuration value to put in @@ -89,334 +79,11 @@ where } } -struct RoundTracker { - votes: Vec<(Id, Signature)>, -} - -impl Default for RoundTracker { - fn default() -> Self { - RoundTracker { votes: Vec::new() } - } -} - -impl RoundTracker -where - Id: PartialEq, - Signature: PartialEq, -{ - fn add_vote(&mut self, vote: (Id, Signature)) -> bool { - // this needs to handle equivocations in the future - if self.votes.contains(&vote) { - return false; - } - - self.votes.push(vote); - true - } - - fn is_done(&self, threshold: usize) -> bool { - self.votes.len() >= threshold - } -} - -fn threshold(authorities: usize) -> usize { - let faulty = authorities.saturating_sub(1) / 3; - authorities - faulty -} - -struct Rounds { - rounds: BTreeMap<(Hash, Number), RoundTracker>, - authorities: Vec, -} - -impl Rounds -where - Hash: Ord, - Number: Ord, -{ - fn new(authorities: Vec) -> Self { - Rounds { - rounds: BTreeMap::new(), - authorities, - } - } -} - -impl Rounds -where - Hash: Ord, - Number: Ord, - Id: PartialEq, - Signature: Clone + PartialEq, -{ - fn add_vote(&mut self, round: (Hash, Number), vote: (Id, Signature)) -> bool { - self.rounds.entry(round).or_default().add_vote(vote) - } - - fn is_done(&self, round: &(Hash, Number)) -> bool { - self.rounds - .get(round) - .map(|tracker| tracker.is_done(threshold(self.authorities.len()))) - .unwrap_or(false) - } - - fn drop(&mut self, round: &(Hash, Number)) -> Option>> { - let signatures = self.rounds.remove(round)?.votes; - - Some( - self.authorities - .iter() - .map(|authority_id| { - signatures - .iter() - .find_map(|(id, sig)| if id == authority_id { Some(sig.clone()) } else { None }) - }) - .collect(), - ) - } -} - -fn topic() -> Block::Hash { - <::Hashing as HashT>::hash(b"beefy") -} - -#[derive(Debug, Decode, Encode)] -struct VoteMessage { - commitment: Commitment, - id: Id, - signature: Signature, -} - -enum BeefyId { - Validator(Id), - None, -} - -struct BeefyWorker { - local_id: BeefyId, - key_store: SyncCryptoStorePtr, - min_interval: u32, - rounds: Rounds, Id, Signature>, - finality_notifications: FinalityNotifications, - gossip_engine: Arc>>, - signed_commitment_sender: BeefySignedCommitmentSender, - best_finalized_block: NumberFor, - best_block_voted_on: NumberFor, - validator_set_id: Option, -} - -impl BeefyWorker -where - Block: BlockT, -{ - #[allow(clippy::too_many_arguments)] - fn new( - local_id: BeefyId, - key_store: SyncCryptoStorePtr, - authorities: Vec, - finality_notifications: FinalityNotifications, - gossip_engine: GossipEngine, - signed_commitment_sender: BeefySignedCommitmentSender, - best_finalized_block: NumberFor, - best_block_voted_on: NumberFor, - validator_set_id: Option, - ) -> Self { - BeefyWorker { - local_id, - key_store, - min_interval: 2, - rounds: Rounds::new(authorities), - finality_notifications, - gossip_engine: Arc::new(Mutex::new(gossip_engine)), - signed_commitment_sender, - best_finalized_block, - best_block_voted_on, - validator_set_id, - } - } -} - -impl BeefyWorker -where - Block: BlockT, - Id: Codec + Debug + PartialEq + Public, - Signature: Clone + Codec + Debug + PartialEq + std::convert::TryFrom>, - FinalityNotifications: Stream> + Unpin, -{ - fn should_vote_on(&self, number: NumberFor) -> bool { - use sp_runtime::traits::Saturating; - use sp_runtime::SaturatedConversion; - - // we only vote as a validator - if let BeefyId::None = self.local_id { - return false; - } - - let diff = self.best_finalized_block.saturating_sub(self.best_block_voted_on); - let diff = diff.saturated_into::(); - let next_power_of_two = (diff / 2).next_power_of_two(); - let next_block_to_vote_on = self.best_block_voted_on + self.min_interval.max(next_power_of_two).into(); - - trace!( - target: "beefy", - "should_vote_on: #{:?}, diff: {:?}, next_power_of_two: {:?}, next_block_to_vote_on: #{:?}", - number, - diff, - next_power_of_two, - next_block_to_vote_on, - ); - - number == next_block_to_vote_on - } - - fn sign_commitment(&self, id: &Id, commitment: &[u8]) -> Result> { - let sig = SyncCryptoStore::sign_with(&*self.key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) - .map_err(|e| error::Error::CannotSign((*id).clone(), e.to_string()))? - .ok_or_else(|| error::Error::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; - - let sig = sig - .clone() - .try_into() - .map_err(|_| error::Error::InvalidSignature(sig.encode_hex(), (*id).clone()))?; - - Ok(sig) - } - - fn handle_finality_notification(&mut self, notification: FinalityNotification) { - debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); - - if self.should_vote_on(*notification.header.number()) { - let local_id = if let BeefyId::Validator(id) = &self.local_id { - id - } else { - warn!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); - return; - }; - - let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { - hash - } else { - warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); - return; - }; - - if let Some(new) = find_authorities_change::(¬ification.header) { - debug!(target: "beefy", "🥩 New validator set: {:?}", new); - self.validator_set_id = Some(new.id); - }; - - let current_set_id = if let Some(set_id) = self.validator_set_id { - set_id - } else { - warn!(target: "beefy", "🥩 Unknown validator set id - can't vote for: {:?}", notification.header.hash()); - return; - }; - - let commitment = Commitment { - payload: mmr_root, - block_number: notification.header.number(), - validator_set_id: current_set_id, - }; - - let signature = match self.sign_commitment(local_id, commitment.encode().as_ref()) { - Ok(sig) => sig, - Err(err) => { - warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err); - return; - } - }; - - self.best_block_voted_on = *notification.header.number(); - - let message = VoteMessage { - commitment, - id: local_id.clone(), - signature, - }; - - self.gossip_engine - .lock() - .gossip_message(topic::(), message.encode(), false); - - debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); - - self.handle_vote( - (message.commitment.payload, *message.commitment.block_number), - (message.id, message.signature), - ); - } - - self.best_finalized_block = *notification.header.number(); - } - - fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (Id, Signature)) { - // TODO: validate signature - let vote_added = self.rounds.add_vote(round, vote); - - if vote_added && self.rounds.is_done(&round) { - if let Some(signatures) = self.rounds.drop(&round) { - let commitment = Commitment { - payload: round.0, - block_number: round.1, - validator_set_id: self - .validator_set_id - .expect("We voted only in case of a valid validator_set_id; qed"), - }; - - let signed_commitment = SignedCommitment { commitment, signatures }; - - info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); - - self.signed_commitment_sender.notify(signed_commitment); - } - } - } - - async fn run(mut self) { - let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( - |notification| async move { - debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); - - VoteMessage::, Id, Signature>::decode(&mut ¬ification.message[..]).ok() - }, - )); - - loop { - let engine = self.gossip_engine.clone(); - let gossip_engine = future::poll_fn(|cx| engine.lock().poll_unpin(cx)); - - futures::select! { - notification = self.finality_notifications.next().fuse() => { - if let Some(notification) = notification { - self.handle_finality_notification(notification); - } else { - return; - } - }, - vote = votes.next() => { - if let Some(vote) = vote { - self.handle_vote( - (vote.commitment.payload, vote.commitment.block_number), - (vote.id, vote.signature), - ); - } else { - return; - } - }, - _ = gossip_engine.fuse() => { - error!(target: "beefy", "🥩 Gossip engine has terminated."); - return; - } - } - } - } -} - pub async fn start_beefy_gadget( client: Arc, key_store: SyncCryptoStorePtr, network: Network, - signed_commitment_sender: BeefySignedCommitmentSender, + signed_commitment_sender: notification::BeefySignedCommitmentSender, _sync_oracle: SyncOracle, ) where Block: BlockT, @@ -438,7 +105,7 @@ pub async fn start_beefy_gadget(), + topic: worker::topic::(), }), None, ); @@ -455,18 +122,18 @@ pub async fn start_beefy_gadget { info!(target: "beefy", "🥩 Starting BEEFY worker with local id: {:?}", id); - BeefyId::Validator(id.clone()) + worker::BeefyId::Validator(id.clone()) } None => { info!(target: "beefy", "🥩 No local id found, BEEFY worker will be gossip only."); - BeefyId::None + worker::BeefyId::None } }; let best_finalized_block = client.info().finalized_number; let best_block_voted_on = Zero::zero(); - let worker = BeefyWorker::<_, Pair::Public, Pair::Signature, _>::new( + let worker = worker::BeefyWorker::<_, Pair::Public, Pair::Signature, _>::new( local_id, key_store, authorities, @@ -481,33 +148,3 @@ pub async fn start_beefy_gadget(header: &Block::Header) -> Option -where - Id: Codec, -{ - header.digest().logs().iter().find_map(|log| { - match log.try_to::>(OpaqueDigestItemId::Consensus(&BEEFY_ENGINE_ID)) { - Some(ConsensusLog::MmrRoot(root)) => Some(root), - _ => None, - } - }) -} - -/// Scan the `header` digest log for a BEEFY validator set change. Return either the new -/// validator set or `None` in case no validator set change has been signaled. -fn find_authorities_change(header: &B::Header) -> Option> -where - B: BlockT, - Id: Codec, -{ - let id = OpaqueDigestItemId::Consensus(&BEEFY_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)) -} diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs new file mode 100644 index 0000000000000..4c188e7eb8d8f --- /dev/null +++ b/client/beefy/src/round.rs @@ -0,0 +1,104 @@ +// Copyright (C) 2020-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::collections::BTreeMap; + +struct RoundTracker { + votes: Vec<(Id, Signature)>, +} + +impl Default for RoundTracker { + fn default() -> Self { + RoundTracker { votes: Vec::new() } + } +} + +impl RoundTracker +where + Id: PartialEq, + Signature: PartialEq, +{ + fn add_vote(&mut self, vote: (Id, Signature)) -> bool { + // this needs to handle equivocations in the future + if self.votes.contains(&vote) { + return false; + } + + self.votes.push(vote); + true + } + + fn is_done(&self, threshold: usize) -> bool { + self.votes.len() >= threshold + } +} + +fn threshold(authorities: usize) -> usize { + let faulty = authorities.saturating_sub(1) / 3; + authorities - faulty +} + +pub(crate) struct Rounds { + rounds: BTreeMap<(Hash, Number), RoundTracker>, + authorities: Vec, +} + +impl Rounds +where + Hash: Ord, + Number: Ord, +{ + pub(crate) fn new(authorities: Vec) -> Self { + Rounds { + rounds: BTreeMap::new(), + authorities, + } + } +} + +impl Rounds +where + Hash: Ord, + Number: Ord, + Id: PartialEq, + Signature: Clone + PartialEq, +{ + pub(crate) fn add_vote(&mut self, round: (Hash, Number), vote: (Id, Signature)) -> bool { + self.rounds.entry(round).or_default().add_vote(vote) + } + + pub(crate) fn is_done(&self, round: &(Hash, Number)) -> bool { + self.rounds + .get(round) + .map(|tracker| tracker.is_done(threshold(self.authorities.len()))) + .unwrap_or(false) + } + + pub(crate) fn drop(&mut self, round: &(Hash, Number)) -> Option>> { + let signatures = self.rounds.remove(round)?.votes; + + Some( + self.authorities + .iter() + .map(|authority_id| { + signatures + .iter() + .find_map(|(id, sig)| if id == authority_id { Some(sig.clone()) } else { None }) + }) + .collect(), + ) + } +} diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs new file mode 100644 index 0000000000000..dda301a536633 --- /dev/null +++ b/client/beefy/src/worker.rs @@ -0,0 +1,310 @@ +// Copyright (C) 2020-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::{convert::TryInto, fmt::Debug, sync::Arc}; + +use { + codec::{Codec, Decode, Encode}, + futures::{future, FutureExt, Stream, StreamExt}, + hex::ToHex, + log::{debug, error, info, trace, warn}, + parking_lot::Mutex, +}; + +use beefy_primitives::{ + Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, KEY_TYPE, +}; + +use { + sc_client_api::FinalityNotification, + sc_network_gossip::GossipEngine, + sp_application_crypto::Public, + sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}, + sp_runtime::{ + generic::OpaqueDigestItemId, + traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor}, + }, +}; + +use crate::error; +use crate::notification; +use crate::round; + +pub(crate) fn topic() -> Block::Hash { + <::Hashing as HashT>::hash(b"beefy") +} + +#[derive(Debug, Decode, Encode)] +struct VoteMessage { + commitment: Commitment, + id: Id, + signature: Signature, +} + +pub(crate) enum BeefyId { + Validator(Id), + None, +} + +pub(crate) struct BeefyWorker { + local_id: BeefyId, + key_store: SyncCryptoStorePtr, + min_interval: u32, + rounds: round::Rounds, Id, Signature>, + finality_notifications: FinalityNotifications, + gossip_engine: Arc>>, + signed_commitment_sender: notification::BeefySignedCommitmentSender, + best_finalized_block: NumberFor, + best_block_voted_on: NumberFor, + validator_set_id: Option, +} + +impl BeefyWorker +where + Block: BlockT, +{ + #[allow(clippy::too_many_arguments)] + pub(crate) fn new( + local_id: BeefyId, + key_store: SyncCryptoStorePtr, + authorities: Vec, + finality_notifications: FinalityNotifications, + gossip_engine: GossipEngine, + signed_commitment_sender: notification::BeefySignedCommitmentSender, + best_finalized_block: NumberFor, + best_block_voted_on: NumberFor, + validator_set_id: Option, + ) -> Self { + BeefyWorker { + local_id, + key_store, + min_interval: 2, + rounds: round::Rounds::new(authorities), + finality_notifications, + gossip_engine: Arc::new(Mutex::new(gossip_engine)), + signed_commitment_sender, + best_finalized_block, + best_block_voted_on, + validator_set_id, + } + } +} + +impl BeefyWorker +where + Block: BlockT, + Id: Codec + Debug + PartialEq + Public, + Signature: Clone + Codec + Debug + PartialEq + std::convert::TryFrom>, + FinalityNotifications: Stream> + Unpin, +{ + fn should_vote_on(&self, number: NumberFor) -> bool { + use sp_runtime::traits::Saturating; + use sp_runtime::SaturatedConversion; + + // we only vote as a validator + if let BeefyId::None = self.local_id { + return false; + } + + let diff = self.best_finalized_block.saturating_sub(self.best_block_voted_on); + let diff = diff.saturated_into::(); + let next_power_of_two = (diff / 2).next_power_of_two(); + let next_block_to_vote_on = self.best_block_voted_on + self.min_interval.max(next_power_of_two).into(); + + trace!( + target: "beefy", + "should_vote_on: #{:?}, diff: {:?}, next_power_of_two: {:?}, next_block_to_vote_on: #{:?}", + number, + diff, + next_power_of_two, + next_block_to_vote_on, + ); + + number == next_block_to_vote_on + } + + fn sign_commitment(&self, id: &Id, commitment: &[u8]) -> Result> { + let sig = SyncCryptoStore::sign_with(&*self.key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) + .map_err(|e| error::Error::CannotSign((*id).clone(), e.to_string()))? + .ok_or_else(|| error::Error::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; + + let sig = sig + .clone() + .try_into() + .map_err(|_| error::Error::InvalidSignature(sig.encode_hex(), (*id).clone()))?; + + Ok(sig) + } + + fn handle_finality_notification(&mut self, notification: FinalityNotification) { + debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); + + if self.should_vote_on(*notification.header.number()) { + let local_id = if let BeefyId::Validator(id) = &self.local_id { + id + } else { + warn!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); + return; + }; + + let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { + hash + } else { + warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); + return; + }; + + if let Some(new) = find_authorities_change::(¬ification.header) { + debug!(target: "beefy", "🥩 New validator set: {:?}", new); + self.validator_set_id = Some(new.id); + }; + + let current_set_id = if let Some(set_id) = self.validator_set_id { + set_id + } else { + warn!(target: "beefy", "🥩 Unknown validator set id - can't vote for: {:?}", notification.header.hash()); + return; + }; + + let commitment = Commitment { + payload: mmr_root, + block_number: notification.header.number(), + validator_set_id: current_set_id, + }; + + let signature = match self.sign_commitment(local_id, commitment.encode().as_ref()) { + Ok(sig) => sig, + Err(err) => { + warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err); + return; + } + }; + + self.best_block_voted_on = *notification.header.number(); + + let message = VoteMessage { + commitment, + id: local_id.clone(), + signature, + }; + + self.gossip_engine + .lock() + .gossip_message(topic::(), message.encode(), false); + + debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); + + self.handle_vote( + (message.commitment.payload, *message.commitment.block_number), + (message.id, message.signature), + ); + } + + self.best_finalized_block = *notification.header.number(); + } + + fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (Id, Signature)) { + // TODO: validate signature + let vote_added = self.rounds.add_vote(round, vote); + + if vote_added && self.rounds.is_done(&round) { + if let Some(signatures) = self.rounds.drop(&round) { + let commitment = Commitment { + payload: round.0, + block_number: round.1, + validator_set_id: self + .validator_set_id + .expect("We voted only in case of a valid validator_set_id; qed"), + }; + + let signed_commitment = SignedCommitment { commitment, signatures }; + + info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); + + self.signed_commitment_sender.notify(signed_commitment); + } + } + } + + pub(crate) async fn run(mut self) { + let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( + |notification| async move { + debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); + + VoteMessage::, Id, Signature>::decode(&mut ¬ification.message[..]).ok() + }, + )); + + loop { + let engine = self.gossip_engine.clone(); + let gossip_engine = future::poll_fn(|cx| engine.lock().poll_unpin(cx)); + + futures::select! { + notification = self.finality_notifications.next().fuse() => { + if let Some(notification) = notification { + self.handle_finality_notification(notification); + } else { + return; + } + }, + vote = votes.next() => { + if let Some(vote) = vote { + self.handle_vote( + (vote.commitment.payload, vote.commitment.block_number), + (vote.id, vote.signature), + ); + } else { + return; + } + }, + _ = gossip_engine.fuse() => { + error!(target: "beefy", "🥩 Gossip engine has terminated."); + return; + } + } + } + } +} + +/// Extract the MMR root hash from a digest in the given header, if it exists. +fn find_mmr_root_digest(header: &Block::Header) -> Option +where + Id: Codec, +{ + header.digest().logs().iter().find_map(|log| { + match log.try_to::>(OpaqueDigestItemId::Consensus(&BEEFY_ENGINE_ID)) { + Some(ConsensusLog::MmrRoot(root)) => Some(root), + _ => None, + } + }) +} + +/// Scan the `header` digest log for a BEEFY validator set change. Return either the new +/// validator set or `None` in case no validator set change has been signaled. +fn find_authorities_change(header: &B::Header) -> Option> +where + B: BlockT, + Id: Codec, +{ + let id = OpaqueDigestItemId::Consensus(&BEEFY_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)) +} From 80eaa5290f3e5a13e77e2e2db833a72206c2972c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 8 Mar 2021 05:44:16 +0000 Subject: [PATCH 032/109] Bump serde from 1.0.123 to 1.0.124 (#106) --- client/beefy/rpc/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 91258ad484015..da067cd3fd2d2 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = { version = "0.3.12", features = ["compat"] } log = "0.4" -serde = { version = "1.0.123", features = ["derive"] } +serde = { version = "1.0.124", features = ["derive"] } serde_json = "1.0.64" jsonrpc-core = "15.1.0" diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 9b37279c1b9d2..65908f6856d0d 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -serde = { version = "1.0.123", optional = true } +serde = { version = "1.0.124", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From 64799ea35bd87c88b8fb05ffc4d39d327f9a6c8d Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Tue, 9 Mar 2021 13:12:57 +0100 Subject: [PATCH 033/109] Rework BeefyAPI (#110) --- client/beefy/src/lib.rs | 9 +++++---- frame/beefy/src/lib.rs | 8 ++++++++ frame/beefy/src/tests.rs | 36 ++++++++++++++++++++++++++++++++++++ primitives/beefy/src/lib.rs | 6 +++--- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 152d574564981..dc107c060feb4 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -111,12 +111,13 @@ pub async fn start_beefy_gadget::new( local_id, key_store, - authorities, + validator_set.validators, client.finality_notification_stream(), gossip_engine, signed_commitment_sender, diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index 7ecf93fcde536..68bfffdeacf87 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -96,6 +96,14 @@ pub mod pallet { } impl Pallet { + /// Return the current active BEEFY validator set. + pub fn validator_set() -> ValidatorSet { + ValidatorSet:: { + validators: Self::authorities(), + id: Self::validator_set_id(), + } + } + fn change_authorities(new: Vec, queued: Vec) { // As in GRANDPA, we trigger a validator set change only if the the validator // set has actually changed. diff --git a/frame/beefy/src/tests.rs b/frame/beefy/src/tests.rs index 186334f362450..9ee30350559a1 100644 --- a/frame/beefy/src/tests.rs +++ b/frame/beefy/src/tests.rs @@ -103,3 +103,39 @@ fn session_change_updates_next_authorities() { assert_eq!(want[3], next_authorities[1]); }); } + +#[test] +fn validator_set_at_genesis() { + let want = vec![mock_beefy_id(1), mock_beefy_id(2)]; + + new_test_ext(vec![1, 2, 3, 4]).execute_with(|| { + let vs = Beefy::validator_set(); + + assert_eq!(vs.id, 0u64); + assert_eq!(vs.validators[0], want[0]); + assert_eq!(vs.validators[1], want[1]); + }); +} + +#[test] +fn validator_set_updates_work() { + let want = vec![mock_beefy_id(1), mock_beefy_id(2), mock_beefy_id(3), mock_beefy_id(4)]; + + new_test_ext(vec![1, 2, 3, 4]).execute_with(|| { + init_block(1); + + let vs = Beefy::validator_set(); + + assert_eq!(vs.id, 0u64); + assert_eq!(want[0], vs.validators[0]); + assert_eq!(want[1], vs.validators[1]); + + init_block(2); + + let vs = Beefy::validator_set(); + + assert_eq!(vs.id, 1u64); + assert_eq!(want[2], vs.validators[0]); + assert_eq!(want[3], vs.validators[1]); + }); +} diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index fcc21590ff5ce..cbd227da62875 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -70,7 +70,7 @@ pub const BEEFY_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"BEEF"; pub type ValidatorSetId = u64; /// A set of BEEFY authorities, a.k.a. validators. -#[derive(Decode, Encode, Debug)] +#[derive(Decode, Encode, Debug, PartialEq)] pub struct ValidatorSet { /// Public keys of the validator set elements pub validators: Vec, @@ -101,7 +101,7 @@ pub enum ConsensusLog { sp_api::decl_runtime_apis! { /// API necessary for BEEFY voters. pub trait BeefyApi { - /// Return the current set of authorities. - fn authorities() -> Vec; + /// Return the current active BEEFY validator set + fn validator_set() -> ValidatorSet; } } From e1b3f9b368c3c303259855674a31dabc335a368b Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 10 Mar 2021 05:43:49 +0100 Subject: [PATCH 034/109] Initialize BeefyWorker with current validator set (#111) --- client/beefy/src/lib.rs | 31 +++++----------------- client/beefy/src/worker.rs | 53 +++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 51 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index dc107c060feb4..5f543448235f0 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -16,9 +16,9 @@ use std::{convert::TryFrom, fmt::Debug, sync::Arc}; -use {codec::Codec, log::info}; +use codec::Codec; -use beefy_primitives::{BeefyApi, KEY_TYPE}; +use beefy_primitives::BeefyApi; use { sc_client_api::{Backend as BackendT, BlockchainEvents, Finalizer}, @@ -30,10 +30,10 @@ use { use { sp_api::{BlockId, ProvideRuntimeApi}, - sp_application_crypto::{AppPublic, Public}, + sp_application_crypto::AppPublic, sp_blockchain::HeaderBackend, sp_consensus::SyncOracle as SyncOracleT, - sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}, + sp_keystore::SyncCryptoStorePtr, sp_runtime::traits::{Block as BlockT, Zero}, }; @@ -111,40 +111,23 @@ pub async fn start_beefy_gadget { - info!(target: "beefy", "🥩 Starting BEEFY worker with local id: {:?}", id); - worker::BeefyId::Validator(id.clone()) - } - None => { - info!(target: "beefy", "🥩 No local id found, BEEFY worker will be gossip only."); - worker::BeefyId::None - } - }; + .expect("Failed to get BEEFY validator set"); let best_finalized_block = client.info().finalized_number; let best_block_voted_on = Zero::zero(); let worker = worker::BeefyWorker::<_, Pair::Public, Pair::Signature, _>::new( - local_id, + validator_set, key_store, - validator_set.validators, client.finality_notification_stream(), gossip_engine, signed_commitment_sender, best_finalized_block, best_block_voted_on, - // TODO #95 - Some(0), ); worker.run().await diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index dda301a536633..bc8de27055398 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -54,13 +54,8 @@ struct VoteMessage { signature: Signature, } -pub(crate) enum BeefyId { - Validator(Id), - None, -} - pub(crate) struct BeefyWorker { - local_id: BeefyId, + local_id: Option, key_store: SyncCryptoStorePtr, min_interval: u32, rounds: round::Rounds, Id, Signature>, @@ -69,36 +64,49 @@ pub(crate) struct BeefyWorker, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, - validator_set_id: Option, + validator_set_id: ValidatorSetId, } impl BeefyWorker where Block: BlockT, + Id: Public + Debug, { - #[allow(clippy::too_many_arguments)] pub(crate) fn new( - local_id: BeefyId, + validator_set: ValidatorSet, key_store: SyncCryptoStorePtr, - authorities: Vec, finality_notifications: FinalityNotifications, gossip_engine: GossipEngine, signed_commitment_sender: notification::BeefySignedCommitmentSender, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, - validator_set_id: Option, ) -> Self { + let local_id = match validator_set + .validators + .iter() + .find(|id| SyncCryptoStore::has_keys(&*key_store, &[(id.to_raw_vec(), KEY_TYPE)])) + { + Some(id) => { + info!(target: "beefy", "🥩 Starting BEEFY worker with local id: {:?}", id); + Some(id.clone()) + } + None => { + info!(target: "beefy", "🥩 No local id found, BEEFY worker will be gossip only."); + None + } + }; + BeefyWorker { local_id, key_store, min_interval: 2, - rounds: round::Rounds::new(authorities), + rounds: round::Rounds::new(validator_set.validators), finality_notifications, gossip_engine: Arc::new(Mutex::new(gossip_engine)), signed_commitment_sender, best_finalized_block, best_block_voted_on, - validator_set_id, + validator_set_id: validator_set.id, } } } @@ -115,7 +123,7 @@ where use sp_runtime::SaturatedConversion; // we only vote as a validator - if let BeefyId::None = self.local_id { + if self.local_id.is_none() { return false; } @@ -153,7 +161,7 @@ where debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { - let local_id = if let BeefyId::Validator(id) = &self.local_id { + let local_id = if let Some(id) = &self.local_id { id } else { warn!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); @@ -169,20 +177,13 @@ where if let Some(new) = find_authorities_change::(¬ification.header) { debug!(target: "beefy", "🥩 New validator set: {:?}", new); - self.validator_set_id = Some(new.id); - }; - - let current_set_id = if let Some(set_id) = self.validator_set_id { - set_id - } else { - warn!(target: "beefy", "🥩 Unknown validator set id - can't vote for: {:?}", notification.header.hash()); - return; + self.validator_set_id = new.id; }; let commitment = Commitment { payload: mmr_root, block_number: notification.header.number(), - validator_set_id: current_set_id, + validator_set_id: self.validator_set_id, }; let signature = match self.sign_commitment(local_id, commitment.encode().as_ref()) { @@ -225,9 +226,7 @@ where let commitment = Commitment { payload: round.0, block_number: round.1, - validator_set_id: self - .validator_set_id - .expect("We voted only in case of a valid validator_set_id; qed"), + validator_set_id: self.validator_set_id, }; let signed_commitment = SignedCommitment { commitment, signatures }; From 87e5f0dc811a34d1205ff30d0efae77292dfa8fd Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Thu, 11 Mar 2021 12:56:09 +0100 Subject: [PATCH 035/109] Update toolchain (#115) * Use nightly toolchain * dongradde to latest clippy stable * GH workflow trail and error * next try * use stable for clippy * update wasm builder * yet another try * fun with CI * no env var * and one more * allow from_over_into bco contruct_runtime * back to start * well ... * full circle * old version was still used --- frame/beefy/src/mock.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index c01ef64b74ea2..b094cf732728a 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -14,17 +14,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::vec; +// construct_runtime requires this +#![allow(clippy::from_over_into)] -use frame_support::{parameter_types, sp_io::TestExternalities, BasicExternalities}; +use std::vec; -use sp_core::H256; -use sp_runtime::{ - app_crypto::ecdsa::Public, - impl_opaque_keys, - testing::Header, - traits::{BlakeTwo256, ConvertInto, IdentityLookup, OpaqueKeys}, - Perbill, +use { + frame_support::{construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities}, + sp_core::H256, + sp_runtime::{ + app_crypto::ecdsa::Public, + impl_opaque_keys, + testing::Header, + traits::{BlakeTwo256, ConvertInto, IdentityLookup, OpaqueKeys}, + Perbill, + }, }; use crate as pallet_beefy; @@ -40,7 +44,7 @@ impl_opaque_keys! { type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; -frame_support::construct_runtime!( +construct_runtime!( pub enum Test where Block = Block, NodeBlock = Block, From 7120b621b2d3a76fe90a28bcb4b631cd9edf2331 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 15 Mar 2021 11:29:47 +0100 Subject: [PATCH 036/109] Bump Substrate and Deps (#117) * Bump Substrate and Deps * cargo fmt should enforce uniform imports * merge some imports --- client/beefy/rpc/src/lib.rs | 10 +++++----- client/beefy/src/lib.rs | 32 +++++++++++------------------ client/beefy/src/worker.rs | 40 ++++++++++++++----------------------- frame/beefy/src/mock.rs | 18 ++++++++--------- 4 files changed, 40 insertions(+), 60 deletions(-) diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs index 95cfae45b5826..47357df0bb696 100644 --- a/client/beefy/rpc/src/lib.rs +++ b/client/beefy/rpc/src/lib.rs @@ -18,22 +18,22 @@ #![warn(missing_docs)] +use beefy_gadget::notification::BeefySignedCommitmentStream; use codec::Encode; use futures::{StreamExt, TryStreamExt}; use jsonrpc_core::futures::{ - future::Executor as Executor01, future::Future as Future01, sink::Sink as Sink01, stream::Stream as Stream01, + future::{Executor as Executor01, Future as Future01}, + sink::Sink as Sink01, + stream::Stream as Stream01, }; use jsonrpc_derive::rpc; use jsonrpc_pubsub::{manager::SubscriptionManager, typed::Subscriber, SubscriptionId}; use log::warn; +use sp_runtime::traits::Block as BlockT; use std::sync::Arc; mod notification; -use sp_runtime::traits::Block as BlockT; - -use beefy_gadget::notification::BeefySignedCommitmentStream; - /// Provides RPC methods for interacting with BEEFY. #[allow(clippy::needless_return)] #[rpc] diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 5f543448235f0..fc8e778d61e6e 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -14,28 +14,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{convert::TryFrom, fmt::Debug, sync::Arc}; - -use codec::Codec; - use beefy_primitives::BeefyApi; - -use { - sc_client_api::{Backend as BackendT, BlockchainEvents, Finalizer}, - sc_network_gossip::{ - GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, - Validator as GossipValidator, ValidatorContext as GossipValidatorContext, - }, -}; - -use { - sp_api::{BlockId, ProvideRuntimeApi}, - sp_application_crypto::AppPublic, - sp_blockchain::HeaderBackend, - sp_consensus::SyncOracle as SyncOracleT, - sp_keystore::SyncCryptoStorePtr, - sp_runtime::traits::{Block as BlockT, Zero}, +use codec::Codec; +use sc_client_api::{Backend as BackendT, BlockchainEvents, Finalizer}; +use sc_network_gossip::{ + GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, Validator as GossipValidator, + ValidatorContext as GossipValidatorContext, }; +use sp_api::{BlockId, ProvideRuntimeApi}; +use sp_application_crypto::AppPublic; +use sp_blockchain::HeaderBackend; +use sp_consensus::SyncOracle as SyncOracleT; +use sp_keystore::SyncCryptoStorePtr; +use sp_runtime::traits::{Block as BlockT, Zero}; +use std::{convert::TryFrom, fmt::Debug, sync::Arc}; mod error; mod round; diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index bc8de27055398..3e9acf5bb34ea 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -14,34 +14,25 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{convert::TryInto, fmt::Debug, sync::Arc}; - -use { - codec::{Codec, Decode, Encode}, - futures::{future, FutureExt, Stream, StreamExt}, - hex::ToHex, - log::{debug, error, info, trace, warn}, - parking_lot::Mutex, -}; - use beefy_primitives::{ Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, KEY_TYPE, }; - -use { - sc_client_api::FinalityNotification, - sc_network_gossip::GossipEngine, - sp_application_crypto::Public, - sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}, - sp_runtime::{ - generic::OpaqueDigestItemId, - traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor}, - }, +use codec::{Codec, Decode, Encode}; +use futures::{future, FutureExt, Stream, StreamExt}; +use hex::ToHex; +use log::{debug, error, info, trace, warn}; +use parking_lot::Mutex; +use sc_client_api::FinalityNotification; +use sc_network_gossip::GossipEngine; +use sp_application_crypto::Public; +use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; +use sp_runtime::{ + generic::OpaqueDigestItemId, + traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor}, }; +use std::{convert::TryInto, fmt::Debug, sync::Arc}; -use crate::error; -use crate::notification; -use crate::round; +use crate::{error, notification, round}; pub(crate) fn topic() -> Block::Hash { <::Hashing as HashT>::hash(b"beefy") @@ -119,8 +110,7 @@ where FinalityNotifications: Stream> + Unpin, { fn should_vote_on(&self, number: NumberFor) -> bool { - use sp_runtime::traits::Saturating; - use sp_runtime::SaturatedConversion; + use sp_runtime::{traits::Saturating, SaturatedConversion}; // we only vote as a validator if self.local_id.is_none() { diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index b094cf732728a..408e6a556bedc 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -19,16 +19,14 @@ use std::vec; -use { - frame_support::{construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities}, - sp_core::H256, - sp_runtime::{ - app_crypto::ecdsa::Public, - impl_opaque_keys, - testing::Header, - traits::{BlakeTwo256, ConvertInto, IdentityLookup, OpaqueKeys}, - Perbill, - }, +use frame_support::{construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities}; +use sp_core::H256; +use sp_runtime::{ + app_crypto::ecdsa::Public, + impl_opaque_keys, + testing::Header, + traits::{BlakeTwo256, ConvertInto, IdentityLookup, OpaqueKeys}, + Perbill, }; use crate as pallet_beefy; From c010f95804920644aa5d2f4d8d11a4d1f7c620b3 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 22 Mar 2021 15:19:12 +0100 Subject: [PATCH 037/109] Delayed BEEFY worker initialization (#121) * lifecycle state * add Client convenience trait * rework trait identifiers * WIP * rework BeefyWorker::new() signature * Delayed BEEFY gadget initialization * address review --- client/beefy/src/error.rs | 18 +++- client/beefy/src/lib.rs | 106 +++++++++++-------- client/beefy/src/worker.rs | 210 ++++++++++++++++++++++++++----------- 3 files changed, 225 insertions(+), 109 deletions(-) diff --git a/client/beefy/src/error.rs b/client/beefy/src/error.rs index b5bddd665108e..4befb59dd39aa 100644 --- a/client/beefy/src/error.rs +++ b/client/beefy/src/error.rs @@ -14,15 +14,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +//! BEEFY gadget specific errors +//! +//! Used for BEEFY gadget interal error handling only + use std::fmt::Debug; use sp_core::crypto::Public; -/// BEEFY gadget specific errors -/// Note that this type is currently used for BEEFY gadget internal -/// error handling only. +/// Crypto related errors #[derive(Debug, thiserror::Error)] -pub(crate) enum Error { +pub(crate) enum Crypto { /// Check signature error #[error("Message signature {0} by {1:?} is invalid.")] InvalidSignature(String, Id), @@ -30,3 +32,11 @@ pub(crate) enum Error { #[error("Failed to sign comitment using key: {0:?}. Reason: {1}")] CannotSign(Id, String), } + +/// Lifecycle related errors +#[derive(Debug, thiserror::Error)] +pub(crate) enum Lifecycle { + /// Can't fetch validator set from BEEFY pallet + #[error("Failed to fetch validator set: {0}")] + MissingValidatorSet(String), +} diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index fc8e778d61e6e..465ad47058e36 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -14,20 +14,23 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use std::{convert::TryFrom, fmt::Debug, sync::Arc}; + use beefy_primitives::BeefyApi; use codec::Codec; -use sc_client_api::{Backend as BackendT, BlockchainEvents, Finalizer}; + +use sc_client_api::{Backend, BlockchainEvents, Finalizer}; use sc_network_gossip::{ GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, Validator as GossipValidator, ValidatorContext as GossipValidatorContext, }; -use sp_api::{BlockId, ProvideRuntimeApi}; + +use sp_api::ProvideRuntimeApi; use sp_application_crypto::AppPublic; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle as SyncOracleT; use sp_keystore::SyncCryptoStorePtr; -use sp_runtime::traits::{Block as BlockT, Zero}; -use std::{convert::TryFrom, fmt::Debug, sync::Arc}; +use sp_runtime::traits::Block; mod error; mod round; @@ -52,74 +55,89 @@ pub fn beefy_peers_set_config() -> sc_network::config::NonDefaultSetConfig { } } +/// A convenience BEEFY client trait that defines all the type bounds a BEEFY 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(crate) trait Client: + BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync +where + B: Block, + BE: Backend, + P: sp_core::Pair, + P::Public: AppPublic + Codec, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, +{ + // empty +} + +impl Client for T +where + B: Block, + BE: Backend, + P: sp_core::Pair, + P::Public: AppPublic + Codec, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, + T: BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync, +{ + // empty +} + /// Allows all gossip messages to get through. struct AllowAll { topic: Hash, } -impl GossipValidator for AllowAll +impl GossipValidator for AllowAll where - Block: BlockT, + B: Block, { fn validate( &self, - _context: &mut dyn GossipValidatorContext, + _context: &mut dyn GossipValidatorContext, _sender: &sc_network::PeerId, _data: &[u8], - ) -> GossipValidationResult { + ) -> GossipValidationResult { GossipValidationResult::ProcessAndKeep(self.topic) } } -pub async fn start_beefy_gadget( - client: Arc, +/// Start the BEEFY gadget. +/// +/// This is a thin shim around running and awaiting a BEEFY worker. The [`Client`] +/// convenience trait is not used here on purpose. We don't want to leak it into the +/// public interface of the BEEFY gadget. +pub async fn start_beefy_gadget( + client: Arc, key_store: SyncCryptoStorePtr, - network: Network, - signed_commitment_sender: notification::BeefySignedCommitmentSender, - _sync_oracle: SyncOracle, + network: N, + signed_commitment_sender: notification::BeefySignedCommitmentSender, + _sync_oracle: SO, ) where - Block: BlockT, - Pair: sp_core::Pair, - Pair::Public: AppPublic + Codec, - Pair::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, - Backend: BackendT, - Client: BlockchainEvents - + HeaderBackend - + Finalizer - + ProvideRuntimeApi - + Send - + Sync, - Client::Api: BeefyApi, - Network: GossipNetwork + Clone + Send + 'static, - SyncOracle: SyncOracleT + Send + 'static, + B: Block, + P: sp_core::Pair, + P::Public: AppPublic + Codec, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, + BE: Backend, + C: BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync, + C::Api: BeefyApi, + N: GossipNetwork + Clone + Send + 'static, + SO: SyncOracleT + Send + 'static, { let gossip_engine = GossipEngine::new( network, BEEFY_PROTOCOL_NAME, Arc::new(AllowAll { - topic: worker::topic::(), + topic: worker::topic::(), }), None, ); - let at = BlockId::hash(client.info().best_hash); - - let validator_set = client - .runtime_api() - .validator_set(&at) - .expect("Failed to get BEEFY validator set"); - - let best_finalized_block = client.info().finalized_number; - let best_block_voted_on = Zero::zero(); - - let worker = worker::BeefyWorker::<_, Pair::Public, Pair::Signature, _>::new( - validator_set, + let worker = worker::BeefyWorker::<_, P::Signature, _, BE, P>::new( + client.clone(), key_store, - client.finality_notification_stream(), - gossip_engine, signed_commitment_sender, - best_finalized_block, - best_block_voted_on, + gossip_engine, ); worker.run().await diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 3e9acf5bb34ea..2867f895826cc 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -14,28 +14,45 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use std::{ + convert::{TryFrom, TryInto}, + fmt::Debug, + marker::PhantomData, + sync::Arc, +}; + use beefy_primitives::{ - Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, KEY_TYPE, + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, + KEY_TYPE, }; use codec::{Codec, Decode, Encode}; -use futures::{future, FutureExt, Stream, StreamExt}; +use futures::{future, FutureExt, StreamExt}; use hex::ToHex; use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; -use sc_client_api::FinalityNotification; + +use sc_client_api::{Backend, FinalityNotification, FinalityNotifications}; use sc_network_gossip::GossipEngine; -use sp_application_crypto::Public; + +use sp_api::BlockId; +use sp_application_crypto::{AppPublic, Public}; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use sp_runtime::{ generic::OpaqueDigestItemId, - traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor}, + traits::{Block, Hash, Header, NumberFor, Zero}, }; -use std::{convert::TryInto, fmt::Debug, sync::Arc}; -use crate::{error, notification, round}; +use crate::{ + error::{self}, + notification, round, Client, +}; -pub(crate) fn topic() -> Block::Hash { - <::Hashing as HashT>::hash(b"beefy") +/// Gossip engine messages topic +pub(crate) fn topic() -> B::Hash +where + B: Block, +{ + <::Hashing as Hash>::hash(b"beefy") } #[derive(Debug, Decode, Encode)] @@ -44,76 +61,136 @@ struct VoteMessage { id: Id, signature: Signature, } +#[derive(PartialEq)] +/// Worker lifecycle state +enum State { + /// A new worker that still needs to be initialized. + New, + /// A worker that validates and votes for commitments + Validate, + /// A worker that acts as a goosip relay only + Gossip, +} -pub(crate) struct BeefyWorker { - local_id: Option, +pub(crate) struct BeefyWorker +where + B: Block, + BE: Backend, + P: sp_core::Pair, + P::Public: AppPublic + Codec, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, + C: Client, +{ + state: State, + local_id: Option, key_store: SyncCryptoStorePtr, min_interval: u32, - rounds: round::Rounds, Id, Signature>, - finality_notifications: FinalityNotifications, - gossip_engine: Arc>>, - signed_commitment_sender: notification::BeefySignedCommitmentSender, - best_finalized_block: NumberFor, - best_block_voted_on: NumberFor, + rounds: round::Rounds, P::Public, S>, + finality_notifications: FinalityNotifications, + gossip_engine: Arc>>, + signed_commitment_sender: notification::BeefySignedCommitmentSender, + best_finalized_block: NumberFor, + best_block_voted_on: NumberFor, validator_set_id: ValidatorSetId, + client: Arc, + _backend: PhantomData, + _pair: PhantomData

, } -impl BeefyWorker +impl BeefyWorker where - Block: BlockT, - Id: Public + Debug, + B: Block, + BE: Backend, + P: sp_core::Pair, + P::Public: AppPublic + Codec, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, + C: Client, + C::Api: BeefyApi, { + /// Retrun a new BEEFY worker instance. + /// + /// Note that full BEEFY worker initialization can only be completed, if an + /// on-chain BEEFY pallet is available. Reason is that the current active + /// validator set has to be fetched from the on-chain BEFFY pallet. + /// + /// For this reason, BEEFY worker initialization completes only after a finality + /// notification has been received. Such a notifcation is basically an indication + /// that an on-chain BEEFY pallet is available. pub(crate) fn new( - validator_set: ValidatorSet, + client: Arc, key_store: SyncCryptoStorePtr, - finality_notifications: FinalityNotifications, - gossip_engine: GossipEngine, - signed_commitment_sender: notification::BeefySignedCommitmentSender, - best_finalized_block: NumberFor, - best_block_voted_on: NumberFor, + signed_commitment_sender: notification::BeefySignedCommitmentSender, + gossip_engine: GossipEngine, ) -> Self { + BeefyWorker { + state: State::New, + local_id: None, + key_store, + min_interval: 2, + rounds: round::Rounds::new(vec![]), + finality_notifications: client.finality_notification_stream(), + gossip_engine: Arc::new(Mutex::new(gossip_engine)), + signed_commitment_sender, + best_finalized_block: client.info().finalized_number, + best_block_voted_on: Zero::zero(), + validator_set_id: 0, + client, + _backend: PhantomData, + _pair: PhantomData, + } + } + + fn init_validator_set(&mut self) -> Result<(), error::Lifecycle> { + let at = BlockId::hash(self.client.info().best_hash); + + let validator_set = self + .client + .runtime_api() + .validator_set(&at) + .map_err(|err| error::Lifecycle::MissingValidatorSet(err.to_string()))?; + let local_id = match validator_set .validators .iter() - .find(|id| SyncCryptoStore::has_keys(&*key_store, &[(id.to_raw_vec(), KEY_TYPE)])) + .find(|id| SyncCryptoStore::has_keys(&*self.key_store, &[(id.to_raw_vec(), KEY_TYPE)])) { Some(id) => { info!(target: "beefy", "🥩 Starting BEEFY worker with local id: {:?}", id); + self.state = State::Validate; Some(id.clone()) } None => { info!(target: "beefy", "🥩 No local id found, BEEFY worker will be gossip only."); + self.state = State::Gossip; None } }; - BeefyWorker { - local_id, - key_store, - min_interval: 2, - rounds: round::Rounds::new(validator_set.validators), - finality_notifications, - gossip_engine: Arc::new(Mutex::new(gossip_engine)), - signed_commitment_sender, - best_finalized_block, - best_block_voted_on, - validator_set_id: validator_set.id, - } + self.local_id = local_id; + self.rounds = round::Rounds::new(validator_set.validators.clone()); + + debug!(target: "beefy", "🥩 Validator set with id {} initialized", validator_set.id); + + Ok(()) } } -impl BeefyWorker +impl BeefyWorker where - Block: BlockT, - Id: Codec + Debug + PartialEq + Public, - Signature: Clone + Codec + Debug + PartialEq + std::convert::TryFrom>, - FinalityNotifications: Stream> + Unpin, + B: Block, + S: Clone + Codec + Debug + PartialEq + std::convert::TryFrom>, + BE: Backend, + P: sp_core::Pair, + P::Public: AppPublic + Codec, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, + C: Client, + C::Api: BeefyApi, { - fn should_vote_on(&self, number: NumberFor) -> bool { + fn should_vote_on(&self, number: NumberFor) -> bool { use sp_runtime::{traits::Saturating, SaturatedConversion}; // we only vote as a validator - if self.local_id.is_none() { + if self.state != State::Validate { return false; } @@ -134,38 +211,38 @@ where number == next_block_to_vote_on } - fn sign_commitment(&self, id: &Id, commitment: &[u8]) -> Result> { + fn sign_commitment(&self, id: &P::Public, commitment: &[u8]) -> Result> { let sig = SyncCryptoStore::sign_with(&*self.key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) - .map_err(|e| error::Error::CannotSign((*id).clone(), e.to_string()))? - .ok_or_else(|| error::Error::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; + .map_err(|e| error::Crypto::CannotSign((*id).clone(), e.to_string()))? + .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; let sig = sig .clone() .try_into() - .map_err(|_| error::Error::InvalidSignature(sig.encode_hex(), (*id).clone()))?; + .map_err(|_| error::Crypto::InvalidSignature(sig.encode_hex(), (*id).clone()))?; Ok(sig) } - fn handle_finality_notification(&mut self, notification: FinalityNotification) { + fn handle_finality_notification(&mut self, notification: FinalityNotification) { debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); if self.should_vote_on(*notification.header.number()) { let local_id = if let Some(id) = &self.local_id { id } else { - warn!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); + error!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); return; }; - let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { + let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { hash } else { warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); return; }; - if let Some(new) = find_authorities_change::(¬ification.header) { + if let Some(new) = find_authorities_change::(¬ification.header) { debug!(target: "beefy", "🥩 New validator set: {:?}", new); self.validator_set_id = new.id; }; @@ -194,7 +271,7 @@ where self.gossip_engine .lock() - .gossip_message(topic::(), message.encode(), false); + .gossip_message(topic::(), message.encode(), false); debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); @@ -207,7 +284,7 @@ where self.best_finalized_block = *notification.header.number(); } - fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (Id, Signature)) { + fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (P::Public, S)) { // TODO: validate signature let vote_added = self.rounds.add_vote(round, vote); @@ -229,11 +306,11 @@ where } pub(crate) async fn run(mut self) { - let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( + let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( |notification| async move { debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); - VoteMessage::, Id, Signature>::decode(&mut ¬ification.message[..]).ok() + VoteMessage::, P::Public, S>::decode(&mut ¬ification.message[..]).ok() }, )); @@ -244,12 +321,22 @@ where futures::select! { notification = self.finality_notifications.next().fuse() => { if let Some(notification) = notification { + if self.state == State::New { + match self.init_validator_set() { + Ok(()) => (), + Err(err) => { + // we don't treat this as an error here because there really is + // nothing a node operator could do in order to remedy the error. + info!(target: "beefy", "🥩 Init validator set failed: {:?}", err); + } + } + } self.handle_finality_notification(notification); } else { return; } }, - vote = votes.next() => { + vote = votes.next().fuse() => { if let Some(vote) = vote { self.handle_vote( (vote.commitment.payload, vote.commitment.block_number), @@ -269,8 +356,9 @@ where } /// Extract the MMR root hash from a digest in the given header, if it exists. -fn find_mmr_root_digest(header: &Block::Header) -> Option +fn find_mmr_root_digest(header: &B::Header) -> Option where + B: Block, Id: Codec, { header.digest().logs().iter().find_map(|log| { @@ -285,7 +373,7 @@ where /// validator set or `None` in case no validator set change has been signaled. fn find_authorities_change(header: &B::Header) -> Option> where - B: BlockT, + B: Block, Id: Codec, { let id = OpaqueDigestItemId::Consensus(&BEEFY_ENGINE_ID); From e343d47e121e92af0a3b2296dbd9100907a3f842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 22 Mar 2021 16:32:26 +0100 Subject: [PATCH 038/109] Bump substrate. (#123) * Bump substrate. * Fix tests. --- frame/beefy/src/lib.rs | 10 +++++----- frame/beefy/src/mock.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index 68bfffdeacf87..50748e9b325cc 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -121,7 +121,7 @@ impl Pallet { }) .encode(), ); - >::deposit_log(log); + >::deposit_log(log); } >::put(&queued); @@ -144,11 +144,11 @@ impl Pallet { } } -impl sp_runtime::BoundToRuntimeAppPublic for Module { +impl sp_runtime::BoundToRuntimeAppPublic for Pallet { type Public = T::AuthorityId; } -impl OneSessionHandler for Module { +impl OneSessionHandler for Pallet { type Key = T::AuthorityId; fn on_genesis_session<'a, I: 'a>(validators: I) @@ -177,11 +177,11 @@ impl OneSessionHandler for Module { ConsensusLog::::OnDisabled(i as AuthorityIndex).encode(), ); - >::deposit_log(log); + >::deposit_log(log); } } -impl IsMember for Module { +impl IsMember for Pallet { fn is_member(authority_id: &T::AuthorityId) -> bool { Self::authorities().iter().any(|id| id == authority_id) } diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index 408e6a556bedc..94175c336cb1c 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -35,7 +35,7 @@ pub use beefy_primitives::{ecdsa::AuthorityId as BeefyId, ConsensusLog, BEEFY_EN impl_opaque_keys! { pub struct MockSessionKeys { - pub dummy: pallet_beefy::Module, + pub dummy: pallet_beefy::Pallet, } } @@ -48,9 +48,9 @@ construct_runtime!( NodeBlock = Block, UncheckedExtrinsic = UncheckedExtrinsic, { - System: frame_system::{Module, Call, Config, Storage, Event}, - Beefy: pallet_beefy::{Module, Call, Config, Storage}, - Session: pallet_session::{Module, Call, Storage, Event, Config}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Beefy: pallet_beefy::{Pallet, Call, Config, Storage}, + Session: pallet_session::{Pallet, Call, Storage, Event, Config}, } ); @@ -151,7 +151,7 @@ pub fn new_test_ext_raw_authorities(authorities: Vec<(u64, BeefyId)>) -> TestExt BasicExternalities::execute_with_storage(&mut t, || { for (ref id, ..) in &session_keys { - frame_system::Module::::inc_providers(id); + frame_system::Pallet::::inc_providers(id); } }); From 9e28469dcc5e89b7c63e64b64d7bbae65fd6778e Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Tue, 23 Mar 2021 15:30:05 +0100 Subject: [PATCH 039/109] Lower log-level for a missing validator set (#124) * lower log-level for a missing validator set * move best_finalized_block initialization --- client/beefy/src/worker.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 2867f895826cc..8a2c46ab216e8 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -115,7 +115,7 @@ where /// /// For this reason, BEEFY worker initialization completes only after a finality /// notification has been received. Such a notifcation is basically an indication - /// that an on-chain BEEFY pallet is available. + /// that an on-chain BEEFY pallet may be available. pub(crate) fn new( client: Arc, key_store: SyncCryptoStorePtr, @@ -131,7 +131,7 @@ where finality_notifications: client.finality_notification_stream(), gossip_engine: Arc::new(Mutex::new(gossip_engine)), signed_commitment_sender, - best_finalized_block: client.info().finalized_number, + best_finalized_block: Zero::zero(), best_block_voted_on: Zero::zero(), validator_set_id: 0, client, @@ -169,6 +169,11 @@ where self.local_id = local_id; self.rounds = round::Rounds::new(validator_set.validators.clone()); + // we are actually interested in the best finalized block with the BEEFY pallet + // being available on-chain. That is why we set `best_finalized_block` here and + // not as part of `new()` already. + self.best_finalized_block = self.client.info().finalized_number; + debug!(target: "beefy", "🥩 Validator set with id {} initialized", validator_set.id); Ok(()) @@ -325,9 +330,9 @@ where match self.init_validator_set() { Ok(()) => (), Err(err) => { - // we don't treat this as an error here because there really is - // nothing a node operator could do in order to remedy the error. - info!(target: "beefy", "🥩 Init validator set failed: {:?}", err); + // this is not treated as an error here because there really is + // nothing a node operator could do in order to remedy the root cause. + debug!(target: "beefy", "🥩 Init validator set failed: {:?}", err); } } } From c88af04e4ddf2f3634806b3811a3871741d8688d Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 24 Mar 2021 17:51:47 +0100 Subject: [PATCH 040/109] Setup Prometheus metrics (#125) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * setup Prometheus metrics * expose validator set id * cargo fmt * Update beefy-gadget/src/lib.rs Co-authored-by: Tomasz DrwiÄ™ga * add vote messages gossiped metric * track authorities change, before checking for MMR root digest Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/Cargo.toml | 1 + client/beefy/src/lib.rs | 19 +++++++++++++++++ client/beefy/src/metrics.rs | 41 +++++++++++++++++++++++++++++++++++++ client/beefy/src/worker.rs | 23 ++++++++++++++++----- 4 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 client/beefy/src/metrics.rs diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 9ab9a36881c5f..d90954fae6594 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -13,6 +13,7 @@ parking_lot = "0.11" thiserror = "1.0" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } +prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master"} sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 465ad47058e36..467f9edc22d1f 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -18,6 +18,8 @@ use std::{convert::TryFrom, fmt::Debug, sync::Arc}; use beefy_primitives::BeefyApi; use codec::Codec; +use log::debug; +use prometheus::Registry; use sc_client_api::{Backend, BlockchainEvents, Finalizer}; use sc_network_gossip::{ @@ -33,6 +35,7 @@ use sp_keystore::SyncCryptoStorePtr; use sp_runtime::traits::Block; mod error; +mod metrics; mod round; mod worker; @@ -113,6 +116,7 @@ pub async fn start_beefy_gadget( network: N, signed_commitment_sender: notification::BeefySignedCommitmentSender, _sync_oracle: SO, + prometheus_registry: Option, ) where B: Block, P: sp_core::Pair, @@ -133,11 +137,26 @@ pub async fn start_beefy_gadget( None, ); + let metrics = prometheus_registry + .as_ref() + .map(metrics::Metrics::register) + .and_then(|result| match result { + Ok(metrics) => { + debug!(target: "beefy", "🥩 Registered metrics"); + Some(metrics) + } + Err(err) => { + debug!(target: "beefy", "🥩 Failed to register metrics: {:?}", err); + None + } + }); + let worker = worker::BeefyWorker::<_, P::Signature, _, BE, P>::new( client.clone(), key_store, signed_commitment_sender, gossip_engine, + metrics, ); worker.run().await diff --git a/client/beefy/src/metrics.rs b/client/beefy/src/metrics.rs new file mode 100644 index 0000000000000..798c75ad99b94 --- /dev/null +++ b/client/beefy/src/metrics.rs @@ -0,0 +1,41 @@ +// Copyright (C) 2020-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 . + +//! BEEFY Prometheus metrics definition + +use prometheus::{register, Counter, Gauge, PrometheusError, Registry, U64}; + +/// BEEFY metrics exposed through Prometheus +pub(crate) struct Metrics { + /// Current active validator set id + pub beefy_validator_set_id: Gauge, + pub beefy_gadget_votes: Counter, +} + +impl Metrics { + pub(crate) fn register(registry: &Registry) -> Result { + Ok(Self { + beefy_validator_set_id: register( + Gauge::new("beefy_validator_set_id", "Current BEEFY active validator set id.")?, + registry, + )?, + beefy_gadget_votes: register( + Counter::new("beefy_gadget_votes_total", "Total number of vote messages gossiped.")?, + registry, + )?, + }) + } +} diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 8a2c46ab216e8..dd7166f536c01 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -44,6 +44,7 @@ use sp_runtime::{ use crate::{ error::{self}, + metrics::Metrics, notification, round, Client, }; @@ -93,6 +94,7 @@ where best_block_voted_on: NumberFor, validator_set_id: ValidatorSetId, client: Arc, + metrics: Option, _backend: PhantomData, _pair: PhantomData

, } @@ -121,6 +123,7 @@ where key_store: SyncCryptoStorePtr, signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: GossipEngine, + metrics: Option, ) -> Self { BeefyWorker { state: State::New, @@ -135,6 +138,7 @@ where best_block_voted_on: Zero::zero(), validator_set_id: 0, client, + metrics, _backend: PhantomData, _pair: PhantomData, } @@ -240,6 +244,16 @@ where return; }; + if let Some(new) = find_authorities_change::(¬ification.header) { + debug!(target: "beefy", "🥩 New validator set: {:?}", new); + + if let Some(metrics) = self.metrics.as_ref() { + metrics.beefy_validator_set_id.set(new.id); + } + + self.validator_set_id = new.id; + }; + let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { hash } else { @@ -247,11 +261,6 @@ where return; }; - if let Some(new) = find_authorities_change::(¬ification.header) { - debug!(target: "beefy", "🥩 New validator set: {:?}", new); - self.validator_set_id = new.id; - }; - let commitment = Commitment { payload: mmr_root, block_number: notification.header.number(), @@ -280,6 +289,10 @@ where debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); + if let Some(metrics) = self.metrics.as_ref() { + metrics.beefy_gadget_votes.inc(); + } + self.handle_vote( (message.commitment.payload, *message.commitment.block_number), (message.id, message.signature), From 9450b5409eac48c77d765bf92bc34c4d90958748 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Thu, 25 Mar 2021 10:38:41 +0100 Subject: [PATCH 041/109] Make Client convenience trait public (#126) --- client/beefy/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 467f9edc22d1f..9b2917082ae11 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -62,7 +62,7 @@ pub fn beefy_peers_set_config() -> sc_network::config::NonDefaultSetConfig { /// 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(crate) trait Client: +pub trait Client: BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync where B: Block, @@ -107,9 +107,7 @@ where /// Start the BEEFY gadget. /// -/// This is a thin shim around running and awaiting a BEEFY worker. The [`Client`] -/// convenience trait is not used here on purpose. We don't want to leak it into the -/// public interface of the BEEFY gadget. +/// This is a thin shim around running and awaiting a BEEFY worker. pub async fn start_beefy_gadget( client: Arc, key_store: SyncCryptoStorePtr, @@ -123,7 +121,7 @@ pub async fn start_beefy_gadget( P::Public: AppPublic + Codec, P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, BE: Backend, - C: BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync, + C: Client, C::Api: BeefyApi, N: GossipNetwork + Clone + Send + 'static, SO: SyncOracleT + Send + 'static, From 58fa17c4cc9d63b929f840bcd5f4e7510fc51d45 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 29 Mar 2021 03:47:01 +0000 Subject: [PATCH 042/109] Bump serde from 1.0.124 to 1.0.125 (#131) --- client/beefy/rpc/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index da067cd3fd2d2..659fba13e1d8d 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = { version = "0.3.12", features = ["compat"] } log = "0.4" -serde = { version = "1.0.124", features = ["derive"] } +serde = { version = "1.0.125", features = ["derive"] } serde_json = "1.0.64" jsonrpc-core = "15.1.0" diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 65908f6856d0d..1e7362ebc836e 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -serde = { version = "1.0.124", optional = true } +serde = { version = "1.0.125", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From 19832353fb29126d667ec269e9a0784e5c319907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 1 Apr 2021 19:32:20 +0200 Subject: [PATCH 043/109] Reset rounds on new validator set. (#133) * Re-set rounds on new validator set. * Fix docs. --- client/beefy/src/round.rs | 17 ++++++++++++----- client/beefy/src/worker.rs | 15 ++++++--------- primitives/beefy/src/lib.rs | 12 +++++++++++- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index 4c188e7eb8d8f..ac8bca845b806 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -16,6 +16,8 @@ use std::collections::BTreeMap; +use beefy_primitives::{ValidatorSet, ValidatorSetId}; + struct RoundTracker { votes: Vec<(Id, Signature)>, } @@ -53,7 +55,7 @@ fn threshold(authorities: usize) -> usize { pub(crate) struct Rounds { rounds: BTreeMap<(Hash, Number), RoundTracker>, - authorities: Vec, + validator_set: ValidatorSet, } impl Rounds @@ -61,10 +63,10 @@ where Hash: Ord, Number: Ord, { - pub(crate) fn new(authorities: Vec) -> Self { + pub(crate) fn new(validator_set: ValidatorSet) -> Self { Rounds { rounds: BTreeMap::new(), - authorities, + validator_set, } } } @@ -76,6 +78,10 @@ where Id: PartialEq, Signature: Clone + PartialEq, { + pub(crate) fn validator_set_id(&self) -> ValidatorSetId { + self.validator_set.id + } + pub(crate) fn add_vote(&mut self, round: (Hash, Number), vote: (Id, Signature)) -> bool { self.rounds.entry(round).or_default().add_vote(vote) } @@ -83,7 +89,7 @@ where pub(crate) fn is_done(&self, round: &(Hash, Number)) -> bool { self.rounds .get(round) - .map(|tracker| tracker.is_done(threshold(self.authorities.len()))) + .map(|tracker| tracker.is_done(threshold(self.validator_set.validators.len()))) .unwrap_or(false) } @@ -91,7 +97,8 @@ where let signatures = self.rounds.remove(round)?.votes; Some( - self.authorities + self.validator_set + .validators .iter() .map(|authority_id| { signatures diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index dd7166f536c01..ca955d56ae235 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -22,8 +22,7 @@ use std::{ }; use beefy_primitives::{ - BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, - KEY_TYPE, + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, BEEFY_ENGINE_ID, KEY_TYPE, }; use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, StreamExt}; @@ -92,7 +91,6 @@ where signed_commitment_sender: notification::BeefySignedCommitmentSender, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, - validator_set_id: ValidatorSetId, client: Arc, metrics: Option, _backend: PhantomData, @@ -130,13 +128,12 @@ where local_id: None, key_store, min_interval: 2, - rounds: round::Rounds::new(vec![]), + rounds: round::Rounds::new(ValidatorSet::empty()), finality_notifications: client.finality_notification_stream(), gossip_engine: Arc::new(Mutex::new(gossip_engine)), signed_commitment_sender, best_finalized_block: Zero::zero(), best_block_voted_on: Zero::zero(), - validator_set_id: 0, client, metrics, _backend: PhantomData, @@ -171,7 +168,7 @@ where }; self.local_id = local_id; - self.rounds = round::Rounds::new(validator_set.validators.clone()); + self.rounds = round::Rounds::new(validator_set.clone()); // we are actually interested in the best finalized block with the BEEFY pallet // being available on-chain. That is why we set `best_finalized_block` here and @@ -251,7 +248,7 @@ where metrics.beefy_validator_set_id.set(new.id); } - self.validator_set_id = new.id; + self.rounds = round::Rounds::new(new); }; let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { @@ -264,7 +261,7 @@ where let commitment = Commitment { payload: mmr_root, block_number: notification.header.number(), - validator_set_id: self.validator_set_id, + validator_set_id: self.rounds.validator_set_id(), }; let signature = match self.sign_commitment(local_id, commitment.encode().as_ref()) { @@ -311,7 +308,7 @@ where let commitment = Commitment { payload: round.0, block_number: round.1, - validator_set_id: self.validator_set_id, + validator_set_id: self.rounds.validator_set_id(), }; let signed_commitment = SignedCommitment { commitment, signatures }; diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index cbd227da62875..15642fc361989 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -70,7 +70,7 @@ pub const BEEFY_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"BEEF"; pub type ValidatorSetId = u64; /// A set of BEEFY authorities, a.k.a. validators. -#[derive(Decode, Encode, Debug, PartialEq)] +#[derive(Decode, Encode, Debug, PartialEq, Clone)] pub struct ValidatorSet { /// Public keys of the validator set elements pub validators: Vec, @@ -78,6 +78,16 @@ pub struct ValidatorSet { pub id: ValidatorSetId, } +impl ValidatorSet { + /// Return an empty validator set with id of 0. + pub fn empty() -> Self { + Self { + validators: Default::default(), + id: Default::default(), + } + } +} + /// The index of an authority. pub type AuthorityIndex = u32; From 0092db38879c6941bc5c3fc1a17020bc8e13d2b4 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 2 Apr 2021 12:21:10 +0200 Subject: [PATCH 044/109] Bump Substrate and Deps (#134) --- frame/beefy/src/mock.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index 94175c336cb1c..689a8db487565 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -82,6 +82,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = SS58Prefix; + type OnSetCode = (); } impl pallet_beefy::Config for Test { From 0c02f263f3ca8baaa3229bc0361d768a7bae75b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 6 Apr 2021 10:55:03 +0100 Subject: [PATCH 045/109] beefy: authority set changes fixes (#139) * node: fix grandpa peers set config * gadget: update best finalized number only when finalized with beefy * gadget: process authorities changes regardless of vote status --- client/beefy/src/worker.rs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index ca955d56ae235..4cece6b81923a 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -233,24 +233,29 @@ where fn handle_finality_notification(&mut self, notification: FinalityNotification) { debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); + if let Some(new) = find_authorities_change::(¬ification.header) { + debug!(target: "beefy", "🥩 New validator set: {:?}", new); + + if let Some(metrics) = self.metrics.as_ref() { + metrics.beefy_validator_set_id.set(new.id); + } + + self.rounds = round::Rounds::new(new); + + // NOTE: currently we act as if this block has been finalized by BEEFY as we perform + // the validator set changes instantly (insecure). Once proper validator set changes + // are implemented this should be removed + self.best_finalized_block = *notification.header.number(); + }; + if self.should_vote_on(*notification.header.number()) { - let local_id = if let Some(id) = &self.local_id { + let local_id = if let Some(ref id) = self.local_id { id } else { error!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); return; }; - if let Some(new) = find_authorities_change::(¬ification.header) { - debug!(target: "beefy", "🥩 New validator set: {:?}", new); - - if let Some(metrics) = self.metrics.as_ref() { - metrics.beefy_validator_set_id.set(new.id); - } - - self.rounds = round::Rounds::new(new); - }; - let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { hash } else { @@ -264,7 +269,7 @@ where validator_set_id: self.rounds.validator_set_id(), }; - let signature = match self.sign_commitment(local_id, commitment.encode().as_ref()) { + let signature = match self.sign_commitment(&local_id, commitment.encode().as_ref()) { Ok(sig) => sig, Err(err) => { warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err); @@ -295,8 +300,6 @@ where (message.id, message.signature), ); } - - self.best_finalized_block = *notification.header.number(); } fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (P::Public, S)) { @@ -316,6 +319,7 @@ where info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); self.signed_commitment_sender.notify(signed_commitment); + self.best_finalized_block = round.1; } } } From 6ecfeb8da5057c254f37af54dea5a2216aa13a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 6 Apr 2021 11:18:56 +0100 Subject: [PATCH 046/109] gadget: remove superfluous signature type (#140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * node: fix grandpa peers set config * gadget: update best finalized number only when finalized with beefy * gadget: process authorities changes regardless of vote status * gadget: remove superfluous signature type Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/src/lib.rs | 2 +- client/beefy/src/worker.rs | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 9b2917082ae11..7a6a0d69fff20 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -149,7 +149,7 @@ pub async fn start_beefy_gadget( } }); - let worker = worker::BeefyWorker::<_, P::Signature, _, BE, P>::new( + let worker = worker::BeefyWorker::<_, _, BE, P>::new( client.clone(), key_store, signed_commitment_sender, diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 4cece6b81923a..f6405784d19d0 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -72,7 +72,7 @@ enum State { Gossip, } -pub(crate) struct BeefyWorker +pub(crate) struct BeefyWorker where B: Block, BE: Backend, @@ -85,10 +85,10 @@ where local_id: Option, key_store: SyncCryptoStorePtr, min_interval: u32, - rounds: round::Rounds, P::Public, S>, + rounds: round::Rounds, P::Public, P::Signature>, finality_notifications: FinalityNotifications, gossip_engine: Arc>>, - signed_commitment_sender: notification::BeefySignedCommitmentSender, + signed_commitment_sender: notification::BeefySignedCommitmentSender, best_finalized_block: NumberFor, best_block_voted_on: NumberFor, client: Arc, @@ -97,7 +97,7 @@ where _pair: PhantomData

, } -impl BeefyWorker +impl BeefyWorker where B: Block, BE: Backend, @@ -119,7 +119,7 @@ where pub(crate) fn new( client: Arc, key_store: SyncCryptoStorePtr, - signed_commitment_sender: notification::BeefySignedCommitmentSender, + signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: GossipEngine, metrics: Option, ) -> Self { @@ -181,10 +181,9 @@ where } } -impl BeefyWorker +impl BeefyWorker where B: Block, - S: Clone + Codec + Debug + PartialEq + std::convert::TryFrom>, BE: Backend, P: sp_core::Pair, P::Public: AppPublic + Codec, @@ -217,7 +216,7 @@ where number == next_block_to_vote_on } - fn sign_commitment(&self, id: &P::Public, commitment: &[u8]) -> Result> { + fn sign_commitment(&self, id: &P::Public, commitment: &[u8]) -> Result> { let sig = SyncCryptoStore::sign_with(&*self.key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) .map_err(|e| error::Crypto::CannotSign((*id).clone(), e.to_string()))? .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; @@ -302,7 +301,7 @@ where } } - fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (P::Public, S)) { + fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (P::Public, P::Signature)) { // TODO: validate signature let vote_added = self.rounds.add_vote(round, vote); @@ -329,7 +328,10 @@ where |notification| async move { debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); - VoteMessage::, P::Public, S>::decode(&mut ¬ification.message[..]).ok() + VoteMessage::, P::Public, P::Signature>::decode( + &mut ¬ification.message[..], + ) + .ok() }, )); From 69f1f46af8d9f78858c43bee9f0cd4496aff4fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Wed, 7 Apr 2021 08:53:48 +0100 Subject: [PATCH 047/109] gadget: reduce gossip spam (#141) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * node: fix grandpa peers set config * gadget: update best finalized number only when finalized with beefy * gadget: process authorities changes regardless of vote status * gadget: remove superfluous signature type * gadget: only gossip last 5 rounds * gadget: note round to gossip validator before gossiping message * gadget: fix clippy warnings * gadget: update docs Co-authored-by: Tomasz DrwiÄ™ga Co-authored-by: Tomasz DrwiÄ™ga Co-authored-by: adoerr <0xad@gmx.net> --- client/beefy/Cargo.toml | 2 +- client/beefy/src/lib.rs | 38 ++--------- client/beefy/src/worker.rs | 134 ++++++++++++++++++++++++++++++++----- 3 files changed, 126 insertions(+), 48 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index d90954fae6594..317c9ee58d008 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -29,4 +29,4 @@ sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } -beefy-primitives = { path = "../beefy-primitives" } \ No newline at end of file +beefy-primitives = { path = "../beefy-primitives" } diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 7a6a0d69fff20..43b6aa36ff868 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -16,16 +16,12 @@ use std::{convert::TryFrom, fmt::Debug, sync::Arc}; -use beefy_primitives::BeefyApi; use codec::Codec; use log::debug; use prometheus::Registry; use sc_client_api::{Backend, BlockchainEvents, Finalizer}; -use sc_network_gossip::{ - GossipEngine, Network as GossipNetwork, ValidationResult as GossipValidationResult, Validator as GossipValidator, - ValidatorContext as GossipValidatorContext, -}; +use sc_network_gossip::{GossipEngine, Network as GossipNetwork}; use sp_api::ProvideRuntimeApi; use sp_application_crypto::AppPublic; @@ -34,6 +30,8 @@ use sp_consensus::SyncOracle as SyncOracleT; use sp_keystore::SyncCryptoStorePtr; use sp_runtime::traits::Block; +use beefy_primitives::BeefyApi; + mod error; mod metrics; mod round; @@ -86,25 +84,6 @@ where // empty } -/// Allows all gossip messages to get through. -struct AllowAll { - topic: Hash, -} - -impl GossipValidator for AllowAll -where - B: Block, -{ - fn validate( - &self, - _context: &mut dyn GossipValidatorContext, - _sender: &sc_network::PeerId, - _data: &[u8], - ) -> GossipValidationResult { - GossipValidationResult::ProcessAndKeep(self.topic) - } -} - /// Start the BEEFY gadget. /// /// This is a thin shim around running and awaiting a BEEFY worker. @@ -126,14 +105,8 @@ pub async fn start_beefy_gadget( N: GossipNetwork + Clone + Send + 'static, SO: SyncOracleT + Send + 'static, { - let gossip_engine = GossipEngine::new( - network, - BEEFY_PROTOCOL_NAME, - Arc::new(AllowAll { - topic: worker::topic::(), - }), - None, - ); + let gossip_validator = Arc::new(worker::BeefyGossipValidator::new()); + let gossip_engine = GossipEngine::new(network, BEEFY_PROTOCOL_NAME, gossip_validator.clone(), None); let metrics = prometheus_registry .as_ref() @@ -154,6 +127,7 @@ pub async fn start_beefy_gadget( key_store, signed_commitment_sender, gossip_engine, + gossip_validator, metrics, ); diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index f6405784d19d0..2b1c369ee1287 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -21,20 +21,22 @@ use std::{ sync::Arc, }; -use beefy_primitives::{ - BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, BEEFY_ENGINE_ID, KEY_TYPE, -}; use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, StreamExt}; use hex::ToHex; use log::{debug, error, info, trace, warn}; -use parking_lot::Mutex; +use parking_lot::{Mutex, RwLock}; use sc_client_api::{Backend, FinalityNotification, FinalityNotifications}; -use sc_network_gossip::GossipEngine; +use sc_network::PeerId; +use sc_network_gossip::{ + GossipEngine, MessageIntent, ValidationResult as GossipValidationResult, Validator as GossipValidator, + ValidatorContext as GossipValidatorContext, +}; use sp_api::BlockId; use sp_application_crypto::{AppPublic, Public}; +use sp_core::Pair; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use sp_runtime::{ generic::OpaqueDigestItemId, @@ -46,6 +48,12 @@ use crate::{ metrics::Metrics, notification, round, Client, }; +use beefy_primitives::{ + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, BEEFY_ENGINE_ID, KEY_TYPE, +}; + +/// The maximum number of live gossip rounds allowed, i.e. we will expire messages older than this. +const MAX_LIVE_GOSSIP_ROUNDS: usize = 5; /// Gossip engine messages topic pub(crate) fn topic() -> B::Hash @@ -55,12 +63,101 @@ where <::Hashing as Hash>::hash(b"beefy") } +/// Allows messages from last [`MAX_LIVE_GOSSIP_ROUNDS`] to flow, everything else gets +/// rejected/expired. All messaging is handled in a single global topic. +pub struct BeefyGossipValidator +where + B: Block, +{ + topic: B::Hash, + live_rounds: RwLock>>, + _pair: PhantomData

, +} + +impl BeefyGossipValidator +where + B: Block, +{ + pub fn new() -> BeefyGossipValidator { + BeefyGossipValidator { + topic: topic::(), + live_rounds: RwLock::new(Vec::new()), + _pair: PhantomData, + } + } + + fn note_round(&self, round: NumberFor) { + let mut live_rounds = self.live_rounds.write(); + + // NOTE: ideally we'd use a VecDeque here, but currently binary search is only available on + // nightly for `VecDeque`. + while live_rounds.len() > MAX_LIVE_GOSSIP_ROUNDS { + let _ = live_rounds.remove(0); + } + + if let Some(idx) = live_rounds.binary_search(&round).err() { + live_rounds.insert(idx, round); + } + } + + fn is_live(live_rounds: &[NumberFor], round: NumberFor) -> bool { + live_rounds.binary_search(&round).is_ok() + } +} + +impl GossipValidator for BeefyGossipValidator +where + B: Block, + P: Pair, + P::Public: Decode, + P::Signature: Decode, +{ + fn validate( + &self, + _context: &mut dyn GossipValidatorContext, + _sender: &sc_network::PeerId, + mut data: &[u8], + ) -> GossipValidationResult { + if VoteMessage::, P::Public, P::Signature>::decode(&mut data).is_ok() { + GossipValidationResult::ProcessAndKeep(self.topic) + } else { + GossipValidationResult::Discard + } + } + + fn message_expired<'a>(&'a self) -> Box bool + 'a> { + let live_rounds = self.live_rounds.read(); + Box::new(move |_topic, mut data| { + let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + Ok(vote) => vote, + Err(_) => return true, + }; + + !BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + }) + } + + #[allow(clippy::type_complexity)] + fn message_allowed<'a>(&'a self) -> Box bool + 'a> { + let live_rounds = self.live_rounds.read(); + Box::new(move |_who, _intent, _topic, mut data| { + let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + Ok(vote) => vote, + Err(_) => return true, + }; + + BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + }) + } +} + #[derive(Debug, Decode, Encode)] struct VoteMessage { commitment: Commitment, id: Id, signature: Signature, } + #[derive(PartialEq)] /// Worker lifecycle state enum State { @@ -76,7 +173,7 @@ pub(crate) struct BeefyWorker where B: Block, BE: Backend, - P: sp_core::Pair, + P: Pair, P::Public: AppPublic + Codec, P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, C: Client, @@ -93,6 +190,7 @@ where best_block_voted_on: NumberFor, client: Arc, metrics: Option, + gossip_validator: Arc>, _backend: PhantomData, _pair: PhantomData

, } @@ -101,8 +199,8 @@ impl BeefyWorker where B: Block, BE: Backend, - P: sp_core::Pair, - P::Public: AppPublic + Codec, + P: Pair, + P::Public: AppPublic, P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, C: Client, C::Api: BeefyApi, @@ -121,6 +219,7 @@ where key_store: SyncCryptoStorePtr, signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: GossipEngine, + gossip_validator: Arc>, metrics: Option, ) -> Self { BeefyWorker { @@ -136,6 +235,7 @@ where best_block_voted_on: Zero::zero(), client, metrics, + gossip_validator, _backend: PhantomData, _pair: PhantomData, } @@ -185,8 +285,8 @@ impl BeefyWorker where B: Block, BE: Backend, - P: sp_core::Pair, - P::Public: AppPublic + Codec, + P: Pair, + P::Public: AppPublic, P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, C: Client, C::Api: BeefyApi, @@ -284,24 +384,28 @@ where signature, }; - self.gossip_engine - .lock() - .gossip_message(topic::(), message.encode(), false); - - debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); + let encoded_message = message.encode(); if let Some(metrics) = self.metrics.as_ref() { metrics.beefy_gadget_votes.inc(); } + debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); + self.handle_vote( (message.commitment.payload, *message.commitment.block_number), (message.id, message.signature), ); + + self.gossip_engine + .lock() + .gossip_message(topic::(), encoded_message, false); } } fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (P::Public, P::Signature)) { + self.gossip_validator.note_round(round.1); + // TODO: validate signature let vote_added = self.rounds.add_vote(round, vote); From 1d94b0fad7ba587bd081bcf0a776f84709f22407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Thu, 8 Apr 2021 13:46:22 +0100 Subject: [PATCH 048/109] gadget: verify SignedCommitment message signature (#142) * gadget: verify SignedCommitment message signature * gadget: log messages with bad sigs * gadget: move todo comment --- client/beefy/src/worker.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 2b1c369ee1287..841f710385dbb 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -109,20 +109,25 @@ impl GossipValidator for BeefyGossipValidator where B: Block, P: Pair, - P::Public: Decode, - P::Signature: Decode, + P::Public: Debug + Decode, + P::Signature: Debug + Decode, { fn validate( &self, _context: &mut dyn GossipValidatorContext, - _sender: &sc_network::PeerId, + sender: &sc_network::PeerId, mut data: &[u8], ) -> GossipValidationResult { - if VoteMessage::, P::Public, P::Signature>::decode(&mut data).is_ok() { - GossipValidationResult::ProcessAndKeep(self.topic) - } else { - GossipValidationResult::Discard + if let Ok(msg) = VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + if P::verify(&msg.signature, &msg.commitment.encode(), &msg.id) { + return GossipValidationResult::ProcessAndKeep(self.topic); + } else { + // TODO: report peer + debug!(target: "beefy", "🥩 Bad signature on message: {:?}, from: {:?}", msg, sender); + } } + + GossipValidationResult::Discard } fn message_expired<'a>(&'a self) -> Box bool + 'a> { @@ -406,7 +411,6 @@ where fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (P::Public, P::Signature)) { self.gossip_validator.note_round(round.1); - // TODO: validate signature let vote_added = self.rounds.add_vote(round, vote); if vote_added && self.rounds.is_done(&round) { From d3dd36ee1192042ad2f0d9282e86ef235b976e71 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Apr 2021 16:12:11 +0000 Subject: [PATCH 049/109] Bump futures from 0.3.13 to 0.3.14 (#145) --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 659fba13e1d8d..028c977b9994d 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -futures = { version = "0.3.12", features = ["compat"] } +futures = { version = "0.3.14", features = ["compat"] } log = "0.4" serde = { version = "1.0.125", features = ["derive"] } serde_json = "1.0.64" From 75ea15d74adcaa6381ff721721d2e3238c4c6456 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 14 Apr 2021 06:30:07 +0200 Subject: [PATCH 050/109] Milestone 1 (#144) * use best_finalized, prevent race * make best_finalized_block an Option, should_vote_on bails on None * Bump futures from 0.3.13 to 0.3.14 * Revert futures bump * Revert "Revert futures bump" This reverts commit a1b5e7e9bac526f2897ebfdfee7f02dd29a13ac5. * Revert "Bump futures from 0.3.13 to 0.3.14" This reverts commit a4e508b118ad2c4b52909d24143c284073961458. * debug msg if the bail voting * validator_set() * local_id() * get rid of worker state * Apply review suggestions * fix should_vote_on() --- client/beefy/src/error.rs | 8 -- client/beefy/src/round.rs | 6 +- client/beefy/src/worker.rs | 168 ++++++++++++++++-------------------- primitives/beefy/src/lib.rs | 3 + 4 files changed, 82 insertions(+), 103 deletions(-) diff --git a/client/beefy/src/error.rs b/client/beefy/src/error.rs index 4befb59dd39aa..aee3b7d04580e 100644 --- a/client/beefy/src/error.rs +++ b/client/beefy/src/error.rs @@ -32,11 +32,3 @@ pub(crate) enum Crypto { #[error("Failed to sign comitment using key: {0:?}. Reason: {1}")] CannotSign(Id, String), } - -/// Lifecycle related errors -#[derive(Debug, thiserror::Error)] -pub(crate) enum Lifecycle { - /// Can't fetch validator set from BEEFY pallet - #[error("Failed to fetch validator set: {0}")] - MissingValidatorSet(String), -} diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index ac8bca845b806..af905fd889eb9 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -75,13 +75,17 @@ impl Rounds where Hash: Ord, Number: Ord, - Id: PartialEq, + Id: PartialEq + Clone, Signature: Clone + PartialEq, { pub(crate) fn validator_set_id(&self) -> ValidatorSetId { self.validator_set.id } + pub(crate) fn validators(&self) -> Vec { + self.validator_set.validators.clone() + } + pub(crate) fn add_vote(&mut self, round: (Hash, Number), vote: (Id, Signature)) -> bool { self.rounds.entry(round).or_default().add_vote(vote) } diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 841f710385dbb..95c7fc2f75198 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -49,7 +49,8 @@ use crate::{ notification, round, Client, }; use beefy_primitives::{ - BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, BEEFY_ENGINE_ID, KEY_TYPE, + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, BEEFY_ENGINE_ID, + GENESIS_AUTHORITY_SET_ID, KEY_TYPE, }; /// The maximum number of live gossip rounds allowed, i.e. we will expire messages older than this. @@ -163,17 +164,6 @@ struct VoteMessage { signature: Signature, } -#[derive(PartialEq)] -/// Worker lifecycle state -enum State { - /// A new worker that still needs to be initialized. - New, - /// A worker that validates and votes for commitments - Validate, - /// A worker that acts as a goosip relay only - Gossip, -} - pub(crate) struct BeefyWorker where B: Block, @@ -183,19 +173,21 @@ where P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, C: Client, { - state: State, - local_id: Option, + client: Arc, key_store: SyncCryptoStorePtr, - min_interval: u32, + signed_commitment_sender: notification::BeefySignedCommitmentSender, + gossip_engine: Arc>>, + gossip_validator: Arc>, + metrics: Option, rounds: round::Rounds, P::Public, P::Signature>, finality_notifications: FinalityNotifications, - gossip_engine: Arc>>, - signed_commitment_sender: notification::BeefySignedCommitmentSender, - best_finalized_block: NumberFor, + min_interval: u32, + /// Best block we received a GRANDPA notification for + best_grandpa_block: NumberFor, + /// Best block a BEEFY voting round has been concluded for + best_beefy_block: Option>, + /// Best block this node has voted for best_block_voted_on: NumberFor, - client: Arc, - metrics: Option, - gossip_validator: Arc>, _backend: PhantomData, _pair: PhantomData

, } @@ -228,62 +220,22 @@ where metrics: Option, ) -> Self { BeefyWorker { - state: State::New, - local_id: None, + client: client.clone(), key_store, - min_interval: 2, + signed_commitment_sender, + gossip_engine: Arc::new(Mutex::new(gossip_engine)), + gossip_validator, + metrics, rounds: round::Rounds::new(ValidatorSet::empty()), finality_notifications: client.finality_notification_stream(), - gossip_engine: Arc::new(Mutex::new(gossip_engine)), - signed_commitment_sender, - best_finalized_block: Zero::zero(), + min_interval: 2, + best_grandpa_block: client.info().finalized_number, + best_beefy_block: None, best_block_voted_on: Zero::zero(), - client, - metrics, - gossip_validator, _backend: PhantomData, _pair: PhantomData, } } - - fn init_validator_set(&mut self) -> Result<(), error::Lifecycle> { - let at = BlockId::hash(self.client.info().best_hash); - - let validator_set = self - .client - .runtime_api() - .validator_set(&at) - .map_err(|err| error::Lifecycle::MissingValidatorSet(err.to_string()))?; - - let local_id = match validator_set - .validators - .iter() - .find(|id| SyncCryptoStore::has_keys(&*self.key_store, &[(id.to_raw_vec(), KEY_TYPE)])) - { - Some(id) => { - info!(target: "beefy", "🥩 Starting BEEFY worker with local id: {:?}", id); - self.state = State::Validate; - Some(id.clone()) - } - None => { - info!(target: "beefy", "🥩 No local id found, BEEFY worker will be gossip only."); - self.state = State::Gossip; - None - } - }; - - self.local_id = local_id; - self.rounds = round::Rounds::new(validator_set.clone()); - - // we are actually interested in the best finalized block with the BEEFY pallet - // being available on-chain. That is why we set `best_finalized_block` here and - // not as part of `new()` already. - self.best_finalized_block = self.client.info().finalized_number; - - debug!(target: "beefy", "🥩 Validator set with id {} initialized", validator_set.id); - - Ok(()) - } } impl BeefyWorker @@ -296,15 +248,18 @@ where C: Client, C::Api: BeefyApi, { + /// Return `true`, if the should vote on block `number` fn should_vote_on(&self, number: NumberFor) -> bool { use sp_runtime::{traits::Saturating, SaturatedConversion}; - // we only vote as a validator - if self.state != State::Validate { + let best_beefy_block = if let Some(block) = self.best_beefy_block { + block + } else { + debug!(target: "beefy", "🥩 Missing best BEEFY block - won't vote for: {:?}", number); return false; - } + }; - let diff = self.best_finalized_block.saturating_sub(self.best_block_voted_on); + let diff = self.best_grandpa_block.saturating_sub(best_beefy_block); let diff = diff.saturated_into::(); let next_power_of_two = (diff / 2).next_power_of_two(); let next_block_to_vote_on = self.best_block_voted_on + self.min_interval.max(next_power_of_two).into(); @@ -334,26 +289,61 @@ where Ok(sig) } + /// 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 BEEFY authority set change and we can't fetch the validator set from the + /// BEEFY on-chain state. Such a failure is usually an indication that the BEEFT + /// pallet has not been deployed (yet). + fn validator_set(&self, header: &B::Header) -> Option> { + if let Some(new) = find_authorities_change::(header) { + Some(new) + } else { + let at = BlockId::hash(header.hash()); + self.client.runtime_api().validator_set(&at).ok() + } + } + + /// Return the local authority id. + /// + /// `None` is returned, if we are not permitted to vote + fn local_id(&self) -> Option { + self.rounds + .validators() + .iter() + .find(|id| SyncCryptoStore::has_keys(&*self.key_store, &[(id.to_raw_vec(), KEY_TYPE)])) + .cloned() + } + fn handle_finality_notification(&mut self, notification: FinalityNotification) { debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); - if let Some(new) = find_authorities_change::(¬ification.header) { - debug!(target: "beefy", "🥩 New validator set: {:?}", new); + // update best GRANDPA finalized block we have seen + self.best_grandpa_block = *notification.header.number(); + + if let Some(active) = self.validator_set(¬ification.header) { + debug!(target: "beefy", "🥩 Active validator set id: {:?}", active); if let Some(metrics) = self.metrics.as_ref() { - metrics.beefy_validator_set_id.set(new.id); + metrics.beefy_validator_set_id.set(active.id); } - self.rounds = round::Rounds::new(new); + // Authority set change or genesis set id triggers new voting rounds + // + // TODO: (adoerr) Enacting a new authority set will also implicitly 'conclude' + // the currently active BEEFY voting round by starting a new one. This is + // temporary and needs to be repalced by proper round life cycle handling. + if (active.id != self.rounds.validator_set_id()) || (active.id == GENESIS_AUTHORITY_SET_ID) { + self.rounds = round::Rounds::new(active.clone()); + + debug!(target: "beefy", "🥩 New Rounds for id: {:?}", active.id); - // NOTE: currently we act as if this block has been finalized by BEEFY as we perform - // the validator set changes instantly (insecure). Once proper validator set changes - // are implemented this should be removed - self.best_finalized_block = *notification.header.number(); + self.best_beefy_block = Some(*notification.header.number()); + } }; if self.should_vote_on(*notification.header.number()) { - let local_id = if let Some(ref id) = self.local_id { + let local_id = if let Some(id) = self.local_id() { id } else { error!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); @@ -385,7 +375,7 @@ where let message = VoteMessage { commitment, - id: local_id.clone(), + id: local_id, signature, }; @@ -426,7 +416,7 @@ where info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); self.signed_commitment_sender.notify(signed_commitment); - self.best_finalized_block = round.1; + self.best_beefy_block = Some(round.1); } } } @@ -450,16 +440,6 @@ where futures::select! { notification = self.finality_notifications.next().fuse() => { if let Some(notification) = notification { - if self.state == State::New { - match self.init_validator_set() { - Ok(()) => (), - Err(err) => { - // this is not treated as an error here because there really is - // nothing a node operator could do in order to remedy the root cause. - debug!(target: "beefy", "🥩 Init validator set failed: {:?}", err); - } - } - } self.handle_finality_notification(notification); } else { return; diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 15642fc361989..acfacb8a93225 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -66,6 +66,9 @@ pub mod ecdsa { /// The `ConsensusEngineId` of BEEFY. pub const BEEFY_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"BEEF"; +/// 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; From 9da8233d8f52949c355a16c5d19f7c5e369a1d55 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 14 Apr 2021 15:16:56 +0200 Subject: [PATCH 051/109] Extract BeefyGossipValidator (#147) * Extract BeefyGossipValidator * Apply review suggestions --- client/beefy/src/lib.rs | 3 +- client/beefy/src/validator.rs | 143 +++++++++++++++++++++++++++++++ client/beefy/src/worker.rs | 155 +++++----------------------------- primitives/beefy/src/lib.rs | 14 +++ 4 files changed, 180 insertions(+), 135 deletions(-) create mode 100644 client/beefy/src/validator.rs diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 43b6aa36ff868..a33c391cfa87d 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -35,6 +35,7 @@ use beefy_primitives::BeefyApi; mod error; mod metrics; mod round; +mod validator; mod worker; pub mod notification; @@ -105,7 +106,7 @@ pub async fn start_beefy_gadget( N: GossipNetwork + Clone + Send + 'static, SO: SyncOracleT + Send + 'static, { - let gossip_validator = Arc::new(worker::BeefyGossipValidator::new()); + let gossip_validator = Arc::new(validator::BeefyGossipValidator::new()); let gossip_engine = GossipEngine::new(network, BEEFY_PROTOCOL_NAME, gossip_validator.clone(), None); let metrics = prometheus_registry diff --git a/client/beefy/src/validator.rs b/client/beefy/src/validator.rs new file mode 100644 index 0000000000000..c855c73f07e4d --- /dev/null +++ b/client/beefy/src/validator.rs @@ -0,0 +1,143 @@ +// Copyright (C) 2020-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 . + +/// The maximum number of live gossip rounds allowed, i.e. we will expire messages older than this. +use std::{fmt::Debug, marker::PhantomData}; + +use codec::{Decode, Encode}; +use log::debug; +use parking_lot::RwLock; + +use sc_network::PeerId; +use sc_network_gossip::{ + MessageIntent, ValidationResult as GossipValidationResult, Validator as GossipValidator, + ValidatorContext as GossipValidatorContext, +}; + +use sp_core::Pair; +use sp_runtime::traits::{Block, Hash, Header, NumberFor}; + +use beefy_primitives::{MmrRootHash, VoteMessage}; + +// Limit BEEFY gossip by keeping only a bound number of voting rounds alive. +const MAX_LIVE_GOSSIP_ROUNDS: usize = 5; + +/// Gossip engine messages topic +pub(crate) fn topic() -> B::Hash +where + B: Block, +{ + <::Hashing as Hash>::hash(b"beefy") +} + +/// BEEFY gossip validator +/// +/// Validate BEEFY gossip messages and limit the number of live BEEFY voting rounds. +/// +/// Allows messages from last [`MAX_LIVE_GOSSIP_ROUNDS`] to flow, everything else gets +/// rejected/expired. +/// +///All messaging is handled in a single BEEFY global topic. +pub(crate) struct BeefyGossipValidator +where + B: Block, +{ + topic: B::Hash, + live_rounds: RwLock>>, + _pair: PhantomData

, +} + +impl BeefyGossipValidator +where + B: Block, +{ + pub fn new() -> BeefyGossipValidator { + BeefyGossipValidator { + topic: topic::(), + live_rounds: RwLock::new(Vec::new()), + _pair: PhantomData, + } + } + + pub(crate) fn note_round(&self, round: NumberFor) { + let mut live_rounds = self.live_rounds.write(); + + // NOTE: ideally we'd use a VecDeque here, but currently binary search is only available on + // nightly for `VecDeque`. + while live_rounds.len() > MAX_LIVE_GOSSIP_ROUNDS { + let _ = live_rounds.remove(0); + } + + if let Some(idx) = live_rounds.binary_search(&round).err() { + live_rounds.insert(idx, round); + } + } + + fn is_live(live_rounds: &[NumberFor], round: NumberFor) -> bool { + live_rounds.binary_search(&round).is_ok() + } +} + +impl GossipValidator for BeefyGossipValidator +where + B: Block, + P: Pair, + P::Public: Debug + Decode, + P::Signature: Debug + Decode, +{ + fn validate( + &self, + _context: &mut dyn GossipValidatorContext, + sender: &sc_network::PeerId, + mut data: &[u8], + ) -> GossipValidationResult { + if let Ok(msg) = VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + if P::verify(&msg.signature, &msg.commitment.encode(), &msg.id) { + return GossipValidationResult::ProcessAndKeep(self.topic); + } else { + // TODO: report peer + debug!(target: "beefy", "🥩 Bad signature on message: {:?}, from: {:?}", msg, sender); + } + } + + GossipValidationResult::Discard + } + + fn message_expired<'a>(&'a self) -> Box bool + 'a> { + let live_rounds = self.live_rounds.read(); + Box::new(move |_topic, mut data| { + let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + Ok(vote) => vote, + Err(_) => return true, + }; + + !BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + }) + } + + #[allow(clippy::type_complexity)] + fn message_allowed<'a>(&'a self) -> Box bool + 'a> { + let live_rounds = self.live_rounds.read(); + Box::new(move |_who, _intent, _topic, mut data| { + let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + Ok(vote) => vote, + Err(_) => return true, + }; + + BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + }) + } +} diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 95c7fc2f75198..a337109852514 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -25,14 +25,10 @@ use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, StreamExt}; use hex::ToHex; use log::{debug, error, info, trace, warn}; -use parking_lot::{Mutex, RwLock}; +use parking_lot::Mutex; use sc_client_api::{Backend, FinalityNotification, FinalityNotifications}; -use sc_network::PeerId; -use sc_network_gossip::{ - GossipEngine, MessageIntent, ValidationResult as GossipValidationResult, Validator as GossipValidator, - ValidatorContext as GossipValidatorContext, -}; +use sc_network_gossip::GossipEngine; use sp_api::BlockId; use sp_application_crypto::{AppPublic, Public}; @@ -40,130 +36,23 @@ use sp_core::Pair; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use sp_runtime::{ generic::OpaqueDigestItemId, - traits::{Block, Hash, Header, NumberFor, Zero}, + traits::{Block, Header, NumberFor, Zero}, }; -use crate::{ - error::{self}, - metrics::Metrics, - notification, round, Client, -}; use beefy_primitives::{ - BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, BEEFY_ENGINE_ID, + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, VoteMessage, BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID, KEY_TYPE, }; -/// The maximum number of live gossip rounds allowed, i.e. we will expire messages older than this. -const MAX_LIVE_GOSSIP_ROUNDS: usize = 5; - -/// Gossip engine messages topic -pub(crate) fn topic() -> B::Hash -where - B: Block, -{ - <::Hashing as Hash>::hash(b"beefy") -} - -/// Allows messages from last [`MAX_LIVE_GOSSIP_ROUNDS`] to flow, everything else gets -/// rejected/expired. All messaging is handled in a single global topic. -pub struct BeefyGossipValidator -where - B: Block, -{ - topic: B::Hash, - live_rounds: RwLock>>, - _pair: PhantomData

, -} - -impl BeefyGossipValidator -where - B: Block, -{ - pub fn new() -> BeefyGossipValidator { - BeefyGossipValidator { - topic: topic::(), - live_rounds: RwLock::new(Vec::new()), - _pair: PhantomData, - } - } - - fn note_round(&self, round: NumberFor) { - let mut live_rounds = self.live_rounds.write(); - - // NOTE: ideally we'd use a VecDeque here, but currently binary search is only available on - // nightly for `VecDeque`. - while live_rounds.len() > MAX_LIVE_GOSSIP_ROUNDS { - let _ = live_rounds.remove(0); - } - - if let Some(idx) = live_rounds.binary_search(&round).err() { - live_rounds.insert(idx, round); - } - } - - fn is_live(live_rounds: &[NumberFor], round: NumberFor) -> bool { - live_rounds.binary_search(&round).is_ok() - } -} - -impl GossipValidator for BeefyGossipValidator -where - B: Block, - P: Pair, - P::Public: Debug + Decode, - P::Signature: Debug + Decode, -{ - fn validate( - &self, - _context: &mut dyn GossipValidatorContext, - sender: &sc_network::PeerId, - mut data: &[u8], - ) -> GossipValidationResult { - if let Ok(msg) = VoteMessage::, P::Public, P::Signature>::decode(&mut data) { - if P::verify(&msg.signature, &msg.commitment.encode(), &msg.id) { - return GossipValidationResult::ProcessAndKeep(self.topic); - } else { - // TODO: report peer - debug!(target: "beefy", "🥩 Bad signature on message: {:?}, from: {:?}", msg, sender); - } - } - - GossipValidationResult::Discard - } - - fn message_expired<'a>(&'a self) -> Box bool + 'a> { - let live_rounds = self.live_rounds.read(); - Box::new(move |_topic, mut data| { - let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { - Ok(vote) => vote, - Err(_) => return true, - }; - - !BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) - }) - } - - #[allow(clippy::type_complexity)] - fn message_allowed<'a>(&'a self) -> Box bool + 'a> { - let live_rounds = self.live_rounds.read(); - Box::new(move |_who, _intent, _topic, mut data| { - let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { - Ok(vote) => vote, - Err(_) => return true, - }; - - BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) - }) - } -} - -#[derive(Debug, Decode, Encode)] -struct VoteMessage { - commitment: Commitment, - id: Id, - signature: Signature, -} +use crate::{ + error::{self}, + metrics::Metrics, + notification, round, + validator::{topic, BeefyGossipValidator}, + Client, +}; +/// A BEEFY worker plays the BEEFY protocol pub(crate) struct BeefyWorker where B: Block, @@ -202,15 +91,12 @@ where C: Client, C::Api: BeefyApi, { - /// Retrun a new BEEFY worker instance. + /// Return a new BEEFY worker instance. /// - /// Note that full BEEFY worker initialization can only be completed, if an - /// on-chain BEEFY pallet is available. Reason is that the current active - /// validator set has to be fetched from the on-chain BEFFY pallet. + /// Note that a BEEFY worker is only fully functional if a corresponding + /// BEEFY pallet has been deployed on-chain. /// - /// For this reason, BEEFY worker initialization completes only after a finality - /// notification has been received. Such a notifcation is basically an indication - /// that an on-chain BEEFY pallet may be available. + /// The BEEFY pallet is needed in order to keep track of the BEEFY authority set. pub(crate) fn new( client: Arc, key_store: SyncCryptoStorePtr, @@ -248,7 +134,7 @@ where C: Client, C::Api: BeefyApi, { - /// Return `true`, if the should vote on block `number` + /// Return `true`, if we should vote on block `number` fn should_vote_on(&self, number: NumberFor) -> bool { use sp_runtime::{traits::Saturating, SaturatedConversion}; @@ -292,9 +178,10 @@ where /// 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 BEEFY authority set change and we can't fetch the validator set from the - /// BEEFY on-chain state. Such a failure is usually an indication that the BEEFT - /// pallet has not been deployed (yet). + /// a BEEFY authority set change and we can't fetch the authority set from the + /// BEEFY on-chain state. + /// + /// Such a failure is usually an indication that the BEEFT pallet has not been deployed (yet). fn validator_set(&self, header: &B::Header) -> Option> { if let Some(new) = find_authorities_change::(header) { Some(new) diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index acfacb8a93225..cdf6dc0cba7f4 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -111,6 +111,20 @@ pub enum ConsensusLog { MmrRoot(MmrRootHash), } +/// BEEFY vote message. +/// +/// A vote message is a direct vote created by a BEEFY node on every voting round +/// and is gossiped to its peers. +#[derive(Debug, Decode, Encode)] +pub struct VoteMessage { + /// Commit to information extracted from a finalized block + pub commitment: Commitment, + /// Node authority id + pub id: Id, + /// Node signature + pub signature: Signature, +} + sp_api::decl_runtime_apis! { /// API necessary for BEEFY voters. pub trait BeefyApi { From 40e81a6f3291ae1a0a6cab0120732c4eaf99820e Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 16 Apr 2021 06:01:06 +0200 Subject: [PATCH 052/109] Add block_delta parameter to start_beefy_gadget (#151) * Add block_delta parameter * rename to min_block_delta --- client/beefy/src/lib.rs | 2 ++ client/beefy/src/worker.rs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index a33c391cfa87d..784c40cb4a75a 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -94,6 +94,7 @@ pub async fn start_beefy_gadget( network: N, signed_commitment_sender: notification::BeefySignedCommitmentSender, _sync_oracle: SO, + min_block_delta: u32, prometheus_registry: Option, ) where B: Block, @@ -129,6 +130,7 @@ pub async fn start_beefy_gadget( signed_commitment_sender, gossip_engine, gossip_validator, + min_block_delta, metrics, ); diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index a337109852514..05e6dc68b7f27 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -67,10 +67,10 @@ where signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: Arc>>, gossip_validator: Arc>, + min_block_delta: u32, metrics: Option, rounds: round::Rounds, P::Public, P::Signature>, finality_notifications: FinalityNotifications, - min_interval: u32, /// Best block we received a GRANDPA notification for best_grandpa_block: NumberFor, /// Best block a BEEFY voting round has been concluded for @@ -103,6 +103,7 @@ where signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: GossipEngine, gossip_validator: Arc>, + min_block_delta: u32, metrics: Option, ) -> Self { BeefyWorker { @@ -111,10 +112,10 @@ where signed_commitment_sender, gossip_engine: Arc::new(Mutex::new(gossip_engine)), gossip_validator, + min_block_delta, metrics, rounds: round::Rounds::new(ValidatorSet::empty()), finality_notifications: client.finality_notification_stream(), - min_interval: 2, best_grandpa_block: client.info().finalized_number, best_beefy_block: None, best_block_voted_on: Zero::zero(), @@ -148,7 +149,7 @@ where let diff = self.best_grandpa_block.saturating_sub(best_beefy_block); let diff = diff.saturated_into::(); let next_power_of_two = (diff / 2).next_power_of_two(); - let next_block_to_vote_on = self.best_block_voted_on + self.min_interval.max(next_power_of_two).into(); + let next_block_to_vote_on = self.best_block_voted_on + self.min_block_delta.max(next_power_of_two).into(); trace!( target: "beefy", From bd3a85fb29835738500f1ca6fd64f5ea1b1dc47d Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 19 Apr 2021 10:26:47 +0200 Subject: [PATCH 053/109] Add additional metrics (#152) * Add additional metrics * add skipped session metric * add some comment for temp metric --- client/beefy/src/metrics.rs | 56 +++++++++++++++++++++++++++++++++++-- client/beefy/src/worker.rs | 32 +++++++++++++++++---- 2 files changed, 79 insertions(+), 9 deletions(-) diff --git a/client/beefy/src/metrics.rs b/client/beefy/src/metrics.rs index 798c75ad99b94..513031b5502aa 100644 --- a/client/beefy/src/metrics.rs +++ b/client/beefy/src/metrics.rs @@ -22,7 +22,16 @@ use prometheus::{register, Counter, Gauge, PrometheusError, Registry, U64}; pub(crate) struct Metrics { /// Current active validator set id pub beefy_validator_set_id: Gauge, - pub beefy_gadget_votes: Counter, + /// Total number of votes sent by this node + pub beefy_votes_sent: Counter, + /// Most recent concluded voting round + pub beefy_round_concluded: Gauge, + /// Best block finalized by BEEFY + pub beefy_best_block: Gauge, + /// Next block BEEFY should vote on + pub beefy_should_vote_on: Gauge, + /// Number of sessions without a signed commitment + pub beefy_skipped_sessions: Counter, } impl Metrics { @@ -32,10 +41,51 @@ impl Metrics { Gauge::new("beefy_validator_set_id", "Current BEEFY active validator set id.")?, registry, )?, - beefy_gadget_votes: register( - Counter::new("beefy_gadget_votes_total", "Total number of vote messages gossiped.")?, + beefy_votes_sent: register( + Counter::new("beefy_votes_sent", "Number of votes sent by this node")?, + registry, + )?, + beefy_round_concluded: register( + Gauge::new("beefy_round_concluded", "Voting round, that has been concluded")?, + registry, + )?, + beefy_best_block: register( + Gauge::new("beefy_best_block", "Best block finalized by BEEFY")?, + registry, + )?, + beefy_should_vote_on: register( + Gauge::new("beefy_should_vote_on", "Next block, BEEFY should vote on")?, + registry, + )?, + beefy_skipped_sessions: register( + Counter::new( + "beefy_skipped_sessions", + "Number of sessions without a signed commitment", + )?, registry, )?, }) } } + +// Note: we use the `format` macro to convert an expr into a `u64`. This will fail, +// if expr does not derive `Display`. +#[macro_export] +macro_rules! metric_set { + ($self:ident, $m:ident, $v:expr) => {{ + let val: u64 = format!("{}", $v).parse().unwrap(); + + if let Some(metrics) = $self.metrics.as_ref() { + metrics.$m.set(val); + } + }}; +} + +#[macro_export] +macro_rules! metric_inc { + ($self:ident, $m:ident) => {{ + if let Some(metrics) = $self.metrics.as_ref() { + metrics.$m.inc(); + } + }}; +} diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 05e6dc68b7f27..65870dde610f3 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -46,6 +46,7 @@ use beefy_primitives::{ use crate::{ error::{self}, + metric_inc, metric_set, metrics::Metrics, notification, round, validator::{topic, BeefyGossipValidator}, @@ -67,6 +68,7 @@ where signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: Arc>>, gossip_validator: Arc>, + /// Min delta in block numbers between two blocks, BEEFY should vote on min_block_delta: u32, metrics: Option, rounds: round::Rounds, P::Public, P::Signature>, @@ -77,6 +79,9 @@ where best_beefy_block: Option>, /// Best block this node has voted for best_block_voted_on: NumberFor, + /// Validator set id for the last signed commitment + last_signed_id: u64, + // keep rustc happy _backend: PhantomData, _pair: PhantomData

, } @@ -119,6 +124,7 @@ where best_grandpa_block: client.info().finalized_number, best_beefy_block: None, best_block_voted_on: Zero::zero(), + last_signed_id: 0, _backend: PhantomData, _pair: PhantomData, } @@ -160,6 +166,8 @@ where next_block_to_vote_on, ); + metric_set!(self, beefy_should_vote_on, next_block_to_vote_on); + number == next_block_to_vote_on } @@ -212,8 +220,11 @@ where if let Some(active) = self.validator_set(¬ification.header) { debug!(target: "beefy", "🥩 Active validator set id: {:?}", active); - if let Some(metrics) = self.metrics.as_ref() { - metrics.beefy_validator_set_id.set(active.id); + metric_set!(self, beefy_validator_set_id, active.id); + + // BEEFY should produce a signed commitment for each session + if (active.id != GENESIS_AUTHORITY_SET_ID) && (active.id != (1 + self.last_signed_id)) { + metric_inc!(self, beefy_skipped_sessions); } // Authority set change or genesis set id triggers new voting rounds @@ -227,6 +238,10 @@ where debug!(target: "beefy", "🥩 New Rounds for id: {:?}", active.id); self.best_beefy_block = Some(*notification.header.number()); + + // this metric is kind of 'fake'. Best BEEFY block should only be updated once we have a + // signed commitment for the block. Remove once the above TODO is done. + metric_set!(self, beefy_best_block, *notification.header.number()); } }; @@ -269,9 +284,7 @@ where let encoded_message = message.encode(); - if let Some(metrics) = self.metrics.as_ref() { - metrics.beefy_gadget_votes.inc(); - } + metric_inc!(self, beefy_votes_sent); debug!(target: "beefy", "🥩 Sent vote message: {:?}", message); @@ -293,18 +306,25 @@ where if vote_added && self.rounds.is_done(&round) { if let Some(signatures) = self.rounds.drop(&round) { + // id is stored for skipped session metric calculation + self.last_signed_id = self.rounds.validator_set_id(); + let commitment = Commitment { payload: round.0, block_number: round.1, - validator_set_id: self.rounds.validator_set_id(), + validator_set_id: self.last_signed_id, }; let signed_commitment = SignedCommitment { commitment, signatures }; + metric_set!(self, beefy_round_concluded, round.1); + info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); self.signed_commitment_sender.notify(signed_commitment); self.best_beefy_block = Some(round.1); + + metric_set!(self, beefy_best_block, round.1); } } } From 2e9b4bf31de9b3d5088cb10748c6af43833a47e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 20 Apr 2021 11:28:31 +0100 Subject: [PATCH 054/109] don't log under info for every concluded round (#156) --- client/beefy/src/worker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 65870dde610f3..bf721d58fad0a 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -319,7 +319,7 @@ where metric_set!(self, beefy_round_concluded, round.1); - info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); + debug!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); self.signed_commitment_sender.notify(signed_commitment); self.best_beefy_block = Some(round.1); From 6b6a4670ecb6a823177faba1dcc2c491f6dcec7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:33:07 +0100 Subject: [PATCH 055/109] don't log error on missing validator keys (#157) * don't log error on missing validator keys * remove unused import --- client/beefy/src/worker.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index bf721d58fad0a..e0d6a2f6caf10 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -24,7 +24,7 @@ use std::{ use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, StreamExt}; use hex::ToHex; -use log::{debug, error, info, trace, warn}; +use log::{debug, error, trace, warn}; use parking_lot::Mutex; use sc_client_api::{Backend, FinalityNotification, FinalityNotifications}; @@ -249,7 +249,7 @@ where let local_id = if let Some(id) = self.local_id() { id } else { - error!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); + debug!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); return; }; From 11786fcaa37082f66a64e1a33387bd6d0c34ae5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Wed, 21 Apr 2021 11:30:26 +0100 Subject: [PATCH 056/109] Fix validator set change handling (#158) * reduce some logs from debug to trace * fix validator set changes handling * rename validator module to gossip * run rustfmt --- client/beefy/src/{validator.rs => gossip.rs} | 0 client/beefy/src/lib.rs | 4 +-- client/beefy/src/worker.rs | 36 ++++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) rename client/beefy/src/{validator.rs => gossip.rs} (100%) diff --git a/client/beefy/src/validator.rs b/client/beefy/src/gossip.rs similarity index 100% rename from client/beefy/src/validator.rs rename to client/beefy/src/gossip.rs diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 784c40cb4a75a..7c4ade5611d77 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -33,9 +33,9 @@ use sp_runtime::traits::Block; use beefy_primitives::BeefyApi; mod error; +mod gossip; mod metrics; mod round; -mod validator; mod worker; pub mod notification; @@ -107,7 +107,7 @@ pub async fn start_beefy_gadget( N: GossipNetwork + Clone + Send + 'static, SO: SyncOracleT + Send + 'static, { - let gossip_validator = Arc::new(validator::BeefyGossipValidator::new()); + let gossip_validator = Arc::new(gossip::BeefyGossipValidator::new()); let gossip_engine = GossipEngine::new(network, BEEFY_PROTOCOL_NAME, gossip_validator.clone(), None); let metrics = prometheus_registry diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index e0d6a2f6caf10..9a7aa715362a1 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -46,11 +46,10 @@ use beefy_primitives::{ use crate::{ error::{self}, + gossip::{topic, BeefyGossipValidator}, metric_inc, metric_set, metrics::Metrics, - notification, round, - validator::{topic, BeefyGossipValidator}, - Client, + notification, round, Client, }; /// A BEEFY worker plays the BEEFY protocol @@ -212,27 +211,28 @@ where } fn handle_finality_notification(&mut self, notification: FinalityNotification) { - debug!(target: "beefy", "🥩 Finality notification: {:?}", notification); + trace!(target: "beefy", "🥩 Finality notification: {:?}", notification); // update best GRANDPA finalized block we have seen self.best_grandpa_block = *notification.header.number(); if let Some(active) = self.validator_set(¬ification.header) { - debug!(target: "beefy", "🥩 Active validator set id: {:?}", active); - - metric_set!(self, beefy_validator_set_id, active.id); - - // BEEFY should produce a signed commitment for each session - if (active.id != GENESIS_AUTHORITY_SET_ID) && (active.id != (1 + self.last_signed_id)) { - metric_inc!(self, beefy_skipped_sessions); - } - // Authority set change or genesis set id triggers new voting rounds // // TODO: (adoerr) Enacting a new authority set will also implicitly 'conclude' // the currently active BEEFY voting round by starting a new one. This is - // temporary and needs to be repalced by proper round life cycle handling. - if (active.id != self.rounds.validator_set_id()) || (active.id == GENESIS_AUTHORITY_SET_ID) { + // temporary and needs to be replaced by proper round life cycle handling. + if active.id != self.rounds.validator_set_id() + || (active.id == GENESIS_AUTHORITY_SET_ID && self.best_beefy_block.is_none()) + { + debug!(target: "beefy", "🥩 New active validator set id: {:?}", active); + metric_set!(self, beefy_validator_set_id, active.id); + + // BEEFY should produce a signed commitment for each session + if active.id != self.last_signed_id + 1 && active.id != GENESIS_AUTHORITY_SET_ID { + metric_inc!(self, beefy_skipped_sessions); + } + self.rounds = round::Rounds::new(active.clone()); debug!(target: "beefy", "🥩 New Rounds for id: {:?}", active.id); @@ -243,13 +243,13 @@ where // signed commitment for the block. Remove once the above TODO is done. metric_set!(self, beefy_best_block, *notification.header.number()); } - }; + } if self.should_vote_on(*notification.header.number()) { let local_id = if let Some(id) = self.local_id() { id } else { - debug!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); + trace!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); return; }; @@ -332,7 +332,7 @@ where pub(crate) async fn run(mut self) { let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( |notification| async move { - debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); + trace!(target: "beefy", "🥩 Got vote message: {:?}", notification); VoteMessage::, P::Public, P::Signature>::decode( &mut ¬ification.message[..], From 5fb0be316b48ee1537c1c403f9be3c99d78ef00b Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 26 Apr 2021 17:43:44 +0200 Subject: [PATCH 057/109] Fix should_vote_on() (#160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix should_vote_on() * by the textbook * fix the algorithm * Apply review suggestions * don't use NumberFor in vote_target Co-authored-by: André Silva --- client/beefy/Cargo.toml | 1 + client/beefy/src/worker.rs | 142 +++++++++++++++++++++++++++++++------ 2 files changed, 121 insertions(+), 22 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 317c9ee58d008..42cbfdae12662 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -17,6 +17,7 @@ prometheus = { package = "substrate-prometheus-endpoint", git = "https://github. sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 9a7aa715362a1..9a2c0124f67f3 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -32,11 +32,13 @@ use sc_network_gossip::GossipEngine; use sp_api::BlockId; use sp_application_crypto::{AppPublic, Public}; +use sp_arithmetic::traits::AtLeast32Bit; use sp_core::Pair; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use sp_runtime::{ generic::OpaqueDigestItemId, - traits::{Block, Header, NumberFor, Zero}, + traits::{Block, Header, NumberFor}, + SaturatedConversion, }; use beefy_primitives::{ @@ -76,8 +78,6 @@ where best_grandpa_block: NumberFor, /// Best block a BEEFY voting round has been concluded for best_beefy_block: Option>, - /// Best block this node has voted for - best_block_voted_on: NumberFor, /// Validator set id for the last signed commitment last_signed_id: u64, // keep rustc happy @@ -122,7 +122,6 @@ where finality_notifications: client.finality_notification_stream(), best_grandpa_block: client.info().finalized_number, best_beefy_block: None, - best_block_voted_on: Zero::zero(), last_signed_id: 0, _backend: PhantomData, _pair: PhantomData, @@ -142,8 +141,6 @@ where { /// Return `true`, if we should vote on block `number` fn should_vote_on(&self, number: NumberFor) -> bool { - use sp_runtime::{traits::Saturating, SaturatedConversion}; - let best_beefy_block = if let Some(block) = self.best_beefy_block { block } else { @@ -151,23 +148,13 @@ where return false; }; - let diff = self.best_grandpa_block.saturating_sub(best_beefy_block); - let diff = diff.saturated_into::(); - let next_power_of_two = (diff / 2).next_power_of_two(); - let next_block_to_vote_on = self.best_block_voted_on + self.min_block_delta.max(next_power_of_two).into(); + let target = vote_target(self.best_grandpa_block, best_beefy_block, self.min_block_delta); - trace!( - target: "beefy", - "should_vote_on: #{:?}, diff: {:?}, next_power_of_two: {:?}, next_block_to_vote_on: #{:?}", - number, - diff, - next_power_of_two, - next_block_to_vote_on, - ); + trace!(target: "beefy", "🥩 should_vote_on: #{:?}, next_block_to_vote_on: #{:?}", number, target); - metric_set!(self, beefy_should_vote_on, next_block_to_vote_on); + metric_set!(self, beefy_should_vote_on, target); - number == next_block_to_vote_on + number == target } fn sign_commitment(&self, id: &P::Public, commitment: &[u8]) -> Result> { @@ -274,8 +261,6 @@ where } }; - self.best_block_voted_on = *notification.header.number(); - let message = VoteMessage { commitment, id: local_id, @@ -402,3 +387,116 @@ where header.digest().convert_first(|l| l.try_to(id).and_then(filter)) } + +/// Calculate next block number to vote on +fn vote_target(best_grandpa: N, best_beefy: N, min_delta: u32) -> N +where + N: AtLeast32Bit + Copy + Debug, +{ + let diff = best_grandpa.saturating_sub(best_beefy); + let diff = diff.saturated_into::(); + let target = best_beefy + min_delta.max(diff.next_power_of_two()).into(); + + trace!( + target: "beefy", + "🥩 vote target - diff: {:?}, next_power_of_two: {:?}, target block: #{:?}", + diff, + diff.next_power_of_two(), + target, + ); + + target +} + +#[cfg(test)] +mod tests { + use super::vote_target; + + #[test] + fn vote_on_min_block_delta() { + let t = vote_target(1u32, 0, 4); + assert_eq!(4, t); + let t = vote_target(2u32, 0, 4); + assert_eq!(4, t); + let t = vote_target(3u32, 0, 4); + assert_eq!(4, t); + let t = vote_target(4u32, 0, 4); + assert_eq!(4, t); + + let t = vote_target(4u32, 4, 4); + assert_eq!(8, t); + + let t = vote_target(10u32, 10, 4); + assert_eq!(14, t); + let t = vote_target(11u32, 10, 4); + assert_eq!(14, t); + let t = vote_target(12u32, 10, 4); + assert_eq!(14, t); + let t = vote_target(13u32, 10, 4); + assert_eq!(14, t); + + let t = vote_target(10u32, 10, 8); + assert_eq!(18, t); + let t = vote_target(11u32, 10, 8); + assert_eq!(18, t); + let t = vote_target(12u32, 10, 8); + assert_eq!(18, t); + let t = vote_target(13u32, 10, 8); + assert_eq!(18, t); + } + + #[test] + fn vote_on_power_of_two() { + let t = vote_target(1008u32, 1000, 4); + assert_eq!(1008, t); + + let t = vote_target(1016u32, 1000, 4); + assert_eq!(1016, t); + + let t = vote_target(1032u32, 1000, 4); + assert_eq!(1032, t); + + let t = vote_target(1064u32, 1000, 4); + assert_eq!(1064, t); + + let t = vote_target(1128u32, 1000, 4); + assert_eq!(1128, t); + + let t = vote_target(1256u32, 1000, 4); + assert_eq!(1256, t); + + let t = vote_target(1512u32, 1000, 4); + assert_eq!(1512, t); + + let t = vote_target(1024u32, 0, 4); + assert_eq!(1024, t); + } + + #[test] + fn vote_on_target_block() { + let t = vote_target(1008u32, 1002, 4); + assert_eq!(1010, t); + let t = vote_target(1010u32, 1002, 4); + assert_eq!(1010, t); + + let t = vote_target(1016u32, 1006, 4); + assert_eq!(1022, t); + let t = vote_target(1022u32, 1006, 4); + assert_eq!(1022, t); + + let t = vote_target(1032u32, 1012, 4); + assert_eq!(1044, t); + let t = vote_target(1044u32, 1012, 4); + assert_eq!(1044, t); + + let t = vote_target(1064u32, 1014, 4); + assert_eq!(1078, t); + let t = vote_target(1078u32, 1014, 4); + assert_eq!(1078, t); + + let t = vote_target(1128u32, 1008, 4); + assert_eq!(1136, t); + let t = vote_target(1136u32, 1008, 4); + assert_eq!(1136, t); + } +} From 8f7f4e28966a711794b898f1ba5cfa4b6f2b47b4 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 30 Apr 2021 09:55:30 +0200 Subject: [PATCH 058/109] Make KeyStore optional (#173) --- client/beefy/src/lib.rs | 2 +- client/beefy/src/worker.rs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 7c4ade5611d77..c48105c46e7a4 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -90,7 +90,7 @@ where /// This is a thin shim around running and awaiting a BEEFY worker. pub async fn start_beefy_gadget( client: Arc, - key_store: SyncCryptoStorePtr, + key_store: Option, network: N, signed_commitment_sender: notification::BeefySignedCommitmentSender, _sync_oracle: SO, diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 9a2c0124f67f3..b206a87f5e313 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -65,7 +65,7 @@ where C: Client, { client: Arc, - key_store: SyncCryptoStorePtr, + key_store: Option, signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: Arc>>, gossip_validator: Arc>, @@ -103,7 +103,7 @@ where /// The BEEFY pallet is needed in order to keep track of the BEEFY authority set. pub(crate) fn new( client: Arc, - key_store: SyncCryptoStorePtr, + key_store: Option, signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: GossipEngine, gossip_validator: Arc>, @@ -158,7 +158,12 @@ where } fn sign_commitment(&self, id: &P::Public, commitment: &[u8]) -> Result> { - let sig = SyncCryptoStore::sign_with(&*self.key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) + let key_store = self + .key_store + .clone() + .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "Missing KeyStore".into()))?; + + let sig = SyncCryptoStore::sign_with(&*key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) .map_err(|e| error::Crypto::CannotSign((*id).clone(), e.to_string()))? .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; @@ -190,10 +195,12 @@ where /// /// `None` is returned, if we are not permitted to vote fn local_id(&self) -> Option { + let key_store = self.key_store.clone()?; + self.rounds .validators() .iter() - .find(|id| SyncCryptoStore::has_keys(&*self.key_store, &[(id.to_raw_vec(), KEY_TYPE)])) + .find(|id| SyncCryptoStore::has_keys(&*key_store, &[(id.to_raw_vec(), KEY_TYPE)])) .cloned() } From 532c85880f82c0a960c7c0ce8e24243878c0a459 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 4 May 2021 17:15:36 +0200 Subject: [PATCH 059/109] Use builder pattern for NonDefaultSetConfig (#178) Co-authored-by: adoerr <0xad@gmx.net> --- client/beefy/src/lib.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index c48105c46e7a4..3b52f49f1e015 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -45,16 +45,9 @@ pub const BEEFY_PROTOCOL_NAME: &str = "/paritytech/beefy/1"; /// Returns the configuration value to put in /// [`sc_network::config::NetworkConfiguration::extra_sets`]. pub fn beefy_peers_set_config() -> sc_network::config::NonDefaultSetConfig { - sc_network::config::NonDefaultSetConfig { - notifications_protocol: BEEFY_PROTOCOL_NAME.into(), - max_notification_size: 1024 * 1024, - set_config: sc_network::config::SetConfig { - in_peers: 25, - out_peers: 25, - reserved_nodes: Vec::new(), - non_reserved_mode: sc_network::config::NonReservedPeerMode::Accept, - }, - } + let mut cfg = sc_network::config::NonDefaultSetConfig::new(BEEFY_PROTOCOL_NAME.into(), 1024 * 1024); + cfg.allow_non_reserved(25, 25); + cfg } /// A convenience BEEFY client trait that defines all the type bounds a BEEFY client From 088fa19fd02ce063546e27b5842fe96c4a825528 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Tue, 11 May 2021 16:25:29 +0200 Subject: [PATCH 060/109] Append SignedCommitment to block justifications (#177) * Append SignedCommitment * add BeefyParams * add WorkerParams * use warn * versioned variant for SignedCommitment --- client/beefy/src/lib.rs | 55 +++++++++++++++++++++------- client/beefy/src/worker.rs | 59 ++++++++++++++++++++++++------ primitives/beefy/src/commitment.rs | 36 ++++++++++++++++++ primitives/beefy/src/lib.rs | 2 +- 4 files changed, 126 insertions(+), 26 deletions(-) diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 3b52f49f1e015..ac6d5aea76df9 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -26,7 +26,6 @@ use sc_network_gossip::{GossipEngine, Network as GossipNetwork}; use sp_api::ProvideRuntimeApi; use sp_application_crypto::AppPublic; use sp_blockchain::HeaderBackend; -use sp_consensus::SyncOracle as SyncOracleT; use sp_keystore::SyncCryptoStorePtr; use sp_runtime::traits::Block; @@ -78,18 +77,34 @@ where // empty } +/// BEEFY gadget initialization parameters. +pub struct BeefyParams +where + B: Block, + P: sp_core::Pair, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, +{ + /// BEEFY client + pub client: Arc, + /// Client Backend + pub backend: Arc, + /// Local key store + pub key_store: Option, + /// Gossip network + pub network: N, + /// BEEFY signed commitment sender + pub signed_commitment_sender: notification::BeefySignedCommitmentSender, + /// Minimal delta between blocks, BEEFY should vote for + pub min_block_delta: u32, + /// Prometheus metric registry + pub prometheus_registry: Option, +} + /// Start the BEEFY gadget. /// /// This is a thin shim around running and awaiting a BEEFY worker. -pub async fn start_beefy_gadget( - client: Arc, - key_store: Option, - network: N, - signed_commitment_sender: notification::BeefySignedCommitmentSender, - _sync_oracle: SO, - min_block_delta: u32, - prometheus_registry: Option, -) where +pub async fn start_beefy_gadget(beefy_params: BeefyParams) +where B: Block, P: sp_core::Pair, P::Public: AppPublic + Codec, @@ -98,8 +113,17 @@ pub async fn start_beefy_gadget( C: Client, C::Api: BeefyApi, N: GossipNetwork + Clone + Send + 'static, - SO: SyncOracleT + Send + 'static, { + let BeefyParams { + client, + backend, + key_store, + network, + signed_commitment_sender, + min_block_delta, + prometheus_registry, + } = beefy_params; + let gossip_validator = Arc::new(gossip::BeefyGossipValidator::new()); let gossip_engine = GossipEngine::new(network, BEEFY_PROTOCOL_NAME, gossip_validator.clone(), None); @@ -117,15 +141,18 @@ pub async fn start_beefy_gadget( } }); - let worker = worker::BeefyWorker::<_, _, BE, P>::new( - client.clone(), + let worker_params = worker::WorkerParams { + client, + backend, key_store, signed_commitment_sender, gossip_engine, gossip_validator, min_block_delta, metrics, - ); + }; + + let worker = worker::BeefyWorker::<_, _, _, _>::new(worker_params); worker.run().await } diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index b206a87f5e313..a8899283ca7f5 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -42,8 +42,8 @@ use sp_runtime::{ }; use beefy_primitives::{ - BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, VoteMessage, BEEFY_ENGINE_ID, - GENESIS_AUTHORITY_SET_ID, KEY_TYPE, + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, VersionedCommitment, VoteMessage, + BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID, KEY_TYPE, }; use crate::{ @@ -54,6 +54,22 @@ use crate::{ notification, round, Client, }; +pub(crate) struct WorkerParams +where + B: Block, + P: sp_core::Pair, + P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, +{ + pub client: Arc, + pub backend: Arc, + pub key_store: Option, + pub signed_commitment_sender: notification::BeefySignedCommitmentSender, + pub gossip_engine: GossipEngine, + pub gossip_validator: Arc>, + pub min_block_delta: u32, + pub metrics: Option, +} + /// A BEEFY worker plays the BEEFY protocol pub(crate) struct BeefyWorker where @@ -65,6 +81,7 @@ where C: Client, { client: Arc, + backend: Arc, key_store: Option, signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: Arc>>, @@ -101,17 +118,21 @@ where /// BEEFY pallet has been deployed on-chain. /// /// The BEEFY pallet is needed in order to keep track of the BEEFY authority set. - pub(crate) fn new( - client: Arc, - key_store: Option, - signed_commitment_sender: notification::BeefySignedCommitmentSender, - gossip_engine: GossipEngine, - gossip_validator: Arc>, - min_block_delta: u32, - metrics: Option, - ) -> Self { + pub(crate) fn new(worker_params: WorkerParams) -> Self { + let WorkerParams { + client, + backend, + key_store, + signed_commitment_sender, + gossip_engine, + gossip_validator, + min_block_delta, + metrics, + } = worker_params; + BeefyWorker { client: client.clone(), + backend, key_store, signed_commitment_sender, gossip_engine: Arc::new(Mutex::new(gossip_engine)), @@ -313,6 +334,22 @@ where debug!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); + if self + .backend + .append_justification( + BlockId::Number(round.1), + ( + BEEFY_ENGINE_ID, + VersionedCommitment::V1(signed_commitment.clone()).encode(), + ), + ) + .is_err() + { + // this is a warning for now, because until the round lifecycle is improved, we will + // conclude certain rounds multiple times. + warn!(target: "beefy", "🥩 Failed to append justification: {:?}", signed_commitment); + } + self.signed_commitment_sender.notify(signed_commitment); self.best_beefy_block = Some(round.1); diff --git a/primitives/beefy/src/commitment.rs b/primitives/beefy/src/commitment.rs index 0e682fbff56e9..0cca6e6d77bbb 100644 --- a/primitives/beefy/src/commitment.rs +++ b/primitives/beefy/src/commitment.rs @@ -95,6 +95,16 @@ impl SignedCommitment { + #[codec(index = 1)] + /// Current active version + V1(SignedCommitment), +} + #[cfg(test)] mod tests { use super::*; @@ -102,6 +112,7 @@ mod tests { type TestCommitment = Commitment; type TestSignedCommitment = SignedCommitment>; + type TestVersionedCommitment = VersionedCommitment>; #[test] fn commitment_encode_decode() { @@ -195,4 +206,29 @@ mod tests { assert!(c < d); assert!(b < d); } + + #[test] + fn versioned_commitment_encode_decode() { + let commitment: TestCommitment = Commitment { + payload: "Hello World!".into(), + block_number: 5, + validator_set_id: 0, + }; + + let signed = SignedCommitment { + commitment, + signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + }; + + let versioned = TestVersionedCommitment::V1(signed.clone()); + + let encoded = codec::Encode::encode(&versioned); + + assert_eq!(1, encoded[0]); + assert_eq!(encoded[1..], codec::Encode::encode(&signed)); + + let decoded = TestVersionedCommitment::decode(&mut &*encoded); + + assert_eq!(decoded, Ok(versioned)); + } } diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index cdf6dc0cba7f4..287574947c116 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -35,7 +35,7 @@ mod commitment; pub mod witness; -pub use commitment::{Commitment, SignedCommitment}; +pub use commitment::{Commitment, SignedCommitment, VersionedCommitment}; use codec::{Codec, Decode, Encode}; use sp_core::H256; From 45acbe13332dd07c23bc8f309da0d4a4b22b2e1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 06:08:12 +0200 Subject: [PATCH 061/109] Bump serde from 1.0.125 to 1.0.126 (#184) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.125 to 1.0.126. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.125...v1.0.126) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- client/beefy/rpc/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 028c977b9994d..90fe183ae9aa3 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = { version = "0.3.14", features = ["compat"] } log = "0.4" -serde = { version = "1.0.125", features = ["derive"] } +serde = { version = "1.0.126", features = ["derive"] } serde_json = "1.0.64" jsonrpc-core = "15.1.0" diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 1e7362ebc836e..936164e9d5359 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -serde = { version = "1.0.125", optional = true } +serde = { version = "1.0.126", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From bff1de1b04941462b44c22733774fe11fea744a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Jun 2021 08:18:04 +0200 Subject: [PATCH 062/109] Bump strum from 0.20.0 to 0.21.0 (#195) * Bump strum from 0.20.0 to 0.21.0 Bumps [strum](https://github.com/Peternator7/strum) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/Peternator7/strum/releases) - [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md) - [Commits](https://github.com/Peternator7/strum/commits) --- updated-dependencies: - dependency-name: strum dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * use dervie feature for strum; clippy and deny housekeeping Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: adoerr <0xad@gmx.net> --- client/beefy/src/worker.rs | 2 +- primitives/beefy/tests/light_client/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index a8899283ca7f5..b135bdd3089c8 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -184,7 +184,7 @@ where .clone() .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "Missing KeyStore".into()))?; - let sig = SyncCryptoStore::sign_with(&*key_store, KEY_TYPE, &id.to_public_crypto_pair(), &commitment) + let sig = SyncCryptoStore::sign_with(&*key_store, KEY_TYPE, &id.to_public_crypto_pair(), commitment) .map_err(|e| error::Crypto::CannotSign((*id).clone(), e.to_string()))? .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; diff --git a/primitives/beefy/tests/light_client/mod.rs b/primitives/beefy/tests/light_client/mod.rs index 8825a4f2dc0d1..b5c0d827ea20c 100644 --- a/primitives/beefy/tests/light_client/mod.rs +++ b/primitives/beefy/tests/light_client/mod.rs @@ -217,7 +217,7 @@ impl LightClient { let mut valid = 0; for (signature, public) in signatures.into_iter().zip(validator_set.1.iter()) { match signature { - Some(signature) if signature.is_valid_for(&public) => { + Some(signature) if signature.is_valid_for(public) => { valid += 1; } _ => {} From 31043a79d0861e2f27cedfdaf0deb4f3d1e22460 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Sat, 12 Jun 2021 05:54:16 +0200 Subject: [PATCH 063/109] Make concluded round an info log (#200) --- client/beefy/src/worker.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index b135bdd3089c8..e9ae66e56b958 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -24,7 +24,7 @@ use std::{ use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, StreamExt}; use hex::ToHex; -use log::{debug, error, trace, warn}; +use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; use sc_client_api::{Backend, FinalityNotification, FinalityNotifications}; @@ -332,7 +332,7 @@ where metric_set!(self, beefy_round_concluded, round.1); - debug!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); + info!(target: "beefy", "🥩 Round #{} concluded, committed: {:?}.", round.1, signed_commitment); if self .backend From 386855b2786c48dd66db7110008dec201df4067a Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Thu, 17 Jun 2021 06:16:05 +0200 Subject: [PATCH 064/109] Remove external crypto trait bounds (#207) * BeefyKeystore newtype * WIP * remove mod ecdsa * WIP * fix tests * some polishing --- client/beefy/rpc/src/lib.rs | 14 +- client/beefy/rpc/src/notification.rs | 5 +- client/beefy/src/error.rs | 17 +- client/beefy/src/gossip.rs | 35 ++- client/beefy/src/keystore.rs | 206 ++++++++++++++++++ client/beefy/src/lib.rs | 38 ++-- client/beefy/src/notification.rs | 48 ++-- client/beefy/src/round.rs | 37 ++-- client/beefy/src/worker.rs | 115 +++------- frame/beefy/src/mock.rs | 2 +- primitives/beefy/Cargo.toml | 2 + primitives/beefy/src/commitment.rs | 60 +++-- primitives/beefy/src/lib.rs | 37 ++-- primitives/beefy/src/witness.rs | 51 ++++- primitives/beefy/tests/basic_lc_operations.rs | 24 +- primitives/beefy/tests/light_client/mod.rs | 12 +- .../beefy/tests/light_client/validator_set.rs | 2 +- 17 files changed, 456 insertions(+), 249 deletions(-) create mode 100644 client/beefy/src/keystore.rs diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs index 47357df0bb696..f90d67bd85d08 100644 --- a/client/beefy/rpc/src/lib.rs +++ b/client/beefy/rpc/src/lib.rs @@ -19,7 +19,6 @@ #![warn(missing_docs)] use beefy_gadget::notification::BeefySignedCommitmentStream; -use codec::Encode; use futures::{StreamExt, TryStreamExt}; use jsonrpc_core::futures::{ future::{Executor as Executor01, Future as Future01}, @@ -63,14 +62,14 @@ pub trait BeefyApi { } /// Implements the BeefyApi RPC trait for interacting with BEEFY. -pub struct BeefyRpcHandler { - signed_commitment_stream: BeefySignedCommitmentStream, +pub struct BeefyRpcHandler { + signed_commitment_stream: BeefySignedCommitmentStream, manager: SubscriptionManager, } -impl BeefyRpcHandler { +impl BeefyRpcHandler { /// Creates a new BeefyRpcHandler instance. - pub fn new(signed_commitment_stream: BeefySignedCommitmentStream, executor: E) -> Self + pub fn new(signed_commitment_stream: BeefySignedCommitmentStream, executor: E) -> Self where E: Executor01 + Send>> + Send + Sync + 'static, { @@ -82,10 +81,9 @@ impl BeefyRpcHandler { } } -impl BeefyApi for BeefyRpcHandler +impl BeefyApi for BeefyRpcHandler where Block: BlockT, - Signature: Clone + Encode + Send + 'static, { type Metadata = sc_rpc::Metadata; @@ -97,7 +95,7 @@ where let stream = self .signed_commitment_stream .subscribe() - .map(|x| Ok::<_, ()>(notification::SignedCommitment::new::(x))) + .map(|x| Ok::<_, ()>(notification::SignedCommitment::new::(x))) .map_err(|e| warn!("Notification stream error: {:?}", e)) .compat(); diff --git a/client/beefy/rpc/src/notification.rs b/client/beefy/rpc/src/notification.rs index 8e77eb2209663..fded0f48ec7f6 100644 --- a/client/beefy/rpc/src/notification.rs +++ b/client/beefy/rpc/src/notification.rs @@ -26,12 +26,9 @@ use sp_runtime::traits::Block as BlockT; pub struct SignedCommitment(sp_core::Bytes); impl SignedCommitment { - pub fn new( - signed_commitment: beefy_gadget::notification::SignedCommitment, - ) -> Self + pub fn new(signed_commitment: beefy_gadget::notification::SignedCommitment) -> Self where Block: BlockT, - Signature: Encode, { SignedCommitment(signed_commitment.encode().into()) } diff --git a/client/beefy/src/error.rs b/client/beefy/src/error.rs index aee3b7d04580e..d65baf55f3f18 100644 --- a/client/beefy/src/error.rs +++ b/client/beefy/src/error.rs @@ -20,15 +20,10 @@ use std::fmt::Debug; -use sp_core::crypto::Public; - -/// Crypto related errors -#[derive(Debug, thiserror::Error)] -pub(crate) enum Crypto { - /// Check signature error - #[error("Message signature {0} by {1:?} is invalid.")] - InvalidSignature(String, Id), - /// Sign commitment error - #[error("Failed to sign comitment using key: {0:?}. Reason: {1}")] - CannotSign(Id, String), +#[derive(Debug, thiserror::Error, PartialEq)] +pub enum Error { + #[error("Keystore error: {0}")] + Keystore(String), + #[error("Signature error: {0}")] + Signature(String), } diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index c855c73f07e4d..e6441080fcad0 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -15,8 +15,6 @@ // along with this program. If not, see . /// The maximum number of live gossip rounds allowed, i.e. we will expire messages older than this. -use std::{fmt::Debug, marker::PhantomData}; - use codec::{Decode, Encode}; use log::debug; use parking_lot::RwLock; @@ -27,10 +25,14 @@ use sc_network_gossip::{ ValidatorContext as GossipValidatorContext, }; -use sp_core::Pair; use sp_runtime::traits::{Block, Hash, Header, NumberFor}; -use beefy_primitives::{MmrRootHash, VoteMessage}; +use beefy_primitives::{ + crypto::{Public, Signature}, + MmrRootHash, VoteMessage, +}; + +use crate::keystore::BeefyKeystore; // Limit BEEFY gossip by keeping only a bound number of voting rounds alive. const MAX_LIVE_GOSSIP_ROUNDS: usize = 5; @@ -51,24 +53,22 @@ where /// rejected/expired. /// ///All messaging is handled in a single BEEFY global topic. -pub(crate) struct BeefyGossipValidator +pub(crate) struct BeefyGossipValidator where B: Block, { topic: B::Hash, live_rounds: RwLock>>, - _pair: PhantomData

, } -impl BeefyGossipValidator +impl BeefyGossipValidator where B: Block, { - pub fn new() -> BeefyGossipValidator { + pub fn new() -> BeefyGossipValidator { BeefyGossipValidator { topic: topic::(), live_rounds: RwLock::new(Vec::new()), - _pair: PhantomData, } } @@ -91,12 +91,9 @@ where } } -impl GossipValidator for BeefyGossipValidator +impl GossipValidator for BeefyGossipValidator where B: Block, - P: Pair, - P::Public: Debug + Decode, - P::Signature: Debug + Decode, { fn validate( &self, @@ -104,8 +101,8 @@ where sender: &sc_network::PeerId, mut data: &[u8], ) -> GossipValidationResult { - if let Ok(msg) = VoteMessage::, P::Public, P::Signature>::decode(&mut data) { - if P::verify(&msg.signature, &msg.commitment.encode(), &msg.id) { + if let Ok(msg) = VoteMessage::, Public, Signature>::decode(&mut data) { + if BeefyKeystore::verify(&msg.id, &msg.signature, &msg.commitment.encode()) { return GossipValidationResult::ProcessAndKeep(self.topic); } else { // TODO: report peer @@ -119,12 +116,12 @@ where fn message_expired<'a>(&'a self) -> Box bool + 'a> { let live_rounds = self.live_rounds.read(); Box::new(move |_topic, mut data| { - let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + let message = match VoteMessage::, Public, Signature>::decode(&mut data) { Ok(vote) => vote, Err(_) => return true, }; - !BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + !BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) }) } @@ -132,12 +129,12 @@ where fn message_allowed<'a>(&'a self) -> Box bool + 'a> { let live_rounds = self.live_rounds.read(); Box::new(move |_who, _intent, _topic, mut data| { - let message = match VoteMessage::, P::Public, P::Signature>::decode(&mut data) { + let message = match VoteMessage::, Public, Signature>::decode(&mut data) { Ok(vote) => vote, Err(_) => return true, }; - BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) }) } } diff --git a/client/beefy/src/keystore.rs b/client/beefy/src/keystore.rs new file mode 100644 index 0000000000000..ddbfc33c0f692 --- /dev/null +++ b/client/beefy/src/keystore.rs @@ -0,0 +1,206 @@ +// 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::convert::TryInto; + +use sp_application_crypto::RuntimeAppPublic; +use sp_core::keccak_256; +use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; + +use beefy_primitives::{ + crypto::{Public, Signature}, + KEY_TYPE, +}; + +use crate::error; + +/// A BEEFY specific keystore implemented as a `Newtype`. This is basically a +/// wrapper around [`sp_keystore::SyncCryptoStore`] and allows to customize +/// common cryptographic functionality. +pub(crate) struct BeefyKeystore(Option); + +impl BeefyKeystore { + /// 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: &[Public]) -> Option { + let store = self.0.clone()?; + + for key in keys { + if SyncCryptoStore::has_keys(&*store, &[(key.to_raw_vec(), KEY_TYPE)]) { + return Some(key.clone()); + } + } + + None + } + + /// Sign `message` with the `public` key. + /// + /// Note that `message` usually will be pre-hashed before being singed. + /// + /// Return the message signature or an error in case of failure. + pub fn sign(&self, public: &Public, message: &[u8]) -> Result { + let store = if let Some(store) = self.0.clone() { + store + } else { + return Err(error::Error::Keystore("no Keystore".to_string())); + }; + + let msg = keccak_256(message); + let public = public.as_ref(); + + let sig = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, public, &msg) + .map_err(|e| error::Error::Keystore(e.to_string()))? + .ok_or_else(|| error::Error::Signature("ecdsa_sign_prehashed() 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) + } + + /// 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: &Public, sig: &Signature, message: &[u8]) -> bool { + let msg = keccak_256(message); + let sig = sig.as_ref(); + let public = public.as_ref(); + + sp_core::ecdsa::Pair::verify_prehashed(sig, &msg, public) + } +} + +impl From> for BeefyKeystore { + fn from(store: Option) -> BeefyKeystore { + BeefyKeystore(store) + } +} + +#[cfg(test)] +mod tests { + #![allow(clippy::unit_cmp)] + + use sp_core::{keccak_256, Pair}; + use sp_keystore::{testing::KeyStore, SyncCryptoStore, SyncCryptoStorePtr}; + + use beefy_primitives::{crypto, KEY_TYPE}; + + use super::BeefyKeystore; + use crate::error::Error; + + #[test] + fn authority_id_works() { + let store: SyncCryptoStorePtr = KeyStore::new().into(); + + let alice = crypto::Pair::from_string("//Alice", None).unwrap(); + let _ = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()).unwrap(); + + let bob = crypto::Pair::from_string("//Bob", None).unwrap(); + let charlie = crypto::Pair::from_string("//Charlie", None).unwrap(); + + let store: BeefyKeystore = Some(store).into(); + + let mut keys = vec![bob.public(), charlie.public()]; + + let id = store.authority_id(keys.as_slice()); + assert!(id.is_none()); + + keys.push(alice.public()); + + let id = store.authority_id(keys.as_slice()).unwrap(); + assert_eq!(id, alice.public()); + } + + #[test] + fn sign_works() { + let store: SyncCryptoStorePtr = KeyStore::new().into(); + + let suri = "//Alice"; + let pair = sp_core::ecdsa::Pair::from_string(suri, None).unwrap(); + + let res = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, suri, pair.public().as_ref()).unwrap(); + assert_eq!((), res); + + let beefy_store: BeefyKeystore = Some(store.clone()).into(); + + let msg = b"are you involved or commited?"; + let sig1 = beefy_store.sign(&pair.public().into(), msg).unwrap(); + + let msg = keccak_256(b"are you involved or commited?"); + let sig2 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &pair.public(), &msg) + .unwrap() + .unwrap(); + + assert_eq!(sig1, sig2.into()); + } + + #[test] + fn sign_error() { + let store: SyncCryptoStorePtr = KeyStore::new().into(); + + let bob = crypto::Pair::from_string("//Bob", None).unwrap(); + let res = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Bob", bob.public().as_ref()).unwrap(); + assert_eq!((), res); + + let alice = crypto::Pair::from_string("//Alice", None).unwrap(); + + let store: BeefyKeystore = Some(store).into(); + + let msg = b"are you involved or commited?"; + let sig = store.sign(&alice.public(), msg).err().unwrap(); + let err = Error::Signature("ecdsa_sign_prehashed() failed".to_string()); + assert_eq!(sig, err); + } + + #[test] + fn sign_no_keystore() { + let store: BeefyKeystore = None.into(); + + let alice = crypto::Pair::from_string("//Alice", None).unwrap(); + let msg = b"are you involved or commited"; + + let sig = store.sign(&alice.public(), msg).err().unwrap(); + let err = Error::Keystore("no Keystore".to_string()); + assert_eq!(sig, err); + } + + #[test] + fn verify_works() { + let store: SyncCryptoStorePtr = KeyStore::new().into(); + + let suri = "//Alice"; + let pair = crypto::Pair::from_string(suri, None).unwrap(); + + let res = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, suri, pair.public().as_ref()).unwrap(); + assert_eq!((), res); + + let store: BeefyKeystore = Some(store).into(); + + // `msg` and `sig` match + let msg = b"are you involved or commited?"; + let sig = store.sign(&pair.public(), msg).unwrap(); + assert!(BeefyKeystore::verify(&pair.public(), &sig, msg)); + + // `msg and `sig` don't match + let msg = b"you are just involved"; + assert!(!BeefyKeystore::verify(&pair.public(), &sig, msg)); + } +} diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index ac6d5aea76df9..cf7a4667b8652 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -14,9 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{convert::TryFrom, fmt::Debug, sync::Arc}; +use std::sync::Arc; -use codec::Codec; use log::debug; use prometheus::Registry; @@ -24,7 +23,6 @@ use sc_client_api::{Backend, BlockchainEvents, Finalizer}; use sc_network_gossip::{GossipEngine, Network as GossipNetwork}; use sp_api::ProvideRuntimeApi; -use sp_application_crypto::AppPublic; use sp_blockchain::HeaderBackend; use sp_keystore::SyncCryptoStorePtr; use sp_runtime::traits::Block; @@ -33,6 +31,7 @@ use beefy_primitives::BeefyApi; mod error; mod gossip; +mod keystore; mod metrics; mod round; mod worker; @@ -53,36 +52,32 @@ pub fn beefy_peers_set_config() -> sc_network::config::NonDefaultSetConfig { /// 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: +pub trait Client: BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync where B: Block, BE: Backend, - P: sp_core::Pair, - P::Public: AppPublic + Codec, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, { // empty } -impl Client for T +impl Client for T where B: Block, BE: Backend, - P: sp_core::Pair, - P::Public: AppPublic + Codec, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, T: BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync, { // empty } /// BEEFY gadget initialization parameters. -pub struct BeefyParams +pub struct BeefyParams where B: Block, - P: sp_core::Pair, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, + BE: Backend, + C: Client, + C::Api: BeefyApi, + N: GossipNetwork + Clone + Send + 'static, { /// BEEFY client pub client: Arc, @@ -93,7 +88,7 @@ where /// Gossip network pub network: N, /// BEEFY signed commitment sender - pub signed_commitment_sender: notification::BeefySignedCommitmentSender, + pub signed_commitment_sender: notification::BeefySignedCommitmentSender, /// Minimal delta between blocks, BEEFY should vote for pub min_block_delta: u32, /// Prometheus metric registry @@ -103,15 +98,12 @@ where /// Start the BEEFY gadget. /// /// This is a thin shim around running and awaiting a BEEFY worker. -pub async fn start_beefy_gadget(beefy_params: BeefyParams) +pub async fn start_beefy_gadget(beefy_params: BeefyParams) where B: Block, - P: sp_core::Pair, - P::Public: AppPublic + Codec, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, BE: Backend, - C: Client, - C::Api: BeefyApi, + C: Client, + C::Api: BeefyApi, N: GossipNetwork + Clone + Send + 'static, { let BeefyParams { @@ -144,7 +136,7 @@ where let worker_params = worker::WorkerParams { client, backend, - key_store, + key_store: key_store.into(), signed_commitment_sender, gossip_engine, gossip_validator, @@ -152,7 +144,7 @@ where metrics, }; - let worker = worker::BeefyWorker::<_, _, _, _>::new(worker_params); + let worker = worker::BeefyWorker::<_, _, _>::new(worker_params); worker.run().await } diff --git a/client/beefy/src/notification.rs b/client/beefy/src/notification.rs index be034442626fa..f86e09efa86e9 100644 --- a/client/beefy/src/notification.rs +++ b/client/beefy/src/notification.rs @@ -14,47 +14,49 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use parking_lot::Mutex; use std::sync::Arc; -use sp_runtime::traits::{Block as BlockT, NumberFor}; +use sp_runtime::traits::{Block, NumberFor}; use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; +use parking_lot::Mutex; + /// Stream of signed commitments returned when subscribing. -pub type SignedCommitment = - beefy_primitives::SignedCommitment, beefy_primitives::MmrRootHash, Signature>; +pub type SignedCommitment = beefy_primitives::SignedCommitment, beefy_primitives::MmrRootHash>; /// Stream of signed commitments returned when subscribing. -type SignedCommitmentStream = TracingUnboundedReceiver>; +type SignedCommitmentStream = TracingUnboundedReceiver>; /// Sending endpoint for notifying about signed commitments. -type SignedCommitmentSender = TracingUnboundedSender>; +type SignedCommitmentSender = TracingUnboundedSender>; /// Collection of channel sending endpoints shared with the receiver side so they can register /// themselves. -type SharedSignedCommitmentSenders = Arc>>>; +type SharedSignedCommitmentSenders = Arc>>>; /// The sending half of the signed commitment channel(s). /// /// Used to send notifications about signed commitments generated at the end of a BEEFY round. #[derive(Clone)] -pub struct BeefySignedCommitmentSender { - subscribers: SharedSignedCommitmentSenders, +pub struct BeefySignedCommitmentSender +where + B: Block, +{ + subscribers: SharedSignedCommitmentSenders, } -impl BeefySignedCommitmentSender +impl BeefySignedCommitmentSender where - Block: BlockT, - Signature: Clone, + B: Block, { /// The `subscribers` should be shared with a corresponding `SignedCommitmentSender`. - fn new(subscribers: SharedSignedCommitmentSenders) -> Self { + fn new(subscribers: SharedSignedCommitmentSenders) -> Self { Self { subscribers } } /// Send out a notification to all subscribers that a new signed commitment is available for a /// block. - pub fn notify(&self, signed_commitment: SignedCommitment) { + pub fn notify(&self, signed_commitment: SignedCommitment) { let mut subscribers = self.subscribers.lock(); // do an initial prune on closed subscriptions @@ -72,17 +74,19 @@ where /// The `BeefySignedCommitmentStream` entity stores the `SharedSignedCommitmentSenders` so it can be /// used to add more subscriptions. #[derive(Clone)] -pub struct BeefySignedCommitmentStream { - subscribers: SharedSignedCommitmentSenders, +pub struct BeefySignedCommitmentStream +where + B: Block, +{ + subscribers: SharedSignedCommitmentSenders, } -impl BeefySignedCommitmentStream +impl BeefySignedCommitmentStream where - Block: BlockT, - Signature: Clone, + B: Block, { /// Creates a new pair of receiver and sender of signed commitment notifications. - pub fn channel() -> (BeefySignedCommitmentSender, Self) { + pub fn channel() -> (BeefySignedCommitmentSender, Self) { let subscribers = Arc::new(Mutex::new(vec![])); let receiver = BeefySignedCommitmentStream::new(subscribers.clone()); let sender = BeefySignedCommitmentSender::new(subscribers); @@ -92,13 +96,13 @@ where /// Create a new receiver of signed commitment notifications. /// /// The `subscribers` should be shared with a corresponding `BeefySignedCommitmentSender`. - fn new(subscribers: SharedSignedCommitmentSenders) -> Self { + fn new(subscribers: SharedSignedCommitmentSenders) -> Self { Self { subscribers } } /// Subscribe to a channel through which signed commitments are sent at the end of each BEEFY /// voting round. - pub fn subscribe(&self) -> SignedCommitmentStream { + pub fn subscribe(&self) -> SignedCommitmentStream { let (sender, receiver) = tracing_unbounded("mpsc_signed_commitments_notification_stream"); self.subscribers.lock().push(sender); receiver diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index af905fd889eb9..eee15b8ab6ade 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -16,24 +16,23 @@ use std::collections::BTreeMap; -use beefy_primitives::{ValidatorSet, ValidatorSetId}; +use beefy_primitives::{ + crypto::{Public, Signature}, + ValidatorSet, ValidatorSetId, +}; -struct RoundTracker { - votes: Vec<(Id, Signature)>, +struct RoundTracker { + votes: Vec<(Public, Signature)>, } -impl Default for RoundTracker { +impl Default for RoundTracker { fn default() -> Self { RoundTracker { votes: Vec::new() } } } -impl RoundTracker -where - Id: PartialEq, - Signature: PartialEq, -{ - fn add_vote(&mut self, vote: (Id, Signature)) -> bool { +impl RoundTracker { + fn add_vote(&mut self, vote: (Public, Signature)) -> bool { // this needs to handle equivocations in the future if self.votes.contains(&vote) { return false; @@ -53,17 +52,17 @@ fn threshold(authorities: usize) -> usize { authorities - faulty } -pub(crate) struct Rounds { - rounds: BTreeMap<(Hash, Number), RoundTracker>, - validator_set: ValidatorSet, +pub(crate) struct Rounds { + rounds: BTreeMap<(Hash, Number), RoundTracker>, + validator_set: ValidatorSet, } -impl Rounds +impl Rounds where Hash: Ord, Number: Ord, { - pub(crate) fn new(validator_set: ValidatorSet) -> Self { + pub(crate) fn new(validator_set: ValidatorSet) -> Self { Rounds { rounds: BTreeMap::new(), validator_set, @@ -71,22 +70,20 @@ where } } -impl Rounds +impl Rounds where Hash: Ord, Number: Ord, - Id: PartialEq + Clone, - Signature: Clone + PartialEq, { pub(crate) fn validator_set_id(&self) -> ValidatorSetId { self.validator_set.id } - pub(crate) fn validators(&self) -> Vec { + pub(crate) fn validators(&self) -> Vec { self.validator_set.validators.clone() } - pub(crate) fn add_vote(&mut self, round: (Hash, Number), vote: (Id, Signature)) -> bool { + pub(crate) fn add_vote(&mut self, round: (Hash, Number), vote: (Public, Signature)) -> bool { self.rounds.entry(round).or_default().add_vote(vote) } diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index e9ae66e56b958..2f28b70e3ee8a 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -14,16 +14,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{ - convert::{TryFrom, TryInto}, - fmt::Debug, - marker::PhantomData, - sync::Arc, -}; +use std::{fmt::Debug, marker::PhantomData, sync::Arc}; use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, StreamExt}; -use hex::ToHex; use log::{debug, error, info, trace, warn}; use parking_lot::Mutex; @@ -31,10 +25,7 @@ use sc_client_api::{Backend, FinalityNotification, FinalityNotifications}; use sc_network_gossip::GossipEngine; use sp_api::BlockId; -use sp_application_crypto::{AppPublic, Public}; use sp_arithmetic::traits::AtLeast32Bit; -use sp_core::Pair; -use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use sp_runtime::{ generic::OpaqueDigestItemId, traits::{Block, Header, NumberFor}, @@ -42,54 +33,50 @@ use sp_runtime::{ }; use beefy_primitives::{ + crypto::{Public, Signature}, BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, VersionedCommitment, VoteMessage, - BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID, KEY_TYPE, + BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID, }; use crate::{ - error::{self}, gossip::{topic, BeefyGossipValidator}, + keystore::BeefyKeystore, metric_inc, metric_set, metrics::Metrics, notification, round, Client, }; -pub(crate) struct WorkerParams +pub(crate) struct WorkerParams where B: Block, - P: sp_core::Pair, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, { pub client: Arc, pub backend: Arc, - pub key_store: Option, - pub signed_commitment_sender: notification::BeefySignedCommitmentSender, + pub key_store: BeefyKeystore, + pub signed_commitment_sender: notification::BeefySignedCommitmentSender, pub gossip_engine: GossipEngine, - pub gossip_validator: Arc>, + pub gossip_validator: Arc>, pub min_block_delta: u32, pub metrics: Option, } /// A BEEFY worker plays the BEEFY protocol -pub(crate) struct BeefyWorker +pub(crate) struct BeefyWorker where B: Block, BE: Backend, - P: Pair, - P::Public: AppPublic + Codec, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, - C: Client, + C: Client, { client: Arc, backend: Arc, - key_store: Option, - signed_commitment_sender: notification::BeefySignedCommitmentSender, + key_store: BeefyKeystore, + signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: Arc>>, - gossip_validator: Arc>, + gossip_validator: Arc>, /// Min delta in block numbers between two blocks, BEEFY should vote on min_block_delta: u32, metrics: Option, - rounds: round::Rounds, P::Public, P::Signature>, + rounds: round::Rounds>, finality_notifications: FinalityNotifications, /// Best block we received a GRANDPA notification for best_grandpa_block: NumberFor, @@ -99,18 +86,14 @@ where last_signed_id: u64, // keep rustc happy _backend: PhantomData, - _pair: PhantomData

, } -impl BeefyWorker +impl BeefyWorker where - B: Block, + B: Block + Codec, BE: Backend, - P: Pair, - P::Public: AppPublic, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, - C: Client, - C::Api: BeefyApi, + C: Client, + C::Api: BeefyApi, { /// Return a new BEEFY worker instance. /// @@ -118,7 +101,7 @@ where /// BEEFY pallet has been deployed on-chain. /// /// The BEEFY pallet is needed in order to keep track of the BEEFY authority set. - pub(crate) fn new(worker_params: WorkerParams) -> Self { + pub(crate) fn new(worker_params: WorkerParams) -> Self { let WorkerParams { client, backend, @@ -145,20 +128,16 @@ where best_beefy_block: None, last_signed_id: 0, _backend: PhantomData, - _pair: PhantomData, } } } -impl BeefyWorker +impl BeefyWorker where B: Block, BE: Backend, - P: Pair, - P::Public: AppPublic, - P::Signature: Clone + Codec + Debug + PartialEq + TryFrom>, - C: Client, - C::Api: BeefyApi, + C: Client, + C::Api: BeefyApi, { /// Return `true`, if we should vote on block `number` fn should_vote_on(&self, number: NumberFor) -> bool { @@ -178,24 +157,6 @@ where number == target } - fn sign_commitment(&self, id: &P::Public, commitment: &[u8]) -> Result> { - let key_store = self - .key_store - .clone() - .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "Missing KeyStore".into()))?; - - let sig = SyncCryptoStore::sign_with(&*key_store, KEY_TYPE, &id.to_public_crypto_pair(), commitment) - .map_err(|e| error::Crypto::CannotSign((*id).clone(), e.to_string()))? - .ok_or_else(|| error::Crypto::CannotSign((*id).clone(), "No key in KeyStore found".into()))?; - - let sig = sig - .clone() - .try_into() - .map_err(|_| error::Crypto::InvalidSignature(sig.encode_hex(), (*id).clone()))?; - - Ok(sig) - } - /// 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 @@ -203,8 +164,8 @@ where /// BEEFY on-chain state. /// /// Such a failure is usually an indication that the BEEFT pallet has not been deployed (yet). - fn validator_set(&self, header: &B::Header) -> Option> { - if let Some(new) = find_authorities_change::(header) { + fn validator_set(&self, header: &B::Header) -> Option> { + if let Some(new) = find_authorities_change::(header) { Some(new) } else { let at = BlockId::hash(header.hash()); @@ -212,19 +173,6 @@ where } } - /// Return the local authority id. - /// - /// `None` is returned, if we are not permitted to vote - fn local_id(&self) -> Option { - let key_store = self.key_store.clone()?; - - self.rounds - .validators() - .iter() - .find(|id| SyncCryptoStore::has_keys(&*key_store, &[(id.to_raw_vec(), KEY_TYPE)])) - .cloned() - } - fn handle_finality_notification(&mut self, notification: FinalityNotification) { trace!(target: "beefy", "🥩 Finality notification: {:?}", notification); @@ -261,14 +209,14 @@ where } if self.should_vote_on(*notification.header.number()) { - let local_id = if let Some(id) = self.local_id() { + let authority_id = if let Some(id) = self.key_store.authority_id(self.rounds.validators().as_slice()) { id } else { trace!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); return; }; - let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { + let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { hash } else { warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); @@ -281,7 +229,7 @@ where validator_set_id: self.rounds.validator_set_id(), }; - let signature = match self.sign_commitment(&local_id, commitment.encode().as_ref()) { + let signature = match self.key_store.sign(&authority_id, commitment.encode().as_ref()) { Ok(sig) => sig, Err(err) => { warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err); @@ -291,7 +239,7 @@ where let message = VoteMessage { commitment, - id: local_id, + id: authority_id, signature, }; @@ -312,7 +260,7 @@ where } } - fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (P::Public, P::Signature)) { + fn handle_vote(&mut self, round: (MmrRootHash, NumberFor), vote: (Public, Signature)) { self.gossip_validator.note_round(round.1); let vote_added = self.rounds.add_vote(round, vote); @@ -363,10 +311,7 @@ where |notification| async move { trace!(target: "beefy", "🥩 Got vote message: {:?}", notification); - VoteMessage::, P::Public, P::Signature>::decode( - &mut ¬ification.message[..], - ) - .ok() + VoteMessage::, Public, Signature>::decode(&mut ¬ification.message[..]).ok() }, )); diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index 689a8db487565..b962a0b422b2d 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -31,7 +31,7 @@ use sp_runtime::{ use crate as pallet_beefy; -pub use beefy_primitives::{ecdsa::AuthorityId as BeefyId, ConsensusLog, BEEFY_ENGINE_ID}; +pub use beefy_primitives::{crypto::AuthorityId as BeefyId, ConsensusLog, BEEFY_ENGINE_ID}; impl_opaque_keys! { pub struct MockSessionKeys { diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index 2cc4f33cc4ca0..e76d34a5419b5 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -17,6 +17,8 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f [dev-dependencies] hex-literal = "0.3" +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } + [features] default = ["std"] std = [ diff --git a/primitives/beefy/src/commitment.rs b/primitives/beefy/src/commitment.rs index 0cca6e6d77bbb..c9b29e3dcc606 100644 --- a/primitives/beefy/src/commitment.rs +++ b/primitives/beefy/src/commitment.rs @@ -16,7 +16,7 @@ use sp_std::{cmp, prelude::*}; -use crate::ValidatorSetId; +use crate::{crypto::Signature, ValidatorSetId}; /// A commitment signed by GRANDPA validators as part of BEEFY protocol. /// @@ -78,17 +78,17 @@ where /// A commitment with matching GRANDPA validators' signatures. #[derive(Clone, Debug, PartialEq, Eq, codec::Encode, codec::Decode)] -pub struct SignedCommitment { +pub struct SignedCommitment { /// The commitment signatures are collected for. pub commitment: Commitment, /// GRANDPA validators' signatures for the commitment. /// /// The length of this `Vec` must match number of validators in the current set (see /// [Commitment::validator_set_id]). - pub signatures: Vec>, + pub signatures: Vec>, } -impl SignedCommitment { +impl SignedCommitment { /// Return the number of collected signatures. pub fn no_of_signatures(&self) -> usize { self.signatures.iter().filter(|x| x.is_some()).count() @@ -99,20 +99,46 @@ impl SignedCommitment { +pub enum VersionedCommitment { #[codec(index = 1)] /// Current active version - V1(SignedCommitment), + V1(SignedCommitment), } #[cfg(test)] mod tests { + + use sp_core::{keccak_256, Pair}; + use sp_keystore::{testing::KeyStore, SyncCryptoStore, SyncCryptoStorePtr}; + use super::*; use codec::Decode; + use crate::{crypto, KEY_TYPE}; + type TestCommitment = Commitment; - type TestSignedCommitment = SignedCommitment>; - type TestVersionedCommitment = VersionedCommitment>; + type TestSignedCommitment = SignedCommitment; + type TestVersionedCommitment = VersionedCommitment; + + // The mock signatures are equivalent to the ones produced by the BEEFY keystore + fn mock_signatures() -> (crypto::Signature, crypto::Signature) { + let store: SyncCryptoStorePtr = KeyStore::new().into(); + + let alice = sp_core::ecdsa::Pair::from_string("//Alice", None).unwrap(); + let _ = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()).unwrap(); + + let msg = keccak_256(b"This is the first message"); + let sig1 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &alice.public(), &msg) + .unwrap() + .unwrap(); + + let msg = keccak_256(b"This is the second message"); + let sig2 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &alice.public(), &msg) + .unwrap() + .unwrap(); + + (sig1.into(), sig2.into()) + } #[test] fn commitment_encode_decode() { @@ -143,9 +169,12 @@ mod tests { block_number: 5, validator_set_id: 0, }; + + let sigs = mock_signatures(); + let signed = SignedCommitment { commitment, - signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + signatures: vec![None, None, Some(sigs.0), Some(sigs.1)], }; // when @@ -156,9 +185,7 @@ mod tests { assert_eq!(decoded, Ok(signed)); assert_eq!( encoded, - hex_literal::hex!( - "3048656c6c6f20576f726c6421050000000000000000000000000000000000000000000000100000011001020304011005060708" - ) + hex_literal::hex!("3048656c6c6f20576f726c642105000000000000000000000000000000000000000000000010000001558455ad81279df0795cc985580e4fb75d72d948d1107b2ac80a09abed4da8480c746cc321f2319a5e99a830e314d10dd3cd68ce3dc0c33c86e99bcb7816f9ba01012d6e1f8105c337a86cdd9aaacdc496577f3db8c55ef9e6fd48f2c5c05a2274707491635d8ba3df64f324575b7b2a34487bca2324b6a0046395a71681be3d0c2a00") ); } @@ -170,9 +197,12 @@ mod tests { block_number: 5, validator_set_id: 0, }; + + let sigs = mock_signatures(); + let mut signed = SignedCommitment { commitment, - signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + signatures: vec![None, None, Some(sigs.0), Some(sigs.1)], }; assert_eq!(signed.no_of_signatures(), 2); @@ -215,9 +245,11 @@ mod tests { validator_set_id: 0, }; + let sigs = mock_signatures(); + let signed = SignedCommitment { commitment, - signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + signatures: vec![None, None, Some(sigs.0), Some(sigs.1)], }; let versioned = TestVersionedCommitment::V1(signed.clone()); diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 287574947c116..0272775dbd83a 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020-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 @@ -44,23 +44,27 @@ use sp_std::prelude::*; /// Key type for BEEFY module. pub const KEY_TYPE: sp_application_crypto::KeyTypeId = sp_application_crypto::KeyTypeId(*b"beef"); -/// BEEFY application-specific crypto types using ECDSA. -pub mod ecdsa { - mod app_ecdsa { - use sp_application_crypto::{app_crypto, ecdsa}; - app_crypto!(ecdsa, crate::KEY_TYPE); - } - - sp_application_crypto::with_pair! { - /// A BEEFY authority keypair using ECDSA as its crypto. - pub type AuthorityPair = app_ecdsa::Pair; - } +/// BEEFY cryptographic types +/// +/// This module basically introduces three crypto types: +/// - `crypto::Pair` +/// - `crypto::Public` +/// - `crypto::Signature` +/// +/// Your code should use the above types as concrete types for all crypto related +/// functionality. +/// +/// The current underlying crypto scheme used is ECDSA. This can be changed, +/// without affecting code restricted against the above listed crypto types. +pub mod crypto { + use sp_application_crypto::{app_crypto, ecdsa}; + app_crypto!(ecdsa, crate::KEY_TYPE); /// Identity of a BEEFY authority using ECDSA as its crypto. - pub type AuthorityId = app_ecdsa::Public; + pub type AuthorityId = Public; /// Signature for a BEEFY authority using ECDSA as its crypto. - pub type AuthoritySignature = app_ecdsa::Signature; + pub type AuthoritySignature = Signature; } /// The `ConsensusEngineId` of BEEFY. @@ -127,8 +131,9 @@ pub struct VoteMessage { sp_api::decl_runtime_apis! { /// API necessary for BEEFY voters. - pub trait BeefyApi { + pub trait BeefyApi + { /// Return the current active BEEFY validator set - fn validator_set() -> ValidatorSet; + fn validator_set() -> ValidatorSet; } } diff --git a/primitives/beefy/src/witness.rs b/primitives/beefy/src/witness.rs index 1928a38dd08fe..0ddbfb0e4a35d 100644 --- a/primitives/beefy/src/witness.rs +++ b/primitives/beefy/src/witness.rs @@ -24,7 +24,10 @@ use sp_std::prelude::*; -use crate::commitment::{Commitment, SignedCommitment}; +use crate::{ + commitment::{Commitment, SignedCommitment}, + crypto::Signature, +}; /// A light form of [SignedCommitment]. /// @@ -56,12 +59,12 @@ impl SignedCommitmentWitness( - signed: SignedCommitment, + pub fn from_signed( + signed: SignedCommitment, merkelize: TMerkelize, - ) -> (Self, Vec>) + ) -> (Self, Vec>) where - TMerkelize: FnOnce(&[Option]) -> TMerkleRoot, + TMerkelize: FnOnce(&[Option]) -> TMerkleRoot, { let SignedCommitment { commitment, signatures } = signed; let signed_by = signatures.iter().map(|s| s.is_some()).collect(); @@ -80,12 +83,38 @@ impl SignedCommitmentWitness; - type TestSignedCommitment = SignedCommitment>; - type TestSignedCommitmentWitness = SignedCommitmentWitness>>>; + type TestSignedCommitment = SignedCommitment; + type TestSignedCommitmentWitness = SignedCommitmentWitness>>; + + // The mock signatures are equivalent to the ones produced by the BEEFY keystore + fn mock_signatures() -> (crypto::Signature, crypto::Signature) { + let store: SyncCryptoStorePtr = KeyStore::new().into(); + + let alice = sp_core::ecdsa::Pair::from_string("//Alice", None).unwrap(); + let _ = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()).unwrap(); + + let msg = keccak_256(b"This is the first message"); + let sig1 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &alice.public(), &msg) + .unwrap() + .unwrap(); + + let msg = keccak_256(b"This is the second message"); + let sig2 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &alice.public(), &msg) + .unwrap() + .unwrap(); + + (sig1.into(), sig2.into()) + } fn signed_commitment() -> TestSignedCommitment { let commitment: TestCommitment = Commitment { @@ -94,9 +123,11 @@ mod tests { validator_set_id: 0, }; + let sigs = mock_signatures(); + SignedCommitment { commitment, - signatures: vec![None, None, Some(vec![1, 2, 3, 4]), Some(vec![5, 6, 7, 8])], + signatures: vec![None, None, Some(sigs.0), Some(sigs.1)], } } @@ -126,9 +157,7 @@ mod tests { assert_eq!(decoded, Ok(witness)); assert_eq!( encoded, - hex_literal::hex!( - "3048656c6c6f20576f726c64210500000000000000000000000000000000000000000000001000000101100000011001020304011005060708" - ) + hex_literal::hex!("3048656c6c6f20576f726c6421050000000000000000000000000000000000000000000000100000010110000001558455ad81279df0795cc985580e4fb75d72d948d1107b2ac80a09abed4da8480c746cc321f2319a5e99a830e314d10dd3cd68ce3dc0c33c86e99bcb7816f9ba01012d6e1f8105c337a86cdd9aaacdc496577f3db8c55ef9e6fd48f2c5c05a2274707491635d8ba3df64f324575b7b2a34487bca2324b6a0046395a71681be3d0c2a00") ); } } diff --git a/primitives/beefy/tests/basic_lc_operations.rs b/primitives/beefy/tests/basic_lc_operations.rs index 8445507374567..26c30ed831d80 100644 --- a/primitives/beefy/tests/basic_lc_operations.rs +++ b/primitives/beefy/tests/basic_lc_operations.rs @@ -14,9 +14,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +/* mod light_client; -use self::light_client::{validator_set, Commitment, Error, Payload, SignedCommitment}; +use std::convert::TryInto; + +use self::light_client::{Commitment, Error, Payload, SignedCommitment}; + +use beefy_primitives::crypto::{Public, Signature}; #[test] fn light_client_should_make_progress() { @@ -30,7 +35,7 @@ fn light_client_should_make_progress() { block_number: 2, validator_set_id: 0, }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }); // then @@ -48,7 +53,7 @@ fn should_verify_mmr_proof() { block_number: 2, validator_set_id: 0, }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }) .unwrap(); @@ -69,7 +74,7 @@ fn should_reject_invalid_mmr_proof() { block_number: 2, validator_set_id: 0, }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }) .unwrap(); @@ -92,7 +97,7 @@ fn light_client_should_reject_invalid_validator_set() { block_number: 1, validator_set_id: 1, }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }); // then @@ -112,7 +117,7 @@ fn light_client_should_reject_set_transitions_without_validator_proof() { block_number: 1, validator_set_id: 1, }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }); // then @@ -131,7 +136,7 @@ fn light_client_should_reject_older_block() { block_number: 10, validator_set_id: 0, }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }) .unwrap(); @@ -142,7 +147,7 @@ fn light_client_should_reject_older_block() { block_number: 5, validator_set_id: 0, }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }); // then @@ -215,7 +220,7 @@ fn light_client_should_reject_if_not_enough_valid_signatures() { block_number: 5, validator_set_id: 0, }, - signatures: vec![Some(validator_set::Signature::ValidFor(1.into()))], + signatures: vec![Some(vec![0].try_into().unwrap())], }); // then @@ -356,3 +361,4 @@ fn light_client_reject_set_transition_with_invalid_proof() { // then assert_eq!(result, Err(Error::InvalidValidatorSetProof)); } +*/ diff --git a/primitives/beefy/tests/light_client/mod.rs b/primitives/beefy/tests/light_client/mod.rs index b5c0d827ea20c..a59947b907a3e 100644 --- a/primitives/beefy/tests/light_client/mod.rs +++ b/primitives/beefy/tests/light_client/mod.rs @@ -14,10 +14,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +/* use beefy_primitives::{self as bp, ValidatorSetId}; +use beefy_primitives::crypto::{Public, Signature}; pub mod merkle_tree; -pub mod validator_set; /// A marker struct for validator set merkle tree. #[derive(Debug)] @@ -44,7 +45,7 @@ impl Payload { pub type BlockNumber = u64; pub type Commitment = bp::Commitment; -pub type SignedCommitment = bp::SignedCommitment; +pub type SignedCommitment = bp::SignedCommitment; #[derive(Debug, PartialEq, Eq)] pub enum Error { @@ -87,7 +88,7 @@ pub enum Error { InvalidMmrProof, } -type ValidatorSet = (ValidatorSetId, Vec); +type ValidatorSet = (ValidatorSetId, Vec); pub struct LightClient { validator_set: ValidatorSet, @@ -117,7 +118,7 @@ impl LightClient { pub fn import_set_transition( &mut self, signed: SignedCommitment, - validator_set_proof: merkle_tree::Proof>, + validator_set_proof: merkle_tree::Proof>, ) -> Result<(), Error> { // Make sure it is a set transition block (see [import]). if signed.commitment.validator_set_id != self.validator_set.0 + 1 { @@ -242,8 +243,9 @@ impl LightClient { pub fn new() -> LightClient { LightClient { - validator_set: (0, vec![validator_set::Public(0)]), + validator_set: (0, vec![Public(0)]), next_validator_set: None, last_commitment: None, } } +*/ \ No newline at end of file diff --git a/primitives/beefy/tests/light_client/validator_set.rs b/primitives/beefy/tests/light_client/validator_set.rs index 67fe03bf0d8e1..2f30d97b19a74 100644 --- a/primitives/beefy/tests/light_client/validator_set.rs +++ b/primitives/beefy/tests/light_client/validator_set.rs @@ -29,7 +29,7 @@ pub enum Signature { Invalid, } -impl Signature { +impl beefy_primitives::crypto::Signature { pub fn is_valid_for(&self, public: &Public) -> bool { matches!(self, Self::ValidFor(ref p) if p == public) } From 7da9470a0cae9e447ab4cd8f4c6641d70a775910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 17 Jun 2021 18:56:50 +0200 Subject: [PATCH 065/109] Rename AuthorityId to BeefyId to avoid type conflict in UI (#211) --- frame/beefy/src/lib.rs | 30 +++++++++++++++--------------- frame/beefy/src/mock.rs | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index 50748e9b325cc..cd1bc59d8039b 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -46,7 +46,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// Authority identifier type - type AuthorityId: Member + Parameter + RuntimeAppPublic + Default + MaybeSerializeDeserialize; + type BeefyId: Member + Parameter + RuntimeAppPublic + Default + MaybeSerializeDeserialize; } #[pallet::pallet] @@ -61,7 +61,7 @@ pub mod pallet { /// The current authorities set #[pallet::storage] #[pallet::getter(fn authorities)] - pub(super) type Authorities = StorageValue<_, Vec, ValueQuery>; + pub(super) type Authorities = StorageValue<_, Vec, ValueQuery>; /// The current validator set id #[pallet::storage] @@ -71,11 +71,11 @@ pub mod pallet { /// Authorities set scheduled to be used with the next session #[pallet::storage] #[pallet::getter(fn next_authorities)] - pub(super) type NextAuthorities = StorageValue<_, Vec, ValueQuery>; + pub(super) type NextAuthorities = StorageValue<_, Vec, ValueQuery>; #[pallet::genesis_config] pub struct GenesisConfig { - pub authorities: Vec, + pub authorities: Vec, } #[cfg(feature = "std")] @@ -97,14 +97,14 @@ pub mod pallet { impl Pallet { /// Return the current active BEEFY validator set. - pub fn validator_set() -> ValidatorSet { - ValidatorSet:: { + pub fn validator_set() -> ValidatorSet { + ValidatorSet:: { validators: Self::authorities(), id: Self::validator_set_id(), } } - fn change_authorities(new: Vec, queued: Vec) { + fn change_authorities(new: Vec, queued: Vec) { // As in GRANDPA, we trigger a validator set change only if the the validator // set has actually changed. if new != Self::authorities() { @@ -127,7 +127,7 @@ impl Pallet { >::put(&queued); } - fn initialize_authorities(authorities: &[T::AuthorityId]) { + fn initialize_authorities(authorities: &[T::BeefyId]) { if authorities.is_empty() { return; } @@ -145,15 +145,15 @@ impl Pallet { } impl sp_runtime::BoundToRuntimeAppPublic for Pallet { - type Public = T::AuthorityId; + type Public = T::BeefyId; } impl OneSessionHandler for Pallet { - type Key = T::AuthorityId; + type Key = T::BeefyId; fn on_genesis_session<'a, I: 'a>(validators: I) where - I: Iterator, + I: Iterator, { let authorities = validators.map(|(_, k)| k).collect::>(); Self::initialize_authorities(&authorities); @@ -161,7 +161,7 @@ impl OneSessionHandler for Pallet { fn on_new_session<'a, I: 'a>(changed: bool, validators: I, queued_validators: I) where - I: Iterator, + I: Iterator, { if changed { let next_authorities = validators.map(|(_, k)| k).collect::>(); @@ -174,15 +174,15 @@ impl OneSessionHandler for Pallet { fn on_disabled(i: usize) { let log: DigestItem = DigestItem::Consensus( BEEFY_ENGINE_ID, - ConsensusLog::::OnDisabled(i as AuthorityIndex).encode(), + ConsensusLog::::OnDisabled(i as AuthorityIndex).encode(), ); >::deposit_log(log); } } -impl IsMember for Pallet { - fn is_member(authority_id: &T::AuthorityId) -> bool { +impl IsMember for Pallet { + fn is_member(authority_id: &T::BeefyId) -> bool { Self::authorities().iter().any(|id| id == authority_id) } } diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index b962a0b422b2d..9b82e6b805161 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -86,7 +86,7 @@ impl frame_system::Config for Test { } impl pallet_beefy::Config for Test { - type AuthorityId = BeefyId; + type BeefyId = BeefyId; } parameter_types! { From 600f28610d99ef871c49305e9a5984b05139af16 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 18 Jun 2021 06:56:27 +0200 Subject: [PATCH 066/109] Add trace points; Reduce MAX_LIVE_GOSSIP_ROUNDS (#210) * Add trace points; Reduce MAX_LIVE_GOSSIP_ROUNDS * log local authority id --- client/beefy/src/gossip.rs | 12 +++++++++--- client/beefy/src/round.rs | 35 +++++++++++++++++++++++------------ client/beefy/src/worker.rs | 9 +++++++-- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index e6441080fcad0..003a52a070d1f 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -16,7 +16,7 @@ /// The maximum number of live gossip rounds allowed, i.e. we will expire messages older than this. use codec::{Decode, Encode}; -use log::debug; +use log::{debug, trace}; use parking_lot::RwLock; use sc_network::PeerId; @@ -35,7 +35,7 @@ use beefy_primitives::{ use crate::keystore::BeefyKeystore; // Limit BEEFY gossip by keeping only a bound number of voting rounds alive. -const MAX_LIVE_GOSSIP_ROUNDS: usize = 5; +const MAX_LIVE_GOSSIP_ROUNDS: usize = 3; /// Gossip engine messages topic pub(crate) fn topic() -> B::Hash @@ -73,6 +73,8 @@ where } pub(crate) fn note_round(&self, round: NumberFor) { + trace!(target: "beefy", "🥩 About to note round #{}", round); + let mut live_rounds = self.live_rounds.write(); // NOTE: ideally we'd use a VecDeque here, but currently binary search is only available on @@ -87,7 +89,11 @@ where } fn is_live(live_rounds: &[NumberFor], round: NumberFor) -> bool { - live_rounds.binary_search(&round).is_ok() + let live = live_rounds.binary_search(&round).is_ok(); + + trace!(target: "beefy", "🥩 Round #{} is live: {}", round, live); + + live } } diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index eee15b8ab6ade..496852f13f98b 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -14,12 +14,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::collections::BTreeMap; +use std::{collections::BTreeMap, hash::Hash}; + +use log::trace; use beefy_primitives::{ crypto::{Public, Signature}, ValidatorSet, ValidatorSetId, }; +use sp_arithmetic::traits::AtLeast32BitUnsigned; +use sp_runtime::traits::MaybeDisplay; struct RoundTracker { votes: Vec<(Public, Signature)>, @@ -57,10 +61,10 @@ pub(crate) struct Rounds { validator_set: ValidatorSet, } -impl Rounds +impl Rounds where - Hash: Ord, - Number: Ord, + H: Ord + Hash, + N: Ord + AtLeast32BitUnsigned + MaybeDisplay, { pub(crate) fn new(validator_set: ValidatorSet) -> Self { Rounds { @@ -70,10 +74,10 @@ where } } -impl Rounds +impl Rounds where - Hash: Ord, - Number: Ord, + H: Ord + Hash, + N: Ord + AtLeast32BitUnsigned + MaybeDisplay, { pub(crate) fn validator_set_id(&self) -> ValidatorSetId { self.validator_set.id @@ -83,18 +87,25 @@ where self.validator_set.validators.clone() } - pub(crate) fn add_vote(&mut self, round: (Hash, Number), vote: (Public, Signature)) -> bool { + pub(crate) fn add_vote(&mut self, round: (H, N), vote: (Public, Signature)) -> bool { self.rounds.entry(round).or_default().add_vote(vote) } - pub(crate) fn is_done(&self, round: &(Hash, Number)) -> bool { - self.rounds + pub(crate) fn is_done(&self, round: &(H, N)) -> bool { + let done = self + .rounds .get(round) .map(|tracker| tracker.is_done(threshold(self.validator_set.validators.len()))) - .unwrap_or(false) + .unwrap_or(false); + + trace!(target: "beefy", "🥩 Round #{} done: {}", round.1, done); + + done } - pub(crate) fn drop(&mut self, round: &(Hash, Number)) -> Option>> { + pub(crate) fn drop(&mut self, round: &(H, N)) -> Option>> { + trace!(target: "beefy", "🥩 About to drop round #{}", round.1); + let signatures = self.rounds.remove(round)?.votes; Some( diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 2f28b70e3ee8a..9f9e747401af3 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -165,12 +165,16 @@ where /// /// Such a failure is usually an indication that the BEEFT pallet has not been deployed (yet). fn validator_set(&self, header: &B::Header) -> Option> { - if let Some(new) = find_authorities_change::(header) { + let new = if let Some(new) = find_authorities_change::(header) { Some(new) } else { let at = BlockId::hash(header.hash()); self.client.runtime_api().validator_set(&at).ok() - } + }; + + trace!(target: "beefy", "🥩 active validator set: {:?}", new); + + new } fn handle_finality_notification(&mut self, notification: FinalityNotification) { @@ -210,6 +214,7 @@ where if self.should_vote_on(*notification.header.number()) { let authority_id = if let Some(id) = self.key_store.authority_id(self.rounds.validators().as_slice()) { + trace!(target: "beefy", "🥩 Local authority id: {:?}", id); id } else { trace!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); From 8676c10b56221ba0e3c5abeb2cb4d21fc7dab612 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 23 Jun 2021 05:55:33 +0200 Subject: [PATCH 067/109] Additional initial authority id's (#217) * Scratch concluded rounds * adjust testnet doc * fix authority key typo * We don't want no scratches * address review comments --- client/beefy/src/gossip.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index 003a52a070d1f..eaa3fd28696da 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -72,6 +72,9 @@ where } } + /// Note a live voting round + /// + /// This should be called, in order to keep tabs on `round`. pub(crate) fn note_round(&self, round: NumberFor) { trace!(target: "beefy", "🥩 About to note round #{}", round); @@ -89,11 +92,7 @@ where } fn is_live(live_rounds: &[NumberFor], round: NumberFor) -> bool { - let live = live_rounds.binary_search(&round).is_ok(); - - trace!(target: "beefy", "🥩 Round #{} is live: {}", round, live); - - live + live_rounds.binary_search(&round).is_ok() } } @@ -122,12 +121,16 @@ where fn message_expired<'a>(&'a self) -> Box bool + 'a> { let live_rounds = self.live_rounds.read(); Box::new(move |_topic, mut data| { - let message = match VoteMessage::, Public, Signature>::decode(&mut data) { + let msg = match VoteMessage::, Public, Signature>::decode(&mut data) { Ok(vote) => vote, Err(_) => return true, }; - !BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + let expired = !BeefyGossipValidator::::is_live(&live_rounds, msg.commitment.block_number); + + trace!(target: "beefy", "🥩 Message for round #{} expired: {}", msg.commitment.block_number, expired); + + expired }) } @@ -135,12 +138,16 @@ where fn message_allowed<'a>(&'a self) -> Box bool + 'a> { let live_rounds = self.live_rounds.read(); Box::new(move |_who, _intent, _topic, mut data| { - let message = match VoteMessage::, Public, Signature>::decode(&mut data) { + let msg = match VoteMessage::, Public, Signature>::decode(&mut data) { Ok(vote) => vote, Err(_) => return true, }; - BeefyGossipValidator::::is_live(&live_rounds, message.commitment.block_number) + let allowed = BeefyGossipValidator::::is_live(&live_rounds, msg.commitment.block_number); + + trace!(target: "beefy", "🥩 Message for round #{} allowed: {}", msg.commitment.block_number, allowed); + + allowed }) } } From 2edf07ccfc7221fd5fbe0b6093d58bb66cfe11f4 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 25 Jun 2021 10:22:43 +0200 Subject: [PATCH 068/109] Fix note_round() (#219) * rename BeefyGossipValidator * Fix note_round() * use const for assert * put message trace points back in * test case note_same_round_twice() * address review comments * remove redundant check --- client/beefy/Cargo.toml | 3 + client/beefy/src/gossip.rs | 138 ++++++++++++++++++++++++++++++------- client/beefy/src/lib.rs | 2 +- client/beefy/src/worker.rs | 6 +- 4 files changed, 119 insertions(+), 30 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 42cbfdae12662..e06e49aa337a7 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -31,3 +31,6 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "master sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } beefy-primitives = { path = "../beefy-primitives" } + +[dev-dependencies] +sc-network-test = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index eaa3fd28696da..ab3f56d8d3b2c 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -14,16 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -/// The maximum number of live gossip rounds allowed, i.e. we will expire messages older than this. use codec::{Decode, Encode}; use log::{debug, trace}; use parking_lot::RwLock; use sc_network::PeerId; -use sc_network_gossip::{ - MessageIntent, ValidationResult as GossipValidationResult, Validator as GossipValidator, - ValidatorContext as GossipValidatorContext, -}; +use sc_network_gossip::{MessageIntent, ValidationResult, Validator, ValidatorContext}; use sp_runtime::traits::{Block, Hash, Header, NumberFor}; @@ -53,7 +49,7 @@ where /// rejected/expired. /// ///All messaging is handled in a single BEEFY global topic. -pub(crate) struct BeefyGossipValidator +pub(crate) struct GossipValidator where B: Block, { @@ -61,33 +57,34 @@ where live_rounds: RwLock>>, } -impl BeefyGossipValidator +impl GossipValidator where B: Block, { - pub fn new() -> BeefyGossipValidator { - BeefyGossipValidator { + pub fn new() -> GossipValidator { + GossipValidator { topic: topic::(), live_rounds: RwLock::new(Vec::new()), } } - /// Note a live voting round + /// Note a voting round. + /// + /// Noting `round` will keep `round` live. /// - /// This should be called, in order to keep tabs on `round`. + /// We retain the [`MAX_LIVE_GOSSIP_ROUNDS`] most **recent** voting rounds as live. + /// As long as a voting round is live, it will be gossiped to peer nodes. pub(crate) fn note_round(&self, round: NumberFor) { trace!(target: "beefy", "🥩 About to note round #{}", round); - let mut live_rounds = self.live_rounds.write(); + let mut live = self.live_rounds.write(); - // NOTE: ideally we'd use a VecDeque here, but currently binary search is only available on - // nightly for `VecDeque`. - while live_rounds.len() > MAX_LIVE_GOSSIP_ROUNDS { - let _ = live_rounds.remove(0); + if let Some(idx) = live.binary_search(&round).err() { + live.insert(idx, round); } - if let Some(idx) = live_rounds.binary_search(&round).err() { - live_rounds.insert(idx, round); + if live.len() > MAX_LIVE_GOSSIP_ROUNDS { + let _ = live.remove(0); } } @@ -96,26 +93,26 @@ where } } -impl GossipValidator for BeefyGossipValidator +impl Validator for GossipValidator where B: Block, { fn validate( &self, - _context: &mut dyn GossipValidatorContext, - sender: &sc_network::PeerId, + _context: &mut dyn ValidatorContext, + sender: &PeerId, mut data: &[u8], - ) -> GossipValidationResult { + ) -> ValidationResult { if let Ok(msg) = VoteMessage::, Public, Signature>::decode(&mut data) { if BeefyKeystore::verify(&msg.id, &msg.signature, &msg.commitment.encode()) { - return GossipValidationResult::ProcessAndKeep(self.topic); + return ValidationResult::ProcessAndKeep(self.topic); } else { // TODO: report peer debug!(target: "beefy", "🥩 Bad signature on message: {:?}, from: {:?}", msg, sender); } } - GossipValidationResult::Discard + ValidationResult::Discard } fn message_expired<'a>(&'a self) -> Box bool + 'a> { @@ -126,7 +123,7 @@ where Err(_) => return true, }; - let expired = !BeefyGossipValidator::::is_live(&live_rounds, msg.commitment.block_number); + let expired = !GossipValidator::::is_live(&live_rounds, msg.commitment.block_number); trace!(target: "beefy", "🥩 Message for round #{} expired: {}", msg.commitment.block_number, expired); @@ -143,7 +140,7 @@ where Err(_) => return true, }; - let allowed = BeefyGossipValidator::::is_live(&live_rounds, msg.commitment.block_number); + let allowed = GossipValidator::::is_live(&live_rounds, msg.commitment.block_number); trace!(target: "beefy", "🥩 Message for round #{} allowed: {}", msg.commitment.block_number, allowed); @@ -151,3 +148,92 @@ where }) } } + +#[cfg(test)] +mod tests { + use super::{GossipValidator, MAX_LIVE_GOSSIP_ROUNDS}; + use sc_network_test::Block; + + #[test] + fn note_round_works() { + let gv = GossipValidator::::new(); + + gv.note_round(1u64); + + let live = gv.live_rounds.read(); + assert!(GossipValidator::::is_live(&live, 1u64)); + + drop(live); + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + + let live = gv.live_rounds.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(!GossipValidator::::is_live(&live, 1u64)); + assert!(GossipValidator::::is_live(&live, 3u64)); + assert!(GossipValidator::::is_live(&live, 7u64)); + assert!(GossipValidator::::is_live(&live, 10u64)); + } + + #[test] + fn keeps_most_recent_max_rounds() { + let gv = GossipValidator::::new(); + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + gv.note_round(1u64); + + let live = gv.live_rounds.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(GossipValidator::::is_live(&live, 3u64)); + assert!(!GossipValidator::::is_live(&live, 1u64)); + + drop(live); + + gv.note_round(23u64); + gv.note_round(15u64); + gv.note_round(20u64); + gv.note_round(2u64); + + let live = gv.live_rounds.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(GossipValidator::::is_live(&live, 15u64)); + assert!(GossipValidator::::is_live(&live, 20u64)); + assert!(GossipValidator::::is_live(&live, 23u64)); + } + + #[test] + fn note_same_round_twice() { + let gv = GossipValidator::::new(); + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + + let live = gv.live_rounds.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + drop(live); + + // note round #7 again -> should not change anything + gv.note_round(7u64); + + let live = gv.live_rounds.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(GossipValidator::::is_live(&live, 3u64)); + assert!(GossipValidator::::is_live(&live, 7u64)); + assert!(GossipValidator::::is_live(&live, 10u64)); + } +} diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index cf7a4667b8652..0442d25bb9d6a 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -116,7 +116,7 @@ where prometheus_registry, } = beefy_params; - let gossip_validator = Arc::new(gossip::BeefyGossipValidator::new()); + let gossip_validator = Arc::new(gossip::GossipValidator::new()); let gossip_engine = GossipEngine::new(network, BEEFY_PROTOCOL_NAME, gossip_validator.clone(), None); let metrics = prometheus_registry diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 9f9e747401af3..8721cbcfc856e 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -39,7 +39,7 @@ use beefy_primitives::{ }; use crate::{ - gossip::{topic, BeefyGossipValidator}, + gossip::{topic, GossipValidator}, keystore::BeefyKeystore, metric_inc, metric_set, metrics::Metrics, @@ -55,7 +55,7 @@ where pub key_store: BeefyKeystore, pub signed_commitment_sender: notification::BeefySignedCommitmentSender, pub gossip_engine: GossipEngine, - pub gossip_validator: Arc>, + pub gossip_validator: Arc>, pub min_block_delta: u32, pub metrics: Option, } @@ -72,7 +72,7 @@ where key_store: BeefyKeystore, signed_commitment_sender: notification::BeefySignedCommitmentSender, gossip_engine: Arc>>, - gossip_validator: Arc>, + gossip_validator: Arc>, /// Min delta in block numbers between two blocks, BEEFY should vote on min_block_delta: u32, metrics: Option, From e08e656a2c8709284726506992c382e8df227330 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Thu, 1 Jul 2021 21:07:02 +0200 Subject: [PATCH 069/109] Use LocalKeystore for tests (#224) * private_keys() * Use LocalKeystore for tests * Use keystore helper * Address review * some reformatting --- client/beefy/Cargo.toml | 2 + client/beefy/src/keystore.rs | 153 ++++++++++++++++++++++++----------- 2 files changed, 107 insertions(+), 48 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index e06e49aa337a7..e1481938ba7e0 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -34,3 +34,5 @@ beefy-primitives = { path = "../beefy-primitives" } [dev-dependencies] sc-network-test = { git = "https://github.com/paritytech/substrate", branch = "master" } + +beefy-test = { path = "../beefy-test" } \ No newline at end of file diff --git a/client/beefy/src/keystore.rs b/client/beefy/src/keystore.rs index ddbfc33c0f692..6d5a7c2a42164 100644 --- a/client/beefy/src/keystore.rs +++ b/client/beefy/src/keystore.rs @@ -11,7 +11,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::convert::TryInto; +use std::convert::{From, TryInto}; use sp_application_crypto::RuntimeAppPublic; use sp_core::keccak_256; @@ -54,11 +54,10 @@ impl BeefyKeystore { /// /// Return the message signature or an error in case of failure. pub fn sign(&self, public: &Public, message: &[u8]) -> Result { - let store = if let Some(store) = self.0.clone() { - store - } else { - return Err(error::Error::Keystore("no Keystore".to_string())); - }; + let store = self + .0 + .clone() + .ok_or_else(|| error::Error::Keystore("no Keystore".into()))?; let msg = keccak_256(message); let public = public.as_ref(); @@ -76,6 +75,23 @@ impl BeefyKeystore { Ok(sig) } + #[allow(dead_code)] + /// Returns a vector of [`beefy_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::ecdsa_public_keys(&*store, KEY_TYPE) + .iter() + .map(|k| Public::from(k.clone())) + .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. @@ -96,77 +112,83 @@ impl From> for BeefyKeystore { #[cfg(test)] mod tests { - #![allow(clippy::unit_cmp)] + use std::sync::Arc; - use sp_core::{keccak_256, Pair}; - use sp_keystore::{testing::KeyStore, SyncCryptoStore, SyncCryptoStorePtr}; + use sc_keystore::LocalKeystore; + use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use beefy_primitives::{crypto, KEY_TYPE}; + use beefy_test::Keyring; use super::BeefyKeystore; use crate::error::Error; + fn keystore() -> SyncCryptoStorePtr { + Arc::new(LocalKeystore::in_memory()) + } + #[test] fn authority_id_works() { - let store: SyncCryptoStorePtr = KeyStore::new().into(); + let store = keystore(); - let alice = crypto::Pair::from_string("//Alice", None).unwrap(); - let _ = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()).unwrap(); + let alice: crypto::Public = + SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) + .ok() + .unwrap() + .into(); - let bob = crypto::Pair::from_string("//Bob", None).unwrap(); - let charlie = crypto::Pair::from_string("//Charlie", None).unwrap(); + let bob = Keyring::Bob.public(); + let charlie = Keyring::Charlie.public(); let store: BeefyKeystore = Some(store).into(); - let mut keys = vec![bob.public(), charlie.public()]; + let mut keys = vec![bob, charlie]; let id = store.authority_id(keys.as_slice()); assert!(id.is_none()); - keys.push(alice.public()); + keys.push(alice.clone()); let id = store.authority_id(keys.as_slice()).unwrap(); - assert_eq!(id, alice.public()); + assert_eq!(id, alice); } #[test] fn sign_works() { - let store: SyncCryptoStorePtr = KeyStore::new().into(); + let store = keystore(); - let suri = "//Alice"; - let pair = sp_core::ecdsa::Pair::from_string(suri, None).unwrap(); + let alice: crypto::Public = + SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) + .ok() + .unwrap() + .into(); - let res = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, suri, pair.public().as_ref()).unwrap(); - assert_eq!((), res); - - let beefy_store: BeefyKeystore = Some(store.clone()).into(); + let store: BeefyKeystore = Some(store).into(); let msg = b"are you involved or commited?"; - let sig1 = beefy_store.sign(&pair.public().into(), msg).unwrap(); - let msg = keccak_256(b"are you involved or commited?"); - let sig2 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &pair.public(), &msg) - .unwrap() - .unwrap(); + let sig1 = store.sign(&alice, msg).unwrap(); + let sig2 = Keyring::Alice.sign(msg); - assert_eq!(sig1, sig2.into()); + assert_eq!(sig1, sig2); } #[test] fn sign_error() { - let store: SyncCryptoStorePtr = KeyStore::new().into(); - - let bob = crypto::Pair::from_string("//Bob", None).unwrap(); - let res = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Bob", bob.public().as_ref()).unwrap(); - assert_eq!((), res); + let store = keystore(); - let alice = crypto::Pair::from_string("//Alice", None).unwrap(); + let _ = SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Bob.to_seed())) + .ok() + .unwrap(); let store: BeefyKeystore = Some(store).into(); + let alice = Keyring::Alice.public(); + let msg = b"are you involved or commited?"; - let sig = store.sign(&alice.public(), msg).err().unwrap(); + let sig = store.sign(&alice, msg).err().unwrap(); let err = Error::Signature("ecdsa_sign_prehashed() failed".to_string()); + assert_eq!(sig, err); } @@ -174,33 +196,68 @@ mod tests { fn sign_no_keystore() { let store: BeefyKeystore = None.into(); - let alice = crypto::Pair::from_string("//Alice", None).unwrap(); + let alice = Keyring::Alice.public(); let msg = b"are you involved or commited"; - let sig = store.sign(&alice.public(), msg).err().unwrap(); + 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: SyncCryptoStorePtr = KeyStore::new().into(); + let store = keystore(); - let suri = "//Alice"; - let pair = crypto::Pair::from_string(suri, None).unwrap(); - - let res = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, suri, pair.public().as_ref()).unwrap(); - assert_eq!((), res); + let alice: crypto::Public = + SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) + .ok() + .unwrap() + .into(); let store: BeefyKeystore = Some(store).into(); // `msg` and `sig` match let msg = b"are you involved or commited?"; - let sig = store.sign(&pair.public(), msg).unwrap(); - assert!(BeefyKeystore::verify(&pair.public(), &sig, msg)); + let sig = store.sign(&alice, msg).unwrap(); + assert!(BeefyKeystore::verify(&alice, &sig, msg)); // `msg and `sig` don't match let msg = b"you are just involved"; - assert!(!BeefyKeystore::verify(&pair.public(), &sig, msg)); + assert!(!BeefyKeystore::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::ecdsa_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: BeefyKeystore = 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)); } } From b0e0cdb9adbceb10d227ac642bee4582a9fccc32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 5 Jul 2021 05:34:13 +0200 Subject: [PATCH 070/109] Cache known votes in gossip (#227) * Implement known messages cache. * Add tests. * Appease clippy. * More clippy Co-authored-by: adoerr <0xad@gmx.net> --- client/beefy/Cargo.toml | 3 +- client/beefy/src/gossip.rs | 199 ++++++++++++++++++++++++++++++------- 2 files changed, 167 insertions(+), 35 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index e1481938ba7e0..ac6c6836dcadc 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -6,6 +6,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] +fnv = "1.0.6" futures = "0.3" hex = "0.4" log = "0.4" @@ -35,4 +36,4 @@ beefy-primitives = { path = "../beefy-primitives" } [dev-dependencies] sc-network-test = { git = "https://github.com/paritytech/substrate", branch = "master" } -beefy-test = { path = "../beefy-test" } \ No newline at end of file +beefy-test = { path = "../beefy-test" } diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index ab3f56d8d3b2c..f3ffbcec6ba82 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -17,10 +17,12 @@ use codec::{Decode, Encode}; use log::{debug, trace}; use parking_lot::RwLock; +use std::collections::BTreeMap; use sc_network::PeerId; use sc_network_gossip::{MessageIntent, ValidationResult, Validator, ValidatorContext}; +use sp_core::hashing::twox_64; use sp_runtime::traits::{Block, Hash, Header, NumberFor}; use beefy_primitives::{ @@ -41,6 +43,11 @@ where <::Hashing as Hash>::hash(b"beefy") } +/// A type that represents hash of the message. +pub type MessageHash = [u8; 8]; + +type KnownVotes = BTreeMap, fnv::FnvHashSet>; + /// BEEFY gossip validator /// /// Validate BEEFY gossip messages and limit the number of live BEEFY voting rounds. @@ -54,7 +61,7 @@ where B: Block, { topic: B::Hash, - live_rounds: RwLock>>, + known_votes: RwLock>, } impl GossipValidator @@ -64,7 +71,7 @@ where pub fn new() -> GossipValidator { GossipValidator { topic: topic::(), - live_rounds: RwLock::new(Vec::new()), + known_votes: RwLock::new(BTreeMap::new()), } } @@ -77,19 +84,34 @@ where pub(crate) fn note_round(&self, round: NumberFor) { trace!(target: "beefy", "🥩 About to note round #{}", round); - let mut live = self.live_rounds.write(); + let mut live = self.known_votes.write(); - if let Some(idx) = live.binary_search(&round).err() { - live.insert(idx, round); + #[allow(clippy::map_entry)] + if !live.contains_key(&round) { + live.insert(round, Default::default()); } if live.len() > MAX_LIVE_GOSSIP_ROUNDS { - let _ = live.remove(0); + let to_remove = live.iter().next().map(|x| x.0).copied(); + if let Some(first) = to_remove { + live.remove(&first); + } } } - fn is_live(live_rounds: &[NumberFor], round: NumberFor) -> bool { - live_rounds.binary_search(&round).is_ok() + fn add_known(known_votes: &mut KnownVotes, round: &NumberFor, hash: MessageHash) { + known_votes.get_mut(round).map(|known| known.insert(hash)); + } + + fn is_live(known_votes: &KnownVotes, round: &NumberFor) -> bool { + known_votes.contains_key(round) + } + + fn is_known(known_votes: &KnownVotes, round: &NumberFor, hash: &MessageHash) -> bool { + known_votes + .get(round) + .map(|known| known.contains(hash)) + .unwrap_or(false) } } @@ -104,7 +126,26 @@ where mut data: &[u8], ) -> ValidationResult { if let Ok(msg) = VoteMessage::, Public, Signature>::decode(&mut data) { + let msg_hash = twox_64(data); + let round = msg.commitment.block_number; + + // Verify general usefulness of the message. + // We are going to discard old votes right away (without verification) + // Also we keep track of already received votes to avoid verifying duplicates. + { + let known_votes = self.known_votes.read(); + + if !GossipValidator::::is_live(&known_votes, &round) { + return ValidationResult::Discard; + } + + if GossipValidator::::is_known(&known_votes, &round, &msg_hash) { + return ValidationResult::ProcessAndKeep(self.topic); + } + } + if BeefyKeystore::verify(&msg.id, &msg.signature, &msg.commitment.encode()) { + GossipValidator::::add_known(&mut *self.known_votes.write(), &round, msg_hash); return ValidationResult::ProcessAndKeep(self.topic); } else { // TODO: report peer @@ -116,16 +157,17 @@ where } fn message_expired<'a>(&'a self) -> Box bool + 'a> { - let live_rounds = self.live_rounds.read(); + let known_votes = self.known_votes.read(); Box::new(move |_topic, mut data| { let msg = match VoteMessage::, Public, Signature>::decode(&mut data) { Ok(vote) => vote, Err(_) => return true, }; - let expired = !GossipValidator::::is_live(&live_rounds, msg.commitment.block_number); + let round = msg.commitment.block_number; + let expired = !GossipValidator::::is_live(&known_votes, &round); - trace!(target: "beefy", "🥩 Message for round #{} expired: {}", msg.commitment.block_number, expired); + trace!(target: "beefy", "🥩 Message for round #{} expired: {}", round, expired); expired }) @@ -133,16 +175,17 @@ where #[allow(clippy::type_complexity)] fn message_allowed<'a>(&'a self) -> Box bool + 'a> { - let live_rounds = self.live_rounds.read(); + let known_votes = self.known_votes.read(); Box::new(move |_who, _intent, _topic, mut data| { let msg = match VoteMessage::, Public, Signature>::decode(&mut data) { Ok(vote) => vote, Err(_) => return true, }; - let allowed = GossipValidator::::is_live(&live_rounds, msg.commitment.block_number); + let round = msg.commitment.block_number; + let allowed = GossipValidator::::is_live(&known_votes, &round); - trace!(target: "beefy", "🥩 Message for round #{} allowed: {}", msg.commitment.block_number, allowed); + trace!(target: "beefy", "🥩 Message for round #{} allowed: {}", round, allowed); allowed }) @@ -151,8 +194,14 @@ where #[cfg(test)] mod tests { - use super::{GossipValidator, MAX_LIVE_GOSSIP_ROUNDS}; + use crate::keystore::BeefyKeystore; + + use super::*; + use beefy_primitives::{crypto::Signature, Commitment, MmrRootHash, VoteMessage, KEY_TYPE}; + use beefy_test::Keyring; + use sc_keystore::LocalKeystore; use sc_network_test::Block; + use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; #[test] fn note_round_works() { @@ -160,8 +209,8 @@ mod tests { gv.note_round(1u64); - let live = gv.live_rounds.read(); - assert!(GossipValidator::::is_live(&live, 1u64)); + let live = gv.known_votes.read(); + assert!(GossipValidator::::is_live(&live, &1u64)); drop(live); @@ -169,14 +218,14 @@ mod tests { gv.note_round(7u64); gv.note_round(10u64); - let live = gv.live_rounds.read(); + let live = gv.known_votes.read(); assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - assert!(!GossipValidator::::is_live(&live, 1u64)); - assert!(GossipValidator::::is_live(&live, 3u64)); - assert!(GossipValidator::::is_live(&live, 7u64)); - assert!(GossipValidator::::is_live(&live, 10u64)); + assert!(!GossipValidator::::is_live(&live, &1u64)); + assert!(GossipValidator::::is_live(&live, &3u64)); + assert!(GossipValidator::::is_live(&live, &7u64)); + assert!(GossipValidator::::is_live(&live, &10u64)); } #[test] @@ -188,12 +237,12 @@ mod tests { gv.note_round(10u64); gv.note_round(1u64); - let live = gv.live_rounds.read(); + let live = gv.known_votes.read(); assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - assert!(GossipValidator::::is_live(&live, 3u64)); - assert!(!GossipValidator::::is_live(&live, 1u64)); + assert!(GossipValidator::::is_live(&live, &3u64)); + assert!(!GossipValidator::::is_live(&live, &1u64)); drop(live); @@ -202,13 +251,13 @@ mod tests { gv.note_round(20u64); gv.note_round(2u64); - let live = gv.live_rounds.read(); + let live = gv.known_votes.read(); assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - assert!(GossipValidator::::is_live(&live, 15u64)); - assert!(GossipValidator::::is_live(&live, 20u64)); - assert!(GossipValidator::::is_live(&live, 23u64)); + assert!(GossipValidator::::is_live(&live, &15u64)); + assert!(GossipValidator::::is_live(&live, &20u64)); + assert!(GossipValidator::::is_live(&live, &23u64)); } #[test] @@ -219,7 +268,7 @@ mod tests { gv.note_round(7u64); gv.note_round(10u64); - let live = gv.live_rounds.read(); + let live = gv.known_votes.read(); assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); @@ -228,12 +277,94 @@ mod tests { // note round #7 again -> should not change anything gv.note_round(7u64); - let live = gv.live_rounds.read(); + let live = gv.known_votes.read(); assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - assert!(GossipValidator::::is_live(&live, 3u64)); - assert!(GossipValidator::::is_live(&live, 7u64)); - assert!(GossipValidator::::is_live(&live, 10u64)); + assert!(GossipValidator::::is_live(&live, &3u64)); + assert!(GossipValidator::::is_live(&live, &7u64)); + assert!(GossipValidator::::is_live(&live, &10u64)); + } + + struct TestContext; + impl ValidatorContext for TestContext { + fn broadcast_topic(&mut self, _topic: B::Hash, _force: bool) { + todo!() + } + + fn broadcast_message(&mut self, _topic: B::Hash, _message: Vec, _force: bool) { + todo!() + } + + fn send_message(&mut self, _who: &sc_network::PeerId, _message: Vec) { + todo!() + } + + fn send_topic(&mut self, _who: &sc_network::PeerId, _topic: B::Hash, _force: bool) { + todo!() + } + } + + fn sign_commitment(who: &Keyring, commitment: &Commitment) -> Signature { + let store: SyncCryptoStorePtr = std::sync::Arc::new(LocalKeystore::in_memory()); + SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&who.to_seed())).unwrap(); + let beefy_keystore: BeefyKeystore = Some(store).into(); + + beefy_keystore.sign(&who.public(), &commitment.encode()).unwrap() + } + + #[test] + fn should_avoid_verifying_signatures_twice() { + let gv = GossipValidator::::new(); + let sender = sc_network::PeerId::random(); + let mut context = TestContext; + + let commitment = Commitment { + payload: MmrRootHash::default(), + block_number: 3_u64, + validator_set_id: 0, + }; + + let signature = sign_commitment(&Keyring::Alice, &commitment); + + let vote = VoteMessage { + commitment, + id: Keyring::Alice.public(), + signature, + }; + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + + // first time the cache should be populated. + let res = gv.validate(&mut context, &sender, &vote.encode()); + + assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + assert_eq!( + gv.known_votes + .read() + .get(&vote.commitment.block_number) + .map(|x| x.len()), + Some(1) + ); + + // second time we should hit the cache + let res = gv.validate(&mut context, &sender, &vote.encode()); + + assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + + // next we should quickly reject if the round is not live. + gv.note_round(11_u64); + gv.note_round(12_u64); + + assert!(!GossipValidator::::is_live( + &*gv.known_votes.read(), + &vote.commitment.block_number + )); + + let res = gv.validate(&mut context, &sender, &vote.encode()); + + assert!(matches!(res, ValidationResult::Discard)); } } From 9234d02ad7411252ab6ea3385c77b4a726f5d70d Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 7 Jul 2021 17:07:02 +0200 Subject: [PATCH 071/109] Some key store sanity checks (#232) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * verify vote message * verify_validator_set() * rework logging * some rework * Tone down warnings. * Add signature verification. * Tone down more. * Fix clippy Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/src/gossip.rs | 2 +- client/beefy/src/keystore.rs | 18 ++++++++---- client/beefy/src/round.rs | 4 +-- client/beefy/src/worker.rs | 56 ++++++++++++++++++++++++++++-------- 4 files changed, 59 insertions(+), 21 deletions(-) diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index f3ffbcec6ba82..c2cd2b2c066a4 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -82,7 +82,7 @@ where /// We retain the [`MAX_LIVE_GOSSIP_ROUNDS`] most **recent** voting rounds as live. /// As long as a voting round is live, it will be gossiped to peer nodes. pub(crate) fn note_round(&self, round: NumberFor) { - trace!(target: "beefy", "🥩 About to note round #{}", round); + debug!(target: "beefy", "🥩 About to note round #{}", round); let mut live = self.known_votes.write(); diff --git a/client/beefy/src/keystore.rs b/client/beefy/src/keystore.rs index 6d5a7c2a42164..521dfab77edeb 100644 --- a/client/beefy/src/keystore.rs +++ b/client/beefy/src/keystore.rs @@ -17,6 +17,8 @@ use sp_application_crypto::RuntimeAppPublic; use sp_core::keccak_256; use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; +use log::warn; + use beefy_primitives::{ crypto::{Public, Signature}, KEY_TYPE, @@ -39,13 +41,18 @@ impl BeefyKeystore { pub fn authority_id(&self, keys: &[Public]) -> Option { let store = self.0.clone()?; - for key in keys { - if SyncCryptoStore::has_keys(&*store, &[(key.to_raw_vec(), KEY_TYPE)]) { - return Some(key.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()); } - None + public.get(0).cloned() } /// Sign `message` with the `public` key. @@ -75,7 +82,6 @@ impl BeefyKeystore { Ok(sig) } - #[allow(dead_code)] /// Returns a vector of [`beefy_primitives::crypto::Public`] keys which are currently supported (i.e. found /// in the keystore). pub fn public_keys(&self) -> Result, error::Error> { diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index 496852f13f98b..88f35bfb25709 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -16,7 +16,7 @@ use std::{collections::BTreeMap, hash::Hash}; -use log::trace; +use log::{debug, trace}; use beefy_primitives::{ crypto::{Public, Signature}, @@ -98,7 +98,7 @@ where .map(|tracker| tracker.is_done(threshold(self.validator_set.validators.len()))) .unwrap_or(false); - trace!(target: "beefy", "🥩 Round #{} done: {}", round.1, done); + debug!(target: "beefy", "🥩 Round #{} done: {}", round.1, done); done } diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 8721cbcfc856e..63ddfb9041c08 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{fmt::Debug, marker::PhantomData, sync::Arc}; +use std::{collections::BTreeSet, fmt::Debug, marker::PhantomData, sync::Arc}; use codec::{Codec, Decode, Encode}; use futures::{future, FutureExt, StreamExt}; @@ -33,12 +33,13 @@ use sp_runtime::{ }; use beefy_primitives::{ - crypto::{Public, Signature}, + crypto::{AuthorityId, Public, Signature}, BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, VersionedCommitment, VoteMessage, BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID, }; use crate::{ + error, gossip::{topic, GossipValidator}, keystore::BeefyKeystore, metric_inc, metric_set, @@ -165,7 +166,7 @@ where /// /// Such a failure is usually an indication that the BEEFT pallet has not been deployed (yet). fn validator_set(&self, header: &B::Header) -> Option> { - let new = if let Some(new) = find_authorities_change::(header) { + let new = if let Some(new) = find_authorities_change::(header) { Some(new) } else { let at = BlockId::hash(header.hash()); @@ -177,6 +178,27 @@ where new } + /// Verify `active` validator set for `block` against the key store + /// + /// The critical case is, if we do have a public key in the key store which is not + /// part of the active validator set. + /// + /// Note that for a non-authority node there will be no keystore, and we will + /// return an error and don't check. The error can usually be ignored. + fn verify_validator_set(&self, block: &NumberFor, mut active: ValidatorSet) -> Result<(), error::Error> { + let active: BTreeSet = active.validators.drain(..).collect(); + + let store: BTreeSet = self.key_store.public_keys()?.drain(..).collect(); + + let missing: Vec<_> = store.difference(&active).cloned().collect(); + + if !missing.is_empty() { + debug!(target: "beefy", "🥩 for block {:?} public key missing in validator set: {:?}", block, missing); + } + + Ok(()) + } + fn handle_finality_notification(&mut self, notification: FinalityNotification) { trace!(target: "beefy", "🥩 Finality notification: {:?}", notification); @@ -200,6 +222,9 @@ where metric_inc!(self, beefy_skipped_sessions); } + // verify the new validator set + let _ = self.verify_validator_set(notification.header.number(), active.clone()); + self.rounds = round::Rounds::new(active.clone()); debug!(target: "beefy", "🥩 New Rounds for id: {:?}", active.id); @@ -214,10 +239,10 @@ where if self.should_vote_on(*notification.header.number()) { let authority_id = if let Some(id) = self.key_store.authority_id(self.rounds.validators().as_slice()) { - trace!(target: "beefy", "🥩 Local authority id: {:?}", id); + debug!(target: "beefy", "🥩 Local authority id: {:?}", id); id } else { - trace!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); + debug!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); return; }; @@ -233,8 +258,9 @@ where block_number: notification.header.number(), validator_set_id: self.rounds.validator_set_id(), }; + let encoded_commitment = commitment.encode(); - let signature = match self.key_store.sign(&authority_id, commitment.encode().as_ref()) { + let signature = match self.key_store.sign(&authority_id, &*encoded_commitment) { Ok(sig) => sig, Err(err) => { warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err); @@ -242,6 +268,13 @@ where } }; + trace!( + target: "beefy", + "🥩 Produced signature using {:?}, is_valid: {:?}", + authority_id, + BeefyKeystore::verify(&authority_id, &signature, &*encoded_commitment) + ); + let message = VoteMessage { commitment, id: authority_id, @@ -298,9 +331,9 @@ where ) .is_err() { - // this is a warning for now, because until the round lifecycle is improved, we will + // just a trace, because until the round lifecycle is improved, we will // conclude certain rounds multiple times. - warn!(target: "beefy", "🥩 Failed to append justification: {:?}", signed_commitment); + trace!(target: "beefy", "🥩 Failed to append justification: {:?}", signed_commitment); } self.signed_commitment_sender.notify(signed_commitment); @@ -314,7 +347,7 @@ where pub(crate) async fn run(mut self) { let mut votes = Box::pin(self.gossip_engine.lock().messages_for(topic::()).filter_map( |notification| async move { - trace!(target: "beefy", "🥩 Got vote message: {:?}", notification); + debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); VoteMessage::, Public, Signature>::decode(&mut ¬ification.message[..]).ok() }, @@ -367,14 +400,13 @@ where /// Scan the `header` digest log for a BEEFY validator set change. Return either the new /// validator set or `None` in case no validator set change has been signaled. -fn find_authorities_change(header: &B::Header) -> Option> +fn find_authorities_change(header: &B::Header) -> Option> where B: Block, - Id: Codec, { let id = OpaqueDigestItemId::Consensus(&BEEFY_ENGINE_ID); - let filter = |log: ConsensusLog| match log { + let filter = |log: ConsensusLog| match log { ConsensusLog::AuthoritiesChange(validator_set) => Some(validator_set), _ => None, }; From 9a8773f2a28979d086f309ab4d3d069e3efb9803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 8 Jul 2021 16:10:51 +0200 Subject: [PATCH 072/109] Use Binary Merkle Tree instead of a trie (#225) * Binary tree merkle root. * Add proofs and verification. * Clean up debug. * Use BEEFY addresses instead of pubkeys. * Use new merkle tree. * Optimize allocations. * Add test for larger trees. * Add tests for larger cases. * Appease clippy * Appease clippy2. * Fix proof generation & verification. * Add more test data. * Fix CLI. * Update README * Bump version. * Update docs. * Rename beefy-merkle-root to beefy-merkle-tree Co-authored-by: adoerr <0xad@gmx.net> --- frame/beefy-mmr/primitives/Cargo.toml | 23 + frame/beefy-mmr/primitives/src/lib.rs | 808 ++++++++++++++++++++++++++ 2 files changed, 831 insertions(+) create mode 100644 frame/beefy-mmr/primitives/Cargo.toml create mode 100644 frame/beefy-mmr/primitives/src/lib.rs diff --git a/frame/beefy-mmr/primitives/Cargo.toml b/frame/beefy-mmr/primitives/Cargo.toml new file mode 100644 index 0000000000000..05a65dfc770b2 --- /dev/null +++ b/frame/beefy-mmr/primitives/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "beefy-merkle-tree" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +description = "A no-std/Substrate compatible library to construct binary merkle tree." + +[dependencies] +hex = { version = "0.4", optional = true } +log = { version = "0.4", optional = true, default-features = false } +tiny-keccak = { version = "2.0.2", features = ["keccak"], optional = true } + +[dev-dependencies] +env_logger = "0.8" +hex = "0.4" +hex-literal = "0.3" + +[features] +debug = ["hex", "log"] +default = ["std", "debug", "keccak"] +keccak = ["tiny-keccak"] +std = ["log/std"] diff --git a/frame/beefy-mmr/primitives/src/lib.rs b/frame/beefy-mmr/primitives/src/lib.rs new file mode 100644 index 0000000000000..3b3912c4f2ed5 --- /dev/null +++ b/frame/beefy-mmr/primitives/src/lib.rs @@ -0,0 +1,808 @@ +// Copyright (C) 2020-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 . + +#![cfg_attr(not(feature = "std"), no_std)] +#![warn(missing_docs)] + +//! This crate implements a simple binary Merkle Tree utilities required for inter-op with Ethereum +//! bridge & Solidity contract. +//! +//! The implementation is optimised for usage within Substrate Runtime and supports no-std +//! compilation targets. +//! +//! Merkle Tree is constructed from arbitrary-length leaves, that are initially hashed using the +//! same [Hasher] as the inner nodes. +//! Inner nodes are created by concatenating child hashes and hashing again. The implementation +//! does not perform any sorting of the input data (leaves) nor when inner nodes are created. +//! +//! If the number of leaves is not even, last leave (hash of) is promoted to the upper layer. + +#[cfg(not(feature = "std"))] +use core::vec::Vec; + +/// Supported hashing output size. +/// +/// The size is restricted to 32 bytes to allow for a more optimised implementation. +pub type Hash = [u8; 32]; + +/// Generic hasher trait. +/// +/// Implement the function to support custom way of hashing data. +/// The implementation must return a [Hash] type, so only 32-byte output hashes are supported. +pub trait Hasher { + /// Hash given arbitrary-length piece of data. + fn hash(data: &[u8]) -> Hash; +} + +#[cfg(feature = "keccak")] +mod keccak256 { + use tiny_keccak::{Hasher as _, Keccak}; + + /// Keccak256 hasher implementation. + pub struct Keccak256; + impl Keccak256 { + /// Hash given data. + pub fn hash(data: &[u8]) -> super::Hash { + ::hash(data) + } + } + impl super::Hasher for Keccak256 { + fn hash(data: &[u8]) -> super::Hash { + let mut keccak = Keccak::v256(); + keccak.update(data); + let mut output = [0_u8; 32]; + keccak.finalize(&mut output); + output + } + } +} +#[cfg(feature = "keccak")] +pub use keccak256::Keccak256; + +/// Construct a root hash of a Binary Merkle Tree created from given leaves. +/// +/// See crate-level docs for details about Merkle Tree construction. +/// +/// In case an empty list of leaves is passed the function returns a 0-filled hash. +pub fn merkle_root(leaves: I) -> Hash +where + H: Hasher, + I: IntoIterator, + T: AsRef<[u8]>, +{ + let iter = leaves.into_iter().map(|l| H::hash(l.as_ref())); + merkelize::(iter, &mut ()) +} + +fn merkelize(leaves: I, visitor: &mut V) -> Hash +where + H: Hasher, + V: Visitor, + I: Iterator, +{ + let upper = Vec::with_capacity(leaves.size_hint().0); + let mut next = match merkelize_row::(leaves, upper, visitor) { + Ok(root) => return root, + Err(next) if next.is_empty() => return Hash::default(), + Err(next) => next, + }; + + let mut upper = Vec::with_capacity((next.len() + 1) / 2); + loop { + visitor.move_up(); + + match merkelize_row::(next.drain(..), upper, visitor) { + Ok(root) => return root, + Err(t) => { + // swap collections to avoid allocations + upper = next; + next = t; + } + }; + } +} + +/// A generated merkle proof. +/// +/// The structure contains all necessary data to later on verify the proof and the leaf itself. +#[derive(Debug, PartialEq, Eq)] +pub struct MerkleProof { + /// Root hash of generated merkle tree. + pub root: Hash, + /// Proof items (does not contain the leaf hash, nor the root obviously). + /// + /// This vec contains all inner node hashes necessary to reconstruct the root hash given the + /// leaf hash. + pub proof: Vec, + /// Number of leaves in the original tree. + /// + /// This is needed to detect a case where we have an odd number of leaves that "get promoted" + /// to upper layers. + pub number_of_leaves: usize, + /// Index of the leaf the proof is for (0-based). + pub leaf_index: usize, + /// Leaf content. + pub leaf: T, +} + +/// A trait of object inspecting merkle root creation. +/// +/// It can be passed to [`merkelize_row`] or [`merkelize`] functions and will be notified +/// about tree traversal. +trait Visitor { + /// We are moving one level up in the tree. + fn move_up(&mut self); + + /// We are creating an inner node from given `left` and `right` nodes. + /// + /// Note that in case of last odd node in the row `right` might be empty. + /// The method will also visit the `root` hash (level 0). + /// + /// The `index` is an index of `left` item. + fn visit(&mut self, index: usize, left: &Option, right: &Option); +} + +/// No-op implementation of the visitor. +impl Visitor for () { + fn move_up(&mut self) {} + fn visit(&mut self, _index: usize, _left: &Option, _right: &Option) {} +} + +/// Construct a Merkle Proof for leaves given by indices. +/// +/// The function constructs a (partial) Merkle Tree first and stores all elements required +/// to prove requested item (leaf) given the root hash. +/// +/// Both the Proof and the Root Hash is returned. +/// +/// # Panic +/// +/// The function will panic if given [`leaf_index`] is greater than the number of leaves. +pub fn merkle_proof(leaves: I, leaf_index: usize) -> MerkleProof +where + H: Hasher, + I: IntoIterator, + I::IntoIter: ExactSizeIterator, + T: AsRef<[u8]>, +{ + let mut leaf = None; + let iter = leaves.into_iter().enumerate().map(|(idx, l)| { + let hash = H::hash(l.as_ref()); + if idx == leaf_index { + leaf = Some(l); + } + hash + }); + + /// The struct collects a proof for single leaf. + struct ProofCollection { + proof: Vec, + position: usize, + } + + impl ProofCollection { + fn new(position: usize) -> Self { + ProofCollection { + proof: Default::default(), + position, + } + } + } + + impl Visitor for ProofCollection { + fn move_up(&mut self) { + self.position /= 2; + } + + fn visit(&mut self, index: usize, left: &Option, right: &Option) { + // we are at left branch - right goes to the proof. + if self.position == index { + if let Some(right) = right { + self.proof.push(*right); + } + } + // we are at right branch - left goes to the proof. + if self.position == index + 1 { + if let Some(left) = left { + self.proof.push(*left); + } + } + } + } + + let number_of_leaves = iter.len(); + let mut collect_proof = ProofCollection::new(leaf_index); + + let root = merkelize::(iter, &mut collect_proof); + let leaf = leaf.expect("Requested `leaf_index` is greater than number of leaves."); + + #[cfg(feature = "debug")] + log::debug!( + "[merkle_proof] Proof: {:?}", + collect_proof.proof.iter().map(hex::encode).collect::>() + ); + + MerkleProof { + root, + proof: collect_proof.proof, + number_of_leaves, + leaf_index, + leaf, + } +} + +/// Leaf node for proof verification. +/// +/// Can be either a value that needs to be hashed first, +/// or the hash itself. +#[derive(Debug, PartialEq, Eq)] +pub enum Leaf<'a> { + /// Leaf content. + Value(&'a [u8]), + /// Hash of the leaf content. + Hash(Hash), +} + +impl<'a, T: AsRef<[u8]>> From<&'a T> for Leaf<'a> { + fn from(v: &'a T) -> Self { + Leaf::Value(v.as_ref()) + } +} + +impl<'a> From for Leaf<'a> { + fn from(v: Hash) -> Self { + Leaf::Hash(v) + } +} + +/// Verify Merkle Proof correctness versus given root hash. +/// +/// The proof is NOT expected to contain leaf hash as the first +/// element, but only all adjacent nodes required to eventually by process of +/// concatenating and hashing end up with given root hash. +/// +/// The proof must not contain the root hash. +pub fn verify_proof<'a, H, P, L>(root: &'a Hash, proof: P, number_of_leaves: usize, leaf_index: usize, leaf: L) -> bool +where + H: Hasher, + P: IntoIterator, + L: Into>, +{ + if leaf_index >= number_of_leaves { + return false; + } + + let leaf_hash = match leaf.into() { + Leaf::Value(content) => H::hash(content), + Leaf::Hash(hash) => hash, + }; + + let mut combined = [0_u8; 64]; + let mut position = leaf_index; + let mut width = number_of_leaves; + let computed = proof.into_iter().fold(leaf_hash, |a, b| { + if position % 2 == 1 || position + 1 == width { + combined[0..32].copy_from_slice(&b); + combined[32..64].copy_from_slice(&a); + } else { + combined[0..32].copy_from_slice(&a); + combined[32..64].copy_from_slice(&b); + } + let hash = H::hash(&combined); + #[cfg(feature = "debug")] + log::debug!( + "[verify_proof]: (a, b) {:?}, {:?} => {:?} ({:?}) hash", + hex::encode(a), + hex::encode(b), + hex::encode(hash), + hex::encode(combined) + ); + position /= 2; + width = ((width - 1) / 2) + 1; + hash + }); + + root == &computed +} + +/// Processes a single row (layer) of a tree by taking pairs of elements, +/// concatenating them, hashing and placing into resulting vector. +/// +/// In case only one element is provided it is returned via `Ok` result, in any other case (also an +/// empty iterator) an `Err` with the inner nodes of upper layer is returned. +fn merkelize_row(mut iter: I, mut next: Vec, visitor: &mut V) -> Result> +where + H: Hasher, + V: Visitor, + I: Iterator, +{ + #[cfg(feature = "debug")] + log::debug!("[merkelize_row]"); + next.clear(); + + let mut index = 0; + let mut combined = [0_u8; 64]; + loop { + let a = iter.next(); + let b = iter.next(); + visitor.visit(index, &a, &b); + + #[cfg(feature = "debug")] + log::debug!( + " {:?}\n {:?}", + a.as_ref().map(hex::encode), + b.as_ref().map(hex::encode) + ); + + index += 2; + match (a, b) { + (Some(a), Some(b)) => { + combined[0..32].copy_from_slice(&a); + combined[32..64].copy_from_slice(&b); + + next.push(H::hash(&combined)); + } + // Odd number of items. Promote the item to the upper layer. + (Some(a), None) if !next.is_empty() => { + next.push(a); + } + // Last item = root. + (Some(a), None) => { + return Ok(a); + } + // Finish up, no more items. + _ => { + #[cfg(feature = "debug")] + log::debug!( + "[merkelize_row] Next: {:?}", + next.iter().map(hex::encode).collect::>() + ); + return Err(next); + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use hex_literal::hex; + + #[test] + fn should_generate_empty_root() { + // given + let _ = env_logger::try_init(); + let data: Vec<[u8; 1]> = Default::default(); + + // when + let out = merkle_root::(data); + + // then + assert_eq!( + hex::encode(&out), + "0000000000000000000000000000000000000000000000000000000000000000" + ); + } + + #[test] + fn should_generate_single_root() { + // given + let _ = env_logger::try_init(); + let data = vec![hex!("E04CC55ebEE1cBCE552f250e85c57B70B2E2625b")]; + + // when + let out = merkle_root::(data); + + // then + assert_eq!( + hex::encode(&out), + "aeb47a269393297f4b0a3c9c9cfd00c7a4195255274cf39d83dabc2fcc9ff3d7" + ); + } + + #[test] + fn should_generate_root_pow_2() { + // given + let _ = env_logger::try_init(); + let data = vec![ + hex!("E04CC55ebEE1cBCE552f250e85c57B70B2E2625b"), + hex!("25451A4de12dcCc2D166922fA938E900fCc4ED24"), + ]; + + // when + let out = merkle_root::(data); + + // then + assert_eq!( + hex::encode(&out), + "697ea2a8fe5b03468548a7a413424a6292ab44a82a6f5cc594c3fa7dda7ce402" + ); + } + + #[test] + fn should_generate_root_complex() { + let _ = env_logger::try_init(); + let test = |root, data| { + assert_eq!(hex::encode(&merkle_root::(data)), root); + }; + + test( + "aff1208e69c9e8be9b584b07ebac4e48a1ee9d15ce3afe20b77a4d29e4175aa3", + vec!["a", "b", "c"], + ); + + test( + "b8912f7269068901f231a965adfefbc10f0eedcfa61852b103efd54dac7db3d7", + vec!["a", "b", "a"], + ); + + test( + "dc8e73fe6903148ff5079baecc043983625c23b39f31537e322cd0deee09fa9c", + vec!["a", "b", "a", "b"], + ); + + test( + "fb3b3be94be9e983ba5e094c9c51a7d96a4fa2e5d8e891df00ca89ba05bb1239", + vec!["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"], + ); + } + + #[test] + fn should_generate_and_verify_proof_simple() { + // given + let _ = env_logger::try_init(); + let data = vec!["a", "b", "c"]; + + // when + let proof0 = merkle_proof::(data.clone(), 0); + assert!(verify_proof::( + &proof0.root, + proof0.proof.clone(), + data.len(), + proof0.leaf_index, + &proof0.leaf, + )); + + let proof1 = merkle_proof::(data.clone(), 1); + assert!(verify_proof::( + &proof1.root, + proof1.proof, + data.len(), + proof1.leaf_index, + &proof1.leaf, + )); + + let proof2 = merkle_proof::(data.clone(), 2); + assert!(verify_proof::( + &proof2.root, + proof2.proof, + data.len(), + proof2.leaf_index, + &proof2.leaf + )); + + // then + assert_eq!(hex::encode(proof0.root), hex::encode(proof1.root)); + assert_eq!(hex::encode(proof2.root), hex::encode(proof1.root)); + + assert!(!verify_proof::( + &hex!("fb3b3be94be9e983ba5e094c9c51a7d96a4fa2e5d8e891df00ca89ba05bb1239"), + proof0.proof, + data.len(), + proof0.leaf_index, + &proof0.leaf + )); + + assert!(!verify_proof::( + &proof0.root, + vec![], + data.len(), + proof0.leaf_index, + &proof0.leaf + )); + } + + #[test] + fn should_generate_and_verify_proof_complex() { + // given + let _ = env_logger::try_init(); + let data = vec!["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]; + + for l in 0..data.len() { + // when + let proof = merkle_proof::(data.clone(), l); + // then + assert!(verify_proof::( + &proof.root, + proof.proof, + data.len(), + proof.leaf_index, + &proof.leaf + )); + } + } + + #[test] + fn should_generate_and_verify_proof_large() { + // given + let _ = env_logger::try_init(); + let mut data = vec![]; + for i in 1..16 { + for c in 'a'..'z' { + if c as usize % i != 0 { + data.push(c.to_string()); + } + } + + for l in 0..data.len() { + // when + let proof = merkle_proof::(data.clone(), l); + // then + assert!(verify_proof::( + &proof.root, + proof.proof, + data.len(), + proof.leaf_index, + &proof.leaf + )); + } + } + } + + #[test] + fn should_generate_and_verify_proof_large_tree() { + // given + let _ = env_logger::try_init(); + let mut data = vec![]; + for i in 0..6000 { + data.push(format!("{}", i)); + } + + for l in (0..data.len()).step_by(13) { + // when + let proof = merkle_proof::(data.clone(), l); + // then + assert!(verify_proof::( + &proof.root, + proof.proof, + data.len(), + proof.leaf_index, + &proof.leaf + )); + } + } + + #[test] + #[should_panic] + fn should_panic_on_invalid_leaf_index() { + let _ = env_logger::try_init(); + merkle_proof::(vec!["a"], 5); + } + + #[test] + fn should_generate_and_verify_proof_on_test_data() { + let addresses = vec![ + "0x9aF1Ca5941148eB6A3e9b9C741b69738292C533f", + "0xDD6ca953fddA25c496165D9040F7F77f75B75002", + "0x60e9C47B64Bc1C7C906E891255EaEC19123E7F42", + "0xfa4859480Aa6D899858DE54334d2911E01C070df", + "0x19B9b128470584F7209eEf65B69F3624549Abe6d", + "0xC436aC1f261802C4494504A11fc2926C726cB83b", + "0xc304C8C2c12522F78aD1E28dD86b9947D7744bd0", + "0xDa0C2Cba6e832E55dE89cF4033affc90CC147352", + "0xf850Fd22c96e3501Aad4CDCBf38E4AEC95622411", + "0x684918D4387CEb5E7eda969042f036E226E50642", + "0x963F0A1bFbb6813C0AC88FcDe6ceB96EA634A595", + "0x39B38ad74b8bCc5CE564f7a27Ac19037A95B6099", + "0xC2Dec7Fdd1fef3ee95aD88EC8F3Cd5bd4065f3C7", + "0x9E311f05c2b6A43C2CCF16fB2209491BaBc2ec01", + "0x927607C30eCE4Ef274e250d0bf414d4a210b16f0", + "0x98882bcf85E1E2DFF780D0eB360678C1cf443266", + "0xFBb50191cd0662049E7C4EE32830a4Cc9B353047", + "0x963854fc2C358c48C3F9F0A598B9572c581B8DEF", + "0xF9D7Bc222cF6e3e07bF66711e6f409E51aB75292", + "0xF2E3fd32D063F8bBAcB9e6Ea8101C2edd899AFe6", + "0x407a5b9047B76E8668570120A96d580589fd1325", + "0xEAD9726FAFB900A07dAd24a43AE941d2eFDD6E97", + "0x42f5C8D9384034A9030313B51125C32a526b6ee8", + "0x158fD2529Bc4116570Eb7C80CC76FEf33ad5eD95", + "0x0A436EE2E4dEF3383Cf4546d4278326Ccc82514E", + "0x34229A215db8FeaC93Caf8B5B255e3c6eA51d855", + "0xEb3B7CF8B1840242CB98A732BA464a17D00b5dDF", + "0x2079692bf9ab2d6dc7D79BBDdEE71611E9aA3B72", + "0x46e2A67e5d450e2Cf7317779f8274a2a630f3C9B", + "0xA7Ece4A5390DAB18D08201aE18800375caD78aab", + "0x15E1c0D24D62057Bf082Cb2253dA11Ef0d469570", + "0xADDEF4C9b5687Eb1F7E55F2251916200A3598878", + "0xe0B16Fb96F936035db2b5A68EB37D470fED2f013", + "0x0c9A84993feaa779ae21E39F9793d09e6b69B62D", + "0x3bc4D5148906F70F0A7D1e2756572655fd8b7B34", + "0xFf4675C26903D5319795cbd3a44b109E7DDD9fDe", + "0xCec4450569A8945C6D2Aba0045e4339030128a92", + "0x85f0584B10950E421A32F471635b424063FD8405", + "0xb38bEe7Bdc0bC43c096e206EFdFEad63869929E3", + "0xc9609466274Fef19D0e58E1Ee3b321D5C141067E", + "0xa08EA868cF75268E7401021E9f945BAe73872ecc", + "0x67C9Cb1A29E964Fe87Ff669735cf7eb87f6868fE", + "0x1B6BEF636aFcdd6085cD4455BbcC93796A12F6E2", + "0x46B37b243E09540b55cF91C333188e7D5FD786dD", + "0x8E719E272f62Fa97da93CF9C941F5e53AA09e44a", + "0xa511B7E7DB9cb24AD5c89fBb6032C7a9c2EfA0a5", + "0x4D11FDcAeD335d839132AD450B02af974A3A66f8", + "0xB8cf790a5090E709B4619E1F335317114294E17E", + "0x7f0f57eA064A83210Cafd3a536866ffD2C5eDCB3", + "0xC03C848A4521356EF800e399D889e9c2A25D1f9E", + "0xC6b03DF05cb686D933DD31fCa5A993bF823dc4FE", + "0x58611696b6a8102cf95A32c25612E4cEF32b910F", + "0x2ed4bC7197AEF13560F6771D930Bf907772DE3CE", + "0x3C5E58f334306be029B0e47e119b8977B2639eb4", + "0x288646a1a4FeeC560B349d210263c609aDF649a6", + "0xb4F4981E0d027Dc2B3c86afA0D0fC03d317e83C0", + "0xaAE4A87F8058feDA3971f9DEd639Ec9189aA2500", + "0x355069DA35E598913d8736E5B8340527099960b8", + "0x3cf5A0F274cd243C0A186d9fCBdADad089821B93", + "0xca55155dCc4591538A8A0ca322a56EB0E4aD03C4", + "0xE824D0268366ec5C4F23652b8eD70D552B1F2b8B", + "0x84C3e9B25AE8a9b39FF5E331F9A597F2DCf27Ca9", + "0xcA0018e278751De10d26539915d9c7E7503432FE", + "0xf13077dE6191D6c1509ac7E088b8BE7Fe656c28b", + "0x7a6bcA1ec9Db506e47ac6FD86D001c2aBc59C531", + "0xeA7f9A2A9dd6Ba9bc93ca615C3Ddf26973146911", + "0x8D0d8577e16F8731d4F8712BAbFa97aF4c453458", + "0xB7a7855629dF104246997e9ACa0E6510df75d0ea", + "0x5C1009BDC70b0C8Ab2e5a53931672ab448C17c89", + "0x40B47D1AfefEF5eF41e0789F0285DE7b1C31631C", + "0x5086933d549cEcEB20652CE00973703CF10Da373", + "0xeb364f6FE356882F92ae9314fa96116Cf65F47d8", + "0xdC4D31516A416cEf533C01a92D9a04bbdb85EE67", + "0x9b36E086E5A274332AFd3D8509e12ca5F6af918d", + "0xBC26394fF36e1673aE0608ce91A53B9768aD0D76", + "0x81B5AB400be9e563fA476c100BE898C09966426c", + "0x9d93C8ae5793054D28278A5DE6d4653EC79e90FE", + "0x3B8E75804F71e121008991E3177fc942b6c28F50", + "0xC6Eb5886eB43dD473f5BB4e21e56E08dA464D9B4", + "0xfdf1277b71A73c813cD0e1a94B800f4B1Db66DBE", + "0xc2ff2cCc98971556670e287Ff0CC39DA795231ad", + "0x76b7E1473f0D0A87E9B4a14E2B179266802740f5", + "0xA7Bc965660a6EF4687CCa4F69A97563163A3C2Ef", + "0xB9C2b47888B9F8f7D03dC1de83F3F55E738CebD3", + "0xEd400162E6Dd6bD2271728FFb04176bF770De94a", + "0xE3E8331156700339142189B6E555DCb2c0962750", + "0xbf62e342Bc7706a448EdD52AE871d9C4497A53b1", + "0xb9d7A1A111eed75714a0AcD2dd467E872eE6B03D", + "0x03942919DFD0383b8c574AB8A701d89fd4bfA69D", + "0x0Ef4C92355D3c8c7050DFeb319790EFCcBE6fe9e", + "0xA6895a3cf0C60212a73B3891948ACEcF1753f25E", + "0x0Ed509239DB59ef3503ded3d31013C983d52803A", + "0xc4CE8abD123BfAFc4deFf37c7D11DeCd5c350EE4", + "0x4A4Bf59f7038eDcd8597004f35d7Ee24a7Bdd2d3", + "0x5769E8e8A2656b5ed6b6e6fa2a2bFAeaf970BB87", + "0xf9E15cCE181332F4F57386687c1776b66C377060", + "0xc98f8d4843D56a46C21171900d3eE538Cc74dbb5", + "0x3605965B47544Ce4302b988788B8195601AE4dEd", + "0xe993BDfdcAac2e65018efeE0F69A12678031c71d", + "0x274fDf8801385D3FAc954BCc1446Af45f5a8304c", + "0xBFb3f476fcD6429F4a475bA23cEFdDdd85c6b964", + "0x806cD16588Fe812ae740e931f95A289aFb4a4B50", + "0xa89488CE3bD9C25C3aF797D1bbE6CA689De79d81", + "0xd412f1AfAcf0Ebf3Cd324593A231Fc74CC488B12", + "0xd1f715b2D7951d54bc31210BbD41852D9BF98Ed1", + "0xf65aD707c344171F467b2ADba3d14f312219cE23", + "0x2971a4b242e9566dEF7bcdB7347f5E484E11919B", + "0x12b113D6827E07E7D426649fBd605f427da52314", + "0x1c6CA45171CDb9856A6C9Dba9c5F1216913C1e97", + "0x11cC6ee1d74963Db23294FCE1E3e0A0555779CeA", + "0x8Aa1C721255CDC8F895E4E4c782D86726b068667", + "0xA2cDC1f37510814485129aC6310b22dF04e9Bbf0", + "0xCf531b71d388EB3f5889F1f78E0d77f6fb109767", + "0xBe703e3545B2510979A0cb0C440C0Fba55c6dCB5", + "0x30a35886F989db39c797D8C93880180Fdd71b0c8", + "0x1071370D981F60c47A9Cd27ac0A61873a372cBB2", + "0x3515d74A11e0Cb65F0F46cB70ecf91dD1712daaa", + "0x50500a3c2b7b1229c6884505D00ac6Be29Aecd0C", + "0x9A223c2a11D4FD3585103B21B161a2B771aDA3d1", + "0xd7218df03AD0907e6c08E707B15d9BD14285e657", + "0x76CfD72eF5f93D1a44aD1F80856797fBE060c70a", + "0x44d093cB745944991EFF5cBa151AA6602d6f5420", + "0x626516DfF43bf09A71eb6fd1510E124F96ED0Cde", + "0x6530824632dfe099304E2DC5701cA99E6d031E08", + "0x57e6c423d6a7607160d6379A0c335025A14DaFC0", + "0x3966D4AD461Ef150E0B10163C81E79b9029E69c3", + "0xF608aCfd0C286E23721a3c347b2b65039f6690F1", + "0xbfB8FAac31A25646681936977837f7740fCd0072", + "0xd80aa634a623a7ED1F069a1a3A28a173061705c7", + "0x9122a77B36363e24e12E1E2D73F87b32926D3dF5", + "0x62562f0d1cD31315bCCf176049B6279B2bfc39C2", + "0x48aBF7A2a7119e5675059E27a7082ba7F38498b2", + "0xb4596983AB9A9166b29517acD634415807569e5F", + "0x52519D16E20BC8f5E96Da6d736963e85b2adA118", + "0x7663893C3dC0850EfC5391f5E5887eD723e51B83", + "0x5FF323a29bCC3B5b4B107e177EccEF4272959e61", + "0xee6e499AdDf4364D75c05D50d9344e9daA5A9AdF", + "0x1631b0BD31fF904aD67dD58994C6C2051CDe4E75", + "0xbc208e9723D44B9811C428f6A55722a26204eEF2", + "0xe76103a222Ee2C7Cf05B580858CEe625C4dc00E1", + "0xC71Bb2DBC51760f4fc2D46D84464410760971B8a", + "0xB4C18811e6BFe564D69E12c224FFc57351f7a7ff", + "0xD11DB0F5b41061A887cB7eE9c8711438844C298A", + "0xB931269934A3D4432c084bAAc3d0de8143199F4f", + "0x070037cc85C761946ec43ea2b8A2d5729908A2a1", + "0x2E34aa8C95Ffdbb37f14dCfBcA69291c55Ba48DE", + "0x052D93e8d9220787c31d6D83f87eC7dB088E998f", + "0x498dAC6C69b8b9ad645217050054840f1D91D029", + "0xE4F7D60f9d84301e1fFFd01385a585F3A11F8E89", + "0xEa637992f30eA06460732EDCBaCDa89355c2a107", + "0x4960d8Da07c27CB6Be48a79B96dD70657c57a6bF", + "0x7e471A003C8C9fdc8789Ded9C3dbe371d8aa0329", + "0xd24265Cc10eecb9e8d355CCc0dE4b11C556E74D7", + "0xDE59C8f7557Af779674f41CA2cA855d571018690", + "0x2fA8A6b3b6226d8efC9d8f6EBDc73Ca33DDcA4d8", + "0xe44102664c6c2024673Ff07DFe66E187Db77c65f", + "0x94E3f4f90a5f7CBF2cc2623e66B8583248F01022", + "0x0383EdBbc21D73DEd039E9C1Ff6bf56017b4CC40", + "0x64C3E49898B88d1E0f0d02DA23E0c00A2Cd0cA99", + "0xF4ccfB67b938d82B70bAb20975acFAe402E812E1", + "0x4f9ee5829e9852E32E7BC154D02c91D8E203e074", + "0xb006312eF9713463bB33D22De60444Ba95609f6B", + "0x7Cbe76ef69B52110DDb2e3b441C04dDb11D63248", + "0x70ADEEa65488F439392B869b1Df7241EF317e221", + "0x64C0bf8AA36Ba590477585Bc0D2BDa7970769463", + "0xA4cDc98593CE52d01Fe5Ca47CB3dA5320e0D7592", + "0xc26B34D375533fFc4c5276282Fa5D660F3d8cbcB", + ]; + let root = hex!("72b0acd7c302a84f1f6b6cefe0ba7194b7398afb440e1b44a9dbbe270394ca53"); + + let data = addresses + .into_iter() + .map(|address| hex::decode(&address[2..]).unwrap()) + .collect::>(); + + for l in 0..data.len() { + // when + let proof = merkle_proof::(data.clone(), l); + assert_eq!(hex::encode(&proof.root), hex::encode(&root)); + assert_eq!(proof.leaf_index, l); + assert_eq!(&proof.leaf, &data[l]); + + // then + assert!(verify_proof::( + &proof.root, + proof.proof, + data.len(), + proof.leaf_index, + &proof.leaf + )); + } + + let proof = merkle_proof::(data.clone(), data.len() - 1); + + assert_eq!( + proof, + MerkleProof { + root, + proof: vec![ + hex!("340bcb1d49b2d82802ddbcf5b85043edb3427b65d09d7f758fbc76932ad2da2f"), + hex!("ba0580e5bd530bc93d61276df7969fb5b4ae8f1864b4a28c280249575198ff1f"), + hex!("d02609d2bbdb28aa25f58b85afec937d5a4c85d37925bce6d0cf802f9d76ba79"), + hex!("ae3f8991955ed884613b0a5f40295902eea0e0abe5858fc520b72959bc016d4e"), + ], + number_of_leaves: data.len(), + leaf_index: data.len() - 1, + leaf: hex!("c26B34D375533fFc4c5276282Fa5D660F3d8cbcB").to_vec(), + } + ); + } +} From 5a89c81966dd22f9f1af7b1226f4db10f5991ea5 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Tue, 13 Jul 2021 13:46:50 +0200 Subject: [PATCH 073/109] Bump Substrate and Deps (#235) --- frame/beefy/src/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index 9b82e6b805161..15cac3218b5c5 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -60,7 +60,7 @@ parameter_types! { } impl frame_system::Config for Test { - type BaseCallFilter = (); + type BaseCallFilter = frame_support::traits::AllowAll; type BlockWeights = (); type BlockLength = (); type DbWeight = (); From 3f5de1014d0839507967e2a8cd296dc2d87c5108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Wed, 14 Jul 2021 15:15:27 +0200 Subject: [PATCH 074/109] BEEFY+MMR pallet (#236) * Add MMR leaf format to primitives. * Fix tests * Initial work on the BEEFY-MMR pallet. * Add tests to MMR pallet. * Use eth addresses. * Use binary merkle tree. * Bump libsecp256k1 * Fix compilation. * Bump deps. * Appease cargo deny. * Re-format. * Module-level docs. * no-std fix. * update README Co-authored-by: adoerr <0xad@gmx.net> --- frame/beefy-mmr/Cargo.toml | 55 +++++++ frame/beefy-mmr/primitives/Cargo.toml | 4 +- frame/beefy-mmr/primitives/src/lib.rs | 4 +- frame/beefy-mmr/src/lib.rs | 225 ++++++++++++++++++++++++++ frame/beefy-mmr/src/mock.rs | 205 +++++++++++++++++++++++ frame/beefy-mmr/src/tests.rs | 139 ++++++++++++++++ primitives/beefy/src/lib.rs | 1 + primitives/beefy/src/mmr.rs | 130 +++++++++++++++ 8 files changed, 760 insertions(+), 3 deletions(-) create mode 100644 frame/beefy-mmr/Cargo.toml create mode 100644 frame/beefy-mmr/src/lib.rs create mode 100644 frame/beefy-mmr/src/mock.rs create mode 100644 frame/beefy-mmr/src/tests.rs create mode 100644 primitives/beefy/src/mmr.rs diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml new file mode 100644 index 0000000000000..c1e694009edb5 --- /dev/null +++ b/frame/beefy-mmr/Cargo.toml @@ -0,0 +1,55 @@ +[package] +name = "pallet-beefy-mmr" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +description = "BEEFY + MMR runtime utilities" + +[dependencies] +hex = { version = "0.4", optional = true } +codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +libsecp256k1 = { version = "0.3.5", default-features = false } +log = { version = "0.4.13", default-features = false } +serde = { version = "1.0.126", optional = true } + +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-mmr = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +beefy-merkle-tree = { path = "../beefy-merkle-tree", default-features = false } +beefy-primitives = { path = "../beefy-primitives", default-features = false } +pallet-beefy = { path = "../beefy-pallet", default-features = false } + +[dev-dependencies] +sp-staking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +hex = "0.4" +hex-literal = "0.3" + +[features] +default = ["std"] +std = [ + "beefy-merkle-tree/std", + "beefy-primitives/std", + "codec/std", + "frame-support/std", + "frame-system/std", + "hex", + "libsecp256k1/std", + "log/std", + "pallet-beefy/std", + "pallet-mmr-primitives/std", + "pallet-mmr/std", + "pallet-session/std", + "serde", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", +] diff --git a/frame/beefy-mmr/primitives/Cargo.toml b/frame/beefy-mmr/primitives/Cargo.toml index 05a65dfc770b2..05c812d5c709e 100644 --- a/frame/beefy-mmr/primitives/Cargo.toml +++ b/frame/beefy-mmr/primitives/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" description = "A no-std/Substrate compatible library to construct binary merkle tree." [dependencies] -hex = { version = "0.4", optional = true } +hex = { version = "0.4", optional = true, default-features = false } log = { version = "0.4", optional = true, default-features = false } tiny-keccak = { version = "2.0.2", features = ["keccak"], optional = true } @@ -20,4 +20,4 @@ hex-literal = "0.3" debug = ["hex", "log"] default = ["std", "debug", "keccak"] keccak = ["tiny-keccak"] -std = ["log/std"] +std = [] diff --git a/frame/beefy-mmr/primitives/src/lib.rs b/frame/beefy-mmr/primitives/src/lib.rs index 3b3912c4f2ed5..8fc72ee05e0b5 100644 --- a/frame/beefy-mmr/primitives/src/lib.rs +++ b/frame/beefy-mmr/primitives/src/lib.rs @@ -31,7 +31,9 @@ //! If the number of leaves is not even, last leave (hash of) is promoted to the upper layer. #[cfg(not(feature = "std"))] -use core::vec::Vec; +extern crate alloc; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; /// Supported hashing output size. /// diff --git a/frame/beefy-mmr/src/lib.rs b/frame/beefy-mmr/src/lib.rs new file mode 100644 index 0000000000000..8a151cce89094 --- /dev/null +++ b/frame/beefy-mmr/src/lib.rs @@ -0,0 +1,225 @@ +// Copyright (C) 2020-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 . + +#![cfg_attr(not(feature = "std"), no_std)] +#![warn(missing_docs)] + +//! A BEEFY+MMR pallet combo. +//! +//! While both BEEFY and Merkle Mountain Range (MMR) can be used separately, +//! these tools were designed to work together in unison. +//! +//! The pallet provides a standardized MMR Leaf format that is can be used +//! to bridge BEEFY+MMR-based networks (both standalone and polkadot-like). +//! +//! The MMR leaf contains: +//! 1. Block number and parent block hash. +//! 2. Merkle Tree Root Hash of next BEEFY validator set. +//! 3. Merkle Tree Root Hash of current parachain heads state. +//! +//! and thanks to versioning can be easily updated in the future. + +use beefy_primitives::mmr::{BeefyNextAuthoritySet, MmrLeaf, MmrLeafVersion}; +use codec::Encode; +use frame_support::traits::Get; +use pallet_mmr::primitives::LeafDataProvider; +use sp_runtime::traits::{Convert, Hash}; +use sp_std::prelude::*; + +pub use pallet::*; + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +/// A BEEFY consensus digest item with MMR root hash. +pub struct DepositBeefyDigest(sp_std::marker::PhantomData); + +impl pallet_mmr::primitives::OnNewRoot for DepositBeefyDigest +where + T: pallet_mmr::Config, + T: pallet_beefy::Config, +{ + fn on_new_root(root: &::Hash) { + let digest = sp_runtime::generic::DigestItem::Consensus( + beefy_primitives::BEEFY_ENGINE_ID, + codec::Encode::encode( + &beefy_primitives::ConsensusLog::<::BeefyId>::MmrRoot(*root), + ), + ); + >::deposit_log(digest); + } +} + +/// Convert BEEFY secp256k1 public keys into Ethereum addresses +pub struct BeefyEcdsaToEthereum; +impl Convert> for BeefyEcdsaToEthereum { + fn convert(a: beefy_primitives::crypto::AuthorityId) -> Vec { + use sp_core::crypto::Public; + let compressed_key = a.as_slice(); + + secp256k1::PublicKey::parse_slice(compressed_key, Some(secp256k1::PublicKeyFormat::Compressed)) + // uncompress the key + .map(|pub_key| pub_key.serialize().to_vec()) + // now convert to ETH address + .map(|uncompressed| sp_io::hashing::keccak_256(&uncompressed[1..])[12..].to_vec()) + .map_err(|_| { + log::error!(target: "runtime::beefy", "Invalid BEEFY PublicKey format!"); + }) + .unwrap_or_default() + } +} + +type MerkleRootOf = ::Hash; +type ParaId = u32; +type ParaHead = Vec; + +/// A type that is able to return current list of parachain heads that end up in the MMR leaf. +pub trait ParachainHeadsProvider { + /// Return a list of tuples containing a `ParaId` and Parachain Header data (ParaHead). + /// + /// The returned data does not have to be sorted. + fn parachain_heads() -> Vec<(ParaId, ParaHead)>; +} + +/// A default implementation for runtimes without parachains. +impl ParachainHeadsProvider for () { + fn parachain_heads() -> Vec<(ParaId, ParaHead)> { + Default::default() + } +} + +#[frame_support::pallet] +pub mod pallet { + #![allow(missing_docs)] + + use super::*; + use frame_support::pallet_prelude::*; + + /// BEEFY-MMR pallet. + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + /// The module's configuration trait. + #[pallet::config] + #[pallet::disable_frame_system_supertrait_check] + pub trait Config: pallet_mmr::Config + pallet_beefy::Config { + /// Current leaf version. + /// + /// Specifies the version number added to every leaf that get's appended to the MMR. + /// Read more in [`MmrLeafVersion`] docs about versioning leaves. + type LeafVersion: Get; + + /// Convert BEEFY AuthorityId to a form that would end up in the Merkle Tree. + /// + /// For instance for ECDSA (secp256k1) we want to store uncompressed public keys (65 bytes) + /// and later to Ethereum Addresses (160 bits) to simplify using them on Ethereum chain, + /// but the rest of the Substrate codebase is storing them compressed (33 bytes) for + /// efficiency reasons. + type BeefyAuthorityToMerkleLeaf: Convert<::BeefyId, Vec>; + + /// Retrieve a list of current parachain heads. + /// + /// The trait is implemented for `paras` module, but since not all chains might have parachains, + /// and we want to keep the MMR leaf structure uniform, it's possible to use `()` as well to + /// simply put dummy data to the leaf. + type ParachainHeads: ParachainHeadsProvider; + } + + /// Details of next BEEFY authority set. + /// + /// This storage entry is used as cache for calls to [`update_beefy_next_authority_set`]. + #[pallet::storage] + #[pallet::getter(fn beefy_next_authorities)] + pub type BeefyNextAuthorities = StorageValue<_, BeefyNextAuthoritySet>, ValueQuery>; +} + +impl LeafDataProvider for Pallet +where + MerkleRootOf: From + Into, +{ + type LeafData = + MmrLeaf<::BlockNumber, ::Hash, MerkleRootOf>; + + fn leaf_data() -> Self::LeafData { + MmrLeaf { + version: T::LeafVersion::get(), + parent_number_and_hash: frame_system::Pallet::::leaf_data(), + parachain_heads: Pallet::::parachain_heads_merkle_root(), + beefy_next_authority_set: Pallet::::update_beefy_next_authority_set(), + } + } +} + +impl beefy_merkle_tree::Hasher for Pallet +where + MerkleRootOf: Into, +{ + fn hash(data: &[u8]) -> beefy_merkle_tree::Hash { + ::Hashing::hash(data).into() + } +} + +impl Pallet +where + MerkleRootOf: From + Into, +{ + /// Returns latest root hash of a merkle tree constructed from all active parachain headers. + /// + /// The leafs are sorted by `ParaId` to allow more efficient lookups and non-existence proofs. + /// + /// NOTE this does not include parathreads - only parachains are part of the merkle tree. + /// + /// NOTE This is an initial and inefficient implementation, which re-constructs + /// the merkle tree every block. Instead we should update the merkle root in [Self::on_initialize] + /// call of this pallet and update the merkle tree efficiently (use on-chain storage to persist inner nodes). + fn parachain_heads_merkle_root() -> MerkleRootOf { + let mut para_heads = T::ParachainHeads::parachain_heads(); + para_heads.sort(); + let para_heads = para_heads.into_iter().map(|pair| pair.encode()); + beefy_merkle_tree::merkle_root::(para_heads).into() + } + + /// Returns details of the next BEEFY authority set. + /// + /// Details contain authority set id, authority set length and a merkle root, + /// constructed from uncompressed secp256k1 public keys converted to Ethereum addresses + /// of the next BEEFY authority set. + /// + /// This function will use a storage-cached entry in case the set didn't change, or compute and cache + /// new one in case it did. + fn update_beefy_next_authority_set() -> BeefyNextAuthoritySet> { + let id = pallet_beefy::Pallet::::validator_set_id() + 1; + let current_next = Self::beefy_next_authorities(); + // avoid computing the merkle tree if validator set id didn't change. + if id == current_next.id { + return current_next; + } + + let beefy_addresses = pallet_beefy::Pallet::::next_authorities() + .into_iter() + .map(T::BeefyAuthorityToMerkleLeaf::convert) + .collect::>(); + let len = beefy_addresses.len() as u32; + let root = beefy_merkle_tree::merkle_root::(beefy_addresses).into(); + let next_set = BeefyNextAuthoritySet { id, len, root }; + // cache the result + BeefyNextAuthorities::::put(&next_set); + next_set + } +} diff --git a/frame/beefy-mmr/src/mock.rs b/frame/beefy-mmr/src/mock.rs new file mode 100644 index 0000000000000..5553a3c862172 --- /dev/null +++ b/frame/beefy-mmr/src/mock.rs @@ -0,0 +1,205 @@ +// Copyright (C) 2020 - 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 . + +// construct_runtime requires this +#![allow(clippy::from_over_into)] + +use std::vec; + +use beefy_primitives::mmr::MmrLeafVersion; +use frame_support::{construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities}; +use sp_core::{Hasher, H256}; +use sp_runtime::{ + app_crypto::ecdsa::Public, + impl_opaque_keys, + testing::Header, + traits::{BlakeTwo256, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys}, + Perbill, +}; + +use crate as pallet_beefy_mmr; + +pub use beefy_primitives::{crypto::AuthorityId as BeefyId, ConsensusLog, BEEFY_ENGINE_ID}; + +impl_opaque_keys! { + pub struct MockSessionKeys { + pub dummy: pallet_beefy::Pallet, + } +} + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Session: pallet_session::{Pallet, Call, Storage, Event, Config}, + Mmr: pallet_mmr::{Pallet, Call, Storage}, + Beefy: pallet_beefy::{Pallet, Config, Storage}, + BeefyMmr: pallet_beefy_mmr::{Pallet, Storage}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl frame_system::Config for Test { + type BaseCallFilter = frame_support::traits::AllowAll; + 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 = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); +} + +parameter_types! { + pub const Period: u64 = 1; + pub const Offset: u64 = 0; + pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33); +} + +impl pallet_session::Config for Test { + type Event = Event; + type ValidatorId = u64; + type ValidatorIdOf = ConvertInto; + type ShouldEndSession = pallet_session::PeriodicSessions; + type NextSessionRotation = pallet_session::PeriodicSessions; + type SessionManager = MockSessionManager; + type SessionHandler = ::KeyTypeIdProviders; + type Keys = MockSessionKeys; + type DisabledValidatorsThreshold = DisabledValidatorsThreshold; + type WeightInfo = (); +} + +pub type MmrLeaf = beefy_primitives::mmr::MmrLeaf< + ::BlockNumber, + ::Hash, + ::Hash, +>; + +impl pallet_mmr::Config for Test { + const INDEXING_PREFIX: &'static [u8] = b"mmr"; + + type Hashing = Keccak256; + + type Hash = ::Out; + + type LeafData = BeefyMmr; + + type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest; + + type WeightInfo = (); +} + +impl pallet_beefy::Config for Test { + type BeefyId = BeefyId; +} + +parameter_types! { + pub LeafVersion: MmrLeafVersion = MmrLeafVersion::new(1, 5); +} + +impl pallet_beefy_mmr::Config for Test { + type LeafVersion = LeafVersion; + + type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum; + + type ParachainHeads = DummyParaHeads; +} + +pub struct DummyParaHeads; +impl pallet_beefy_mmr::ParachainHeadsProvider for DummyParaHeads { + fn parachain_heads() -> Vec<(pallet_beefy_mmr::ParaId, pallet_beefy_mmr::ParaHead)> { + vec![(15, vec![1, 2, 3]), (5, vec![4, 5, 6])] + } +} + +pub struct MockSessionManager; +impl pallet_session::SessionManager for MockSessionManager { + fn end_session(_: sp_staking::SessionIndex) {} + fn start_session(_: sp_staking::SessionIndex) {} + fn new_session(idx: sp_staking::SessionIndex) -> Option> { + if idx == 0 || idx == 1 { + Some(vec![1, 2]) + } else if idx == 2 { + Some(vec![3, 4]) + } else { + None + } + } +} + +// Note, that we can't use `UintAuthorityId` here. Reason is that the implementation +// of `to_public_key()` assumes, that a public key is 32 bytes long. This is true for +// ed25519 and sr25519 but *not* for ecdsa. An ecdsa public key is 33 bytes. +pub fn mock_beefy_id(id: u8) -> BeefyId { + let buf: [u8; 33] = [id; 33]; + let pk = Public::from_raw(buf); + BeefyId::from(pk) +} + +pub fn mock_authorities(vec: Vec) -> Vec<(u64, BeefyId)> { + vec.into_iter().map(|id| ((id as u64), mock_beefy_id(id))).collect() +} + +pub fn new_test_ext(ids: Vec) -> TestExternalities { + new_test_ext_raw_authorities(mock_authorities(ids)) +} + +pub fn new_test_ext_raw_authorities(authorities: Vec<(u64, BeefyId)>) -> TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + let session_keys: Vec<_> = authorities + .iter() + .enumerate() + .map(|(_, id)| (id.0 as u64, id.0 as u64, MockSessionKeys { dummy: id.1.clone() })) + .collect(); + + BasicExternalities::execute_with_storage(&mut t, || { + for (ref id, ..) in &session_keys { + frame_system::Pallet::::inc_providers(id); + } + }); + + pallet_session::GenesisConfig:: { keys: session_keys } + .assimilate_storage(&mut t) + .unwrap(); + + t.into() +} diff --git a/frame/beefy-mmr/src/tests.rs b/frame/beefy-mmr/src/tests.rs new file mode 100644 index 0000000000000..c64cb6a21b27d --- /dev/null +++ b/frame/beefy-mmr/src/tests.rs @@ -0,0 +1,139 @@ +// Copyright (C) 2020 - 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::vec; + +use beefy_primitives::{ + mmr::{BeefyNextAuthoritySet, MmrLeafVersion}, + ValidatorSet, +}; +use codec::{Decode, Encode}; +use hex_literal::hex; + +use sp_core::H256; +use sp_io::TestExternalities; +use sp_runtime::{traits::Keccak256, DigestItem}; + +use frame_support::traits::OnInitialize; + +use crate::mock::*; + +fn init_block(block: u64) { + System::set_block_number(block); + Session::on_initialize(block); + Mmr::on_initialize(block); + Beefy::on_initialize(block); + BeefyMmr::on_initialize(block); +} + +pub fn beefy_log(log: ConsensusLog) -> DigestItem { + DigestItem::Consensus(BEEFY_ENGINE_ID, log.encode()) +} + +fn offchain_key(pos: usize) -> Vec { + (::INDEXING_PREFIX, pos as u64).encode() +} + +fn read_mmr_leaf(ext: &mut TestExternalities, index: usize) -> MmrLeaf { + type Node = pallet_mmr_primitives::DataOrHash; + ext.persist_offchain_overlay(); + let offchain_db = ext.offchain_db(); + offchain_db + .get(&offchain_key(index)) + .map(|d| Node::decode(&mut &*d).unwrap()) + .map(|n| match n { + Node::Data(d) => d, + _ => panic!("Unexpected MMR node."), + }) + .unwrap() +} + +#[test] +fn should_contain_mmr_digest() { + let mut ext = new_test_ext(vec![1, 2, 3, 4]); + ext.execute_with(|| { + init_block(1); + + assert_eq!( + System::digest().logs, + vec![beefy_log(ConsensusLog::MmrRoot( + hex!("f3e3afbfa69e89cd1e99f8d3570155962f3346d1d8758dc079be49ef70387758").into() + ))] + ); + + // unique every time + init_block(2); + + assert_eq!( + System::digest().logs, + vec![ + beefy_log(ConsensusLog::MmrRoot( + hex!("f3e3afbfa69e89cd1e99f8d3570155962f3346d1d8758dc079be49ef70387758").into() + )), + beefy_log(ConsensusLog::AuthoritiesChange(ValidatorSet { + validators: vec![mock_beefy_id(3), mock_beefy_id(4),], + id: 1, + })), + beefy_log(ConsensusLog::MmrRoot( + hex!("7d4ae4524bae75d52b63f08eab173b0c263eb95ae2c55c3a1d871241bd0cc559").into() + )), + ] + ); + }); +} + +#[test] +fn should_contain_valid_leaf_data() { + let mut ext = new_test_ext(vec![1, 2, 3, 4]); + ext.execute_with(|| { + init_block(1); + }); + + let mmr_leaf = read_mmr_leaf(&mut ext, 0); + assert_eq!( + mmr_leaf, + MmrLeaf { + version: MmrLeafVersion::new(1, 5), + parent_number_and_hash: (0_u64, H256::repeat_byte(0x45)), + beefy_next_authority_set: BeefyNextAuthoritySet { + id: 1, + len: 2, + root: hex!("01b1a742589773fc054c8f5021a456316ffcec0370b25678b0696e116d1ef9ae").into(), + }, + parachain_heads: hex!("ed893c8f8cc87195a5d4d2805b011506322036bcace79642aa3e94ab431e442e").into(), + } + ); + + // build second block on top + ext.execute_with(|| { + init_block(2); + }); + + let mmr_leaf = read_mmr_leaf(&mut ext, 1); + assert_eq!( + mmr_leaf, + MmrLeaf { + version: MmrLeafVersion::new(1, 5), + parent_number_and_hash: (1_u64, H256::repeat_byte(0x45)), + beefy_next_authority_set: BeefyNextAuthoritySet { + id: 2, + len: 2, + root: hex!("9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5").into(), + }, + parachain_heads: hex!("ed893c8f8cc87195a5d4d2805b011506322036bcace79642aa3e94ab431e442e").into(), + } + ); +} diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 0272775dbd83a..16432fd4a8052 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -33,6 +33,7 @@ //! while GRANDPA uses `ed25519`. mod commitment; +pub mod mmr; pub mod witness; pub use commitment::{Commitment, SignedCommitment, VersionedCommitment}; diff --git a/primitives/beefy/src/mmr.rs b/primitives/beefy/src/mmr.rs new file mode 100644 index 0000000000000..e3e1b6a79c4e9 --- /dev/null +++ b/primitives/beefy/src/mmr.rs @@ -0,0 +1,130 @@ +// Copyright (C) 2020 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 . + +//! BEEFY + MMR utilties. +//! +//! While BEEFY can be used completely indepentently as an additional consensus gadget, +//! it is designed around a main use case of making bridging standalone networks together. +//! For that use case it's common to use some aggregated data structure (like MMR) to be +//! used in conjunction with BEEFY, to be able to efficiently prove any past blockchain data. +//! +//! This module contains primitives used by Polkadot implementation of the BEEFY+MMR bridge, +//! but we imagine they will be useful for other chains that either want to bridge with Polkadot +//! or are completely standalone, but heavily inspired by Polkadot. + +use codec::{Decode, Encode}; + +/// A standard leaf that gets added every block to the MMR constructed by Substrate's `pallet_mmr`. +#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)] +pub struct MmrLeaf { + /// Version of the leaf format. + /// + /// Can be used to enable future format migrations and compatibility. + /// See [`MmrLeafVersion`] documentation for details. + pub version: MmrLeafVersion, + /// Current block parent number and hash. + pub parent_number_and_hash: (BlockNumber, Hash), + /// A merkle root of the next BEEFY authority set. + pub beefy_next_authority_set: BeefyNextAuthoritySet, + /// A merkle root of all registered parachain heads. + pub parachain_heads: MerkleRoot, +} + +/// A MMR leaf versioning scheme. +/// +/// Version is a single byte that constist of two components: +/// - `major` - 3 bits +/// - `minor` - 5 bits +/// +/// Any change in encoding that adds new items to the structure is considered non-breaking, hence +/// only requires an update of `minor` version. Any backward incompatible change (i.e. decoding to a +/// previous leaf format fails) should be indicated with `major` version bump. +/// +/// Given that adding new struct elements in SCALE is backward compatible (i.e. old format can be +/// still decoded, the new fields will simply be ignored). We expect the major version to be bumped +/// very rarely (hopefuly never). +#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode)] +pub struct MmrLeafVersion(u8); +impl MmrLeafVersion { + /// Create new version object from `major` and `minor` components. + /// + /// Panics if any of the component occupies more than 4 bits. + pub fn new(major: u8, minor: u8) -> Self { + if major > 0b111 || minor > 0b11111 { + panic!("Version components are too big."); + } + let version = (major << 5) + minor; + Self(version) + } + + /// Split the version into `major` and `minor` sub-components. + pub fn split(&self) -> (u8, u8) { + let major = self.0 >> 5; + let minor = self.0 & 0b11111; + (major, minor) + } +} + +/// Details of the next BEEFY authority set. +#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode)] +pub struct BeefyNextAuthoritySet { + /// Id of the next set. + /// + /// Id is required to correlate BEEFY signed commitments with the validator set. + /// Light Client can easily verify that the commitment witness it is getting is + /// produced by the latest validator set. + pub id: crate::ValidatorSetId, + /// Number of validators in the set. + /// + /// Some BEEFY Light Clients may use an interactive protocol to verify only subset + /// of signatures. We put set length here, so that these clients can verify the minimal + /// number of required signatures. + pub len: u32, + /// Merkle Root Hash build from BEEFY AuthorityIds. + /// + /// This is used by Light Clients to confirm that the commitments are signed by the correct + /// validator set. Light Clients using interactive protocol, might verify only subset of + /// signatures, hence don't require the full list here (will receive inclusion proofs). + pub root: MerkleRoot, +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn should_construct_version_correctly() { + let tests = vec![(0, 0, 0b00000000), (7, 2, 0b11100010), (7, 31, 0b11111111)]; + + for (major, minor, version) in tests { + let v = MmrLeafVersion::new(major, minor); + assert_eq!(v.encode(), vec![version], "Encoding does not match."); + assert_eq!(v.split(), (major, minor)); + } + } + + #[test] + #[should_panic] + fn should_panic_if_major_too_large() { + MmrLeafVersion::new(8, 0); + } + + #[test] + #[should_panic] + fn should_panic_if_minor_too_large() { + MmrLeafVersion::new(0, 32); + } +} From 40f23abe07369698615d6b00f232fd5fadcfc814 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 14 Jul 2021 23:40:24 +0200 Subject: [PATCH 075/109] Fix noting rounds for non-authorities (#238) --- client/beefy/src/gossip.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index c2cd2b2c066a4..7aa473dcb4db5 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -14,17 +14,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use codec::{Decode, Encode}; -use log::{debug, trace}; -use parking_lot::RwLock; use std::collections::BTreeMap; use sc_network::PeerId; use sc_network_gossip::{MessageIntent, ValidationResult, Validator, ValidatorContext}; - use sp_core::hashing::twox_64; use sp_runtime::traits::{Block, Hash, Header, NumberFor}; +use codec::{Decode, Encode}; +use log::{debug, trace}; +use parking_lot::RwLock; + use beefy_primitives::{ crypto::{Public, Signature}, MmrRootHash, VoteMessage, @@ -103,8 +103,21 @@ where known_votes.get_mut(round).map(|known| known.insert(hash)); } + // Note that we will always keep the most recent unseen round alive. + // + // This is a preliminary fix and the detailed description why we are + // doing this can be found as part of the issue below + // + // https://github.com/paritytech/grandpa-bridge-gadget/issues/237 + // fn is_live(known_votes: &KnownVotes, round: &NumberFor) -> bool { - known_votes.contains_key(round) + let unseen_round = if let Some(max_known_round) = known_votes.keys().last() { + round > max_known_round + } else { + known_votes.is_empty() + }; + + known_votes.contains_key(round) || unseen_round } fn is_known(known_votes: &KnownVotes, round: &NumberFor, hash: &MessageHash) -> bool { From 03092f8f47f3415478d973e16efc7fe917490c23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Jul 2021 05:37:55 +0200 Subject: [PATCH 076/109] Bump env_logger from 0.8.4 to 0.9.0 (#242) Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.8.4 to 0.9.0. - [Release notes](https://github.com/env-logger-rs/env_logger/releases) - [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md) - [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.4...v0.9.0) --- updated-dependencies: - dependency-name: env_logger dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frame/beefy-mmr/primitives/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/beefy-mmr/primitives/Cargo.toml b/frame/beefy-mmr/primitives/Cargo.toml index 05c812d5c709e..362227963387c 100644 --- a/frame/beefy-mmr/primitives/Cargo.toml +++ b/frame/beefy-mmr/primitives/Cargo.toml @@ -12,7 +12,7 @@ log = { version = "0.4", optional = true, default-features = false } tiny-keccak = { version = "2.0.2", features = ["keccak"], optional = true } [dev-dependencies] -env_logger = "0.8" +env_logger = "0.9" hex = "0.4" hex-literal = "0.3" From 66a2ada5e408a81c63cc02826d76c7a29a0d5412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Mon, 19 Jul 2021 18:29:59 +0100 Subject: [PATCH 077/109] gadget: add global timeout for rebroadcasting messages (#243) * gadget: add global timeout for rebroadcasting messages * update rustfmt.toml * make message_allowed() a debug trace Co-authored-by: adoerr <0xad@gmx.net> --- client/beefy/Cargo.toml | 1 + client/beefy/src/gossip.rs | 29 +++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index ac6c6836dcadc..e4b83eaf210dd 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -12,6 +12,7 @@ hex = "0.4" log = "0.4" parking_lot = "0.11" thiserror = "1.0" +wasm-timer = "0.2.5" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master"} diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index 7aa473dcb4db5..8244a089e2df4 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::collections::BTreeMap; +use std::{collections::BTreeMap, time::Duration}; use sc_network::PeerId; use sc_network_gossip::{MessageIntent, ValidationResult, Validator, ValidatorContext}; @@ -23,7 +23,8 @@ use sp_runtime::traits::{Block, Hash, Header, NumberFor}; use codec::{Decode, Encode}; use log::{debug, trace}; -use parking_lot::RwLock; +use parking_lot::{Mutex, RwLock}; +use wasm_timer::Instant; use beefy_primitives::{ crypto::{Public, Signature}, @@ -35,6 +36,9 @@ use crate::keystore::BeefyKeystore; // Limit BEEFY gossip by keeping only a bound number of voting rounds alive. const MAX_LIVE_GOSSIP_ROUNDS: usize = 3; +// Timeout for rebroadcasting messages. +const REBROADCAST_AFTER: Duration = Duration::from_secs(60 * 5); + /// Gossip engine messages topic pub(crate) fn topic() -> B::Hash where @@ -62,6 +66,7 @@ where { topic: B::Hash, known_votes: RwLock>, + next_rebroadcast: Mutex, } impl GossipValidator @@ -72,6 +77,7 @@ where GossipValidator { topic: topic::(), known_votes: RwLock::new(BTreeMap::new()), + next_rebroadcast: Mutex::new(Instant::now() + REBROADCAST_AFTER), } } @@ -188,8 +194,23 @@ where #[allow(clippy::type_complexity)] fn message_allowed<'a>(&'a self) -> Box bool + 'a> { + let do_rebroadcast = { + let now = Instant::now(); + let mut next_rebroadcast = self.next_rebroadcast.lock(); + if now >= *next_rebroadcast { + *next_rebroadcast = now + REBROADCAST_AFTER; + true + } else { + false + } + }; + let known_votes = self.known_votes.read(); - Box::new(move |_who, _intent, _topic, mut data| { + Box::new(move |_who, intent, _topic, mut data| { + if let MessageIntent::PeriodicRebroadcast = intent { + return do_rebroadcast; + } + let msg = match VoteMessage::, Public, Signature>::decode(&mut data) { Ok(vote) => vote, Err(_) => return true, @@ -198,7 +219,7 @@ where let round = msg.commitment.block_number; let allowed = GossipValidator::::is_live(&known_votes, &round); - trace!(target: "beefy", "🥩 Message for round #{} allowed: {}", round, allowed); + debug!(target: "beefy", "🥩 Message for round #{} allowed: {}", round, allowed); allowed }) From 71141478eab7670dfdd90578a11898fdcc948024 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Fri, 23 Jul 2021 10:10:46 +0200 Subject: [PATCH 078/109] Bump Substrate and Deps (#245) * Bump Substrate and Deps * Bump Substrate again --- frame/beefy-mmr/src/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/beefy-mmr/src/mock.rs b/frame/beefy-mmr/src/mock.rs index 5553a3c862172..a0813807558c5 100644 --- a/frame/beefy-mmr/src/mock.rs +++ b/frame/beefy-mmr/src/mock.rs @@ -51,7 +51,7 @@ construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Session: pallet_session::{Pallet, Call, Storage, Event, Config}, - Mmr: pallet_mmr::{Pallet, Call, Storage}, + Mmr: pallet_mmr::{Pallet, Storage}, Beefy: pallet_beefy::{Pallet, Config, Storage}, BeefyMmr: pallet_beefy_mmr::{Pallet, Storage}, } From 90bd59ceeabc9fc3f1e07f45b72cb32c00b0b2e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jul 2021 05:38:19 +0200 Subject: [PATCH 079/109] Bump futures from 0.3.15 to 0.3.16 (#247) Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.15 to 0.3.16. - [Release notes](https://github.com/rust-lang/futures-rs/releases) - [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.15...0.3.16) --- updated-dependencies: - dependency-name: futures dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- client/beefy/rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 90fe183ae9aa3..481b7095e8a49 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -futures = { version = "0.3.14", features = ["compat"] } +futures = { version = "0.3.16", features = ["compat"] } log = "0.4" serde = { version = "1.0.126", features = ["derive"] } serde_json = "1.0.64" From af8bb2e4ee850c137db86a281f49cad42bd1e57a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jul 2021 06:57:55 +0200 Subject: [PATCH 080/109] Bump libsecp256k1 from 0.5.0 to 0.6.0 (#249) * Bump libsecp256k1 from 0.5.0 to 0.6.0 Bumps [libsecp256k1](https://github.com/paritytech/libsecp256k1) from 0.5.0 to 0.6.0. - [Release notes](https://github.com/paritytech/libsecp256k1/releases) - [Changelog](https://github.com/paritytech/libsecp256k1/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/libsecp256k1/commits) --- updated-dependencies: - dependency-name: libsecp256k1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * use correct crate name Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: adoerr <0xad@gmx.net> --- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy-mmr/src/lib.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index c1e694009edb5..31673caa3684f 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -9,7 +9,7 @@ description = "BEEFY + MMR runtime utilities" [dependencies] hex = { version = "0.4", optional = true } codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -libsecp256k1 = { version = "0.3.5", default-features = false } +libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } serde = { version = "1.0.126", optional = true } diff --git a/frame/beefy-mmr/src/lib.rs b/frame/beefy-mmr/src/lib.rs index 8a151cce89094..6c959efcc44c5 100644 --- a/frame/beefy-mmr/src/lib.rs +++ b/frame/beefy-mmr/src/lib.rs @@ -32,12 +32,14 @@ //! //! and thanks to versioning can be easily updated in the future. +use sp_runtime::traits::{Convert, Hash}; +use sp_std::prelude::*; + use beefy_primitives::mmr::{BeefyNextAuthoritySet, MmrLeaf, MmrLeafVersion}; +use pallet_mmr::primitives::LeafDataProvider; + use codec::Encode; use frame_support::traits::Get; -use pallet_mmr::primitives::LeafDataProvider; -use sp_runtime::traits::{Convert, Hash}; -use sp_std::prelude::*; pub use pallet::*; @@ -72,7 +74,7 @@ impl Convert> for BeefyEcdsaToEth use sp_core::crypto::Public; let compressed_key = a.as_slice(); - secp256k1::PublicKey::parse_slice(compressed_key, Some(secp256k1::PublicKeyFormat::Compressed)) + libsecp256k1::PublicKey::parse_slice(compressed_key, Some(libsecp256k1::PublicKeyFormat::Compressed)) // uncompress the key .map(|pub_key| pub_key.serialize().to_vec()) // now convert to ETH address From b0ac09f88e5d7d5a9502ed892f9e6868e541429b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 30 Jul 2021 11:14:02 +0100 Subject: [PATCH 081/109] Derive `scale_info::TypeInfo` for types used in polkadot (#218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add scale-info TypeInfo derives * Update scale-info * Add crates.io patches * Use substrate aj-metadata-vnext branch * Revert master branch substrate deps * Add scale-info to beefy-pallet * scale-info v0.9.0 * Remove github dependencies and patches * More TypeInfo derives * Update scale-info to 0.10.0 * Add missing scale-info dependency * Add missing TypeInfo derive * Hide TypeInfo under a feature. Co-authored-by: Tomasz DrwiÄ™ga --- client/beefy/Cargo.toml | 2 +- frame/beefy-mmr/Cargo.toml | 1 + frame/beefy/Cargo.toml | 2 ++ primitives/beefy/Cargo.toml | 1 + primitives/beefy/src/lib.rs | 3 +++ primitives/beefy/src/mmr.rs | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index e4b83eaf210dd..5ba39003cf1ff 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -15,7 +15,7 @@ thiserror = "1.0" wasm-timer = "0.2.5" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } -prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master"} +prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 31673caa3684f..83f0d77416c7d 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -11,6 +11,7 @@ hex = { version = "0.4", optional = true } codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } +scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } serde = { version = "1.0.126", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 936164e9d5359..208cdc6f8850a 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -7,6 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } serde = { version = "1.0.126", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -28,6 +29,7 @@ sp-staking = { git = "https://github.com/paritytech/substrate.git", branch = "ma default = ["std"] std = [ "codec/std", + "scale-info/std", "serde", "beefy-primitives/std", "frame-support/std", diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index e76d34a5419b5..d5351f9bb9dd2 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -7,6 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +scale-info = { version = "0.10.0", default-features = false, features = ["derive"], optional = true } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 16432fd4a8052..bcecdca9fff46 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -79,6 +79,7 @@ pub type ValidatorSetId = u64; /// A set of BEEFY authorities, a.k.a. validators. #[derive(Decode, Encode, Debug, PartialEq, Clone)] +#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] pub struct ValidatorSet { /// Public keys of the validator set elements pub validators: Vec, @@ -104,6 +105,7 @@ pub type MmrRootHash = H256; /// A consensus log item for BEEFY. #[derive(Decode, Encode)] +#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] pub enum ConsensusLog { /// The authorities have changed. #[codec(index = 1)] @@ -121,6 +123,7 @@ pub enum ConsensusLog { /// A vote message is a direct vote created by a BEEFY node on every voting round /// and is gossiped to its peers. #[derive(Debug, Decode, Encode)] +#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] pub struct VoteMessage { /// Commit to information extracted from a finalized block pub commitment: Commitment, diff --git a/primitives/beefy/src/mmr.rs b/primitives/beefy/src/mmr.rs index e3e1b6a79c4e9..5c863d84e7d01 100644 --- a/primitives/beefy/src/mmr.rs +++ b/primitives/beefy/src/mmr.rs @@ -80,6 +80,7 @@ impl MmrLeafVersion { /// Details of the next BEEFY authority set. #[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] pub struct BeefyNextAuthoritySet { /// Id of the next set. /// From bddaf98faecc9e5b863d2aa3a0c0289dcab8f993 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 05:27:28 +0200 Subject: [PATCH 082/109] Bump serde from 1.0.126 to 1.0.127 (#260) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.126 to 1.0.127. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- client/beefy/rpc/Cargo.toml | 2 +- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 481b7095e8a49..aec1dfc04da14 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = { version = "0.3.16", features = ["compat"] } log = "0.4" -serde = { version = "1.0.126", features = ["derive"] } +serde = { version = "1.0.127", features = ["derive"] } serde_json = "1.0.64" jsonrpc-core = "15.1.0" diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 83f0d77416c7d..8a10d8a9b7e13 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -12,7 +12,7 @@ codec = { version = "2.0.0", package = "parity-scale-codec", default-features = libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.126", optional = true } +serde = { version = "1.0.127", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 208cdc6f8850a..c2de2876ba9b8 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.126", optional = true } +serde = { version = "1.0.127", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From ef89227cd73ac14f547b237c9096f3fdacb6ec88 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Mon, 9 Aug 2021 11:19:17 +0200 Subject: [PATCH 083/109] Bump Substrate and Deps (#262) --- frame/beefy-mmr/src/mock.rs | 2 +- frame/beefy/src/mock.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/beefy-mmr/src/mock.rs b/frame/beefy-mmr/src/mock.rs index a0813807558c5..a0fb97705a24f 100644 --- a/frame/beefy-mmr/src/mock.rs +++ b/frame/beefy-mmr/src/mock.rs @@ -63,7 +63,7 @@ parameter_types! { } impl frame_system::Config for Test { - type BaseCallFilter = frame_support::traits::AllowAll; + type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); type DbWeight = (); diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index 15cac3218b5c5..910b80ec4b0b1 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -60,7 +60,7 @@ parameter_types! { } impl frame_system::Config for Test { - type BaseCallFilter = frame_support::traits::AllowAll; + type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); type DbWeight = (); From a0cc00e3c33a94b274d9321f1addde3e729698d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 13 Aug 2021 09:22:46 +0200 Subject: [PATCH 084/109] Update jsonrpc (#265) * Update jsonrpc * Update Substrate --- client/beefy/rpc/Cargo.toml | 10 +++++----- client/beefy/rpc/src/lib.rs | 18 +++++------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index aec1dfc04da14..09bc783e067e0 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -6,15 +6,15 @@ edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -futures = { version = "0.3.16", features = ["compat"] } +futures = "0.3.16" log = "0.4" serde = { version = "1.0.127", features = ["derive"] } serde_json = "1.0.64" -jsonrpc-core = "15.1.0" -jsonrpc-core-client = "15.1.0" -jsonrpc-derive = "15.1.0" -jsonrpc-pubsub = "15.1.0" +jsonrpc-core = "18.0.0" +jsonrpc-core-client = "18.0.0" +jsonrpc-derive = "18.0.0" +jsonrpc-pubsub = "18.0.0" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs index f90d67bd85d08..8715fac1645b6 100644 --- a/client/beefy/rpc/src/lib.rs +++ b/client/beefy/rpc/src/lib.rs @@ -19,12 +19,7 @@ #![warn(missing_docs)] use beefy_gadget::notification::BeefySignedCommitmentStream; -use futures::{StreamExt, TryStreamExt}; -use jsonrpc_core::futures::{ - future::{Executor as Executor01, Future as Future01}, - sink::Sink as Sink01, - stream::Stream as Stream01, -}; +use futures::{FutureExt, SinkExt, StreamExt}; use jsonrpc_derive::rpc; use jsonrpc_pubsub::{manager::SubscriptionManager, typed::Subscriber, SubscriptionId}; use log::warn; @@ -71,7 +66,7 @@ impl BeefyRpcHandler { /// Creates a new BeefyRpcHandler instance. pub fn new(signed_commitment_stream: BeefySignedCommitmentStream, executor: E) -> Self where - E: Executor01 + Send>> + Send + Sync + 'static, + E: futures::task::Spawn + Send + Sync + 'static, { let manager = SubscriptionManager::new(Arc::new(executor)); Self { @@ -95,14 +90,11 @@ where let stream = self .signed_commitment_stream .subscribe() - .map(|x| Ok::<_, ()>(notification::SignedCommitment::new::(x))) - .map_err(|e| warn!("Notification stream error: {:?}", e)) - .compat(); + .map(|x| Ok::<_, ()>(Ok(notification::SignedCommitment::new::(x)))); self.manager.add(subscriber, |sink| { - let stream = stream.map(Ok); - sink.sink_map_err(|e| warn!("Error sending notifications: {:?}", e)) - .send_all(stream) + stream + .forward(sink.sink_map_err(|e| warn!("Error sending notifications: {:?}", e))) .map(|_| ()) }); } From ccc148ce486ff0d617830d9797550c79fbb4e0fb Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Tue, 17 Aug 2021 14:01:13 +0200 Subject: [PATCH 085/109] bump Substrate and Deps (#268) --- client/beefy/src/worker.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 63ddfb9041c08..0b22f20e3135b 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![allow(clippy::collapsible_match)] + use std::{collections::BTreeSet, fmt::Debug, marker::PhantomData, sync::Arc}; use codec::{Codec, Decode, Encode}; From 4274bead1ffe431e8e2e791d430008c4062ecaf9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 21:11:46 +0200 Subject: [PATCH 086/109] Bump serde from 1.0.127 to 1.0.128 (#272) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.127 to 1.0.128. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- client/beefy/rpc/Cargo.toml | 2 +- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 09bc783e067e0..7a3565d38ac4c 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = "0.3.16" log = "0.4" -serde = { version = "1.0.127", features = ["derive"] } +serde = { version = "1.0.128", features = ["derive"] } serde_json = "1.0.64" jsonrpc-core = "18.0.0" diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 8a10d8a9b7e13..f9f5da9727105 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -12,7 +12,7 @@ codec = { version = "2.0.0", package = "parity-scale-codec", default-features = libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.127", optional = true } +serde = { version = "1.0.128", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index c2de2876ba9b8..58f6e86b79c56 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.127", optional = true } +serde = { version = "1.0.128", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From 6b062b5c5c6224a1c4b18bee359ea93cd832e534 Mon Sep 17 00:00:00 2001 From: drewstone Date: Mon, 23 Aug 2021 15:37:57 -0400 Subject: [PATCH 087/109] Fix spelling (#271) --- client/beefy/src/keystore.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/src/keystore.rs b/client/beefy/src/keystore.rs index 521dfab77edeb..04213eed219b8 100644 --- a/client/beefy/src/keystore.rs +++ b/client/beefy/src/keystore.rs @@ -57,7 +57,7 @@ impl BeefyKeystore { /// Sign `message` with the `public` key. /// - /// Note that `message` usually will be pre-hashed before being singed. + /// 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: &Public, message: &[u8]) -> Result { From 79663a7f4bf616f46aeb043aa64e6b3e9c2dc486 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 05:41:07 +0200 Subject: [PATCH 088/109] Bump serde from 1.0.128 to 1.0.130 (#276) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.128 to 1.0.130. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.128...v1.0.130) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- client/beefy/rpc/Cargo.toml | 2 +- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 7a3565d38ac4c..1556ca93e685d 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] futures = "0.3.16" log = "0.4" -serde = { version = "1.0.128", features = ["derive"] } +serde = { version = "1.0.130", features = ["derive"] } serde_json = "1.0.64" jsonrpc-core = "18.0.0" diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index f9f5da9727105..e9f92b13b2107 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -12,7 +12,7 @@ codec = { version = "2.0.0", package = "parity-scale-codec", default-features = libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.128", optional = true } +serde = { version = "1.0.130", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 58f6e86b79c56..c8ba702c09e5a 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.128", optional = true } +serde = { version = "1.0.130", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From 39fbb7a72ad769910e57d6bd3af060c04fcac713 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 04:41:42 +0000 Subject: [PATCH 089/109] Bump scale-info from 0.10.0 to 0.12.0 (#275) Bumps [scale-info](https://github.com/paritytech/scale-info) from 0.10.0 to 0.12.0. - [Release notes](https://github.com/paritytech/scale-info/releases) - [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/scale-info/commits) --- updated-dependencies: - dependency-name: scale-info dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: adoerr <0xad@gmx.net> --- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- primitives/beefy/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index e9f92b13b2107..7f55f528a2cfe 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -11,7 +11,7 @@ hex = { version = "0.4", optional = true } codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } -scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } +scale-info = { version = "0.12.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index c8ba702c09e5a..2631d8078f431 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } +scale-info = { version = "0.12.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index d5351f9bb9dd2..0d2b556f920e8 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -scale-info = { version = "0.10.0", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "0.12.0", default-features = false, features = ["derive"], optional = true } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From 3dd7ea39c91e9b978a21c2184f62406d07a02f64 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 1 Sep 2021 18:29:57 +0100 Subject: [PATCH 090/109] Update to scale-info 1.0 (#278) --- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- primitives/beefy/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 7f55f528a2cfe..aacc20c2b7823 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -11,7 +11,7 @@ hex = { version = "0.4", optional = true } codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } -scale-info = { version = "0.12.0", default-features = false, features = ["derive"] } +scale-info = { version = "1.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 2631d8078f431..a06b5cf39acf4 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -scale-info = { version = "0.12.0", default-features = false, features = ["derive"] } +scale-info = { version = "1.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index 0d2b556f920e8..89fe14fa9591f 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -scale-info = { version = "0.12.0", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "1.0", default-features = false, features = ["derive"], optional = true } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } From 5a271ada1d1d609a7c25f4dabefe16fb7177445a Mon Sep 17 00:00:00 2001 From: Andronik Ordian Date: Sun, 5 Sep 2021 19:39:40 +0200 Subject: [PATCH 091/109] bump substrate (#282) * bump Substrate and Deps * cargo fmt Co-authored-by: Wenfeng Wang --- client/beefy/Cargo.toml | 2 +- client/beefy/src/notification.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 5ba39003cf1ff..c0818e5491c25 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -25,7 +25,7 @@ sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "mast sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/src/notification.rs b/client/beefy/src/notification.rs index f86e09efa86e9..40a8cd6ed8ec7 100644 --- a/client/beefy/src/notification.rs +++ b/client/beefy/src/notification.rs @@ -16,8 +16,8 @@ use std::sync::Arc; +use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; use sp_runtime::traits::{Block, NumberFor}; -use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnboundedSender}; use parking_lot::Mutex; From 81a2d863c5e4b9a0466c65ddcc0c9a037aa9f383 Mon Sep 17 00:00:00 2001 From: drewstone Date: Thu, 9 Sep 2021 00:00:01 -0400 Subject: [PATCH 092/109] Update worker.rs (#287) --- client/beefy/src/worker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 0b22f20e3135b..d47f19808681a 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -166,7 +166,7 @@ where /// a BEEFY authority set change and we can't fetch the authority set from the /// BEEFY on-chain state. /// - /// Such a failure is usually an indication that the BEEFT pallet has not been deployed (yet). + /// Such a failure is usually an indication that the BEEFY pallet has not been deployed (yet). fn validator_set(&self, header: &B::Header) -> Option> { let new = if let Some(new) = find_authorities_change::(header) { Some(new) From a54f1516759abb4ef7e2752b35743f93e78b1bc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 07:38:25 +0200 Subject: [PATCH 093/109] Bump anyhow from 1.0.43 to 1.0.44 (#290) * Bump anyhow from 1.0.43 to 1.0.44 Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.43 to 1.0.44. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.43...1.0.44) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * derive Default Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: adoerr <0xad@gmx.net> --- client/beefy/src/round.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index 88f35bfb25709..038e2ba39c279 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -25,16 +25,11 @@ use beefy_primitives::{ use sp_arithmetic::traits::AtLeast32BitUnsigned; use sp_runtime::traits::MaybeDisplay; +#[derive(Default)] struct RoundTracker { votes: Vec<(Public, Signature)>, } -impl Default for RoundTracker { - fn default() -> Self { - RoundTracker { votes: Vec::new() } - } -} - impl RoundTracker { fn add_vote(&mut self, vote: (Public, Signature)) -> bool { // this needs to handle equivocations in the future From b2a2f7f77020e54d46f49b3df41040581ed4557d Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 15 Sep 2021 16:56:42 +0100 Subject: [PATCH 094/109] Remove optional `scale-info` feature (#292) * Make scale-info dependency non-optional * Remove feature gated TypeInfo derives * Import TypeInfo * Update substrate * Fix up runtime --- primitives/beefy/Cargo.toml | 3 ++- primitives/beefy/src/lib.rs | 10 ++++------ primitives/beefy/src/mmr.rs | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index 89fe14fa9591f..908ebd8d37615 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -scale-info = { version = "1.0", default-features = false, features = ["derive"], optional = true } +scale-info = { version = "1.0", default-features = false, features = ["derive"] } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -24,6 +24,7 @@ sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste default = ["std"] std = [ "codec/std", + "scale-info/std", "sp-api/std", "sp-application-crypto/std", "sp-core/std", diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index bcecdca9fff46..35d44e2101392 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -39,6 +39,7 @@ pub mod witness; pub use commitment::{Commitment, SignedCommitment, VersionedCommitment}; use codec::{Codec, Decode, Encode}; +use scale_info::TypeInfo; use sp_core::H256; use sp_std::prelude::*; @@ -78,8 +79,7 @@ pub const GENESIS_AUTHORITY_SET_ID: u64 = 0; pub type ValidatorSetId = u64; /// A set of BEEFY authorities, a.k.a. validators. -#[derive(Decode, Encode, Debug, PartialEq, Clone)] -#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] +#[derive(Decode, Encode, Debug, PartialEq, Clone, TypeInfo)] pub struct ValidatorSet { /// Public keys of the validator set elements pub validators: Vec, @@ -104,8 +104,7 @@ pub type AuthorityIndex = u32; pub type MmrRootHash = H256; /// A consensus log item for BEEFY. -#[derive(Decode, Encode)] -#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] +#[derive(Decode, Encode, TypeInfo)] pub enum ConsensusLog { /// The authorities have changed. #[codec(index = 1)] @@ -122,8 +121,7 @@ pub enum ConsensusLog { /// /// A vote message is a direct vote created by a BEEFY node on every voting round /// and is gossiped to its peers. -#[derive(Debug, Decode, Encode)] -#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] +#[derive(Debug, Decode, Encode, TypeInfo)] pub struct VoteMessage { /// Commit to information extracted from a finalized block pub commitment: Commitment, diff --git a/primitives/beefy/src/mmr.rs b/primitives/beefy/src/mmr.rs index 5c863d84e7d01..21ee447c31277 100644 --- a/primitives/beefy/src/mmr.rs +++ b/primitives/beefy/src/mmr.rs @@ -26,6 +26,7 @@ //! or are completely standalone, but heavily inspired by Polkadot. use codec::{Decode, Encode}; +use scale_info::TypeInfo; /// A standard leaf that gets added every block to the MMR constructed by Substrate's `pallet_mmr`. #[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)] @@ -79,8 +80,7 @@ impl MmrLeafVersion { } /// Details of the next BEEFY authority set. -#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode)] -#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] +#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] pub struct BeefyNextAuthoritySet { /// Id of the next set. /// From fde16c2ec960f471039332854e62277103a209f1 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Thu, 16 Sep 2021 09:55:52 -0700 Subject: [PATCH 095/109] prune .git suffix (#294) --- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index aacc20c2b7823..88a8e5d484192 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -29,7 +29,7 @@ beefy-primitives = { path = "../beefy-primitives", default-features = false } pallet-beefy = { path = "../beefy-pallet", default-features = false } [dev-dependencies] -sp-staking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } hex = "0.4" hex-literal = "0.3" diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index a06b5cf39acf4..4704d7681d64b 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -21,9 +21,9 @@ pallet-session = { git = "https://github.com/paritytech/substrate", default-feat beefy-primitives = { path = "../beefy-primitives", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-staking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } [features] default = ["std"] From ec91dc16ca435e2006c088b5e9b455202e34dfca Mon Sep 17 00:00:00 2001 From: Squirrel Date: Fri, 17 Sep 2021 04:51:52 +0100 Subject: [PATCH 096/109] remove unused deps (#295) * remove unused deps * update lock file --- client/beefy/Cargo.toml | 2 -- client/beefy/rpc/Cargo.toml | 1 - frame/beefy-mmr/Cargo.toml | 1 - 3 files changed, 4 deletions(-) diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index c0818e5491c25..c4eb9861668a4 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -8,7 +8,6 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] fnv = "1.0.6" futures = "0.3" -hex = "0.4" log = "0.4" parking_lot = "0.11" thiserror = "1.0" @@ -21,7 +20,6 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 1556ca93e685d..250b53de7e856 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -9,7 +9,6 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" futures = "0.3.16" log = "0.4" serde = { version = "1.0.130", features = ["derive"] } -serde_json = "1.0.64" jsonrpc-core = "18.0.0" jsonrpc-core-client = "18.0.0" diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 88a8e5d484192..e605796e2845b 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -30,7 +30,6 @@ pallet-beefy = { path = "../beefy-pallet", default-features = false } [dev-dependencies] sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } -hex = "0.4" hex-literal = "0.3" [features] From 1afb853e1b083c329f8612c5bbecbbae7cc5a97c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 06:13:06 +0000 Subject: [PATCH 097/109] Bump libsecp256k1 from 0.6.0 to 0.7.0 (#296) * Bump libsecp256k1 from 0.6.0 to 0.7.0 Bumps [libsecp256k1](https://github.com/paritytech/libsecp256k1) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/paritytech/libsecp256k1/releases) - [Changelog](https://github.com/paritytech/libsecp256k1/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/libsecp256k1/commits) --- updated-dependencies: - dependency-name: libsecp256k1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * update sec advisories Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: adoerr <0xad@gmx.net> --- frame/beefy-mmr/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index e605796e2845b..0b277cb802a3f 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -9,7 +9,7 @@ description = "BEEFY + MMR runtime utilities" [dependencies] hex = { version = "0.4", optional = true } codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } -libsecp256k1 = { version = "0.6.0", default-features = false } +libsecp256k1 = { version = "0.7.0", default-features = false } log = { version = "0.4.13", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } From 2ecebb43123d4365bd2e67dbfab21f1c4c367b48 Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Tue, 21 Sep 2021 14:18:51 +0200 Subject: [PATCH 098/109] clean compile --- Cargo.lock | 4717 +++++++++++++++++++--------- Cargo.toml | 6 + client/beefy/Cargo.toml | 4 +- client/beefy/rpc/Cargo.toml | 2 +- client/beefy/src/gossip.rs | 206 +- client/beefy/src/gossip_tests.rs | 182 ++ client/beefy/src/keystore.rs | 178 +- client/beefy/src/keystore_tests.rs | 275 ++ frame/beefy-mmr/Cargo.toml | 6 +- frame/beefy/Cargo.toml | 2 +- 10 files changed, 3750 insertions(+), 1828 deletions(-) create mode 100644 client/beefy/src/gossip_tests.rs create mode 100644 client/beefy/src/keystore_tests.rs diff --git a/Cargo.lock b/Cargo.lock index 37773a4ae3a69..60c7bba970fa3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -492,6 +492,80 @@ dependencies = [ "serde", ] +[[package]] +name = "beefy-gadget" +version = "0.1.0" +dependencies = [ + "beefy-primitives", + "fnv", + "futures 0.3.16", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.11.1", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-keystore 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network-gossip 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network-test 0.8.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "strum 0.21.0", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", + "thiserror", + "wasm-timer", +] + +[[package]] +name = "beefy-gadget-rpc" +version = "0.1.0" +dependencies = [ + "beefy-gadget", + "beefy-primitives", + "futures 0.3.16", + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "jsonrpc-pubsub", + "log 0.4.14", + "parity-scale-codec", + "sc-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "beefy-merkle-tree" +version = "0.1.0" +dependencies = [ + "env_logger 0.9.0", + "hex", + "hex-literal", + "log 0.4.14", + "tiny-keccak", +] + +[[package]] +name = "beefy-primitives" +version = "0.1.0" +dependencies = [ + "hex-literal", + "parity-scale-codec", + "scale-info", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + [[package]] name = "bincode" version = "1.3.2" @@ -842,10 +916,10 @@ dependencies = [ "ansi_term 0.12.1", "node-cli", "rand 0.7.3", - "sc-chain-spec", - "sc-keystore", - "sp-core", - "sp-keystore", + "sc-chain-spec 4.0.0-dev", + "sc-keystore 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-keystore 0.10.0-dev", "structopt", ] @@ -1864,6 +1938,14 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "fork-tree" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "parity-scale-codec", +] + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -1878,20 +1960,40 @@ dependencies = [ name = "frame-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "hex-literal", "linregress", "log 0.4.14", "parity-scale-codec", "paste 1.0.4", "scale-info", - "sp-api", - "sp-io", - "sp-runtime", - "sp-runtime-interface", - "sp-std", - "sp-storage", + "sp-api 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-storage 4.0.0-dev", +] + +[[package]] +name = "frame-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "linregress", + "log 0.4.14", + "parity-scale-codec", + "paste 1.0.4", + "scale-info", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -1900,22 +2002,22 @@ version = "4.0.0-dev" dependencies = [ "Inflector", "chrono", - "frame-benchmarking", - "frame-support", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", "handlebars", "linked-hash-map", "log 0.4.14", "parity-scale-codec", "sc-cli", - "sc-client-db", - "sc-executor", - "sc-service", - "serde", - "sp-core", - "sp-externalities", - "sp-keystore", - "sp-runtime", - "sp-state-machine", + "sc-client-db 0.10.0-dev", + "sc-executor 0.10.0-dev", + "sc-service 0.10.0-dev", + "serde", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", "structopt", ] @@ -1923,36 +2025,36 @@ dependencies = [ name = "frame-election-provider-support" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", + "sp-arithmetic 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", "sp-npos-elections", - "sp-runtime", - "sp-std", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "frame-executive" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "hex-literal", "pallet-balances", "pallet-transaction-payment", "parity-scale-codec", "scale-info", - "sp-core", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing", - "sp-version", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-version 4.0.0-dev", ] [[package]] @@ -1974,8 +2076,8 @@ dependencies = [ "assert_matches", "bitflags", "frame-metadata", - "frame-support-procedural", - "frame-system", + "frame-support-procedural 4.0.0-dev", + "frame-system 4.0.0-dev", "impl-trait-for-tuples", "log 0.4.14", "once_cell", @@ -1986,23 +2088,73 @@ dependencies = [ "scale-info", "serde", "smallvec 1.6.1", - "sp-arithmetic", - "sp-core", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-state-machine", - "sp-std", - "sp-tracing", + "sp-arithmetic 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", + "sp-tracing 4.0.0-dev", +] + +[[package]] +name = "frame-support" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "bitflags", + "frame-metadata", + "frame-support-procedural 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "impl-trait-for-tuples", + "log 0.4.14", + "once_cell", + "parity-scale-codec", + "paste 1.0.4", + "scale-info", + "serde", + "smallvec 1.6.1", + "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "frame-support-procedural" +version = "4.0.0-dev" +dependencies = [ + "Inflector", + "frame-support-procedural-tools 4.0.0-dev", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "Inflector", - "frame-support-procedural-tools", + "frame-support-procedural-tools 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "4.0.0-dev" +dependencies = [ + "frame-support-procedural-tools-derive 3.0.0", + "proc-macro-crate 1.0.0", "proc-macro2", "quote", "syn", @@ -2011,8 +2163,9 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-support-procedural-tools-derive", + "frame-support-procedural-tools-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", "proc-macro-crate 1.0.0", "proc-macro2", "quote", @@ -2028,25 +2181,35 @@ dependencies = [ "syn", ] +[[package]] +name = "frame-support-procedural-tools-derive" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "frame-support-test" version = "3.0.0" dependencies = [ - "frame-support", + "frame-support 4.0.0-dev", "frame-support-test-pallet", - "frame-system", + "frame-system 4.0.0-dev", "parity-scale-codec", "pretty_assertions 0.6.1", "rustversion", "scale-info", "serde", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-version", + "sp-arithmetic 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", + "sp-version 4.0.0-dev", "trybuild", ] @@ -2054,8 +2217,8 @@ dependencies = [ name = "frame-support-test-pallet" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "parity-scale-codec", "scale-info", ] @@ -2065,51 +2228,77 @@ name = "frame-system" version = "4.0.0-dev" dependencies = [ "criterion", - "frame-support", + "frame-support 4.0.0-dev", + "log 0.4.14", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-version 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", +] + +[[package]] +name = "frame-system" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "log 0.4.14", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", - "substrate-test-runtime-client", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "frame-system-rpc-runtime-api" +version = "4.0.0-dev" +dependencies = [ + "parity-scale-codec", + "sp-api 4.0.0-dev", ] [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", - "sp-api", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "frame-try-runtime" version = "0.10.0-dev" dependencies = [ - "frame-support", - "sp-api", - "sp-runtime", - "sp-std", + "frame-support 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -2320,12 +2509,12 @@ version = "3.0.0" dependencies = [ "chrono", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "git2", "num-format", "pallet-staking", - "sp-io", + "sp-io 4.0.0-dev", "structopt", ] @@ -3751,9 +3940,9 @@ dependencies = [ "base64 0.12.3", "digest 0.9.0", "hmac-drbg 0.3.0", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", + "libsecp256k1-core 0.2.2", + "libsecp256k1-gen-ecmult 0.2.1", + "libsecp256k1-gen-genmult 0.2.1", "rand 0.7.3", "serde", "sha2 0.9.3", @@ -3770,15 +3959,32 @@ dependencies = [ "base64 0.12.3", "digest 0.9.0", "hmac-drbg 0.3.0", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", + "libsecp256k1-core 0.2.2", + "libsecp256k1-gen-ecmult 0.2.1", + "libsecp256k1-gen-genmult 0.2.1", "rand 0.7.3", "serde", "sha2 0.9.3", "typenum", ] +[[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", + "libsecp256k1-core 0.3.0", + "libsecp256k1-gen-ecmult 0.3.0", + "libsecp256k1-gen-genmult 0.3.0", + "rand 0.8.4", + "serde", + "sha2 0.9.3", +] + [[package]] name = "libsecp256k1-core" version = "0.2.2" @@ -3790,13 +3996,33 @@ dependencies = [ "subtle 2.4.0", ] +[[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 2.4.0", +] + [[package]] name = "libsecp256k1-gen-ecmult" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" dependencies = [ - "libsecp256k1-core", + "libsecp256k1-core 0.2.2", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core 0.3.0", ] [[package]] @@ -3805,7 +4031,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" dependencies = [ - "libsecp256k1-core", + "libsecp256k1-core 0.2.2", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core 0.3.0", ] [[package]] @@ -4365,19 +4600,19 @@ dependencies = [ "parity-util-mem", "rand 0.7.3", "sc-basic-authorship", - "sc-client-api", - "sc-transaction-pool", - "sc-transaction-pool-api", + "sc-client-api 4.0.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", "serde", "serde_json", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-timestamp", - "sp-tracing", - "sp-trie", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-timestamp 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-trie 4.0.0-dev", "structopt", "tempfile", ] @@ -4389,7 +4624,7 @@ dependencies = [ "assert_cmd", "async-std", "frame-benchmarking-cli", - "frame-system", + "frame-system 4.0.0-dev", "futures 0.3.16", "hex-literal", "log 0.4.14", @@ -4407,44 +4642,44 @@ dependencies = [ "regex", "sc-authority-discovery", "sc-basic-authorship", - "sc-chain-spec", + "sc-chain-spec 4.0.0-dev", "sc-cli", - "sc-client-api", - "sc-client-db", - "sc-consensus", + "sc-client-api 4.0.0-dev", + "sc-client-db 0.10.0-dev", + "sc-consensus 0.10.0-dev", "sc-consensus-babe", "sc-consensus-epochs", "sc-consensus-slots", "sc-consensus-uncles", - "sc-executor", + "sc-executor 0.10.0-dev", "sc-finality-grandpa", - "sc-keystore", - "sc-network", - "sc-rpc", - "sc-service", + "sc-keystore 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-rpc 4.0.0-dev", + "sc-service 0.10.0-dev", "sc-service-test", "sc-sync-state-rpc", - "sc-telemetry", - "sc-transaction-pool", - "sc-transaction-pool-api", + "sc-telemetry 4.0.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", "serde", "serde_json", "soketto 0.4.2", "sp-authority-discovery", - "sp-authorship", - "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-transaction-storage-proof", - "sp-trie", + "sp-authorship 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-timestamp 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-transaction-pool 4.0.0-dev", + "sp-transaction-storage-proof 4.0.0-dev", + "sp-trie 4.0.0-dev", "structopt", "substrate-build-script-utils", "substrate-frame-cli", @@ -4457,9 +4692,9 @@ name = "node-executor" version = "3.0.0-dev" dependencies = [ "criterion", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "futures 0.3.16", "node-primitives", "node-runtime", @@ -4467,19 +4702,19 @@ dependencies = [ "pallet-balances", "pallet-contracts", "pallet-im-online", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "pallet-treasury", "parity-scale-codec", - "sc-executor", + "sc-executor 0.10.0-dev", "scale-info", - "sp-application-crypto", - "sp-consensus-babe", - "sp-core", - "sp-externalities", - "sp-keystore", - "sp-runtime", - "sp-state-machine", - "sp-trie", + "sp-application-crypto 4.0.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-trie 4.0.0-dev", "wat", ] @@ -4490,12 +4725,12 @@ dependencies = [ "derive_more", "parity-scale-codec", "sc-cli", - "sc-client-api", - "sc-executor", - "sc-service", - "sp-blockchain", - "sp-core", - "sp-runtime", + "sc-client-api 4.0.0-dev", + "sc-executor 0.10.0-dev", + "sc-service 0.10.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", "structopt", ] @@ -4503,12 +4738,12 @@ dependencies = [ name = "node-primitives" version = "2.0.0" dependencies = [ - "frame-system", + "frame-system 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-application-crypto", - "sp-core", - "sp-runtime", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] @@ -4520,24 +4755,24 @@ dependencies = [ "pallet-contracts-rpc", "pallet-mmr-rpc", "pallet-transaction-payment-rpc", - "sc-chain-spec", - "sc-client-api", + "sc-chain-spec 4.0.0-dev", + "sc-client-api 4.0.0-dev", "sc-consensus-babe", "sc-consensus-babe-rpc", "sc-consensus-epochs", "sc-finality-grandpa", "sc-finality-grandpa-rpc", - "sc-rpc", - "sc-rpc-api", + "sc-rpc 4.0.0-dev", + "sc-rpc-api 0.10.0-dev", "sc-sync-state-rpc", - "sc-transaction-pool-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-keystore", - "sp-runtime", + "sc-transaction-pool-api 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", "substrate-frame-rpc-system", ] @@ -4548,29 +4783,29 @@ dependencies = [ "futures 0.3.16", "jsonrpc-core-client", "node-primitives", - "sc-rpc", - "sp-tracing", + "sc-rpc 4.0.0-dev", + "sp-tracing 4.0.0-dev", ] [[package]] name = "node-runtime" version = "3.0.0-dev" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", "frame-executive", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "frame-system-benchmarking", - "frame-system-rpc-runtime-api", + "frame-system-rpc-runtime-api 4.0.0-dev", "frame-try-runtime", "hex-literal", "log 0.4.14", "node-primitives", "pallet-assets", "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", + "pallet-authorship 4.0.0-dev", + "pallet-babe 4.0.0-dev", "pallet-bags-list", "pallet-balances", "pallet-bounties", @@ -4588,7 +4823,7 @@ dependencies = [ "pallet-indices", "pallet-lottery", "pallet-membership", - "pallet-mmr", + "pallet-mmr 4.0.0-dev", "pallet-multisig", "pallet-offences", "pallet-offences-benchmarking", @@ -4596,13 +4831,13 @@ dependencies = [ "pallet-randomness-collective-flip", "pallet-recovery", "pallet-scheduler", - "pallet-session", + "pallet-session 4.0.0-dev", "pallet-session-benchmarking", "pallet-society", "pallet-staking", "pallet-staking-reward-curve", "pallet-sudo", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -4613,24 +4848,24 @@ dependencies = [ "pallet-vesting", "parity-scale-codec", "scale-info", - "sp-api", + "sp-api 4.0.0-dev", "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-core", - "sp-inherents", - "sp-io", - "sp-keyring", + "sp-block-builder 4.0.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keyring 4.0.0-dev", "sp-npos-elections", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-transaction-pool", - "sp-version", + "sp-offchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-transaction-pool 4.0.0-dev", + "sp-version 4.0.0-dev", "static_assertions", - "substrate-wasm-builder", + "substrate-wasm-builder 5.0.0-dev", ] [[package]] @@ -4646,34 +4881,34 @@ dependencies = [ name = "node-template" version = "3.0.0" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-benchmarking-cli", "jsonrpc-core", "node-template-runtime", "pallet-transaction-payment-rpc", "sc-basic-authorship", "sc-cli", - "sc-client-api", - "sc-consensus", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", "sc-consensus-aura", - "sc-executor", + "sc-executor 0.10.0-dev", "sc-finality-grandpa", - "sc-keystore", - "sc-rpc", - "sc-rpc-api", - "sc-service", - "sc-telemetry", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-aura", - "sp-core", - "sp-finality-grandpa", - "sp-runtime", - "sp-timestamp", + "sc-keystore 4.0.0-dev", + "sc-rpc 4.0.0-dev", + "sc-rpc-api 0.10.0-dev", + "sc-service 0.10.0-dev", + "sc-telemetry 4.0.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-aura 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-timestamp 4.0.0-dev", "structopt", "substrate-build-script-utils", "substrate-frame-rpc-system", @@ -4683,12 +4918,12 @@ dependencies = [ name = "node-template-runtime" version = "3.0.0" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-executive", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "frame-system-benchmarking", - "frame-system-rpc-runtime-api", + "frame-system-rpc-runtime-api 4.0.0-dev", "hex-literal", "pallet-aura", "pallet-balances", @@ -4696,30 +4931,30 @@ dependencies = [ "pallet-randomness-collective-flip", "pallet-sudo", "pallet-template", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "scale-info", - "sp-api", - "sp-block-builder", - "sp-consensus-aura", - "sp-core", - "sp-inherents", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-std", - "sp-transaction-pool", - "sp-version", - "substrate-wasm-builder", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-consensus-aura 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-offchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-transaction-pool 4.0.0-dev", + "sp-version 4.0.0-dev", + "substrate-wasm-builder 5.0.0-dev", ] [[package]] name = "node-testing" version = "3.0.0-dev" dependencies = [ - "frame-system", + "frame-system 4.0.0-dev", "fs_extra", "futures 0.3.16", "log 0.4.14", @@ -4728,23 +4963,23 @@ dependencies = [ "node-runtime", "pallet-transaction-payment", "parity-scale-codec", - "sc-block-builder", - "sc-client-api", - "sc-client-db", - "sc-consensus", - "sc-executor", - "sc-service", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-timestamp", - "substrate-test-client", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-client-db 0.10.0-dev", + "sc-consensus 0.10.0-dev", + "sc-executor 0.10.0-dev", + "sc-service 0.10.0-dev", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-timestamp 4.0.0-dev", + "substrate-test-client 2.0.1", "tempfile", ] @@ -4972,179 +5207,262 @@ dependencies = [ name = "pallet-assets" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-atomic-swap" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-aura" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", - "pallet-timestamp", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "pallet-timestamp 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-application-crypto", - "sp-consensus-aura", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-application-crypto 4.0.0-dev", + "sp-consensus-aura 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", - "pallet-session", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "pallet-session 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-application-crypto", + "sp-application-crypto 4.0.0-dev", "sp-authority-discovery", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "pallet-authorship" +version = "4.0.0-dev" +dependencies = [ + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-authorship 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-authorship" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-authorship", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-authorship 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "pallet-babe" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", - "pallet-authorship", + "pallet-authorship 4.0.0-dev", "pallet-balances", "pallet-offences", - "pallet-session", + "pallet-session 4.0.0-dev", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", + "parity-scale-codec", + "scale-info", + "sp-application-crypto 4.0.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-consensus-vrf 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "pallet-babe" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "frame-benchmarking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "log 0.4.14", + "pallet-authorship 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "parity-scale-codec", "scale-info", - "sp-application-crypto", - "sp-consensus-babe", - "sp-consensus-vrf", - "sp-core", - "sp-io", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-babe 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-vrf 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "pallet-bags-list" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-tracing 4.0.0-dev", ] [[package]] name = "pallet-balances" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-transaction-payment", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "pallet-beefy" +version = "0.1.0" +dependencies = [ + "beefy-primitives", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "pallet-beefy-mmr" +version = "0.1.0" +dependencies = [ + "beefy-merkle-tree", + "beefy-primitives", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "hex", + "hex-literal", + "libsecp256k1 0.7.0", + "log 0.4.14", + "pallet-beefy", + "pallet-mmr 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-mmr-primitives 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "pallet-bounties" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "pallet-treasury", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-collective" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -5153,9 +5471,9 @@ version = "4.0.0-dev" dependencies = [ "assert_matches", "bitflags", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "hex-literal", "libsecp256k1 0.3.5", "log 0.4.14", @@ -5163,7 +5481,7 @@ dependencies = [ "pallet-contracts-primitives", "pallet-contracts-proc-macro", "pallet-randomness-collective-flip", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "pallet-utility", "parity-scale-codec", "pretty_assertions 0.7.2", @@ -5173,11 +5491,11 @@ dependencies = [ "scale-info", "serde", "smallvec 1.6.1", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", "sp-sandbox", - "sp-std", + "sp-std 4.0.0-dev", "wasmi-validation", "wat", ] @@ -5190,9 +5508,9 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -5216,11 +5534,11 @@ dependencies = [ "parity-scale-codec", "serde", "serde_json", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-rpc 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] @@ -5230,50 +5548,50 @@ dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", "scale-info", - "sp-api", - "sp-runtime", - "sp-std", + "sp-api 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-democracy" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "pallet-scheduler", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-balances", "parity-scale-codec", "parking_lot 0.11.1", "rand 0.7.3", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", + "sp-arithmetic 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", "sp-npos-elections", - "sp-runtime", - "sp-std", - "sp-tracing", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-tracing 4.0.0-dev", "static_assertions", "strum 0.21.0", "strum_macros 0.21.1", @@ -5283,33 +5601,33 @@ dependencies = [ name = "pallet-elections" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", "sp-npos-elections", - "sp-runtime", - "sp-std", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", "substrate-test-utils", ] @@ -5317,66 +5635,66 @@ dependencies = [ name = "pallet-example" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-example-offchain-worker" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "lite-json", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-keystore", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-example-parallel" version = "3.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tasks", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-tasks 4.0.0-dev", ] [[package]] name = "pallet-gilt" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-arithmetic 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -5384,29 +5702,29 @@ name = "pallet-grandpa" version = "4.0.0-dev" dependencies = [ "finality-grandpa", - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", - "pallet-authorship", + "pallet-authorship 4.0.0-dev", "pallet-balances", "pallet-offences", - "pallet-session", + "pallet-session 4.0.0-dev", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-application-crypto", - "sp-core", - "sp-finality-grandpa", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -5414,86 +5732,86 @@ name = "pallet-identity" version = "4.0.0-dev" dependencies = [ "enumflags2", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-im-online" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", - "pallet-authorship", - "pallet-session", + "pallet-authorship 4.0.0-dev", + "pallet-session 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-indices" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-lottery" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", "frame-support-test", - "frame-system", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-membership" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -5502,33 +5820,67 @@ version = "4.0.0-dev" dependencies = [ "ckb-merkle-mountain-range", "env_logger 0.9.0", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "hex-literal", - "pallet-mmr-primitives", + "pallet-mmr-primitives 4.0.0-dev", + "parity-scale-codec", + "scale-info", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "pallet-mmr" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "ckb-merkle-mountain-range", + "frame-benchmarking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-mmr-primitives 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "pallet-mmr-primitives" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "hex-literal", "log 0.4.14", "parity-scale-codec", "serde", - "sp-api", - "sp-core", - "sp-runtime", - "sp-std", + "sp-api 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "pallet-mmr-primitives" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "log 0.4.14", + "parity-scale-codec", + "serde", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -5538,167 +5890,167 @@ dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "pallet-mmr-primitives", + "pallet-mmr-primitives 4.0.0-dev", "parity-scale-codec", "serde", "serde_json", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] name = "pallet-multisig" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-nicks" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-node-authorization" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-offences" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", - "frame-support", - "frame-system", - "pallet-babe", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "pallet-babe 4.0.0-dev", "pallet-balances", "pallet-grandpa", "pallet-im-online", "pallet-offences", - "pallet-session", + "pallet-session 4.0.0-dev", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-proxy" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "pallet-utility", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "parity-scale-codec", "safe-mix", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-recovery" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-scheduler" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", "substrate-test-utils", ] @@ -5706,104 +6058,125 @@ dependencies = [ name = "pallet-scored-pool" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "pallet-session" +version = "4.0.0-dev" +dependencies = [ + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "impl-trait-for-tuples", + "log 0.4.14", + "pallet-timestamp 4.0.0-dev", + "parity-scale-codec", + "scale-info", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-trie 4.0.0-dev", ] [[package]] name = "pallet-session" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "impl-trait-for-tuples", "log 0.4.14", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-trie", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", - "pallet-session", + "pallet-session 4.0.0-dev", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "parity-scale-codec", "rand 0.7.3", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-session", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-society" version = "4.0.0-dev" dependencies = [ - "frame-support", + "frame-support 4.0.0-dev", "frame-support-test", - "frame-system", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "rand_chacha 0.2.2", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-staking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 4.0.0-dev", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", - "pallet-authorship", + "pallet-authorship 4.0.0-dev", "pallet-bags-list", "pallet-balances", - "pallet-session", + "pallet-session 4.0.0-dev", "pallet-staking-reward-curve", - "pallet-timestamp", + "pallet-timestamp 4.0.0-dev", "parity-scale-codec", "rand_chacha 0.2.2", "scale-info", "serde", - "sp-application-crypto", - "sp-core", - "sp-io", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", "sp-npos-elections", - "sp-runtime", - "sp-staking", - "sp-std", - "sp-tracing", + "sp-runtime 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-tracing 4.0.0-dev", "substrate-test-utils", ] @@ -5814,7 +6187,7 @@ dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", "quote", - "sp-runtime", + "sp-runtime 4.0.0-dev", "syn", ] @@ -5823,91 +6196,108 @@ name = "pallet-staking-reward-fn" version = "4.0.0-dev" dependencies = [ "log 0.4.14", - "sp-arithmetic", + "sp-arithmetic 4.0.0-dev", ] [[package]] name = "pallet-sudo" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-template" version = "3.0.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "parity-scale-codec", + "scale-info", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", +] + +[[package]] +name = "pallet-timestamp" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-timestamp 4.0.0-dev", ] [[package]] name = "pallet-timestamp" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-timestamp", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "pallet-tips" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-balances", "pallet-treasury", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-storage", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-storage 4.0.0-dev", ] [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", "serde", "serde_json", "smallvec 1.6.1", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -5919,11 +6309,11 @@ dependencies = [ "jsonrpc-derive", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-rpc 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] @@ -5932,95 +6322,95 @@ version = "4.0.0-dev" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", - "sp-api", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] name = "pallet-transaction-storage" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "hex-literal", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-transaction-storage-proof", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-transaction-storage-proof 4.0.0-dev", ] [[package]] name = "pallet-treasury" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "impl-trait-for-tuples", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-uniques" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-utility" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "pallet-vesting" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -7133,10 +7523,10 @@ dependencies = [ "parity-scale-codec", "serde", "serde_json", - "sp-core", - "sp-io", - "sp-runtime", - "sp-version", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-version 4.0.0-dev", "tokio", ] @@ -7322,8 +7712,19 @@ name = "sc-allocator" version = "4.0.0-dev" dependencies = [ "log 0.4.14", - "sp-core", - "sp-wasm-interface", + "sp-core 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", + "thiserror", +] + +[[package]] +name = "sc-allocator" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "log 0.4.14", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -7343,17 +7744,17 @@ dependencies = [ "prost-build", "quickcheck", "rand 0.7.3", - "sc-client-api", - "sc-network", - "sp-api", + "sc-client-api 4.0.0-dev", + "sc-network 0.10.0-dev", + "sp-api 4.0.0-dev", "sp-authority-discovery", - "sp-blockchain", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-tracing", - "substrate-prometheus-endpoint", - "substrate-test-runtime-client", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime-client 2.0.0", ] [[package]] @@ -7365,36 +7766,52 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder", - "sc-client-api", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", "sc-proposer-metrics", - "sc-telemetry", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "substrate-prometheus-endpoint", - "substrate-test-runtime-client", + "sc-telemetry 4.0.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime-client 2.0.0", +] + +[[package]] +name = "sc-block-builder" +version = "0.10.0-dev" +dependencies = [ + "parity-scale-codec", + "sc-client-api 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "substrate-test-runtime-client 2.0.0", ] [[package]] name = "sc-block-builder" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", - "sc-client-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "substrate-test-runtime-client", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-block-builder 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -7403,22 +7820,49 @@ version = "4.0.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sc-chain-spec-derive", - "sc-network", - "sc-telemetry", + "sc-chain-spec-derive 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-telemetry 4.0.0-dev", "serde", "serde_json", - "sp-core", - "sp-runtime", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] -name = "sc-chain-spec-derive" +name = "sc-chain-spec" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "proc-macro-crate 1.0.0", - "proc-macro2", - "quote", + "impl-trait-for-tuples", + "parity-scale-codec", + "sc-chain-spec-derive 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-telemetry 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde", + "serde_json", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sc-chain-spec-derive" +version = "4.0.0-dev" +dependencies = [ + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sc-chain-spec-derive" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", "syn", ] @@ -7437,22 +7881,22 @@ dependencies = [ "rand 0.7.3", "regex", "rpassword", - "sc-client-api", - "sc-keystore", - "sc-network", - "sc-service", - "sc-telemetry", - "sc-tracing", - "sc-utils", + "sc-client-api 4.0.0-dev", + "sc-keystore 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-service 0.10.0-dev", + "sc-telemetry 4.0.0-dev", + "sc-tracing 4.0.0-dev", + "sc-utils 4.0.0-dev", "serde", "serde_json", - "sp-blockchain", - "sp-core", - "sp-keyring", - "sp-keystore", - "sp-panic-handler", - "sp-runtime", - "sp-version", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-panic-handler 3.0.0", + "sp-runtime 4.0.0-dev", + "sp-version 4.0.0-dev", "structopt", "tempfile", "thiserror", @@ -7470,26 +7914,54 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.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", + "sc-executor 0.10.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sc-utils 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-database 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-storage 4.0.0-dev", "sp-test-primitives", - "sp-trie", - "substrate-prometheus-endpoint", - "substrate-test-runtime", + "sp-trie 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime 2.0.0", "thiserror", ] +[[package]] +name = "sc-client-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "fnv", + "futures 0.3.16", + "hash-db", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.11.1", + "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-database 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", +] + [[package]] name = "sc-client-db" version = "0.10.0-dev" @@ -7504,20 +7976,43 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.11.1", "quickcheck", - "sc-client-api", - "sc-state-db", - "sp-arithmetic", - "sp-blockchain", - "sp-core", - "sp-database", - "sp-runtime", - "sp-state-machine", - "sp-tracing", - "sp-trie", - "substrate-test-runtime-client", + "sc-client-api 4.0.0-dev", + "sc-state-db 0.10.0-dev", + "sp-arithmetic 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-database 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-tracing 4.0.0-dev", + "sp-trie 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", "tempfile", ] +[[package]] +name = "sc-client-db" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "hash-db", + "kvdb", + "kvdb-memorydb", + "linked-hash-map", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.11.1", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-state-db 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-database 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + [[package]] name = "sc-consensus" version = "0.10.0-dev" @@ -7528,17 +8023,41 @@ dependencies = [ "libp2p", "log 0.4.14", "parking_lot 0.11.1", - "sc-client-api", - "sc-utils", - "serde", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "sp-state-machine", + "sc-client-api 4.0.0-dev", + "sc-utils 4.0.0-dev", + "serde", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", "sp-test-primitives", - "substrate-prometheus-endpoint", + "substrate-prometheus-endpoint 0.9.0", + "thiserror", +] + +[[package]] +name = "sc-consensus" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "futures 0.3.16", + "futures-timer 3.0.2", + "libp2p", + "log 0.4.14", + "parking_lot 0.11.1", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -7553,30 +8072,30 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder", - "sc-client-api", - "sc-consensus", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", "sc-consensus-slots", - "sc-keystore", - "sc-network", - "sc-network-test", - "sc-telemetry", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-aura", - "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-keyring", - "sp-keystore", - "sp-runtime", - "sp-timestamp", - "sp-tracing", - "substrate-prometheus-endpoint", - "substrate-test-runtime-client", + "sc-keystore 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-network-test 0.8.0", + "sc-telemetry 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-aura 0.10.0-dev", + "sp-consensus-slots 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-timestamp 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime-client 2.0.0", "tempfile", ] @@ -7586,7 +8105,7 @@ version = "0.10.0-dev" dependencies = [ "async-trait", "derive_more", - "fork-tree", + "fork-tree 3.0.0", "futures 0.3.16", "log 0.4.14", "merlin", @@ -7598,35 +8117,35 @@ dependencies = [ "rand 0.7.3", "rand_chacha 0.2.2", "retain_mut", - "sc-block-builder", - "sc-client-api", - "sc-consensus", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", "sc-consensus-epochs", "sc-consensus-slots", - "sc-keystore", - "sc-network", - "sc-network-test", - "sc-telemetry", + "sc-keystore 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-network-test 0.8.0", + "sc-telemetry 4.0.0-dev", "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-timestamp", - "sp-tracing", - "sp-version", - "substrate-prometheus-endpoint", - "substrate-test-runtime-client", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-consensus-slots 0.10.0-dev", + "sp-consensus-vrf 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-timestamp 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-version 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime-client 2.0.0", "tempfile", ] @@ -7639,23 +8158,23 @@ dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "sc-consensus", + "sc-consensus 0.10.0-dev", "sc-consensus-babe", "sc-consensus-epochs", - "sc-keystore", - "sc-rpc-api", + "sc-keystore 4.0.0-dev", + "sc-rpc-api 0.10.0-dev", "serde", "serde_json", - "sp-api", - "sp-application-crypto", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-core", - "sp-keyring", - "sp-keystore", - "sp-runtime", - "substrate-test-runtime-client", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", "tempfile", ] @@ -7663,12 +8182,12 @@ dependencies = [ name = "sc-consensus-epochs" version = "0.10.0-dev" dependencies = [ - "fork-tree", + "fork-tree 3.0.0", "parity-scale-codec", - "sc-client-api", - "sc-consensus", - "sp-blockchain", - "sp-runtime", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] @@ -7685,25 +8204,25 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "sc-basic-authorship", - "sc-client-api", - "sc-consensus", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", "sc-consensus-babe", "sc-consensus-epochs", - "sc-transaction-pool", - "sc-transaction-pool-api", - "serde", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-keystore", - "sp-runtime", - "sp-timestamp", - "substrate-prometheus-endpoint", - "substrate-test-runtime-client", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "serde", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-consensus-slots 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-timestamp 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime-client 2.0.0", "substrate-test-runtime-transaction-pool", "tokio", ] @@ -7719,17 +8238,17 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-client-api", - "sc-consensus", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", "sp-consensus-pow", - "sp-core", - "sp-inherents", - "sp-runtime", - "substrate-prometheus-endpoint", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", ] [[package]] @@ -7741,20 +8260,20 @@ dependencies = [ "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", - "sc-client-api", - "sc-consensus", - "sc-telemetry", - "sp-api", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-timestamp", - "substrate-test-runtime-client", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", + "sc-telemetry 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-arithmetic 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-slots 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-timestamp 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", "thiserror", ] @@ -7762,9 +8281,9 @@ dependencies = [ name = "sc-consensus-uncles" version = "0.10.0-dev" dependencies = [ - "sc-client-api", - "sp-authorship", - "sp-runtime", + "sc-client-api 4.0.0-dev", + "sp-authorship 4.0.0-dev", + "sp-runtime 4.0.0-dev", "thiserror", ] @@ -7780,31 +8299,56 @@ dependencies = [ "parking_lot 0.11.1", "paste 1.0.4", "regex", - "sc-executor-common", - "sc-executor-wasmi", + "sc-executor-common 0.10.0-dev", + "sc-executor-wasmi 0.10.0-dev", "sc-executor-wasmtime", "sc-runtime-test", - "sc-tracing", - "sp-api", - "sp-core", - "sp-externalities", - "sp-io", - "sp-maybe-compressed-blob", - "sp-panic-handler", - "sp-runtime", - "sp-runtime-interface", - "sp-state-machine", - "sp-tasks", - "sp-trie", - "sp-version", - "sp-wasm-interface", - "substrate-test-runtime", + "sc-tracing 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-io 4.0.0-dev", + "sp-maybe-compressed-blob 4.0.0-dev", + "sp-panic-handler 3.0.0", + "sp-runtime 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-tasks 4.0.0-dev", + "sp-trie 4.0.0-dev", + "sp-version 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", + "substrate-test-runtime 2.0.0", "tracing", "tracing-subscriber", "wasmi", "wat", ] +[[package]] +name = "sc-executor" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "lazy_static", + "libsecp256k1 0.6.0", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.11.1", + "sc-executor-common 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-executor-wasmi 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-panic-handler 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tasks 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "wasmi", +] + [[package]] name = "sc-executor-common" version = "0.10.0-dev" @@ -7813,29 +8357,63 @@ dependencies = [ "environmental", "parity-scale-codec", "pwasm-utils", - "sc-allocator", - "sp-core", - "sp-maybe-compressed-blob", - "sp-serializer", - "sp-wasm-interface", + "sc-allocator 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-maybe-compressed-blob 4.0.0-dev", + "sp-serializer 3.0.0", + "sp-wasm-interface 4.0.0-dev", "thiserror", "wasmer", "wasmer-compiler-singlepass", "wasmi", ] +[[package]] +name = "sc-executor-common" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "derive_more", + "environmental", + "parity-scale-codec", + "pwasm-utils", + "sc-allocator 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-maybe-compressed-blob 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-serializer 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "thiserror", + "wasmi", +] + +[[package]] +name = "sc-executor-wasmi" +version = "0.10.0-dev" +dependencies = [ + "log 0.4.14", + "parity-scale-codec", + "sc-allocator 4.0.0-dev", + "sc-executor-common 0.10.0-dev", + "scoped-tls", + "sp-core 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", + "wasmi", +] + [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "log 0.4.14", "parity-scale-codec", - "sc-allocator", - "sc-executor-common", + "sc-allocator 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-executor-common 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "scoped-tls", - "sp-core", - "sp-runtime-interface", - "sp-wasm-interface", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "wasmi", ] @@ -7848,14 +8426,14 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parity-wasm 0.42.2", - "sc-allocator", - "sc-executor-common", + "sc-allocator 4.0.0-dev", + "sc-executor-common 0.10.0-dev", "sc-runtime-test", "scoped-tls", - "sp-core", - "sp-io", - "sp-runtime-interface", - "sp-wasm-interface", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", "wasmtime", "wat", ] @@ -7869,36 +8447,36 @@ dependencies = [ "derive_more", "dyn-clone", "finality-grandpa", - "fork-tree", + "fork-tree 3.0.0", "futures 0.3.16", "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", "rand 0.8.4", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sc-keystore", - "sc-network", - "sc-network-gossip", - "sc-network-test", - "sc-telemetry", - "sc-utils", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", + "sc-keystore 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-network-gossip 0.10.0-dev", + "sc-network-test 0.8.0", + "sc-telemetry 4.0.0-dev", + "sc-utils 4.0.0-dev", "serde_json", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-finality-grandpa", - "sp-keyring", - "sp-keystore", - "sp-runtime", - "sp-tracing", - "substrate-prometheus-endpoint", - "substrate-test-runtime-client", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-arithmetic 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime-client 2.0.0", "tempfile", "tokio", ] @@ -7916,34 +8494,51 @@ dependencies = [ "jsonrpc-pubsub", "log 0.4.14", "parity-scale-codec", - "sc-block-builder", - "sc-client-api", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", "sc-finality-grandpa", - "sc-rpc", + "sc-rpc 4.0.0-dev", "serde", "serde_json", - "sp-blockchain", - "sp-core", - "sp-finality-grandpa", - "sp-keyring", - "sp-runtime", - "substrate-test-runtime-client", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", +] + +[[package]] +name = "sc-informant" +version = "0.10.0-dev" +dependencies = [ + "ansi_term 0.12.1", + "futures 0.3.16", + "futures-timer 3.0.2", + "log 0.4.14", + "parity-util-mem", + "sc-client-api 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] name = "sc-informant" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "ansi_term 0.12.1", "futures 0.3.16", "futures-timer 3.0.2", "log 0.4.14", "parity-util-mem", - "sc-client-api", - "sc-network", - "sc-transaction-pool-api", - "sp-blockchain", - "sp-runtime", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -7955,27 +8550,60 @@ dependencies = [ "hex", "parking_lot 0.11.1", "serde_json", - "sp-application-crypto", - "sp-core", - "sp-keystore", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-keystore 0.10.0-dev", "tempfile", ] +[[package]] +name = "sc-keystore" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "derive_more", + "hex", + "parking_lot 0.11.1", + "serde_json", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sc-light" +version = "4.0.0-dev" +dependencies = [ + "hash-db", + "parity-scale-codec", + "parking_lot 0.11.1", + "sc-client-api 4.0.0-dev", + "sc-executor 0.10.0-dev", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", +] + [[package]] name = "sc-light" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "hash-db", "parity-scale-codec", "parking_lot 0.11.1", - "sc-client-api", - "sc-executor", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-externalities", - "sp-runtime", - "sp-state-machine", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -7992,7 +8620,7 @@ dependencies = [ "derive_more", "either", "fnv", - "fork-tree", + "fork-tree 3.0.0", "futures 0.3.16", "futures-timer 3.0.2", "hex", @@ -8009,25 +8637,25 @@ dependencies = [ "prost-build", "quickcheck", "rand 0.7.3", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sc-peerset", - "sc-utils", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", + "sc-peerset 4.0.0-dev", + "sc-utils 4.0.0-dev", "serde", "serde_json", "smallvec 1.6.1", - "sp-arithmetic", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-finality-grandpa", - "sp-runtime", + "sp-arithmetic 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-runtime 4.0.0-dev", "sp-test-primitives", - "sp-tracing", - "substrate-prometheus-endpoint", - "substrate-test-runtime", - "substrate-test-runtime-client", + "sp-tracing 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime 2.0.0", + "substrate-test-runtime-client 2.0.0", "tempfile", "thiserror", "unsigned-varint 0.6.0", @@ -8035,6 +8663,57 @@ dependencies = [ "zeroize", ] +[[package]] +name = "sc-network" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-std", + "async-trait", + "asynchronous-codec 0.5.0", + "bitflags", + "bytes 1.0.1", + "cid", + "derive_more", + "either", + "fnv", + "fork-tree 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "futures 0.3.16", + "futures-timer 3.0.2", + "hex", + "ip_network", + "libp2p", + "linked-hash-map", + "linked_hash_set", + "log 0.4.14", + "lru", + "parity-scale-codec", + "parking_lot 0.11.1", + "pin-project 1.0.5", + "prost", + "prost-build", + "rand 0.7.3", + "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-peerset 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde", + "serde_json", + "smallvec 1.6.1", + "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-finality-grandpa 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", + "thiserror", + "unsigned-varint 0.6.0", + "void", + "zeroize", +] + [[package]] name = "sc-network-gossip" version = "0.10.0-dev" @@ -8046,10 +8725,26 @@ dependencies = [ "log 0.4.14", "lru", "quickcheck", - "sc-network", - "sp-runtime", - "substrate-prometheus-endpoint", - "substrate-test-runtime-client", + "sc-network 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime-client 2.0.0", + "tracing", +] + +[[package]] +name = "sc-network-gossip" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "futures-timer 3.0.2", + "libp2p", + "log 0.4.14", + "lru", + "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", "tracing", ] @@ -8065,19 +8760,47 @@ dependencies = [ "log 0.4.14", "parking_lot 0.11.1", "rand 0.7.3", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sc-network", - "sc-service", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-core", - "sp-runtime", - "sp-tracing", - "substrate-test-runtime", - "substrate-test-runtime-client", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", + "sc-network 0.10.0-dev", + "sc-service 0.10.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "substrate-test-runtime 2.0.0", + "substrate-test-runtime-client 2.0.0", +] + +[[package]] +name = "sc-network-test" +version = "0.8.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-std", + "async-trait", + "futures 0.3.16", + "futures-timer 3.0.2", + "libp2p", + "log 0.4.14", + "parking_lot 0.11.1", + "rand 0.7.3", + "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-service 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-babe 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-test-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-test-runtime-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -8097,24 +8820,51 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.11.1", "rand 0.7.3", - "sc-block-builder", - "sc-client-api", - "sc-client-db", - "sc-network", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sc-utils", - "sp-api", - "sp-consensus", - "sp-core", - "sp-offchain", - "sp-runtime", - "sp-tracing", - "substrate-test-runtime-client", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-client-db 0.10.0-dev", + "sc-network 0.10.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sc-utils 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-offchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", "threadpool", "tokio", ] +[[package]] +name = "sc-offchain" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "bytes 1.0.1", + "fnv", + "futures 0.3.16", + "futures-timer 3.0.2", + "hex", + "hyper 0.14.11", + "hyper-rustls", + "log 0.4.14", + "num_cpus", + "parity-scale-codec", + "parking_lot 0.11.1", + "rand 0.7.3", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "threadpool", +] + [[package]] name = "sc-peerset" version = "4.0.0-dev" @@ -8123,7 +8873,20 @@ dependencies = [ "libp2p", "log 0.4.14", "rand 0.7.3", - "sc-utils", + "sc-utils 4.0.0-dev", + "serde_json", + "wasm-timer", +] + +[[package]] +name = "sc-peerset" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "libp2p", + "log 0.4.14", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "serde_json", "wasm-timer", ] @@ -8133,7 +8896,7 @@ name = "sc-proposer-metrics" version = "0.9.0" dependencies = [ "log 0.4.14", - "substrate-prometheus-endpoint", + "substrate-prometheus-endpoint 0.9.0", ] [[package]] @@ -8149,33 +8912,89 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder", - "sc-chain-spec", - "sc-client-api", - "sc-network", - "sc-rpc-api", - "sc-tracing", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sc-utils", + "sc-block-builder 0.10.0-dev", + "sc-chain-spec 4.0.0-dev", + "sc-client-api 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-rpc-api 0.10.0-dev", + "sc-tracing 4.0.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sc-utils 4.0.0-dev", + "serde_json", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-offchain 4.0.0-dev", + "sp-rpc 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-version 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", +] + +[[package]] +name = "sc-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "hash-db", + "jsonrpc-core", + "jsonrpc-pubsub", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.11.1", + "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-chain-spec 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-rpc-api 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde_json", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sc-rpc-api" +version = "0.10.0-dev" +dependencies = [ + "futures 0.3.16", + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "jsonrpc-pubsub", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.11.1", + "sc-chain-spec 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "serde", "serde_json", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-io", - "sp-keystore", - "sp-offchain", - "sp-rpc", - "sp-runtime", - "sp-session", - "sp-version", - "substrate-test-runtime-client", + "sp-core 4.0.0-dev", + "sp-rpc 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-version 4.0.0-dev", + "thiserror", ] [[package]] name = "sc-rpc-api" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "futures 0.3.16", "jsonrpc-core", @@ -8185,15 +9004,15 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-chain-spec", - "sc-transaction-pool-api", + "sc-chain-spec 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "serde", "serde_json", - "sp-core", - "sp-rpc", - "sp-runtime", - "sp-tracing", - "sp-version", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -8209,21 +9028,38 @@ dependencies = [ "jsonrpc-ws-server", "log 0.4.14", "serde_json", - "substrate-prometheus-endpoint", + "substrate-prometheus-endpoint 0.9.0", "tokio", ] [[package]] -name = "sc-runtime-test" -version = "2.0.0" -dependencies = [ - "sp-core", - "sp-io", - "sp-runtime", +name = "sc-rpc-server" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "jsonrpc-core", + "jsonrpc-http-server", + "jsonrpc-ipc-server", + "jsonrpc-pubsub", + "jsonrpc-ws-server", + "log 0.4.14", + "serde_json", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", + "tokio", +] + +[[package]] +name = "sc-runtime-test" +version = "2.0.0" +dependencies = [ + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", "sp-sandbox", - "sp-std", - "sp-tasks", - "substrate-wasm-builder", + "sp-std 4.0.0-dev", + "sp-tasks 4.0.0-dev", + "substrate-wasm-builder 5.0.0-dev", ] [[package]] @@ -8245,47 +9081,112 @@ dependencies = [ "parking_lot 0.11.1", "pin-project 1.0.5", "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-light", - "sc-network", - "sc-offchain", - "sc-rpc", - "sc-rpc-server", - "sc-telemetry", - "sc-tracing", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sc-utils", + "sc-block-builder 0.10.0-dev", + "sc-chain-spec 4.0.0-dev", + "sc-client-api 4.0.0-dev", + "sc-client-db 0.10.0-dev", + "sc-consensus 0.10.0-dev", + "sc-executor 0.10.0-dev", + "sc-informant 0.10.0-dev", + "sc-keystore 4.0.0-dev", + "sc-light 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-offchain 4.0.0-dev", + "sc-rpc 4.0.0-dev", + "sc-rpc-server 4.0.0-dev", + "sc-telemetry 4.0.0-dev", + "sc-tracing 4.0.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sc-utils 4.0.0-dev", + "serde", + "serde_json", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-inherents 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-storage 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-transaction-pool 4.0.0-dev", + "sp-transaction-storage-proof 4.0.0-dev", + "sp-trie 4.0.0-dev", + "sp-version 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime 2.0.0", + "substrate-test-runtime-client 2.0.0", + "tempfile", + "thiserror", + "tokio", + "tracing", + "tracing-futures", +] + +[[package]] +name = "sc-service" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "directories", + "exit-future", + "futures 0.3.16", + "futures-timer 3.0.2", + "hash-db", + "jsonrpc-core", + "jsonrpc-pubsub", + "log 0.4.14", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.11.1", + "pin-project 1.0.5", + "rand 0.7.3", + "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-chain-spec 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-db 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-informant 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-keystore 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-light 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-rpc-server 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-telemetry 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "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", - "substrate-test-runtime", - "substrate-test-runtime-client", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-block-builder 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-transaction-storage-proof 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", "tempfile", "thiserror", "tokio", @@ -8303,28 +9204,28 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder", - "sc-client-api", - "sc-client-db", - "sc-consensus", - "sc-executor", - "sc-light", - "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", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-client-db 0.10.0-dev", + "sc-consensus 0.10.0-dev", + "sc-executor 0.10.0-dev", + "sc-light 4.0.0-dev", + "sc-network 0.10.0-dev", + "sc-service 0.10.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-panic-handler 3.0.0", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-storage 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-trie 4.0.0-dev", + "substrate-test-runtime 2.0.0", + "substrate-test-runtime-client 2.0.0", "tempfile", "tokio", ] @@ -8338,8 +9239,22 @@ dependencies = [ "parity-util-mem", "parity-util-mem-derive", "parking_lot 0.11.1", - "sc-client-api", - "sp-core", + "sc-client-api 4.0.0-dev", + "sp-core 4.0.0-dev", +] + +[[package]] +name = "sc-state-db" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "log 0.4.14", + "parity-scale-codec", + "parity-util-mem", + "parity-util-mem-derive", + "parking_lot 0.11.1", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -8350,16 +9265,16 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "parity-scale-codec", - "sc-chain-spec", - "sc-client-api", + "sc-chain-spec 4.0.0-dev", + "sc-client-api 4.0.0-dev", "sc-consensus-babe", "sc-consensus-epochs", "sc-finality-grandpa", - "sc-rpc-api", + "sc-rpc-api 0.10.0-dev", "serde", "serde_json", - "sp-blockchain", - "sp-runtime", + "sp-blockchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", "thiserror", ] @@ -8380,9 +9295,56 @@ dependencies = [ "wasm-timer", ] +[[package]] +name = "sc-telemetry" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "chrono", + "futures 0.3.16", + "libp2p", + "log 0.4.14", + "parking_lot 0.11.1", + "pin-project 1.0.5", + "rand 0.7.3", + "serde", + "serde_json", + "thiserror", + "wasm-timer", +] + +[[package]] +name = "sc-tracing" +version = "4.0.0-dev" +dependencies = [ + "ansi_term 0.12.1", + "atty", + "lazy_static", + "log 0.4.14", + "once_cell", + "parking_lot 0.11.1", + "regex", + "rustc-hash", + "sc-client-api 4.0.0-dev", + "sc-rpc-server 4.0.0-dev", + "sc-tracing-proc-macro 4.0.0-dev", + "serde", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-rpc 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "thiserror", + "tracing", + "tracing-log", + "tracing-subscriber", +] + [[package]] name = "sc-tracing" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "ansi_term 0.12.1", "atty", @@ -8392,16 +9354,16 @@ dependencies = [ "parking_lot 0.11.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", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-rpc-server 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-tracing-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", "tracing", "tracing-log", @@ -8418,6 +9380,17 @@ dependencies = [ "syn", ] +[[package]] +name = "sc-tracing-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" @@ -8433,35 +9406,76 @@ dependencies = [ "parity-util-mem", "parking_lot 0.11.1", "retain_mut", - "sc-block-builder", - "sc-client-api", - "sc-transaction-pool-api", - "sc-utils", - "serde", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "sp-tracing", - "sp-transaction-pool", - "substrate-prometheus-endpoint", - "substrate-test-runtime", - "substrate-test-runtime-client", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sc-utils 4.0.0-dev", + "serde", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-transaction-pool 4.0.0-dev", + "substrate-prometheus-endpoint 0.9.0", + "substrate-test-runtime 2.0.0", + "substrate-test-runtime-client 2.0.0", "substrate-test-runtime-transaction-pool", "thiserror", ] +[[package]] +name = "sc-transaction-pool" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "intervalier", + "linked-hash-map", + "log 0.4.14", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.11.1", + "retain_mut", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", + "thiserror", +] + +[[package]] +name = "sc-transaction-pool-api" +version = "4.0.0-dev" +dependencies = [ + "derive_more", + "futures 0.3.16", + "log 0.4.14", + "serde", + "sp-blockchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "thiserror", +] + [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "derive_more", "futures 0.3.16", "log 0.4.14", "serde", - "sp-blockchain", - "sp-runtime", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -8475,6 +9489,17 @@ dependencies = [ "prometheus", ] +[[package]] +name = "sc-utils" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "futures-timer 3.0.2", + "lazy_static", + "prometheus", +] + [[package]] name = "scale-info" version = "1.0.0" @@ -8628,9 +9653,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] @@ -8656,9 +9681,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -8909,13 +9934,30 @@ dependencies = [ "hash-db", "log 0.4.14", "parity-scale-codec", - "sp-api-proc-macro", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-std", + "sp-api-proc-macro 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", "sp-test-primitives", - "sp-version", + "sp-version 4.0.0-dev", + "thiserror", +] + +[[package]] +name = "sp-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "hash-db", + "log 0.4.14", + "parity-scale-codec", + "sp-api-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -8930,6 +9972,18 @@ dependencies = [ "syn", ] +[[package]] +name = "sp-api-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "blake2-rfc", + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sp-api-test" version = "2.0.1" @@ -8939,15 +9993,15 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "rustversion", - "sc-block-builder", - "sp-api", - "sp-consensus", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-tracing", - "sp-version", - "substrate-test-runtime-client", + "sc-block-builder 0.10.0-dev", + "sp-api 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-tracing 4.0.0-dev", + "sp-version 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", "trybuild", ] @@ -8958,21 +10012,34 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-std", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "sp-application-crypto" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] name = "sp-application-crypto-test" version = "2.0.0" dependencies = [ - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "sp-runtime", - "substrate-test-runtime-client", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", ] [[package]] @@ -8987,8 +10054,23 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 3.0.0", + "sp-std 4.0.0-dev", + "static_assertions", +] + +[[package]] +name = "sp-arithmetic" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "static_assertions", ] @@ -8999,7 +10081,7 @@ dependencies = [ "honggfuzz", "num-bigint", "primitive-types", - "sp-arithmetic", + "sp-arithmetic 4.0.0-dev", ] [[package]] @@ -9008,10 +10090,10 @@ version = "4.0.0-dev" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-application-crypto", - "sp-runtime", - "sp-std", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] @@ -9020,20 +10102,44 @@ version = "4.0.0-dev" dependencies = [ "async-trait", "parity-scale-codec", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "sp-authorship" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "parity-scale-codec", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sp-block-builder" +version = "4.0.0-dev" +dependencies = [ + "parity-scale-codec", + "sp-api 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "sp-block-builder" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9045,11 +10151,29 @@ dependencies = [ "lru", "parity-scale-codec", "parking_lot 0.11.1", - "sp-api", - "sp-consensus", - "sp-database", - "sp-runtime", - "sp-state-machine", + "sp-api 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-database 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "thiserror", +] + +[[package]] +name = "sp-blockchain" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "log 0.4.14", + "lru", + "parity-scale-codec", + "parking_lot 0.11.1", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-database 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -9062,31 +10186,68 @@ dependencies = [ "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-std", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", "sp-test-primitives", - "sp-version", + "sp-version 4.0.0-dev", "thiserror", ] +[[package]] +name = "sp-consensus" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "futures 0.3.16", + "futures-timer 3.0.2", + "log 0.4.14", + "parity-scale-codec", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "thiserror", +] + +[[package]] +name = "sp-consensus-aura" +version = "0.10.0-dev" +dependencies = [ + "async-trait", + "parity-scale-codec", + "scale-info", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-slots 0.10.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-timestamp 4.0.0-dev", +] + [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "async-trait", "parity-scale-codec", "scale-info", - "sp-api", - "sp-application-crypto", - "sp-consensus", - "sp-consensus-slots", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-timestamp", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-slots 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9098,17 +10259,40 @@ dependencies = [ "parity-scale-codec", "scale-info", "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", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-slots 0.10.0-dev", + "sp-consensus-vrf 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-timestamp 4.0.0-dev", +] + +[[package]] +name = "sp-consensus-babe" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "merlin", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-slots 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-vrf 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9116,20 +10300,31 @@ name = "sp-consensus-pow" version = "0.10.0-dev" dependencies = [ "parity-scale-codec", - "sp-api", - "sp-core", - "sp-runtime", - "sp-std", + "sp-api 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "sp-consensus-slots" +version = "0.10.0-dev" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-arithmetic 4.0.0-dev", + "sp-runtime 4.0.0-dev", ] [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-runtime", + "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9138,9 +10333,21 @@ version = "0.10.0-dev" dependencies = [ "parity-scale-codec", "schnorrkel", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "sp-consensus-vrf" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "parity-scale-codec", + "schnorrkel", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9176,12 +10383,57 @@ dependencies = [ "serde", "serde_json", "sha2 0.9.3", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-serializer", - "sp-std", - "sp-storage", + "sp-debug-derive 3.0.0", + "sp-externalities 0.10.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-serializer 3.0.0", + "sp-std 4.0.0-dev", + "sp-storage 4.0.0-dev", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "tiny-keccak", + "twox-hash", + "wasmi", + "zeroize", +] + +[[package]] +name = "sp-core" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "base58", + "blake2-rfc", + "byteorder", + "dyn-clonable", + "ed25519-dalek", + "futures 0.3.16", + "hash-db", + "hash256-std-hasher", + "hex", + "impl-serde", + "lazy_static", + "libsecp256k1 0.6.0", + "log 0.4.14", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.11.1", + "primitive-types", + "rand 0.7.3", + "regex", + "scale-info", + "schnorrkel", + "secrecy", + "serde", + "sha2 0.9.3", + "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "substrate-bip39", "thiserror", "tiny-bip39", @@ -9199,6 +10451,15 @@ dependencies = [ "parking_lot 0.11.1", ] +[[package]] +name = "sp-database" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "kvdb", + "parking_lot 0.11.1", +] + [[package]] name = "sp-debug-derive" version = "3.0.0" @@ -9208,31 +10469,70 @@ dependencies = [ "syn", ] +[[package]] +name = "sp-debug-derive" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.10.0-dev" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 4.0.0-dev", + "sp-storage 4.0.0-dev", +] + [[package]] name = "sp-externalities" version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "environmental", "parity-scale-codec", - "sp-std", - "sp-storage", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sp-finality-grandpa" +version = "4.0.0-dev" +dependencies = [ + "finality-grandpa", + "log 0.4.14", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "finality-grandpa", "log 0.4.14", "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-std", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9243,9 +10543,23 @@ dependencies = [ "futures 0.3.16", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "thiserror", +] + +[[package]] +name = "sp-inherents" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -9259,16 +10573,41 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sp-core", - "sp-externalities", - "sp-keystore", - "sp-maybe-compressed-blob", - "sp-runtime-interface", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-trie", - "sp-wasm-interface", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-keystore 0.10.0-dev", + "sp-maybe-compressed-blob 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-trie 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "hash-db", + "libsecp256k1 0.6.0", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.11.1", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-maybe-compressed-blob 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "tracing", "tracing-core", ] @@ -9278,8 +10617,19 @@ name = "sp-keyring" version = "4.0.0-dev" dependencies = [ "lazy_static", - "sp-core", - "sp-runtime", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "strum 0.20.0", +] + +[[package]] +name = "sp-keyring" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "lazy_static", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "strum 0.20.0", ] @@ -9297,13 +10647,38 @@ dependencies = [ "rand_chacha 0.2.2", "schnorrkel", "serde", - "sp-core", - "sp-externalities", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", +] + +[[package]] +name = "sp-keystore" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "derive_more", + "futures 0.3.16", + "merlin", + "parity-scale-codec", + "parking_lot 0.11.1", + "schnorrkel", + "serde", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sp-maybe-compressed-blob" +version = "4.0.0-dev" +dependencies = [ + "zstd", ] [[package]] name = "sp-maybe-compressed-blob" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "zstd", ] @@ -9316,11 +10691,11 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-arithmetic", - "sp-core", + "sp-arithmetic 4.0.0-dev", + "sp-core 4.0.0-dev", "sp-npos-elections-solution-type", - "sp-runtime", - "sp-std", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", "substrate-test-utils", ] @@ -9333,7 +10708,7 @@ dependencies = [ "rand 0.7.3", "scale-info", "sp-npos-elections", - "sp-runtime", + "sp-runtime 4.0.0-dev", "structopt", ] @@ -9346,7 +10721,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "sp-arithmetic", + "sp-arithmetic 4.0.0-dev", "sp-npos-elections", "syn", "trybuild", @@ -9356,14 +10731,32 @@ dependencies = [ name = "sp-offchain" version = "4.0.0-dev" dependencies = [ - "sp-api", - "sp-core", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", +] + +[[package]] +name = "sp-offchain" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sp-panic-handler" +version = "3.0.0" +dependencies = [ + "backtrace", ] [[package]] name = "sp-panic-handler" version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "backtrace", ] @@ -9375,7 +10768,17 @@ dependencies = [ "rustc-hash", "serde", "serde_json", - "sp-core", + "sp-core 4.0.0-dev", +] + +[[package]] +name = "sp-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "rustc-hash", + "serde", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9393,15 +10796,37 @@ dependencies = [ "scale-info", "serde", "serde_json", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-state-machine", - "sp-std", - "sp-tracing", - "substrate-test-runtime-client", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-arithmetic 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", +] + +[[package]] +name = "sp-runtime" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log 0.4.14", + "parity-scale-codec", + "parity-util-mem", + "paste 1.0.4", + "rand 0.7.3", + "scale-info", + "serde", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9412,23 +10837,52 @@ dependencies = [ "parity-scale-codec", "primitive-types", "rustversion", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime-interface-proc-macro", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime-interface-proc-macro 4.0.0-dev", "sp-runtime-interface-test-wasm", - "sp-state-machine", - "sp-std", - "sp-storage", - "sp-tracing", - "sp-wasm-interface", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", + "sp-storage 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", "static_assertions", "trybuild", ] +[[package]] +name = "sp-runtime-interface" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "4.0.0-dev" +dependencies = [ + "Inflector", + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sp-runtime-interface-proc-macro" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "Inflector", "proc-macro-crate 1.0.0", @@ -9441,14 +10895,14 @@ dependencies = [ name = "sp-runtime-interface-test" version = "2.0.0" dependencies = [ - "sc-executor", - "sc-executor-common", - "sp-io", - "sp-runtime", - "sp-runtime-interface", + "sc-executor 0.10.0-dev", + "sc-executor-common 0.10.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", "sp-runtime-interface-test-wasm", "sp-runtime-interface-test-wasm-deprecated", - "sp-state-machine", + "sp-state-machine 0.10.0-dev", "tracing", "tracing-core", ] @@ -9457,22 +10911,22 @@ dependencies = [ name = "sp-runtime-interface-test-wasm" version = "2.0.0" dependencies = [ - "sp-core", - "sp-io", - "sp-runtime-interface", - "sp-std", - "substrate-wasm-builder", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-std 4.0.0-dev", + "substrate-wasm-builder 5.0.0-dev", ] [[package]] name = "sp-runtime-interface-test-wasm-deprecated" version = "2.0.0" dependencies = [ - "sp-core", - "sp-io", - "sp-runtime-interface", - "sp-std", - "substrate-wasm-builder", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-std 4.0.0-dev", + "substrate-wasm-builder 5.0.0-dev", ] [[package]] @@ -9482,10 +10936,10 @@ dependencies = [ "assert_matches", "log 0.4.14", "parity-scale-codec", - "sp-core", - "sp-io", - "sp-std", - "sp-wasm-interface", + "sp-core 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", "wasmi", "wat", ] @@ -9498,27 +10952,61 @@ dependencies = [ "serde_json", ] +[[package]] +name = "sp-serializer" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "sp-session" +version = "4.0.0-dev" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-staking 4.0.0-dev", + "sp-std 4.0.0-dev", +] + [[package]] name = "sp-session" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sp-staking" +version = "4.0.0-dev" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-core", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", ] [[package]] name = "sp-staking" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-std", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9534,12 +11022,35 @@ dependencies = [ "pretty_assertions 0.6.1", "rand 0.7.3", "smallvec 1.6.1", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-runtime", - "sp-std", - "sp-trie", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-panic-handler 3.0.0", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-trie 4.0.0-dev", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-state-machine" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "hash-db", + "log 0.4.14", + "num-traits", + "parity-scale-codec", + "parking_lot 0.11.1", + "rand 0.7.3", + "smallvec 1.6.1", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-panic-handler 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", "tracing", "trie-db", @@ -9550,16 +11061,34 @@ dependencies = [ name = "sp-std" version = "4.0.0-dev" +[[package]] +name = "sp-std" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" + +[[package]] +name = "sp-storage" +version = "4.0.0-dev" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 3.0.0", + "sp-std 4.0.0-dev", +] + [[package]] name = "sp-storage" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9568,11 +11097,24 @@ version = "4.0.0-dev" dependencies = [ "log 0.4.14", "parity-scale-codec", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime-interface", - "sp-std", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-io 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-std 4.0.0-dev", +] + +[[package]] +name = "sp-tasks" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "log 0.4.14", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9582,23 +11124,39 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "serde", - "sp-application-crypto", - "sp-core", - "sp-runtime", + "sp-application-crypto 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", +] + +[[package]] +name = "sp-timestamp" +version = "4.0.0-dev" +dependencies = [ + "async-trait", + "futures-timer 3.0.2", + "log 0.4.14", + "parity-scale-codec", + "sp-api 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "thiserror", ] [[package]] name = "sp-timestamp" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "async-trait", "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -9613,7 +11171,25 @@ dependencies = [ "serde", "serde_json", "slog", - "sp-std", + "sp-std 4.0.0-dev", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-tracing" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "erased-serde", + "log 0.4.14", + "parity-scale-codec", + "parking_lot 0.10.2", + "serde", + "serde_json", + "slog", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "tracing", "tracing-core", "tracing-subscriber", @@ -9623,23 +11199,48 @@ dependencies = [ name = "sp-transaction-pool" version = "4.0.0-dev" dependencies = [ - "sp-api", - "sp-runtime", + "sp-api 4.0.0-dev", + "sp-runtime 4.0.0-dev", +] + +[[package]] +name = "sp-transaction-pool" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", +] + +[[package]] +name = "sp-transaction-storage-proof" +version = "4.0.0-dev" +dependencies = [ + "async-trait", + "log 0.4.14", + "parity-scale-codec", + "scale-info", + "sp-core 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-trie 4.0.0-dev", ] [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "async-trait", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-trie", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9652,27 +11253,58 @@ dependencies = [ "memory-db", "parity-scale-codec", "scale-info", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", "trie-bench", "trie-db", "trie-root", "trie-standardmap", ] +[[package]] +name = "sp-trie" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "hash-db", + "memory-db", + "parity-scale-codec", + "scale-info", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-version" +version = "4.0.0-dev" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm 0.42.2", + "scale-info", + "serde", + "sp-runtime 4.0.0-dev", + "sp-std 4.0.0-dev", + "sp-version-proc-macro 4.0.0-dev", + "thiserror", +] + [[package]] name = "sp-version" version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "impl-serde", "parity-scale-codec", "parity-wasm 0.42.2", "scale-info", "serde", - "sp-runtime", - "sp-std", - "sp-version-proc-macro", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", ] @@ -9683,7 +11315,18 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "sp-version", + "sp-version 4.0.0-dev", + "syn", +] + +[[package]] +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", "syn", ] @@ -9693,7 +11336,18 @@ version = "4.0.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sp-std", + "sp-std 4.0.0-dev", + "wasmi", +] + +[[package]] +name = "sp-wasm-interface" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "wasmi", ] @@ -9778,6 +11432,9 @@ name = "strum" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" +dependencies = [ + "strum_macros 0.21.1", +] [[package]] name = "strum_macros" @@ -9835,11 +11492,11 @@ dependencies = [ name = "substrate-frame-cli" version = "4.0.0-dev" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "sc-cli", - "sp-core", - "sp-runtime", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", "structopt", ] @@ -9847,15 +11504,15 @@ dependencies = [ name = "substrate-frame-rpc-support" version = "3.0.0" dependencies = [ - "frame-support", - "frame-system", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", "futures 0.3.16", "jsonrpc-client-transports", "parity-scale-codec", - "sc-rpc-api", + "sc-rpc-api 0.10.0-dev", "scale-info", "serde", - "sp-storage", + "sp-storage 4.0.0-dev", "tokio", ] @@ -9863,29 +11520,43 @@ dependencies = [ name = "substrate-frame-rpc-system" version = "4.0.0-dev" dependencies = [ - "frame-system-rpc-runtime-api", + "frame-system-rpc-runtime-api 4.0.0-dev", "futures 0.3.16", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "log 0.4.14", "parity-scale-codec", - "sc-client-api", - "sc-rpc-api", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-tracing", - "substrate-test-runtime-client", + "sc-client-api 4.0.0-dev", + "sc-rpc-api 0.10.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-tracing 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", +] + +[[package]] +name = "substrate-prometheus-endpoint" +version = "0.9.0" +dependencies = [ + "async-std", + "derive_more", + "futures-util", + "hyper 0.14.11", + "log 0.4.14", + "prometheus", + "tokio", ] [[package]] name = "substrate-prometheus-endpoint" version = "0.9.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "async-std", "derive_more", @@ -9904,22 +11575,49 @@ dependencies = [ "futures 0.3.16", "hex", "parity-scale-codec", - "sc-client-api", - "sc-client-db", - "sc-consensus", - "sc-executor", - "sc-light", - "sc-offchain", - "sc-service", + "sc-client-api 4.0.0-dev", + "sc-client-db 0.10.0-dev", + "sc-consensus 0.10.0-dev", + "sc-executor 0.10.0-dev", + "sc-light 4.0.0-dev", + "sc-offchain 4.0.0-dev", + "sc-service 0.10.0-dev", + "serde", + "serde_json", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", +] + +[[package]] +name = "substrate-test-client" +version = "2.0.1" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "async-trait", + "futures 0.3.16", + "hex", + "parity-scale-codec", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-db 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-light 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-service 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "serde", "serde_json", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-keyring", - "sp-keystore", - "sp-runtime", - "sp-state-machine", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keyring 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9927,44 +11625,86 @@ name = "substrate-test-runtime" version = "2.0.0" dependencies = [ "cfg-if 1.0.0", - "frame-support", - "frame-system", - "frame-system-rpc-runtime-api", + "frame-support 4.0.0-dev", + "frame-system 4.0.0-dev", + "frame-system-rpc-runtime-api 4.0.0-dev", "futures 0.3.16", "log 0.4.14", "memory-db", - "pallet-babe", - "pallet-timestamp", + "pallet-babe 4.0.0-dev", + "pallet-timestamp 4.0.0-dev", + "parity-scale-codec", + "parity-util-mem", + "sc-block-builder 0.10.0-dev", + "sc-executor 0.10.0-dev", + "sc-service 0.10.0-dev", + "scale-info", + "serde", + "sp-api 4.0.0-dev", + "sp-application-crypto 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-aura 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-io 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-offchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-std 4.0.0-dev", + "sp-transaction-pool 4.0.0-dev", + "sp-trie 4.0.0-dev", + "sp-version 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", + "substrate-wasm-builder 5.0.0-dev", + "trie-db", +] + +[[package]] +name = "substrate-test-runtime" +version = "2.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "cfg-if 1.0.0", + "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-system-rpc-runtime-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "log 0.4.14", + "memory-db", + "pallet-babe 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "parity-scale-codec", "parity-util-mem", - "sc-block-builder", - "sc-executor", - "sc-service", + "sc-service 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-block-builder", - "sp-consensus", - "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-test-runtime-client", - "substrate-wasm-builder", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-block-builder 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-aura 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus-babe 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-finality-grandpa 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-keyring 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-wasm-builder 5.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "trie-db", ] @@ -9974,17 +11714,37 @@ version = "2.0.0" dependencies = [ "futures 0.3.16", "parity-scale-codec", - "sc-block-builder", - "sc-client-api", - "sc-consensus", - "sc-light", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-runtime", - "substrate-test-client", - "substrate-test-runtime", + "sc-block-builder 0.10.0-dev", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", + "sc-light 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-test-client 2.0.1", + "substrate-test-runtime 2.0.0", +] + +[[package]] +name = "substrate-test-runtime-client" +version = "2.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "futures 0.3.16", + "parity-scale-codec", + "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-light 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-test-client 2.0.1 (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-test-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=master)", ] [[package]] @@ -9995,11 +11755,11 @@ dependencies = [ "futures 0.3.16", "parity-scale-codec", "parking_lot 0.11.1", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sp-blockchain", - "sp-runtime", - "substrate-test-runtime-client", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "substrate-test-runtime-client 2.0.0", ] [[package]] @@ -10007,7 +11767,7 @@ name = "substrate-test-utils" version = "4.0.0-dev" dependencies = [ "futures 0.3.16", - "sc-service", + "sc-service 0.10.0-dev", "substrate-test-utils-derive", "tokio", "trybuild", @@ -10027,7 +11787,7 @@ dependencies = [ name = "substrate-test-utils-test-crate" version = "0.1.0" dependencies = [ - "sc-service", + "sc-service 0.10.0-dev", "substrate-test-utils", "tokio", ] @@ -10039,7 +11799,22 @@ dependencies = [ "ansi_term 0.12.1", "build-helper", "cargo_metadata", - "sp-maybe-compressed-blob", + "sp-maybe-compressed-blob 4.0.0-dev", + "tempfile", + "toml", + "walkdir", + "wasm-gc-api", +] + +[[package]] +name = "substrate-wasm-builder" +version = "5.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" +dependencies = [ + "ansi_term 0.12.1", + "build-helper", + "cargo_metadata", + "sp-maybe-compressed-blob 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", "tempfile", "toml", "walkdir", @@ -10137,43 +11912,43 @@ dependencies = [ name = "test-runner" version = "0.9.0" dependencies = [ - "frame-system", + "frame-system 4.0.0-dev", "futures 0.3.16", "jsonrpc-core", "log 0.4.14", "num-traits", "sc-basic-authorship", "sc-cli", - "sc-client-api", - "sc-consensus", + "sc-client-api 4.0.0-dev", + "sc-consensus 0.10.0-dev", "sc-consensus-babe", "sc-consensus-manual-seal", - "sc-executor", + "sc-executor 0.10.0-dev", "sc-finality-grandpa", - "sc-informant", - "sc-network", - "sc-rpc", - "sc-rpc-server", - "sc-service", - "sc-transaction-pool", - "sc-transaction-pool-api", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-core", - "sp-externalities", - "sp-finality-grandpa", - "sp-inherents", - "sp-keyring", - "sp-offchain", - "sp-runtime", - "sp-runtime-interface", - "sp-session", - "sp-state-machine", - "sp-transaction-pool", - "sp-wasm-interface", + "sc-informant 0.10.0-dev", + "sc-network 0.10.0-dev", + "sc-rpc 4.0.0-dev", + "sc-rpc-server 4.0.0-dev", + "sc-service 0.10.0-dev", + "sc-transaction-pool 4.0.0-dev", + "sc-transaction-pool-api 4.0.0-dev", + "sp-api 4.0.0-dev", + "sp-block-builder 4.0.0-dev", + "sp-blockchain 4.0.0-dev", + "sp-consensus 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-core 4.0.0-dev", + "sp-externalities 0.10.0-dev", + "sp-finality-grandpa 4.0.0-dev", + "sp-inherents 4.0.0-dev", + "sp-keyring 4.0.0-dev", + "sp-offchain 4.0.0-dev", + "sp-runtime 4.0.0-dev", + "sp-runtime-interface 4.0.0-dev", + "sp-session 4.0.0-dev", + "sp-state-machine 0.10.0-dev", + "sp-transaction-pool 4.0.0-dev", + "sp-wasm-interface 4.0.0-dev", "tokio", ] @@ -10181,21 +11956,21 @@ dependencies = [ name = "test-runner-example" version = "0.1.0" dependencies = [ - "frame-benchmarking", - "frame-system", + "frame-benchmarking 4.0.0-dev", + "frame-system 4.0.0-dev", "node-cli", "node-primitives", "node-runtime", "pallet-transaction-payment", - "sc-consensus", + "sc-consensus 0.10.0-dev", "sc-consensus-babe", "sc-consensus-manual-seal", - "sc-executor", + "sc-executor 0.10.0-dev", "sc-finality-grandpa", - "sc-service", - "sp-consensus-babe", - "sp-keyring", - "sp-runtime", + "sc-service 0.10.0-dev", + "sp-consensus-babe 0.10.0-dev", + "sp-keyring 4.0.0-dev", + "sp-runtime 4.0.0-dev", "test-runner", ] @@ -10689,15 +12464,15 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "remote-externalities", - "sc-chain-spec", + "sc-chain-spec 4.0.0-dev", "sc-cli", - "sc-executor", - "sc-service", + "sc-executor 0.10.0-dev", + "sc-service 0.10.0-dev", "serde", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-state-machine", + "sp-core 4.0.0-dev", + "sp-keystore 0.10.0-dev", + "sp-runtime 4.0.0-dev", + "sp-state-machine 0.10.0-dev", "structopt", ] diff --git a/Cargo.toml b/Cargo.toml index e110c27b20d77..71473a4bc5689 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,8 @@ members = [ "client/api", "client/authority-discovery", "client/basic-authorship", + "client/beefy", + "client/beefy/rpc", "client/block-builder", "client/chain-spec", "client/chain-spec/derive", @@ -69,6 +71,9 @@ members = [ "frame/authorship", "frame/babe", "frame/balances", + "frame/beefy", + "frame/beefy-mmr", + "frame/beefy-mmr/primitives", "frame/benchmarking", "frame/bounties", "frame/collective", @@ -138,6 +143,7 @@ members = [ "primitives/arithmetic/fuzzer", "primitives/authority-discovery", "primitives/authorship", + "primitives/beefy", "primitives/block-builder", "primitives/blockchain", "primitives/consensus/aura", diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index c4eb9861668a4..7c118c561d527 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -30,9 +30,9 @@ sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } -beefy-primitives = { path = "../beefy-primitives" } +beefy-primitives = { path = "../../primitives/beefy" } [dev-dependencies] sc-network-test = { git = "https://github.com/paritytech/substrate", branch = "master" } -beefy-test = { path = "../beefy-test" } +strum = { version = "0.21", features = ["derive"] } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 250b53de7e856..0aedd0dc83d11 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -23,4 +23,4 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } beefy-gadget = { path = "../." } -beefy-primitives = { path = "../../beefy-primitives" } +beefy-primitives = { path = "../../../primitives/beefy" } diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index 8244a089e2df4..9964b5b0de3d2 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. +// 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 @@ -33,6 +35,10 @@ use beefy_primitives::{ use crate::keystore::BeefyKeystore; +#[cfg(test)] +#[path = "gossip_tests.rs"] +mod tests; + // Limit BEEFY gossip by keeping only a bound number of voting rounds alive. const MAX_LIVE_GOSSIP_ROUNDS: usize = 3; @@ -127,10 +133,7 @@ where } fn is_known(known_votes: &KnownVotes, round: &NumberFor, hash: &MessageHash) -> bool { - known_votes - .get(round) - .map(|known| known.contains(hash)) - .unwrap_or(false) + known_votes.get(round).map(|known| known.contains(hash)).unwrap_or(false) } } @@ -144,7 +147,9 @@ where sender: &PeerId, mut data: &[u8], ) -> ValidationResult { - if let Ok(msg) = VoteMessage::, Public, Signature>::decode(&mut data) { + if let Ok(msg) = + VoteMessage::, Public, Signature>::decode(&mut data) + { let msg_hash = twox_64(data); let round = msg.commitment.block_number; @@ -178,7 +183,9 @@ where fn message_expired<'a>(&'a self) -> Box bool + 'a> { let known_votes = self.known_votes.read(); Box::new(move |_topic, mut data| { - let msg = match VoteMessage::, Public, Signature>::decode(&mut data) { + let msg = match VoteMessage::, Public, Signature>::decode( + &mut data, + ) { Ok(vote) => vote, Err(_) => return true, }; @@ -193,7 +200,9 @@ where } #[allow(clippy::type_complexity)] - fn message_allowed<'a>(&'a self) -> Box bool + 'a> { + fn message_allowed<'a>( + &'a self, + ) -> Box bool + 'a> { let do_rebroadcast = { let now = Instant::now(); let mut next_rebroadcast = self.next_rebroadcast.lock(); @@ -211,7 +220,9 @@ where return do_rebroadcast; } - let msg = match VoteMessage::, Public, Signature>::decode(&mut data) { + let msg = match VoteMessage::, Public, Signature>::decode( + &mut data, + ) { Ok(vote) => vote, Err(_) => return true, }; @@ -225,180 +236,3 @@ where }) } } - -#[cfg(test)] -mod tests { - use crate::keystore::BeefyKeystore; - - use super::*; - use beefy_primitives::{crypto::Signature, Commitment, MmrRootHash, VoteMessage, KEY_TYPE}; - use beefy_test::Keyring; - use sc_keystore::LocalKeystore; - use sc_network_test::Block; - use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; - - #[test] - fn note_round_works() { - let gv = GossipValidator::::new(); - - gv.note_round(1u64); - - let live = gv.known_votes.read(); - assert!(GossipValidator::::is_live(&live, &1u64)); - - drop(live); - - gv.note_round(3u64); - gv.note_round(7u64); - gv.note_round(10u64); - - let live = gv.known_votes.read(); - - assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - - assert!(!GossipValidator::::is_live(&live, &1u64)); - assert!(GossipValidator::::is_live(&live, &3u64)); - assert!(GossipValidator::::is_live(&live, &7u64)); - assert!(GossipValidator::::is_live(&live, &10u64)); - } - - #[test] - fn keeps_most_recent_max_rounds() { - let gv = GossipValidator::::new(); - - gv.note_round(3u64); - gv.note_round(7u64); - gv.note_round(10u64); - gv.note_round(1u64); - - let live = gv.known_votes.read(); - - assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - - assert!(GossipValidator::::is_live(&live, &3u64)); - assert!(!GossipValidator::::is_live(&live, &1u64)); - - drop(live); - - gv.note_round(23u64); - gv.note_round(15u64); - gv.note_round(20u64); - gv.note_round(2u64); - - let live = gv.known_votes.read(); - - assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - - assert!(GossipValidator::::is_live(&live, &15u64)); - assert!(GossipValidator::::is_live(&live, &20u64)); - assert!(GossipValidator::::is_live(&live, &23u64)); - } - - #[test] - fn note_same_round_twice() { - let gv = GossipValidator::::new(); - - gv.note_round(3u64); - gv.note_round(7u64); - gv.note_round(10u64); - - let live = gv.known_votes.read(); - - assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - - drop(live); - - // note round #7 again -> should not change anything - gv.note_round(7u64); - - let live = gv.known_votes.read(); - - assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); - - assert!(GossipValidator::::is_live(&live, &3u64)); - assert!(GossipValidator::::is_live(&live, &7u64)); - assert!(GossipValidator::::is_live(&live, &10u64)); - } - - struct TestContext; - impl ValidatorContext for TestContext { - fn broadcast_topic(&mut self, _topic: B::Hash, _force: bool) { - todo!() - } - - fn broadcast_message(&mut self, _topic: B::Hash, _message: Vec, _force: bool) { - todo!() - } - - fn send_message(&mut self, _who: &sc_network::PeerId, _message: Vec) { - todo!() - } - - fn send_topic(&mut self, _who: &sc_network::PeerId, _topic: B::Hash, _force: bool) { - todo!() - } - } - - fn sign_commitment(who: &Keyring, commitment: &Commitment) -> Signature { - let store: SyncCryptoStorePtr = std::sync::Arc::new(LocalKeystore::in_memory()); - SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&who.to_seed())).unwrap(); - let beefy_keystore: BeefyKeystore = Some(store).into(); - - beefy_keystore.sign(&who.public(), &commitment.encode()).unwrap() - } - - #[test] - fn should_avoid_verifying_signatures_twice() { - let gv = GossipValidator::::new(); - let sender = sc_network::PeerId::random(); - let mut context = TestContext; - - let commitment = Commitment { - payload: MmrRootHash::default(), - block_number: 3_u64, - validator_set_id: 0, - }; - - let signature = sign_commitment(&Keyring::Alice, &commitment); - - let vote = VoteMessage { - commitment, - id: Keyring::Alice.public(), - signature, - }; - - gv.note_round(3u64); - gv.note_round(7u64); - gv.note_round(10u64); - - // first time the cache should be populated. - let res = gv.validate(&mut context, &sender, &vote.encode()); - - assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); - assert_eq!( - gv.known_votes - .read() - .get(&vote.commitment.block_number) - .map(|x| x.len()), - Some(1) - ); - - // second time we should hit the cache - let res = gv.validate(&mut context, &sender, &vote.encode()); - - assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); - - // next we should quickly reject if the round is not live. - gv.note_round(11_u64); - gv.note_round(12_u64); - - assert!(!GossipValidator::::is_live( - &*gv.known_votes.read(), - &vote.commitment.block_number - )); - - let res = gv.validate(&mut context, &sender, &vote.encode()); - - assert!(matches!(res, ValidationResult::Discard)); - } -} diff --git a/client/beefy/src/gossip_tests.rs b/client/beefy/src/gossip_tests.rs new file mode 100644 index 0000000000000..0387bf08d159f --- /dev/null +++ b/client/beefy/src/gossip_tests.rs @@ -0,0 +1,182 @@ +// 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 sc_keystore::LocalKeystore; +use sc_network_test::Block; +use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; + +use beefy_primitives::{crypto::Signature, Commitment, MmrRootHash, VoteMessage, KEY_TYPE}; + +use crate::{keystore::tests::Keyring, keystore::BeefyKeystore}; + +use super::*; + +#[test] +fn note_round_works() { + let gv = GossipValidator::::new(); + + gv.note_round(1u64); + + let live = gv.known_votes.read(); + assert!(GossipValidator::::is_live(&live, &1u64)); + + drop(live); + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + + let live = gv.known_votes.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(!GossipValidator::::is_live(&live, &1u64)); + assert!(GossipValidator::::is_live(&live, &3u64)); + assert!(GossipValidator::::is_live(&live, &7u64)); + assert!(GossipValidator::::is_live(&live, &10u64)); +} + +#[test] +fn keeps_most_recent_max_rounds() { + let gv = GossipValidator::::new(); + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + gv.note_round(1u64); + + let live = gv.known_votes.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(GossipValidator::::is_live(&live, &3u64)); + assert!(!GossipValidator::::is_live(&live, &1u64)); + + drop(live); + + gv.note_round(23u64); + gv.note_round(15u64); + gv.note_round(20u64); + gv.note_round(2u64); + + let live = gv.known_votes.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(GossipValidator::::is_live(&live, &15u64)); + assert!(GossipValidator::::is_live(&live, &20u64)); + assert!(GossipValidator::::is_live(&live, &23u64)); +} + +#[test] +fn note_same_round_twice() { + let gv = GossipValidator::::new(); + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + + let live = gv.known_votes.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + drop(live); + + // note round #7 again -> should not change anything + gv.note_round(7u64); + + let live = gv.known_votes.read(); + + assert_eq!(live.len(), MAX_LIVE_GOSSIP_ROUNDS); + + assert!(GossipValidator::::is_live(&live, &3u64)); + assert!(GossipValidator::::is_live(&live, &7u64)); + assert!(GossipValidator::::is_live(&live, &10u64)); +} + +struct TestContext; +impl ValidatorContext for TestContext { + fn broadcast_topic(&mut self, _topic: B::Hash, _force: bool) { + todo!() + } + + fn broadcast_message(&mut self, _topic: B::Hash, _message: Vec, _force: bool) { + todo!() + } + + fn send_message(&mut self, _who: &sc_network::PeerId, _message: Vec) { + todo!() + } + + fn send_topic(&mut self, _who: &sc_network::PeerId, _topic: B::Hash, _force: bool) { + todo!() + } +} + +fn sign_commitment( + who: &Keyring, + commitment: &Commitment, +) -> Signature { + let store: SyncCryptoStorePtr = std::sync::Arc::new(LocalKeystore::in_memory()); + SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&who.to_seed())).unwrap(); + let beefy_keystore: BeefyKeystore = Some(store).into(); + + beefy_keystore.sign(&who.public(), &commitment.encode()).unwrap() +} + +#[test] +fn should_avoid_verifying_signatures_twice() { + let gv = GossipValidator::::new(); + let sender = sc_network::PeerId::random(); + let mut context = TestContext; + + let commitment = + Commitment { payload: MmrRootHash::default(), block_number: 3_u64, validator_set_id: 0 }; + + let signature = sign_commitment(&Keyring::Alice, &commitment); + + let vote = VoteMessage { commitment, id: Keyring::Alice.public(), signature }; + + gv.note_round(3u64); + gv.note_round(7u64); + gv.note_round(10u64); + + // first time the cache should be populated. + let res = gv.validate(&mut context, &sender, &vote.encode()); + + assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + assert_eq!(gv.known_votes.read().get(&vote.commitment.block_number).map(|x| x.len()), Some(1)); + + // second time we should hit the cache + let res = gv.validate(&mut context, &sender, &vote.encode()); + + assert!(matches!(res, ValidationResult::ProcessAndKeep(_))); + + // next we should quickly reject if the round is not live. + gv.note_round(11_u64); + gv.note_round(12_u64); + + assert!(!GossipValidator::::is_live( + &*gv.known_votes.read(), + &vote.commitment.block_number + )); + + let res = gv.validate(&mut context, &sender, &vote.encode()); + + assert!(matches!(res, ValidationResult::Discard)); +} diff --git a/client/beefy/src/keystore.rs b/client/beefy/src/keystore.rs index 04213eed219b8..a74aa891a20e2 100644 --- a/client/beefy/src/keystore.rs +++ b/client/beefy/src/keystore.rs @@ -1,3 +1,8 @@ +// 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 @@ -26,6 +31,10 @@ use beefy_primitives::{ use crate::error; +#[cfg(test)] +#[path = "keystore_tests.rs"] +pub mod tests; + /// A BEEFY specific keystore implemented as a `Newtype`. This is basically a /// wrapper around [`sp_keystore::SyncCryptoStore`] and allows to customize /// common cryptographic functionality. @@ -61,10 +70,7 @@ impl BeefyKeystore { /// /// Return the message signature or an error in case of failure. pub fn sign(&self, public: &Public, message: &[u8]) -> Result { - let store = self - .0 - .clone() - .ok_or_else(|| error::Error::Keystore("no Keystore".into()))?; + let store = self.0.clone().ok_or_else(|| error::Error::Keystore("no Keystore".into()))?; let msg = keccak_256(message); let public = public.as_ref(); @@ -74,10 +80,9 @@ impl BeefyKeystore { .ok_or_else(|| error::Error::Signature("ecdsa_sign_prehashed() 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)))?; + let sig = sig.clone().try_into().map_err(|_| { + error::Error::Signature(format!("invalid signature {:?} for key {:?}", sig, public)) + })?; Ok(sig) } @@ -85,10 +90,7 @@ impl BeefyKeystore { /// Returns a vector of [`beefy_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 store = self.0.clone().ok_or_else(|| error::Error::Keystore("no Keystore".into()))?; let pk: Vec = SyncCryptoStore::ecdsa_public_keys(&*store, KEY_TYPE) .iter() @@ -115,155 +117,3 @@ impl From> for BeefyKeystore { BeefyKeystore(store) } } - -#[cfg(test)] -mod tests { - use std::sync::Arc; - - use sc_keystore::LocalKeystore; - use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; - - use beefy_primitives::{crypto, KEY_TYPE}; - use beefy_test::Keyring; - - use super::BeefyKeystore; - use crate::error::Error; - - fn keystore() -> SyncCryptoStorePtr { - Arc::new(LocalKeystore::in_memory()) - } - - #[test] - fn authority_id_works() { - let store = keystore(); - - let alice: crypto::Public = - SyncCryptoStore::ecdsa_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: BeefyKeystore = 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); - } - - #[test] - fn sign_works() { - let store = keystore(); - - let alice: crypto::Public = - SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) - .ok() - .unwrap() - .into(); - - let store: BeefyKeystore = 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::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Bob.to_seed())) - .ok() - .unwrap(); - - let store: BeefyKeystore = 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("ecdsa_sign_prehashed() failed".to_string()); - - assert_eq!(sig, err); - } - - #[test] - fn sign_no_keystore() { - let store: BeefyKeystore = 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::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) - .ok() - .unwrap() - .into(); - - let store: BeefyKeystore = Some(store).into(); - - // `msg` and `sig` match - let msg = b"are you involved or commited?"; - let sig = store.sign(&alice, msg).unwrap(); - assert!(BeefyKeystore::verify(&alice, &sig, msg)); - - // `msg and `sig` don't match - let msg = b"you are just involved"; - assert!(!BeefyKeystore::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::ecdsa_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: BeefyKeystore = 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/beefy/src/keystore_tests.rs b/client/beefy/src/keystore_tests.rs new file mode 100644 index 0000000000000..99e3e42228df2 --- /dev/null +++ b/client/beefy/src/keystore_tests.rs @@ -0,0 +1,275 @@ +// 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::{ecdsa, keccak_256, Pair}; +use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; + +use beefy_primitives::{crypto, KEY_TYPE}; + +use super::BeefyKeystore; +use crate::error::Error; + +/// Set of test accounts using [`beefy_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); + ecdsa::Pair::from(self).sign_prehashed(&msg).into() + } + + /// Return key pair. + pub fn pair(self) -> crypto::Pair { + ecdsa::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 ecdsa::Pair { + fn from(k: Keyring) -> Self { + k.pair().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!(ecdsa::Pair::verify_prehashed( + &sig.clone().into(), + &msg, + &Keyring::Alice.public().into(), + )); + + // different public key -> fail + assert!(!ecdsa::Pair::verify_prehashed( + &sig.clone().into(), + &msg, + &Keyring::Bob.public().into(), + )); + + let msg = keccak_256(b"I am not Alice!"); + + // different msg -> fail + assert!(!ecdsa::Pair::verify_prehashed(&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::ecdsa_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: BeefyKeystore = 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); +} + +#[test] +fn sign_works() { + let store = keystore(); + + let alice: crypto::Public = + SyncCryptoStore::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) + .ok() + .unwrap() + .into(); + + let store: BeefyKeystore = 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::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Bob.to_seed())) + .ok() + .unwrap(); + + let store: BeefyKeystore = 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("ecdsa_sign_prehashed() failed".to_string()); + + assert_eq!(sig, err); +} + +#[test] +fn sign_no_keystore() { + let store: BeefyKeystore = 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::ecdsa_generate_new(&*store, KEY_TYPE, Some(&Keyring::Alice.to_seed())) + .ok() + .unwrap() + .into(); + + let store: BeefyKeystore = Some(store).into(); + + // `msg` and `sig` match + let msg = b"are you involved or commited?"; + let sig = store.sign(&alice, msg).unwrap(); + assert!(BeefyKeystore::verify(&alice, &sig, msg)); + + // `msg and `sig` don't match + let msg = b"you are just involved"; + assert!(!BeefyKeystore::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::ecdsa_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: BeefyKeystore = 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/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 0b277cb802a3f..8efa095d229ca 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -24,9 +24,9 @@ sp-io = { git = "https://github.com/paritytech/substrate", default-features = fa sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -beefy-merkle-tree = { path = "../beefy-merkle-tree", default-features = false } -beefy-primitives = { path = "../beefy-primitives", default-features = false } -pallet-beefy = { path = "../beefy-pallet", default-features = false } +beefy-merkle-tree = { path = "./primitives", default-features = false } +beefy-primitives = { path = "../../primitives/beefy", default-features = false } +pallet-beefy = { path = "../beefy", default-features = false } [dev-dependencies] sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index 4704d7681d64b..e78d401412745 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -18,7 +18,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -beefy-primitives = { path = "../beefy-primitives", default-features = false } +beefy-primitives = { path = "../../primitives/beefy", default-features = false } [dev-dependencies] sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } From 2068171b5c701955b684e074bc062721b634912c Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Tue, 21 Sep 2021 16:03:25 +0200 Subject: [PATCH 099/109] use path dependencies --- Cargo.lock | 4574 +++++++++----------------- client/beefy/Cargo.toml | 30 +- client/beefy/rpc/Cargo.toml | 8 +- client/beefy/rpc/src/lib.rs | 15 +- client/beefy/rpc/src/notification.rs | 8 +- frame/beefy-mmr/Cargo.toml | 27 +- frame/beefy/Cargo.toml | 20 +- primitives/beefy/Cargo.toml | 14 +- 8 files changed, 1555 insertions(+), 3141 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 60c7bba970fa3..23a27161f9cae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -494,7 +494,7 @@ dependencies = [ [[package]] name = "beefy-gadget" -version = "0.1.0" +version = "4.0.0-dev" dependencies = [ "beefy-primitives", "fnv", @@ -502,19 +502,19 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-keystore 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network-gossip 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network-test 0.8.0 (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api", + "sc-keystore", + "sc-network", + "sc-network-gossip", + "sc-network-test", + "sc-utils", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-blockchain", + "sp-core", + "sp-keystore", + "sp-runtime", "strum 0.21.0", "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", "thiserror", @@ -523,7 +523,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" -version = "0.1.0" +version = "4.0.0-dev" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -534,10 +534,10 @@ dependencies = [ "jsonrpc-pubsub", "log 0.4.14", "parity-scale-codec", - "sc-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-rpc", "serde", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-runtime", ] [[package]] @@ -553,17 +553,17 @@ dependencies = [ [[package]] name = "beefy-primitives" -version = "0.1.0" +version = "4.0.0-dev" dependencies = [ "hex-literal", "parity-scale-codec", "scale-info", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-std", ] [[package]] @@ -916,10 +916,10 @@ dependencies = [ "ansi_term 0.12.1", "node-cli", "rand 0.7.3", - "sc-chain-spec 4.0.0-dev", - "sc-keystore 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-keystore 0.10.0-dev", + "sc-chain-spec", + "sc-keystore", + "sp-core", + "sp-keystore", "structopt", ] @@ -1938,14 +1938,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "fork-tree" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "parity-scale-codec", -] - [[package]] name = "form_urlencoded" version = "1.0.1" @@ -1960,40 +1952,20 @@ dependencies = [ name = "frame-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "hex-literal", "linregress", "log 0.4.14", "parity-scale-codec", "paste 1.0.4", "scale-info", - "sp-api 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", -] - -[[package]] -name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "linregress", - "log 0.4.14", - "parity-scale-codec", - "paste 1.0.4", - "scale-info", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", + "sp-storage", ] [[package]] @@ -2002,22 +1974,22 @@ version = "4.0.0-dev" dependencies = [ "Inflector", "chrono", - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", + "frame-benchmarking", + "frame-support", "handlebars", "linked-hash-map", "log 0.4.14", "parity-scale-codec", "sc-cli", - "sc-client-db 0.10.0-dev", - "sc-executor 0.10.0-dev", - "sc-service 0.10.0-dev", - "serde", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", + "sc-client-db", + "sc-executor", + "sc-service", + "serde", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime", + "sp-state-machine", "structopt", ] @@ -2025,36 +1997,36 @@ dependencies = [ name = "frame-election-provider-support" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", + "sp-arithmetic", + "sp-core", + "sp-io", "sp-npos-elections", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-runtime", + "sp-std", ] [[package]] name = "frame-executive" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "hex-literal", "pallet-balances", "pallet-transaction-payment", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-version 4.0.0-dev", + "sp-core", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", + "sp-version", ] [[package]] @@ -2076,8 +2048,8 @@ dependencies = [ "assert_matches", "bitflags", "frame-metadata", - "frame-support-procedural 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support-procedural", + "frame-system", "impl-trait-for-tuples", "log 0.4.14", "once_cell", @@ -2088,73 +2060,23 @@ dependencies = [ "scale-info", "serde", "smallvec 1.6.1", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", -] - -[[package]] -name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "bitflags", - "frame-metadata", - "frame-support-procedural 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "impl-trait-for-tuples", - "log 0.4.14", - "once_cell", - "parity-scale-codec", - "paste 1.0.4", - "scale-info", - "serde", - "smallvec 1.6.1", - "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "frame-support-procedural" -version = "4.0.0-dev" -dependencies = [ - "Inflector", - "frame-support-procedural-tools 4.0.0-dev", - "proc-macro2", - "quote", - "syn", + "sp-arithmetic", + "sp-core", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-state-machine", + "sp-std", + "sp-tracing", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "Inflector", - "frame-support-procedural-tools 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-support-procedural-tools" -version = "4.0.0-dev" -dependencies = [ - "frame-support-procedural-tools-derive 3.0.0", - "proc-macro-crate 1.0.0", + "frame-support-procedural-tools", "proc-macro2", "quote", "syn", @@ -2163,9 +2085,8 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-support-procedural-tools-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support-procedural-tools-derive", "proc-macro-crate 1.0.0", "proc-macro2", "quote", @@ -2181,35 +2102,25 @@ dependencies = [ "syn", ] -[[package]] -name = "frame-support-procedural-tools-derive" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "frame-support-test" version = "3.0.0" dependencies = [ - "frame-support 4.0.0-dev", + "frame-support", "frame-support-test-pallet", - "frame-system 4.0.0-dev", + "frame-system", "parity-scale-codec", "pretty_assertions 0.6.1", "rustversion", "scale-info", "serde", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-version 4.0.0-dev", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-version", "trybuild", ] @@ -2217,8 +2128,8 @@ dependencies = [ name = "frame-support-test-pallet" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", ] @@ -2228,77 +2139,51 @@ name = "frame-system" version = "4.0.0-dev" dependencies = [ "criterion", - "frame-support 4.0.0-dev", - "log 0.4.14", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-version 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", -] - -[[package]] -name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support", "log 0.4.14", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-externalities", + "sp-io", + "sp-runtime", + "sp-std", + "sp-version", + "substrate-test-runtime-client", ] [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "frame-system-rpc-runtime-api" -version = "4.0.0-dev" -dependencies = [ - "parity-scale-codec", - "sp-api 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", ] [[package]] name = "frame-try-runtime" version = "0.10.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "frame-support", + "sp-api", + "sp-runtime", + "sp-std", ] [[package]] @@ -2509,12 +2394,12 @@ version = "3.0.0" dependencies = [ "chrono", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "git2", "num-format", "pallet-staking", - "sp-io 4.0.0-dev", + "sp-io", "structopt", ] @@ -4600,19 +4485,19 @@ dependencies = [ "parity-util-mem", "rand 0.7.3", "sc-basic-authorship", - "sc-client-api 4.0.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", + "sc-client-api", + "sc-transaction-pool", + "sc-transaction-pool-api", "serde", "serde_json", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-timestamp 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-trie 4.0.0-dev", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "sp-timestamp", + "sp-tracing", + "sp-trie", "structopt", "tempfile", ] @@ -4624,7 +4509,7 @@ dependencies = [ "assert_cmd", "async-std", "frame-benchmarking-cli", - "frame-system 4.0.0-dev", + "frame-system", "futures 0.3.16", "hex-literal", "log 0.4.14", @@ -4642,44 +4527,44 @@ dependencies = [ "regex", "sc-authority-discovery", "sc-basic-authorship", - "sc-chain-spec 4.0.0-dev", + "sc-chain-spec", "sc-cli", - "sc-client-api 4.0.0-dev", - "sc-client-db 0.10.0-dev", - "sc-consensus 0.10.0-dev", + "sc-client-api", + "sc-client-db", + "sc-consensus", "sc-consensus-babe", "sc-consensus-epochs", "sc-consensus-slots", "sc-consensus-uncles", - "sc-executor 0.10.0-dev", + "sc-executor", "sc-finality-grandpa", - "sc-keystore 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-rpc 4.0.0-dev", - "sc-service 0.10.0-dev", + "sc-keystore", + "sc-network", + "sc-rpc", + "sc-service", "sc-service-test", "sc-sync-state-rpc", - "sc-telemetry 4.0.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", + "sc-telemetry", + "sc-transaction-pool", + "sc-transaction-pool-api", "serde", "serde_json", "soketto 0.4.2", "sp-authority-discovery", - "sp-authorship 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-timestamp 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-transaction-pool 4.0.0-dev", - "sp-transaction-storage-proof 4.0.0-dev", - "sp-trie 4.0.0-dev", + "sp-authorship", + "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-transaction-storage-proof", + "sp-trie", "structopt", "substrate-build-script-utils", "substrate-frame-cli", @@ -4692,9 +4577,9 @@ name = "node-executor" version = "3.0.0-dev" dependencies = [ "criterion", - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "futures 0.3.16", "node-primitives", "node-runtime", @@ -4702,19 +4587,19 @@ dependencies = [ "pallet-balances", "pallet-contracts", "pallet-im-online", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "pallet-treasury", "parity-scale-codec", - "sc-executor 0.10.0-dev", + "sc-executor", "scale-info", - "sp-application-crypto 4.0.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-trie 4.0.0-dev", + "sp-application-crypto", + "sp-consensus-babe", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime", + "sp-state-machine", + "sp-trie", "wat", ] @@ -4725,12 +4610,12 @@ dependencies = [ "derive_more", "parity-scale-codec", "sc-cli", - "sc-client-api 4.0.0-dev", - "sc-executor 0.10.0-dev", - "sc-service 0.10.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sc-client-api", + "sc-executor", + "sc-service", + "sp-blockchain", + "sp-core", + "sp-runtime", "structopt", ] @@ -4738,12 +4623,12 @@ dependencies = [ name = "node-primitives" version = "2.0.0" dependencies = [ - "frame-system 4.0.0-dev", + "frame-system", "parity-scale-codec", "scale-info", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-application-crypto", + "sp-core", + "sp-runtime", ] [[package]] @@ -4755,24 +4640,24 @@ dependencies = [ "pallet-contracts-rpc", "pallet-mmr-rpc", "pallet-transaction-payment-rpc", - "sc-chain-spec 4.0.0-dev", - "sc-client-api 4.0.0-dev", + "sc-chain-spec", + "sc-client-api", "sc-consensus-babe", "sc-consensus-babe-rpc", "sc-consensus-epochs", "sc-finality-grandpa", "sc-finality-grandpa-rpc", - "sc-rpc 4.0.0-dev", - "sc-rpc-api 0.10.0-dev", + "sc-rpc", + "sc-rpc-api", "sc-sync-state-rpc", - "sc-transaction-pool-api 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-keystore", + "sp-runtime", "substrate-frame-rpc-system", ] @@ -4783,29 +4668,29 @@ dependencies = [ "futures 0.3.16", "jsonrpc-core-client", "node-primitives", - "sc-rpc 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sc-rpc", + "sp-tracing", ] [[package]] name = "node-runtime" version = "3.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", "frame-executive", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "frame-system-benchmarking", - "frame-system-rpc-runtime-api 4.0.0-dev", + "frame-system-rpc-runtime-api", "frame-try-runtime", "hex-literal", "log 0.4.14", "node-primitives", "pallet-assets", "pallet-authority-discovery", - "pallet-authorship 4.0.0-dev", - "pallet-babe 4.0.0-dev", + "pallet-authorship", + "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-bounties", @@ -4823,7 +4708,7 @@ dependencies = [ "pallet-indices", "pallet-lottery", "pallet-membership", - "pallet-mmr 4.0.0-dev", + "pallet-mmr", "pallet-multisig", "pallet-offences", "pallet-offences-benchmarking", @@ -4831,13 +4716,13 @@ dependencies = [ "pallet-randomness-collective-flip", "pallet-recovery", "pallet-scheduler", - "pallet-session 4.0.0-dev", + "pallet-session", "pallet-session-benchmarking", "pallet-society", "pallet-staking", "pallet-staking-reward-curve", "pallet-sudo", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -4848,24 +4733,24 @@ dependencies = [ "pallet-vesting", "parity-scale-codec", "scale-info", - "sp-api 4.0.0-dev", + "sp-api", "sp-authority-discovery", - "sp-block-builder 4.0.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keyring 4.0.0-dev", + "sp-block-builder", + "sp-consensus-babe", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keyring", "sp-npos-elections", - "sp-offchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-transaction-pool 4.0.0-dev", - "sp-version 4.0.0-dev", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-transaction-pool", + "sp-version", "static_assertions", - "substrate-wasm-builder 5.0.0-dev", + "substrate-wasm-builder", ] [[package]] @@ -4881,34 +4766,34 @@ dependencies = [ name = "node-template" version = "3.0.0" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-benchmarking-cli", "jsonrpc-core", "node-template-runtime", "pallet-transaction-payment-rpc", "sc-basic-authorship", "sc-cli", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", + "sc-client-api", + "sc-consensus", "sc-consensus-aura", - "sc-executor 0.10.0-dev", + "sc-executor", "sc-finality-grandpa", - "sc-keystore 4.0.0-dev", - "sc-rpc 4.0.0-dev", - "sc-rpc-api 0.10.0-dev", - "sc-service 0.10.0-dev", - "sc-telemetry 4.0.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-aura 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-timestamp 4.0.0-dev", + "sc-keystore", + "sc-rpc", + "sc-rpc-api", + "sc-service", + "sc-telemetry", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-core", + "sp-finality-grandpa", + "sp-runtime", + "sp-timestamp", "structopt", "substrate-build-script-utils", "substrate-frame-rpc-system", @@ -4918,12 +4803,12 @@ dependencies = [ name = "node-template-runtime" version = "3.0.0" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-executive", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "frame-system-benchmarking", - "frame-system-rpc-runtime-api 4.0.0-dev", + "frame-system-rpc-runtime-api", "hex-literal", "pallet-aura", "pallet-balances", @@ -4931,30 +4816,30 @@ dependencies = [ "pallet-randomness-collective-flip", "pallet-sudo", "pallet-template", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "scale-info", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-consensus-aura 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-offchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-transaction-pool 4.0.0-dev", - "sp-version 4.0.0-dev", - "substrate-wasm-builder 5.0.0-dev", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder", ] [[package]] name = "node-testing" version = "3.0.0-dev" dependencies = [ - "frame-system 4.0.0-dev", + "frame-system", "fs_extra", "futures 0.3.16", "log 0.4.14", @@ -4963,23 +4848,23 @@ dependencies = [ "node-runtime", "pallet-transaction-payment", "parity-scale-codec", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-client-db 0.10.0-dev", - "sc-consensus 0.10.0-dev", - "sc-executor 0.10.0-dev", - "sc-service 0.10.0-dev", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-timestamp 4.0.0-dev", - "substrate-test-client 2.0.1", + "sc-block-builder", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-executor", + "sc-service", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keyring", + "sp-runtime", + "sp-timestamp", + "substrate-test-client", "tempfile", ] @@ -5207,262 +5092,223 @@ dependencies = [ name = "pallet-assets" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-atomic-swap" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-aura" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "pallet-timestamp 4.0.0-dev", + "frame-support", + "frame-system", + "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto 4.0.0-dev", - "sp-consensus-aura 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-application-crypto", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "pallet-session 4.0.0-dev", + "frame-support", + "frame-system", + "pallet-session", "parity-scale-codec", "scale-info", - "sp-application-crypto 4.0.0-dev", + "sp-application-crypto", "sp-authority-discovery", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "pallet-authorship" -version = "4.0.0-dev" -dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-authorship 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support", + "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-authorship 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-authorship", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-babe" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "log 0.4.14", - "pallet-authorship 4.0.0-dev", + "pallet-authorship", "pallet-balances", "pallet-offences", - "pallet-session 4.0.0-dev", + "pallet-session", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp 4.0.0-dev", - "parity-scale-codec", - "scale-info", - "sp-application-crypto 4.0.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-consensus-vrf 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "pallet-babe" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "frame-benchmarking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "log 0.4.14", - "pallet-authorship 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "pallet-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-babe 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-vrf 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-application-crypto", + "sp-consensus-babe", + "sp-consensus-vrf", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", ] [[package]] name = "pallet-bags-list" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", ] [[package]] name = "pallet-balances" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "pallet-transaction-payment", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-beefy" -version = "0.1.0" +version = "4.0.0-dev" dependencies = [ "beefy-primitives", - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "pallet-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support", + "frame-system", + "pallet-session", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", ] [[package]] name = "pallet-beefy-mmr" -version = "0.1.0" +version = "4.0.0-dev" dependencies = [ "beefy-merkle-tree", "beefy-primitives", - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support", + "frame-system", "hex", "hex-literal", "libsecp256k1 0.7.0", "log 0.4.14", "pallet-beefy", - "pallet-mmr 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "pallet-mmr-primitives 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "pallet-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-mmr", + "pallet-mmr-primitives", + "pallet-session", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", ] [[package]] name = "pallet-bounties" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "pallet-treasury", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-collective" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] @@ -5471,9 +5317,9 @@ version = "4.0.0-dev" dependencies = [ "assert_matches", "bitflags", - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "hex-literal", "libsecp256k1 0.3.5", "log 0.4.14", @@ -5481,7 +5327,7 @@ dependencies = [ "pallet-contracts-primitives", "pallet-contracts-proc-macro", "pallet-randomness-collective-flip", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "pallet-utility", "parity-scale-codec", "pretty_assertions 0.7.2", @@ -5491,11 +5337,11 @@ dependencies = [ "scale-info", "serde", "smallvec 1.6.1", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", "sp-sandbox", - "sp-std 4.0.0-dev", + "sp-std", "wasmi-validation", "wat", ] @@ -5508,9 +5354,9 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-runtime", + "sp-std", ] [[package]] @@ -5534,11 +5380,11 @@ dependencies = [ "parity-scale-codec", "serde", "serde_json", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-rpc 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", ] [[package]] @@ -5548,50 +5394,50 @@ dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", "scale-info", - "sp-api 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-api", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-democracy" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "pallet-scheduler", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "log 0.4.14", "pallet-balances", "parity-scale-codec", "parking_lot 0.11.1", "rand 0.7.3", "scale-info", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", + "sp-arithmetic", + "sp-core", + "sp-io", "sp-npos-elections", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sp-runtime", + "sp-std", + "sp-tracing", "static_assertions", "strum 0.21.0", "strum_macros 0.21.1", @@ -5601,33 +5447,33 @@ dependencies = [ name = "pallet-elections" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", + "sp-core", + "sp-io", "sp-npos-elections", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-runtime", + "sp-std", "substrate-test-utils", ] @@ -5635,66 +5481,66 @@ dependencies = [ name = "pallet-example" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-example-offchain-worker" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "lite-json", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-example-parallel" version = "3.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-tasks 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tasks", ] [[package]] name = "pallet-gilt" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] @@ -5702,29 +5548,29 @@ name = "pallet-grandpa" version = "4.0.0-dev" dependencies = [ "finality-grandpa", - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "log 0.4.14", - "pallet-authorship 4.0.0-dev", + "pallet-authorship", "pallet-balances", "pallet-offences", - "pallet-session 4.0.0-dev", + "pallet-session", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-application-crypto", + "sp-core", + "sp-finality-grandpa", + "sp-io", + "sp-keyring", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", ] [[package]] @@ -5732,86 +5578,86 @@ name = "pallet-identity" version = "4.0.0-dev" dependencies = [ "enumflags2", - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-im-online" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", - "pallet-authorship 4.0.0-dev", - "pallet-session 4.0.0-dev", + "pallet-authorship", + "pallet-session", "parity-scale-codec", "scale-info", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", ] [[package]] name = "pallet-indices" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-keyring", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-lottery" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", + "frame-benchmarking", + "frame-support", "frame-support-test", - "frame-system 4.0.0-dev", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-membership" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] @@ -5820,67 +5666,33 @@ version = "4.0.0-dev" dependencies = [ "ckb-merkle-mountain-range", "env_logger 0.9.0", - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "hex-literal", - "pallet-mmr-primitives 4.0.0-dev", - "parity-scale-codec", - "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "pallet-mmr" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "ckb-merkle-mountain-range", - "frame-benchmarking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "pallet-mmr-primitives 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-mmr-primitives", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-mmr-primitives" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "hex-literal", "log 0.4.14", "parity-scale-codec", "serde", - "sp-api 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "pallet-mmr-primitives" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "log 0.4.14", - "parity-scale-codec", - "serde", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-core", + "sp-runtime", + "sp-std", ] [[package]] @@ -5890,167 +5702,167 @@ dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "pallet-mmr-primitives 4.0.0-dev", + "pallet-mmr-primitives", "parity-scale-codec", "serde", "serde_json", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-runtime", ] [[package]] name = "pallet-multisig" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-nicks" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-node-authorization" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-offences" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", ] [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "pallet-babe 4.0.0-dev", + "frame-support", + "frame-system", + "pallet-babe", "pallet-balances", "pallet-grandpa", "pallet-im-online", "pallet-offences", - "pallet-session 4.0.0-dev", + "pallet-session", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", ] [[package]] name = "pallet-proxy" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "pallet-utility", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "parity-scale-codec", "safe-mix", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-recovery" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-scheduler" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", "substrate-test-utils", ] @@ -6058,125 +5870,104 @@ dependencies = [ name = "pallet-scored-pool" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "pallet-session" -version = "4.0.0-dev" -dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "impl-trait-for-tuples", - "log 0.4.14", - "pallet-timestamp 4.0.0-dev", - "parity-scale-codec", - "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-trie 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-support", + "frame-system", "impl-trait-for-tuples", "log 0.4.14", - "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-trie", ] [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "pallet-balances", - "pallet-session 4.0.0-dev", + "pallet-session", "pallet-staking", "pallet-staking-reward-curve", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "parity-scale-codec", "rand 0.7.3", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-std", ] [[package]] name = "pallet-society" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", + "frame-support", "frame-support-test", - "frame-system 4.0.0-dev", + "frame-system", "pallet-balances", "parity-scale-codec", "rand_chacha 0.2.2", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-staking" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "log 0.4.14", - "pallet-authorship 4.0.0-dev", + "pallet-authorship", "pallet-bags-list", "pallet-balances", - "pallet-session 4.0.0-dev", + "pallet-session", "pallet-staking-reward-curve", - "pallet-timestamp 4.0.0-dev", + "pallet-timestamp", "parity-scale-codec", "rand_chacha 0.2.2", "scale-info", "serde", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", + "sp-application-crypto", + "sp-core", + "sp-io", "sp-npos-elections", - "sp-runtime 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sp-runtime", + "sp-staking", + "sp-std", + "sp-tracing", "substrate-test-utils", ] @@ -6187,7 +5978,7 @@ dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", "quote", - "sp-runtime 4.0.0-dev", + "sp-runtime", "syn", ] @@ -6196,108 +5987,91 @@ name = "pallet-staking-reward-fn" version = "4.0.0-dev" dependencies = [ "log 0.4.14", - "sp-arithmetic 4.0.0-dev", + "sp-arithmetic", ] [[package]] name = "pallet-sudo" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-template" version = "3.0.0" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "parity-scale-codec", - "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", -] - -[[package]] -name = "pallet-timestamp" -version = "4.0.0-dev" -dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "log 0.4.14", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-timestamp 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", ] [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "frame-benchmarking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-std", + "sp-timestamp", ] [[package]] name = "pallet-tips" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "pallet-balances", "pallet-treasury", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-storage", ] [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", "serde", "serde_json", "smallvec 1.6.1", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] @@ -6309,11 +6083,11 @@ dependencies = [ "jsonrpc-derive", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-rpc 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", ] [[package]] @@ -6322,95 +6096,95 @@ version = "4.0.0-dev" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", - "sp-api 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-api", + "sp-runtime", ] [[package]] name = "pallet-transaction-storage" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "hex-literal", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-transaction-storage-proof 4.0.0-dev", + "sp-core", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-std", + "sp-transaction-storage-proof", ] [[package]] name = "pallet-treasury" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "impl-trait-for-tuples", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-uniques" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-utility" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] name = "pallet-vesting" version = "4.0.0-dev" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-support", + "frame-system", "log 0.4.14", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", ] [[package]] @@ -7523,10 +7297,10 @@ dependencies = [ "parity-scale-codec", "serde", "serde_json", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-version 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", + "sp-version", "tokio", ] @@ -7712,19 +7486,8 @@ name = "sc-allocator" version = "4.0.0-dev" dependencies = [ "log 0.4.14", - "sp-core 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", - "thiserror", -] - -[[package]] -name = "sc-allocator" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "log 0.4.14", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-wasm-interface", "thiserror", ] @@ -7744,17 +7507,17 @@ dependencies = [ "prost-build", "quickcheck", "rand 0.7.3", - "sc-client-api 4.0.0-dev", - "sc-network 0.10.0-dev", - "sp-api 4.0.0-dev", + "sc-client-api", + "sc-network", + "sp-api", "sp-authority-discovery", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sp-blockchain", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-tracing", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime-client", ] [[package]] @@ -7766,99 +7529,56 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", + "sc-block-builder", + "sc-client-api", "sc-proposer-metrics", - "sc-telemetry 4.0.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sc-telemetry", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-runtime", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime-client 2.0.0", -] - -[[package]] -name = "sc-block-builder" -version = "0.10.0-dev" -dependencies = [ - "parity-scale-codec", - "sc-client-api 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime-client", ] [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "parity-scale-codec", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-block-builder 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sc-chain-spec" -version = "4.0.0-dev" dependencies = [ - "impl-trait-for-tuples", "parity-scale-codec", - "sc-chain-spec-derive 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-telemetry 4.0.0-dev", - "serde", - "serde_json", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sc-client-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "substrate-test-runtime-client", ] [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sc-chain-spec-derive 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-telemetry 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-chain-spec-derive", + "sc-network", + "sc-telemetry", "serde", "serde_json", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sc-chain-spec-derive" -version = "4.0.0-dev" -dependencies = [ - "proc-macro-crate 1.0.0", - "proc-macro2", - "quote", - "syn", + "sp-core", + "sp-runtime", ] [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -7881,22 +7601,22 @@ dependencies = [ "rand 0.7.3", "regex", "rpassword", - "sc-client-api 4.0.0-dev", - "sc-keystore 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-service 0.10.0-dev", - "sc-telemetry 4.0.0-dev", - "sc-tracing 4.0.0-dev", - "sc-utils 4.0.0-dev", + "sc-client-api", + "sc-keystore", + "sc-network", + "sc-service", + "sc-telemetry", + "sc-tracing", + "sc-utils", "serde", "serde_json", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-panic-handler 3.0.0", - "sp-runtime 4.0.0-dev", - "sp-version 4.0.0-dev", + "sp-blockchain", + "sp-core", + "sp-keyring", + "sp-keystore", + "sp-panic-handler", + "sp-runtime", + "sp-version", "structopt", "tempfile", "thiserror", @@ -7914,54 +7634,26 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-executor 0.10.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sc-utils 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-database 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-storage 4.0.0-dev", + "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-test-primitives", - "sp-trie 4.0.0-dev", + "sp-trie", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime 2.0.0", + "substrate-test-runtime", "thiserror", ] -[[package]] -name = "sc-client-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "fnv", - "futures 0.3.16", - "hash-db", - "log 0.4.14", - "parity-scale-codec", - "parking_lot 0.11.1", - "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-database 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", -] - [[package]] name = "sc-client-db" version = "0.10.0-dev" @@ -7976,43 +7668,20 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.11.1", "quickcheck", - "sc-client-api 4.0.0-dev", - "sc-state-db 0.10.0-dev", - "sp-arithmetic 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-database 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-tracing 4.0.0-dev", - "sp-trie 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sc-client-api", + "sc-state-db", + "sp-arithmetic", + "sp-blockchain", + "sp-core", + "sp-database", + "sp-runtime", + "sp-state-machine", + "sp-tracing", + "sp-trie", + "substrate-test-runtime-client", "tempfile", ] -[[package]] -name = "sc-client-db" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "hash-db", - "kvdb", - "kvdb-memorydb", - "linked-hash-map", - "log 0.4.14", - "parity-scale-codec", - "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-state-db 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-database 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - [[package]] name = "sc-consensus" version = "0.10.0-dev" @@ -8023,44 +7692,20 @@ dependencies = [ "libp2p", "log 0.4.14", "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev", - "sc-utils 4.0.0-dev", - "serde", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", + "sc-client-api", + "sc-utils", + "serde", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "sp-state-machine", "sp-test-primitives", "substrate-prometheus-endpoint 0.9.0", "thiserror", ] -[[package]] -name = "sc-consensus" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "futures 0.3.16", - "futures-timer 3.0.2", - "libp2p", - "log 0.4.14", - "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "serde", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", - "thiserror", -] - [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" @@ -8072,30 +7717,30 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", + "sc-block-builder", + "sc-client-api", + "sc-consensus", "sc-consensus-slots", - "sc-keystore 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-network-test 0.8.0", - "sc-telemetry 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-aura 0.10.0-dev", - "sp-consensus-slots 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-timestamp 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sc-keystore", + "sc-network", + "sc-network-test", + "sc-telemetry", + "sp-api", + "sp-application-crypto", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-keyring", + "sp-keystore", + "sp-runtime", + "sp-timestamp", + "sp-tracing", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime-client", "tempfile", ] @@ -8105,7 +7750,7 @@ version = "0.10.0-dev" dependencies = [ "async-trait", "derive_more", - "fork-tree 3.0.0", + "fork-tree", "futures 0.3.16", "log 0.4.14", "merlin", @@ -8117,35 +7762,35 @@ dependencies = [ "rand 0.7.3", "rand_chacha 0.2.2", "retain_mut", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", + "sc-block-builder", + "sc-client-api", + "sc-consensus", "sc-consensus-epochs", "sc-consensus-slots", - "sc-keystore 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-network-test 0.8.0", - "sc-telemetry 4.0.0-dev", + "sc-keystore", + "sc-network", + "sc-network-test", + "sc-telemetry", "schnorrkel", "serde", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-consensus-slots 0.10.0-dev", - "sp-consensus-vrf 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-timestamp 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-version 4.0.0-dev", + "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-timestamp", + "sp-tracing", + "sp-version", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime-client", "tempfile", ] @@ -8158,23 +7803,23 @@ dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", - "sc-consensus 0.10.0-dev", + "sc-consensus", "sc-consensus-babe", "sc-consensus-epochs", - "sc-keystore 4.0.0-dev", - "sc-rpc-api 0.10.0-dev", + "sc-keystore", + "sc-rpc-api", "serde", "serde_json", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sp-api", + "sp-application-crypto", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core", + "sp-keyring", + "sp-keystore", + "sp-runtime", + "substrate-test-runtime-client", "tempfile", ] @@ -8182,12 +7827,12 @@ dependencies = [ name = "sc-consensus-epochs" version = "0.10.0-dev" dependencies = [ - "fork-tree 3.0.0", + "fork-tree", "parity-scale-codec", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sc-client-api", + "sc-consensus", + "sp-blockchain", + "sp-runtime", ] [[package]] @@ -8204,25 +7849,25 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "sc-basic-authorship", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", + "sc-client-api", + "sc-consensus", "sc-consensus-babe", "sc-consensus-epochs", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "serde", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-consensus-slots 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-timestamp 4.0.0-dev", + "sc-transaction-pool", + "sc-transaction-pool-api", + "serde", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "sp-timestamp", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime-client", "substrate-test-runtime-transaction-pool", "tokio", ] @@ -8238,16 +7883,16 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", + "sc-client-api", + "sc-consensus", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", "sp-consensus-pow", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-core", + "sp-inherents", + "sp-runtime", "substrate-prometheus-endpoint 0.9.0", ] @@ -8260,20 +7905,20 @@ dependencies = [ "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", - "sc-telemetry 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-arithmetic 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-slots 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-timestamp 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sc-client-api", + "sc-consensus", + "sc-telemetry", + "sp-api", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "sp-timestamp", + "substrate-test-runtime-client", "thiserror", ] @@ -8281,9 +7926,9 @@ dependencies = [ name = "sc-consensus-uncles" version = "0.10.0-dev" dependencies = [ - "sc-client-api 4.0.0-dev", - "sp-authorship 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sc-client-api", + "sp-authorship", + "sp-runtime", "thiserror", ] @@ -8299,25 +7944,25 @@ dependencies = [ "parking_lot 0.11.1", "paste 1.0.4", "regex", - "sc-executor-common 0.10.0-dev", - "sc-executor-wasmi 0.10.0-dev", + "sc-executor-common", + "sc-executor-wasmi", "sc-executor-wasmtime", "sc-runtime-test", - "sc-tracing 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-io 4.0.0-dev", - "sp-maybe-compressed-blob 4.0.0-dev", - "sp-panic-handler 3.0.0", - "sp-runtime 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-tasks 4.0.0-dev", - "sp-trie 4.0.0-dev", - "sp-version 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", - "substrate-test-runtime 2.0.0", + "sc-tracing", + "sp-api", + "sp-core", + "sp-externalities", + "sp-io", + "sp-maybe-compressed-blob", + "sp-panic-handler", + "sp-runtime", + "sp-runtime-interface", + "sp-state-machine", + "sp-tasks", + "sp-trie", + "sp-version", + "sp-wasm-interface", + "substrate-test-runtime", "tracing", "tracing-subscriber", "wasmi", @@ -8325,95 +7970,36 @@ dependencies = [ ] [[package]] -name = "sc-executor" +name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "lazy_static", - "libsecp256k1 0.6.0", - "log 0.4.14", - "parity-scale-codec", - "parking_lot 0.11.1", - "sc-executor-common 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-executor-wasmi 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-panic-handler 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tasks 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "wasmi", -] - -[[package]] -name = "sc-executor-common" -version = "0.10.0-dev" -dependencies = [ - "derive_more", - "environmental", + "derive_more", + "environmental", "parity-scale-codec", "pwasm-utils", - "sc-allocator 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-maybe-compressed-blob 4.0.0-dev", - "sp-serializer 3.0.0", - "sp-wasm-interface 4.0.0-dev", + "sc-allocator", + "sp-core", + "sp-maybe-compressed-blob", + "sp-serializer", + "sp-wasm-interface", "thiserror", "wasmer", "wasmer-compiler-singlepass", "wasmi", ] -[[package]] -name = "sc-executor-common" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "derive_more", - "environmental", - "parity-scale-codec", - "pwasm-utils", - "sc-allocator 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-maybe-compressed-blob 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-serializer 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "thiserror", - "wasmi", -] - -[[package]] -name = "sc-executor-wasmi" -version = "0.10.0-dev" -dependencies = [ - "log 0.4.14", - "parity-scale-codec", - "sc-allocator 4.0.0-dev", - "sc-executor-common 0.10.0-dev", - "scoped-tls", - "sp-core 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", - "wasmi", -] - [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "log 0.4.14", "parity-scale-codec", - "sc-allocator 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-executor-common 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-allocator", + "sc-executor-common", "scoped-tls", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-runtime-interface", + "sp-wasm-interface", "wasmi", ] @@ -8426,14 +8012,14 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parity-wasm 0.42.2", - "sc-allocator 4.0.0-dev", - "sc-executor-common 0.10.0-dev", + "sc-allocator", + "sc-executor-common", "sc-runtime-test", "scoped-tls", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime-interface", + "sp-wasm-interface", "wasmtime", "wat", ] @@ -8447,36 +8033,36 @@ dependencies = [ "derive_more", "dyn-clone", "finality-grandpa", - "fork-tree 3.0.0", + "fork-tree", "futures 0.3.16", "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", "rand 0.8.4", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", - "sc-keystore 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-network-gossip 0.10.0-dev", - "sc-network-test 0.8.0", - "sc-telemetry 4.0.0-dev", - "sc-utils 4.0.0-dev", + "sc-block-builder", + "sc-client-api", + "sc-consensus", + "sc-keystore", + "sc-network", + "sc-network-gossip", + "sc-network-test", + "sc-telemetry", + "sc-utils", "serde_json", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-arithmetic 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-finality-grandpa", + "sp-keyring", + "sp-keystore", + "sp-runtime", + "sp-tracing", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime-client", "tempfile", "tokio", ] @@ -8494,18 +8080,18 @@ dependencies = [ "jsonrpc-pubsub", "log 0.4.14", "parity-scale-codec", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", + "sc-block-builder", + "sc-client-api", "sc-finality-grandpa", - "sc-rpc 4.0.0-dev", + "sc-rpc", "serde", "serde_json", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sp-blockchain", + "sp-core", + "sp-finality-grandpa", + "sp-keyring", + "sp-runtime", + "substrate-test-runtime-client", ] [[package]] @@ -8517,28 +8103,11 @@ dependencies = [ "futures-timer 3.0.2", "log 0.4.14", "parity-util-mem", - "sc-client-api 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", -] - -[[package]] -name = "sc-informant" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "ansi_term 0.12.1", - "futures 0.3.16", - "futures-timer 3.0.2", - "log 0.4.14", - "parity-util-mem", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api", + "sc-network", + "sc-transaction-pool-api", + "sp-blockchain", + "sp-runtime", ] [[package]] @@ -8550,60 +8119,27 @@ dependencies = [ "hex", "parking_lot 0.11.1", "serde_json", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-keystore 0.10.0-dev", + "sp-application-crypto", + "sp-core", + "sp-keystore", "tempfile", ] -[[package]] -name = "sc-keystore" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "derive_more", - "hex", - "parking_lot 0.11.1", - "serde_json", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sc-light" -version = "4.0.0-dev" -dependencies = [ - "hash-db", - "parity-scale-codec", - "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev", - "sc-executor 0.10.0-dev", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", -] - [[package]] name = "sc-light" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "hash-db", "parity-scale-codec", "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api", + "sc-executor", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-externalities", + "sp-runtime", + "sp-state-machine", ] [[package]] @@ -8620,7 +8156,7 @@ dependencies = [ "derive_more", "either", "fnv", - "fork-tree 3.0.0", + "fork-tree", "futures 0.3.16", "futures-timer 3.0.2", "hex", @@ -8637,25 +8173,25 @@ dependencies = [ "prost-build", "quickcheck", "rand 0.7.3", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", - "sc-peerset 4.0.0-dev", - "sc-utils 4.0.0-dev", + "sc-block-builder", + "sc-client-api", + "sc-consensus", + "sc-peerset", + "sc-utils", "serde", "serde_json", "smallvec 1.6.1", - "sp-arithmetic 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-finality-grandpa", + "sp-runtime", "sp-test-primitives", - "sp-tracing 4.0.0-dev", + "sp-tracing", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime 2.0.0", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime", + "substrate-test-runtime-client", "tempfile", "thiserror", "unsigned-varint 0.6.0", @@ -8663,57 +8199,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "sc-network" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-std", - "async-trait", - "asynchronous-codec 0.5.0", - "bitflags", - "bytes 1.0.1", - "cid", - "derive_more", - "either", - "fnv", - "fork-tree 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "futures 0.3.16", - "futures-timer 3.0.2", - "hex", - "ip_network", - "libp2p", - "linked-hash-map", - "linked_hash_set", - "log 0.4.14", - "lru", - "parity-scale-codec", - "parking_lot 0.11.1", - "pin-project 1.0.5", - "prost", - "prost-build", - "rand 0.7.3", - "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-peerset 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "serde", - "serde_json", - "smallvec 1.6.1", - "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-finality-grandpa 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", - "thiserror", - "unsigned-varint 0.6.0", - "void", - "zeroize", -] - [[package]] name = "sc-network-gossip" version = "0.10.0-dev" @@ -8725,26 +8210,10 @@ dependencies = [ "log 0.4.14", "lru", "quickcheck", - "sc-network 0.10.0-dev", - "sp-runtime 4.0.0-dev", + "sc-network", + "sp-runtime", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime-client 2.0.0", - "tracing", -] - -[[package]] -name = "sc-network-gossip" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "futures-timer 3.0.2", - "libp2p", - "log 0.4.14", - "lru", - "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-test-runtime-client", "tracing", ] @@ -8760,47 +8229,19 @@ dependencies = [ "log 0.4.14", "parking_lot 0.11.1", "rand 0.7.3", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", - "sc-network 0.10.0-dev", - "sc-service 0.10.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "substrate-test-runtime 2.0.0", - "substrate-test-runtime-client 2.0.0", -] - -[[package]] -name = "sc-network-test" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-std", - "async-trait", - "futures 0.3.16", - "futures-timer 3.0.2", - "libp2p", - "log 0.4.14", - "parking_lot 0.11.1", - "rand 0.7.3", - "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-service 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-babe 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-test-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-test-runtime-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sc-block-builder", + "sc-client-api", + "sc-consensus", + "sc-network", + "sc-service", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core", + "sp-runtime", + "sp-tracing", + "substrate-test-runtime", + "substrate-test-runtime-client", ] [[package]] @@ -8820,51 +8261,24 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.11.1", "rand 0.7.3", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-client-db 0.10.0-dev", - "sc-network 0.10.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sc-utils 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-offchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sc-block-builder", + "sc-client-api", + "sc-client-db", + "sc-network", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-utils", + "sp-api", + "sp-consensus", + "sp-core", + "sp-offchain", + "sp-runtime", + "sp-tracing", + "substrate-test-runtime-client", "threadpool", "tokio", ] -[[package]] -name = "sc-offchain" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "bytes 1.0.1", - "fnv", - "futures 0.3.16", - "futures-timer 3.0.2", - "hex", - "hyper 0.14.11", - "hyper-rustls", - "log 0.4.14", - "num_cpus", - "parity-scale-codec", - "parking_lot 0.11.1", - "rand 0.7.3", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "threadpool", -] - [[package]] name = "sc-peerset" version = "4.0.0-dev" @@ -8873,20 +8287,7 @@ dependencies = [ "libp2p", "log 0.4.14", "rand 0.7.3", - "sc-utils 4.0.0-dev", - "serde_json", - "wasm-timer", -] - -[[package]] -name = "sc-peerset" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "libp2p", - "log 0.4.14", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-utils", "serde_json", "wasm-timer", ] @@ -8912,89 +8313,33 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder 0.10.0-dev", - "sc-chain-spec 4.0.0-dev", - "sc-client-api 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-rpc-api 0.10.0-dev", - "sc-tracing 4.0.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sc-utils 4.0.0-dev", - "serde_json", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-offchain 4.0.0-dev", - "sp-rpc 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-version 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", -] - -[[package]] -name = "sc-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "hash-db", - "jsonrpc-core", - "jsonrpc-pubsub", - "log 0.4.14", - "parity-scale-codec", - "parking_lot 0.11.1", - "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-chain-spec 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-rpc-api 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "serde_json", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sc-rpc-api" -version = "0.10.0-dev" -dependencies = [ - "futures 0.3.16", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "jsonrpc-pubsub", - "log 0.4.14", - "parity-scale-codec", - "parking_lot 0.11.1", - "sc-chain-spec 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "serde", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-network", + "sc-rpc-api", + "sc-tracing", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-utils", "serde_json", - "sp-core 4.0.0-dev", - "sp-rpc 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-version 4.0.0-dev", - "thiserror", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-io", + "sp-keystore", + "sp-offchain", + "sp-rpc", + "sp-runtime", + "sp-session", + "sp-version", + "substrate-test-runtime-client", ] [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "futures 0.3.16", "jsonrpc-core", @@ -9004,15 +8349,15 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-chain-spec 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-chain-spec", + "sc-transaction-pool-api", "serde", "serde_json", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-rpc", + "sp-runtime", + "sp-tracing", + "sp-version", "thiserror", ] @@ -9032,34 +8377,17 @@ dependencies = [ "tokio", ] -[[package]] -name = "sc-rpc-server" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "jsonrpc-core", - "jsonrpc-http-server", - "jsonrpc-ipc-server", - "jsonrpc-pubsub", - "jsonrpc-ws-server", - "log 0.4.14", - "serde_json", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", - "tokio", -] - [[package]] name = "sc-runtime-test" version = "2.0.0" dependencies = [ - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime", "sp-sandbox", - "sp-std 4.0.0-dev", - "sp-tasks 4.0.0-dev", - "substrate-wasm-builder 5.0.0-dev", + "sp-std", + "sp-tasks", + "substrate-wasm-builder", ] [[package]] @@ -9081,112 +8409,47 @@ dependencies = [ "parking_lot 0.11.1", "pin-project 1.0.5", "rand 0.7.3", - "sc-block-builder 0.10.0-dev", - "sc-chain-spec 4.0.0-dev", - "sc-client-api 4.0.0-dev", - "sc-client-db 0.10.0-dev", - "sc-consensus 0.10.0-dev", - "sc-executor 0.10.0-dev", - "sc-informant 0.10.0-dev", - "sc-keystore 4.0.0-dev", - "sc-light 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-offchain 4.0.0-dev", - "sc-rpc 4.0.0-dev", - "sc-rpc-server 4.0.0-dev", - "sc-telemetry 4.0.0-dev", - "sc-tracing 4.0.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sc-utils 4.0.0-dev", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-executor", + "sc-informant", + "sc-keystore", + "sc-light", + "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 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-inherents 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-storage 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-transaction-pool 4.0.0-dev", - "sp-transaction-storage-proof 4.0.0-dev", - "sp-trie 4.0.0-dev", - "sp-version 4.0.0-dev", + "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 0.9.0", - "substrate-test-runtime 2.0.0", - "substrate-test-runtime-client 2.0.0", - "tempfile", - "thiserror", - "tokio", - "tracing", - "tracing-futures", -] - -[[package]] -name = "sc-service" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "directories", - "exit-future", - "futures 0.3.16", - "futures-timer 3.0.2", - "hash-db", - "jsonrpc-core", - "jsonrpc-pubsub", - "log 0.4.14", - "parity-scale-codec", - "parity-util-mem", - "parking_lot 0.11.1", - "pin-project 1.0.5", - "rand 0.7.3", - "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-chain-spec 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-client-db 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-informant 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-keystore 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-light 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-network 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-rpc-server 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-telemetry 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "serde", - "serde_json", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-block-builder 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-transaction-storage-proof 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-test-runtime", + "substrate-test-runtime-client", "tempfile", "thiserror", "tokio", @@ -9204,28 +8467,28 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-client-db 0.10.0-dev", - "sc-consensus 0.10.0-dev", - "sc-executor 0.10.0-dev", - "sc-light 4.0.0-dev", - "sc-network 0.10.0-dev", - "sc-service 0.10.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-panic-handler 3.0.0", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-storage 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-trie 4.0.0-dev", - "substrate-test-runtime 2.0.0", - "substrate-test-runtime-client 2.0.0", + "sc-block-builder", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-executor", + "sc-light", + "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", ] @@ -9239,42 +8502,28 @@ dependencies = [ "parity-util-mem", "parity-util-mem-derive", "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev", - "sp-core 4.0.0-dev", + "sc-client-api", + "sp-core", ] [[package]] -name = "sc-state-db" +name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ - "log 0.4.14", + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", "parity-scale-codec", - "parity-util-mem", - "parity-util-mem-derive", - "parking_lot 0.11.1", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sc-sync-state-rpc" -version = "0.10.0-dev" -dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "parity-scale-codec", - "sc-chain-spec 4.0.0-dev", - "sc-client-api 4.0.0-dev", + "sc-chain-spec", + "sc-client-api", "sc-consensus-babe", "sc-consensus-epochs", "sc-finality-grandpa", - "sc-rpc-api 0.10.0-dev", + "sc-rpc-api", "serde", "serde_json", - "sp-blockchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-blockchain", + "sp-runtime", "thiserror", ] @@ -9295,56 +8544,9 @@ dependencies = [ "wasm-timer", ] -[[package]] -name = "sc-telemetry" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "chrono", - "futures 0.3.16", - "libp2p", - "log 0.4.14", - "parking_lot 0.11.1", - "pin-project 1.0.5", - "rand 0.7.3", - "serde", - "serde_json", - "thiserror", - "wasm-timer", -] - -[[package]] -name = "sc-tracing" -version = "4.0.0-dev" -dependencies = [ - "ansi_term 0.12.1", - "atty", - "lazy_static", - "log 0.4.14", - "once_cell", - "parking_lot 0.11.1", - "regex", - "rustc-hash", - "sc-client-api 4.0.0-dev", - "sc-rpc-server 4.0.0-dev", - "sc-tracing-proc-macro 4.0.0-dev", - "serde", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-rpc 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "thiserror", - "tracing", - "tracing-log", - "tracing-subscriber", -] - [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "ansi_term 0.12.1", "atty", @@ -9354,16 +8556,16 @@ dependencies = [ "parking_lot 0.11.1", "regex", "rustc-hash", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-rpc-server 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-tracing-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "serde", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-rpc 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "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", @@ -9380,17 +8582,6 @@ dependencies = [ "syn", ] -[[package]] -name = "sc-tracing-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "proc-macro-crate 1.0.0", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" @@ -9406,76 +8597,35 @@ dependencies = [ "parity-util-mem", "parking_lot 0.11.1", "retain_mut", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sc-utils 4.0.0-dev", - "serde", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-transaction-pool 4.0.0-dev", + "sc-block-builder", + "sc-client-api", + "sc-transaction-pool-api", + "sc-utils", + "serde", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "sp-tracing", + "sp-transaction-pool", "substrate-prometheus-endpoint 0.9.0", - "substrate-test-runtime 2.0.0", - "substrate-test-runtime-client 2.0.0", + "substrate-test-runtime", + "substrate-test-runtime-client", "substrate-test-runtime-transaction-pool", "thiserror", ] -[[package]] -name = "sc-transaction-pool" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "intervalier", - "linked-hash-map", - "log 0.4.14", - "parity-scale-codec", - "parity-util-mem", - "parking_lot 0.11.1", - "retain_mut", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-transaction-pool-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-utils 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "serde", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", - "thiserror", -] - -[[package]] -name = "sc-transaction-pool-api" -version = "4.0.0-dev" -dependencies = [ - "derive_more", - "futures 0.3.16", - "log 0.4.14", - "serde", - "sp-blockchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "thiserror", -] - [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "derive_more", "futures 0.3.16", "log 0.4.14", "serde", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain", + "sp-runtime", "thiserror", ] @@ -9489,17 +8639,6 @@ dependencies = [ "prometheus", ] -[[package]] -name = "sc-utils" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "futures-timer 3.0.2", - "lazy_static", - "prometheus", -] - [[package]] name = "scale-info" version = "1.0.0" @@ -9934,30 +9073,13 @@ dependencies = [ "hash-db", "log 0.4.14", "parity-scale-codec", - "sp-api-proc-macro 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", + "sp-api-proc-macro", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-std", "sp-test-primitives", - "sp-version 4.0.0-dev", - "thiserror", -] - -[[package]] -name = "sp-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "hash-db", - "log 0.4.14", - "parity-scale-codec", - "sp-api-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version", "thiserror", ] @@ -9972,18 +9094,6 @@ dependencies = [ "syn", ] -[[package]] -name = "sp-api-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "blake2-rfc", - "proc-macro-crate 1.0.0", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sp-api-test" version = "2.0.1" @@ -9993,15 +9103,15 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "rustversion", - "sc-block-builder 0.10.0-dev", - "sp-api 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-tracing 4.0.0-dev", - "sp-version 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sc-block-builder", + "sp-api", + "sp-consensus", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-tracing", + "sp-version", + "substrate-test-runtime-client", "trybuild", ] @@ -10012,34 +9122,21 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-application-crypto" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-io", + "sp-std", ] [[package]] name = "sp-application-crypto-test" version = "2.0.0" dependencies = [ - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", + "substrate-test-runtime-client", ] [[package]] @@ -10054,23 +9151,8 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-debug-derive 3.0.0", - "sp-std 4.0.0-dev", - "static_assertions", -] - -[[package]] -name = "sp-arithmetic" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-debug-derive", + "sp-std", "static_assertions", ] @@ -10081,7 +9163,7 @@ dependencies = [ "honggfuzz", "num-bigint", "primitive-types", - "sp-arithmetic 4.0.0-dev", + "sp-arithmetic", ] [[package]] @@ -10090,10 +9172,10 @@ version = "4.0.0-dev" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-api", + "sp-application-crypto", + "sp-runtime", + "sp-std", ] [[package]] @@ -10102,21 +9184,9 @@ version = "4.0.0-dev" dependencies = [ "async-trait", "parity-scale-codec", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "parity-scale-codec", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-inherents", + "sp-runtime", + "sp-std", ] [[package]] @@ -10124,22 +9194,10 @@ name = "sp-block-builder" version = "4.0.0-dev" dependencies = [ "parity-scale-codec", - "sp-api 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-block-builder" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "parity-scale-codec", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-inherents", + "sp-runtime", + "sp-std", ] [[package]] @@ -10151,29 +9209,11 @@ dependencies = [ "lru", "parity-scale-codec", "parking_lot 0.11.1", - "sp-api 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-database 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "thiserror", -] - -[[package]] -name = "sp-blockchain" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "log 0.4.14", - "lru", - "parity-scale-codec", - "parking_lot 0.11.1", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-database 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-consensus", + "sp-database", + "sp-runtime", + "sp-state-machine", "thiserror", ] @@ -10186,32 +9226,13 @@ dependencies = [ "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "sp-std", "sp-test-primitives", - "sp-version 4.0.0-dev", - "thiserror", -] - -[[package]] -name = "sp-consensus" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "futures 0.3.16", - "futures-timer 3.0.2", - "log 0.4.14", - "parity-scale-codec", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-version", "thiserror", ] @@ -10222,32 +9243,14 @@ dependencies = [ "async-trait", "parity-scale-codec", "scale-info", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-slots 0.10.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-timestamp 4.0.0-dev", -] - -[[package]] -name = "sp-consensus-aura" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "parity-scale-codec", - "scale-info", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-slots 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-application-crypto", + "sp-consensus", + "sp-consensus-slots", + "sp-inherents", + "sp-runtime", + "sp-std", + "sp-timestamp", ] [[package]] @@ -10259,40 +9262,17 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-slots 0.10.0-dev", - "sp-consensus-vrf 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-timestamp 4.0.0-dev", -] - -[[package]] -name = "sp-consensus-babe" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "merlin", - "parity-scale-codec", - "scale-info", - "serde", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-slots 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-vrf 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "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]] @@ -10300,31 +9280,20 @@ name = "sp-consensus-pow" version = "0.10.0-dev" dependencies = [ "parity-scale-codec", - "sp-api 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-consensus-slots" -version = "0.10.0-dev" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-arithmetic 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-api", + "sp-core", + "sp-runtime", + "sp-std", ] [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", "scale-info", - "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-arithmetic", + "sp-runtime", ] [[package]] @@ -10333,21 +9302,9 @@ version = "0.10.0-dev" dependencies = [ "parity-scale-codec", "schnorrkel", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-consensus-vrf" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "parity-scale-codec", - "schnorrkel", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-runtime", + "sp-std", ] [[package]] @@ -10383,57 +9340,12 @@ dependencies = [ "serde", "serde_json", "sha2 0.9.3", - "sp-debug-derive 3.0.0", - "sp-externalities 0.10.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-serializer 3.0.0", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "tiny-keccak", - "twox-hash", - "wasmi", - "zeroize", -] - -[[package]] -name = "sp-core" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "base58", - "blake2-rfc", - "byteorder", - "dyn-clonable", - "ed25519-dalek", - "futures 0.3.16", - "hash-db", - "hash256-std-hasher", - "hex", - "impl-serde", - "lazy_static", - "libsecp256k1 0.6.0", - "log 0.4.14", - "merlin", - "num-traits", - "parity-scale-codec", - "parity-util-mem", - "parking_lot 0.11.1", - "primitive-types", - "rand 0.7.3", - "regex", - "scale-info", - "schnorrkel", - "secrecy", - "serde", - "sha2 0.9.3", - "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-serializer", + "sp-std", + "sp-storage", "substrate-bip39", "thiserror", "tiny-bip39", @@ -10451,28 +9363,9 @@ dependencies = [ "parking_lot 0.11.1", ] -[[package]] -name = "sp-database" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "kvdb", - "parking_lot 0.11.1", -] - -[[package]] -name = "sp-debug-derive" -version = "3.0.0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sp-debug-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "proc-macro2", "quote", @@ -10485,19 +9378,8 @@ version = "0.10.0-dev" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", -] - -[[package]] -name = "sp-externalities" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std", + "sp-storage", ] [[package]] @@ -10509,30 +9391,12 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-finality-grandpa" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "finality-grandpa", - "log 0.4.14", - "parity-scale-codec", - "scale-info", - "serde", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-std", ] [[package]] @@ -10543,54 +9407,15 @@ dependencies = [ "futures 0.3.16", "impl-trait-for-tuples", "parity-scale-codec", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-runtime", + "sp-std", "thiserror", ] -[[package]] -name = "sp-inherents" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "impl-trait-for-tuples", - "parity-scale-codec", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "thiserror", -] - -[[package]] -name = "sp-io" -version = "4.0.0-dev" -dependencies = [ - "futures 0.3.16", - "hash-db", - "libsecp256k1 0.6.0", - "log 0.4.14", - "parity-scale-codec", - "parking_lot 0.11.1", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-keystore 0.10.0-dev", - "sp-maybe-compressed-blob 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-trie 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", - "tracing", - "tracing-core", -] - [[package]] name = "sp-io" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "futures 0.3.16", "hash-db", @@ -10598,16 +9423,16 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "parking_lot 0.11.1", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-maybe-compressed-blob 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-maybe-compressed-blob", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", + "sp-wasm-interface", "tracing", "tracing-core", ] @@ -10617,19 +9442,8 @@ name = "sp-keyring" version = "4.0.0-dev" dependencies = [ "lazy_static", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "strum 0.20.0", -] - -[[package]] -name = "sp-keyring" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "lazy_static", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-runtime", "strum 0.20.0", ] @@ -10647,38 +9461,13 @@ dependencies = [ "rand_chacha 0.2.2", "schnorrkel", "serde", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", -] - -[[package]] -name = "sp-keystore" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "derive_more", - "futures 0.3.16", - "merlin", - "parity-scale-codec", - "parking_lot 0.11.1", - "schnorrkel", - "serde", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sp-maybe-compressed-blob" -version = "4.0.0-dev" -dependencies = [ - "zstd", + "sp-core", + "sp-externalities", ] [[package]] name = "sp-maybe-compressed-blob" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "zstd", ] @@ -10691,11 +9480,11 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", + "sp-arithmetic", + "sp-core", "sp-npos-elections-solution-type", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-runtime", + "sp-std", "substrate-test-utils", ] @@ -10708,7 +9497,7 @@ dependencies = [ "rand 0.7.3", "scale-info", "sp-npos-elections", - "sp-runtime 4.0.0-dev", + "sp-runtime", "structopt", ] @@ -10721,7 +9510,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "sp-arithmetic 4.0.0-dev", + "sp-arithmetic", "sp-npos-elections", "syn", "trybuild", @@ -10731,32 +9520,14 @@ dependencies = [ name = "sp-offchain" version = "4.0.0-dev" dependencies = [ - "sp-api 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", -] - -[[package]] -name = "sp-offchain" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sp-panic-handler" -version = "3.0.0" -dependencies = [ - "backtrace", + "sp-api", + "sp-core", + "sp-runtime", ] [[package]] name = "sp-panic-handler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "backtrace", ] @@ -10768,49 +9539,12 @@ dependencies = [ "rustc-hash", "serde", "serde_json", - "sp-core 4.0.0-dev", -] - -[[package]] -name = "sp-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "rustc-hash", - "serde", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sp-runtime" -version = "4.0.0-dev" -dependencies = [ - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log 0.4.14", - "parity-scale-codec", - "parity-util-mem", - "paste 1.0.4", - "rand 0.7.3", - "scale-info", - "serde", - "serde_json", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-arithmetic 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sp-core", ] [[package]] name = "sp-runtime" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "either", "hash256-std-hasher", @@ -10822,11 +9556,16 @@ dependencies = [ "rand 0.7.3", "scale-info", "serde", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-arithmetic 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "serde_json", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-state-machine", + "sp-std", + "sp-tracing", + "substrate-test-runtime-client", ] [[package]] @@ -10837,52 +9576,23 @@ dependencies = [ "parity-scale-codec", "primitive-types", "rustversion", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime-interface-proc-macro 4.0.0-dev", + "sp-core", + "sp-externalities", + "sp-io", + "sp-runtime-interface-proc-macro", "sp-runtime-interface-test-wasm", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-storage 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", + "sp-state-machine", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", "static_assertions", "trybuild", ] -[[package]] -name = "sp-runtime-interface" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-storage 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-tracing 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-wasm-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "static_assertions", -] - -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "4.0.0-dev" -dependencies = [ - "Inflector", - "proc-macro-crate 1.0.0", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sp-runtime-interface-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "Inflector", "proc-macro-crate 1.0.0", @@ -10895,14 +9605,14 @@ dependencies = [ name = "sp-runtime-interface-test" version = "2.0.0" dependencies = [ - "sc-executor 0.10.0-dev", - "sc-executor-common 0.10.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", + "sc-executor", + "sc-executor-common", + "sp-io", + "sp-runtime", + "sp-runtime-interface", "sp-runtime-interface-test-wasm", "sp-runtime-interface-test-wasm-deprecated", - "sp-state-machine 0.10.0-dev", + "sp-state-machine", "tracing", "tracing-core", ] @@ -10911,22 +9621,22 @@ dependencies = [ name = "sp-runtime-interface-test-wasm" version = "2.0.0" dependencies = [ - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-std 4.0.0-dev", - "substrate-wasm-builder 5.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime-interface", + "sp-std", + "substrate-wasm-builder", ] [[package]] name = "sp-runtime-interface-test-wasm-deprecated" version = "2.0.0" dependencies = [ - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-std 4.0.0-dev", - "substrate-wasm-builder 5.0.0-dev", + "sp-core", + "sp-io", + "sp-runtime-interface", + "sp-std", + "substrate-wasm-builder", ] [[package]] @@ -10936,10 +9646,10 @@ dependencies = [ "assert_matches", "log 0.4.14", "parity-scale-codec", - "sp-core 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", + "sp-core", + "sp-io", + "sp-std", + "sp-wasm-interface", "wasmi", "wat", ] @@ -10952,61 +9662,27 @@ dependencies = [ "serde_json", ] -[[package]] -name = "sp-serializer" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "sp-session" -version = "4.0.0-dev" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-api 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-staking 4.0.0-dev", - "sp-std 4.0.0-dev", -] - [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-staking 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sp-staking" -version = "4.0.0-dev" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "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=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "parity-scale-codec", "scale-info", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime", + "sp-std", ] [[package]] @@ -11022,35 +9698,12 @@ dependencies = [ "pretty_assertions 0.6.1", "rand 0.7.3", "smallvec 1.6.1", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-panic-handler 3.0.0", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-trie 4.0.0-dev", - "thiserror", - "tracing", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-state-machine" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "hash-db", - "log 0.4.14", - "num-traits", - "parity-scale-codec", - "parking_lot 0.11.1", - "rand 0.7.3", - "smallvec 1.6.1", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-panic-handler 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-runtime", + "sp-std", + "sp-trie", "thiserror", "tracing", "trie-db", @@ -11061,34 +9714,16 @@ dependencies = [ name = "sp-std" version = "4.0.0-dev" -[[package]] -name = "sp-std" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" - -[[package]] -name = "sp-storage" -version = "4.0.0-dev" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive 3.0.0", - "sp-std 4.0.0-dev", -] - [[package]] name = "sp-storage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-debug-derive", + "sp-std", ] [[package]] @@ -11097,24 +9732,11 @@ version = "4.0.0-dev" dependencies = [ "log 0.4.14", "parity-scale-codec", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-io 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-std 4.0.0-dev", -] - -[[package]] -name = "sp-tasks" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "log 0.4.14", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-externalities", + "sp-io", + "sp-runtime-interface", + "sp-std", ] [[package]] @@ -11124,39 +9746,23 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "serde", - "sp-application-crypto 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", -] - -[[package]] -name = "sp-timestamp" -version = "4.0.0-dev" -dependencies = [ - "async-trait", - "futures-timer 3.0.2", - "log 0.4.14", - "parity-scale-codec", - "sp-api 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "thiserror", + "sp-application-crypto", + "sp-core", + "sp-runtime", ] [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "async-trait", "futures-timer 3.0.2", "log 0.4.14", "parity-scale-codec", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-inherents", + "sp-runtime", + "sp-std", "thiserror", ] @@ -11171,25 +9777,7 @@ dependencies = [ "serde", "serde_json", "slog", - "sp-std 4.0.0-dev", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-tracing" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "erased-serde", - "log 0.4.14", - "parity-scale-codec", - "parking_lot 0.10.2", - "serde", - "serde_json", - "slog", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std", "tracing", "tracing-core", "tracing-subscriber", @@ -11199,48 +9787,23 @@ dependencies = [ name = "sp-transaction-pool" version = "4.0.0-dev" dependencies = [ - "sp-api 4.0.0-dev", - "sp-runtime 4.0.0-dev", -] - -[[package]] -name = "sp-transaction-pool" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", -] - -[[package]] -name = "sp-transaction-storage-proof" -version = "4.0.0-dev" -dependencies = [ - "async-trait", - "log 0.4.14", - "parity-scale-codec", - "scale-info", - "sp-core 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-trie 4.0.0-dev", + "sp-api", + "sp-runtime", ] [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "async-trait", "log 0.4.14", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-std", + "sp-trie", ] [[package]] @@ -11253,58 +9816,27 @@ dependencies = [ "memory-db", "parity-scale-codec", "scale-info", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", + "sp-core", + "sp-runtime", + "sp-std", "trie-bench", "trie-db", "trie-root", "trie-standardmap", ] -[[package]] -name = "sp-trie" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "hash-db", - "memory-db", - "parity-scale-codec", - "scale-info", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-version" -version = "4.0.0-dev" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "parity-wasm 0.42.2", - "scale-info", - "serde", - "sp-runtime 4.0.0-dev", - "sp-std 4.0.0-dev", - "sp-version-proc-macro 4.0.0-dev", - "thiserror", -] - [[package]] name = "sp-version" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" dependencies = [ "impl-serde", "parity-scale-codec", "parity-wasm 0.42.2", "scale-info", "serde", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version-proc-macro 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-runtime", + "sp-std", + "sp-version-proc-macro", "thiserror", ] @@ -11315,18 +9847,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "sp-version 4.0.0-dev", - "syn", -] - -[[package]] -name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "parity-scale-codec", - "proc-macro2", - "quote", + "sp-version", "syn", ] @@ -11336,18 +9857,7 @@ version = "4.0.0-dev" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", - "sp-std 4.0.0-dev", - "wasmi", -] - -[[package]] -name = "sp-wasm-interface" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-std", "wasmi", ] @@ -11492,11 +10002,11 @@ dependencies = [ name = "substrate-frame-cli" version = "4.0.0-dev" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "sc-cli", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sp-core", + "sp-runtime", "structopt", ] @@ -11504,15 +10014,15 @@ dependencies = [ name = "substrate-frame-rpc-support" version = "3.0.0" dependencies = [ - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-support", + "frame-system", "futures 0.3.16", "jsonrpc-client-transports", "parity-scale-codec", - "sc-rpc-api 0.10.0-dev", + "sc-rpc-api", "scale-info", "serde", - "sp-storage 4.0.0-dev", + "sp-storage", "tokio", ] @@ -11520,24 +10030,24 @@ dependencies = [ name = "substrate-frame-rpc-system" version = "4.0.0-dev" dependencies = [ - "frame-system-rpc-runtime-api 4.0.0-dev", + "frame-system-rpc-runtime-api", "futures 0.3.16", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "log 0.4.14", "parity-scale-codec", - "sc-client-api 4.0.0-dev", - "sc-rpc-api 0.10.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-tracing 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sc-client-api", + "sc-rpc-api", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core", + "sp-runtime", + "sp-tracing", + "substrate-test-runtime-client", ] [[package]] @@ -11575,49 +10085,22 @@ dependencies = [ "futures 0.3.16", "hex", "parity-scale-codec", - "sc-client-api 4.0.0-dev", - "sc-client-db 0.10.0-dev", - "sc-consensus 0.10.0-dev", - "sc-executor 0.10.0-dev", - "sc-light 4.0.0-dev", - "sc-offchain 4.0.0-dev", - "sc-service 0.10.0-dev", - "serde", - "serde_json", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", -] - -[[package]] -name = "substrate-test-client" -version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-trait", - "futures 0.3.16", - "hex", - "parity-scale-codec", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-client-db 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-executor 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-light 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-service 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-executor", + "sc-light", + "sc-offchain", + "sc-service", "serde", "serde_json", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keyring 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keystore 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-keyring", + "sp-keystore", + "sp-runtime", + "sp-state-machine", ] [[package]] @@ -11625,86 +10108,44 @@ name = "substrate-test-runtime" version = "2.0.0" dependencies = [ "cfg-if 1.0.0", - "frame-support 4.0.0-dev", - "frame-system 4.0.0-dev", - "frame-system-rpc-runtime-api 4.0.0-dev", + "frame-support", + "frame-system", + "frame-system-rpc-runtime-api", "futures 0.3.16", "log 0.4.14", "memory-db", - "pallet-babe 4.0.0-dev", - "pallet-timestamp 4.0.0-dev", - "parity-scale-codec", - "parity-util-mem", - "sc-block-builder 0.10.0-dev", - "sc-executor 0.10.0-dev", - "sc-service 0.10.0-dev", - "scale-info", - "serde", - "sp-api 4.0.0-dev", - "sp-application-crypto 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-aura 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-io 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-offchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-std 4.0.0-dev", - "sp-transaction-pool 4.0.0-dev", - "sp-trie 4.0.0-dev", - "sp-version 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", - "substrate-wasm-builder 5.0.0-dev", - "trie-db", -] - -[[package]] -name = "substrate-test-runtime" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "cfg-if 1.0.0", - "frame-support 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "frame-system-rpc-runtime-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "log 0.4.14", - "memory-db", - "pallet-babe 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "pallet-timestamp 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "pallet-babe", + "pallet-timestamp", "parity-scale-codec", "parity-util-mem", - "sc-service 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sc-block-builder", + "sc-executor", + "sc-service", "scale-info", "serde", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-application-crypto 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-block-builder 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-aura 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus-babe 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-externalities 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-finality-grandpa 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-inherents 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-io 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-keyring 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-offchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime-interface 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-session 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-state-machine 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-std 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-transaction-pool 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-trie 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-version 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-wasm-builder 5.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-api", + "sp-application-crypto", + "sp-block-builder", + "sp-consensus", + "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-test-runtime-client", + "substrate-wasm-builder", "trie-db", ] @@ -11714,37 +10155,17 @@ version = "2.0.0" dependencies = [ "futures 0.3.16", "parity-scale-codec", - "sc-block-builder 0.10.0-dev", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", - "sc-light 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "substrate-test-client 2.0.1", - "substrate-test-runtime 2.0.0", -] - -[[package]] -name = "substrate-test-runtime-client" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "futures 0.3.16", - "parity-scale-codec", - "sc-block-builder 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-client-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sc-light 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-api 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-blockchain 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-consensus 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-core 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "sp-runtime 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-test-client 2.0.1 (git+https://github.com/paritytech/substrate?branch=master)", - "substrate-test-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=master)", + "sc-block-builder", + "sc-client-api", + "sc-consensus", + "sc-light", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "substrate-test-client", + "substrate-test-runtime", ] [[package]] @@ -11755,11 +10176,11 @@ dependencies = [ "futures 0.3.16", "parity-scale-codec", "parking_lot 0.11.1", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "substrate-test-runtime-client 2.0.0", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sp-blockchain", + "sp-runtime", + "substrate-test-runtime-client", ] [[package]] @@ -11767,7 +10188,7 @@ name = "substrate-test-utils" version = "4.0.0-dev" dependencies = [ "futures 0.3.16", - "sc-service 0.10.0-dev", + "sc-service", "substrate-test-utils-derive", "tokio", "trybuild", @@ -11787,7 +10208,7 @@ dependencies = [ name = "substrate-test-utils-test-crate" version = "0.1.0" dependencies = [ - "sc-service 0.10.0-dev", + "sc-service", "substrate-test-utils", "tokio", ] @@ -11799,22 +10220,7 @@ dependencies = [ "ansi_term 0.12.1", "build-helper", "cargo_metadata", - "sp-maybe-compressed-blob 4.0.0-dev", - "tempfile", - "toml", - "walkdir", - "wasm-gc-api", -] - -[[package]] -name = "substrate-wasm-builder" -version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "ansi_term 0.12.1", - "build-helper", - "cargo_metadata", - "sp-maybe-compressed-blob 4.0.0-dev (git+https://github.com/paritytech/substrate?branch=master)", + "sp-maybe-compressed-blob", "tempfile", "toml", "walkdir", @@ -11912,43 +10318,43 @@ dependencies = [ name = "test-runner" version = "0.9.0" dependencies = [ - "frame-system 4.0.0-dev", + "frame-system", "futures 0.3.16", "jsonrpc-core", "log 0.4.14", "num-traits", "sc-basic-authorship", "sc-cli", - "sc-client-api 4.0.0-dev", - "sc-consensus 0.10.0-dev", + "sc-client-api", + "sc-consensus", "sc-consensus-babe", "sc-consensus-manual-seal", - "sc-executor 0.10.0-dev", + "sc-executor", "sc-finality-grandpa", - "sc-informant 0.10.0-dev", - "sc-network 0.10.0-dev", - "sc-rpc 4.0.0-dev", - "sc-rpc-server 4.0.0-dev", - "sc-service 0.10.0-dev", - "sc-transaction-pool 4.0.0-dev", - "sc-transaction-pool-api 4.0.0-dev", - "sp-api 4.0.0-dev", - "sp-block-builder 4.0.0-dev", - "sp-blockchain 4.0.0-dev", - "sp-consensus 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-core 4.0.0-dev", - "sp-externalities 0.10.0-dev", - "sp-finality-grandpa 4.0.0-dev", - "sp-inherents 4.0.0-dev", - "sp-keyring 4.0.0-dev", - "sp-offchain 4.0.0-dev", - "sp-runtime 4.0.0-dev", - "sp-runtime-interface 4.0.0-dev", - "sp-session 4.0.0-dev", - "sp-state-machine 0.10.0-dev", - "sp-transaction-pool 4.0.0-dev", - "sp-wasm-interface 4.0.0-dev", + "sc-informant", + "sc-network", + "sc-rpc", + "sc-rpc-server", + "sc-service", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core", + "sp-externalities", + "sp-finality-grandpa", + "sp-inherents", + "sp-keyring", + "sp-offchain", + "sp-runtime", + "sp-runtime-interface", + "sp-session", + "sp-state-machine", + "sp-transaction-pool", + "sp-wasm-interface", "tokio", ] @@ -11956,21 +10362,21 @@ dependencies = [ name = "test-runner-example" version = "0.1.0" dependencies = [ - "frame-benchmarking 4.0.0-dev", - "frame-system 4.0.0-dev", + "frame-benchmarking", + "frame-system", "node-cli", "node-primitives", "node-runtime", "pallet-transaction-payment", - "sc-consensus 0.10.0-dev", + "sc-consensus", "sc-consensus-babe", "sc-consensus-manual-seal", - "sc-executor 0.10.0-dev", + "sc-executor", "sc-finality-grandpa", - "sc-service 0.10.0-dev", - "sp-consensus-babe 0.10.0-dev", - "sp-keyring 4.0.0-dev", - "sp-runtime 4.0.0-dev", + "sc-service", + "sp-consensus-babe", + "sp-keyring", + "sp-runtime", "test-runner", ] @@ -12464,15 +10870,15 @@ dependencies = [ "log 0.4.14", "parity-scale-codec", "remote-externalities", - "sc-chain-spec 4.0.0-dev", + "sc-chain-spec", "sc-cli", - "sc-executor 0.10.0-dev", - "sc-service 0.10.0-dev", + "sc-executor", + "sc-service", "serde", - "sp-core 4.0.0-dev", - "sp-keystore 0.10.0-dev", - "sp-runtime 4.0.0-dev", - "sp-state-machine 0.10.0-dev", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-state-machine", "structopt", ] diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 7c118c561d527..784066b64d666 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "beefy-gadget" -version = "0.1.0" +version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -16,23 +16,23 @@ wasm-timer = "0.2.5" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-api = { version = "4.0.0-dev", path = "../../primitives/api" } +sp-application-crypto = { version = "4.0.0-dev", path = "../../primitives/application-crypto" } +sp-arithmetic = { version = "4.0.0-dev", path = "../../primitives/arithmetic" } +sp-blockchain = { version = "4.0.0-dev", path = "../../primitives/blockchain" } +sp-core = { version = "4.0.0-dev", path = "../../primitives/core" } +sp-keystore = { version = "0.10.0-dev", path = "../../primitives/keystore" } +sp-runtime = { version = "4.0.0-dev", path = "../../primitives/runtime" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } -sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-utils = { version = "4.0.0-dev", path = "../utils" } +sc-client-api = { version = "4.0.0-dev", path = "../api" } +sc-keystore = { version = "4.0.0-dev", path = "../keystore" } +sc-network = { version = "0.10.0-dev", path = "../network" } +sc-network-gossip = { version = "0.10.0-dev", path = "../network-gossip" } -beefy-primitives = { path = "../../primitives/beefy" } +beefy-primitives = { version = "4.0.0-dev", path = "../../primitives/beefy" } [dev-dependencies] -sc-network-test = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-network-test = { version = "0.8.0", path = "../network/test" } strum = { version = "0.21", features = ["derive"] } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 0aedd0dc83d11..22ed2c64f9af4 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "beefy-gadget-rpc" -version = "0.1.0" +version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -17,10 +17,10 @@ jsonrpc-pubsub = "18.0.0" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-rpc = { version = "4.0.0-dev", path = "../../rpc" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { version = "4.0.0-dev", path = "../../../primitives/core" } +sp-runtime = { versin = "4.0.0-dev", path = "../../../primitives/runtime" } beefy-gadget = { path = "../." } beefy-primitives = { path = "../../../primitives/beefy" } diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs index 8715fac1645b6..9cc00ba280ed0 100644 --- a/client/beefy/rpc/src/lib.rs +++ b/client/beefy/rpc/src/lib.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// 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 @@ -41,7 +43,11 @@ pub trait BeefyApi { subscribe, name = "beefy_subscribeJustifications" )] - fn subscribe_justifications(&self, metadata: Self::Metadata, subscriber: Subscriber); + fn subscribe_justifications( + &self, + metadata: Self::Metadata, + subscriber: Subscriber, + ); /// Unsubscribe from receiving notifications about recently finalized blocks. #[pubsub( @@ -69,10 +75,7 @@ impl BeefyRpcHandler { E: futures::task::Spawn + Send + Sync + 'static, { let manager = SubscriptionManager::new(Arc::new(executor)); - Self { - signed_commitment_stream, - manager, - } + Self { signed_commitment_stream, manager } } } diff --git a/client/beefy/rpc/src/notification.rs b/client/beefy/rpc/src/notification.rs index fded0f48ec7f6..4830d72905a98 100644 --- a/client/beefy/rpc/src/notification.rs +++ b/client/beefy/rpc/src/notification.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// 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 @@ -26,7 +28,9 @@ use sp_runtime::traits::Block as BlockT; pub struct SignedCommitment(sp_core::Bytes); impl SignedCommitment { - pub fn new(signed_commitment: beefy_gadget::notification::SignedCommitment) -> Self + pub fn new( + signed_commitment: beefy_gadget::notification::SignedCommitment, + ) -> Self where Block: BlockT, { diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 8efa095d229ca..d5cc40c705a1a 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-beefy-mmr" -version = "0.1.0" +version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -14,22 +14,23 @@ log = { version = "0.4.13", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -pallet-mmr = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -pallet-mmr-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { version = "4.0.0-dev", path = "../support", default-features = false } +frame-system = { version = "4.0.0-dev", path = "../system", default-features = false } +pallet-mmr = { version = "4.0.0-dev", path = "../merkle-mountain-range", default-features = false } +pallet-mmr-primitives = { version = "4.0.0-dev", path = "../merkle-mountain-range/primitives", default-features = false } +pallet-session = { version = "4.0.0-dev", path = "../session", default-features = false } + +sp-core = { version = "4.0.0-dev", path = "../../primitives/core", default-features = false } +sp-io = { version = "4.0.0-dev", path = "../../primitives/io", default-features = false } +sp-runtime = { version = "4.0.0-dev", path = "../../primitives/runtime", default-features = false } +sp-std = { version = "4.0.0-dev", path = "../../primitives/std", default-features = false } beefy-merkle-tree = { path = "./primitives", default-features = false } -beefy-primitives = { path = "../../primitives/beefy", default-features = false } -pallet-beefy = { path = "../beefy", default-features = false } +beefy-primitives = { version = "4.0.0-dev", path = "../../primitives/beefy", default-features = false } +pallet-beefy = { version = "4.0.0-dev", path = "../beefy", default-features = false } [dev-dependencies] -sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-staking = { version = "4.0.0-dev", path = "../../primitives/staking" } hex-literal = "0.3" [features] diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index e78d401412745..c6feed7645c98 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-beefy" -version = "0.1.0" +version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -10,20 +10,20 @@ codec = { version = "2.0.0", package = "parity-scale-codec", default-features = scale-info = { version = "1.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { version = "4.0.0-dev", path = "../support", default-features = false } +frame-system = { version = "4.0.0-dev", path = "../system", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { version = "4.0.0-dev", path = "../../primitives/runtime", default-features = false } +sp-std = { version = "4.0.0-dev", path = "../../primitives/std", default-features = false } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session = { version = "4.0.0-dev", path = "../session", default-features = false } -beefy-primitives = { path = "../../primitives/beefy", default-features = false } +beefy-primitives = { version = "4.0.0-dev", path = "../../primitives/beefy", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { version = "4.0.0-dev", path = "../../primitives/core" } +sp-io = { version = "4.0.0-dev", path = "../../primitives/io" } +sp-staking = { version = "4.0.0-dev", path = "../../primitives/staking" } [features] default = ["std"] diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index 908ebd8d37615..ffd945a0186d6 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "beefy-primitives" -version = "0.1.0" +version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" @@ -9,16 +9,16 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } scale-info = { version = "1.0", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-api = { version = "4.0.0-dev", path = "../api", default-features = false } +sp-application-crypto = { version = "4.0.0-dev", path = "../application-crypto", default-features = false } +sp-core = { version = "4.0.0-dev", path = "../core", default-features = false } +sp-runtime = { version = "4.0.0-dev", path = "../runtime", default-features = false } +sp-std = { version = "4.0.0-dev", path = "../std", default-features = false } [dev-dependencies] hex-literal = "0.3" -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-keystore = { version = "0.10.0-dev", path = "../keystore" } [features] default = ["std"] From aacad378def1230a9c4f29027a38c0affe01fdd9 Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Tue, 21 Sep 2021 16:32:39 +0200 Subject: [PATCH 100/109] beefy-gadget license header --- Cargo.lock | 4 +-- client/beefy/Cargo.toml | 2 +- client/beefy/rpc/Cargo.toml | 6 ++--- client/beefy/rpc/src/lib.rs | 9 ++++--- client/beefy/src/error.rs | 4 ++- client/beefy/src/lib.rs | 45 ++++++++++++++++++------------- client/beefy/src/metrics.rs | 4 ++- client/beefy/src/notification.rs | 7 +++-- client/beefy/src/round.rs | 19 +++++++------ client/beefy/src/worker.rs | 46 ++++++++++++++++++-------------- 10 files changed, 87 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23a27161f9cae..c0b4776bff4e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6208,9 +6208,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8975095a2a03bbbdc70a74ab11a4f76a6d0b84680d87c68d722531b0ac28e8a9" +checksum = "e11263a97373b43da4b426edbb52ef99a7b51e2d9752ef56a7f8b356f48495a5" dependencies = [ "arrayvec 0.7.0", "bitvec 0.20.2", diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 784066b64d666..8c58a8613a6c2 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -13,7 +13,7 @@ parking_lot = "0.11" thiserror = "1.0" wasm-timer = "0.2.5" -codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } +codec = { version = "2.3.0", package = "parity-scale-codec", features = ["derive"] } prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { version = "4.0.0-dev", path = "../../primitives/api" } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 22ed2c64f9af4..704db19d885cf 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -15,12 +15,12 @@ jsonrpc-core-client = "18.0.0" jsonrpc-derive = "18.0.0" jsonrpc-pubsub = "18.0.0" -codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } +codec = { version = "2.3.0", package = "parity-scale-codec", features = ["derive"] } sc-rpc = { version = "4.0.0-dev", path = "../../rpc" } sp-core = { version = "4.0.0-dev", path = "../../../primitives/core" } sp-runtime = { versin = "4.0.0-dev", path = "../../../primitives/runtime" } -beefy-gadget = { path = "../." } -beefy-primitives = { path = "../../../primitives/beefy" } +beefy-gadget = { version = "4.0.0-dev", path = "../." } +beefy-primitives = { version = "4.0.0-dev", path = "../../../primitives/beefy" } diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs index 9cc00ba280ed0..0a52b4bdbd678 100644 --- a/client/beefy/rpc/src/lib.rs +++ b/client/beefy/rpc/src/lib.rs @@ -20,13 +20,16 @@ #![warn(missing_docs)] -use beefy_gadget::notification::BeefySignedCommitmentStream; +use std::sync::Arc; + +use sp_runtime::traits::Block as BlockT; + use futures::{FutureExt, SinkExt, StreamExt}; use jsonrpc_derive::rpc; use jsonrpc_pubsub::{manager::SubscriptionManager, typed::Subscriber, SubscriptionId}; use log::warn; -use sp_runtime::traits::Block as BlockT; -use std::sync::Arc; + +use beefy_gadget::notification::BeefySignedCommitmentStream; mod notification; diff --git a/client/beefy/src/error.rs b/client/beefy/src/error.rs index d65baf55f3f18..db532d34c1e3b 100644 --- a/client/beefy/src/error.rs +++ b/client/beefy/src/error.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. +// 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 diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 0442d25bb9d6a..33432143736a0 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. +// 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 @@ -43,7 +45,8 @@ pub const BEEFY_PROTOCOL_NAME: &str = "/paritytech/beefy/1"; /// Returns the configuration value to put in /// [`sc_network::config::NetworkConfiguration::extra_sets`]. pub fn beefy_peers_set_config() -> sc_network::config::NonDefaultSetConfig { - let mut cfg = sc_network::config::NonDefaultSetConfig::new(BEEFY_PROTOCOL_NAME.into(), 1024 * 1024); + let mut cfg = + sc_network::config::NonDefaultSetConfig::new(BEEFY_PROTOCOL_NAME.into(), 1024 * 1024); cfg.allow_non_reserved(25, 25); cfg } @@ -65,7 +68,12 @@ impl Client for T where B: Block, BE: Backend, - T: BlockchainEvents + HeaderBackend + Finalizer + ProvideRuntimeApi + Send + Sync, + T: BlockchainEvents + + HeaderBackend + + Finalizer + + ProvideRuntimeApi + + Send + + Sync, { // empty } @@ -117,21 +125,22 @@ where } = beefy_params; let gossip_validator = Arc::new(gossip::GossipValidator::new()); - let gossip_engine = GossipEngine::new(network, BEEFY_PROTOCOL_NAME, gossip_validator.clone(), None); - - let metrics = prometheus_registry - .as_ref() - .map(metrics::Metrics::register) - .and_then(|result| match result { - Ok(metrics) => { - debug!(target: "beefy", "🥩 Registered metrics"); - Some(metrics) - } - Err(err) => { - debug!(target: "beefy", "🥩 Failed to register metrics: {:?}", err); - None - } - }); + let gossip_engine = + GossipEngine::new(network, BEEFY_PROTOCOL_NAME, gossip_validator.clone(), None); + + let metrics = + prometheus_registry.as_ref().map(metrics::Metrics::register).and_then( + |result| match result { + Ok(metrics) => { + debug!(target: "beefy", "🥩 Registered metrics"); + Some(metrics) + } + Err(err) => { + debug!(target: "beefy", "🥩 Failed to register metrics: {:?}", err); + None + } + }, + ); let worker_params = worker::WorkerParams { client, diff --git a/client/beefy/src/metrics.rs b/client/beefy/src/metrics.rs index 513031b5502aa..0fdc29f97c37a 100644 --- a/client/beefy/src/metrics.rs +++ b/client/beefy/src/metrics.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. +// 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 diff --git a/client/beefy/src/notification.rs b/client/beefy/src/notification.rs index 40a8cd6ed8ec7..6099c9681447b 100644 --- a/client/beefy/src/notification.rs +++ b/client/beefy/src/notification.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// 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 @@ -22,7 +24,8 @@ use sp_runtime::traits::{Block, NumberFor}; use parking_lot::Mutex; /// Stream of signed commitments returned when subscribing. -pub type SignedCommitment = beefy_primitives::SignedCommitment, beefy_primitives::MmrRootHash>; +pub type SignedCommitment = + beefy_primitives::SignedCommitment, beefy_primitives::MmrRootHash>; /// Stream of signed commitments returned when subscribing. type SignedCommitmentStream = TracingUnboundedReceiver>; diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index 038e2ba39c279..ee53c8d427162 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. +// 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 @@ -62,10 +64,7 @@ where N: Ord + AtLeast32BitUnsigned + MaybeDisplay, { pub(crate) fn new(validator_set: ValidatorSet) -> Self { - Rounds { - rounds: BTreeMap::new(), - validator_set, - } + Rounds { rounds: BTreeMap::new(), validator_set } } } @@ -108,9 +107,13 @@ where .validators .iter() .map(|authority_id| { - signatures - .iter() - .find_map(|(id, sig)| if id == authority_id { Some(sig.clone()) } else { None }) + signatures.iter().find_map(|(id, sig)| { + if id == authority_id { + Some(sig.clone()) + } else { + None + } + }) }) .collect(), ) diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index d47f19808681a..ca408fc00d419 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -1,4 +1,6 @@ -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. +// 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 @@ -36,8 +38,8 @@ use sp_runtime::{ use beefy_primitives::{ crypto::{AuthorityId, Public, Signature}, - BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, VersionedCommitment, VoteMessage, - BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID, + BeefyApi, Commitment, ConsensusLog, MmrRootHash, SignedCommitment, ValidatorSet, + VersionedCommitment, VoteMessage, BEEFY_ENGINE_ID, GENESIS_AUTHORITY_SET_ID, }; use crate::{ @@ -187,7 +189,11 @@ where /// /// Note that for a non-authority node there will be no keystore, and we will /// return an error and don't check. The error can usually be ignored. - fn verify_validator_set(&self, block: &NumberFor, mut active: ValidatorSet) -> Result<(), error::Error> { + fn verify_validator_set( + &self, + block: &NumberFor, + mut active: ValidatorSet, + ) -> Result<(), error::Error> { let active: BTreeSet = active.validators.drain(..).collect(); let store: BTreeSet = self.key_store.public_keys()?.drain(..).collect(); @@ -240,7 +246,9 @@ where } if self.should_vote_on(*notification.header.number()) { - let authority_id = if let Some(id) = self.key_store.authority_id(self.rounds.validators().as_slice()) { + let authority_id = if let Some(id) = + self.key_store.authority_id(self.rounds.validators().as_slice()) + { debug!(target: "beefy", "🥩 Local authority id: {:?}", id); id } else { @@ -248,12 +256,13 @@ where return; }; - let mmr_root = if let Some(hash) = find_mmr_root_digest::(¬ification.header) { - hash - } else { - warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); - return; - }; + let mmr_root = + if let Some(hash) = find_mmr_root_digest::(¬ification.header) { + hash + } else { + warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); + return; + }; let commitment = Commitment { payload: mmr_root, @@ -277,11 +286,7 @@ where BeefyKeystore::verify(&authority_id, &signature, &*encoded_commitment) ); - let message = VoteMessage { - commitment, - id: authority_id, - signature, - }; + let message = VoteMessage { commitment, id: authority_id, signature }; let encoded_message = message.encode(); @@ -294,9 +299,7 @@ where (message.id, message.signature), ); - self.gossip_engine - .lock() - .gossip_message(topic::(), encoded_message, false); + self.gossip_engine.lock().gossip_message(topic::(), encoded_message, false); } } @@ -351,7 +354,10 @@ where |notification| async move { debug!(target: "beefy", "🥩 Got vote message: {:?}", notification); - VoteMessage::, Public, Signature>::decode(&mut ¬ification.message[..]).ok() + VoteMessage::, Public, Signature>::decode( + &mut ¬ification.message[..], + ) + .ok() }, )); From 9ee380bc550e9abcfb3b3a40ffc11f16a0d91b3e Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Tue, 21 Sep 2021 16:42:16 +0200 Subject: [PATCH 101/109] pallet-beefy license header --- frame/beefy/Cargo.toml | 2 +- frame/beefy/src/lib.rs | 55 +++++++++++++++++----------------------- frame/beefy/src/mock.rs | 31 +++++++++++----------- frame/beefy/src/tests.rs | 31 +++++++++++----------- 4 files changed, 56 insertions(+), 63 deletions(-) diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index c6feed7645c98..fcb53a41dd532 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-beefy" version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "Apache-2.0" [dependencies] codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index cd1bc59d8039b..c7c8439080802 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020-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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] @@ -66,7 +67,8 @@ pub mod pallet { /// The current validator set id #[pallet::storage] #[pallet::getter(fn validator_set_id)] - pub(super) type ValidatorSetId = StorageValue<_, beefy_primitives::ValidatorSetId, ValueQuery>; + pub(super) type ValidatorSetId = + StorageValue<_, beefy_primitives::ValidatorSetId, ValueQuery>; /// Authorities set scheduled to be used with the next session #[pallet::storage] @@ -81,9 +83,7 @@ pub mod pallet { #[cfg(feature = "std")] impl Default for GenesisConfig { fn default() -> Self { - Self { - authorities: Vec::new(), - } + Self { authorities: Vec::new() } } } @@ -98,10 +98,7 @@ pub mod pallet { impl Pallet { /// Return the current active BEEFY validator set. pub fn validator_set() -> ValidatorSet { - ValidatorSet:: { - validators: Self::authorities(), - id: Self::validator_set_id(), - } + ValidatorSet:: { validators: Self::authorities(), id: Self::validator_set_id() } } fn change_authorities(new: Vec, queued: Vec) { @@ -115,11 +112,8 @@ impl Pallet { let log: DigestItem = DigestItem::Consensus( BEEFY_ENGINE_ID, - ConsensusLog::AuthoritiesChange(ValidatorSet { - validators: new, - id: next_id, - }) - .encode(), + ConsensusLog::AuthoritiesChange(ValidatorSet { validators: new, id: next_id }) + .encode(), ); >::deposit_log(log); } @@ -132,10 +126,7 @@ impl Pallet { return; } - assert!( - >::get().is_empty(), - "Authorities are already initialized!" - ); + assert!(>::get().is_empty(), "Authorities are already initialized!"); >::put(authorities); >::put(0); diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index 910b80ec4b0b1..712770730645f 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020 - 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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // construct_runtime requires this #![allow(clippy::from_over_into)] diff --git a/frame/beefy/src/tests.rs b/frame/beefy/src/tests.rs index 9ee30350559a1..24f9acaf76bfc 100644 --- a/frame/beefy/src/tests.rs +++ b/frame/beefy/src/tests.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020 - 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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. use std::vec; From 144ad9396b79613e720f00364d26e64db5a2c241 Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Tue, 21 Sep 2021 17:20:03 +0200 Subject: [PATCH 102/109] pallet-beefy-mmr license header --- Cargo.lock | 2 +- frame/beefy-mmr/Cargo.toml | 6 +-- frame/beefy-mmr/primitives/Cargo.toml | 4 +- frame/beefy-mmr/primitives/src/lib.rs | 64 ++++++++++++------------- frame/beefy-mmr/src/lib.rs | 68 +++++++++++++++------------ frame/beefy-mmr/src/mock.rs | 35 +++++++------- frame/beefy-mmr/src/tests.rs | 47 ++++++++++-------- 7 files changed, 122 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0b4776bff4e9..c00fa52023c7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -542,7 +542,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" -version = "0.1.0" +version = "4.0.0-dev" dependencies = [ "env_logger 0.9.0", "hex", diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index d5cc40c705a1a..66690b39074c8 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -3,12 +3,12 @@ name = "pallet-beefy-mmr" version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "Apache-2.0" description = "BEEFY + MMR runtime utilities" [dependencies] hex = { version = "0.4", optional = true } -codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +codec = { version = "2.3.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } libsecp256k1 = { version = "0.7.0", default-features = false } log = { version = "0.4.13", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } @@ -25,7 +25,7 @@ sp-io = { version = "4.0.0-dev", path = "../../primitives/io", default-features sp-runtime = { version = "4.0.0-dev", path = "../../primitives/runtime", default-features = false } sp-std = { version = "4.0.0-dev", path = "../../primitives/std", default-features = false } -beefy-merkle-tree = { path = "./primitives", default-features = false } +beefy-merkle-tree = { version = "4.0.0-dev", path = "./primitives", default-features = false } beefy-primitives = { version = "4.0.0-dev", path = "../../primitives/beefy", default-features = false } pallet-beefy = { version = "4.0.0-dev", path = "../beefy", default-features = false } diff --git a/frame/beefy-mmr/primitives/Cargo.toml b/frame/beefy-mmr/primitives/Cargo.toml index 362227963387c..d5dcc0eed3350 100644 --- a/frame/beefy-mmr/primitives/Cargo.toml +++ b/frame/beefy-mmr/primitives/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "beefy-merkle-tree" -version = "0.1.0" +version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "Apache-2.0" description = "A no-std/Substrate compatible library to construct binary merkle tree." [dependencies] diff --git a/frame/beefy-mmr/primitives/src/lib.rs b/frame/beefy-mmr/primitives/src/lib.rs index 8fc72ee05e0b5..e784fafb1ea9e 100644 --- a/frame/beefy-mmr/primitives/src/lib.rs +++ b/frame/beefy-mmr/primitives/src/lib.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020-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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] @@ -197,10 +198,7 @@ where impl ProofCollection { fn new(position: usize) -> Self { - ProofCollection { - proof: Default::default(), - position, - } + ProofCollection { proof: Default::default(), position } } } @@ -237,13 +235,7 @@ where collect_proof.proof.iter().map(hex::encode).collect::>() ); - MerkleProof { - root, - proof: collect_proof.proof, - number_of_leaves, - leaf_index, - leaf, - } + MerkleProof { root, proof: collect_proof.proof, number_of_leaves, leaf_index, leaf } } /// Leaf node for proof verification. @@ -277,7 +269,13 @@ impl<'a> From for Leaf<'a> { /// concatenating and hashing end up with given root hash. /// /// The proof must not contain the root hash. -pub fn verify_proof<'a, H, P, L>(root: &'a Hash, proof: P, number_of_leaves: usize, leaf_index: usize, leaf: L) -> bool +pub fn verify_proof<'a, H, P, L>( + root: &'a Hash, + proof: P, + number_of_leaves: usize, + leaf_index: usize, + leaf: L, +) -> bool where H: Hasher, P: IntoIterator, @@ -325,7 +323,11 @@ where /// /// In case only one element is provided it is returned via `Ok` result, in any other case (also an /// empty iterator) an `Err` with the inner nodes of upper layer is returned. -fn merkelize_row(mut iter: I, mut next: Vec, visitor: &mut V) -> Result> +fn merkelize_row( + mut iter: I, + mut next: Vec, + visitor: &mut V, +) -> Result> where H: Hasher, V: Visitor, @@ -343,11 +345,7 @@ where visitor.visit(index, &a, &b); #[cfg(feature = "debug")] - log::debug!( - " {:?}\n {:?}", - a.as_ref().map(hex::encode), - b.as_ref().map(hex::encode) - ); + log::debug!(" {:?}\n {:?}", a.as_ref().map(hex::encode), b.as_ref().map(hex::encode)); index += 2; match (a, b) { diff --git a/frame/beefy-mmr/src/lib.rs b/frame/beefy-mmr/src/lib.rs index 6c959efcc44c5..86defda985ab5 100644 --- a/frame/beefy-mmr/src/lib.rs +++ b/frame/beefy-mmr/src/lib.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020-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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] @@ -59,9 +60,9 @@ where fn on_new_root(root: &::Hash) { let digest = sp_runtime::generic::DigestItem::Consensus( beefy_primitives::BEEFY_ENGINE_ID, - codec::Encode::encode( - &beefy_primitives::ConsensusLog::<::BeefyId>::MmrRoot(*root), - ), + codec::Encode::encode(&beefy_primitives::ConsensusLog::< + ::BeefyId, + >::MmrRoot(*root)), ); >::deposit_log(digest); } @@ -74,15 +75,18 @@ impl Convert> for BeefyEcdsaToEth use sp_core::crypto::Public; let compressed_key = a.as_slice(); - libsecp256k1::PublicKey::parse_slice(compressed_key, Some(libsecp256k1::PublicKeyFormat::Compressed)) - // uncompress the key - .map(|pub_key| pub_key.serialize().to_vec()) - // now convert to ETH address - .map(|uncompressed| sp_io::hashing::keccak_256(&uncompressed[1..])[12..].to_vec()) - .map_err(|_| { - log::error!(target: "runtime::beefy", "Invalid BEEFY PublicKey format!"); - }) - .unwrap_or_default() + libsecp256k1::PublicKey::parse_slice( + compressed_key, + Some(libsecp256k1::PublicKeyFormat::Compressed), + ) + // uncompress the key + .map(|pub_key| pub_key.serialize().to_vec()) + // now convert to ETH address + .map(|uncompressed| sp_io::hashing::keccak_256(&uncompressed[1..])[12..].to_vec()) + .map_err(|_| { + log::error!(target: "runtime::beefy", "Invalid BEEFY PublicKey format!"); + }) + .unwrap_or_default() } } @@ -148,15 +152,19 @@ pub mod pallet { /// This storage entry is used as cache for calls to [`update_beefy_next_authority_set`]. #[pallet::storage] #[pallet::getter(fn beefy_next_authorities)] - pub type BeefyNextAuthorities = StorageValue<_, BeefyNextAuthoritySet>, ValueQuery>; + pub type BeefyNextAuthorities = + StorageValue<_, BeefyNextAuthoritySet>, ValueQuery>; } impl LeafDataProvider for Pallet where MerkleRootOf: From + Into, { - type LeafData = - MmrLeaf<::BlockNumber, ::Hash, MerkleRootOf>; + type LeafData = MmrLeaf< + ::BlockNumber, + ::Hash, + MerkleRootOf, + >; fn leaf_data() -> Self::LeafData { MmrLeaf { diff --git a/frame/beefy-mmr/src/mock.rs b/frame/beefy-mmr/src/mock.rs index a0fb97705a24f..ed27431fa783d 100644 --- a/frame/beefy-mmr/src/mock.rs +++ b/frame/beefy-mmr/src/mock.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020 - 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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // construct_runtime requires this #![allow(clippy::from_over_into)] @@ -20,7 +21,9 @@ use std::vec; use beefy_primitives::mmr::MmrLeafVersion; -use frame_support::{construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities}; +use frame_support::{ + construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities, +}; use sp_core::{Hasher, H256}; use sp_runtime::{ app_crypto::ecdsa::Public, diff --git a/frame/beefy-mmr/src/tests.rs b/frame/beefy-mmr/src/tests.rs index c64cb6a21b27d..7c70766623b4d 100644 --- a/frame/beefy-mmr/src/tests.rs +++ b/frame/beefy-mmr/src/tests.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020 - 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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. use std::vec; @@ -111,9 +112,13 @@ fn should_contain_valid_leaf_data() { beefy_next_authority_set: BeefyNextAuthoritySet { id: 1, len: 2, - root: hex!("01b1a742589773fc054c8f5021a456316ffcec0370b25678b0696e116d1ef9ae").into(), + root: hex!("01b1a742589773fc054c8f5021a456316ffcec0370b25678b0696e116d1ef9ae") + .into(), }, - parachain_heads: hex!("ed893c8f8cc87195a5d4d2805b011506322036bcace79642aa3e94ab431e442e").into(), + parachain_heads: hex!( + "ed893c8f8cc87195a5d4d2805b011506322036bcace79642aa3e94ab431e442e" + ) + .into(), } ); @@ -131,9 +136,13 @@ fn should_contain_valid_leaf_data() { beefy_next_authority_set: BeefyNextAuthoritySet { id: 2, len: 2, - root: hex!("9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5").into(), + root: hex!("9c6b2c1b0d0b25a008e6c882cc7b415f309965c72ad2b944ac0931048ca31cd5") + .into(), }, - parachain_heads: hex!("ed893c8f8cc87195a5d4d2805b011506322036bcace79642aa3e94ab431e442e").into(), + parachain_heads: hex!( + "ed893c8f8cc87195a5d4d2805b011506322036bcace79642aa3e94ab431e442e" + ) + .into(), } ); } From d256dc4e32236b878d0e08f11f9745a10b81dcbe Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Tue, 21 Sep 2021 17:34:47 +0200 Subject: [PATCH 103/109] beefy-primitves license header --- primitives/beefy/Cargo.toml | 4 +- primitives/beefy/src/commitment.rs | 78 ++-- primitives/beefy/src/lib.rs | 31 +- primitives/beefy/src/mmr.rs | 27 +- primitives/beefy/src/witness.rs | 31 +- primitives/beefy/tests/basic_lc_operations.rs | 364 ------------------ .../beefy/tests/bridge_parachain_flow.rs | 111 ------ .../beefy/tests/light_client/merkle_tree.rs | 70 ---- primitives/beefy/tests/light_client/mod.rs | 251 ------------ .../beefy/tests/light_client/validator_set.rs | 36 -- 10 files changed, 83 insertions(+), 920 deletions(-) delete mode 100644 primitives/beefy/tests/basic_lc_operations.rs delete mode 100644 primitives/beefy/tests/bridge_parachain_flow.rs delete mode 100644 primitives/beefy/tests/light_client/merkle_tree.rs delete mode 100644 primitives/beefy/tests/light_client/mod.rs delete mode 100644 primitives/beefy/tests/light_client/validator_set.rs diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index ffd945a0186d6..55119f674d1ae 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -3,10 +3,10 @@ name = "beefy-primitives" version = "4.0.0-dev" authors = ["Parity Technologies "] edition = "2018" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "Apache-2.0" [dependencies] -codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +codec = { version = "2.3.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } scale-info = { version = "1.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", path = "../api", default-features = false } diff --git a/primitives/beefy/src/commitment.rs b/primitives/beefy/src/commitment.rs index c9b29e3dcc606..8e9c08e625e9b 100644 --- a/primitives/beefy/src/commitment.rs +++ b/primitives/beefy/src/commitment.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020 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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. use sp_std::{cmp, prelude::*}; @@ -125,7 +126,9 @@ mod tests { let store: SyncCryptoStorePtr = KeyStore::new().into(); let alice = sp_core::ecdsa::Pair::from_string("//Alice", None).unwrap(); - let _ = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()).unwrap(); + let _ = + SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()) + .unwrap(); let msg = keccak_256(b"This is the first message"); let sig1 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &alice.public(), &msg) @@ -143,11 +146,8 @@ mod tests { #[test] fn commitment_encode_decode() { // given - let commitment: TestCommitment = Commitment { - payload: "Hello World!".into(), - block_number: 5, - validator_set_id: 0, - }; + let commitment: TestCommitment = + Commitment { payload: "Hello World!".into(), block_number: 5, validator_set_id: 0 }; // when let encoded = codec::Encode::encode(&commitment); @@ -157,18 +157,17 @@ mod tests { assert_eq!(decoded, Ok(commitment)); assert_eq!( encoded, - hex_literal::hex!("3048656c6c6f20576f726c6421050000000000000000000000000000000000000000000000") + hex_literal::hex!( + "3048656c6c6f20576f726c6421050000000000000000000000000000000000000000000000" + ) ); } #[test] fn signed_commitment_encode_decode() { // given - let commitment: TestCommitment = Commitment { - payload: "Hello World!".into(), - block_number: 5, - validator_set_id: 0, - }; + let commitment: TestCommitment = + Commitment { payload: "Hello World!".into(), block_number: 5, validator_set_id: 0 }; let sigs = mock_signatures(); @@ -192,11 +191,8 @@ mod tests { #[test] fn signed_commitment_count_signatures() { // given - let commitment: TestCommitment = Commitment { - payload: "Hello World!".into(), - block_number: 5, - validator_set_id: 0, - }; + let commitment: TestCommitment = + Commitment { payload: "Hello World!".into(), block_number: 5, validator_set_id: 0 }; let sigs = mock_signatures(); @@ -215,12 +211,11 @@ mod tests { #[test] fn commitment_ordering() { - fn commitment(block_number: u128, validator_set_id: crate::ValidatorSetId) -> TestCommitment { - Commitment { - payload: "Hello World!".into(), - block_number, - validator_set_id, - } + fn commitment( + block_number: u128, + validator_set_id: crate::ValidatorSetId, + ) -> TestCommitment { + Commitment { payload: "Hello World!".into(), block_number, validator_set_id } } // given @@ -239,11 +234,8 @@ mod tests { #[test] fn versioned_commitment_encode_decode() { - let commitment: TestCommitment = Commitment { - payload: "Hello World!".into(), - block_number: 5, - validator_set_id: 0, - }; + let commitment: TestCommitment = + Commitment { payload: "Hello World!".into(), block_number: 5, validator_set_id: 0 }; let sigs = mock_signatures(); diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 35d44e2101392..8a1e32d467c15 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020-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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] diff --git a/primitives/beefy/src/mmr.rs b/primitives/beefy/src/mmr.rs index 21ee447c31277..e428c0ea01215 100644 --- a/primitives/beefy/src/mmr.rs +++ b/primitives/beefy/src/mmr.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// This file is part of Substrate. -// 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. +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 -// 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 . +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. //! BEEFY + MMR utilties. //! diff --git a/primitives/beefy/src/witness.rs b/primitives/beefy/src/witness.rs index 0ddbfb0e4a35d..475128e10a602 100644 --- a/primitives/beefy/src/witness.rs +++ b/primitives/beefy/src/witness.rs @@ -1,18 +1,19 @@ -// Copyright (C) 2020 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 . +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. //! Primitives for light, 2-phase interactive verification protocol. //! diff --git a/primitives/beefy/tests/basic_lc_operations.rs b/primitives/beefy/tests/basic_lc_operations.rs deleted file mode 100644 index 26c30ed831d80..0000000000000 --- a/primitives/beefy/tests/basic_lc_operations.rs +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (C) 2020 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 . - -/* -mod light_client; - -use std::convert::TryInto; - -use self::light_client::{Commitment, Error, Payload, SignedCommitment}; - -use beefy_primitives::crypto::{Public, Signature}; - -#[test] -fn light_client_should_make_progress() { - // given - let mut lc = light_client::new(); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 2, - validator_set_id: 0, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }); - - // then - assert_eq!(result, Ok(())); - assert_eq!(lc.last_payload(), &Payload::new(1)); -} - -#[test] -fn should_verify_mmr_proof() { - // given - let mut lc = light_client::new(); - lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 2, - validator_set_id: 0, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }) - .unwrap(); - - // when - let result = lc.verify_proof(light_client::merkle_tree::Proof::ValidFor(1.into(), ())); - - // then - assert_eq!(result, Ok(())); -} - -#[test] -fn should_reject_invalid_mmr_proof() { - // given - let mut lc = light_client::new(); - lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 2, - validator_set_id: 0, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }) - .unwrap(); - - // when - let result = lc.verify_proof(light_client::merkle_tree::Proof::Invalid(())); - - // then - assert_eq!(result, Err(Error::InvalidMmrProof)); -} - -#[test] -fn light_client_should_reject_invalid_validator_set() { - // given - let mut lc = light_client::new(); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 1, - validator_set_id: 1, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }); - - // then - assert_eq!(result, Err(Error::InvalidValidatorSetId { expected: 0, got: 1 })); - assert_eq!(lc.last_commitment(), None); -} - -#[test] -fn light_client_should_reject_set_transitions_without_validator_proof() { - // given - let mut lc = light_client::new(); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 1, - validator_set_id: 1, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }); - - // then - assert_eq!(result, Err(Error::InvalidValidatorSetId { expected: 0, got: 1 })); - assert_eq!(lc.last_commitment(), None); -} - -#[test] -fn light_client_should_reject_older_block() { - // given - let mut lc = light_client::new(); - // jump to 10 - lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 10, - validator_set_id: 0, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }) - .unwrap(); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 5, - validator_set_id: 0, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }); - - // then - assert_eq!(result, Err(Error::OldBlock { best_known: 10, got: 5 })); -} - -#[test] -fn light_client_should_reject_if_not_enough_signatures() { - // given - let mut lc = light_client::new(); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 5, - validator_set_id: 0, - }, - signatures: vec![None], - }); - - // then - assert_eq!( - result, - Err(Error::NotEnoughValidSignatures { - expected: 1, - got: 0, - valid: None, - }) - ); -} - -#[test] -fn light_client_should_reject_if_too_many_or_too_little_signatures() { - // given - let mut lc = light_client::new(); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 5, - validator_set_id: 0, - }, - signatures: vec![None, None], - }); - let result2 = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 5, - validator_set_id: 0, - }, - signatures: vec![], - }); - - // then - assert_eq!(result, Err(Error::InvalidNumberOfSignatures { expected: 1, got: 2 })); - assert_eq!(result2, Err(Error::InvalidNumberOfSignatures { expected: 1, got: 0 })); -} - -#[test] -fn light_client_should_reject_if_not_enough_valid_signatures() { - // given - let mut lc = light_client::new(); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 5, - validator_set_id: 0, - }, - signatures: vec![Some(vec![0].try_into().unwrap())], - }); - - // then - assert_eq!( - result, - Err(Error::NotEnoughValidSignatures { - expected: 1, - got: 1, - valid: Some(0), - }) - ); - - // when - let result = lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload::new(1), - block_number: 5, - validator_set_id: 0, - }, - signatures: vec![Some(validator_set::Signature::Invalid)], - }); - - // then - assert_eq!( - result, - Err(Error::NotEnoughValidSignatures { - expected: 1, - got: 1, - valid: Some(0), - }) - ); -} - -#[test] -fn light_client_should_perform_set_transition() { - // given - let mut lc = light_client::new(); - lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload { - next_validator_set: Some(2.into()), - mmr: 1.into(), - }, - block_number: 5, - validator_set_id: 0, - }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], - }) - .unwrap(); - - let commitment = SignedCommitment { - commitment: Commitment { - payload: Payload { - next_validator_set: None, - mmr: 1.into(), - }, - block_number: 6, - validator_set_id: 1, - }, - signatures: vec![ - Some(validator_set::Signature::ValidFor(1.into())), - Some(validator_set::Signature::ValidFor(2.into())), - ], - }; - - // when - let result = lc.import_set_transition( - commitment, - light_client::merkle_tree::Proof::ValidFor(2.into(), vec![1.into(), 2.into()]), - ); - - // then - assert_eq!(result, Ok(())); - assert_eq!(lc.validator_set(), &(1, vec![1.into(), 2.into()],)); -} - -#[test] -fn light_client_reject_set_transition_with_invalid_payload() { - // given - let mut lc = light_client::new(); - let commitment = SignedCommitment { - commitment: Commitment { - payload: Payload { - // missing validator set in the payload - next_validator_set: None, - mmr: 1.into(), - }, - block_number: 5, - validator_set_id: 1, - }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], - }; - - // when - let result = lc.import_set_transition( - commitment, - light_client::merkle_tree::Proof::ValidFor(2.into(), vec![0.into(), 1.into(), 2.into()]), - ); - - // then - assert_eq!(result, Err(Error::MissingNextValidatorSetData)); -} - -#[test] -fn light_client_reject_set_transition_with_invalid_proof() { - // given - let mut lc = light_client::new(); - lc.import(SignedCommitment { - commitment: Commitment { - payload: Payload { - next_validator_set: Some(1.into()), - mmr: 0.into(), - }, - block_number: 3, - validator_set_id: 0, - }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], - }) - .unwrap(); - let commitment = SignedCommitment { - commitment: Commitment { - payload: Payload { - next_validator_set: None, - mmr: 1.into(), - }, - block_number: 5, - validator_set_id: 1, - }, - signatures: vec![Some(validator_set::Signature::ValidFor(0.into()))], - }; - - // when - let result = lc.import_set_transition( - commitment, - light_client::merkle_tree::Proof::ValidFor(2.into(), vec![0.into(), 1.into(), 2.into()]), - ); - - // then - assert_eq!(result, Err(Error::InvalidValidatorSetProof)); -} -*/ diff --git a/primitives/beefy/tests/bridge_parachain_flow.rs b/primitives/beefy/tests/bridge_parachain_flow.rs deleted file mode 100644 index 38c41c264eed8..0000000000000 --- a/primitives/beefy/tests/bridge_parachain_flow.rs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (C) 2020 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 . - -//! A set of examples how the bridge would operate. - -// struct MerkleMountainRangeLeaf( -// ( -// /// This is populated only for epoch blocks and contains a merkle root of the NEXT -// /// validator set. -// Option, -// /// -// MerkleRootOfParaHeads, -// /// -// ParentBlockHash, -// ), -// ) -// -// #[test] -// fn light_client_andres_case() { -// // we submit block 10 (1st phase) -// -// // an app submitting a mmr proof against this hash from block10 -// -// -// // we are at block 10 doing second phase for it. (validatorset=1) -// .. -// -// // we got block 20 (validatorset=1) -// -// .. -// } -// -// #[test] -// fn solidity_light_client_makes_progress() { -// let lc = SolidityContractOnEthereum; -// // -// lc.submit(PartialSignedCommitment {}); -// -// // For epoch blocks -// lc.submit(PartialSignedCommitment {}, MMMProofOfMerkleProofOfPublicKeys); -// -// //TODO: 2nd phase verification -// lc.submit_signatures( -// Vec<(idx, PublicKey)>, -// Vec<(idx, Signature)>, -// MerkleProofOfPublicKeys, -// MerkleProofOfSignatures, -// ); -// } -// -// #[test] -// fn light_client_makes_progress() { -// let lc = ...; -// -// lc.submit(SignedCommitment, None); -// -// // if the validator_set_id_changes we require an extra proof. -// lc.submit(SignedCommitment, Some(Vec + MMRProofForTheValidatorMerkleRoot)); -// } -// -// #[test] -// fn can_process_bridge_messages() { -// // ParachainY -HRMP->ParachainX -// // ParachainX -> SmartContractX -// // -// // -// // -// // RelayChain -> BridgeSmartContract -// // -// // -// // x -// // ........................... Relay Chian Blocks -// // c c c c c c | c c c c c c c Generated comittment (by BEEFY) -// // ^ ^ ^ ^ Commitment seen by the light client -// // * 2nd-phase proven commitments. -// // l l -// // -// // x -// // ....a...................... -// // c c c c c c | c c c c c c c -// // ^ ^ -// // * -// -// -// -// let heavy_proof = ( -// ParachainSpecificProof, // for instance storage proof on a parachain -// ParachainHead, -// MerkleProofOfParachainHeadAtTheRelayChainBlockXWhenParachainHeadGotIncluded, -// //MmrProofOfRelayChainBlock, -// Block10 -// ); -// -// let lighter_proof = ( -// MmrProofOfRelayChainBlock, -// -// ); -// } diff --git a/primitives/beefy/tests/light_client/merkle_tree.rs b/primitives/beefy/tests/light_client/merkle_tree.rs deleted file mode 100644 index cdd2fd87dd04d..0000000000000 --- a/primitives/beefy/tests/light_client/merkle_tree.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2020 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::marker::PhantomData; - -#[derive(Debug)] -pub struct Root { - root: u32, - _data: PhantomData, -} - -impl Clone for Root { - fn clone(&self) -> Self { - Self::new(self.root) - } -} - -impl Root { - pub fn new(root: u32) -> Self { - Self { - root, - _data: Default::default(), - } - } -} - -impl From for Root { - fn from(root: u32) -> Self { - Self::new(root) - } -} - -impl Eq for Root {} -impl PartialEq for Root { - fn eq(&self, other: &Self) -> bool { - self.root == other.root - } -} - -#[derive(Debug, PartialEq, Eq)] -pub enum Proof { - ValidFor(Root, X), - Invalid(X), -} - -impl Proof { - pub fn is_valid(&self, root: &Root) -> bool { - matches!(self, Self::ValidFor(ref expected, _) if expected == root) - } - - pub fn into_data(self) -> X { - match self { - Self::ValidFor(_, d) => d, - Self::Invalid(d) => d, - } - } -} diff --git a/primitives/beefy/tests/light_client/mod.rs b/primitives/beefy/tests/light_client/mod.rs deleted file mode 100644 index a59947b907a3e..0000000000000 --- a/primitives/beefy/tests/light_client/mod.rs +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (C) 2020 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 beefy_primitives::{self as bp, ValidatorSetId}; -use beefy_primitives::crypto::{Public, Signature}; - -pub mod merkle_tree; - -/// A marker struct for validator set merkle tree. -#[derive(Debug)] -pub struct ValidatorSetTree; - -/// A marker struct for the MMR. -#[derive(Debug)] -pub struct Mmr; - -#[derive(Debug, PartialEq, Eq)] -pub struct Payload { - pub next_validator_set: Option>, - pub mmr: merkle_tree::Root, -} - -impl Payload { - pub fn new(root: u32) -> Self { - Self { - next_validator_set: None, - mmr: root.into(), - } - } -} - -pub type BlockNumber = u64; -pub type Commitment = bp::Commitment; -pub type SignedCommitment = bp::SignedCommitment; - -#[derive(Debug, PartialEq, Eq)] -pub enum Error { - /// [Commitment] can't be imported, cause it's signed by either past or future validator set. - InvalidValidatorSetId { - expected: ValidatorSetId, - got: ValidatorSetId, - }, - /// [Commitment] can't be imported, cause it's a set transition block and the proof is missing. - InvalidValidatorSetProof, - /// [Commitment] is not useful, cause it's made for an older block than we know of. - /// - /// In practice it's okay for the light client to import such commitments (if the validator set - /// matches), but it doesn't provide any more value, since the payload is meant to be - /// cumulative. - /// It might be useful however, if we want to verify proofs that were generated against this - /// specific block number. - OldBlock { - /// Best block currently known by the light client. - best_known: BlockNumber, - /// Block in the commitment. - got: BlockNumber, - }, - /// There are too many signatures in the commitment - more than validators. - InvalidNumberOfSignatures { - /// Number of validators in the set. - expected: usize, - /// Numbers of signatures in the commitment. - got: usize, - }, - /// [SignedCommitment] doesn't have enough valid signatures. - NotEnoughValidSignatures { - expected: usize, - got: usize, - valid: Option, - }, - /// Next validator set has not been provided by any of the previous commitments. - MissingNextValidatorSetData, - /// Couldn't verify the proof against MMR root of the latest commitment. - InvalidMmrProof, -} - -type ValidatorSet = (ValidatorSetId, Vec); - -pub struct LightClient { - validator_set: ValidatorSet, - next_validator_set: Option>, - last_commitment: Option, -} - -impl LightClient { - pub fn import(&mut self, signed: SignedCommitment) -> Result<(), Error> { - // Make sure it's not a set transition block (see [import_set_transition]). - if signed.commitment.validator_set_id != self.validator_set.0 { - return Err(Error::InvalidValidatorSetId { - expected: self.validator_set.0, - got: signed.commitment.validator_set_id, - }); - } - - let commitment = self.validate_commitment(signed, &self.validator_set)?; - if let Some(ref next_validator_set) = commitment.payload.next_validator_set { - self.next_validator_set = Some(next_validator_set.clone()); - } - self.last_commitment = Some(commitment); - - Ok(()) - } - - pub fn import_set_transition( - &mut self, - signed: SignedCommitment, - validator_set_proof: merkle_tree::Proof>, - ) -> Result<(), Error> { - // Make sure it is a set transition block (see [import]). - if signed.commitment.validator_set_id != self.validator_set.0 + 1 { - return Err(Error::InvalidValidatorSetId { - expected: self.validator_set.0 + 1, - got: signed.commitment.validator_set_id, - }); - } - - // verify validator set proof - let validator_set_root = self - .next_validator_set - .as_ref() - .ok_or(Error::MissingNextValidatorSetData)?; - if !validator_set_proof.is_valid(validator_set_root) { - return Err(Error::InvalidValidatorSetProof); - } - let set = validator_set_proof.into_data(); - let new_id = self.validator_set.0 + 1; - let new_validator_set = (new_id, set); - - let commitment = self.validate_commitment(signed, &new_validator_set)?; - - self.validator_set = new_validator_set; - self.next_validator_set = commitment.payload.next_validator_set.clone(); - self.last_commitment = Some(commitment); - - Ok(()) - } - - pub fn verify_proof(&self, proof: merkle_tree::Proof) -> Result { - if proof.is_valid(&self.last_payload().mmr) { - Ok(proof.into_data()) - } else { - Err(Error::InvalidMmrProof) - } - } - - pub fn validator_set(&self) -> &ValidatorSet { - &self.validator_set - } - - pub fn last_commitment(&self) -> Option<&Commitment> { - self.last_commitment.as_ref() - } - - pub fn last_payload(&self) -> &Payload { - &self - .last_commitment() - .expect("Genesis doesn't contain commitment.") - .payload - } - - fn validate_commitment( - &self, - commitment: SignedCommitment, - validator_set: &ValidatorSet, - ) -> Result { - let no_of_non_empty_signatures = commitment.no_of_signatures(); - let SignedCommitment { commitment, signatures } = commitment; - // Make sure it's signed by the current validator set we know of. - if validator_set.0 != commitment.validator_set_id { - return Err(Error::InvalidValidatorSetId { - expected: validator_set.0, - got: commitment.validator_set_id, - }); - } - - // Make sure it's not worse than what we already have. - let best_block = self.last_commitment().map(|c| c.block_number).unwrap_or(0); - if commitment.block_number <= best_block { - return Err(Error::OldBlock { - best_known: best_block, - got: commitment.block_number, - }); - } - - // check number of signatures - let validator_set_count = validator_set.1.len(); - if signatures.len() != validator_set_count { - return Err(Error::InvalidNumberOfSignatures { - expected: validator_set_count, - got: signatures.len(), - }); - } - - // check the validity of signatures - let minimal_number_of_signatures = Self::minimal_number_of_signatures(validator_set); - if no_of_non_empty_signatures < minimal_number_of_signatures { - return Err(Error::NotEnoughValidSignatures { - expected: minimal_number_of_signatures, - got: no_of_non_empty_signatures, - valid: None, - }); - } - - let mut valid = 0; - for (signature, public) in signatures.into_iter().zip(validator_set.1.iter()) { - match signature { - Some(signature) if signature.is_valid_for(public) => { - valid += 1; - } - _ => {} - } - } - - if valid < minimal_number_of_signatures { - return Err(Error::NotEnoughValidSignatures { - expected: minimal_number_of_signatures, - got: no_of_non_empty_signatures, - valid: Some(valid), - }); - } - - Ok(commitment) - } - - fn minimal_number_of_signatures(set: &ValidatorSet) -> usize { - 2 * set.1.len() / 3 + 1 - } -} - -pub fn new() -> LightClient { - LightClient { - validator_set: (0, vec![Public(0)]), - next_validator_set: None, - last_commitment: None, - } -} -*/ \ No newline at end of file diff --git a/primitives/beefy/tests/light_client/validator_set.rs b/primitives/beefy/tests/light_client/validator_set.rs deleted file mode 100644 index 2f30d97b19a74..0000000000000 --- a/primitives/beefy/tests/light_client/validator_set.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2020 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 . - -#[derive(Debug, PartialEq, Eq)] -pub struct Public(pub u8); - -impl From for Public { - fn from(public: u8) -> Self { - Self(public) - } -} - -#[derive(Debug)] -pub enum Signature { - ValidFor(Public), - Invalid, -} - -impl beefy_primitives::crypto::Signature { - pub fn is_valid_for(&self, public: &Public) -> bool { - matches!(self, Self::ValidFor(ref p) if p == public) - } -} From 74eb9cca89d4b8273cb642d5e56faf89a2422c88 Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Wed, 22 Sep 2021 07:03:34 +0200 Subject: [PATCH 104/109] carg fmt --- client/beefy/src/gossip.rs | 8 +++--- client/beefy/src/gossip_tests.rs | 2 +- client/beefy/src/keystore.rs | 4 +-- client/beefy/src/lib.rs | 4 +-- client/beefy/src/round.rs | 2 +- client/beefy/src/worker.rs | 18 +++++++------- frame/beefy-mmr/primitives/src/lib.rs | 16 ++++++------ frame/beefy-mmr/src/lib.rs | 17 +++++++------ frame/beefy/src/lib.rs | 2 +- frame/beefy/src/mock.rs | 4 ++- primitives/beefy/src/commitment.rs | 7 +++--- primitives/beefy/src/lib.rs | 5 +--- primitives/beefy/src/witness.rs | 35 +++++++++++---------------- 13 files changed, 59 insertions(+), 65 deletions(-) diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index 9964b5b0de3d2..7eaef02d4e9f1 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -160,17 +160,17 @@ where let known_votes = self.known_votes.read(); if !GossipValidator::::is_live(&known_votes, &round) { - return ValidationResult::Discard; + return ValidationResult::Discard } if GossipValidator::::is_known(&known_votes, &round, &msg_hash) { - return ValidationResult::ProcessAndKeep(self.topic); + return ValidationResult::ProcessAndKeep(self.topic) } } if BeefyKeystore::verify(&msg.id, &msg.signature, &msg.commitment.encode()) { GossipValidator::::add_known(&mut *self.known_votes.write(), &round, msg_hash); - return ValidationResult::ProcessAndKeep(self.topic); + return ValidationResult::ProcessAndKeep(self.topic) } else { // TODO: report peer debug!(target: "beefy", "🥩 Bad signature on message: {:?}, from: {:?}", msg, sender); @@ -217,7 +217,7 @@ where let known_votes = self.known_votes.read(); Box::new(move |_who, intent, _topic, mut data| { if let MessageIntent::PeriodicRebroadcast = intent { - return do_rebroadcast; + return do_rebroadcast } let msg = match VoteMessage::, Public, Signature>::decode( diff --git a/client/beefy/src/gossip_tests.rs b/client/beefy/src/gossip_tests.rs index 0387bf08d159f..2d46b873cb7b0 100644 --- a/client/beefy/src/gossip_tests.rs +++ b/client/beefy/src/gossip_tests.rs @@ -22,7 +22,7 @@ use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr}; use beefy_primitives::{crypto::Signature, Commitment, MmrRootHash, VoteMessage, KEY_TYPE}; -use crate::{keystore::tests::Keyring, keystore::BeefyKeystore}; +use crate::keystore::{tests::Keyring, BeefyKeystore}; use super::*; diff --git a/client/beefy/src/keystore.rs b/client/beefy/src/keystore.rs index a74aa891a20e2..88618b8a5a140 100644 --- a/client/beefy/src/keystore.rs +++ b/client/beefy/src/keystore.rs @@ -87,8 +87,8 @@ impl BeefyKeystore { Ok(sig) } - /// Returns a vector of [`beefy_primitives::crypto::Public`] keys which are currently supported (i.e. found - /// in the keystore). + /// Returns a vector of [`beefy_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()))?; diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs index 33432143736a0..b2372b2a6c518 100644 --- a/client/beefy/src/lib.rs +++ b/client/beefy/src/lib.rs @@ -134,11 +134,11 @@ where Ok(metrics) => { debug!(target: "beefy", "🥩 Registered metrics"); Some(metrics) - } + }, Err(err) => { debug!(target: "beefy", "🥩 Failed to register metrics: {:?}", err); None - } + }, }, ); diff --git a/client/beefy/src/round.rs b/client/beefy/src/round.rs index ee53c8d427162..7d443603b364e 100644 --- a/client/beefy/src/round.rs +++ b/client/beefy/src/round.rs @@ -36,7 +36,7 @@ impl RoundTracker { fn add_vote(&mut self, vote: (Public, Signature)) -> bool { // this needs to handle equivocations in the future if self.votes.contains(&vote) { - return false; + return false } self.votes.push(vote); diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index ca408fc00d419..1d54990d1439f 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -150,7 +150,7 @@ where block } else { debug!(target: "beefy", "🥩 Missing best BEEFY block - won't vote for: {:?}", number); - return false; + return false }; let target = vote_target(self.best_grandpa_block, best_beefy_block, self.min_block_delta); @@ -219,8 +219,8 @@ where // TODO: (adoerr) Enacting a new authority set will also implicitly 'conclude' // the currently active BEEFY voting round by starting a new one. This is // temporary and needs to be replaced by proper round life cycle handling. - if active.id != self.rounds.validator_set_id() - || (active.id == GENESIS_AUTHORITY_SET_ID && self.best_beefy_block.is_none()) + if active.id != self.rounds.validator_set_id() || + (active.id == GENESIS_AUTHORITY_SET_ID && self.best_beefy_block.is_none()) { debug!(target: "beefy", "🥩 New active validator set id: {:?}", active); metric_set!(self, beefy_validator_set_id, active.id); @@ -239,8 +239,8 @@ where self.best_beefy_block = Some(*notification.header.number()); - // this metric is kind of 'fake'. Best BEEFY block should only be updated once we have a - // signed commitment for the block. Remove once the above TODO is done. + // this metric is kind of 'fake'. Best BEEFY block should only be updated once we + // have a signed commitment for the block. Remove once the above TODO is done. metric_set!(self, beefy_best_block, *notification.header.number()); } } @@ -253,7 +253,7 @@ where id } else { debug!(target: "beefy", "🥩 Missing validator id - can't vote for: {:?}", notification.header.hash()); - return; + return }; let mmr_root = @@ -261,7 +261,7 @@ where hash } else { warn!(target: "beefy", "🥩 No MMR root digest found for: {:?}", notification.header.hash()); - return; + return }; let commitment = Commitment { @@ -275,8 +275,8 @@ where Ok(sig) => sig, Err(err) => { warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err); - return; - } + return + }, }; trace!( diff --git a/frame/beefy-mmr/primitives/src/lib.rs b/frame/beefy-mmr/primitives/src/lib.rs index e784fafb1ea9e..2052dbde9ddf2 100644 --- a/frame/beefy-mmr/primitives/src/lib.rs +++ b/frame/beefy-mmr/primitives/src/lib.rs @@ -113,7 +113,7 @@ where // swap collections to avoid allocations upper = next; next = t; - } + }, }; } } @@ -282,7 +282,7 @@ where L: Into>, { if leaf_index >= number_of_leaves { - return false; + return false } let leaf_hash = match leaf.into() { @@ -354,15 +354,15 @@ where combined[32..64].copy_from_slice(&b); next.push(H::hash(&combined)); - } + }, // Odd number of items. Promote the item to the upper layer. (Some(a), None) if !next.is_empty() => { next.push(a); - } + }, // Last item = root. (Some(a), None) => { - return Ok(a); - } + return Ok(a) + }, // Finish up, no more items. _ => { #[cfg(feature = "debug")] @@ -370,8 +370,8 @@ where "[merkelize_row] Next: {:?}", next.iter().map(hex::encode).collect::>() ); - return Err(next); - } + return Err(next) + }, } } } diff --git a/frame/beefy-mmr/src/lib.rs b/frame/beefy-mmr/src/lib.rs index 86defda985ab5..001831639b169 100644 --- a/frame/beefy-mmr/src/lib.rs +++ b/frame/beefy-mmr/src/lib.rs @@ -141,9 +141,9 @@ pub mod pallet { /// Retrieve a list of current parachain heads. /// - /// The trait is implemented for `paras` module, but since not all chains might have parachains, - /// and we want to keep the MMR leaf structure uniform, it's possible to use `()` as well to - /// simply put dummy data to the leaf. + /// The trait is implemented for `paras` module, but since not all chains might have + /// parachains, and we want to keep the MMR leaf structure uniform, it's possible to use + /// `()` as well to simply put dummy data to the leaf. type ParachainHeads: ParachainHeadsProvider; } @@ -196,8 +196,9 @@ where /// NOTE this does not include parathreads - only parachains are part of the merkle tree. /// /// NOTE This is an initial and inefficient implementation, which re-constructs - /// the merkle tree every block. Instead we should update the merkle root in [Self::on_initialize] - /// call of this pallet and update the merkle tree efficiently (use on-chain storage to persist inner nodes). + /// the merkle tree every block. Instead we should update the merkle root in + /// [Self::on_initialize] call of this pallet and update the merkle tree efficiently (use + /// on-chain storage to persist inner nodes). fn parachain_heads_merkle_root() -> MerkleRootOf { let mut para_heads = T::ParachainHeads::parachain_heads(); para_heads.sort(); @@ -211,14 +212,14 @@ where /// constructed from uncompressed secp256k1 public keys converted to Ethereum addresses /// of the next BEEFY authority set. /// - /// This function will use a storage-cached entry in case the set didn't change, or compute and cache - /// new one in case it did. + /// This function will use a storage-cached entry in case the set didn't change, or compute and + /// cache new one in case it did. fn update_beefy_next_authority_set() -> BeefyNextAuthoritySet> { let id = pallet_beefy::Pallet::::validator_set_id() + 1; let current_next = Self::beefy_next_authorities(); // avoid computing the merkle tree if validator set id didn't change. if id == current_next.id { - return current_next; + return current_next } let beefy_addresses = pallet_beefy::Pallet::::next_authorities() diff --git a/frame/beefy/src/lib.rs b/frame/beefy/src/lib.rs index c7c8439080802..32f3133373432 100644 --- a/frame/beefy/src/lib.rs +++ b/frame/beefy/src/lib.rs @@ -123,7 +123,7 @@ impl Pallet { fn initialize_authorities(authorities: &[T::BeefyId]) { if authorities.is_empty() { - return; + return } assert!(>::get().is_empty(), "Authorities are already initialized!"); diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index 712770730645f..c583f9ac08217 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -20,7 +20,9 @@ use std::vec; -use frame_support::{construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities}; +use frame_support::{ + construct_runtime, parameter_types, sp_io::TestExternalities, BasicExternalities, +}; use sp_core::H256; use sp_runtime::{ app_crypto::ecdsa::Public, diff --git a/primitives/beefy/src/commitment.rs b/primitives/beefy/src/commitment.rs index 8e9c08e625e9b..49816a71847cf 100644 --- a/primitives/beefy/src/commitment.rs +++ b/primitives/beefy/src/commitment.rs @@ -49,9 +49,10 @@ pub struct Commitment { /// BEEFY validator set supposed to sign this commitment. /// - /// Validator set is changing once per epoch. The Light Client must be provided by details about - /// the validator set whenever it's importing first commitment with a new `validator_set_id`. - /// Validator set data MUST be verifiable, for instance using [payload] information. + /// Validator set is changing once per epoch. The Light Client must be provided by details + /// about the validator set whenever it's importing first commitment with a new + /// `validator_set_id`. Validator set data MUST be verifiable, for instance using [payload] + /// information. pub validator_set_id: ValidatorSetId, } diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 8a1e32d467c15..cb5eca66b3aae 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -91,10 +91,7 @@ pub struct ValidatorSet { impl ValidatorSet { /// Return an empty validator set with id of 0. pub fn empty() -> Self { - Self { - validators: Default::default(), - id: Default::default(), - } + Self { validators: Default::default(), id: Default::default() } } } diff --git a/primitives/beefy/src/witness.rs b/primitives/beefy/src/witness.rs index 475128e10a602..01e1524fc4e79 100644 --- a/primitives/beefy/src/witness.rs +++ b/primitives/beefy/src/witness.rs @@ -51,7 +51,9 @@ pub struct SignedCommitmentWitness { pub signatures_merkle_root: TMerkleRoot, } -impl SignedCommitmentWitness { +impl + SignedCommitmentWitness +{ /// Convert [SignedCommitment] into [SignedCommitmentWitness]. /// /// This takes a [SignedCommitment], which contains full signatures @@ -71,14 +73,7 @@ impl SignedCommitmentWitness; type TestSignedCommitment = SignedCommitment; - type TestSignedCommitmentWitness = SignedCommitmentWitness>>; + type TestSignedCommitmentWitness = + SignedCommitmentWitness>>; // The mock signatures are equivalent to the ones produced by the BEEFY keystore fn mock_signatures() -> (crypto::Signature, crypto::Signature) { let store: SyncCryptoStorePtr = KeyStore::new().into(); let alice = sp_core::ecdsa::Pair::from_string("//Alice", None).unwrap(); - let _ = SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()).unwrap(); + let _ = + SyncCryptoStore::insert_unknown(&*store, KEY_TYPE, "//Alice", alice.public().as_ref()) + .unwrap(); let msg = keccak_256(b"This is the first message"); let sig1 = SyncCryptoStore::ecdsa_sign_prehashed(&*store, KEY_TYPE, &alice.public(), &msg) @@ -118,18 +116,12 @@ mod tests { } fn signed_commitment() -> TestSignedCommitment { - let commitment: TestCommitment = Commitment { - payload: "Hello World!".into(), - block_number: 5, - validator_set_id: 0, - }; + let commitment: TestCommitment = + Commitment { payload: "Hello World!".into(), block_number: 5, validator_set_id: 0 }; let sigs = mock_signatures(); - SignedCommitment { - commitment, - signatures: vec![None, None, Some(sigs.0), Some(sigs.1)], - } + SignedCommitment { commitment, signatures: vec![None, None, Some(sigs.0), Some(sigs.1)] } } #[test] @@ -138,7 +130,8 @@ mod tests { let signed = signed_commitment(); // when - let (witness, signatures) = TestSignedCommitmentWitness::from_signed(signed, |sigs| sigs.to_vec()); + let (witness, signatures) = + TestSignedCommitmentWitness::from_signed(signed, |sigs| sigs.to_vec()); // then assert_eq!(witness.signatures_merkle_root, signatures); From bedf6f374c200c2a609ea7ef8d402481f04e3d13 Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Wed, 22 Sep 2021 07:15:09 +0200 Subject: [PATCH 105/109] more formatting --- frame/beefy-mmr/primitives/src/lib.rs | 4 +--- primitives/beefy/src/witness.rs | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frame/beefy-mmr/primitives/src/lib.rs b/frame/beefy-mmr/primitives/src/lib.rs index 2052dbde9ddf2..4d4d4e8721ac8 100644 --- a/frame/beefy-mmr/primitives/src/lib.rs +++ b/frame/beefy-mmr/primitives/src/lib.rs @@ -360,9 +360,7 @@ where next.push(a); }, // Last item = root. - (Some(a), None) => { - return Ok(a) - }, + (Some(a), None) => return Ok(a), // Finish up, no more items. _ => { #[cfg(feature = "debug")] diff --git a/primitives/beefy/src/witness.rs b/primitives/beefy/src/witness.rs index 01e1524fc4e79..c28a464e72df5 100644 --- a/primitives/beefy/src/witness.rs +++ b/primitives/beefy/src/witness.rs @@ -151,7 +151,12 @@ mod tests { assert_eq!(decoded, Ok(witness)); assert_eq!( encoded, - hex_literal::hex!("3048656c6c6f20576f726c6421050000000000000000000000000000000000000000000000100000010110000001558455ad81279df0795cc985580e4fb75d72d948d1107b2ac80a09abed4da8480c746cc321f2319a5e99a830e314d10dd3cd68ce3dc0c33c86e99bcb7816f9ba01012d6e1f8105c337a86cdd9aaacdc496577f3db8c55ef9e6fd48f2c5c05a2274707491635d8ba3df64f324575b7b2a34487bca2324b6a0046395a71681be3d0c2a00") + hex_literal::hex!( + "3048656c6c6f20576f726c64210500000000000000000000000000000000000000000000001000 + 00010110000001558455ad81279df0795cc985580e4fb75d72d948d1107b2ac80a09abed4da8480c746cc321f2319a5e9 + 9a830e314d10dd3cd68ce3dc0c33c86e99bcb7816f9ba01012d6e1f8105c337a86cdd9aaacdc496577f3db8c55ef9e6fd + 48f2c5c05a2274707491635d8ba3df64f324575b7b2a34487bca2324b6a0046395a71681be3d0c2a00" + ) ); } } From 0c57822ae82353cd3e88313cd8032a76e2e8679e Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Wed, 22 Sep 2021 07:21:03 +0200 Subject: [PATCH 106/109] shorten line --- primitives/beefy/src/commitment.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/primitives/beefy/src/commitment.rs b/primitives/beefy/src/commitment.rs index 49816a71847cf..7aab93bbcb973 100644 --- a/primitives/beefy/src/commitment.rs +++ b/primitives/beefy/src/commitment.rs @@ -185,7 +185,12 @@ mod tests { assert_eq!(decoded, Ok(signed)); assert_eq!( encoded, - hex_literal::hex!("3048656c6c6f20576f726c642105000000000000000000000000000000000000000000000010000001558455ad81279df0795cc985580e4fb75d72d948d1107b2ac80a09abed4da8480c746cc321f2319a5e99a830e314d10dd3cd68ce3dc0c33c86e99bcb7816f9ba01012d6e1f8105c337a86cdd9aaacdc496577f3db8c55ef9e6fd48f2c5c05a2274707491635d8ba3df64f324575b7b2a34487bca2324b6a0046395a71681be3d0c2a00") + hex_literal::hex!( + "3048656c6c6f20576f726c64210500000000000000000000000000000000000000000000001000 + 0001558455ad81279df0795cc985580e4fb75d72d948d1107b2ac80a09abed4da8480c746cc321f2319a5e99a830e314d + 10dd3cd68ce3dc0c33c86e99bcb7816f9ba01012d6e1f8105c337a86cdd9aaacdc496577f3db8c55ef9e6fd48f2c5c05a + 2274707491635d8ba3df64f324575b7b2a34487bca2324b6a0046395a71681be3d0c2a00" + ) ); } From 41d47744e1aac28c9677034ad5b9969be07f1cf7 Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Wed, 22 Sep 2021 10:27:17 +0200 Subject: [PATCH 107/109] downgrade parity-scale-codec to 2.2.0 --- Cargo.lock | 4 ++-- client/beefy/Cargo.toml | 2 +- client/beefy/rpc/Cargo.toml | 2 +- frame/beefy-mmr/Cargo.toml | 2 +- frame/beefy/Cargo.toml | 2 +- primitives/beefy/Cargo.toml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e66fe655a67a..59746cd94686d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6209,9 +6209,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "2.3.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11263a97373b43da4b426edbb52ef99a7b51e2d9752ef56a7f8b356f48495a5" +checksum = "8975095a2a03bbbdc70a74ab11a4f76a6d0b84680d87c68d722531b0ac28e8a9" dependencies = [ "arrayvec 0.7.0", "bitvec 0.20.2", diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 8c58a8613a6c2..16158c9d789f8 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -13,7 +13,7 @@ parking_lot = "0.11" thiserror = "1.0" wasm-timer = "0.2.5" -codec = { version = "2.3.0", package = "parity-scale-codec", features = ["derive"] } +codec = { version = "2.2.0", package = "parity-scale-codec", features = ["derive"] } prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { version = "4.0.0-dev", path = "../../primitives/api" } diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml index 704db19d885cf..6bb5c5fcc668e 100644 --- a/client/beefy/rpc/Cargo.toml +++ b/client/beefy/rpc/Cargo.toml @@ -15,7 +15,7 @@ jsonrpc-core-client = "18.0.0" jsonrpc-derive = "18.0.0" jsonrpc-pubsub = "18.0.0" -codec = { version = "2.3.0", package = "parity-scale-codec", features = ["derive"] } +codec = { version = "2.2.0", package = "parity-scale-codec", features = ["derive"] } sc-rpc = { version = "4.0.0-dev", path = "../../rpc" } diff --git a/frame/beefy-mmr/Cargo.toml b/frame/beefy-mmr/Cargo.toml index 66690b39074c8..3d4a9a72ddf86 100644 --- a/frame/beefy-mmr/Cargo.toml +++ b/frame/beefy-mmr/Cargo.toml @@ -8,7 +8,7 @@ description = "BEEFY + MMR runtime utilities" [dependencies] hex = { version = "0.4", optional = true } -codec = { version = "2.3.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +codec = { version = "2.2.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } libsecp256k1 = { version = "0.7.0", default-features = false } log = { version = "0.4.13", default-features = false } scale-info = { version = "1.0", default-features = false, features = ["derive"] } diff --git a/frame/beefy/Cargo.toml b/frame/beefy/Cargo.toml index fcb53a41dd532..e5af666e7ca54 100644 --- a/frame/beefy/Cargo.toml +++ b/frame/beefy/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0" [dependencies] -codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +codec = { version = "2.2.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } scale-info = { version = "1.0", default-features = false, features = ["derive"] } serde = { version = "1.0.130", optional = true } diff --git a/primitives/beefy/Cargo.toml b/primitives/beefy/Cargo.toml index 55119f674d1ae..633ac0e8fbcd1 100644 --- a/primitives/beefy/Cargo.toml +++ b/primitives/beefy/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0" [dependencies] -codec = { version = "2.3.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } +codec = { version = "2.2.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } scale-info = { version = "1.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", path = "../api", default-features = false } From 4b5e6900cc63a35a59599fdc5b60f858de337297 Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Wed, 22 Sep 2021 10:55:38 +0200 Subject: [PATCH 108/109] use path dependency for Prometheus endpoint --- Cargo.lock | 46 ++++++++++++++--------------------------- client/beefy/Cargo.toml | 2 +- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59746cd94686d..693388a5299ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -516,7 +516,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "strum 0.21.0", - "substrate-prometheus-endpoint 0.9.0 (git+https://github.com/paritytech/substrate?branch=master)", + "substrate-prometheus-endpoint", "thiserror", "wasm-timer", ] @@ -7517,7 +7517,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-tracing", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", ] @@ -7542,7 +7542,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", ] @@ -7650,7 +7650,7 @@ dependencies = [ "sp-storage", "sp-test-primitives", "sp-trie", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime", "thiserror", ] @@ -7703,7 +7703,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-test-primitives", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "thiserror", ] @@ -7740,7 +7740,7 @@ dependencies = [ "sp-runtime", "sp-timestamp", "sp-tracing", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tempfile", ] @@ -7790,7 +7790,7 @@ dependencies = [ "sp-timestamp", "sp-tracing", "sp-version", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tempfile", ] @@ -7867,7 +7867,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-timestamp", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", "substrate-test-runtime-transaction-pool", "tokio", @@ -7894,7 +7894,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", ] [[package]] @@ -8062,7 +8062,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-tracing", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tempfile", "tokio", @@ -8190,7 +8190,7 @@ dependencies = [ "sp-runtime", "sp-test-primitives", "sp-tracing", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime", "substrate-test-runtime-client", "tempfile", @@ -8213,7 +8213,7 @@ dependencies = [ "quickcheck", "sc-network", "sp-runtime", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tracing", ] @@ -8298,7 +8298,7 @@ name = "sc-proposer-metrics" version = "0.9.0" dependencies = [ "log 0.4.14", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", ] [[package]] @@ -8374,7 +8374,7 @@ dependencies = [ "jsonrpc-ws-server", "log 0.4.14", "serde_json", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "tokio", ] @@ -8448,7 +8448,7 @@ dependencies = [ "sp-transaction-storage-proof", "sp-trie", "sp-version", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime", "substrate-test-runtime-client", "tempfile", @@ -8610,7 +8610,7 @@ dependencies = [ "sp-runtime", "sp-tracing", "sp-transaction-pool", - "substrate-prometheus-endpoint 0.9.0", + "substrate-prometheus-endpoint", "substrate-test-runtime", "substrate-test-runtime-client", "substrate-test-runtime-transaction-pool", @@ -10064,20 +10064,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "substrate-prometheus-endpoint" -version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#50c84cb8f92b6446b4a7b3043684b116aaea6866" -dependencies = [ - "async-std", - "derive_more", - "futures-util", - "hyper 0.14.11", - "log 0.4.14", - "prometheus", - "tokio", -] - [[package]] name = "substrate-test-client" version = "2.0.1" diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 16158c9d789f8..d4541288a6287 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -14,7 +14,7 @@ thiserror = "1.0" wasm-timer = "0.2.5" codec = { version = "2.2.0", package = "parity-scale-codec", features = ["derive"] } -prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" } +prometheus = { version = "0.9.0", package = "substrate-prometheus-endpoint", path = "../../utils/prometheus" } sp-api = { version = "4.0.0-dev", path = "../../primitives/api" } sp-application-crypto = { version = "4.0.0-dev", path = "../../primitives/application-crypto" } From ea2fd96561cd91b0026da5af7b1a42a7751d00ae Mon Sep 17 00:00:00 2001 From: adoerr <0xad@gmx.net> Date: Thu, 23 Sep 2021 16:00:24 +0200 Subject: [PATCH 109/109] remove clippy annotations --- client/beefy/rpc/src/lib.rs | 1 - client/beefy/src/gossip.rs | 2 -- client/beefy/src/worker.rs | 2 -- frame/beefy-mmr/src/mock.rs | 3 --- frame/beefy/src/mock.rs | 3 --- primitives/beefy/src/lib.rs | 2 -- 6 files changed, 13 deletions(-) diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs index 0a52b4bdbd678..c9a09525569b8 100644 --- a/client/beefy/rpc/src/lib.rs +++ b/client/beefy/rpc/src/lib.rs @@ -34,7 +34,6 @@ use beefy_gadget::notification::BeefySignedCommitmentStream; mod notification; /// Provides RPC methods for interacting with BEEFY. -#[allow(clippy::needless_return)] #[rpc] pub trait BeefyApi { /// RPC Metadata diff --git a/client/beefy/src/gossip.rs b/client/beefy/src/gossip.rs index 7eaef02d4e9f1..d0199964b6ebf 100644 --- a/client/beefy/src/gossip.rs +++ b/client/beefy/src/gossip.rs @@ -98,7 +98,6 @@ where let mut live = self.known_votes.write(); - #[allow(clippy::map_entry)] if !live.contains_key(&round) { live.insert(round, Default::default()); } @@ -199,7 +198,6 @@ where }) } - #[allow(clippy::type_complexity)] fn message_allowed<'a>( &'a self, ) -> Box bool + 'a> { diff --git a/client/beefy/src/worker.rs b/client/beefy/src/worker.rs index 1d54990d1439f..3f52686930332 100644 --- a/client/beefy/src/worker.rs +++ b/client/beefy/src/worker.rs @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![allow(clippy::collapsible_match)] - use std::{collections::BTreeSet, fmt::Debug, marker::PhantomData, sync::Arc}; use codec::{Codec, Decode, Encode}; diff --git a/frame/beefy-mmr/src/mock.rs b/frame/beefy-mmr/src/mock.rs index ed27431fa783d..a8d136b192aec 100644 --- a/frame/beefy-mmr/src/mock.rs +++ b/frame/beefy-mmr/src/mock.rs @@ -15,9 +15,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// construct_runtime requires this -#![allow(clippy::from_over_into)] - use std::vec; use beefy_primitives::mmr::MmrLeafVersion; diff --git a/frame/beefy/src/mock.rs b/frame/beefy/src/mock.rs index c583f9ac08217..696d0d972e70c 100644 --- a/frame/beefy/src/mock.rs +++ b/frame/beefy/src/mock.rs @@ -15,9 +15,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// construct_runtime requires this -#![allow(clippy::from_over_into)] - use std::vec; use frame_support::{ diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index cb5eca66b3aae..790b915ab98db 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -17,8 +17,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] -// NOTE: needed to silence warnings about generated code in `decl_runtime_apis` -#![allow(clippy::too_many_arguments, clippy::unnecessary_mut_passed)] //! Primitives for BEEFY protocol. //!