diff --git a/Cargo.lock b/Cargo.lock index 06fa5f63af..8019bb3e2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,40 +16,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" -[[package]] -name = "aes-ctr" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" -dependencies = [ - "aes-soft", - "aesni", - "ctr", - "stream-cipher", -] - -[[package]] -name = "aes-soft" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" -dependencies = [ - "block-cipher-trait", - "byteorder 1.3.4", - "opaque-debug", -] - -[[package]] -name = "aesni" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" -dependencies = [ - "block-cipher-trait", - "opaque-debug", - "stream-cipher", -] - [[package]] name = "ahash" version = "0.2.18" @@ -76,7 +42,7 @@ checksum = "4f823d037a7ec6ea2197046bafd4ae150e6bc36f9ca347404f46a46823fa84f2" dependencies = [ "approx", "num-complex", - "num-traits", + "num-traits 0.2.11", ] [[package]] @@ -99,9 +65,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "013a6e0a2cbe3d20f9c60b65458f7a7f7a5e636c5d0f45a5a6aee5d4b1f01785" +checksum = "d9a60d744a80c30fcb657dfe2c1b22bcb3e814c1a1e3674f32bf5820b570fbff" [[package]] name = "app_dirs" @@ -121,7 +87,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" dependencies = [ - "num-traits", + "num-traits 0.2.11", ] [[package]] @@ -166,8 +132,8 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" dependencies = [ - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -214,14 +180,14 @@ dependencies = [ [[package]] name = "async-tls" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce6977f57fa68da77ffe5542950d47e9c23d65f5bc7cb0a9f8700996913eec7" +checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a" dependencies = [ "futures 0.3.4", - "rustls 0.16.0", + "rustls", "webpki", - "webpki-roots 0.17.0", + "webpki-roots 0.19.0", ] [[package]] @@ -275,15 +241,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder 1.3.4", -] - [[package]] name = "base64" version = "0.11.0" @@ -292,9 +249,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "bindgen" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8" +checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" dependencies = [ "bitflags", "cexpr", @@ -307,7 +264,7 @@ dependencies = [ "log", "peeking_take_while", "proc-macro2", - "quote", + "quote 1.0.3", "regex", "rustc-hash", "shlex", @@ -316,8 +273,9 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.1.0" +version = "0.1.1" dependencies = [ + "bitcoin_hashes", "hex", "mocktopus", "parity-scale-codec", @@ -329,6 +287,12 @@ dependencies = [ "x-core", ] +[[package]] +name = "bitcoin_hashes" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b375d62f341cef9cd9e77793ec8f1db3fc9ce2e4d57e982c8fe697a2c16af3b6" + [[package]] name = "bitflags" version = "1.2.1" @@ -374,23 +338,36 @@ dependencies = [ ] [[package]] -name = "block-buffer" -version = "0.7.3" +name = "blake2b_simd" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" dependencies = [ - "block-padding", - "byte-tools", - "byteorder 1.3.4", - "generic-array", + "arrayref", + "arrayvec 0.5.1", + "constant_time_eq", ] [[package]] -name = "block-cipher-trait" -version = "0.6.2" +name = "blake2s_simd" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" +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", + "byte-tools", + "byteorder", "generic-array", ] @@ -413,7 +390,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "slab", ] @@ -434,15 +411,15 @@ dependencies = [ [[package]] name = "btc-parachain" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" dependencies = [ "btc-parachain-runtime", "futures 0.3.4", "log", "sc-basic-authorship", "sc-cli", - "sc-client", "sc-client-api", + "sc-consensus", "sc-consensus-aura", "sc-executor", "sc-finality-grandpa", @@ -458,12 +435,11 @@ dependencies = [ "sp-transaction-pool", "structopt", "substrate-build-script-utils", - "vergen", ] [[package]] name = "btc-parachain-runtime" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" dependencies = [ "bitcoin", "btc-relay", @@ -510,7 +486,7 @@ dependencies = [ [[package]] name = "btc-relay" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "bitcoin", "frame-support", @@ -531,9 +507,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742" +checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" [[package]] name = "byte-slice-cast" @@ -547,12 +523,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" -[[package]] -name = "byteorder" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" - [[package]] name = "byteorder" version = "1.3.4" @@ -565,7 +535,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" dependencies = [ - "byteorder 1.3.4", + "byteorder", "either", "iovec", ] @@ -622,15 +592,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ "num-integer", - "num-traits", + "num-traits 0.2.11", "time", ] [[package]] name = "clang-sys" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92986241798376849e1a007827041fed9bb36195822c2049d18e174420e0534" +checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" dependencies = [ "glob", "libc", @@ -672,12 +642,13 @@ dependencies = [ [[package]] name = "collateral" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "frame-support", "frame-system", "pallet-balances", "parity-scale-codec", + "serde", "sp-core", "sp-io", "sp-runtime", @@ -817,33 +788,13 @@ dependencies = [ "sct", ] -[[package]] -name = "ctr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" -dependencies = [ - "block-cipher-trait", - "stream-cipher", -] - -[[package]] -name = "cuckoofilter" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f" -dependencies = [ - "byteorder 0.5.3", - "rand 0.3.23", -] - [[package]] name = "curve25519-dalek" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26778518a7f6cffa1d25a44b602b62b979bd88adb9e99ffec546998cf3404839" dependencies = [ - "byteorder 1.3.4", + "byteorder", "digest", "rand_core 0.5.1", "subtle 2.2.2", @@ -858,13 +809,13 @@ checksum = "11c0346158a19b3627234e15596f5e465c360fcdb97d817bcb255e0510f5a788" [[package]] name = "derive_more" -version = "0.99.3" +version = "0.99.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a806e96c59a76a5ba6e18735b6cf833344671e61e7863f2edb5c518ea2cac95c" +checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -882,7 +833,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" dependencies = [ - "byteorder 1.3.4", + "byteorder", "quick-error", ] @@ -910,6 +861,17 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +[[package]] +name = "enum-primitive-derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd" +dependencies = [ + "num-traits 0.1.43", + "quote 0.3.15", + "syn 0.11.11", +] + [[package]] name = "env_logger" version = "0.7.1" @@ -931,43 +893,16 @@ checksum = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4" [[package]] name = "erased-serde" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7d80305c9bd8cd78e3c753eb9fb110f83621e5211f1a3afffcc812b104daf9" +checksum = "d88b6d1705e16a4d62e05ea61cc0496c2bd190f4fa8e5c1f11ce747be6bcf3d1" dependencies = [ "serde", ] -[[package]] -name = "ethbloom" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e7abcddbdd5db30aeed4deb586adc4824e6c247e2f7238d1187f752893f096b" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-rlp", - "impl-serde 0.3.0", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964c23cdee0ca07d5be2a628b46d5c11a2134ce554a8c16d8dbc2db647e4fd4d" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-rlp", - "impl-serde 0.3.0", - "primitive-types", - "uint", -] - [[package]] name = "exchange-rate-oracle" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "collateral", "frame-support", @@ -1012,8 +947,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", "synstructure", ] @@ -1034,14 +969,15 @@ dependencies = [ [[package]] name = "finality-grandpa" -version = "0.11.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "024517816630be5204eba201e8d1d405042b1255a5e0e3f298b054fc24d59e1d" +checksum = "1f4682570188cd105606e621b9992e580f717c15f8cd1b7d106b59f1c6e54680" dependencies = [ + "either", "futures 0.3.4", "futures-timer 2.0.2", "log", - "num-traits", + "num-traits 0.2.11", "parity-scale-codec", "parking_lot 0.9.0", ] @@ -1052,7 +988,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32529fc42e86ec06e5047092082aab9ad459b070c5d2a76b14f4f5ce70bf2e84" dependencies = [ - "byteorder 1.3.4", + "byteorder", "rand 0.7.3", "rustc-hex", "static_assertions", @@ -1085,23 +1021,24 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "fork-tree" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2b3ac9016db4aa757dcab0a52c6911e6c98820d29bc75092176b98e73582bb" +checksum = "00caa7b4d3f6b29b211cd82dfceb1fbe30281fdf6f05e95f1d519837f92443a6" dependencies = [ "parity-scale-codec", ] [[package]] name = "frame-benchmarking" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712481345c6430a3a9a9369871d74e10c8afd64e5191b8d233f43aca5d9df955" +checksum = "b22054d77cb9377dcb9660f9634e79b2e50fcd4129fae7921e98ca30dc5c12e7" dependencies = [ "frame-support", "frame-system", "linregress", "parity-scale-codec", + "paste", "sp-api", "sp-io", "sp-runtime", @@ -1111,23 +1048,25 @@ dependencies = [ [[package]] name = "frame-executive" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2295259d727866604e46c9a24e1e4ba4b5800eb16932a04c3b1f266e122f9445" +checksum = "76692e90be57adc50ca89c08ff92b6d501a1ec9e0800aedd67f3c9eb9cd26b37" dependencies = [ "frame-support", "frame-system", "parity-scale-codec", "serde", + "sp-io", "sp-runtime", "sp-std", + "sp-tracing", ] [[package]] name = "frame-metadata" -version = "11.0.0-alpha.5" +version = "11.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7083431304c527dea7559f6b262b186473f44d1c9819b7da74388d6487b2653f" +checksum = "d4ed1031c3ab5fd338d4922380ecaa1784d96c4670b5e329838c1be9821f1596" dependencies = [ "parity-scale-codec", "serde", @@ -1137,9 +1076,9 @@ dependencies = [ [[package]] name = "frame-support" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390a1a495b50001f75a2f4fe0602734ce61890d7acbd6aa7ddce0b60d9145a82" +checksum = "bdd5a22a0c3e66a82b4ca1965e21373d3e0d29266313130d04a5045906c81dc4" dependencies = [ "bitmask", "frame-metadata", @@ -1157,50 +1096,50 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", - "tracing", + "sp-tracing", ] [[package]] name = "frame-support-procedural" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e509284ec2b06c24d28ba18fda0c21f6ad69545a3da5e9fcb7ba1817686ffa" +checksum = "1a6b4279196725ff56647d12a285328a79685a7d05be6c507f55a11e00f492c0" dependencies = [ "frame-support-procedural-tools", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "frame-support-procedural-tools" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bf920148acb725b9ac1a6238b57a010ba660ecae7cd125f4b146c4a7d43192d" +checksum = "d9135714a5cd9e01b9839c16433d5f075706ef87f8f2fc412944ff826fc8ccd1" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d277cb5e284309c165ac1cfd7e1077b0d66d4aa0a1043dd32329191b510c40" +checksum = "ab73d20fca63196489400b98b71aa96a8709968d83dc26e7c99aa135ba1eaf4f" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "frame-system" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e525321245fb95648e49a22ab1e8a53abd86dcc71e0f9474a7945afe2d7f50" +checksum = "eb202b187ce580c0414d9c7608478377bd2fe90bb15a5777e8c6b746d4c9519a" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1351,8 +1290,8 @@ checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -1397,7 +1336,6 @@ dependencies = [ "proc-macro-hack", "proc-macro-nested", "slab", - "tokio-io", ] [[package]] @@ -1497,7 +1435,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" dependencies = [ - "byteorder 1.3.4", + "byteorder", "bytes 0.4.12", "fnv", "futures 0.1.29", @@ -1511,20 +1449,20 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5c295d1c0c68e4e42003d75f908f5e16a1edd1cbe0b0d02e4dc2006a384f47" +checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" dependencies = [ "bytes 0.5.4", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.0", + "http 0.2.1", "indexmap", "log", "slab", - "tokio 0.2.13", + "tokio 0.2.18", "tokio-util", ] @@ -1564,9 +1502,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" +checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" dependencies = [ "libc", ] @@ -1630,9 +1568,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ "bytes 0.5.4", "fnv", @@ -1658,7 +1596,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ "bytes 0.5.4", - "http 0.2.0", + "http 0.2.1", ] [[package]] @@ -1716,8 +1654,8 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.2.2", - "http 0.2.0", + "h2 0.2.4", + "http 0.2.1", "http-body 0.3.1", "httparse", "itoa", @@ -1725,7 +1663,7 @@ dependencies = [ "net2", "pin-project", "time", - "tokio 0.2.13", + "tokio 0.2.18", "tower-service", "want 0.3.0", ] @@ -1741,9 +1679,9 @@ dependencies = [ "futures-util", "hyper 0.13.4", "log", - "rustls 0.17.0", + "rustls", "rustls-native-certs", - "tokio 0.2.13", + "tokio 0.2.18", "tokio-rustls", "webpki", ] @@ -1779,15 +1717,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-rlp" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f7a72f11830b52333f36e3b09a288333888bf54380fd0ac0790a3c31ab0f3c5" -dependencies = [ - "rlp", -] - [[package]] name = "impl-serde" version = "0.2.3" @@ -1799,9 +1728,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bbe9ea9b182f0fb1cabbd61f4ff9b7b7b9197955e95a7e4c27de5055eb29ff8" +checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" dependencies = [ "serde", ] @@ -1813,8 +1742,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -1838,6 +1767,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "141340095b15ed7491bd3d4ced9d20cebfb826174b6bb03386381f62b01e3d77" +[[package]] +name = "intervalier" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" +dependencies = [ + "futures 0.3.4", + "futures-timer 2.0.2", +] + [[package]] name = "iovec" version = "0.1.4" @@ -1847,6 +1786,12 @@ dependencies = [ "libc", ] +[[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" @@ -1855,7 +1800,7 @@ checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" [[package]] name = "issue" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "bitcoin", "btc-relay", @@ -1906,18 +1851,18 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cb931d43e71f560c81badb0191596562bafad2be06a3f9025b845c847c60df5" +checksum = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" dependencies = [ "wasm-bindgen", ] [[package]] name = "jsonrpc-client-transports" -version = "14.0.5" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a9ae166c4d1f702d297cd76d4b55758ace80272ffc6dbb139fdc1bf810de40b" +checksum = "2307a7e78cf969759e390a8a2151ea12e783849a45bb00aa871b468ba58ea79e" dependencies = [ "failure", "futures 0.1.29", @@ -1931,9 +1876,9 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "14.0.5" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3b688648f1ef5d5072229e2d672ecb92cbff7d1c79bcf3fd5898f3f3df0970" +checksum = "25525f6002338fb4debb5167a89a0b47f727a5a48418417545ad3429758b7fec" dependencies = [ "futures 0.1.29", "log", @@ -1944,9 +1889,9 @@ dependencies = [ [[package]] name = "jsonrpc-core-client" -version = "14.0.5" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080dc110be17701097df238fad3c816d4a478a1899dfbcf8ec8957dd40ec7304" +checksum = "87f9382e831a6d630c658df103aac3f971da096deb57c136ea2b760d3b4e3f9f" dependencies = [ "jsonrpc-client-transports", ] @@ -1959,42 +1904,42 @@ checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "jsonrpc-http-server" -version = "14.0.6" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816d63997ea45d3634608edbef83ddb35e661f7c0b27b5b72f237e321f0e9807" +checksum = "d52860f0549694aa4abb12766856f56952ab46d3fb9f0815131b2db3d9cc2f29" dependencies = [ "hyper 0.12.35", "jsonrpc-core", "jsonrpc-server-utils", "log", "net2", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "unicase", ] [[package]] name = "jsonrpc-pubsub" -version = "14.0.6" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b31c9b90731276fdd24d896f31bb10aecf2e5151733364ae81123186643d939" +checksum = "c4ca5e391d6c6a2261d4adca029f427fe63ea546ad6cef2957c654c08495ec16" dependencies = [ "jsonrpc-core", "log", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "serde", ] [[package]] name = "jsonrpc-server-utils" -version = "14.0.5" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b7635e618a0edbbe0d2a2bbbc69874277c49383fcf6c3c0414491cfb517d22" +checksum = "1f06add502b48351e05dd95814835327fb115e4e9f834ca42fd522d3b769d4d2" dependencies = [ "bytes 0.4.12", "globset", @@ -2008,14 +1953,14 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" -version = "14.0.6" +version = "14.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94e5773b2ae66e0e02c80775ce6bbba6f15d5bb47c14ec36a36fcf94f8df851" +checksum = "017a7dd5083d9ed62c5e1dd3e317975c33c3115dac5447f4480fe05a8c354754" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", "log", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "slab", "ws", ] @@ -2052,7 +1997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cad096c6849b2ef027fabe35c4aed356d0e3d3f586d0a8361e5e17f1e50a7ce5" dependencies = [ "parity-util-mem", - "smallvec 1.2.0", + "smallvec 1.3.0", ] [[package]] @@ -2063,7 +2008,7 @@ checksum = "4aa954d12cfac958822dfd77aab34f3eec71f103b918c4ab79ab59a36ee594ea" dependencies = [ "kvdb", "parity-util-mem", - "parking_lot 0.10.0", + "parking_lot 0.10.2", ] [[package]] @@ -2079,10 +2024,10 @@ dependencies = [ "num_cpus", "owning_ref", "parity-util-mem", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "regex", "rocksdb", - "smallvec 1.2.0", + "smallvec 1.3.0", ] [[package]] @@ -2099,9 +2044,21 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "libc" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" +checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" + +[[package]] +name = "libflate" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" +dependencies = [ + "adler32", + "crc32fast", + "rle-decode-fast", + "take_mut", +] [[package]] name = "libloading" @@ -2121,61 +2078,55 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" [[package]] name = "libp2p" -version = "0.16.2" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bba17ee9cac4bb89de5812159877d9b4f0a993bf41697a5a875940cd1eb71f24" +checksum = "32ea742c86405b659c358223a8f0f9f5a9eb27bb6083894c6340959b05269662" dependencies = [ "bytes 0.5.4", "futures 0.3.4", "lazy_static", "libp2p-core", "libp2p-core-derive", - "libp2p-deflate", "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-mdns", "libp2p-mplex", "libp2p-noise", "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", - "libp2p-secio", "libp2p-swarm", "libp2p-tcp", - "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", - "parity-multiaddr", - "parity-multihash", - "parking_lot 0.10.0", + "multihash", + "parity-multiaddr 0.8.0", + "parking_lot 0.10.2", "pin-project", - "smallvec 1.2.0", + "smallvec 1.3.0", "wasm-timer", ] [[package]] name = "libp2p-core" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b874594c4b29de1a29f27871feba8e6cd13aa54a8a1e8f8c7cf3dfac5ca287c" +checksum = "a1d2c17158c4dca984a77a5927aac6f0862d7f50c013470a415f93be498b5739" dependencies = [ "asn1_der", "bs58", "ed25519-dalek", + "either", "fnv", "futures 0.3.4", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", "log", + "multihash", "multistream-select", - "parity-multiaddr", - "parity-multihash", - "parking_lot 0.10.0", + "parity-multiaddr 0.8.0", + "parking_lot 0.10.2", "pin-project", "prost", "prost-build", @@ -2183,7 +2134,7 @@ dependencies = [ "ring", "rw-stream-sink", "sha2", - "smallvec 1.2.0", + "smallvec 1.3.0", "thiserror", "unsigned-varint", "void", @@ -2192,83 +2143,30 @@ dependencies = [ [[package]] name = "libp2p-core-derive" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d472e9d522f588805c77801de10b957be84e10f019ca5f869fa1825b15ea9b" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "libp2p-deflate" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e25004d4d9837b44b22c5f1a69be1724a5168fef6cff1716b5176a972c3aa62" +checksum = "329127858e4728db5ab60c33d5ae352a999325fdf190ed022ec7d3a4685ae2e6" dependencies = [ - "flate2", - "futures 0.3.4", - "libp2p-core", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "libp2p-dns" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99e552f9939b606eb4b59f7f64d9b01e3f96752f47e350fc3c5fc646ed3f649" -dependencies = [ - "futures 0.3.4", - "libp2p-core", - "log", -] - -[[package]] -name = "libp2p-floodsub" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3234f12e44f9a50351a9807b97fe7de11eb9ae4482370392ba10da6dc90722" -dependencies = [ - "cuckoofilter", - "fnv", - "futures 0.3.4", - "libp2p-core", - "libp2p-swarm", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec 1.2.0", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d46cb3e0841bd951cbf4feae56cdc081e6347836a644fb260c3ec554149b4006" +checksum = "c0d0993481203d68e5ce2f787d033fb0cac6b850659ed6c784612db678977c71" dependencies = [ - "base64 0.11.0", - "byteorder 1.3.4", - "bytes 0.5.4", - "fnv", "futures 0.3.4", - "futures_codec", "libp2p-core", - "libp2p-swarm", "log", - "lru", - "prost", - "prost-build", - "rand 0.7.3", - "sha2", - "smallvec 1.2.0", - "unsigned-varint", - "wasm-timer", ] [[package]] name = "libp2p-identify" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfeb935a9bd41263e4f3a24b988e9f4a044f3ae89ac284e83c17fe2f84e0d66b" +checksum = "a38ca3eb807789e26f41c82ca7cd2b3843c66c5587b8b5f709a2f421f3061414" dependencies = [ "futures 0.3.4", "libp2p-core", @@ -2276,15 +2174,15 @@ dependencies = [ "log", "prost", "prost-build", - "smallvec 1.2.0", + "smallvec 1.3.0", "wasm-timer", ] [[package]] name = "libp2p-kad" -version = "0.16.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464dc8412978d40f0286be72ed9ab5e0e1386a4a06e7f174526739b5c3c1f041" +checksum = "a92cda1fb8149ea64d092a2b99d2bd7a2c309eee38ea322d02e4480bd6ee1759" dependencies = [ "arrayvec 0.5.1", "bytes 0.5.4", @@ -2295,12 +2193,12 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "parity-multihash", + "multihash", "prost", "prost-build", "rand 0.7.3", "sha2", - "smallvec 1.2.0", + "smallvec 1.3.0", "uint", "unsigned-varint", "void", @@ -2309,9 +2207,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881fcfb360c2822db9f0e6bb6f89529621556ed9a8b038313414eda5107334de" +checksum = "41e908d2aaf8ff0ec6ad1f02fe1844fd777fb0b03a68a226423630750ab99471" dependencies = [ "async-std", "data-encoding", @@ -2324,16 +2222,16 @@ dependencies = [ "log", "net2", "rand 0.7.3", - "smallvec 1.2.0", + "smallvec 1.3.0", "void", "wasm-timer", ] [[package]] name = "libp2p-mplex" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8507b37ad0eed275efcde67a023c3d85af6c80768b193845b9288e848e1af95" +checksum = "0832882b06619b2e81d74e71447753ea3c068164a0bca67847d272e856a04a02" dependencies = [ "bytes 0.5.4", "fnv", @@ -2341,15 +2239,15 @@ dependencies = [ "futures_codec", "libp2p-core", "log", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.16.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15a8a3d71f898beb6f854c8aae27aa1d198e0d1f2e49412261c2d90ef39675a" +checksum = "918e94a649e1139c24ee9f1f8c1f2adaba6d157b9471af787f2d9beac8c29c77" dependencies = [ "curve25519-dalek", "futures 0.3.4", @@ -2368,9 +2266,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d22f2f228b3a828dca1cb8aa9fa331e0bc9c36510cb2c1916956e20dc85e8c" +checksum = "f9bfbf87eebb492d040f9899c5c81c9738730465ac5e78d9b7a7d086d0f07230" dependencies = [ "futures 0.3.4", "libp2p-core", @@ -2381,87 +2279,26 @@ dependencies = [ "wasm-timer", ] -[[package]] -name = "libp2p-plaintext" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56126a204d7b3382bac163143ff4125a14570b3ba76ba979103d1ae1abed1923" -dependencies = [ - "bytes 0.5.4", - "futures 0.3.4", - "futures_codec", - "libp2p-core", - "log", - "prost", - "prost-build", - "rw-stream-sink", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b916938a8868f75180aeeffcc6a516a922d165e8fa2a90b57bad989d1ccbb57a" -dependencies = [ - "futures 0.3.4", - "log", - "pin-project", - "rand 0.7.3", - "salsa20", - "sha3", -] - -[[package]] -name = "libp2p-secio" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1219e9ecb4945d7331a05f5ffe96a1f6e28051bfa1223d4c60353c251de0354e" -dependencies = [ - "aes-ctr", - "ctr", - "futures 0.3.4", - "hmac", - "js-sys", - "lazy_static", - "libp2p-core", - "log", - "parity-send-wrapper", - "pin-project", - "prost", - "prost-build", - "quicksink", - "rand 0.7.3", - "ring", - "rw-stream-sink", - "sha2", - "static_assertions", - "twofish", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "libp2p-swarm" -version = "0.16.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "275471e7c0e88ae004660866cd54f603bd8bd1f4caef541a27f50dd8640c4d4c" +checksum = "44ab289ae44cc691da0a6fe96aefa43f26c86c6c7813998e203f6d80f1860f18" dependencies = [ "futures 0.3.4", "libp2p-core", "log", - "smallvec 1.2.0", + "rand 0.7.3", + "smallvec 1.3.0", "void", "wasm-timer", ] [[package]] name = "libp2p-tcp" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e80ad4e3535345f3d666554ce347d3100453775611c05c60786bf9a1747a10" +checksum = "b37ea44823d3ed223e4605da94b50177bc520f05ae2452286700549a32d81669" dependencies = [ "async-std", "futures 0.3.4", @@ -2472,23 +2309,11 @@ dependencies = [ "log", ] -[[package]] -name = "libp2p-uds" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d329564a43da9d0e055a5b938633c4a8ceab1f59cec133fbc4647917c07341" -dependencies = [ - "async-std", - "futures 0.3.4", - "libp2p-core", - "log", -] - [[package]] name = "libp2p-wasm-ext" -version = "0.16.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923581c055bc4b8c5f42d4ce5ef43e52fe5216f1ea4bc26476cb8a966ce6220b" +checksum = "e3ac7dbde0f88cad191dcdfd073b8bae28d01823e8ca313f117b6ecb914160c3" dependencies = [ "futures 0.3.4", "js-sys", @@ -2500,9 +2325,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5351ca9eea122081c1c0f9323164d2918cac29b5a6bfe5054d4ba8ec9447cf42" +checksum = "6874c9069ce93d899df9dc7b29f129c706b2a0fdc048f11d878935352b580190" dependencies = [ "async-tls", "bytes 0.5.4", @@ -2511,7 +2336,7 @@ dependencies = [ "libp2p-core", "log", "quicksink", - "rustls 0.16.0", + "rustls", "rw-stream-sink", "soketto", "url 2.1.1", @@ -2521,22 +2346,22 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.16.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dac30de24ccde0e67f363d71a125c587bbe6589503f664947e9b084b68a34f1" +checksum = "02f91aea50f6571e0bc6c058dc0e9b270afd41ec28dd94e9e4bf607e78b9ab87" dependencies = [ "futures 0.3.4", "libp2p-core", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "thiserror", "yamux", ] [[package]] name = "librocksdb-sys" -version = "6.6.4" +version = "6.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3b727e2dd20ec2fb7ed93f23d9fd5328a0871185485ebdaff007b47d3e27e4" +checksum = "883213ae3d09bfc3d104aefe94b25ebb183b6f4d3a515b23b14817e1f4854005" dependencies = [ "bindgen", "cc", @@ -2600,9 +2425,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ "scopeguard", ] @@ -2652,6 +2477,16 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +[[package]] +name = "memmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +dependencies = [ + "libc", + "winapi 0.3.8", +] + [[package]] name = "memoffset" version = "0.5.4" @@ -2663,9 +2498,9 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58381b20ebe2c578e75dececd9da411414903415349548ccc46aac3209cdfbc" +checksum = "be512cb2ccb4ecbdca937fdd4a62ea5f09f8e7195466a85e4632b3d5bcce82e6" dependencies = [ "ahash", "hash-db", @@ -2685,7 +2520,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78" dependencies = [ - "byteorder 1.3.4", + "byteorder", "keccak", "rand_core 0.5.1", "zeroize", @@ -2770,27 +2605,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "757ebe7dc317c368dba9dcc319266416e48272292ed86814478f66308119c2e9" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", +] + +[[package]] +name = "multihash" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47fbc227f7e2b1cb701f95404579ecb2668abbdd3c7ef7a6cbb3cc0d3b236869" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "digest", + "sha-1", + "sha2", + "sha3", + "unsigned-varint", ] [[package]] name = "multimap" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97fbd5d00e0e37bfb10f433af8f5aaf631e739368dc9fc28286ca81ca4948dc" +checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" [[package]] name = "multistream-select" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f938ffe420493e77c8b6cbcc3f282283f68fc889c5dcbc8e51668d5f3a01ad94" +checksum = "74cdcf7cfb3402881e15a1f95116cb033d69b33c83d481e1234777f5ef0c3d2c" dependencies = [ "bytes 0.5.4", - "futures 0.1.29", + "futures 0.3.4", "log", - "smallvec 1.2.0", - "tokio-io", + "pin-project", + "smallvec 1.3.0", "unsigned-varint", ] @@ -2806,7 +2656,7 @@ dependencies = [ "matrixmultiply", "num-complex", "num-rational", - "num-traits", + "num-traits 0.2.11", "rand 0.6.5", "typenum", ] @@ -2831,6 +2681,33 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "netstat2" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29449d242064c48d3057a194b049a2bdcccadda16faa18a91468677b44e8d422" +dependencies = [ + "bitflags", + "byteorder", + "enum-primitive-derive", + "libc", + "num-traits 0.2.11", + "thiserror", +] + +[[package]] +name = "nix" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" +dependencies = [ + "bitflags", + "cc", + "cfg-if", + "libc", + "void", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -2870,7 +2747,7 @@ checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ "autocfg 1.0.0", "num-integer", - "num-traits", + "num-traits 0.2.11", ] [[package]] @@ -2880,7 +2757,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ "autocfg 1.0.0", - "num-traits", + "num-traits 0.2.11", ] [[package]] @@ -2890,7 +2767,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" dependencies = [ "autocfg 1.0.0", - "num-traits", + "num-traits 0.2.11", ] [[package]] @@ -2902,7 +2779,16 @@ dependencies = [ "autocfg 1.0.0", "num-bigint", "num-integer", - "num-traits", + "num-traits 0.2.11", +] + +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +dependencies = [ + "num-traits 0.2.11", ] [[package]] @@ -2967,9 +2853,9 @@ dependencies = [ [[package]] name = "pallet-aura" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c49caa853a7f6126d9874041bb650747dda0975007f240cffbd8dbb710e385d6" +checksum = "84bfe377cb99f04a51ef30521bd3236acdf57ae76187d6ae8f0b1896fae1ba1d" dependencies = [ "frame-support", "frame-system", @@ -2989,9 +2875,9 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4190f97ea53bebe7a5ae2c089a43e72561d9166968d28d0911eed2cea878d5dd" +checksum = "5933eed290294f48ae9c6ca9b83c48f73c0e50eb2d86532a388d2076806f9d37" dependencies = [ "frame-benchmarking", "frame-support", @@ -3005,9 +2891,9 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "954b11ebb7de3f1ec5e23b37af4a2d1b7f04bc81b13cde2eb76abb4171300cfc" +checksum = "99b6aaf467788f82d9f18c940f57b6773e6114988120c63630ec1a30ef6af73d" dependencies = [ "frame-support", "frame-system", @@ -3022,9 +2908,9 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ede4c610644a485d9f78dfb4853a2b20efb752fe5ab0e75c78e239313304cb" +checksum = "0be9854b7b21a8ab2d14bc323d08b18b6d57d1bbdba1657f37169a02ac198162" dependencies = [ "frame-support", "frame-system", @@ -3041,9 +2927,9 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0901faf91fdec1afa1810bf6f07678482be066ba79fc9d80095360e2c53e2f03" +checksum = "e6f06234e000e7b7554d75d62280e953f902981196d6dcde0d084ad5c7df4809" dependencies = [ "frame-support", "frame-system", @@ -3055,9 +2941,9 @@ dependencies = [ [[package]] name = "pallet-session" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c96ae32f6b03f10067ecd85eb1b686dff0217ac238bd93d2a0dd4460646b6c7" +checksum = "6aace05f197abe3905182ec817e6fadc3c985b3c2ec41bfc74bb9918d1585e9e" dependencies = [ "frame-support", "frame-system", @@ -3074,9 +2960,9 @@ dependencies = [ [[package]] name = "pallet-sudo" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e0132502de44cfcf36977d38b94ddf3fe2ec90b3b5de63ed7c859cd683badd" +checksum = "246c9c0b5c29baff01d925ebadee6c0c642fa4c56ba8de1957f1ecc1438cc7dc" dependencies = [ "frame-support", "frame-system", @@ -3089,9 +2975,9 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec68fe57dc24af2869f5447f406de1de4dc105b11fbab59ae94f580cd2787aa" +checksum = "4c90b652dfb8796d657a2df5fa6200ada33b9784554b81a32efd73de2fe00575" dependencies = [ "frame-benchmarking", "frame-support", @@ -3107,9 +2993,9 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0384d314959975a758174982c17d88c021b227d6caf16c41e6810fd3dc39820f" +checksum = "52333b8598b2bcb3af5e158c61cb2d30821220a5034e92a74c6a4ef116d82a7f" dependencies = [ "frame-support", "frame-system", @@ -3121,9 +3007,9 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac65e7676834aa6778e4a4dc476ee6838219f466d32eaa5e290ee39bb96c78c" +checksum = "40f6cc2ebdaff949b9f38cc03f19e541bd22773ce32e84532ac1d85a481cb112" dependencies = [ "frame-support", "parity-scale-codec", @@ -3133,6 +3019,20 @@ dependencies = [ "sp-std", ] +[[package]] +name = "parity-db" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d595e372d119261593297debbe4193811a4dc811d2a1ccbb8caaa6666ad7ab" +dependencies = [ + "blake2-rfc", + "crc32fast", + "libc", + "log", + "memmap", + "parking_lot 0.10.2", +] + [[package]] name = "parity-multiaddr" version = "0.7.3" @@ -3141,7 +3041,7 @@ checksum = "f77055f9e81921a8cc7bebeb6cded3d128931d51f1e3dd6251f0770a6d431477" dependencies = [ "arrayref", "bs58", - "byteorder 1.3.4", + "byteorder", "data-encoding", "parity-multihash", "percent-encoding 2.1.0", @@ -3151,6 +3051,24 @@ dependencies = [ "url 2.1.1", ] +[[package]] +name = "parity-multiaddr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db35e222f783ef4e6661873f6c165c4eb7b65e0c408349818517d5705c2d7d3" +dependencies = [ + "arrayref", + "bs58", + "byteorder", + "data-encoding", + "multihash", + "percent-encoding 2.1.0", + "serde", + "static_assertions", + "unsigned-varint", + "url 2.1.1", +] + [[package]] name = "parity-multihash" version = "0.2.3" @@ -3187,8 +3105,8 @@ checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -3199,19 +3117,16 @@ checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parity-util-mem" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e42755f26e5ea21a6a819d9e63cbd70713e9867a2b767ec2cc65ca7659532c5" +checksum = "2c6e2583649a3ca84894d1d71da249abcfda54d5aca24733d72ca10d0f02361c" dependencies = [ "cfg-if", - "ethereum-types", - "hashbrown", "impl-trait-for-tuples", - "lru", "parity-util-mem-derive", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "primitive-types", - "smallvec 1.2.0", + "smallvec 1.3.0", "winapi 0.3.8", ] @@ -3222,7 +3137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" dependencies = [ "proc-macro2", - "syn", + "syn 1.0.17", "synstructure", ] @@ -3245,12 +3160,12 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ "lock_api", - "parking_lot_core 0.7.0", + "parking_lot_core 0.7.1", ] [[package]] @@ -3270,23 +3185,23 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" +checksum = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb" dependencies = [ "cfg-if", "cloudabi", "libc", "redox_syscall", - "smallvec 1.2.0", + "smallvec 1.3.0", "winapi 0.3.8", ] [[package]] name = "paste" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8292c1e1e81ddb552c4c90c36af201a0ce7e34995f55f0480f01052f242811c9" +checksum = "ab4fb1930692d1b6a9cfabdde3d06ea0a7d186518e2f4d67660d8970e2fa647a" dependencies = [ "paste-impl", "proc-macro-hack", @@ -3294,14 +3209,14 @@ dependencies = [ [[package]] name = "paste-impl" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e9c43f2645f06ee452544ad032886a75f3d1797b9487dcadcae9100ba58a51c" +checksum = "a62486e111e571b1e93b710b61e8f493c0013be39629b714cb166bdb06aa5a8a" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -3310,7 +3225,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ - "byteorder 1.3.4", + "byteorder", "crypto-mac", ] @@ -3344,22 +3259,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c" +checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" +checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -3380,6 +3295,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +[[package]] +name = "platforms" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e" + [[package]] name = "ppv-lite86" version = "0.2.6" @@ -3388,14 +3309,13 @@ checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" [[package]] name = "primitive-types" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e4b9943a2da369aec5e96f7c10ebc74fcf434d39590d974b0a3460e6f67fbb" +checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" dependencies = [ "fixed-hash", "impl-codec", - "impl-rlp", - "impl-serde 0.3.0", + "impl-serde 0.3.1", "uint", ] @@ -3410,35 +3330,35 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "0.4.12" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678" dependencies = [ "proc-macro-error-attr", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", "version_check", ] [[package]] name = "proc-macro-error-attr" -version = "0.4.12" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", "syn-mid", "version_check", ] [[package]] name = "proc-macro-hack" -version = "0.5.14" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcfdefadc3d57ca21cf17990a28ef4c0f7c61383a28cb7604cf4a18e6ede1420" +checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" [[package]] name = "proc-macro-nested" @@ -3448,25 +3368,40 @@ checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" +checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.0", +] + +[[package]] +name = "procfs" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe50036aa1b71e553a4a0c48ab7baabf8aa8c7a5a61aae06bf38c2eab7430475" +dependencies = [ + "bitflags", + "byteorder", + "chrono", + "hex", + "lazy_static", + "libc", + "libflate", ] [[package]] name = "prometheus" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5567486d5778e2c6455b1b90ff1c558f29e751fc018130fa182e15828e728af1" +checksum = "b0575e258dab62268e7236d7307caa38848acbda7ec7ab87bd9093791e999d20" dependencies = [ "cfg-if", "fnv", "lazy_static", "protobuf", - "quick-error", "spin", + "thiserror", ] [[package]] @@ -3506,8 +3441,8 @@ dependencies = [ "anyhow", "itertools", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -3522,9 +3457,9 @@ dependencies = [ [[package]] name = "protobuf" -version = "2.11.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1b4a8efc42cf150049e8a490f618c7c60e82332405065f202a7e33aa5a1f06" +checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485" [[package]] name = "quick-error" @@ -3534,15 +3469,21 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quicksink" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8461ef7445f61fd72d8dcd0629ce724b9131b3c2eb36e83a5d3d4161c127530" +checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" dependencies = [ "futures-core", "futures-sink", "pin-project-lite", ] +[[package]] +name = "quote" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" + [[package]] name = "quote" version = "1.0.3" @@ -3608,7 +3549,7 @@ dependencies = [ "rand_isaac", "rand_jitter", "rand_os", - "rand_pcg", + "rand_pcg 0.1.2", "rand_xorshift", "winapi 0.3.8", ] @@ -3624,6 +3565,7 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", + "rand_pcg 0.2.1", ] [[package]] @@ -3732,6 +3674,15 @@ dependencies = [ "rand_core 0.4.2", ] +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "rand_xorshift" version = "0.1.1" @@ -3782,7 +3733,7 @@ dependencies = [ [[package]] name = "redeem" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "bitcoin", "btc-relay", @@ -3813,11 +3764,31 @@ version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +[[package]] +name = "ref-cast" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a214c7875e1b63fc1618db7c80efc0954f6156c9ff07699fd9039e255accdd1" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "602eb59cda66fcb9aec25841fb76bc01d2b34282dcdd705028da297db6f3eec8" +dependencies = [ + "proc-macro2", + "quote 1.0.3", + "syn 1.0.17", +] + [[package]] name = "regex" -version = "1.3.5" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048" +checksum = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" dependencies = [ "aho-corasick", "memchr", @@ -3842,7 +3813,7 @@ dependencies = [ [[package]] name = "replace" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "bitcoin", "btc-relay", @@ -3869,9 +3840,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.11" +version = "0.16.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "741ba1704ae21999c00942f9f5944f801e977f54302af346b596287599ad1862" +checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" dependencies = [ "cc", "lazy_static", @@ -3883,13 +3854,10 @@ dependencies = [ ] [[package]] -name = "rlp" -version = "0.4.5" +name = "rle-decode-fast" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a7d3f9bed94764eac15b8f14af59fac420c236adaff743b7bcc88e265cb4345" -dependencies = [ - "rustc-hex", -] +checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" [[package]] name = "rocksdb" @@ -3938,26 +3906,13 @@ dependencies = [ "semver", ] -[[package]] -name = "rustls" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" -dependencies = [ - "base64 0.10.1", - "log", - "ring", - "sct", - "webpki", -] - [[package]] name = "rustls" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" dependencies = [ - "base64 0.11.0", + "base64", "log", "ring", "sct", @@ -3971,7 +3926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" dependencies = [ "openssl-probe", - "rustls 0.17.0", + "rustls", "schannel", "security-framework", ] @@ -4002,31 +3957,11 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "salsa20" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2324b0e8c3bb9a586a571fdb3136f70e7e2c748de00a78043f86e0cff91f91fe" -dependencies = [ - "byteorder 1.3.4", - "salsa20-core", - "stream-cipher", -] - -[[package]] -name = "salsa20-core" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe6cc1b9f5a5867853ade63099de70f042f7679e408d1ffe52821c9248e6e69" -dependencies = [ - "stream-cipher", -] - [[package]] name = "sc-basic-authorship" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19a4c2974771a4eeee60134001922a4aae9a8aa16058af440f7567d8b118c10" +checksum = "606bb1a659f6d10c9d6d1b1520d81b07df6cca26008c865ca4a1eb957841ebfb" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -4047,9 +3982,9 @@ dependencies = [ [[package]] name = "sc-block-builder" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "288d056ccb51111940a020cc4dda2b3ecd539ac680a20a7614b45b52615e1b62" +checksum = "ad86d3862ea0507e4ab26581b64ac902508f5e91f2bdae618327db12d70840c9" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -4064,9 +3999,9 @@ dependencies = [ [[package]] name = "sc-chain-spec" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2477e2a6eea2fbea0e7e6972e0e6cf3dc2e1f5f5c28cbeeed0928e1b1cc83f6d" +checksum = "95ab12f5eabca6fd4e16c202f045dc8e7542b9049294b92747cfcabf037586a4" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -4074,27 +4009,28 @@ dependencies = [ "sc-telemetry", "serde", "serde_json", + "sp-chain-spec", "sp-core", "sp-runtime", ] [[package]] name = "sc-chain-spec-derive" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d9064a901dc1d4c6603e36f0e203b199dbe010b193ef59bf57f0de82d8009a" +checksum = "a11bc26f24e234d61e708f92339efe51ad3d299e0e11d368ee9b3bf94787076f" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sc-cli" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11afd1bf2f02ce51e3d0004035ca860f6b87b9880c9783f1be32d41ef9e0080f" +checksum = "e0cd2a720cc286c964f011f94cd54eb32c9d612883e88b4df2a07902bd6d7822" dependencies = [ "ansi_term 0.12.1", "app_dirs", @@ -4108,6 +4044,7 @@ dependencies = [ "lazy_static", "log", "names", + "nix", "parity-util-mem", "regex", "rpassword", @@ -4124,52 +4061,19 @@ dependencies = [ "sp-panic-handler", "sp-runtime", "sp-state-machine", + "sp-utils", + "sp-version", "structopt", "substrate-prometheus-endpoint", "time", - "tokio 0.2.13", -] - -[[package]] -name = "sc-client" -version = "0.8.0-alpha.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bc77d90c2647134251ed73494515106da17aeee66dd9f5ae067bfa061bb19c9" -dependencies = [ - "derive_more", - "fnv", - "futures 0.3.4", - "hash-db", - "hex-literal", - "kvdb", - "log", - "parity-scale-codec", - "parking_lot 0.10.0", - "sc-block-builder", - "sc-client-api", - "sc-executor", - "sc-telemetry", - "sp-api", - "sp-blockchain", - "sp-consensus", - "sp-core", - "sp-externalities", - "sp-inherents", - "sp-keyring", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "sp-version", - "substrate-prometheus-endpoint", - "tracing", + "tokio 0.2.18", ] [[package]] name = "sc-client-api" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f17aa33afbc6b4f8c64a17922dff034c7d430919fc0835319f6663c8f4deddc" +checksum = "4242f40585bfd1375bbde27f169e2ecaaa40ef1b60b44294c454bc97d5048cdd" dependencies = [ "derive_more", "fnv", @@ -4177,15 +4081,17 @@ dependencies = [ "hash-db", "hex-literal", "kvdb", + "lazy_static", "log", "parity-scale-codec", - "parking_lot 0.10.0", + "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", @@ -4195,52 +4101,66 @@ dependencies = [ "sp-storage", "sp-transaction-pool", "sp-trie", + "sp-utils", "sp-version", + "substrate-prometheus-endpoint", ] [[package]] name = "sc-client-db" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2593615d3b8e2dd9942d333bc7f70c5736d539212c86969eae2edf4dbade0a" +checksum = "b3395df025dfa8edf1be099a2ac941082b953707ea536cffeda5d3e51b23e896" dependencies = [ + "blake2-rfc", "hash-db", "kvdb", "kvdb-memorydb", "kvdb-rocksdb", "linked-hash-map", "log", + "parity-db", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.10.0", - "rand 0.7.3", - "sc-client", + "parking_lot 0.10.2", "sc-client-api", "sc-executor", "sc-state-db", "sp-blockchain", "sp-consensus", "sp-core", + "sp-database", "sp-runtime", "sp-state-machine", "sp-trie", "substrate-prometheus-endpoint", ] +[[package]] +name = "sc-consensus" +version = "0.8.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f7378c44bc005807c427fe3f342fb3a851ff2fe82289e73a10e794ab1a33eee" +dependencies = [ + "sc-client-api", + "sp-blockchain", + "sp-consensus", + "sp-runtime", +] + [[package]] name = "sc-consensus-aura" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1202aef261a68f30db9f57dfb013ec07fc79ba3df8cf9675ed17ee645445a004" +checksum = "78617a2a24923df03b803b928e763c687a4ac9a44bf44a96ed7e47290efae83f" dependencies = [ "derive_more", "futures 0.3.4", "futures-timer 3.0.2", "log", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sc-block-builder", - "sc-client", "sc-client-api", "sc-consensus-slots", "sc-keystore", @@ -4261,15 +4181,15 @@ dependencies = [ [[package]] name = "sc-consensus-slots" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e84cf67d0330f4ba843577475dddff55f2db0199d55c94a972640e44afcdce" +checksum = "d21cdecefdce1abe0fab714c2850f067093a2eed46422d748879a09e66aa2ecf" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", "log", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sc-client-api", "sc-telemetry", "sp-api", @@ -4283,9 +4203,9 @@ dependencies = [ [[package]] name = "sc-executor" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ab992ed677c0d18c30a5a13f7a03af29a59cc74501c60e2e45eb35dc9467e5" +checksum = "2cba18b495c2959a9bfed031f4df4175dfebbbc827ff3524d6eeae05de1f4530" dependencies = [ "derive_more", "lazy_static", @@ -4293,9 +4213,10 @@ dependencies = [ "log", "parity-scale-codec", "parity-wasm", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sc-executor-common", "sc-executor-wasmi", + "sp-api", "sp-core", "sp-externalities", "sp-io", @@ -4310,13 +4231,14 @@ dependencies = [ [[package]] name = "sc-executor-common" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859a874cc47a01fb44bd53b172773629abb2c0d155b4e6505c1ec438103ffe5b" +checksum = "7b92cabca9418211b63c407c939523672fae62051f0dd8088c3068ab3e883dae" dependencies = [ "derive_more", "log", "parity-scale-codec", + "parity-wasm", "sp-allocator", "sp-core", "sp-runtime-interface", @@ -4327,13 +4249,12 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af5cb944a100efd2c117846b1f42da4e303c2a9e48d5231922315861775c558" +checksum = "8a8f35b44090ffdb0bbc4350dcf686ee649099ac7dc3ca0608d513018d4c84ae" dependencies = [ "log", "parity-scale-codec", - "parity-wasm", "sc-executor-common", "sp-allocator", "sp-core", @@ -4344,23 +4265,24 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aad8a1f0d03e8a7c3b1d8cd74050960365e347f739c131715f84f588dd051a4" +checksum = "32a0e197ef12caf06b0d01d922dbe24d018e99a62d723da1df4a303efe9d86be" dependencies = [ "assert_matches", + "derive_more", "finality-grandpa", "fork-tree", "futures 0.3.4", "futures-timer 3.0.2", "log", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "pin-project", "rand 0.7.3", "sc-block-builder", - "sc-client", "sc-client-api", + "sc-consensus", "sc-keystore", "sc-network", "sc-network-gossip", @@ -4375,14 +4297,15 @@ dependencies = [ "sp-finality-tracker", "sp-inherents", "sp-runtime", + "sp-utils", "substrate-prometheus-endpoint", ] [[package]] name = "sc-informant" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b52d147f0dcb8de59e842418056cf3c166828567357cf2dd99040d52bf8a406" +checksum = "7560120ce244b775d755e8550f894b6b57bed6bbb20cb12164e2ceb25e1fc9c6" dependencies = [ "ansi_term 0.12.1", "futures 0.3.4", @@ -4398,13 +4321,13 @@ dependencies = [ [[package]] name = "sc-keystore" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c17c8aa8cb9fa4aa710379dc4e119b848cd65fa0a4e2209b6c0f97ee7c2c8a" +checksum = "e1e44f10a561c72a7fa604cb1a356564ef496609b8306a330b4185840231fe9d" dependencies = [ "derive_more", "hex", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "rand 0.7.3", "serde_json", "sp-application-crypto", @@ -4414,9 +4337,9 @@ dependencies = [ [[package]] name = "sc-network" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df01faa65b22aca751910a417f5a6ea28cefd9d3349c17fbc2ad8b7f190d390" +checksum = "4ef69b5eb4ed887f9b4a02227f922412d814085023f38bc395ad194713f73749" dependencies = [ "bitflags", "bytes 0.5.4", @@ -4428,6 +4351,8 @@ dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", "futures_codec", + "hex", + "ip_network", "libp2p", "linked-hash-map", "linked_hash_set", @@ -4435,14 +4360,12 @@ dependencies = [ "lru", "nohash-hasher", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "pin-project", "prost", "prost-build", "rand 0.7.3", - "rustc-hex", "sc-block-builder", - "sc-client", "sc-client-api", "sc-peerset", "serde", @@ -4453,9 +4376,9 @@ dependencies = [ "sp-arithmetic", "sp-blockchain", "sp-consensus", - "sp-consensus-babe", "sp-core", "sp-runtime", + "sp-utils", "substrate-prometheus-endpoint", "thiserror", "unsigned-varint", @@ -4466,9 +4389,9 @@ dependencies = [ [[package]] name = "sc-network-gossip" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eb8906bfd2d54f84fad8aba2f4303cff30f5596e7d4b90f97008d5477ea9ce4" +checksum = "4002e0430151434a6039e3187b84267cf89e04214de6f677d9ddd89e6a31dafd" dependencies = [ "futures 0.3.4", "futures-timer 3.0.2", @@ -4477,14 +4400,15 @@ dependencies = [ "lru", "sc-network", "sp-runtime", + "sp-utils", "wasm-timer", ] [[package]] name = "sc-offchain" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d375d60dc8b4b1ffc76508b4fae912dd4aad2105bc20a8377d67e132cd96b2" +checksum = "31712efd8cb5ff149885bc19c752555c696e95d27c8a075d1cc58ebb5d6cc957" dependencies = [ "bytes 0.5.4", "fnv", @@ -4495,7 +4419,7 @@ dependencies = [ "log", "num_cpus", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "rand 0.7.3", "sc-client-api", "sc-keystore", @@ -4504,27 +4428,29 @@ dependencies = [ "sp-core", "sp-offchain", "sp-runtime", + "sp-utils", "threadpool", ] [[package]] name = "sc-peerset" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61bec2c8ace0c65c0cbd306b57a81eff12c92686b2988066d0ac49570944095" +checksum = "6c6d53c1c8de2f896ac3dec705285a216ea50b9b387a631362ae2635f6b6fe74" dependencies = [ "futures 0.3.4", "libp2p", "log", "serde_json", + "sp-utils", "wasm-timer", ] [[package]] name = "sc-rpc" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "754b46516c3bce1ac3bf82001e71e1bf371881ab25bf90c8adefd39311089a34" +checksum = "f02f88a10ad3271bc0da9e70d30fcfa182f33226b5e5e9af1b0e0dbeaab032bb" dependencies = [ "futures 0.3.4", "hash-db", @@ -4532,9 +4458,8 @@ dependencies = [ "jsonrpc-pubsub", "log", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sc-block-builder", - "sc-client", "sc-client-api", "sc-executor", "sc-keystore", @@ -4542,6 +4467,7 @@ dependencies = [ "serde_json", "sp-api", "sp-blockchain", + "sp-chain-spec", "sp-core", "sp-offchain", "sp-rpc", @@ -4549,14 +4475,15 @@ dependencies = [ "sp-session", "sp-state-machine", "sp-transaction-pool", + "sp-utils", "sp-version", ] [[package]] name = "sc-rpc-api" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f413b451cfd4440787262b6ae642d1f3003dc368ebd02d9cfe55cd66dc2cb0d" +checksum = "a27aa7d70aec2be0967110b5df9a11ac3aa76fe4c8576455c266d3135d8fe63a" dependencies = [ "derive_more", "futures 0.3.4", @@ -4566,9 +4493,10 @@ dependencies = [ "jsonrpc-pubsub", "log", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "serde", "serde_json", + "sp-chain-spec", "sp-core", "sp-rpc", "sp-runtime", @@ -4578,9 +4506,9 @@ dependencies = [ [[package]] name = "sc-rpc-server" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab710c3b4687a868d86d238b17d33457d83a8d8a2e168c9e8d141724b3b7d45" +checksum = "40b5547f9bb330a6d4273f471b44f8f2b12791abb9cb8557135f372075c42372" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -4594,24 +4522,28 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e93f1aa0656625fe1477d67cf2806a2880fd763e17495d680224e4600b33065" +checksum = "361410fc964e1cc77435f4c3bd1c724b39ad518bdf145c40f7c80701782e6e78" dependencies = [ "derive_more", "exit-future", "futures 0.1.29", "futures 0.3.4", - "futures-diagnose", "futures-timer 3.0.2", + "hash-db", "lazy_static", "log", - "parity-multiaddr", + "netstat2", + "parity-multiaddr 0.7.3", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.10.0", + "parking_lot 0.10.2", + "pin-project", + "procfs", + "rand 0.7.3", + "sc-block-builder", "sc-chain-spec", - "sc-client", "sc-client-api", "sc-client-db", "sc-executor", @@ -4628,47 +4560,52 @@ dependencies = [ "slog", "sp-api", "sp-application-crypto", + "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-core", + "sp-externalities", "sp-io", "sp-runtime", "sp-session", + "sp-state-machine", "sp-transaction-pool", + "sp-trie", + "sp-utils", + "sp-version", "substrate-prometheus-endpoint", "sysinfo", - "target_info", "tracing", "wasm-timer", ] [[package]] name = "sc-state-db" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1db2344b4ebe75dfbaa2f658ee66db81648db3304dc9613c7cb28391861e283" +checksum = "2f18e23f3d774df943bbd8a9fbe90140263de6dcae46aabb702a354198a7e3b4" dependencies = [ "log", "parity-scale-codec", "parity-util-mem", "parity-util-mem-derive", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sc-client-api", "sp-core", ] [[package]] name = "sc-telemetry" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f358814b6fe2f2c726f708870d98d07f10d6ebb7d06dcf7f8f2781a868d24eb2" +checksum = "0c9db676096e46d39083d9cccb62437234b515a085d77488a23b24443b6182ad" dependencies = [ "bytes 0.5.4", "futures 0.3.4", "futures-timer 3.0.2", "libp2p", "log", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "pin-project", "rand 0.7.3", "serde", @@ -4682,13 +4619,13 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9621e030cf432e067cfce76369f80e766c2bb60cd13c7213e3c4aea1c11b92" +checksum = "6d3da8fdeb53322e32e8576c62170cbeea78a0417238b6bd510f7584a6e411fb" dependencies = [ "erased-serde", "log", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sc-telemetry", "serde", "serde_json", @@ -4698,45 +4635,49 @@ dependencies = [ [[package]] name = "sc-transaction-graph" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ba2ba64a7fcdb70b747a3c6590f97c5f721100167629ae5d1617b5dff9072af" +checksum = "48864c813861c919d5c167c11dce9875d74019d633384d66a3ae97ed7db17857" dependencies = [ "derive_more", "futures 0.3.4", "linked-hash-map", "log", "parity-util-mem", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "serde", "sp-blockchain", "sp-core", "sp-runtime", "sp-transaction-pool", + "sp-utils", "wasm-timer", ] [[package]] name = "sc-transaction-pool" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f131fa840ee75820fef3e3658c81d6d13b1bfe086ef21aac53b9661ae6e11ce" +checksum = "3f59734238f19b1d8c3dd1fa0afa9569ee438ae0296a83417c5c9bdd0c6f2d24" dependencies = [ "derive_more", "futures 0.3.4", "futures-diagnose", - "futures-timer 2.0.2", + "intervalier", "log", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sc-client-api", "sc-transaction-graph", "sp-api", "sp-blockchain", "sp-core", "sp-runtime", + "sp-tracing", "sp-transaction-pool", + "sp-utils", + "substrate-prometheus-endpoint", "wasm-timer", ] @@ -4786,7 +4727,7 @@ dependencies = [ [[package]] name = "security" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "frame-support", "frame-system", @@ -4804,21 +4745,22 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97bbedbe81904398b6ebb054b3e912f99d55807125790f3198ac990d98def5b0" +checksum = "572dfa3a0785509e7a44b5b4bebcf94d41ba34e9ed9eb9df722545c3b3c4144a" dependencies = [ "bitflags", "core-foundation", "core-foundation-sys", + "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06fd2f23e31ef68dd2328cc383bd493142e46107a3a0e24f7d734e3f3b80fe4c" +checksum = "8ddb15a5fec93b7021b8a9e96009c5d8d51c15673569f7c0f6b7204e5b7b404f" dependencies = [ "core-foundation-sys", "libc", @@ -4847,29 +4789,29 @@ checksum = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4" [[package]] name = "serde" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff" +checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8" +checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "serde_json" -version = "1.0.48" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" +checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" dependencies = [ "itoa", "ryu", @@ -4991,8 +4933,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5006,9 +4948,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" +checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a" [[package]] name = "snow" @@ -5034,25 +4976,25 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b" dependencies = [ - "base64 0.11.0", + "base64", "bytes 0.5.4", "flate2", "futures 0.3.4", - "http 0.2.0", + "http 0.2.1", "httparse", "log", "rand 0.7.3", "sha1", - "smallvec 1.2.0", + "smallvec 1.3.0", "static_assertions", "thiserror", ] [[package]] name = "sp-allocator" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb6b190d2b48dcfc0641760ed0164df8ac8807a50afcb7c1da7641c8c13591b" +checksum = "1cdb45d1695a4b2004ce17681387bfbeb7ef9ae370c7903de9333f7bf905fbb9" dependencies = [ "derive_more", "log", @@ -5063,9 +5005,9 @@ dependencies = [ [[package]] name = "sp-api" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4312c5081652e14f9c87fe6f8c765bbe63ac0ae69daeba48c2e5f7e7b7b25b" +checksum = "4e34c770de3ada5729a094ed0e594a94fe03f4d6bfffd5d27f40e00778d20998" dependencies = [ "hash-db", "parity-scale-codec", @@ -5079,22 +5021,22 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73a94ac1f228f99fb5279d7983f6bcde83bf1fe5824f9a56e5f7a81cc8a7069c" +checksum = "53f6276132fc841a61e38d6eaa3a89acd10ccec1d8167cedf453c2fff0513b93" dependencies = [ "blake2-rfc", "proc-macro-crate", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sp-application-crypto" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed68f0c283a01b5a8c768965b160fb4aa0a637a7e1b5e0d1168cba2f2310b348" +checksum = "f2997e5072ef4fa6ac54658b0e79149095ececd89e3bd693f8fed90ad69862e8" dependencies = [ "parity-scale-codec", "serde", @@ -5105,13 +5047,14 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d1e32dfcd4c87069d6e48d7d4a873221a8c27161a0ef5ad6ff683b591e6f97" +checksum = "35ee0e06a6d46a3d6fb8706dfa2ca593b60a06c248fbd5173ab56070c209612e" dependencies = [ "integer-sqrt", - "num-traits", + "num-traits 0.2.11", "parity-scale-codec", + "primitive-types", "serde", "sp-debug-derive", "sp-std", @@ -5119,9 +5062,9 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb168416f8724c89877bfea4fece91087855760b6fc2957d982de5c168575b5" +checksum = "e4b654cf89dd73ad85848b2c7e60812f231ba2785aeec9c4708a434323fecf9a" dependencies = [ "parity-scale-codec", "sp-api", @@ -5132,115 +5075,95 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "789cf456c266dfb7d26a08f590b6e4d7644121e0d7fc3a2cd01636e1d3cef512" +checksum = "40b9c16247ff5ddd2b5aae78c51ffb49eddd804492be6182442281afff391e1e" dependencies = [ "derive_more", "log", "lru", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sp-block-builder", "sp-consensus", "sp-runtime", "sp-state-machine", ] +[[package]] +name = "sp-chain-spec" +version = "2.0.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2997456fa5b605fec06c5f2267a0e7cb44708b210548b1a557ce89b07bc04211" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "sp-consensus" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece2291dcf8ee851df66ea0096a5301e18921e8208782ccf484694d4e50aae98" +checksum = "dff4f5824b4d69bbe0db4e67018abadf76acad541b12b58b6880f67fdd6ecc53" dependencies = [ "derive_more", "futures 0.3.4", - "futures-diagnose", "futures-timer 3.0.2", "libp2p", "log", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "serde", "sp-core", "sp-inherents", "sp-runtime", "sp-state-machine", "sp-std", + "sp-utils", "sp-version", ] [[package]] name = "sp-consensus-aura" -version = "0.8.0-alpha.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee662e18c471a2a7abb56ddc32790aeb4cf348b67bfe4c5b320360be0aa7a72" -dependencies = [ - "parity-scale-codec", - "sp-api", - "sp-application-crypto", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-timestamp", -] - -[[package]] -name = "sp-consensus-babe" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3341004b1ed8ae1487dc28b5ba9e3ece95c23c318d427fa598bb0084630ea822" +checksum = "3dc4bdd9859ad3917bf8c4a40ec422259b9b538d9e8ba545dfd6870cd6a88ba5" dependencies = [ "parity-scale-codec", "sp-api", "sp-application-crypto", - "sp-consensus", - "sp-consensus-vrf", "sp-inherents", "sp-runtime", "sp-std", "sp-timestamp", ] -[[package]] -name = "sp-consensus-vrf" -version = "0.8.0-alpha.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7749e59ef895203554a9fca6a5d24e49f079f44f2dddc9306fe50faae783f5a0" -dependencies = [ - "parity-scale-codec", - "schnorrkel", - "sp-core", - "sp-runtime", - "sp-std", -] - [[package]] name = "sp-core" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a2938aefa827fbf6dbf5c3e8eea5cc6dedafe97a28bbfb733258ee99c82c67" +checksum = "a4d4e7309949c9ce65a0347b20bbc89cc09efee55b1918c3253392286dab0df9" dependencies = [ "base58", "blake2-rfc", - "byteorder 1.3.4", + "byteorder", "ed25519-dalek", "futures 0.3.4", "hash-db", "hash256-std-hasher", "hex", - "impl-serde 0.3.0", + "impl-serde 0.3.1", "lazy_static", "libsecp256k1", "log", - "num-traits", + "merlin", + "num-traits 0.2.11", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "primitive-types", "rand 0.7.3", "regex", - "rustc-hex", "schnorrkel", "serde", "sha2", @@ -5257,33 +5180,44 @@ dependencies = [ "zeroize", ] +[[package]] +name = "sp-database" +version = "2.0.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96e050dc3b7a9119e78254bdde9365a27d951a810f7afdcb58fc5799f8bddbb" +dependencies = [ + "kvdb", + "parking_lot 0.10.2", +] + [[package]] name = "sp-debug-derive" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "124f3ffa2d897139864715cc624811ca997ca92be8880229143c6dee801b5ab2" +checksum = "b2c4cb00ba7694df96793cf024418e6a75d5f224716460961b5c9dbfa621c0e8" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sp-externalities" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b3aa6665b2a1a9df50a5514597e96a7d08d69e0e7ff90d238380fb266e14622" +checksum = "93a826d5f8f0085804f5e7174885958611955a904ff184ae0ad289d6b83d8a3e" dependencies = [ "environmental", + "parity-scale-codec", "sp-std", "sp-storage", ] [[package]] name = "sp-finality-grandpa" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b4d96f0aa94da01d3110a20b54d8c35c419b193df6e9fa9127b2aa912afecb" +checksum = "c91cc8d9e62f28d3dd90c3e4291f26147c5094f6f2587aeea4301bf3731d4a3c" dependencies = [ "parity-scale-codec", "serde", @@ -5295,9 +5229,9 @@ dependencies = [ [[package]] name = "sp-finality-tracker" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be49e587e5667f747ca743ef468949535fae5640d26c236ac35e44abe595b15" +checksum = "8f050f19f1e07b63f61a872552fecf7239c75e77dc133a5f5ae00dac0e7b348d" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -5306,27 +5240,29 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d5ea2312969d929d617f852f9728644b98591b503a641106ee444acea4394fc" +checksum = "8367b0e285f8c3ab00400a5f5b53ff0dba263005d2458fdc3e9652f824205f0b" dependencies = [ "derive_more", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "sp-core", "sp-std", ] [[package]] name = "sp-io" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ed12cd1b0eddf5250703fff43da9e76be6cce32c492b2e2a71b4f6d9a12f49" +checksum = "ede88516c08b2070ad2b49f5e4ebff896910b11c0a63184eb5c20b0b604b8655" dependencies = [ + "futures 0.3.4", "hash-db", "libsecp256k1", "log", "parity-scale-codec", + "parking_lot 0.10.2", "sp-core", "sp-externalities", "sp-runtime-interface", @@ -5338,9 +5274,9 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efcad50ccf03fa69c14f1b4a48b14cbb8f17afbbb53b81c34f4e0b4a3101d82" +checksum = "509e39a8b8c8c6532fcbea3140e3f92ec6712ee028bdc968f4ccb90181205c24" dependencies = [ "lazy_static", "sp-core", @@ -5350,19 +5286,20 @@ dependencies = [ [[package]] name = "sp-offchain" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "272f17953e7e64092f12ee2cea98f516d32689027a572565b272107bf7bcbafa" +checksum = "e63092c0ecd8fc90971a14a169f62337b78d885873e55dee87f33fe5f76d6591" dependencies = [ "sp-api", + "sp-core", "sp-runtime", ] [[package]] name = "sp-panic-handler" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643ae9f2dc119551342422394cdfa8bfe0a230d1adc9891fcb08cf15fdf0f703" +checksum = "acec634cd613519673edad420f56d5bbd087da9923c05aa66708882ee9676d20" dependencies = [ "backtrace", "log", @@ -5370,9 +5307,9 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69c98a453e22bfab61ad6a1e71984a73ac4b42ac2203d997e1a390195ff4e1f5" +checksum = "7bd0ae1f6a934590356ce844ce9d0ef71993cab223f6c9371c2fdea98b23c334" dependencies = [ "serde", "sp-core", @@ -5380,9 +5317,9 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2eb5d07f847c7420070d9dc28d810d405dc6316cd58f58548a41f0aeeca84e8" +checksum = "0d37f6a2e111dd82dd194fa9ef77ba49b17e70162afc237f99e7c5dc6f95834f" dependencies = [ "hash256-std-hasher", "impl-trait-for-tuples", @@ -5402,37 +5339,38 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d25229ba01740b13368f743e866d8ee155826932c9f2c4390e4ceb7730df214" +checksum = "bc743ea280556cbaf82203ec63ade39f4167402cb571aaf012c6c43f092ccf33" dependencies = [ "parity-scale-codec", "primitive-types", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", + "sp-tracing", "sp-wasm-interface", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f1d9e32fa5db2f3dd89affbd3c97959432272c9e52e4e2610dad32dd4705784" +checksum = "be673dffcf1084e6a0da85712866afde7bbdefa152e9e3e5dbf4a04f1994a673" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] name = "sp-serializer" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91abe1611fb9ad68cc2be724580710c5824a256d6aa92d88b181cb0d4819f8d1" +checksum = "747ed260860bde3b6b098caf3091905b1fcea95135fb73fb7fded7a7662ae622" dependencies = [ "serde", "serde_json", @@ -5440,9 +5378,9 @@ dependencies = [ [[package]] name = "sp-session" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8e48c0f293408a073609b7274a0ff9388802ae2482de094e36b0609cb38bf5" +checksum = "fd4f193d095bb211ea75c14d924b97e03163e6807185b2ab45ff49a51d259fa8" dependencies = [ "sp-api", "sp-core", @@ -5452,9 +5390,9 @@ dependencies = [ [[package]] name = "sp-staking" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e9996147f5b2572995e7377f2257e8ce207065e135115c3d3845838c1cbaa2" +checksum = "d87f659f9742c456a35382af6ed58160cd1f23e0ddb51c38180b2cf80d5ac8a1" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -5463,15 +5401,15 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e52a17e293be8e7a518ac6aebfc7fdafbe531b6c808a83a754e4a8730f139521" +checksum = "bd342d0b85891ea0e69c34483651df4e05420989b6fa74eb1982994118482985" dependencies = [ "hash-db", "log", - "num-traits", + "num-traits 0.2.11", "parity-scale-codec", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "rand 0.7.3", "sp-core", "sp-externalities", @@ -5483,17 +5421,18 @@ dependencies = [ [[package]] name = "sp-std" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "752e038359704226bb5737531fb91df2e4ab33214e0be6eb6f32ad688a71b411" +checksum = "6e32241a20350ba20f445c73fec53b4c904559756b922ca2c3dda87ab2c1be9e" [[package]] name = "sp-storage" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c389a75ddd45ba771b20c4caed1011d23004069e436b73eca058d2f894585069" +checksum = "645dcf4a75d63a5494eabdc076d19a834c3cc46df65d84506fc40e67bd0bdd40" dependencies = [ "impl-serde 0.2.3", + "ref-cast", "serde", "sp-debug-derive", "sp-std", @@ -5501,9 +5440,9 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990bc28e4e7fd31a13f5e61fd30ef0aa3ba5747b64ab3560df5285abbd879f6c" +checksum = "f981570875b33311c4ae95a721511951689d4d89e2f58bd0933dcbfe67230364" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5514,11 +5453,20 @@ dependencies = [ "wasm-timer", ] +[[package]] +name = "sp-tracing" +version = "2.0.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a4caabab12ba64d7e5d3ff6d2d5a698425227eb8c697f8b3dcac67813a192b" +dependencies = [ + "tracing", +] + [[package]] name = "sp-transaction-pool" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a7e374dd4c0831fa118728656c5d295a3ebd3da9c7ead45451ad4a5801a77e4" +checksum = "008ceb7db9fe134ced1e67226edb36db783e5f9434ca3544efcc94d8db9e1c99" dependencies = [ "derive_more", "futures 0.3.4", @@ -5527,13 +5475,14 @@ dependencies = [ "serde", "sp-api", "sp-runtime", + "sp-utils", ] [[package]] name = "sp-trie" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f417a60d0d1222f92733deef4dffc73b21180b0cf44ec335ac73fc871198721" +checksum = "1620f438771be44e7aee5445c348623c40bc32a15c875689ac9f2e3aecdc3aa3" dependencies = [ "hash-db", "memory-db", @@ -5544,11 +5493,23 @@ dependencies = [ "trie-root", ] +[[package]] +name = "sp-utils" +version = "2.0.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3aa5acc361bb7ccab3940584d9c032a587b8b4414cd949a92a7b391e6f39384" +dependencies = [ + "futures 0.3.4", + "futures-core", + "lazy_static", + "prometheus", +] + [[package]] name = "sp-version" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f7ded62b3fd6346dc7e96dcfc55f8137653809e09cfa3f0da8052efd35c875" +checksum = "d032c1e5c3b484c0e88486a1a6e9bfb736cbe6cb68b074cf0436b2935d38372a" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -5559,9 +5520,9 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9dec817ad8e5eed83a3579da8638703d7559be5da5342312c8effee6a70aa" +checksum = "0154beac23726c550f7fd68b9aad2fd97369221d5aa4b4e18d937e2eddc4246b" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -5583,7 +5544,7 @@ checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" [[package]] name = "staked-relayers" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "bitcoin", "btc-relay", @@ -5591,6 +5552,7 @@ dependencies = [ "exchange-rate-oracle", "frame-support", "frame-system", + "hex", "mocktopus", "pallet-balances", "pallet-timestamp", @@ -5625,15 +5587,6 @@ dependencies = [ "rand 0.5.6", ] -[[package]] -name = "stream-cipher" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" -dependencies = [ - "generic-array", -] - [[package]] name = "string" version = "0.2.1" @@ -5651,9 +5604,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8faa2719539bbe9d77869bfb15d4ee769f99525e707931452c97b693b3f159d" +checksum = "ff6da2e8d107dfd7b74df5ef4d205c6aebee0706c647f6bc6a2d5789905c00fb" dependencies = [ "clap", "lazy_static", @@ -5662,15 +5615,15 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f88b8e18c69496aad6f9ddf4630dd7d585bcaf765786cb415b9aec2fe5a0430" +checksum = "a489c87c08fbaf12e386665109dd13470dcc9c4583ea3e10dd2b4523e5ebd9ac" dependencies = [ "heck", "proc-macro-error", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5690,8 +5643,8 @@ checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" dependencies = [ "heck", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5708,15 +5661,18 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efc616006b44902a803b566592ef11d03a22ba3e1e0a6d1115a0859c105620f4" +checksum = "19b350e0eacbf0f7a5d6394417e3371e6f29b412ce95b4df02bab46db16d66a5" +dependencies = [ + "platforms", +] [[package]] name = "substrate-prometheus-endpoint" -version = "0.8.0-alpha.5" +version = "0.8.0-alpha.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79926ded24e276de08eba7880c173e90eae37dc748f47eabefca9bda2cb296" +checksum = "2d0d8bbb7ede14a1d0212218945b83606e358878eac510685819d5c6394bcad9" dependencies = [ "async-std", "derive_more", @@ -5724,7 +5680,7 @@ dependencies = [ "hyper 0.13.4", "log", "prometheus", - "tokio 0.2.13", + "tokio 0.2.18", ] [[package]] @@ -5745,6 +5701,17 @@ version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" +[[package]] +name = "syn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +dependencies = [ + "quote 0.3.15", + "synom", + "unicode-xid 0.0.4", +] + [[package]] name = "syn" version = "1.0.17" @@ -5752,8 +5719,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" dependencies = [ "proc-macro2", - "quote", - "unicode-xid", + "quote 1.0.3", + "unicode-xid 0.2.0", ] [[package]] @@ -5763,8 +5730,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", +] + +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" +dependencies = [ + "unicode-xid 0.0.4", ] [[package]] @@ -5774,16 +5750,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ "proc-macro2", - "quote", - "syn", - "unicode-xid", + "quote 1.0.3", + "syn 1.0.17", + "unicode-xid 0.2.0", ] [[package]] name = "sysinfo" -version = "0.12.0" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccb41798287e8e299a701b5560d886d6ca2c3e7115e9ea2cb68c123aec339b7" +checksum = "1cac193374347e7c263c5f547524f36ff8ec6702d56c8799c8331d26dffe8c1e" dependencies = [ "cfg-if", "doc-comment", @@ -5800,12 +5776,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" -[[package]] -name = "target_info" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" - [[package]] name = "tempfile" version = "3.1.0" @@ -5840,22 +5810,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3711fd1c4e75b3eff12ba5c40dba762b6b65c5476e8174c1a664772060c49bf" +checksum = "54b3d3d2ff68104100ab257bb6bb0cb26c901abe4bd4ba15961f3bf867924012" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae2b85ba4c9aa32dd3343bd80eb8d22e9b54b7688c17ea3907f236885353b233" +checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -5889,9 +5859,9 @@ dependencies = [ [[package]] name = "tiny-bip39" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e255ec4f7d4aaccbede17dffcfb2e71434d17f5c921d5a06823b8e58a2bcd468" +checksum = "b0165e045cc2ae1660270ca65e1676dbaab60feb0f91b10f7d0665e9b47e31f2" dependencies = [ "failure", "hmac", @@ -5905,9 +5875,9 @@ dependencies = [ [[package]] name = "tiny-keccak" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2953ca5148619bc99695c1274cb54c5275bbb913c6adad87e72eaf8db9787f69" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" dependencies = [ "crunchy", ] @@ -5938,12 +5908,13 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.13" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa5e81d6bc4e67fe889d5783bd2a128ab2e0cfa487e0be16b6a8d177b101616" +checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" dependencies = [ "bytes 0.5.4", "fnv", + "futures-core", "iovec", "lazy_static", "libc", @@ -6058,8 +6029,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4adb8b3e5f86b707f1b54e7c15b6de52617a823608ccda98a15d3a24222f265a" dependencies = [ "futures-core", - "rustls 0.17.0", - "tokio 0.2.13", + "rustls", + "tokio 0.2.18", "webpki", ] @@ -6162,16 +6133,16 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ "bytes 0.5.4", "futures-core", "futures-sink", "log", "pin-project-lite", - "tokio 0.2.13", + "tokio 0.2.18", ] [[package]] @@ -6206,8 +6177,8 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" dependencies = [ - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", ] [[package]] @@ -6221,7 +6192,7 @@ dependencies = [ [[package]] name = "treasury" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "frame-support", "frame-system", @@ -6238,15 +6209,15 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de9222c50cc325855621271157c973da27a0dcd26fa06f8edf81020bd2333df0" +checksum = "bcc309f34008563989045a4c4dbcc5770467f3a3785ee80a9b5cc0d83362475f" dependencies = [ "hash-db", "hashbrown", "log", "rustc-hex", - "smallvec 1.2.0", + "smallvec 1.3.0", ] [[package]] @@ -6264,17 +6235,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" -[[package]] -name = "twofish" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" -dependencies = [ - "block-cipher-trait", - "byteorder 1.3.4", - "opaque-debug", -] - [[package]] name = "twox-hash" version = "1.5.0" @@ -6286,17 +6246,17 @@ dependencies = [ [[package]] name = "typenum" -version = "1.11.2" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" +checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" dependencies = [ - "byteorder 1.3.4", + "byteorder", "crunchy", "rustc-hex", "static_assertions", @@ -6326,7 +6286,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" dependencies = [ - "smallvec 1.2.0", + "smallvec 1.3.0", ] [[package]] @@ -6341,6 +6301,12 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" + [[package]] name = "unicode-xid" version = "0.2.0" @@ -6349,9 +6315,9 @@ checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" [[package]] name = "unsigned-varint" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38e01ad4b98f042e166c1bf9a13f9873a99d79eaa171ce7ca81e6dd0f895d8a" +checksum = "f67332660eb59a6f1eb24ff1220c9e8d01738a8503c6002e30bcfe4bd9f2b4a9" dependencies = [ "bytes 0.5.4", "futures-io", @@ -6389,7 +6355,7 @@ dependencies = [ [[package]] name = "vault-registry" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "collateral", "exchange-rate-oracle", @@ -6423,16 +6389,6 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -[[package]] -name = "vergen" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ce50d8996df1f85af15f2cd8d33daae6e479575123ef4314a51a70a230739cb" -dependencies = [ - "bitflags", - "chrono", -] - [[package]] name = "version_check" version = "0.9.1" @@ -6474,9 +6430,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557c397ab5a8e347d434782bcd31fc1483d927a6826804cec05cc792ee2519d" +checksum = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -6484,24 +6440,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0da9c9a19850d3af6df1cb9574970b566d617ecfaf36eb0b706b6f3ef9bd2f8" +checksum = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" dependencies = [ "bumpalo", "lazy_static", "log", "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457414a91863c0ec00090dba537f88ab955d93ca6555862c29b6d860990b8a8a" +checksum = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" dependencies = [ "cfg-if", "js-sys", @@ -6511,32 +6467,32 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6fde1d36e75a714b5fe0cffbb78978f222ea6baebb726af13c78869fdb4205" +checksum = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" dependencies = [ - "quote", + "quote 1.0.3", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bda4168030a6412ea8a047e27238cadf56f0e53516e1e83fec0a8b7c786f6d" +checksum = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.59" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc9f36ad51f25b0219a3d4d13b90eb44cd075dff8b6280cca015775d7acaddd8" +checksum = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" [[package]] name = "wasm-timer" @@ -6563,7 +6519,7 @@ dependencies = [ "libc", "memory_units", "num-rational", - "num-traits", + "num-traits 0.2.11", "parity-wasm", "wasmi-validation", ] @@ -6579,9 +6535,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721c6263e2c66fd44501cc5efbfa2b7dfa775d13e4ea38c46299646ed1f9c70a" +checksum = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" dependencies = [ "js-sys", "wasm-bindgen", @@ -6599,18 +6555,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a262ae37dd9d60f60dd473d1158f9fbebf110ba7b6a5051c8160460f6043718b" +checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" dependencies = [ "webpki", ] [[package]] name = "webpki-roots" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" +checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" dependencies = [ "webpki", ] @@ -6654,9 +6610,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" +checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e" dependencies = [ "winapi 0.3.8", ] @@ -6673,7 +6629,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94" dependencies = [ - "byteorder 1.3.4", + "byteorder", "bytes 0.4.12", "httparse", "log", @@ -6697,7 +6653,7 @@ dependencies = [ [[package]] name = "x-core" -version = "0.1.0" +version = "2.0.0-alpha.7" dependencies = [ "frame-support", "parity-scale-codec", @@ -6730,7 +6686,7 @@ dependencies = [ "futures 0.3.4", "log", "nohash-hasher", - "parking_lot 0.10.0", + "parking_lot 0.10.2", "rand 0.7.3", "static_assertions", ] @@ -6751,7 +6707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2", - "quote", - "syn", + "quote 1.0.3", + "syn 1.0.17", "synstructure", ] diff --git a/README.md b/README.md index a97271d272..7a298909ac 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,8 @@

- Logo - - - + -

BTC-Parachain

@@ -176,4 +172,10 @@ We would also like to thank the following teams for their continuous support: * [Parity Technologies](https://www.parity.io/) +

+ + + +

+ diff --git a/crates/bitcoin/Cargo.toml b/crates/bitcoin/Cargo.toml index 5f6880795c..355a4032ef 100644 --- a/crates/bitcoin/Cargo.toml +++ b/crates/bitcoin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'bitcoin' -version = '0.1.0' +version = '0.1.1' authors = ['Interlay Ltd '] edition = '2018' @@ -13,20 +13,20 @@ version = '1.0.101' default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.0.0' +version = '1.3.0' [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sha2] default-features = false @@ -40,6 +40,10 @@ path = '../x-core' default-features = false version = '0.4.2' +[dependencies.bitcoin_hashes] +default-features = false +version = "0.7.3" + [dev-dependencies] mocktopus = '0.7.0' diff --git a/crates/bitcoin/src/parser.rs b/crates/bitcoin/src/parser.rs index 30aeb57c1d..96e67361c8 100644 --- a/crates/bitcoin/src/parser.rs +++ b/crates/bitcoin/src/parser.rs @@ -1,6 +1,10 @@ #[cfg(test)] extern crate mocktopus; +extern crate bitcoin_hashes; + +use bitcoin_hashes::Hash; + #[cfg(test)] use mocktopus::macros::mockable; @@ -387,7 +391,30 @@ fn parse_transaction_output(raw_output: &[u8]) -> Result<(TransactionOutput, usi )) } -pub(crate) fn extract_address_hash(output_script: &[u8]) -> Result, Error> { +pub(crate) fn extract_address_hash_scriptsig(input_script: &[u8]) -> Result, Error> { + let mut parser = BytesParser::new(input_script); + let mut p2pkh = true; + + // Multisig OBOE hack -> p2sh + if input_script[0] == OpCode::Op0 as u8 { + parser.parse::()?; + p2pkh = false; + } + + let sig_size: u64 = parser.parse::()?.value; + let _sig = parser.read(sig_size as usize)?; + + let redeem_script_size: u64 = parser.parse::()?.value; + + // if not p2sh, redeem script is just 33-byte pubkey + if p2pkh && redeem_script_size != 33 { + return Err(Error::UnsupportedInputFormat); + } + let redeem_script = parser.read(redeem_script_size as usize)?; + return Ok(bitcoin_hashes::hash160::Hash::hash(&redeem_script).to_vec()); +} + +pub(crate) fn extract_address_hash_scriptpubkey(output_script: &[u8]) -> Result, Error> { let script_len = output_script.len(); // Witness if output_script[0] == 0 { @@ -681,7 +708,7 @@ pub(crate) mod tests { let p2pkh_address: [u8; 20] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - let extr_p2pkh = extract_address_hash(&p2pkh_script).unwrap(); + let extr_p2pkh = extract_address_hash_scriptpubkey(&p2pkh_script).unwrap(); assert_eq!(&extr_p2pkh, &p2pkh_address); } @@ -692,17 +719,47 @@ pub(crate) mod tests { let p2sh_address: [u8; 20] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - let extr_p2sh = extract_address_hash(&p2sh_script).unwrap(); + let extr_p2sh = extract_address_hash_scriptpubkey(&p2sh_script).unwrap(); assert_eq!(&extr_p2sh, &p2sh_address); } + #[test] + fn test_extract_address_hash_scriptsig() { + let raw_tx = "0100000001c15041a06deb6b3818b022fac558da4ce2097f0860c8f642105bbad9d29be02a010000006c493046022100cfd2a2d332b29adce119c55a9fadd3c073332024b7e272513e51623ca15993480221009b482d7f7b4d479aff62bdcdaea54667737d56f8d4d63dd03ec3ef651ed9a25401210325f8b039a11861659c9bf03f43fc4ea055f3a71cd60c7b1fd474ab578f9977faffffffff0290d94000000000001976a9148ed243a7be26080a1a8cf96b53270665f1b8dd2388ac4083086b000000001976a9147e7d94d0ddc21d83bfbcfc7798e4547edf0832aa88ac00000000"; + let tx_bytes = hex::decode(&raw_tx).unwrap(); + let transaction = parse_transaction(&tx_bytes).unwrap(); + + let address: [u8; 20] = [ + 126, 125, 148, 208, 221, 194, 29, 131, 191, 188, 252, 119, 152, 228, 84, 126, 223, 8, + 50, 170, + ]; + let extr_address = extract_address_hash_scriptsig(&transaction.inputs[0].script).unwrap(); + + assert_eq!(&extr_address, &address); + } + + #[test] + fn test_extract_address_hash_scriptsig_p2sh() { + let raw_tx = "0100000001c8cc2b56525e734ff63a13bc6ad06a9e5664df8c67632253a8e36017aee3ee40000000009000483045022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b248593abc1259512793e7dea61036c601775ebb23640a0120b0dba2c34b79001455141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51aefeffffff0120f40e00000000001976a9141d30342095961d951d306845ef98ac08474b36a088aca7270400"; + let tx_bytes = hex::decode(&raw_tx).unwrap(); + let transaction = parse_transaction(&tx_bytes).unwrap(); + + let address: [u8; 20] = [ + 233, 195, 221, 12, 7, 170, 199, 97, 121, 235, 199, 106, 108, 120, 212, 214, 124, 108, + 22, 10, + ]; + let extr_address = extract_address_hash_scriptsig(&transaction.inputs[0].script).unwrap(); + + assert_eq!(&extr_address, &address); + } + /* #[test] fn test_extract_address_invalid_p2pkh_fails() { let p2pkh_script = hex::decode(&sample_malformed_p2pkh_output()).unwrap(); - assert_eq!(extract_address_hash(&p2pkh_script).err(), Some(Error::MalformedP2PKHOutput)); + assert_eq!(extract_address_hash_scriptpubkey(&p2pkh_script).err(), Some(Error::MalformedP2PKHOutput)); } */ } diff --git a/crates/bitcoin/src/types.rs b/crates/bitcoin/src/types.rs index acc0d2098b..2f59ae7611 100644 --- a/crates/bitcoin/src/types.rs +++ b/crates/bitcoin/src/types.rs @@ -3,6 +3,8 @@ extern crate hex; #[cfg(test)] use mocktopus::macros::mockable; +use bitcoin_hashes::Hash; + use codec::alloc::string::String; use codec::{Decode, Encode}; use primitive_types::{H256, U256}; @@ -13,7 +15,10 @@ use x_core::Error; use crate::formatter::Formattable; use crate::merkle::MerkleProof; -use crate::parser::{extract_address_hash, extract_op_return_data, FromLeBytes}; +use crate::parser::{ + extract_address_hash_scriptpubkey, extract_address_hash_scriptsig, extract_op_return_data, + FromLeBytes, +}; use crate::utils::{hash256_merkle_step, log2, reverse_endianness, sha256d_le}; pub(crate) const SERIALIZE_TRANSACTION_NO_WITNESS: i32 = 0x4000_0000; @@ -304,6 +309,16 @@ impl TransactionInput { pub fn with_witness(&mut self, witness: Vec>) { self.witness = witness; } + + pub fn extract_address(&self) -> Result, Error> { + // Witness + if !self.witness.is_empty() { + return Ok(bitcoin_hashes::hash160::Hash::hash(&self.witness[1]).to_vec()); + } + + // P2PKH + extract_address_hash_scriptsig(&self.script) + } } /// Bitcoin script @@ -367,10 +382,6 @@ impl Script { self.bytes.extend(&value.format()) } - pub fn extract_address(&self) -> Result, Error> { - extract_address_hash(&self.bytes) - } - pub fn extract_op_return_data(&self) -> Result, Error> { extract_op_return_data(&self.bytes) } @@ -435,6 +446,10 @@ impl TransactionOutput { script: Script::op_return(return_content), } } + + pub fn extract_address(&self) -> Result, Error> { + extract_address_hash_scriptpubkey(&self.script.bytes) + } } /// Bitcoin transaction @@ -1000,7 +1015,7 @@ mod tests { assert_eq!(transaction.outputs.len(), 2); assert_eq!(transaction.outputs[0].value, 100); assert_eq!( - transaction.outputs[0].script.extract_address().unwrap(), + transaction.outputs[0].extract_address().unwrap(), address.as_bytes() ); assert_eq!(transaction.outputs[1].value, 0); @@ -1134,4 +1149,36 @@ mod tests { let bytes = proof.format(); MerkleProof::parse(&bytes).unwrap(); } + + #[test] + fn extract_witness_address_p2wpkh() { + let raw_tx = "0200000000010140d43a99926d43eb0e619bf0b3d83b4a31f60c176beecfb9d35bf45e54d0f7420100000017160014a4b4ca48de0b3fffc15404a1acdc8dbaae226955ffffffff0100e1f5050000000017a9144a1154d50b03292b3024370901711946cb7cccc387024830450221008604ef8f6d8afa892dee0f31259b6ce02dd70c545cfcfed8148179971876c54a022076d771d6e91bed212783c9b06e0de600fab2d518fad6f15a2b191d7fbd262a3e0121039d25ab79f41f75ceaf882411fd41fa670a4c672c23ffaf0e361a969cde0692e800000000"; + let tx_bytes = hex::decode(&raw_tx).unwrap(); + let transaction = parse_transaction(&tx_bytes).unwrap(); + + let address: [u8; 20] = [ + 164, 180, 202, 72, 222, 11, 63, 255, 193, 84, 4, 161, 172, 220, 141, 186, 174, 34, 105, + 85, + ]; + + let extr_address = transaction.inputs[0].extract_address().unwrap(); + + assert_eq!(&extr_address, &address); + } + + #[test] + fn extract_witness_address_p2wsh() { + let raw_tx = "020000000001027113554199c88273f7f04d18a0dca69145ea863f31519a790b346579b9b55f090100000017160014d6ad6711da30f4349a0d8c387a515bff10ecd507fdffffff90a9eb7550a8308c629014f3f685d2d72e9e7de6bd199c3a9615b567206889430100000017160014cce6d8dffda77f56e237389f48417f10659c2e42fdffffff0228641c000000000017a914d980c4240e77b76d48051c791f68831d23ad3e8687400d03000000000017a914e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a870248304502210088b0fb4b40af9620f785f265c2e2f7436018391d9db34eee3bc1ebd796fbce96022015151182eaa595e090c8030d9f979b920aae276c385dfc66ac2d77160a27453b01210266dd88be116711227e2e953daa008cca45ce5cc0aa4b584c20ae6ddb9ce0212d0247304402204b2fdd767ab93b30a43042c3287ae78d06d1418084fe88350b0aaf06bebe02fe02202d850fc5887d948307fdade871de3714d867610643f6507e511d14dad86fe3ce012102593012612326b4c07e6f0234bac5ff62b5ed12afe77e2900474ca36b3bfa528075f50700"; + let tx_bytes = hex::decode(&raw_tx).unwrap(); + let transaction = parse_transaction(&tx_bytes).unwrap(); + + let address: [u8; 20] = [ + 214, 173, 103, 17, 218, 48, 244, 52, 154, 13, 140, 56, 122, 81, 91, 255, 16, 236, 213, + 7, + ]; + + let extr_address = transaction.inputs[0].extract_address().unwrap(); + + assert_eq!(&extr_address, &address); + } } diff --git a/crates/btc-relay/Cargo.toml b/crates/btc-relay/Cargo.toml index de6e47ef05..30942a8ac3 100644 --- a/crates/btc-relay/Cargo.toml +++ b/crates/btc-relay/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "btc-relay" -version = "0.1.0" +version = "2.0.0-alpha.7" authors = ["Interlay Ltd"] edition = "2018" @@ -13,37 +13,37 @@ version = '1.0.101' default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.0.0' +version = '1.3.0' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.timestamp] default-features = false package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.bitcoin] @@ -60,14 +60,14 @@ path = '../security' [dependencies.hex] default-features = false -version = "0.4.0" +version = '0.4.2' [dev-dependencies] mocktopus = '0.7.0' [dev-dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [features] default = ['std'] diff --git a/crates/btc-relay/src/ext.rs b/crates/btc-relay/src/ext.rs index 3eb4230102..eb488454a7 100644 --- a/crates/btc-relay/src/ext.rs +++ b/crates/btc-relay/src/ext.rs @@ -3,8 +3,10 @@ use mocktopus::macros::mockable; #[cfg_attr(test, mockable)] pub(crate) mod security { + #[cfg(test)] + use security::types::ErrorCode; use security::types::StatusCode; - use x_core::UnitResult; + use x_core::{Error, UnitResult}; pub fn _ensure_parachain_status_running() -> UnitResult { >::_ensure_parachain_status_running() @@ -17,4 +19,26 @@ pub(crate) mod security { pub fn _get_parachain_status() -> StatusCode { >::get_parachain_status() } + + pub fn _is_parachain_error_invalid_btcrelay() -> bool { + >::_is_parachain_error_invalid_btcrelay() + } + + pub fn _is_parachain_error_no_data_btcrelay() -> bool { + >::_is_parachain_error_no_data_btcrelay() + } + + pub fn recover_from_btc_relay_failure() -> UnitResult { + >::recover_from_btc_relay_failure().map_err(|_e| Error::RuntimeError) + } + + #[cfg(test)] + pub fn set_parachain_status(status: StatusCode) -> () { + >::set_parachain_status(status) + } + + #[cfg(test)] + pub fn insert_error(error: ErrorCode) -> () { + >::insert_error(error) + } } diff --git a/crates/btc-relay/src/lib.rs b/crates/btc-relay/src/lib.rs index bf5efe929f..d9f6a7675b 100644 --- a/crates/btc-relay/src/lib.rs +++ b/crates/btc-relay/src/lib.rs @@ -31,6 +31,7 @@ use sp_std::prelude::*; use system::ensure_signed; // Crates +pub use bitcoin; use bitcoin::merkle::{MerkleProof, ProofResult}; use bitcoin::parser::{parse_block_header, parse_transaction}; use bitcoin::types::{ @@ -120,6 +121,7 @@ decl_module! { /// * `block_header_bytes` - 80 byte raw Bitcoin block header. /// * `block_height` - Bitcoin block height of the submitted /// block header. + #[weight = 1000] fn initialize( origin, raw_block_header: RawBlockHeader, @@ -174,6 +176,7 @@ decl_module! { /// # Arguments /// /// * `raw_block_header` - 80 byte raw Bitcoin block header. + #[weight = 1000] fn store_block_header( origin, raw_block_header: RawBlockHeader ) -> DispatchResult { @@ -301,6 +304,7 @@ decl_module! { /// of the BTC in the 1st / payment UTXO /// * `op_return_id` - 32 byte hash identifier expected in /// OP_RETURN (replay protection) + #[weight = 1000] fn verify_and_validate_transaction( origin, tx_id: H256Le, @@ -344,6 +348,7 @@ decl_module! { /// * `confirmations` - The number of confirmations needed to accept /// the proof /// * `insecure` - determines if checks against recommended global transaction confirmation are to be executed. Recommended: set to `true` + #[weight = 1000] fn verify_transaction_inclusion( origin, tx_id: H256Le, @@ -374,6 +379,7 @@ decl_module! { /// of the BTC in the 1st / payment UTXO /// * `op_return_id` - 32 byte hash identifier expected in /// OP_RETURN (replay protection) + #[weight = 1000] fn validate_transaction( origin, raw_tx: Vec, @@ -444,7 +450,7 @@ impl Module { ); // Check if 1st / payment UTXO sends to correct address - let extr_recipient_address = transaction.outputs[0].script.extract_address()?; + let extr_recipient_address = transaction.outputs[0].extract_address()?; ensure!( extr_recipient_address == recipient_btc_address, Error::WrongRecipient @@ -625,7 +631,7 @@ impl Module { } fn _blocks_count(chain_id: u32) -> usize { - ::iter_prefix(chain_id).count() + ::iter_prefix_values(chain_id).count() } /// Add a new block header to an existing blockchain @@ -857,6 +863,9 @@ impl Module { Self::insert_block_hash(MAIN_CHAIN_ID, height, block); } ::remove_prefix(fork.chain_id); + if !fork.is_invalid() && !fork.is_no_data() { + Self::recover_if_needed()? + } Ok(()) } @@ -1048,6 +1057,10 @@ impl Module { }; if block_exists { + if !blockchain.is_invalid() && !blockchain.is_no_data() { + Self::recover_if_needed()? + } + // Store the updated blockchain entry Self::mutate_block_chain_from_id(chain_id, blockchain); @@ -1142,6 +1155,16 @@ impl Module { } Ok(()) } + + fn recover_if_needed() -> Result<(), Error> { + if ext::security::_is_parachain_error_invalid_btcrelay::() + || ext::security::_is_parachain_error_no_data_btcrelay::() + { + ext::security::recover_from_btc_relay_failure::() + } else { + Ok(()) + } + } } decl_event! { diff --git a/crates/btc-relay/src/mock.rs b/crates/btc-relay/src/mock.rs index b1b03c7b51..694e949584 100644 --- a/crates/btc-relay/src/mock.rs +++ b/crates/btc-relay/src/mock.rs @@ -1,6 +1,12 @@ /// Mocking the test environment use crate::{GenesisConfig, Module, Trait}; -use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight}; +use frame_support::{ + impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, +}; use sp_core::H256; use sp_runtime::{ testing::Header, @@ -28,38 +34,44 @@ impl_outer_event! { pub type AccountId = u64; pub const CONFIRMATIONS: u32 = 6; +pub type BlockNumber = u64; // For testing the pallet, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. #[derive(Clone, Eq, PartialEq)] pub struct Test; + parameter_types! { pub const BlockHashCount: u64 = 250; pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } + impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; - type BlockNumber = u64; + type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = (); type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = (); } impl Trait for Test { @@ -96,5 +108,8 @@ where T: FnOnce() -> (), { clear_mocks(); - ExtBuilder::build().execute_with(test); + ExtBuilder::build().execute_with(|| { + System::set_block_number(1); + test(); + }); } diff --git a/crates/btc-relay/src/tests.rs b/crates/btc-relay/src/tests.rs index d4f012ccd5..8e4c7eb7cc 100644 --- a/crates/btc-relay/src/tests.rs +++ b/crates/btc-relay/src/tests.rs @@ -10,7 +10,7 @@ use bitcoin::merkle::*; use bitcoin::parser::*; use bitcoin::types::*; use frame_support::{assert_err, assert_ok}; -use security::ErrorCode; +use security::{ErrorCode, StatusCode}; use sp_std::collections::btree_set::BTreeSet; use sp_std::convert::{TryFrom, TryInto}; use x_core::Error; @@ -498,6 +498,11 @@ fn swap_main_blockchain_succeeds() { main_position, ); + // simulate error + let header = BTCRelay::get_block_header_from_height(&main, 2).unwrap(); + BTCRelay::flag_block_error(header.block_hash, ErrorCode::NoDataBTCRelay).unwrap(); + set_parachain_nodata_error(); + // insert the fork chain and headers let fork_chain_ref: u32 = 4; let fork_start: u32 = 5; @@ -528,7 +533,7 @@ fn swap_main_blockchain_succeeds() { BTCRelay::_blocks_count(main_chain_ref) as u32 ); - assert_eq!(main.no_data, new_main.no_data); + assert_eq!(main.no_data, BTreeSet::new()); assert_eq!(main.invalid, new_main.invalid); // check that the fork is deleted @@ -537,6 +542,10 @@ fn swap_main_blockchain_succeeds() { BTCRelay::get_block_chain_from_id(fork_chain_ref) ); + // check that the parachain has recovered + assert_ok!(ext::security::_ensure_parachain_status_running::()); + assert!(!ext::security::_is_parachain_error_no_data_btcrelay::()); + // check that the old main chain is stored in a old fork let old_main = BTCRelay::get_block_chain_from_id(old_main_ref).unwrap(); assert_eq!(main_height, old_main.max_height); @@ -790,7 +799,7 @@ fn test_validate_transaction_succeeds() { payment_value, recipient_btc_address, op_return_id - )) + )); }); } @@ -1078,21 +1087,21 @@ fn test_clear_block_error_succeeds() { get_empty_block_chain_from_chain_id_and_height(chain_ref, start_height, block_height); blockchain.no_data.insert(block_height); blockchain.invalid.insert(block_height); + set_parachain_nodata_error(); + ext::security::insert_error::(ErrorCode::InvalidBTCRelay); BTCRelay::set_block_chain_from_id(chain_ref, &blockchain); - let error_codes = vec![ErrorCode::NoDataBTCRelay, ErrorCode::InvalidBTCRelay]; - - for error in error_codes.iter() { + let clear_error = move |error: ErrorCode| { assert_ok!(BTCRelay::clear_block_error( rich_header.block_hash, error.clone() )); let curr_chain = BTCRelay::get_block_chain_from_id(chain_ref).unwrap(); - if *error == ErrorCode::NoDataBTCRelay { + if error == ErrorCode::NoDataBTCRelay { assert!(!curr_chain.no_data.contains(&block_height)); - } else if *error == ErrorCode::InvalidBTCRelay { + } else if error == ErrorCode::InvalidBTCRelay { assert!(!curr_chain.invalid.contains(&block_height)); }; let error_event = TestEvent::test_events(Event::ClearBlockError( @@ -1101,7 +1110,20 @@ fn test_clear_block_error_succeeds() { error.clone(), )); assert!(System::events().iter().any(|a| a.event == error_event)); - } + }; + + clear_error(ErrorCode::NoDataBTCRelay); + // ensure not recovered while there are still invalid blocks + assert_err!( + ext::security::_ensure_parachain_status_running::(), + Error::ParachainNotRunning + ); + assert!(ext::security::_is_parachain_error_invalid_btcrelay::()); + clear_error(ErrorCode::InvalidBTCRelay); + + assert_ok!(ext::security::_ensure_parachain_status_running::()); + assert!(!ext::security::_is_parachain_error_invalid_btcrelay::()); + assert!(!ext::security::_is_parachain_error_no_data_btcrelay::()); }) } @@ -1476,7 +1498,7 @@ fn test_check_confirmations_insecure_succeeds() { req_confs, tx_block_height, insecure - )) + )); }); } @@ -1514,7 +1536,7 @@ fn test_check_confirmations_secure_stable_confs_succeeds() { req_confs, tx_block_height, insecure - )) + )); }); } @@ -1536,7 +1558,7 @@ fn test_check_confirmations_secure_user_confs_succeeds() { req_confs, tx_block_height, insecure - )) + )); }); } @@ -1902,3 +1924,9 @@ fn sample_example_real_txid() -> String { fn sample_example_real_transaction_hash() -> String { "b759d39a8596b70b3a46700b83e1edb247e17ba58df305421864fe7a9ac142ea".to_owned() } + +fn set_parachain_nodata_error() { + ext::security::insert_error::(ErrorCode::NoDataBTCRelay); + ext::security::set_parachain_status::(StatusCode::Error); + assert!(ext::security::_is_parachain_error_no_data_btcrelay::()); +} diff --git a/crates/collateral/Cargo.toml b/crates/collateral/Cargo.toml index 3778385dc3..41ad369ae3 100644 --- a/crates/collateral/Cargo.toml +++ b/crates/collateral/Cargo.toml @@ -4,38 +4,43 @@ description = 'Collateral module' edition = '2018' homepage = 'https://interlay.gitlab.io/polkabtc-spec/spec/collateral.html' name = 'collateral' -version = '0.1.0' +version = '2.0.0-alpha.7' + +[dependencies.serde] +version = '1.0.101' +features = ['derive'] +optional = true [dependencies.codec] default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.2.0' +version = '1.3.0' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dev-dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dev-dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dev-dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.pallet-balances] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.x-core] default-features = false @@ -44,6 +49,7 @@ path = '../x-core' [features] default = ['std'] std = [ + 'serde', 'codec/std', 'frame-support/std', 'system/std', diff --git a/crates/collateral/src/lib.rs b/crates/collateral/src/lib.rs index 1b04bdfa81..9347dae48b 100644 --- a/crates/collateral/src/lib.rs +++ b/crates/collateral/src/lib.rs @@ -80,6 +80,10 @@ impl Module { let new_collateral = Self::get_total_collateral() - amount; >::put(new_collateral); } + /// Balance of an account (wrapper) + pub fn get_balance_from_account(account: &T::AccountId) -> BalanceOf { + T::DOT::free_balance(account) + } /// Locked balance of account pub fn get_collateral_from_account(account: &T::AccountId) -> BalanceOf { T::DOT::reserved_balance(account) diff --git a/crates/collateral/src/mock.rs b/crates/collateral/src/mock.rs index 4c1cac09d4..aec8c448bb 100644 --- a/crates/collateral/src/mock.rs +++ b/crates/collateral/src/mock.rs @@ -1,6 +1,12 @@ /// Mocking the test environment use crate::{Module, Trait}; -use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight}; +use frame_support::{ + impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, +}; use pallet_balances as balances; use sp_core::H256; use sp_runtime::{ @@ -31,36 +37,43 @@ impl_outer_event! { pub type AccountId = u64; pub type Balance = u64; +pub type BlockNumber = u64; #[derive(Clone, Eq, PartialEq)] pub struct Test; + parameter_types! { pub const BlockHashCount: u64 = 250; pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } + impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; - type BlockNumber = u64; + type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; } + parameter_types! { pub const ExistentialDeposit: u64 = 1; } @@ -110,5 +123,8 @@ pub fn run_test(test: T) -> () where T: FnOnce() -> (), { - ExtBuilder::build().execute_with(test); + ExtBuilder::build().execute_with(|| { + System::set_block_number(1); + test(); + }); } diff --git a/crates/exchange-rate-oracle/Cargo.toml b/crates/exchange-rate-oracle/Cargo.toml index a1b1f078fb..31df78e252 100644 --- a/crates/exchange-rate-oracle/Cargo.toml +++ b/crates/exchange-rate-oracle/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "exchange-rate-oracle" -version = "0.1.0" +version = "2.0.0-alpha.7" authors = ["Interlay Ltd"] edition = "2018" @@ -32,42 +32,42 @@ optional = true default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.0.0' +version = '1.3.0' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.timestamp] default-features = false package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.pallet-balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.x-core] default-features = false diff --git a/crates/exchange-rate-oracle/src/lib.rs b/crates/exchange-rate-oracle/src/lib.rs index 6876d55106..02a1fc1014 100644 --- a/crates/exchange-rate-oracle/src/lib.rs +++ b/crates/exchange-rate-oracle/src/lib.rs @@ -67,6 +67,8 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { // Initializing events fn deposit_event() = default; + + #[weight = 1000] pub fn set_exchange_rate(origin, rate: u128) -> DispatchResult { // Check that Parachain is RUNNING ext::security::ensure_parachain_status_running::()?; @@ -163,7 +165,7 @@ impl Module { /// Returns true if the last update to the exchange rate /// was before the maximum allowed delay - fn is_max_delay_passed() -> Result { + pub fn is_max_delay_passed() -> Result { let timestamp = Self::get_current_time(); let last_update = Self::get_last_exchange_rate_time(); let max_delay = Self::get_max_delay(); diff --git a/crates/exchange-rate-oracle/src/mock.rs b/crates/exchange-rate-oracle/src/mock.rs index 29cb0990e1..e86a6f6a46 100644 --- a/crates/exchange-rate-oracle/src/mock.rs +++ b/crates/exchange-rate-oracle/src/mock.rs @@ -1,6 +1,12 @@ /// Mocking the test environment use crate::{GenesisConfig, Module, Trait}; -use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight}; +use frame_support::{ + impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, +}; use mocktopus::mocking::clear_mocks; use sp_core::H256; use sp_runtime::{ @@ -28,41 +34,49 @@ impl_outer_event! { } } +pub type AccountId = u64; +pub type Balance = u64; +pub type BlockNumber = u64; + // For testing the pallet, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. #[derive(Clone, Eq, PartialEq)] pub struct Test; + parameter_types! { pub const BlockHashCount: u64 = 250; pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } + impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; - type BlockNumber = u64; + type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; } pub type Balances = pallet_balances::Module; -pub type Balance = u64; impl Trait for Test { type Event = TestEvent; @@ -125,5 +139,8 @@ where T: FnOnce() -> (), { clear_mocks(); - ExtBuilder::build().execute_with(test); + ExtBuilder::build().execute_with(|| { + System::set_block_number(1); + test(); + }); } diff --git a/crates/issue/Cargo.toml b/crates/issue/Cargo.toml index 2801598cbd..5c271e196b 100644 --- a/crates/issue/Cargo.toml +++ b/crates/issue/Cargo.toml @@ -3,7 +3,7 @@ authors = ['Interlay'] description = 'Issue module' edition = '2018' name = 'issue' -version = '0.1.0' +version = '2.0.0-alpha.7' [dependencies.serde] version = '1.0.101' @@ -18,45 +18,37 @@ version = '1.3.0' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.pallet-balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' - -[dev-dependencies] -mocktopus = '0.7.0' - -[dev-dependencies.timestamp] -default-features = false -package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.vault-registry] @@ -67,10 +59,6 @@ path = '../vault-registry' default-features = false path = '../collateral' -[dev-dependencies.exchange-rate-oracle] -default-features = false -path = '../exchange-rate-oracle' - [dependencies.btc-relay] default-features = false path = '../btc-relay' @@ -94,12 +82,19 @@ path = '../security' [dependencies.timestamp] default-features = false package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sha2] default-features = false version = '0.8.0' +[dev-dependencies] +mocktopus = '0.7.0' + +[dev-dependencies.exchange-rate-oracle] +default-features = false +path = '../exchange-rate-oracle' + [features] default = ['std'] std = [ diff --git a/crates/issue/src/lib.rs b/crates/issue/src/lib.rs index 8bd9ff76ab..19a2d9a789 100644 --- a/crates/issue/src/lib.rs +++ b/crates/issue/src/lib.rs @@ -105,6 +105,7 @@ decl_module! { /// * `amount` - amount of PolkaBTC /// * `vault` - address of the vault /// * `griefing_collateral` - amount of DOT + #[weight = 1000] fn request_issue(origin, amount: PolkaBTC, vault_id: T::AccountId, griefing_collateral: DOT) -> DispatchResult { @@ -123,6 +124,7 @@ decl_module! { /// * `tx_block_height` - block number of backing chain /// * `merkle_proof` - raw bytes /// * `raw_tx` - raw bytes + #[weight = 1000] fn execute_issue(origin, issue_id: H256, tx_id: H256Le, tx_block_height: u32, merkle_proof: Vec, raw_tx: Vec) -> DispatchResult { @@ -137,6 +139,7 @@ decl_module! { /// /// * `origin` - sender of the transaction /// * `issue_id` - identifier of issue request as output from request_issue + #[weight = 1000] fn cancel_issue(origin, issue_id: H256) -> DispatchResult { diff --git a/crates/issue/src/mock.rs b/crates/issue/src/mock.rs index 85bec5786c..d350a9283f 100644 --- a/crates/issue/src/mock.rs +++ b/crates/issue/src/mock.rs @@ -1,7 +1,11 @@ /// Mocking the test environment use crate::{Module, Trait}; use frame_support::{ - assert_ok, impl_outer_event, impl_outer_origin, parameter_types, weights::Weight, + assert_ok, impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, }; use pallet_balances as balances; use sp_core::H256; @@ -53,25 +57,28 @@ parameter_types! { } impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; } parameter_types! { @@ -170,6 +177,7 @@ where clear_mocks(); ExtBuilder::build().execute_with(|| { assert_ok!(>::_set_exchange_rate(1)); + System::set_block_number(1); test(); }); } diff --git a/crates/redeem/Cargo.toml b/crates/redeem/Cargo.toml index 6be5840900..bd09ef0286 100644 --- a/crates/redeem/Cargo.toml +++ b/crates/redeem/Cargo.toml @@ -3,7 +3,7 @@ authors = ['Interlay'] description = 'Issue module' edition = '2018' name = 'redeem' -version = '0.1.0' +version = '2.0.0-alpha.7' [dependencies.serde] version = '1.0.101' @@ -18,45 +18,40 @@ version = '1.3.0' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.pallet-balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dev-dependencies] mocktopus = '0.7.0' -[dev-dependencies.timestamp] -default-features = false -package = 'pallet-timestamp' -version = '2.0.0-alpha.5' - [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.vault-registry] @@ -82,7 +77,6 @@ path = '../treasury' [dependencies.bitcoin] default-features = false path = '../bitcoin' -version = '0.1.0' [dependencies.x-core] default-features = false @@ -95,7 +89,7 @@ path = '../security' [dependencies.timestamp] default-features = false package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sha2] default-features = false @@ -116,6 +110,7 @@ std = [ 'primitive-types/std', 'vault-registry/std', 'collateral/std', + 'exchange-rate-oracle/std', 'btc-relay/std', 'treasury/std', 'bitcoin/std', diff --git a/crates/redeem/src/lib.rs b/crates/redeem/src/lib.rs index b37c25c5e7..12e1f6912d 100644 --- a/crates/redeem/src/lib.rs +++ b/crates/redeem/src/lib.rs @@ -86,6 +86,7 @@ decl_module! { /// * `amount` - amount of PolkaBTC /// * `btc_address` - the address to receive BTC /// * `vault` - address of the vault + #[weight = 1000] fn request_redeem(origin, amount_polka_btc: PolkaBTC, btc_address: H160, vault_id: T::AccountId) -> DispatchResult { @@ -175,6 +176,7 @@ decl_module! { /// * `tx_block_height` - block number of backing chain /// * `merkle_proof` - raw bytes /// * `raw_tx` - raw bytes + #[weight = 1000] fn execute_redeem(origin, redeem_id: H256, tx_id: H256Le, tx_block_height: u32, merkle_proof: Vec, raw_tx: Vec) -> DispatchResult { @@ -232,11 +234,13 @@ decl_module! { /// * `reimburse` - specifying if the user wishes to be reimbursed in DOT /// and slash the Vault, or wishes to keep the PolkaBTC (and retry /// Redeem with another Vault) + #[weight = 1000] fn cancel_redeem(origin, redeem_id: H256, reimburse: bool) -> DispatchResult { let redeemer = ensure_signed(origin)?; let redeem = Self::get_redeem_request_from_id(&redeem_id)?; + ensure!(redeemer == redeem.redeemer, Error::UnauthorizedUser); let height = >::block_number(); let period = Self::redeem_period(); diff --git a/crates/redeem/src/mock.rs b/crates/redeem/src/mock.rs index 82b60844e5..4beb77f92c 100644 --- a/crates/redeem/src/mock.rs +++ b/crates/redeem/src/mock.rs @@ -1,7 +1,11 @@ /// Mocking the test environment use crate::{Module, Trait}; use frame_support::{ - assert_ok, impl_outer_event, impl_outer_origin, parameter_types, weights::Weight, + assert_ok, impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, }; use pallet_balances as balances; use sp_core::H256; @@ -53,25 +57,28 @@ parameter_types! { } impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; } parameter_types! { @@ -166,6 +173,7 @@ where clear_mocks(); ExtBuilder::build().execute_with(|| { assert_ok!(>::_set_exchange_rate(1)); + System::set_block_number(1); test(); }); } diff --git a/crates/redeem/src/tests.rs b/crates/redeem/src/tests.rs index a2dd1e80e9..086a8a593c 100644 --- a/crates/redeem/src/tests.rs +++ b/crates/redeem/src/tests.rs @@ -3,7 +3,7 @@ use crate::mock::*; use crate::types::{PolkaBTC, Redeem as RedeemRequest, DOT}; use bitcoin::types::H256Le; -use frame_support::{assert_err, assert_ok}; +use frame_support::{assert_err, assert_noop, assert_ok}; use mocktopus::mocking::*; use primitive_types::H256; use sp_core::H160; @@ -126,8 +126,6 @@ fn test_request_redeem_fails_with_vault_not_found() { #[test] fn test_request_redeem_fails_with_vault_banned() { run_test(|| { - >::set_block_number(0); - ext::vault_registry::get_vault_from_id::.mock_safe(|_| { MockResult::Return(Ok(Vault { id: BOB, @@ -152,7 +150,6 @@ fn test_request_redeem_fails_with_vault_banned() { fn test_request_redeem_fails_with_amount_exceeds_vault_balance() { run_test(|| { ext::oracle::btc_to_dots::.mock_safe(|x| MockResult::Return(btcdot_parity(x))); - >::set_block_number(0); ext::vault_registry::get_vault_from_id::.mock_safe(|_| { MockResult::Return(Ok(Vault { id: BOB, @@ -183,7 +180,6 @@ fn test_request_redeem_fails_with_amount_exceeds_vault_balance() { fn test_request_redeem_succeeds_in_running_state() { run_test(|| { ext::oracle::btc_to_dots::.mock_safe(|x| MockResult::Return(btcdot_parity(x))); - >::set_block_number(0); >::_insert_vault( &BOB, vault_registry::Vault { @@ -235,7 +231,7 @@ fn test_request_redeem_succeeds_in_running_state() { Redeem::get_redeem_request_from_id(&H256([0; 32])), RedeemRequest { vault: BOB, - opentime: 0, + opentime: 1, amount_polka_btc: amount, amount_btc: amount, amount_dot: 0, @@ -270,7 +266,6 @@ fn test_request_redeem_succeeds_in_error_state() { Redeem::get_partial_redeem_factor.mock_safe(|| MockResult::Return(Ok(50_000))); ext::oracle::btc_to_dots::.mock_safe(|x| MockResult::Return(btcdot_parity(x))); - >::set_block_number(0); let redeemer = ALICE; let amount = 10 * 100_000_000; @@ -332,7 +327,7 @@ fn test_request_redeem_succeeds_in_error_state() { Redeem::get_redeem_request_from_id(&H256([0; 32])), RedeemRequest { vault: BOB, - opentime: 0, + opentime: 1, amount_polka_btc: amount, amount_btc: amount / 2, amount_dot: amount / 2, @@ -428,7 +423,7 @@ fn test_execute_redeem_fails_with_commit_period_expired() { fn test_execute_redeem_succeeds() { run_test(|| { ext::oracle::btc_to_dots::.mock_safe(|x| MockResult::Return(btcdot_parity(x))); - >::set_block_number(40); + System::set_block_number(40); >::_insert_vault( &BOB, vault_registry::Vault { @@ -502,7 +497,7 @@ fn test_cancel_redeem_fails_with_redeem_id_not_found() { #[test] fn test_cancel_redeem_fails_with_time_not_expired() { run_test(|| { - >::set_block_number(20); + System::set_block_number(20); Redeem::get_redeem_request_from_id.mock_safe(|_| { MockResult::Return(Ok(RedeemRequest { @@ -525,10 +520,33 @@ fn test_cancel_redeem_fails_with_time_not_expired() { } #[test] -fn test_cancel_redeem_succeeds() { +fn test_cancel_redeem_fails_with_unauthorized_caller() { run_test(|| { - >::set_block_number(0); + >::set_block_number(20); + + Redeem::get_redeem_request_from_id.mock_safe(|_| { + MockResult::Return(Ok(RedeemRequest { + vault: BOB, + opentime: 0, + amount_polka_btc: 0, + amount_btc: 0, + amount_dot: 0, + premium_dot: 0, + redeemer: ALICE, + btc_address: H160([0; 20]), + })) + }); + assert_noop!( + Redeem::cancel_redeem(Origin::signed(CAROL), H256([0u8; 32]), true), + Error::UnauthorizedUser + ); + }) +} + +#[test] +fn test_cancel_redeem_succeeds() { + run_test(|| { inject_redeem_request( H256([0u8; 32]), RedeemRequest { @@ -545,7 +563,7 @@ fn test_cancel_redeem_succeeds() { ext::vault_registry::ban_vault::.mock_safe(|vault, height| { assert_eq!(vault, BOB); - assert_eq!(height, 0); + assert_eq!(height, 1); MockResult::Return(Ok(())) }); diff --git a/crates/replace/Cargo.toml b/crates/replace/Cargo.toml index c2230bb863..2eb485d318 100644 --- a/crates/replace/Cargo.toml +++ b/crates/replace/Cargo.toml @@ -3,7 +3,7 @@ authors = ['Interlay'] description = 'Replace module' edition = '2018' name = 'replace' -version = '0.1.0' +version = '2.0.0-alpha.7' [dependencies.serde] version = '1.0.101' @@ -18,50 +18,43 @@ version = '1.3.0' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.pallet-balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' - -[dev-dependencies] -mocktopus = '0.7.0' +version = '2.0.0-alpha.7' [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.vault-registry] default-features = false path = '../vault-registry' -[dev-dependencies.exchange-rate-oracle] -default-features = false -path = '../exchange-rate-oracle' - [dependencies.collateral] default-features = false path = '../collateral' @@ -77,7 +70,6 @@ path = '../treasury' [dependencies.bitcoin] default-features = false path = '../bitcoin' -version = '0.1.0' [dependencies.x-core] default-features = false @@ -94,7 +86,14 @@ path = '../security' [dependencies.timestamp] default-features = false package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' + +[dev-dependencies] +mocktopus = '0.7.0' + +[dev-dependencies.exchange-rate-oracle] +default-features = false +path = '../exchange-rate-oracle' [features] default = ['std'] @@ -106,6 +105,7 @@ std = [ 'sp-io/std', 'sp-core/std', 'system/std', + 'pallet-balances/std', 'sp-std/std', 'primitive-types/std', 'vault-registry/std', diff --git a/crates/replace/src/lib.rs b/crates/replace/src/lib.rs index 967dd065a1..4c89162f1e 100644 --- a/crates/replace/src/lib.rs +++ b/crates/replace/src/lib.rs @@ -85,6 +85,7 @@ decl_module! { /// * `origin` - sender of the transaction /// * `amount` - amount of PolkaBTC /// * `griefing_collateral` - amount of DOT + #[weight = 1000] fn request_replace(origin, amount: PolkaBTC, griefing_collateral: DOT) -> DispatchResult { @@ -99,6 +100,7 @@ decl_module! { /// /// * `origin` - sender of the transaction: the old vault /// * `replace_id` - the unique identifier of the replace request + #[weight = 1000] fn withdraw_replace(origin, replace_id: H256) -> DispatchResult { @@ -114,6 +116,7 @@ decl_module! { /// * `origin` - the initiator of the transaction: the new vault /// * `replace_id` - the unique identifier for the specific request /// * `collateral` - the collateral for replacement + #[weight = 1000] fn accept_replace(origin, replace_id: H256, collateral: DOT) -> DispatchResult { @@ -130,6 +133,7 @@ decl_module! { /// * `old_vault` - the old vault of the replacement request /// * `btc_amount` - the btc amount to be transferred over from old to new /// * `collateral` - the collateral to be transferred over from old to new + #[weight = 1000] fn auction_replace(origin, old_vault: T::AccountId, btc_amount: PolkaBTC, collateral: DOT) -> DispatchResult { @@ -148,6 +152,7 @@ decl_module! { /// * `tx_block_height` - the blocked height of the backing transaction /// * 'merkle_proof' - the merkle root of the block /// * `raw_tx` - the transaction id in bytes + #[weight = 1000] fn execute_replace(origin, replace_id: H256, tx_id: H256Le, tx_block_height: u32, merkle_proof: Vec, raw_tx: Vec) -> DispatchResult { let new_vault = ensure_signed(origin)?; Self::_execute_replace(new_vault, replace_id, tx_id, tx_block_height, merkle_proof, raw_tx)?; @@ -160,6 +165,7 @@ decl_module! { /// /// * `origin` - sender of the transaction: the new vault /// * `replace_id` - the ID of the replacement request + #[weight = 1000] fn cancel_replace(origin, replace_id: H256) -> DispatchResult { let new_vault = ensure_signed(origin)?; Self::_cancel_replace(new_vault, replace_id)?; diff --git a/crates/replace/src/mock.rs b/crates/replace/src/mock.rs index bdba658607..3f840008f9 100644 --- a/crates/replace/src/mock.rs +++ b/crates/replace/src/mock.rs @@ -1,7 +1,11 @@ /// Mocking the test environment use crate::{Module, Trait}; use frame_support::{ - assert_ok, impl_outer_event, impl_outer_origin, parameter_types, weights::Weight, + assert_ok, impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, }; use pallet_balances as balances; use sp_core::H256; @@ -53,25 +57,28 @@ parameter_types! { } impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; } parameter_types! { @@ -166,6 +173,7 @@ where clear_mocks(); ExtBuilder::build().execute_with(|| { assert_ok!(>::_set_exchange_rate(1)); + System::set_block_number(1); test(); }); } diff --git a/crates/security/Cargo.toml b/crates/security/Cargo.toml index 80b8005569..289d651fc0 100644 --- a/crates/security/Cargo.toml +++ b/crates/security/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "security" -version = "0.1.0" +version = "2.0.0-alpha.7" authors = ["Interlay Ltd"] edition = "2018" @@ -13,45 +13,45 @@ version = '1.0.101' default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.0.0' +version = '1.3.0' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.sha2] default-features = false version = '0.8.0' -[dev-dependencies.sp-runtime] +[dependencies.x-core] default-features = false -version = '2.0.0-alpha.5' +path = '../x-core' -[dev-dependencies.sp-io] +[dev-dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' -[dependencies.x-core] +[dev-dependencies.sp-io] default-features = false -path = '../x-core' +version = '2.0.0-alpha.7' [dev-dependencies] mocktopus = '0.7.0' diff --git a/crates/security/src/mock.rs b/crates/security/src/mock.rs index d9738aec9a..fcac052c97 100644 --- a/crates/security/src/mock.rs +++ b/crates/security/src/mock.rs @@ -1,6 +1,13 @@ /// Mocking the test environment use crate::{Module, Trait}; -use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight}; +use frame_support::{ + impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, +}; +use mocktopus::mocking::clear_mocks; use sp_core::H256; use sp_io; use sp_runtime::{ @@ -9,8 +16,6 @@ use sp_runtime::{ Perbill, }; -use mocktopus::mocking::clear_mocks; - impl_outer_origin! { pub enum Origin for Test {} } @@ -42,26 +47,30 @@ parameter_types! { pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } + impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = (); type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = (); } impl Trait for Test { @@ -88,5 +97,8 @@ where T: FnOnce() -> (), { clear_mocks(); - ExtBuilder::build().execute_with(test); + ExtBuilder::build().execute_with(|| { + System::set_block_number(1); + test(); + }); } diff --git a/crates/staked-relayers/Cargo.toml b/crates/staked-relayers/Cargo.toml index 7ac0ce9d75..b0e39a21e7 100644 --- a/crates/staked-relayers/Cargo.toml +++ b/crates/staked-relayers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "staked-relayers" -version = "0.1.0" +version = "2.0.0-alpha.7" authors = ["Interlay Ltd"] edition = "2018" @@ -13,47 +13,46 @@ version = '1.0.101' default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.0.0' +version = '1.3.0' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.timestamp] default-features = false package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.bitcoin] default-features = false path = '../bitcoin' -version = '0.1.0' [dependencies.collateral] default-features = false @@ -95,13 +94,18 @@ path = '../replace' default-features = false version = '0.8.0' +[dependencies.hex] +default-features = false +version = '0.4.2' + [dev-dependencies.balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dev-dependencies] mocktopus = '0.7.0' +hex = '0.4.2' [features] default = ['std'] @@ -116,6 +120,7 @@ std = [ 'sp-core/std', 'sp-std/std', 'primitive-types/std', + 'bitcoin/std', 'collateral/std', 'vault-registry/std', 'security/std', diff --git a/crates/staked-relayers/src/ext.rs b/crates/staked-relayers/src/ext.rs index 33089bdc6c..6d8f1f1056 100644 --- a/crates/staked-relayers/src/ext.rs +++ b/crates/staked-relayers/src/ext.rs @@ -41,9 +41,7 @@ pub(crate) mod oracle { use x_core::Result; pub(crate) fn is_max_delay_passed() -> Result { - // FIXME - // >::is_max_delay_passed() - Ok(true) + >::is_max_delay_passed() } pub fn btc_to_dots(amount: PolkaBTC) -> Result> { @@ -63,8 +61,7 @@ pub(crate) mod vault_registry { } pub fn get_liquidation_collateral_threshold() -> u128 { - // FIXME: add function to vault registry - 110000 + >::_get_liquidation_collateral_threshold() } pub fn liquidate_vault(vault_id: &T::AccountId) -> UnitResult { @@ -104,6 +101,7 @@ pub(crate) mod security { pub(crate) mod btc_relay { use bitcoin::types::H256Le; use security::types::ErrorCode; + use sp_std::prelude::*; use x_core::UnitResult; pub(crate) fn flag_block_error( @@ -119,6 +117,20 @@ pub(crate) mod btc_relay { ) -> UnitResult { >::clear_block_error(block_hash, error) } + + pub(crate) fn verify_transaction_inclusion( + tx_id: H256Le, + block_height: u32, + raw_merkle_proof: Vec, + ) -> UnitResult { + >::_verify_transaction_inclusion( + tx_id, + block_height, + raw_merkle_proof, + 0, + false, + ) + } } #[cfg_attr(test, mockable)] diff --git a/crates/staked-relayers/src/lib.rs b/crates/staked-relayers/src/lib.rs index 7201bae6c4..23ff11b6c2 100644 --- a/crates/staked-relayers/src/lib.rs +++ b/crates/staked-relayers/src/lib.rs @@ -20,20 +20,21 @@ use mocktopus::macros::mockable; pub use security; use crate::types::{ - ActiveStakedRelayer, InactiveStakedRelayer, ProposalStatus, StakedRelayerStatus, StatusUpdate, - Tally, DOT, + ActiveStakedRelayer, InactiveStakedRelayer, PolkaBTC, ProposalStatus, StakedRelayerStatus, + StatusUpdate, Tally, DOT, }; use bitcoin::parser::parse_transaction; use bitcoin::types::*; -/// # Security module implementation -/// This is the implementation of the BTC Parachain Security module following the spec at: -/// https://interlay.gitlab.io/polkabtc-spec/spec/security +/// # Staked Relayers module implementation +/// This is the implementation of the BTC Parachain Staked Relayers module following the spec at: +/// https://interlay.gitlab.io/polkabtc-spec/spec/staked-relayers.html /// use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::{DispatchError, DispatchResult}, ensure, traits::Get, + weights::Weight, IterableStorageMap, }; use primitive_types::H256; @@ -117,24 +118,13 @@ decl_module! { fn deposit_event() = default; - fn on_initialize(n: T::BlockNumber) { - if let Err(e) = Self::begin_block(n) { - sp_runtime::print(e); - } - } - - fn on_finalize(_n: T::BlockNumber) { - if let Err(e) = Self::end_block() { - sp_runtime::print(e); - } - } - /// Registers a new Staked Relayer, locking the provided collateral, which must exceed `STAKED_RELAYER_STAKE`. /// /// # Arguments /// /// * `origin`: The account of the Staked Relayer to be registered /// * `stake`: to-be-locked collateral/stake in DOT + #[weight = 1000] fn register_staked_relayer(origin, stake: DOT) -> DispatchResult { let signer = ensure_signed(origin)?; @@ -166,6 +156,7 @@ decl_module! { /// # Arguments /// /// * `origin`: The account of the Staked Relayer to be deregistered + #[weight = 1000] fn deregister_staked_relayer(origin) -> DispatchResult { let signer = ensure_signed(origin)?; let staked_relayer = Self::get_active_staked_relayer(&signer)?; @@ -181,6 +172,7 @@ decl_module! { /// # Arguments /// /// * `origin`: The account of the Staked Relayer to be activated + #[weight = 1000] fn activate_staked_relayer(origin) -> DispatchResult { let signer = ensure_signed(origin)?; let staked_relayer = Self::get_inactive_staked_relayer(&signer)?; @@ -204,6 +196,7 @@ decl_module! { /// # Arguments /// /// * `origin`: The account of the Staked Relayer to be deactivated + #[weight = 1000] fn deactivate_staked_relayer(origin) -> DispatchResult { let signer = ensure_signed(origin)?; let staked_relayer = Self::get_active_staked_relayer(&signer)?; @@ -221,6 +214,7 @@ decl_module! { /// * `add_error`: If the suggested status is Error, this set of ErrorCode indicates which error is to be added to the Errors mapping. /// * `remove_error`: ErrorCode to be removed from the Errors list. /// * `block_hash`: [Optional] When reporting an error related to BTC-Relay, this field indicates the affected Bitcoin block (header). + #[weight = 1000] fn suggest_status_update(origin, deposit: DOT, status_code: StatusCode, add_error: Option, remove_error: Option, block_hash: Option) -> DispatchResult { let signer = ensure_signed(origin)?; @@ -269,6 +263,7 @@ decl_module! { /// * `origin`: The AccountId of the Staked Relayer casting the vote. /// * `status_update_id`: Identifier of the `StatusUpdate` voted upon in `StatusUpdates`. /// * `approve`: `True` or `False`, depending on whether the Staked Relayer agrees or disagrees with the suggested `StatusUpdate`. + #[weight = 1000] fn vote_on_status_update(origin, status_update_id: U256, approve: bool) -> DispatchResult { let signer = ensure_signed(origin)?; @@ -296,6 +291,7 @@ decl_module! { /// * `origin`: The AccountId of the Governance Mechanism. /// * `status_code`: Suggested BTC Parachain status (`StatusCode` enum). /// * `errors`: If the suggested status is `Error`, this set of `ErrorCode` entries provides details on the occurred errors. + #[weight = 1000] fn force_status_update(origin, status_code: StatusCode, add_error: Option, remove_error: Option) -> DispatchResult { let signer = ensure_signed(origin)?; Self::only_governance(&signer)?; @@ -327,6 +323,7 @@ decl_module! { /// /// * `origin`: The AccountId of the Governance Mechanism. /// * `staked_relayer_id`: The account of the Staked Relayer to be slashed. + #[weight = 1000] fn slash_staked_relayer(origin, staked_relayer_id: T::AccountId) -> DispatchResult { let signer = ensure_signed(origin)?; Self::only_governance(&signer)?; @@ -341,21 +338,41 @@ decl_module! { Ok(()) } + /// Helper function to check whether a given raw tx is invalid, + /// thus a reportable offense. + /// + /// # Arguments + /// + /// * `origin`: Any signed user. + /// * `vault_id`: The account of the vault to check. + /// * `raw_tx`: The raw Bitcoin transaction. + #[weight = 1000] + fn check_invalid_transaction(origin, vault_id: T::AccountId, raw_tx: Vec) -> DispatchResult { + ensure_signed(origin)?; + Self::_check_invalid_transaction(&vault_id, raw_tx) + } + + /// A Staked Relayer reports misbehavior by a Vault, providing a fraud proof /// (malicious Bitcoin transaction and the corresponding transaction inclusion proof). /// /// # Arguments /// - /// * `origin`: The AccountId of the Governance Mechanism. - /// * `staked_relayer_id`: The account of the Staked Relayer to be slashed. - fn report_vault_theft(origin, vault_id: T::AccountId, tx_id: H256Le, _tx_block_height: U256, _tx_index: u64, _merkle_proof: Vec, raw_tx: Vec) -> DispatchResult { + /// * `origin`: Any signed user. + /// * `vault_id`: The account of the vault to check. + /// * `tx_id`: The hash of the transaction + /// * `tx_block_height`: Height rogue tx was included. + /// * `merkle_proof`: The proof of tx inclusion. + /// * `raw_tx`: The raw Bitcoin transaction. + #[weight = 1000] + fn report_vault_theft(origin, vault_id: T::AccountId, tx_id: H256Le, tx_block_height: u32, merkle_proof: Vec, raw_tx: Vec) -> DispatchResult { let signer = ensure_signed(origin)?; ensure!( Self::check_relayer_registered(&signer), Error::::StakedRelayersOnly, ); - let vault = ext::vault_registry::get_vault_from_id::(&vault_id)?; + // liquidated vaults are removed, so no need for check here // throw if already reported if >::contains_key(&tx_id) { @@ -365,44 +382,9 @@ decl_module! { ); } - let tx = parse_transaction(raw_tx.as_slice())?; - // only check if correct format - if tx.outputs.len() <= 2 { - let out = &tx.outputs[0]; - // check if migration - if let Ok(out_addr) = out.script.extract_address() { - ensure!(H160::from_slice(&out_addr) != vault.btc_address, Error::::ValidMergeTransaction); - let out_val = out.value; - if tx.outputs.len() == 2 { - let out = &tx.outputs[1]; - // check if redeem / replace - if let Ok(out_ret) = out.script.extract_op_return_data() { - let id = H256::from_slice(&out_ret); - let addr = H160::from_slice(&out_addr); - match ext::redeem::get_redeem_request_from_id::(&id) { - Ok(req) => { - let amount = TryInto::::try_into(req.amount_btc).map_err(|_e| Error::::RuntimeError)? as i64; - ensure!( - out_val < amount && addr != req.btc_address, - Error::::ValidRedeemOrReplace - ) - }, - Err(_) => (), - } - match ext::replace::get_replace_request::(&id) { - Ok(req) => { - let amount = TryInto::::try_into(req.amount).map_err(|_e| Error::::RuntimeError)? as i64; - ensure!( - out_val < amount && addr != req.btc_address, - Error::::ValidRedeemOrReplace - ) - }, - Err(_) => (), - } - } - } - } - } + ext::btc_relay::verify_transaction_inclusion::(tx_id, tx_block_height, merkle_proof)?; + Self::_check_invalid_transaction(&vault_id, raw_tx)?; + ext::vault_registry::liquidate_vault::(&vault_id)?; ext::security::set_parachain_status::(StatusCode::Error); ext::security::mutate_errors::(|errors| { @@ -410,6 +392,10 @@ decl_module! { Ok(()) })?; + >::mutate(&tx_id, |reports| { + reports.insert(vault_id); + }); + Self::deposit_event(>::ExecuteStatusUpdate( StatusCode::Error, Some(ErrorCode::Liquidation), @@ -419,9 +405,9 @@ decl_module! { Ok(()) } - /// A Staked Relayer reports that a Vault is undercollateralized (i.e. below the LiquidationCollateralThreshold as defined in Vault Registry). /// If the collateral falls below this rate, we flag the Vault for liquidation and update the ParachainStatus to ERROR - adding LIQUIDATION to Errors. + #[weight = 1000] fn report_vault_under_liquidation_threshold(origin, vault_id: T::AccountId) -> DispatchResult { let signer = ensure_signed(origin)?; ensure!( @@ -479,6 +465,7 @@ decl_module! { /// A Staked Relayer reports that the Exchange Rate Oracle is offline. This function checks if the last exchange /// rate data in the Exchange Rate Oracle is indeed older than the indicated threshold. + #[weight = 1000] fn report_oracle_offline(origin) -> DispatchResult { let signer = ensure_signed(origin)?; ensure!( @@ -505,6 +492,19 @@ decl_module! { Ok(()) } + + fn on_initialize(n: T::BlockNumber) -> Weight { + if let Err(e) = Self::begin_block(n) { + sp_runtime::print(e); + } + 0 + } + + fn on_finalize(_n: T::BlockNumber) { + if let Err(e) = Self::end_block() { + sp_runtime::print(e); + } + } } } @@ -873,6 +873,146 @@ impl Module { Ok(()) } + /// Checks if the vault is doing a valid merge transaction to move funds between + /// addresses. + pub(crate) fn is_valid_merge_transaction(tx: &Transaction, vault_addr: H160) -> bool { + for out in &tx.outputs { + // return if address not extractable (i.e. op_return) + let out_addr = match out.extract_address() { + Ok(addr) => addr, + Err(_) => return false, + }; + if H160::from_slice(&out_addr) != vault_addr { + return false; + } + } + return true; + } + + /// Checks if the vault is sending a valid request transaction. + pub(crate) fn is_valid_request_transaction( + tx: &Transaction, + out_val: i64, + exp_val: PolkaBTC, + out_addr: H160, + req_addr: H160, + vault_addr: H160, + ) -> Result { + let value = + TryInto::::try_into(exp_val).map_err(|_e| Error::::RuntimeError)? as i64; + + // tx here should only have at most three outputs + if out_val >= value && out_addr == req_addr { + if tx.outputs.len() == 3 { + let out = &tx.outputs[2]; + if let Ok(vault_out_addr) = out.extract_address() { + return Ok(H160::from_slice(&vault_out_addr) == vault_addr); + } + return Ok(false); + } + return Ok(true); + } + // invalid if insufficient amount or wrong payout addr + return Ok(false); + } + + /// Check if a vault transaction is invalid. Returns Ok() if invalid and Err otherwise. + /// + /// # Arguments + /// + /// `vault_id`: the vault. + /// `raw_tx`: the BTC transaction by the vault. + pub(crate) fn _check_invalid_transaction( + vault_id: &T::AccountId, + raw_tx: Vec, + ) -> DispatchResult { + let vault = ext::vault_registry::get_vault_from_id::(vault_id)?; + + let tx = parse_transaction(raw_tx.as_slice())?; + + // collect all addresses that feature in the inputs of the transaction + let input_addresses: Vec, _>> = tx + .clone() + .inputs + .into_iter() + .map(|input| input.extract_address()) + .collect(); + + // check if vault's btc address features in an input of the transaction + ensure!( + input_addresses.into_iter().any(|address_result| { + match address_result { + Ok(address) => H160::from_slice(&address) == vault.btc_address, + _ => false, + } + }), + Error::::VaultNoInputToTransaction + ); + + // check if the transaction is a "migration" + ensure!( + !Self::is_valid_merge_transaction(&tx, vault.btc_address), + Error::::ValidMergeTransaction + ); + + // only check if correct format + if tx.outputs.len() > 3 { + return Ok(()); + } + + // Vaults are required to move funds for redeem and replace operations. + // Each transaction MUST contain either two or three outputs as follows: + // 1) recipient: the first output is the recipient of the redeem/replace + // 2) op_return: the second output is the associated ID encoded in the OP_RETURN + // 3) vault: the third output is any "spare change" the vault is transferring + + let out = &tx.outputs[0]; + if let Ok(out_addr) = out.extract_address() { + let out_val = out.value; + if tx.outputs.len() == 2 || tx.outputs.len() == 3 { + let out = &tx.outputs[1]; + // check if redeem / replace + if let Ok(out_ret) = out.script.extract_op_return_data() { + let id = H256::from_slice(&out_ret); + let addr = H160::from_slice(&out_addr); + match ext::redeem::get_redeem_request_from_id::(&id) { + Ok(req) => { + ensure!( + !Self::is_valid_request_transaction( + &tx, + out_val, + req.amount_btc, + addr, + req.btc_address, + vault.btc_address, + )?, + Error::::ValidRedeemTransaction + ); + } + Err(_) => (), + } + match ext::replace::get_replace_request::(&id) { + Ok(req) => { + ensure!( + !Self::is_valid_request_transaction( + &tx, + out_val, + req.amount, + addr, + req.btc_address, + vault.btc_address, + )?, + Error::::ValidReplaceTransaction + ); + } + Err(_) => (), + } + } + } + } + Ok(()) + } + /// Increments the current `StatusCounter` and returns the new value. pub fn get_status_counter() -> U256 { ::mutate(|c| { @@ -925,7 +1065,9 @@ decl_error! { VoteAlreadyCast, VaultAlreadyReported, VaultAlreadyLiquidated, - ValidRedeemOrReplace, + VaultNoInputToTransaction, + ValidRedeemTransaction, + ValidReplaceTransaction, ValidMergeTransaction, OracleOnline, NoBlockHash, diff --git a/crates/staked-relayers/src/mock.rs b/crates/staked-relayers/src/mock.rs index 8adede38bd..6d88b2c2af 100644 --- a/crates/staked-relayers/src/mock.rs +++ b/crates/staked-relayers/src/mock.rs @@ -1,6 +1,12 @@ /// Mocking the test environment use crate::{Error, GenesisConfig, Module, Trait}; -use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight}; +use frame_support::{ + impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, +}; use sp_core::H256; use sp_io; use sp_runtime::{ @@ -52,26 +58,30 @@ parameter_types! { pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } + impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = balances::AccountData; } parameter_types! { @@ -195,5 +205,8 @@ where T: FnOnce() -> (), { clear_mocks(); - ExtBuilder::build().execute_with(test); + ExtBuilder::build().execute_with(|| { + System::set_block_number(1); + test(); + }); } diff --git a/crates/staked-relayers/src/tests.rs b/crates/staked-relayers/src/tests.rs index edaeb82039..d370c59c79 100644 --- a/crates/staked-relayers/src/tests.rs +++ b/crates/staked-relayers/src/tests.rs @@ -1,15 +1,21 @@ +extern crate hex; use crate::types::{ ActiveStakedRelayer, InactiveStakedRelayer, ProposalStatus, StakedRelayerStatus, StatusUpdate, Tally, }; use crate::{ext, mock::*}; -use bitcoin::types::H256Le; +use bitcoin::formatter::Formattable; +use bitcoin::types::{ + Address, H256Le, TransactionBuilder, TransactionInputBuilder, TransactionOutput, +}; use frame_support::{assert_err, assert_ok}; use mocktopus::mocking::*; +use redeem::types::Redeem; +use replace::types::Replace; use security::types::{ErrorCode, StatusCode}; -use sp_core::U256; +use sp_core::{H160, H256, U256}; use sp_std::collections::btree_set::BTreeSet; - +use std::convert::TryInto; use vault_registry::Vault; type Event = crate::Event; @@ -39,9 +45,16 @@ macro_rules! assert_not_emitted { } /// Mocking functions -fn init_zero_vault(id: AccountId) -> Vault { +fn init_zero_vault( + id: AccountId, + btc_address: Option, +) -> Vault { let mut vault = Vault::default(); vault.id = id; + match btc_address { + Some(btc_address) => vault.btc_address = btc_address, + None => {} + } vault } @@ -66,10 +79,9 @@ fn test_register_staked_relayer_succeeds() { let amount: Balance = 20; ext::collateral::lock_collateral::.mock_safe(|_, _| MockResult::Return(Ok(()))); - System::set_block_number(0); assert_ok!(Staking::register_staked_relayer(relayer.clone(), amount)); - assert_emitted!(Event::RegisterStakedRelayer(ALICE, 10, amount)); + assert_emitted!(Event::RegisterStakedRelayer(ALICE, 11, amount)); // re-registration not allowed assert_err!( @@ -86,12 +98,12 @@ fn test_register_staked_relayer_succeeds() { Staking::get_inactive_staked_relayer(&ALICE), InactiveStakedRelayer { stake: amount, - status: StakedRelayerStatus::Bonding(10) + status: StakedRelayerStatus::Bonding(11) } ); assert_err!( - Staking::try_bond_staked_relayer(&ALICE, amount, 0, 10), + Staking::try_bond_staked_relayer(&ALICE, amount, 0, 11), TestError::NotMatured ); assert_err!( @@ -685,7 +697,6 @@ fn test_report_vault_theft_fails_with_staked_relayers_only() { Origin::signed(ALICE), CAROL, H256Le::zero(), - U256::from(0), 0, vec![0u8; 32], vec![0u8; 32] @@ -695,21 +706,139 @@ fn test_report_vault_theft_fails_with_staked_relayers_only() { }) } -// #[test] -// fn test_report_vault_theft_succeeds() { -// run_test(|| { -// let relayer = Origin::signed(ALICE); -// let amount: Balance = 3; -// inject_active_staked_relayer(&ALICE, amount); +#[test] +fn test_report_vault_passes_with_vault_transaction() { + run_test(|| { + let raw_tx = "0100000001c15041a06deb6b3818b022fac558da4ce2097f0860c8f642105bbad9d29be02a010000006c493046022100cfd2a2d332b29adce119c55a9fadd3c073332024b7e272513e51623ca15993480221009b482d7f7b4d479aff62bdcdaea54667737d56f8d4d63dd03ec3ef651ed9a25401210325f8b039a11861659c9bf03f43fc4ea055f3a71cd60c7b1fd474ab578f9977faffffffff0290d94000000000001976a9148ed243a7be26080a1a8cf96b53270665f1b8dd2388ac4083086b000000001976a9147e7d94d0ddc21d83bfbcfc7798e4547edf0832aa88ac00000000"; + + let amount = 3; + inject_active_staked_relayer(&ALICE, amount); + let vault = CAROL; + + let btc_address = H160::from_slice(&[ + 126, 125, 148, 208, 221, 194, 29, 131, 191, 188, 252, 119, 152, 228, 84, 126, 223, 8, + 50, 170, + ]); + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::( + vault.clone(), + Some(btc_address), + ))) + }); + ext::btc_relay::verify_transaction_inclusion:: + .mock_safe(move |_, _, _| MockResult::Return(Ok(()))); + ext::vault_registry::liquidate_vault::.mock_safe(|_| MockResult::Return(Ok(()))); + + assert_ok!(Staking::report_vault_theft( + Origin::signed(ALICE), + CAROL, + H256Le::zero(), + 0, + vec![0u8; 32], + hex::decode(&raw_tx).unwrap() + ),); + }) +} + +#[test] +fn test_report_vault_fails_with_nonvault_transaction() { + run_test(|| { + let raw_tx = "0100000001c15041a06deb6b3818b022fac558da4ce2097f0860c8f642105bbad9d29be02a010000006c493046022100cfd2a2d332b29adce119c55a9fadd3c073332024b7e272513e51623ca15993480221009b482d7f7b4d479aff62bdcdaea54667737d56f8d4d63dd03ec3ef651ed9a25401210325f8b039a11861659c9bf03f43fc4ea055f3a71cd60c7b1fd474ab578f9977faffffffff0290d94000000000001976a9148ed243a7be26080a1a8cf96b53270665f1b8dd2388ac4083086b000000001976a9147e7d94d0ddc21d83bfbcfc7798e4547edf0832aa88ac00000000"; + + let amount = 3; + inject_active_staked_relayer(&ALICE, amount); + let vault = CAROL; + + let btc_address = H160::from_slice(&[ + 125, 125, 148, 208, 221, 194, 29, 131, 191, 188, 252, 119, 152, 228, 84, 126, 223, 8, + 50, 170, + ]); + + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::( + vault.clone(), + Some(btc_address), + ))) + }); + ext::btc_relay::verify_transaction_inclusion:: + .mock_safe(move |_, _, _| MockResult::Return(Ok(()))); + ext::vault_registry::liquidate_vault::.mock_safe(|_| MockResult::Return(Ok(()))); + + assert_err!( + Staking::report_vault_theft( + Origin::signed(ALICE), + CAROL, + H256Le::zero(), + 0, + vec![0u8; 32], + hex::decode(&raw_tx).unwrap() + ), + TestError::VaultNoInputToTransaction + ); + }) +} + +#[test] +fn test_report_vault_succeeds_with_segwit_transaction() { + run_test(|| { + let raw_tx = "0200000000010140d43a99926d43eb0e619bf0b3d83b4a31f60c176beecfb9d35bf45e54d0f7420100000017160014a4b4ca48de0b3fffc15404a1acdc8dbaae226955ffffffff0100e1f5050000000017a9144a1154d50b03292b3024370901711946cb7cccc387024830450221008604ef8f6d8afa892dee0f31259b6ce02dd70c545cfcfed8148179971876c54a022076d771d6e91bed212783c9b06e0de600fab2d518fad6f15a2b191d7fbd262a3e0121039d25ab79f41f75ceaf882411fd41fa670a4c672c23ffaf0e361a969cde0692e800000000"; + + let amount = 3; + inject_active_staked_relayer(&ALICE, amount); + let vault = CAROL; + + let btc_address = H160::from_slice(&[ + 164, 180, 202, 72, 222, 11, 63, 255, 193, 84, 4, 161, 172, 220, 141, 186, 174, 34, 105, + 85, + ]); + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::( + vault.clone(), + Some(btc_address), + ))) + }); + ext::btc_relay::verify_transaction_inclusion:: + .mock_safe(move |_, _, _| MockResult::Return(Ok(()))); + ext::vault_registry::liquidate_vault::.mock_safe(|_| MockResult::Return(Ok(()))); + + assert_ok!(Staking::report_vault_theft( + Origin::signed(ALICE), + CAROL, + H256Le::zero(), + 0, + vec![0u8; 32], + hex::decode(&raw_tx).unwrap() + )); + }) +} + +#[test] +fn test_report_vault_theft_succeeds() { + run_test(|| { + let relayer = Origin::signed(ALICE); + let amount: Balance = 3; + inject_active_staked_relayer(&ALICE, amount); -// assert_ok!(Staking::report_vault_theft(relayer)); -// assert_emitted!(Event::ExecuteStatusUpdate( -// StatusCode::Error, -// Some(ErrorCode::Liquidation), -// None, -// )); -// }) -// } + ext::btc_relay::verify_transaction_inclusion:: + .mock_safe(move |_, _, _| MockResult::Return(Ok(()))); + Staking::_check_invalid_transaction.mock_safe(move |_, _| MockResult::Return(Ok(()))); + ext::vault_registry::liquidate_vault::.mock_safe(move |_| MockResult::Return(Ok(()))); + + assert_ok!(Staking::report_vault_theft( + relayer, + BOB, + H256Le::zero(), + 0, + vec![0u8; 32], + vec![0u8; 32], + )); + assert_emitted!(Event::ExecuteStatusUpdate( + StatusCode::Error, + Some(ErrorCode::Liquidation), + None, + )); + }) +} #[test] fn test_report_vault_under_liquidation_threshold_succeeds() { @@ -722,8 +851,9 @@ fn test_report_vault_under_liquidation_threshold_succeeds() { Staking::check_relayer_registered.mock_safe(|_| MockResult::Return(true)); - ext::vault_registry::get_vault_from_id:: - .mock_safe(move |_| MockResult::Return(Ok(init_zero_vault::(vault.clone())))); + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::(vault.clone(), None))) + }); ext::collateral::get_collateral_from_account:: .mock_safe(move |_| MockResult::Return(collateral_in_dot.clone())); @@ -806,6 +936,357 @@ fn test_report_oracle_offline_succeeds() { }) } +#[test] +fn test_is_valid_merge_transaction_fails() { + run_test(|| { + let vault = BOB; + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::(vault.clone(), None))) + }); + + let address1: Address = "66c7060feb882664ae62ffad0051fe843e318e85" + .try_into() + .unwrap(); + + let address2: Address = "5f69790b72c98041330644bbd50f2ebb5d073c36" + .try_into() + .unwrap(); + + let transaction = TransactionBuilder::new() + .with_version(1) + .add_input( + TransactionInputBuilder::new() + .with_coinbase(true) + .with_height(&vec![0, 0, 0, 0]) + .with_previous_index(u32::max_value()) + .build(), + ) + .add_output(TransactionOutput::p2pkh(100, &address1)) + .build(); + + assert_eq!( + Staking::is_valid_merge_transaction( + &transaction, + H160::from_slice(address2.as_bytes()) + ), + false + ); + }) +} + +#[test] +fn test_is_valid_merge_transaction_succeeds() { + run_test(|| { + let vault = BOB; + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::(vault.clone(), None))) + }); + + let address: Address = "66c7060feb882664ae62ffad0051fe843e318e85" + .try_into() + .unwrap(); + + let transaction = TransactionBuilder::new() + .with_version(1) + .add_input( + TransactionInputBuilder::new() + .with_coinbase(true) + .with_height(&vec![0, 0, 0, 0]) + .with_previous_index(u32::max_value()) + .build(), + ) + .add_output(TransactionOutput::p2pkh(100, &address)) + .build(); + + assert_eq!( + Staking::is_valid_merge_transaction(&transaction, H160::from_slice(address.as_bytes())), + true + ); + }) +} + +#[test] +fn test_is_valid_request_transaction_fails() { + run_test(|| { + let vault = BOB; + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::(vault.clone(), None))) + }); + + let address1: Address = "66c7060feb882664ae62ffad0051fe843e318e85" + .try_into() + .unwrap(); + + let address2: Address = "5f69790b72c98041330644bbd50f2ebb5d073c36" + .try_into() + .unwrap(); + + let transaction = TransactionBuilder::new() + .with_version(1) + .add_input( + TransactionInputBuilder::new() + .with_coinbase(true) + .with_previous_index(u32::max_value()) + .build(), + ) + .add_output(TransactionOutput::p2pkh(100, &address1)) + .build(); + + assert_eq!( + Staking::is_valid_request_transaction( + &transaction, + 50, + 100, + H160::from_slice(address1.as_bytes()), + H160::from_slice(address1.as_bytes()), + H160::from_slice(address2.as_bytes()), + ), + Ok(false) + ); + }) +} + +#[test] +fn test_is_valid_request_transaction_succeeds() { + run_test(|| { + let vault = BOB; + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::(vault.clone(), None))) + }); + + let address1: Address = "66c7060feb882664ae62ffad0051fe843e318e85" + .try_into() + .unwrap(); + + let address2: Address = "5f69790b72c98041330644bbd50f2ebb5d073c36" + .try_into() + .unwrap(); + + let transaction = TransactionBuilder::new() + .with_version(1) + .add_input( + TransactionInputBuilder::new() + .with_coinbase(true) + .with_previous_index(u32::max_value()) + .build(), + ) + .add_output(TransactionOutput::p2pkh(100, &address1)) + .build(); + + assert_eq!( + Staking::is_valid_request_transaction( + &transaction, + 100, + 100, + H160::from_slice(address1.as_bytes()), + H160::from_slice(address1.as_bytes()), + H160::from_slice(address2.as_bytes()), + ), + Ok(true) + ); + }) +} + +#[test] +fn test_check_invalid_transaction_fails_with_valid_merge_transaction() { + run_test(|| { + let address = Address::from([ + 126, 125, 148, 208, 221, 194, 29, 131, 191, 188, 252, 119, 152, 228, 84, 126, 223, 8, + 50, 170, + ]); + + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(Vault { + id: BOB, + to_be_issued_tokens: 0, + issued_tokens: 0, + to_be_redeemed_tokens: 0, + btc_address: H160::from_slice(address.as_bytes()), + banned_until: None, + })) + }); + + let transaction = TransactionBuilder::new() + .with_version(1) + .add_input( + TransactionInputBuilder::new() + .with_coinbase(false) + .with_sequence(4294967295) + .with_previous_index(1) + .with_previous_hash(H256Le::from_bytes_le(&[ + 193, 80, 65, 160, 109, 235, 107, 56, 24, 176, 34, 250, 197, 88, 218, 76, + 226, 9, 127, 8, 96, 200, 246, 66, 16, 91, 186, 217, 210, 155, 224, 42, + ])) + .with_script(&[ + 73, 48, 70, 2, 33, 0, 207, 210, 162, 211, 50, 178, 154, 220, 225, 25, 197, + 90, 159, 173, 211, 192, 115, 51, 32, 36, 183, 226, 114, 81, 62, 81, 98, 60, + 161, 89, 147, 72, 2, 33, 0, 155, 72, 45, 127, 123, 77, 71, 154, 255, 98, + 189, 205, 174, 165, 70, 103, 115, 125, 86, 248, 212, 214, 61, 208, 62, 195, + 239, 101, 30, 217, 162, 84, 1, 33, 3, 37, 248, 176, 57, 161, 24, 97, 101, + 156, 155, 240, 63, 67, 252, 78, 160, 85, 243, 167, 28, 214, 12, 123, 31, + 212, 116, 171, 87, 143, 153, 119, 250, + ]) + .build(), + ) + .add_output(TransactionOutput::p2pkh(100, &address)) + .build(); + + assert_err!( + Staking::_check_invalid_transaction(&BOB, transaction.format()), + TestError::ValidMergeTransaction + ); + }) +} + +#[test] +fn test_check_invalid_transaction_fails_with_valid_request_or_redeem() { + run_test(|| { + let address1 = Address::from([ + 164, 180, 202, 72, 222, 11, 63, 255, 193, 84, 4, 161, 172, 220, 141, 186, 174, 34, 105, + 85, + ]); + + let address2: Address = "5f69790b72c98041330644bbd50f2ebb5d073c36" + .try_into() + .unwrap(); + + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(Vault { + id: BOB, + to_be_issued_tokens: 0, + issued_tokens: 0, + to_be_redeemed_tokens: 0, + btc_address: H160::from_slice(address1.as_bytes()), + banned_until: None, + })) + }); + + ext::redeem::get_redeem_request_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(Redeem { + vault: BOB, + opentime: 0, + amount_polka_btc: 0, + amount_btc: 100, + amount_dot: 0, + premium_dot: 0, + redeemer: ALICE, + btc_address: H160::from_slice(address2.as_bytes()), + })) + }); + + let transaction = TransactionBuilder::new() + .with_version(1) + .add_input( + TransactionInputBuilder::new() + .with_coinbase(false) + .with_previous_index(1) + .with_previous_hash(H256Le::from_hex_le( + "40d43a99926d43eb0e619bf0b3d83b4a31f60c176beecfb9d35bf45e54d0f742", + )) + .with_sequence(4294967295) + .with_script(&[ + 22, 0, 20, 164, 180, 202, 72, 222, 11, 63, 255, 193, 84, 4, 161, 172, 220, + 141, 186, 174, 34, 105, 85, + ]) + .add_witness(&[ + 48, 69, 2, 33, 0, 134, 4, 239, 143, 109, 138, 250, 137, 45, 238, 15, 49, + 37, 155, 108, 224, 45, 215, 12, 84, 92, 252, 254, 216, 20, 129, 121, 151, + 24, 118, 197, 74, 2, 32, 118, 215, 113, 214, 233, 27, 237, 33, 39, 131, + 201, 176, 110, 13, 230, 0, 250, 178, 213, 24, 250, 214, 241, 90, 43, 25, + 29, 127, 189, 38, 42, 62, 1, + ]) + .add_witness(&[ + 3, 157, 37, 171, 121, 244, 31, 117, 206, 175, 136, 36, 17, 253, 65, 250, + 103, 10, 76, 103, 44, 35, 255, 175, 14, 54, 26, 150, 156, 222, 6, 146, 232, + ]) + .build(), + ) + .add_output(TransactionOutput::p2pkh(100, &address2)) + .add_output(TransactionOutput::op_return( + 0, + &H256::from_slice(&[0; 32]).as_bytes(), + )) + .build(); + + assert_err!( + Staking::_check_invalid_transaction(&BOB, transaction.format()), + TestError::ValidRedeemTransaction + ); + + ext::redeem::get_redeem_request_from_id:: + .mock_safe(move |_| MockResult::Return(Err(x_core::Error::RedeemIdNotFound))); + + ext::replace::get_replace_request::.mock_safe(move |_| { + MockResult::Return(Ok(Replace { + old_vault: BOB, + open_time: 0, + amount: 100, + griefing_collateral: 0, + new_vault: None, + collateral: 0, + accept_time: None, + btc_address: H160::from_slice(address2.as_bytes()), + })) + }); + + assert_err!( + Staking::_check_invalid_transaction(&BOB, transaction.format()), + TestError::ValidReplaceTransaction + ); + }) +} + +#[test] +fn test_check_invalid_transaction_succeeds() { + run_test(|| { + let vault_address = Address::from([ + 126, 125, 148, 208, 221, 194, 29, 131, 191, 188, 252, 119, 152, 228, 84, 126, 223, 8, + 50, 170, + ]); + + let address: Address = "66c7060feb882664ae62ffad0051fe843e318e85" + .try_into() + .unwrap(); + + ext::vault_registry::get_vault_from_id::.mock_safe(move |_| { + MockResult::Return(Ok(init_zero_vault::( + BOB, + Some(H160::from_slice(&vault_address.as_bytes())), + ))) + }); + + let transaction = TransactionBuilder::new() + .with_version(1) + .add_input( + TransactionInputBuilder::new() + .with_coinbase(false) + .with_sequence(4294967295) + .with_previous_index(1) + .with_previous_hash(H256Le::from_bytes_le(&[ + 193, 80, 65, 160, 109, 235, 107, 56, 24, 176, 34, 250, 197, 88, 218, 76, + 226, 9, 127, 8, 96, 200, 246, 66, 16, 91, 186, 217, 210, 155, 224, 42, + ])) + .with_script(&[ + 73, 48, 70, 2, 33, 0, 207, 210, 162, 211, 50, 178, 154, 220, 225, 25, 197, + 90, 159, 173, 211, 192, 115, 51, 32, 36, 183, 226, 114, 81, 62, 81, 98, 60, + 161, 89, 147, 72, 2, 33, 0, 155, 72, 45, 127, 123, 77, 71, 154, 255, 98, + 189, 205, 174, 165, 70, 103, 115, 125, 86, 248, 212, 214, 61, 208, 62, 195, + 239, 101, 30, 217, 162, 84, 1, 33, 3, 37, 248, 176, 57, 161, 24, 97, 101, + 156, 155, 240, 63, 67, 252, 78, 160, 85, 243, 167, 28, 214, 12, 123, 31, + 212, 116, 171, 87, 143, 153, 119, 250, + ]) + .build(), + ) + .add_output(TransactionOutput::p2pkh(100, &address)) + .build(); + + assert_ok!(Staking::_check_invalid_transaction( + &BOB, + transaction.format() + )); + }) +} + #[test] fn test_get_status_counter_success() { run_test(|| { diff --git a/crates/treasury/Cargo.toml b/crates/treasury/Cargo.toml index a80b1ee8ff..0676dd23f4 100644 --- a/crates/treasury/Cargo.toml +++ b/crates/treasury/Cargo.toml @@ -3,19 +3,19 @@ authors = ['Interlay'] description = 'Treasury module' edition = '2018' name = 'treasury' -version = '0.1.0' +version = '2.0.0-alpha.7' [features] default = ['std'] std = [ 'codec/std', 'frame-support/std', - 'sp-runtime/std', - 'sp-io/std', - 'sp-core/std', 'safe-mix/std', - 'system/std', + 'sp-core/std', + 'sp-io/std', + 'sp-runtime/std', 'sp-std/std', + 'system/std', 'pallet-balances/std', 'x-core/std', ] @@ -28,7 +28,7 @@ version = '1.3.0' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.safe-mix] default-features = false @@ -36,29 +36,29 @@ version = '1.0.0' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.pallet-balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.x-core] default-features = false diff --git a/crates/treasury/src/lib.rs b/crates/treasury/src/lib.rs index 3380576745..d154bd53e3 100644 --- a/crates/treasury/src/lib.rs +++ b/crates/treasury/src/lib.rs @@ -83,6 +83,7 @@ decl_module! { /// * `origin` - sender of the transaction /// * `receiver` - receiver of the transaction /// * `amount` - amount of PolkaBTC + #[weight = 1000] fn transfer(origin, receiver: T::AccountId, amount: BalanceOf) -> DispatchResult { diff --git a/crates/treasury/src/mock.rs b/crates/treasury/src/mock.rs index 91fdac7fb0..8f519e3ea2 100644 --- a/crates/treasury/src/mock.rs +++ b/crates/treasury/src/mock.rs @@ -1,6 +1,12 @@ /// Mocking the test environment use crate::{Module, Trait}; -use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight}; +use frame_support::{ + impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, +}; use pallet_balances as balances; use sp_core::H256; use sp_runtime::{ @@ -33,36 +39,43 @@ impl_outer_event! { pub type AccountId = u64; pub type Balance = u64; +pub type BlockNumber = u64; #[derive(Clone, Eq, PartialEq)] pub struct Test; + parameter_types! { pub const BlockHashCount: u64 = 250; pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } + impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; - type BlockNumber = u64; + type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; } + parameter_types! { pub const ExistentialDeposit: u64 = 1; } @@ -115,5 +128,8 @@ where T: FnOnce() -> (), { clear_mocks(); - ExtBuilder::build().execute_with(test); + ExtBuilder::build().execute_with(|| { + System::set_block_number(1); + test(); + }); } diff --git a/crates/vault-registry/Cargo.toml b/crates/vault-registry/Cargo.toml index 025f13949e..bd7e5f28b6 100644 --- a/crates/vault-registry/Cargo.toml +++ b/crates/vault-registry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vault-registry" -version = "0.1.0" +version = "2.0.0-alpha.7" authors = ["Interlay Ltd"] edition = "2018" @@ -35,51 +35,51 @@ optional = true default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.0.0' +version = '1.3.0' [dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-arithmetic] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.timestamp] default-features = false package = 'pallet-timestamp' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.pallet-balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.x-core] default-features = false diff --git a/crates/vault-registry/src/lib.rs b/crates/vault-registry/src/lib.rs index c5253cf65b..46aceda4ae 100644 --- a/crates/vault-registry/src/lib.rs +++ b/crates/vault-registry/src/lib.rs @@ -134,6 +134,7 @@ decl_module! { /// * `InsuficientVaultCollateralAmount` - if the collateral is below the minimum threshold /// * `VaultAlreadyRegistered` - if a vault is already registered for the origin account /// * `InsufficientCollateralAvailable` - if the vault does not own enough collateral + #[weight = 1000] fn register_vault(origin, collateral: DOT, btc_address: H160) -> DispatchResult { let sender = ensure_signed(origin)?; ext::security::ensure_parachain_status_running::()?; @@ -161,6 +162,7 @@ decl_module! { /// # Errors /// * `VaultNotFound` - if no vault exists for the origin account /// * `InsufficientCollateralAvailable` - if the vault does not own enough collateral + #[weight = 1000] fn lock_additional_collateral(origin, amount: DOT) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -191,6 +193,7 @@ decl_module! { /// # Errors /// * `VaultNotFound` - if no vault exists for the origin account /// * `InsufficientCollateralAvailable` - if the vault does not own enough collateral + #[weight = 1000] fn withdraw_collateral(origin, amount: DOT) -> DispatchResult { let sender = ensure_signed(origin)?; ext::security::ensure_parachain_status_running::()?; diff --git a/crates/vault-registry/src/mock.rs b/crates/vault-registry/src/mock.rs index a3fec4dcd7..8e813489bb 100644 --- a/crates/vault-registry/src/mock.rs +++ b/crates/vault-registry/src/mock.rs @@ -1,5 +1,11 @@ /// Mocking the test environment -use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight}; +use frame_support::{ + impl_outer_event, impl_outer_origin, parameter_types, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + Weight, + }, +}; use mocktopus::mocking::clear_mocks; use sp_core::H256; use sp_runtime::{ @@ -33,41 +39,48 @@ impl_outer_event! { } } +pub type AccountId = u64; +pub type Balance = u64; +pub type BlockNumber = u64; + // For testing the pallet, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. #[derive(Clone, Eq, PartialEq)] pub struct Test; + parameter_types! { pub const BlockHashCount: u64 = 250; pub const MaximumBlockWeight: Weight = 1024; pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); } + impl system::Trait for Test { - type Origin = Origin; + type AccountId = AccountId; type Call = (); + type Lookup = IdentityLookup; type Index = u64; - type BlockNumber = u64; + type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; type Header = Header; type Event = TestEvent; + type Origin = Origin; type BlockHashCount = BlockHashCount; type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockLength = MaximumBlockLength; type AvailableBlockRatio = AvailableBlockRatio; + type BlockExecutionWeight = BlockExecutionWeight; + type DbWeight = RocksDbWeight; + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; type Version = (); type ModuleToIndex = (); - type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; } -pub type Balance = u64; - parameter_types! { pub const ExistentialDeposit: u64 = 1; } @@ -159,5 +172,8 @@ where clear_mocks(); ext::oracle::dots_to_btc::.mock_safe(|v| MockResult::Return(Ok(v))); ext::oracle::btc_to_dots::.mock_safe(|v| MockResult::Return(Ok(v))); - ExtBuilder::build().execute_with(test) + ExtBuilder::build().execute_with(|| { + System::set_block_number(1); + test() + }) } diff --git a/crates/x-core/Cargo.toml b/crates/x-core/Cargo.toml index cb12f31af9..0d9ea19dca 100644 --- a/crates/x-core/Cargo.toml +++ b/crates/x-core/Cargo.toml @@ -1,22 +1,22 @@ [package] name = "x-core" -version = "0.1.0" +version = "2.0.0-alpha.7" authors = ["Interlay Ltd"] edition = "2018" [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.codec] default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.2.0' +version = '1.3.0' [features] default = ['std'] diff --git a/crates/x-core/src/lib.rs b/crates/x-core/src/lib.rs index 583e347c18..a64651436b 100644 --- a/crates/x-core/src/lib.rs +++ b/crates/x-core/src/lib.rs @@ -59,6 +59,8 @@ pub enum Error { MalformedOpReturnOutput, // Output does not match format of supported output types (Witness, P2PKH, P2SH) UnsupportedOutputFormat, + // Input does not match format of supported input types (Witness, P2PKH, P2SH) + UnsupportedInputFormat, /// There are no NO_DATA blocks in this BlockChain NoDataEmpty, // not in spec // ------------- @@ -155,6 +157,7 @@ impl Error { Error::MalformedP2SHOutput => "Format of the P2SH output is invalid", Error::MalformedOpReturnOutput => "Format of the OP_RETURN transaction output is invalid", Error::UnsupportedOutputFormat => "Unsupported output format. Currently supported: Witness, P2PKH, P2SH,", + Error::UnsupportedInputFormat => "Unsupported input format. Currently supported: Witness, P2PKH, P2SH", Error::NoDataEmpty => "There are no NO_DATA blocks in this BlockChain.", Error::ReplacePeriodExpired => "Replace period expired", diff --git a/docs/polka_btc.png b/docs/polka_btc.png new file mode 100644 index 0000000000..b41db02ede Binary files /dev/null and b/docs/polka_btc.png differ diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 9db0f2ca66..d8c7c182a7 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -3,76 +3,70 @@ authors = ['Interlay Ltd'] build = 'build.rs' edition = '2018' name = 'btc-parachain' -version = '2.0.0-alpha.5' - -[build-dependencies] -vergen = '3.0.4' - -[build-dependencies.build-script-utils] -package = 'substrate-build-script-utils' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies] -futures = '0.3.1' +futures = '0.3.4' log = '0.4.8' structopt = '0.3.8' -[dependencies.grandpa] -package = 'sc-finality-grandpa' -version = '0.8.0-alpha.5' - -[dependencies.grandpa-primitives] -package = 'sp-finality-grandpa' -version = '2.0.0-alpha.5' - [dependencies.btc-parachain-runtime] path = './runtime' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sc-basic-authorship] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sc-cli] -version = '0.8.0-alpha.5' - -[dependencies.sc-client] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sc-client-api] -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' + +[dependencies.sc-consensus] +version = "0.8.0-alpha.7" [dependencies.sc-consensus-aura] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sc-executor] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' + +[dependencies.sc-finality-grandpa] +version = '0.8.0-alpha.7' [dependencies.sc-network] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sc-service] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sc-transaction-pool] -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-consensus] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sp-consensus-aura] -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sp-core] -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' + +[dependencies.sp-finality-grandpa] +version = '2.0.0-alpha.7' [dependencies.sp-inherents] -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-runtime] -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-transaction-pool] -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' + +[build-dependencies.substrate-build-script-utils] +version = '2.0.0-alpha.7' [[bin]] name = 'btc-parachain' diff --git a/parachain/build.rs b/parachain/build.rs index f5b3ff0a81..f9d839f9be 100644 --- a/parachain/build.rs +++ b/parachain/build.rs @@ -1,9 +1,7 @@ -use vergen::{generate_cargo_keys, ConstantsFlags}; - -const ERROR_MSG: &str = "Failed to generate metadata files"; +use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; fn main() { - generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG); + generate_cargo_keys(); - build_script_utils::rerun_if_git_head_changed(); + rerun_if_git_head_changed(); } diff --git a/parachain/runtime/Cargo.toml b/parachain/runtime/Cargo.toml index 65f2fa02c1..dff46a1bd1 100644 --- a/parachain/runtime/Cargo.toml +++ b/parachain/runtime/Cargo.toml @@ -1,46 +1,36 @@ -[package] -authors = ['Interlay Ltd'] -edition = '2018' -name = 'btc-parachain-runtime' -version = '2.0.0-alpha.5' - [dependencies.aura] default-features = false package = 'pallet-aura' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.balances] default-features = false package = 'pallet-balances' -version = '2.0.0-alpha.5' - -[dependencies.bitcoin] -default-features = false -path = '../../crates/bitcoin' +version = '2.0.0-alpha.7' [dependencies.codec] default-features = false features = ['derive'] package = 'parity-scale-codec' -version = '1.2.0' +version = '1.3.0' [dependencies.frame-executive] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.frame-support] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.grandpa] default-features = false package = 'pallet-grandpa' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.randomness-collective-flip] default-features = false package = 'pallet-randomness-collective-flip' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.serde] features = ['derive'] @@ -49,61 +39,75 @@ version = '1.0.101' [dependencies.sp-api] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-block-builder] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-consensus-aura] default-features = false -version = '0.8.0-alpha.5' +version = '0.8.0-alpha.7' [dependencies.sp-core] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-inherents] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-io] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-offchain] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-runtime] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-session] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-std] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-transaction-pool] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sp-version] default-features = false -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.sudo] default-features = false package = 'pallet-sudo' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' [dependencies.system] default-features = false package = 'frame-system' -version = '2.0.0-alpha.5' +version = '2.0.0-alpha.7' + +[dependencies.timestamp] +default-features = false +package = 'pallet-timestamp' +version = '2.0.0-alpha.7' + +[dependencies.transaction-payment] +default-features = false +package = 'pallet-transaction-payment' +version = '2.0.0-alpha.7' + +[build-dependencies.wasm-builder-runner] +package = 'substrate-wasm-builder-runner' +version = '1.0.5' [dependencies.btc-relay] default-features = false @@ -155,20 +159,6 @@ default-features = false package = 'replace' path = '../../crates/replace' -[dependencies.timestamp] -default-features = false -package = 'pallet-timestamp' -version = '2.0.0-alpha.5' - -[dependencies.transaction-payment] -default-features = false -package = 'pallet-transaction-payment' -version = '2.0.0-alpha.5' - -[build-dependencies.wasm-builder-runner] -package = 'substrate-wasm-builder-runner' -version = '1.0.5' - [dev-dependencies.bitcoin] default-features = false package = 'bitcoin' @@ -176,7 +166,7 @@ path = '../../crates/bitcoin' [dev-dependencies.primitive-types] default-features = false -version = '0.7.0' +version = '0.7.2' features= ['codec'] [dev-dependencies] @@ -185,6 +175,15 @@ x-core = { path = '../../crates/x-core' } hex = '0.4.2' serde_json = "1.0" +[package] +authors = ['Interlay Ltd'] +edition = '2018' +name = 'btc-parachain-runtime' +version = '2.0.0-alpha.7' + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] + [features] default = ['std'] std = [ @@ -222,4 +221,4 @@ std = [ 'issue/std', 'redeem/std', 'replace/std', -] +] \ No newline at end of file diff --git a/parachain/runtime/src/lib.rs b/parachain/runtime/src/lib.rs index 799443eca0..1ee8f036a3 100644 --- a/parachain/runtime/src/lib.rs +++ b/parachain/runtime/src/lib.rs @@ -8,6 +8,7 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +use frame_support::traits::StorageMapShim; use grandpa::fg_primitives; use grandpa::AuthorityList as GrandpaAuthorityList; use sp_api::impl_runtime_apis; @@ -17,7 +18,8 @@ use sp_runtime::traits::{ BlakeTwo256, Block as BlockT, ConvertInto, IdentifyAccount, IdentityLookup, Verify, }; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, transaction_validity::TransactionValidity, + create_runtime_str, generic, impl_opaque_keys, + transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, MultiSignature, }; use sp_std::prelude::*; @@ -26,22 +28,23 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. +pub use balances::Call as BalancesCall; +pub use btc_relay::bitcoin; +pub use btc_relay::Call as RelayCall; pub use frame_support::{ - construct_runtime, parameter_types, traits::Randomness, weights::Weight, StorageValue, + construct_runtime, parameter_types, + traits::Randomness, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, + Weight, + }, + StorageValue, }; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; pub use sp_runtime::{Perbill, Permill}; pub use timestamp::Call as TimestampCall; -pub use btc_relay; -pub use collateral; -pub use exchange_rate_oracle; -pub use security; -pub use staked_relayers; -pub use treasury; -pub use vault_registry; - /// An index to a block. pub type BlockNumber = u32; @@ -99,6 +102,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, spec_version: 1, impl_version: 1, + transaction_version: 1, apis: RUNTIME_API_VERSIONS, }; @@ -122,7 +126,8 @@ pub fn native_version() -> NativeVersion { parameter_types! { pub const BlockHashCount: BlockNumber = 250; - pub const MaximumBlockWeight: Weight = 1_000_000_000; + /// We allow for 2 seconds of compute with a 6 second average block time. + pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; pub const Version: RuntimeVersion = VERSION; @@ -157,6 +162,14 @@ impl system::Trait for Runtime { type MaximumBlockLength = MaximumBlockLength; /// Portion of the block weight that is available to all normal transactions. type AvailableBlockRatio = AvailableBlockRatio; + /// The weight of the overhead invoked on the block import process, independent of the + /// extrinsics included in that block. + type BlockExecutionWeight = BlockExecutionWeight; + /// The weight of database operations that the runtime can invoke. + type DbWeight = RocksDbWeight; + /// The base weight of any extrinsic processed by the runtime, independent of the + /// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...) + type ExtrinsicBaseWeight = ExtrinsicBaseWeight; /// Version of the runtime. type Version = Version; /// Converts a module to the index of the module in `construct_runtime!`. @@ -194,6 +207,23 @@ parameter_types! { pub const ExistentialDeposit: u128 = 500; } +parameter_types! { + pub const TransactionByteFee: Balance = 1; +} + +impl transaction_payment::Trait for Runtime { + type Currency = balances::Module; + type OnTransactionPayment = (); + type TransactionByteFee = TransactionByteFee; + type WeightToFee = ConvertInto; + type FeeMultiplierUpdate = (); +} + +impl sudo::Trait for Runtime { + type Event = Event; + type Call = Call; +} + /// DOT impl balances::Trait for Runtime { /// The type for recording an account's balance. @@ -202,7 +232,13 @@ impl balances::Trait for Runtime { type Event = Event; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; + type AccountStore = StorageMapShim< + balances::Account, + system::CallOnCreatedAccount, + system::CallKillAccount, + AccountId, + balances::AccountData, + >; } /// PolkaBTC @@ -211,26 +247,13 @@ impl balances::Trait for Runtime { type Event = Event; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; -} - -parameter_types! { - pub const TransactionBaseFee: Balance = 0; - pub const TransactionByteFee: Balance = 1; -} - -impl transaction_payment::Trait for Runtime { - type Currency = balances::Module; - type OnTransactionPayment = (); - type TransactionBaseFee = TransactionBaseFee; - type TransactionByteFee = TransactionByteFee; - type WeightToFee = ConvertInto; - type FeeMultiplierUpdate = (); -} - -impl sudo::Trait for Runtime { - type Event = Event; - type Call = Call; + type AccountStore = StorageMapShim< + balances::Account, + system::CallOnCreatedAccount, + system::CallKillAccount, + AccountId, + balances::AccountData, + >; } impl btc_relay::Trait for Runtime { @@ -304,10 +327,11 @@ construct_runtime!( Timestamp: timestamp::{Module, Call, Storage, Inherent}, Aura: aura::{Module, Config, Inherent(Timestamp)}, Grandpa: grandpa::{Module, Call, Storage, Config, Event}, - DOT: balances::::{Module, Call, Storage, Config, Event}, - PolkaBTC: balances::::{Module, Call, Storage, Config, Event}, TransactionPayment: transaction_payment::{Module, Storage}, Sudo: sudo::{Module, Call, Config, Storage, Event}, + + DOT: balances::::{Module, Call, Storage, Config, Event}, + PolkaBTC: balances::::{Module, Call, Storage, Config, Event}, BTCRelay: btc_relay::{Module, Call, Config, Storage, Event}, Collateral: collateral::{Module, Call, Storage, Event}, Treasury: treasury::{Module, Call, Storage, Event}, @@ -395,8 +419,11 @@ impl_runtime_apis! { } impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { - fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { - Executive::validate_transaction(tx) + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx) } } diff --git a/parachain/runtime/tests/bitcoin_data.rs b/parachain/runtime/tests/bitcoin_data.rs index 4a8ab14e2f..4ee44e7ba4 100644 --- a/parachain/runtime/tests/bitcoin_data.rs +++ b/parachain/runtime/tests/bitcoin_data.rs @@ -1,3 +1,4 @@ +use bitcoin::types::{H256Le, RawBlockHeader}; use serde::Deserialize; use std::fs; use std::path::PathBuf; @@ -8,15 +9,35 @@ const ERR_JSON_FORMAT: &'static str = "JSON was not well-formatted"; #[derive(Clone, Debug, Deserialize)] pub struct Block { pub height: u32, - pub hash: String, - pub raw_header: String, + hash: String, + raw_header: String, pub test_txs: Vec, } +impl Block { + pub fn get_block_hash(&self) -> H256Le { + H256Le::from_hex_be(&self.hash) + } + + pub fn get_raw_header(&self) -> RawBlockHeader { + RawBlockHeader::from_hex(&self.raw_header).expect("invalid raw header") + } +} + #[derive(Clone, Debug, Deserialize)] pub struct Transaction { - pub txid: String, - pub raw_merkle_proof: String, + txid: String, + raw_merkle_proof: String, +} + +impl Transaction { + pub fn get_txid(&self) -> H256Le { + H256Le::from_hex_be(&self.txid) + } + + pub fn get_raw_merkle_proof(&self) -> Vec { + hex::decode(&self.raw_merkle_proof).expect("Error parsing merkle proof") + } } pub fn get_bitcoin_testdata() -> Vec { diff --git a/parachain/runtime/tests/mock.rs b/parachain/runtime/tests/mock.rs index 3e67ac21b0..86f8912b1b 100644 --- a/parachain/runtime/tests/mock.rs +++ b/parachain/runtime/tests/mock.rs @@ -197,15 +197,9 @@ impl ExtBuilder { .assimilate_storage(&mut storage) .unwrap(); - balances::GenesisConfig:: { - balances: vec![ - (account_of(ALICE), 1_000_000), - (account_of(BOB), 1_000_000), - (account_of(CLAIRE), 1_000_000), - ], - } - .assimilate_storage(&mut storage) - .unwrap(); + balances::GenesisConfig:: { balances: vec![] } + .assimilate_storage(&mut storage) + .unwrap(); exchange_rate_oracle::GenesisConfig:: { admin: account_of(BOB), diff --git a/parachain/runtime/tests/test_btcrelay.rs b/parachain/runtime/tests/test_btcrelay.rs index 524b1dcc00..61bd1db611 100644 --- a/parachain/runtime/tests/test_btcrelay.rs +++ b/parachain/runtime/tests/test_btcrelay.rs @@ -10,32 +10,29 @@ fn integration_test_submit_block_headers_and_verify_transaction_inclusion() { // load blocks with transactions let test_data = get_bitcoin_testdata(); - let mut init = false; - // store all block headers - for block in test_data.iter() { - let raw_header = RawBlockHeader::from_hex(&block.raw_header).unwrap(); - if init == false { - assert_ok!(BTCRelayCall::initialize(raw_header, block.height) - .dispatch(origin_of(account_of(ALICE)))); - init = true; - } else { - assert_ok!(BTCRelayCall::store_block_header(raw_header) - .dispatch(origin_of(account_of(ALICE)))); + SystemModule::set_block_number(1); - assert_store_main_chain_header_event( - block.height, - H256Le::from_hex_be(&block.hash), - ); - } + // store all block headers. parachain_genesis is the first block + // known in the parachain. Any block before will be rejected + let parachain_genesis_height = test_data[0].height; + let parachain_genesis_header = test_data[0].get_raw_header(); + assert_ok!( + BTCRelayCall::initialize(parachain_genesis_header, parachain_genesis_height) + .dispatch(origin_of(account_of(ALICE))) + ); + for block in test_data.iter().skip(1) { + assert_ok!(BTCRelayCall::store_block_header(block.get_raw_header()) + .dispatch(origin_of(account_of(ALICE)))); + + assert_store_main_chain_header_event(block.height, block.get_block_hash()); } - // verify all transaction that have enough confirmations + // verify all transaction let current_height = btc_relay::Module::::get_best_block_height(); for block in test_data.iter() { - if block.height < current_height - CONFIRMATIONS { - for tx in &block.test_txs { - let txid = H256Le::from_hex_be(&tx.txid); - let raw_merkle_proof = - hex::decode(&tx.raw_merkle_proof).expect("Error parsing merkle proof"); + for tx in &block.test_txs { + let txid = tx.get_txid(); + let raw_merkle_proof = tx.get_raw_merkle_proof(); + if block.height <= current_height - CONFIRMATIONS { assert_ok!(BTCRelayCall::verify_transaction_inclusion( txid, block.height, @@ -44,6 +41,19 @@ fn integration_test_submit_block_headers_and_verify_transaction_inclusion() { false ) .dispatch(origin_of(account_of(ALICE)))); + } else { + // expect to fail due to insufficient confirmations + assert_err!( + BTCRelayCall::verify_transaction_inclusion( + txid, + block.height, + raw_merkle_proof, + CONFIRMATIONS, + false + ) + .dispatch(origin_of(account_of(ALICE))), + Error::Confirmations + ); } } } diff --git a/parachain/runtime/tests/test_issue.rs b/parachain/runtime/tests/test_issue.rs index bf2460027e..54a3d30e27 100644 --- a/parachain/runtime/tests/test_issue.rs +++ b/parachain/runtime/tests/test_issue.rs @@ -54,15 +54,23 @@ fn integration_test_issue_polka_btc() { .unwrap() .as_slice(), ); - let amount = 100; + let amount = 100000; + let collateral = 100; + + let initial_dot_balance = + collateral::Module::::get_balance_from_account(&account_of(ALICE)); + let initial_btc_balance = + treasury::Module::::get_balance_from_account(account_of(ALICE)); assert_ok!(OracleCall::set_exchange_rate(1).dispatch(origin_of(account_of(BOB)))); assert_ok!(VaultRegistryCall::register_vault(1000000, address.clone()) .dispatch(origin_of(account_of(BOB)))); // alice requests polka_btc by locking btc with bob - assert_ok!(IssueCall::request_issue(amount, account_of(BOB), 100) - .dispatch(origin_of(account_of(ALICE)))); + assert_ok!( + IssueCall::request_issue(amount, account_of(BOB), collateral) + .dispatch(origin_of(account_of(ALICE))) + ); let id = assert_issue_request_event(); @@ -74,5 +82,15 @@ fn integration_test_issue_polka_btc() { // alice executes the issue by confirming the btc transaction assert_ok!(IssueCall::execute_issue(id, tx_id, height, proof, raw_tx) .dispatch(origin_of(account_of(ALICE)))); + + SystemModule::set_block_number(6); + + let final_dot_balance = + collateral::Module::::get_balance_from_account(&account_of(ALICE)); + let final_btc_balance = + treasury::Module::::get_balance_from_account(account_of(ALICE)); + + assert_eq!(final_dot_balance, initial_dot_balance - collateral); + assert_eq!(final_btc_balance, initial_btc_balance + amount); }); } diff --git a/parachain/runtime/tests/test_replace.rs b/parachain/runtime/tests/test_replace.rs index 7899a9cdad..037a099ba2 100644 --- a/parachain/runtime/tests/test_replace.rs +++ b/parachain/runtime/tests/test_replace.rs @@ -146,6 +146,7 @@ fn integration_test_replace_execute_replace() { let vault_btc_address = H160([0u8; 20]); set_default_thresholds(); + SystemModule::set_block_number(1); // peg spot rate assert_ok!(OracleCall::set_exchange_rate(1).dispatch(origin_of(account_of(BOB)))); diff --git a/parachain/src/chain_spec.rs b/parachain/src/chain_spec.rs index 1e7af0b519..7085a4cdb5 100644 --- a/parachain/src/chain_spec.rs +++ b/parachain/src/chain_spec.rs @@ -3,10 +3,10 @@ use btc_parachain_runtime::{ GrandpaConfig, PolkaBTCConfig, Signature, StakedRelayersConfig, SudoConfig, SystemConfig, VaultRegistryConfig, WASM_BINARY, }; -use grandpa_primitives::AuthorityId as GrandpaId; -use sc_service; +use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{sr25519, Pair, Public}; +use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::{IdentifyAccount, Verify}; // Note this is the URL for the telemetry server @@ -15,17 +15,6 @@ use sp_runtime::traits::{IdentifyAccount, Verify}; /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. pub type ChainSpec = sc_service::GenericChainSpec; -/// The chain specification option. This is expected to come in from the CLI and -/// is little more than one of a number of alternatives which can easily be converted -/// from a string (`--chain=...`) into a `ChainSpec`. -#[derive(Clone, Debug)] -pub enum Alternative { - /// Whatever the current runtime is, with just Alice as an auth. - Development, - /// Whatever the current runtime is, with simple Alice/Bob auths. - LocalTestnet, -} - /// Helper function to generate a crypto pair from seed pub fn get_from_seed(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) @@ -44,79 +33,65 @@ where } /// Helper function to generate an authority key for Aura -pub fn get_authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) { +pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) { (get_from_seed::(s), get_from_seed::(s)) } -impl Alternative { - /// Get an actual chain config from one of the alternatives. - pub(crate) fn load(self) -> Result { - Ok(match self { - Alternative::Development => ChainSpec::from_genesis( - "Development", - "dev", - || { - testnet_genesis( - vec![get_authority_keys_from_seed("Alice")], - get_account_id_from_seed::("Alice"), - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - ], - true, - ) - }, - vec![], - None, - None, - None, - None, - ), - Alternative::LocalTestnet => ChainSpec::from_genesis( - "Local Testnet", - "local_testnet", - || { - testnet_genesis( - vec![ - get_authority_keys_from_seed("Alice"), - get_authority_keys_from_seed("Bob"), - ], - get_account_id_from_seed::("Alice"), - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ], - true, - ) - }, - vec![], - None, - None, - None, - None, - ), - }) - } +pub fn development_config() -> ChainSpec { + ChainSpec::from_genesis( + "Development", + "dev", + ChainType::Development, + || { + testnet_genesis( + vec![authority_keys_from_seed("Alice")], + get_account_id_from_seed::("Alice"), + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + ], + true, + ) + }, + vec![], + None, + None, + None, + None, + ) +} - pub(crate) fn from(s: &str) -> Option { - match s { - "dev" => Some(Alternative::Development), - "" | "local" => Some(Alternative::LocalTestnet), - _ => None, - } - } +pub fn local_testnet_config() -> ChainSpec { + ChainSpec::from_genesis( + "Local Testnet", + "local_testnet", + ChainType::Local, + || { + testnet_genesis( + vec![ + authority_keys_from_seed("Alice"), + authority_keys_from_seed("Bob"), + ], + get_account_id_from_seed::("Alice"), + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + ], + true, + ) + }, + vec![], + None, + None, + None, + None, + ) } fn testnet_genesis( @@ -130,20 +105,6 @@ fn testnet_genesis( code: WASM_BINARY.to_vec(), changes_trie_config: Default::default(), }), - balances_Instance1: Some(DOTConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, 1 << 60)) - .collect(), - }), - balances_Instance2: Some(PolkaBTCConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, 1 << 60)) - .collect(), - }), aura: Some(AuraConfig { authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(), }), @@ -154,6 +115,14 @@ fn testnet_genesis( .collect(), }), sudo: Some(SudoConfig { key: root_key }), + balances_Instance1: Some(DOTConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, 1 << 60)) + .collect(), + }), + balances_Instance2: Some(PolkaBTCConfig { balances: vec![] }), staked_relayers: Some(StakedRelayersConfig { gov_id: get_account_id_from_seed::("Alice"), }), @@ -166,10 +135,3 @@ fn testnet_genesis( }), } } - -pub fn load_spec(id: &str) -> Result, String> { - Ok(match Alternative::from(id) { - Some(spec) => Box::new(spec.load()?), - None => Box::new(ChainSpec::from_json_file(std::path::PathBuf::from(id))?), - }) -} diff --git a/parachain/src/command.rs b/parachain/src/command.rs index 71bffb7d73..e195935c13 100644 --- a/parachain/src/command.rs +++ b/parachain/src/command.rs @@ -17,27 +17,65 @@ use crate::chain_spec; use crate::cli::Cli; use crate::service; -use sc_cli::VersionInfo; +use sc_cli::SubstrateCli; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; -/// Parse and run command line arguments -pub fn run(version: VersionInfo) -> sc_cli::Result<()> { - let opt = sc_cli::from_args::(&version); +impl SubstrateCli for Cli { + fn impl_name() -> &'static str { + "Substrate Node" + } + + fn impl_version() -> &'static str { + env!("SUBSTRATE_CLI_IMPL_VERSION") + } + + fn description() -> &'static str { + env!("CARGO_PKG_DESCRIPTION") + } + + fn author() -> &'static str { + env!("CARGO_PKG_AUTHORS") + } + + fn support_url() -> &'static str { + "interlay.io" + } + + fn copyright_start_year() -> i32 { + 2017 + } + + fn executable_name() -> &'static str { + env!("CARGO_PKG_NAME") + } - let mut config = sc_service::Configuration::from_version(&version); + fn load_spec(&self, id: &str) -> Result, String> { + Ok(match id { + "dev" => Box::new(chain_spec::development_config()), + "" | "local" => Box::new(chain_spec::local_testnet_config()), + path => Box::new(chain_spec::ChainSpec::from_json_file( + std::path::PathBuf::from(path), + )?), + }) + } +} + +/// Parse and run command line arguments +pub fn run() -> sc_cli::Result<()> { + let cli = Cli::from_args(); - match opt.subcommand { + match &cli.subcommand { Some(subcommand) => { - subcommand.init(&version)?; - subcommand.update_config(&mut config, chain_spec::load_spec, &version)?; - subcommand.run(config, |config: _| Ok(new_full_start!(config).0)) + let runner = cli.create_runner(subcommand)?; + runner.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0)) } None => { - opt.run.init(&version)?; - opt.run - .update_config(&mut config, chain_spec::load_spec, &version)?; - opt.run - .run(config, service::new_light, service::new_full, &version) + let runner = cli.create_runner(&cli.run)?; + runner.run_node( + service::new_light, + service::new_full, + btc_parachain_runtime::VERSION, + ) } } } diff --git a/parachain/src/main.rs b/parachain/src/main.rs index 219dda1a5f..0e4e82f5b9 100644 --- a/parachain/src/main.rs +++ b/parachain/src/main.rs @@ -8,16 +8,5 @@ mod cli; mod command; fn main() -> sc_cli::Result<()> { - let version = sc_cli::VersionInfo { - name: "Substrate Node", - commit: env!("VERGEN_SHA_SHORT"), - version: env!("CARGO_PKG_VERSION"), - executable_name: "btc-parachain", - author: "Interlay Ltd", - description: "BTC Parachain connects Bitcoin and Polkadot", - support_url: "interlay.io", - copyright_start_year: 2017, - }; - - command::run(version) + command::run() } diff --git a/parachain/src/service.rs b/parachain/src/service.rs index faf492a9f9..f9b083ca4e 100644 --- a/parachain/src/service.rs +++ b/parachain/src/service.rs @@ -1,13 +1,14 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. use btc_parachain_runtime::{self, opaque::Block, RuntimeApi}; -use grandpa::{ - self, FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider, -}; -use sc_client::LongestChain; use sc_client_api::ExecutorProvider; +use sc_consensus::LongestChain; use sc_executor::native_executor_instance; pub use sc_executor::NativeExecutor; +use sc_finality_grandpa::{ + FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState, + StorageAndProofProvider, +}; use sc_service::{error::Error as ServiceError, AbstractService, Configuration, ServiceBuilder}; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; use sp_inherents::InherentDataProviders; @@ -36,40 +37,48 @@ macro_rules! new_full_start { btc_parachain_runtime::RuntimeApi, crate::service::Executor, >($config)? - .with_select_chain(|_config, backend| Ok(sc_client::LongestChain::new(backend.clone())))? - .with_transaction_pool(|config, client, _fetcher| { + .with_select_chain(|_config, backend| Ok(sc_consensus::LongestChain::new(backend.clone())))? + .with_transaction_pool(|config, client, _fetcher, prometheus_registry| { let pool_api = sc_transaction_pool::FullChainApi::new(client.clone()); Ok(sc_transaction_pool::BasicPool::new( config, std::sync::Arc::new(pool_api), + prometheus_registry, )) })? - .with_import_queue(|_config, client, mut select_chain, _transaction_pool| { - let select_chain = select_chain - .take() - .ok_or_else(|| sc_service::Error::SelectChainRequired)?; + .with_import_queue( + |_config, client, mut select_chain, _transaction_pool, spawn_task_handle| { + let select_chain = select_chain + .take() + .ok_or_else(|| sc_service::Error::SelectChainRequired)?; - let (grandpa_block_import, grandpa_link) = - grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?; + let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( + client.clone(), + &(client.clone() as Arc<_>), + select_chain, + )?; - let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( - grandpa_block_import.clone(), - client.clone(), - ); + let aura_block_import = + sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( + grandpa_block_import.clone(), + client.clone(), + ); - let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair>( - sc_consensus_aura::slot_duration(&*client)?, - aura_block_import, - Some(Box::new(grandpa_block_import.clone())), - None, - client, - inherent_data_providers.clone(), - )?; + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( + sc_consensus_aura::slot_duration(&*client)?, + aura_block_import, + Some(Box::new(grandpa_block_import.clone())), + None, + client, + inherent_data_providers.clone(), + spawn_task_handle, + )?; - import_setup = Some((grandpa_block_import, grandpa_link)); + import_setup = Some((grandpa_block_import, grandpa_link)); - Ok(import_queue) - })?; + Ok(import_queue) + }, + )?; (builder, import_setup, inherent_data_providers) }}; @@ -77,16 +86,11 @@ macro_rules! new_full_start { /// Builds a new service for a full client. pub fn new_full(config: Configuration) -> Result { - let is_authority = config.roles.is_authority(); + let role = config.role.clone(); let force_authoring = config.force_authoring; - let name = config.name.clone(); + let name = config.network.node_name.clone(); let disable_grandpa = config.disable_grandpa; - // sentry nodes announce themselves as authorities to the network - // and should run the same protocols authorities do, but it should - // never actively participate in any consensus process. - let participates_in_consensus = is_authority && !config.sentry_mode; - let (builder, mut import_setup, inherent_data_providers) = new_full_start!(config); let (block_import, grandpa_link) = import_setup.take().expect( @@ -101,7 +105,7 @@ pub fn new_full(config: Configuration) -> Result Result Result Result(config)? .with_select_chain(|_config, backend| Ok(LongestChain::new(backend.clone())))? - .with_transaction_pool(|config, client, fetcher| { + .with_transaction_pool(|config, client, fetcher, prometheus_registry| { let fetcher = fetcher .ok_or_else(|| "Trying to start light transaction pool without active fetcher")?; @@ -195,18 +203,19 @@ pub fn new_light(config: Configuration) -> Result), @@ -216,13 +225,14 @@ pub fn new_light(config: Configuration) -> Result( + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( sc_consensus_aura::slot_duration(&*client)?, grandpa_block_import, None, Some(Box::new(finality_proof_import)), client, inherent_data_providers.clone(), + spawn_task_handle, )?; Ok((import_queue, finality_proof_request_builder))