From 6ae50cab6534337be84f26e7cc1a75000c3a1ad0 Mon Sep 17 00:00:00 2001 From: Michal Swietek Date: Tue, 29 Nov 2022 00:21:38 +0000 Subject: [PATCH 1/7] Request justification from forks --- Cargo.lock | 382 ++++++++++-------- bin/node/Cargo.toml | 2 +- bin/node/src/service.rs | 38 +- bin/runtime/Cargo.toml | 2 +- finality-aleph/Cargo.toml | 2 +- finality-aleph/src/justification/handler.rs | 25 +- finality-aleph/src/justification/mod.rs | 19 +- finality-aleph/src/justification/requester.rs | 173 +++++--- finality-aleph/src/lib.rs | 14 +- finality-aleph/src/nodes/mod.rs | 13 +- finality-aleph/src/nodes/nonvalidator_node.rs | 7 +- finality-aleph/src/nodes/validator_node.rs | 7 +- finality-aleph/src/testing/justification.rs | 52 +-- .../mocks/{header_backend.rs => backend.rs} | 55 +-- .../mocks/justification_handler_config.rs | 5 +- finality-aleph/src/testing/mocks/mod.rs | 4 +- 16 files changed, 465 insertions(+), 335 deletions(-) rename finality-aleph/src/testing/mocks/{header_backend.rs => backend.rs} (72%) diff --git a/Cargo.lock b/Cargo.lock index 728c03f488..0e3185a065 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "aleph-node" -version = "0.8.0" +version = "0.8.1" dependencies = [ "aleph-runtime", "clap", @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "aleph-runtime" -version = "0.8.0" +version = "0.8.1" dependencies = [ "frame-executive", "frame-support", @@ -402,30 +402,30 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ - "concurrent-queue", + "concurrent-queue 1.2.4", "event-listener", "futures-core", ] [[package]] name = "async-executor" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ + "async-lock", "async-task", - "concurrent-queue", + "concurrent-queue 2.0.0", "fastrand", "futures-lite", - "once_cell", "slab", ] [[package]] name = "async-global-executor" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da5b41ee986eed3f524c380e6d64965aea573882a8907682ad100f7859305ca" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ "async-channel", "async-executor", @@ -438,49 +438,50 @@ dependencies = [ [[package]] name = "async-io" -version = "1.9.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7" +checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" dependencies = [ + "async-lock", "autocfg", - "concurrent-queue", + "concurrent-queue 2.0.0", "futures-lite", "libc", "log", - "once_cell", "parking", "polling", "slab", "socket2", "waker-fn", - "winapi", + "windows-sys 0.42.0", ] [[package]] name = "async-lock" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" dependencies = [ "event-listener", + "futures-lite", ] [[package]] name = "async-process" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" +checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" dependencies = [ "async-io", + "async-lock", "autocfg", "blocking", "cfg-if", "event-listener", "futures-lite", "libc", - "once_cell", "signal-hook", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -544,9 +545,9 @@ dependencies = [ [[package]] name = "asynchronous-codec" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" +checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" dependencies = [ "bytes", "futures-sink", @@ -597,7 +598,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.5.4", "object 0.29.0", "rustc-demangle", ] @@ -718,11 +719,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" +checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -732,7 +733,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ "arrayvec 0.4.12", - "constant_time_eq", + "constant_time_eq 0.1.5", ] [[package]] @@ -743,7 +744,7 @@ checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq", + "constant_time_eq 0.1.5", ] [[package]] @@ -754,20 +755,20 @@ checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq", + "constant_time_eq 0.1.5", ] [[package]] name = "blake3" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" dependencies = [ "arrayref", "arrayvec 0.7.2", "cc", "cfg-if", - "constant_time_eq", + "constant_time_eq 0.2.4", ] [[package]] @@ -811,16 +812,16 @@ dependencies = [ [[package]] name = "blocking" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" +checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" dependencies = [ "async-channel", + "async-lock", "async-task", "atomic-waker", "fastrand", "futures-lite", - "once_cell", ] [[package]] @@ -855,9 +856,9 @@ checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byte-slice-cast" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -873,9 +874,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bzip2-sys" @@ -927,9 +928,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" dependencies = [ "jobserver", ] @@ -976,9 +977,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", @@ -1029,14 +1030,14 @@ checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" dependencies = [ "glob", "libc", - "libloading 0.7.3", + "libloading 0.7.4", ] [[package]] name = "clap" -version = "3.2.21" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", @@ -1073,9 +1074,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.48" +version = "0.1.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" dependencies = [ "cc", ] @@ -1099,6 +1100,15 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "concurrent-queue" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-oid" version = "0.7.1" @@ -1111,6 +1121,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "constant_time_eq" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" + [[package]] name = "convert_case" version = "0.4.0" @@ -1288,22 +1304,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", ] @@ -1427,9 +1443,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" dependencies = [ "cc", "cxxbridge-flags", @@ -1439,9 +1455,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" dependencies = [ "cc", "codespan-reporting", @@ -1454,15 +1470,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" dependencies = [ "proc-macro2", "quote", @@ -1548,9 +1564,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -1740,9 +1756,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -1884,7 +1900,7 @@ dependencies = [ [[package]] name = "finality-aleph" -version = "0.5.0" +version = "0.5.3" dependencies = [ "aggregator 0.1.0", "aggregator 0.2.0", @@ -1970,13 +1986,13 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "libz-sys", - "miniz_oxide", + "miniz_oxide 0.6.2", ] [[package]] @@ -2454,9 +2470,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ "bytes", "fnv", @@ -2572,7 +2588,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -2639,9 +2655,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ "bytes", "futures-channel", @@ -2663,9 +2679,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" dependencies = [ "http", "hyper", @@ -2678,9 +2694,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2789,9 +2805,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown 0.12.3", @@ -2833,9 +2849,9 @@ checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" [[package]] name = "io-lifetimes" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "ip_network" @@ -2845,9 +2861,9 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] name = "ipconfig" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" +checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" dependencies = [ "socket2", "widestring", @@ -2857,9 +2873,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" [[package]] name = "itertools" @@ -3052,9 +3068,12 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] [[package]] name = "kv-log-macro" @@ -3118,9 +3137,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.135" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libloading" @@ -3134,9 +3153,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi", @@ -3144,9 +3163,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libp2p" @@ -3804,9 +3823,9 @@ dependencies = [ [[package]] name = "libp2p-pnet" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5a702574223aa55d8878bdc8bf55c84a6086f87ddaddc28ce730b4caa81538" +checksum = "de160c5631696cea22be326c19bd9d306e254c4964945263aea10f25f6e0864e" dependencies = [ "futures", "log", @@ -4393,9 +4412,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" dependencies = [ "libc", ] @@ -4409,6 +4428,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memory-db" version = "0.29.0" @@ -4453,16 +4481,25 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "mio" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.36.1", + "windows-sys 0.42.0", ] [[package]] @@ -4510,7 +4547,7 @@ dependencies = [ "blake2s_simd", "blake3", "core2", - "digest 0.10.5", + "digest 0.10.6", "multihash-derive", "sha2 0.10.6", "sha3", @@ -4763,9 +4800,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi", "libc", @@ -4794,9 +4831,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -4818,9 +4855,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "owning_ref" @@ -5448,7 +5485,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -5533,9 +5570,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "platforms" @@ -5545,16 +5582,16 @@ checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" [[package]] name = "polling" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" +checksum = "9f7d73f1eaed1ca1fb37b54dcc9b38e3b17d6c7b8ecb7abfffcac8d0351f17d4" dependencies = [ "autocfg", "cfg-if", "libc", "log", "wepoll-ffi", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -5582,9 +5619,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" @@ -5969,11 +6006,10 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" dependencies = [ - "autocfg", "crossbeam-deque", "either", "rayon-core", @@ -5981,9 +6017,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -6013,18 +6049,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" +checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" +checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" dependencies = [ "proc-macro2", "quote", @@ -6045,9 +6081,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", @@ -6065,9 +6101,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "region" @@ -6240,16 +6276,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.35.12" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985947f9b6423159c4726323f373be0a21bdb514c5af06a849cb3d2dce2d01e8" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", - "io-lifetimes 0.7.4", + "io-lifetimes 0.7.5", "libc", "linux-raw-sys 0.0.46", - "windows-sys 0.36.1", + "windows-sys 0.42.0", ] [[package]] @@ -6663,7 +6699,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "parity-wasm 0.42.2", - "rustix 0.35.12", + "rustix 0.35.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -7154,9 +7190,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" +checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" dependencies = [ "bitvec", "cfg-if", @@ -7168,9 +7204,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" +checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7242,9 +7278,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" +checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" dependencies = [ "secp256k1-sys", ] @@ -7325,18 +7361,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" dependencies = [ "proc-macro2", "quote", @@ -7345,9 +7381,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa", "ryu", @@ -7400,7 +7436,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -7409,7 +7445,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -7492,9 +7528,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" -version = "1.0.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" +checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" @@ -7778,7 +7814,7 @@ source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=alep dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3", "sp-std", @@ -8227,9 +8263,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "fa0813c10b9dbdc842c2305f949f724c64866e4ef4d09c9151e96f6a2106773c" dependencies = [ "Inflector", "num-format", @@ -8462,9 +8498,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce" dependencies = [ "proc-macro2", "quote", @@ -8512,9 +8548,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" [[package]] name = "tempfile" @@ -8541,9 +8577,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" @@ -8596,9 +8632,9 @@ dependencies = [ [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -8669,9 +8705,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.2" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" dependencies = [ "autocfg", "bytes", @@ -8946,7 +8982,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "digest 0.10.5", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] @@ -9415,7 +9451,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset", + "memoffset 0.6.5", "more-asserts", "rand 0.8.5", "region", @@ -9669,18 +9705,18 @@ checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "winreg" -version = "0.7.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] @@ -9752,9 +9788,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.4+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" dependencies = [ "cc", "libc", diff --git a/bin/node/Cargo.toml b/bin/node/Cargo.toml index 1067293a64..08af44903c 100644 --- a/bin/node/Cargo.toml +++ b/bin/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-node" -version = "0.8.0" +version = "0.8.1" authors = ["Cardinal Cryptography"] description = "Aleph node binary" edition = "2021" diff --git a/bin/node/src/service.rs b/bin/node/src/service.rs index 4d0ad4ed2f..dc959eed0a 100644 --- a/bin/node/src/service.rs +++ b/bin/node/src/service.rs @@ -13,7 +13,7 @@ use finality_aleph::{ }; use futures::channel::mpsc; use log::warn; -use sc_client_api::ExecutorProvider; +use sc_client_api::{Backend, ExecutorProvider, HeaderBackend}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_network::NetworkService; use sc_service::{ @@ -22,6 +22,7 @@ use sc_service::{ }; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_api::ProvideRuntimeApi; +use sp_blockchain::Backend as _; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; use sp_runtime::{ generic::BlockId, @@ -34,7 +35,7 @@ type FullClient = sc_service::TFullClient; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; -fn get_backup_path(aleph_config: &AlephCli, base_path: &Path) -> Option { +fn backup_path(aleph_config: &AlephCli, base_path: &Path) -> Option { if aleph_config.no_backup() { return None; } @@ -264,7 +265,7 @@ pub fn new_authority( .extra_sets .push(finality_aleph::peers_set_config(Protocol::Validator)); - let backup_path = get_backup_path( + let backup_path = backup_path( &aleph_config, config .base_path @@ -293,7 +294,7 @@ pub fn new_authority( let (_rpc_handlers, network, network_starter) = setup( config, - backend, + backend.clone(), &keystore_container, import_queue, transaction_pool.clone(), @@ -353,9 +354,11 @@ pub fn new_authority( if aleph_config.external_addresses().is_empty() { panic!("Cannot run a validator node without external addresses, stopping."); } + let blockchain_backend = BlockchainBackendImpl { backend }; let aleph_config = AlephConfig { network, client, + blockchain_backend, select_chain, session_period, millisecs_per_block, @@ -393,7 +396,7 @@ pub fn new_full( other: (_, justification_tx, justification_rx, mut telemetry, metrics), } = new_partial(&config)?; - let backup_path = get_backup_path( + let backup_path = backup_path( &aleph_config, config .base_path @@ -404,7 +407,7 @@ pub fn new_full( let (_rpc_handlers, network, network_starter) = setup( config, - backend, + backend.clone(), &keystore_container, import_queue, transaction_pool, @@ -428,9 +431,11 @@ pub fn new_full( .unwrap(), ); + let blockchain_backend = BlockchainBackendImpl { backend }; let aleph_config = AlephConfig { network, client, + blockchain_backend, select_chain, session_period, millisecs_per_block, @@ -453,3 +458,24 @@ pub fn new_full( network_starter.start_network(); Ok(task_manager) } + +struct BlockchainBackendImpl { + backend: Arc, +} +impl finality_aleph::BlockchainBackend for BlockchainBackendImpl { + fn children(&self, parent_hash: ::Hash) -> Vec<::Hash> { + self.backend + .blockchain() + .children(parent_hash) + .unwrap_or_default() + } + fn info(&self) -> sp_blockchain::Info { + self.backend.blockchain().info() + } + fn header( + &self, + block_id: sp_api::BlockId, + ) -> sp_blockchain::Result::Header>> { + self.backend.blockchain().header(block_id) + } +} diff --git a/bin/runtime/Cargo.toml b/bin/runtime/Cargo.toml index 9318bed26b..0564d7004b 100644 --- a/bin/runtime/Cargo.toml +++ b/bin/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-runtime" -version = "0.8.0" +version = "0.8.1" authors = ["Cardinal Cryptography"] edition = "2021" homepage = "https://alephzero.org" diff --git a/finality-aleph/Cargo.toml b/finality-aleph/Cargo.toml index de6c62df72..40a081f647 100644 --- a/finality-aleph/Cargo.toml +++ b/finality-aleph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "finality-aleph" -version = "0.5.0" +version = "0.5.3" authors = ["Cardinal Cryptography"] edition = "2021" license = "Apache 2.0" diff --git a/finality-aleph/src/justification/handler.rs b/finality-aleph/src/justification/handler.rs index cf2b752549..2c038fa0e2 100644 --- a/finality-aleph/src/justification/handler.rs +++ b/finality-aleph/src/justification/handler.rs @@ -1,12 +1,8 @@ -use std::{ - sync::Arc, - time::{Duration, Instant}, -}; +use std::time::{Duration, Instant}; use futures::{channel::mpsc, Stream, StreamExt}; use futures_timer::Delay; use log::{debug, error}; -use sc_client_api::HeaderBackend; use sp_api::BlockT; use sp_runtime::traits::Header; use tokio::time::timeout; @@ -17,53 +13,52 @@ use crate::{ requester::BlockRequester, JustificationHandlerConfig, JustificationNotification, JustificationRequestScheduler, SessionInfo, SessionInfoProvider, Verifier, }, - network, Metrics, STATUS_REPORT_INTERVAL, + network, BlockchainBackend, Metrics, STATUS_REPORT_INTERVAL, }; -pub struct JustificationHandler +pub struct JustificationHandler where B: BlockT, V: Verifier, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, SI: SessionInfoProvider, F: BlockFinalizer, + BB: BlockchainBackend + 'static, { session_info_provider: SI, - block_requester: BlockRequester, + block_requester: BlockRequester, verifier_timeout: Duration, notification_timeout: Duration, } -impl JustificationHandler +impl JustificationHandler where B: BlockT, V: Verifier, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, SI: SessionInfoProvider, F: BlockFinalizer, + BB: BlockchainBackend + 'static, { pub fn new( session_info_provider: SI, block_requester: RB, - client: Arc, + blockchain_backend: BB, finalizer: F, justification_request_scheduler: S, metrics: Option::Hash>>, - justification_handler_config: JustificationHandlerConfig, + justification_handler_config: JustificationHandlerConfig, ) -> Self { Self { session_info_provider, block_requester: BlockRequester::new( block_requester, - client, + blockchain_backend, finalizer, justification_request_scheduler, metrics, - justification_handler_config.min_allowed_delay, ), verifier_timeout: justification_handler_config.verifier_timeout, notification_timeout: justification_handler_config.notification_timeout, diff --git a/finality-aleph/src/justification/mod.rs b/finality-aleph/src/justification/mod.rs index fcc16bf9b5..f5cde9d497 100644 --- a/finality-aleph/src/justification/mod.rs +++ b/finality-aleph/src/justification/mod.rs @@ -55,36 +55,29 @@ pub struct JustificationNotification { } #[derive(Clone)] -pub struct JustificationHandlerConfig { +pub struct JustificationHandlerConfig { /// How long should we wait when the session verifier is not yet available. verifier_timeout: Duration, /// How long should we wait for any notification. notification_timeout: Duration, - ///Distance (in amount of blocks) between the best and the block we want to request justification - min_allowed_delay: NumberFor, } -impl Default for JustificationHandlerConfig { +impl Default for JustificationHandlerConfig { fn default() -> Self { Self { verifier_timeout: Duration::from_millis(500), - notification_timeout: Duration::from_millis(1000), - min_allowed_delay: 3u32.into(), + // request justifications slightly more frequently than they're created + notification_timeout: Duration::from_millis(800), } } } #[cfg(test)] -impl JustificationHandlerConfig { - pub fn new( - verifier_timeout: Duration, - notification_timeout: Duration, - min_allowed_delay: NumberFor, - ) -> Self { +impl JustificationHandlerConfig { + pub fn new(verifier_timeout: Duration, notification_timeout: Duration) -> Self { Self { verifier_timeout, notification_timeout, - min_allowed_delay, } } } diff --git a/finality-aleph/src/justification/requester.rs b/finality-aleph/src/justification/requester.rs index 1e140f8c8d..1bc4595df9 100644 --- a/finality-aleph/src/justification/requester.rs +++ b/finality-aleph/src/justification/requester.rs @@ -1,10 +1,10 @@ -use std::{fmt, marker::PhantomData, sync::Arc, time::Instant}; +use std::{fmt, marker::PhantomData, time::Instant}; use aleph_primitives::ALEPH_ENGINE_ID; use log::{debug, error, info, warn}; -use sc_client_api::HeaderBackend; +use sc_client_api::blockchain::Info; use sp_api::{BlockId, BlockT, NumberFor}; -use sp_runtime::traits::Header; +use sp_runtime::traits::{Header, One, Saturating}; use crate::{ finalization::BlockFinalizer, @@ -13,7 +13,7 @@ use crate::{ JustificationRequestScheduler, Verifier, }, metrics::Checkpoint, - network, Metrics, + network, BlockHashNum, BlockchainBackend, Metrics, }; /// Threshold for how many tries are needed so that JustificationRequestStatus is logged @@ -21,100 +21,114 @@ const REPORT_THRESHOLD: u32 = 2; /// This structure is created for keeping and reporting status of BlockRequester pub struct JustificationRequestStatus { - block_number: Option>, - block_hash: Option, - tries: u32, + block_hash_number: Option>, + block_tries: u32, + parent: Option, + n_children: usize, + children_tries: u32, report_threshold: u32, } impl JustificationRequestStatus { fn new() -> Self { Self { - block_number: None, - block_hash: None, - tries: 0, + block_hash_number: None, + block_tries: 0, + parent: None, + n_children: 0, + children_tries: 0, report_threshold: REPORT_THRESHOLD, } } - fn save_block_number(&mut self, num: NumberFor) { - if Some(num) == self.block_number { - self.tries += 1; + fn save_children(&mut self, hash: B::Hash, n_children: usize) { + if self.parent == Some(hash) { + self.children_tries += 1; } else { - self.block_number = Some(num); - self.block_hash = None; - self.tries = 1; + self.parent = Some(hash); + self.children_tries = 1; } + self.n_children = n_children; } - fn insert_hash(&mut self, hash: B::Hash) { - self.block_hash = Some(hash); + fn save_block(&mut self, hn: BlockHashNum) { + if self.block_hash_number == Some(hn.clone()) { + self.block_tries += 1; + } else { + self.block_hash_number = Some(hn); + self.block_tries = 1; + } } fn should_report(&self) -> bool { - self.tries >= self.report_threshold + self.block_tries >= self.report_threshold || self.children_tries >= self.report_threshold } } impl fmt::Display for JustificationRequestStatus { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(n) = self.block_number { - let mut status = format!("tries - {}; requested block number - {}; ", self.tries, n); - if let Some(header) = self.block_hash { - status.push_str(&format!("hash - {}; ", header)); - } else { - status.push_str("hash - unknown; "); + if self.block_tries >= self.report_threshold { + if let Some(hn) = &self.block_hash_number { + write!( + f, + "tries - {}; requested block number - {}; hash - {};", + self.block_tries, hn.num, hn.hash, + )?; + } + } + if self.children_tries >= self.report_threshold { + if let Some(parent) = self.parent { + write!( + f, + "tries - {}; requested {} children of finalized block {}; ", + self.children_tries, self.n_children, parent + )?; } - - write!(f, "{}", status)?; } Ok(()) } } -pub struct BlockRequester +pub struct BlockRequester where B: BlockT, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, F: BlockFinalizer, V: Verifier, + BB: BlockchainBackend + 'static, { block_requester: RB, - client: Arc, + blockchain_backend: BB, finalizer: F, justification_request_scheduler: S, metrics: Option::Hash>>, - min_allowed_delay: NumberFor, request_status: JustificationRequestStatus, _phantom: PhantomData, } -impl BlockRequester +impl BlockRequester where B: BlockT, RB: network::RequestBlocks + 'static, - C: HeaderBackend + Send + Sync + 'static, S: JustificationRequestScheduler, F: BlockFinalizer, V: Verifier, + BB: BlockchainBackend + 'static, { pub fn new( block_requester: RB, - client: Arc, + blockchain_backend: BB, finalizer: F, justification_request_scheduler: S, metrics: Option::Hash>>, - min_allowed_delay: NumberFor, ) -> Self { BlockRequester { block_requester, - client, + blockchain_backend, finalizer, justification_request_scheduler, metrics, - min_allowed_delay, request_status: JustificationRequestStatus::new(), _phantom: PhantomData, } @@ -169,29 +183,12 @@ where } } - pub fn request_justification(&mut self, num: NumberFor) { + pub fn request_justification(&mut self, wanted: NumberFor) { match self.justification_request_scheduler.schedule_action() { SchedulerActions::Request => { - let num = if num > self.client.info().best_number - && self.client.info().best_number > self.min_allowed_delay - { - self.client.info().best_number - self.min_allowed_delay - } else { - num - }; - - debug!(target: "aleph-justification", "Trying to request block {:?}", num); - self.request_status.save_block_number(num); - - if let Ok(Some(header)) = self.client.header(BlockId::Number(num)) { - self.request_status.insert_hash(header.hash()); - debug!(target: "aleph-justification", "We have block {:?} with hash {:?}. Requesting justification.", num, header.hash()); - self.justification_request_scheduler.on_request_sent(); - self.block_requester - .request_justification(&header.hash(), *header.number()); - } else { - debug!(target: "aleph-justification", "Cancelling request, because we don't have block {:?}.", num); - } + let info = self.blockchain_backend.info(); + self.request_children(&info); + self.request_wanted(wanted, &info); } SchedulerActions::ClearQueue => { debug!(target: "aleph-justification", "Clearing justification request queue"); @@ -202,6 +199,64 @@ where } pub fn finalized_number(&self) -> NumberFor { - self.client.info().finalized_number + self.blockchain_backend.info().finalized_number + } + + fn do_request(&mut self, hash: &::Hash, num: NumberFor) { + debug!(target: "aleph-justification", + "We have block {:?} with hash {:?}. Requesting justification.", num, hash); + self.justification_request_scheduler.on_request_sent(); + self.block_requester.request_justification(hash, num); + } + + // We request justifications for all the children of last finalized block. + // Assuming that we request at the same pace that finalization is progressing, it ensures + // that we are up to date with finalization. + // We also request the child that it's on the same branch as top_wanted since a fork may happen + // somewhere in between them. + fn request_children(&mut self, info: &Info) { + let finalized_hash = info.finalized_hash; + let finalized_number = info.finalized_number; + + let children = self.blockchain_backend.children(finalized_hash); + + if !children.is_empty() { + self.request_status + .save_children(finalized_hash, children.len()); + } + + for child in &children { + self.do_request(child, finalized_number + NumberFor::::one()); + } + } + + // This request is important in the case when we are far behind and want to catch up. + fn request_wanted(&mut self, mut top_wanted: NumberFor, info: &Info) { + let best_number = info.best_number; + if best_number <= top_wanted { + // most probably block best_number is not yet finalized + top_wanted = best_number.saturating_sub(NumberFor::::one()); + } + let finalized_number = info.finalized_number; + // We know that top_wanted >= finalized_number, so + // - if top_wanted == finalized_number, then we don't want to request it + // - if top_wanted == finalized_number + 1, then we already requested it + if top_wanted <= finalized_number + NumberFor::::one() { + return; + } + match self.blockchain_backend.header(BlockId::Number(top_wanted)) { + Ok(Some(header)) => { + let hash = header.hash(); + let num = *header.number(); + self.do_request(&hash, num); + self.request_status.save_block((hash, num).into()); + } + Ok(None) => { + warn!(target: "aleph-justification", "Cancelling request, because we don't have block {:?}.", top_wanted); + } + Err(err) => { + warn!(target: "aleph-justification", "Cancelling request, because fetching block {:?} failed {:?}.", top_wanted, err); + } + } } } diff --git a/finality-aleph/src/lib.rs b/finality-aleph/src/lib.rs index 8326fa7bc6..16ed7360bd 100644 --- a/finality-aleph/src/lib.rs +++ b/finality-aleph/src/lib.rs @@ -8,7 +8,7 @@ use futures::{ channel::{mpsc, oneshot}, Future, }; -use sc_client_api::{backend::Backend, BlockchainEvents, Finalizer, LockImportRun, TransactionFor}; +use sc_client_api::{Backend, BlockchainEvents, Finalizer, LockImportRun, TransactionFor}; use sc_consensus::BlockImport; use sc_network::{ExHashT, NetworkService}; use sc_service::SpawnTaskHandle; @@ -250,9 +250,10 @@ impl From<(H, N)> for HashNum { pub type BlockHashNum = HashNum<::Hash, NumberFor>; -pub struct AlephConfig { +pub struct AlephConfig { pub network: Arc>, pub client: Arc, + pub blockchain_backend: BB, pub select_chain: SC, pub spawn_handle: SpawnTaskHandle, pub keystore: Arc, @@ -265,3 +266,12 @@ pub struct AlephConfig { pub external_addresses: Vec, pub validator_port: u16, } + +pub trait BlockchainBackend { + fn children(&self, parent_hash: ::Hash) -> Vec<::Hash>; + fn info(&self) -> sp_blockchain::Info; + fn header( + &self, + block_id: sp_api::BlockId, + ) -> sp_blockchain::Result::Header>>; +} diff --git a/finality-aleph/src/nodes/mod.rs b/finality-aleph/src/nodes/mod.rs index fb36090eea..0d53d23136 100644 --- a/finality-aleph/src/nodes/mod.rs +++ b/finality-aleph/src/nodes/mod.rs @@ -26,7 +26,7 @@ use crate::{ mpsc::UnboundedSender, session_id_from_block_num, session_map::ReadOnlySessionMap, - JustificationNotification, Metrics, MillisecsPerBlock, SessionPeriod, + BlockchainBackend, JustificationNotification, Metrics, MillisecsPerBlock, SessionPeriod, }; /// Max amount of tries we can not update a finalized block number before we will clear requests queue @@ -78,9 +78,10 @@ impl Verifier for JustificationVerifier { } } -struct JustificationParams { +struct JustificationParams { pub network: Arc>, pub client: Arc, + pub blockchain_backend: BB, pub justification_rx: mpsc::UnboundedReceiver>, pub metrics: Option::Hash>>, pub session_period: SessionPeriod, @@ -121,8 +122,8 @@ impl SessionInfoProvider for SessionInfoProv } } -fn setup_justification_handler( - just_params: JustificationParams, +fn setup_justification_handler( + just_params: JustificationParams, ) -> ( UnboundedSender>, impl Future, @@ -133,10 +134,12 @@ where C: crate::ClientForAleph + Send + Sync + 'static, C::Api: aleph_primitives::AlephSessionApi, BE: Backend + 'static, + BB: BlockchainBackend + 'static + Send, { let JustificationParams { network, client, + blockchain_backend, justification_rx, metrics, session_period, @@ -147,7 +150,7 @@ where let handler = JustificationHandler::new( SessionInfoProviderImpl::new(session_map, session_period), network, - client.clone(), + blockchain_backend, AlephFinalizer::new(client), JustificationRequestSchedulerImpl::new(&session_period, &millisecs_per_block, MAX_ATTEMPTS), metrics, diff --git a/finality-aleph/src/nodes/nonvalidator_node.rs b/finality-aleph/src/nodes/nonvalidator_node.rs index e70c03f6b3..9fc076bfd9 100644 --- a/finality-aleph/src/nodes/nonvalidator_node.rs +++ b/finality-aleph/src/nodes/nonvalidator_node.rs @@ -7,21 +7,23 @@ use sp_runtime::traits::Block; use crate::{ nodes::{setup_justification_handler, JustificationParams}, session_map::{AuthorityProviderImpl, FinalityNotificatorImpl, SessionMapUpdater}, - AlephConfig, + AlephConfig, BlockchainBackend, }; -pub async fn run_nonvalidator_node(aleph_config: AlephConfig) +pub async fn run_nonvalidator_node(aleph_config: AlephConfig) where B: Block, H: ExHashT, C: crate::ClientForAleph + Send + Sync + 'static, C::Api: aleph_primitives::AlephSessionApi, BE: Backend + 'static, + BB: BlockchainBackend + Send + 'static, SC: SelectChain + 'static, { let AlephConfig { network, client, + blockchain_backend, metrics, session_period, millisecs_per_block, @@ -42,6 +44,7 @@ where justification_rx, network, client, + blockchain_backend, metrics, session_period, millisecs_per_block, diff --git a/finality-aleph/src/nodes/validator_node.rs b/finality-aleph/src/nodes/validator_node.rs index 53697bbccf..daaf3f2813 100644 --- a/finality-aleph/src/nodes/validator_node.rs +++ b/finality-aleph/src/nodes/validator_node.rs @@ -23,21 +23,23 @@ use crate::{ session_map::{AuthorityProviderImpl, FinalityNotificatorImpl, SessionMapUpdater}, tcp_network::new_tcp_network, validator_network::{Service, KEY_TYPE}, - AlephConfig, + AlephConfig, BlockchainBackend, }; -pub async fn run_validator_node(aleph_config: AlephConfig) +pub async fn run_validator_node(aleph_config: AlephConfig) where B: Block, H: ExHashT, C: crate::ClientForAleph + Send + Sync + 'static, C::Api: aleph_primitives::AlephSessionApi, BE: Backend + 'static, + BB: BlockchainBackend + Send + 'static, SC: SelectChain + 'static, { let AlephConfig { network, client, + blockchain_backend, select_chain, spawn_handle, keystore, @@ -101,6 +103,7 @@ where justification_rx, network: network.clone(), client: client.clone(), + blockchain_backend, metrics: metrics.clone(), session_period, millisecs_per_block, diff --git a/finality-aleph/src/testing/justification.rs b/finality-aleph/src/testing/justification.rs index 5777d4e72d..9cb3fd4373 100644 --- a/finality-aleph/src/testing/justification.rs +++ b/finality-aleph/src/testing/justification.rs @@ -1,4 +1,4 @@ -use std::{cell::RefCell, collections::VecDeque, sync::Arc, time::Duration}; +use std::{cell::RefCell, collections::VecDeque, time::Duration}; use futures::{ channel::mpsc::{unbounded, UnboundedSender}, @@ -12,7 +12,7 @@ use AcceptancePolicy::*; use crate::{ justification::{AlephJustification, JustificationHandler, JustificationHandlerConfig}, testing::mocks::{ - create_block, AcceptancePolicy, Client, JustificationRequestSchedulerImpl, + create_block, AcceptancePolicy, Backend, JustificationRequestSchedulerImpl, MockedBlockFinalizer, MockedBlockRequester, SessionInfoProviderImpl, TBlock, VerifierWrapper, }, @@ -26,15 +26,15 @@ type TJustHandler = JustificationHandler< TBlock, VerifierWrapper, MockedBlockRequester, - Client, JustificationRequestSchedulerImpl, SessionInfoProviderImpl, MockedBlockFinalizer, + Backend, >; type Sender = UnboundedSender>; type Environment = ( TJustHandler, - Client, + Backend, MockedBlockRequester, MockedBlockFinalizer, JustificationRequestSchedulerImpl, @@ -67,7 +67,7 @@ fn prepare_env( verification_policy: AcceptancePolicy, request_policy: AcceptancePolicy, ) -> Environment { - let client = Client::new(finalization_height); + let backend = Backend::new(finalization_height); let info_provider = SessionInfoProviderImpl::new(SESSION_PERIOD, verification_policy); let finalizer = MockedBlockFinalizer::new(); let requester = MockedBlockRequester::new(); @@ -77,7 +77,7 @@ fn prepare_env( let justification_handler = JustificationHandler::new( info_provider, requester.clone(), - Arc::new(client.clone()), + backend.clone(), finalizer.clone(), justification_request_scheduler.clone(), None, @@ -86,7 +86,7 @@ fn prepare_env( ( justification_handler, - client, + backend, requester, finalizer, justification_request_scheduler, @@ -125,19 +125,19 @@ where S: FnOnce( Sender, Sender, - Client, + Backend, MockedBlockRequester, MockedBlockFinalizer, JustificationRequestSchedulerImpl, ) -> F, { - let (justification_handler, client, requester, finalizer, justification_request_scheduler) = + let (justification_handler, backend, requester, finalizer, justification_request_scheduler) = env; let (handle_run, auth_just_tx, imp_just_tx) = run_justification_handler(justification_handler); scenario( auth_just_tx.clone(), imp_just_tx.clone(), - client, + backend, requester, finalizer, justification_request_scheduler, @@ -186,8 +186,8 @@ async fn expect_not_requested( async fn leads_to_finalization_when_appropriate_justification_comes() { run_test( prepare_env(FINALIZED_HEIGHT, AlwaysAccept, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.next_block_to_finalize(); let message = create_justification_notification_for(block.clone()); imp_just_tx.unbounded_send(message).unwrap(); expect_finalized(&finalizer, &justification_request_scheduler, block).await; @@ -201,8 +201,8 @@ async fn waits_for_verifier_before_finalizing() { let verification_policy = FromSequence(RefCell::new(VecDeque::from(vec![false, false, true]))); run_test( prepare_env(FINALIZED_HEIGHT, verification_policy, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.next_block_to_finalize(); let message = create_justification_notification_for(block.clone()); imp_just_tx.unbounded_send(message.clone()).unwrap(); @@ -222,8 +222,8 @@ async fn waits_for_verifier_before_finalizing() { async fn keeps_finalizing_block_if_not_finalized_yet() { run_test( prepare_env(FINALIZED_HEIGHT, AlwaysAccept, AlwaysReject), - |auth_just_tx, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.next_block_to_finalize(); + |auth_just_tx, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.next_block_to_finalize(); let message = create_justification_notification_for(block.clone()); imp_just_tx.unbounded_send(message.clone()).unwrap(); @@ -240,8 +240,8 @@ async fn keeps_finalizing_block_if_not_finalized_yet() { async fn ignores_notifications_for_old_blocks() { run_test( prepare_env(FINALIZED_HEIGHT, AlwaysAccept, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let block = client.get_block(BlockId::Number(1u64)).unwrap(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let block = backend.get_block(BlockId::Number(1u64)).unwrap(); let message = create_justification_notification_for(block); imp_just_tx.unbounded_send(message).unwrap(); expect_not_finalized(&finalizer, &justification_request_scheduler).await; @@ -268,8 +268,8 @@ async fn ignores_notifications_from_future_session() { async fn does_not_buffer_notifications_from_future_session() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, AlwaysAccept, AlwaysReject), - |_, imp_just_tx, client, _, finalizer, justification_request_scheduler| async move { - let current_block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, _, finalizer, justification_request_scheduler| async move { + let current_block = backend.next_block_to_finalize(); let future_block = create_block(current_block.hash(), SESSION_PERIOD.0 as u64); let message = create_justification_notification_for(future_block); @@ -290,8 +290,8 @@ async fn does_not_buffer_notifications_from_future_session() { async fn requests_for_session_ending_justification() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, AlwaysReject, AlwaysAccept), - |_, imp_just_tx, client, requester, _, justification_request_scheduler| async move { - let last_block = client.next_block_to_finalize(); + |_, imp_just_tx, backend, requester, _, justification_request_scheduler| async move { + let last_block = backend.next_block_to_finalize(); // doesn't need any notification passed to keep asking expect_requested( @@ -321,14 +321,14 @@ async fn requests_for_session_ending_justification() { async fn does_not_request_for_session_ending_justification_too_often() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, AlwaysReject, AlwaysReject), - |_, _, client, requester, _, justification_request_scheduler| async move { + |_, _, backend, requester, _, justification_request_scheduler| async move { expect_not_requested(&requester, &justification_request_scheduler).await; justification_request_scheduler.update_policy(AlwaysAccept); expect_requested( &requester, &justification_request_scheduler, - client.next_block_to_finalize(), + backend.next_block_to_finalize(), ) .await; @@ -343,10 +343,10 @@ async fn does_not_request_for_session_ending_justification_too_often() { async fn does_not_request_nor_finalize_when_verifier_is_not_available() { run_test( prepare_env((SESSION_PERIOD.0 - 2) as u64, Unavailable, AlwaysAccept), - |_, imp_just_tx, client, requester, finalizer, justification_request_scheduler| async move { + |_, imp_just_tx, backend, requester, finalizer, justification_request_scheduler| async move { expect_not_requested(&requester, &justification_request_scheduler).await; - let block = client.next_block_to_finalize(); + let block = backend.next_block_to_finalize(); imp_just_tx .unbounded_send(create_justification_notification_for(block)) .unwrap(); diff --git a/finality-aleph/src/testing/mocks/header_backend.rs b/finality-aleph/src/testing/mocks/backend.rs similarity index 72% rename from finality-aleph/src/testing/mocks/header_backend.rs rename to finality-aleph/src/testing/mocks/backend.rs index 4adaf2c8f2..a2365ad7b4 100644 --- a/finality-aleph/src/testing/mocks/header_backend.rs +++ b/finality-aleph/src/testing/mocks/backend.rs @@ -1,11 +1,14 @@ use sp_api::BlockId; -use sp_blockchain::{BlockStatus, HeaderBackend, Info}; +use sp_blockchain::Info; use sp_runtime::traits::Block; -use crate::testing::mocks::{TBlock, THash, THeader, TNumber}; +use crate::{ + testing::mocks::{TBlock, THash, THeader, TNumber}, + BlockchainBackend, +}; #[derive(Clone)] -pub(crate) struct Client { +pub(crate) struct Backend { blocks: Vec, next_block_to_finalize: TBlock, } @@ -25,7 +28,7 @@ pub(crate) fn create_block(parent_hash: THash, number: TNumber) -> TBlock { const GENESIS_HASH: [u8; 32] = [0u8; 32]; -impl Client { +impl Backend { pub(crate) fn new(finalized_height: u64) -> Self { let mut blocks: Vec = vec![]; @@ -40,7 +43,7 @@ impl Client { let next_block_to_finalize = create_block(blocks.last().unwrap().hash(), finalized_height + 1); - Client { + Backend { blocks, next_block_to_finalize, } @@ -70,11 +73,30 @@ impl Client { } } -impl HeaderBackend for Client { +impl BlockchainBackend for Backend { + fn children(&self, parent_hash: THash) -> Vec { + if self.next_block_to_finalize.hash() == parent_hash { + Vec::new() + } else if self + .blocks + .last() + .map(|b| b.hash()) + .unwrap() + .eq(&parent_hash) + { + vec![self.next_block_to_finalize.hash()] + } else { + self.blocks + .windows(2) + .flat_map(<&[TBlock; 2]>::try_from) + .find(|[parent, _]| parent.header.hash().eq(&parent_hash)) + .map(|[_, c]| vec![c.hash()]) + .unwrap_or_default() + } + } fn header(&self, id: BlockId) -> sp_blockchain::Result> { Ok(self.get_block(id).map(|b| b.header)) } - fn info(&self) -> Info { Info { best_hash: self.next_block_to_finalize.hash(), @@ -87,23 +109,8 @@ impl HeaderBackend for Client { block_gap: None, } } - - fn status(&self, id: BlockId) -> sp_blockchain::Result { - Ok(match self.get_block(id) { - Some(_) => BlockStatus::InChain, - _ => BlockStatus::Unknown, - }) - } - - fn number(&self, hash: THash) -> sp_blockchain::Result> { - Ok(self.get_block(BlockId::hash(hash)).map(|b| b.header.number)) - } - - fn hash(&self, number: TNumber) -> sp_blockchain::Result> { - Ok(self.get_block(BlockId::Number(number)).map(|b| b.hash())) - } } -unsafe impl Send for Client {} +unsafe impl Send for Backend {} -unsafe impl Sync for Client {} +unsafe impl Sync for Backend {} diff --git a/finality-aleph/src/testing/mocks/justification_handler_config.rs b/finality-aleph/src/testing/mocks/justification_handler_config.rs index 49dee9543e..6db2ec7f16 100644 --- a/finality-aleph/src/testing/mocks/justification_handler_config.rs +++ b/finality-aleph/src/testing/mocks/justification_handler_config.rs @@ -5,7 +5,7 @@ use std::{ use crate::{ justification::{JustificationHandlerConfig, JustificationRequestScheduler, SchedulerActions}, - testing::mocks::{single_action_mock::SingleActionMock, AcceptancePolicy, TBlock}, + testing::mocks::{single_action_mock::SingleActionMock, AcceptancePolicy}, }; #[derive(Clone)] @@ -58,12 +58,11 @@ impl JustificationRequestScheduler for JustificationRequestSchedulerImpl { const DEFAULT_VERIFIER_TIMEOUT_MS: u64 = 10u64; const DEFAULT_NOTIFICATION_TIMEOUT_MS: u64 = 10u64; -impl JustificationHandlerConfig { +impl JustificationHandlerConfig { pub fn test() -> Self { JustificationHandlerConfig::new( Duration::from_millis(DEFAULT_VERIFIER_TIMEOUT_MS), Duration::from_millis(DEFAULT_NOTIFICATION_TIMEOUT_MS), - 3u32.into(), ) } } diff --git a/finality-aleph/src/testing/mocks/mod.rs b/finality-aleph/src/testing/mocks/mod.rs index 3a95478e8d..dee1ad4e89 100644 --- a/finality-aleph/src/testing/mocks/mod.rs +++ b/finality-aleph/src/testing/mocks/mod.rs @@ -1,7 +1,7 @@ pub(crate) use acceptance_policy::AcceptancePolicy; +pub(crate) use backend::{create_block, Backend}; pub(crate) use block_finalizer::MockedBlockFinalizer; pub(crate) use block_request::MockedBlockRequester; -pub(crate) use header_backend::{create_block, Client}; pub(crate) use justification_handler_config::JustificationRequestSchedulerImpl; pub(crate) use proposal::{ aleph_data_from_blocks, aleph_data_from_headers, unvalidated_proposal_from_headers, @@ -14,9 +14,9 @@ pub(crate) type THash = substrate_test_runtime::Hash; pub(crate) type TNumber = substrate_test_runtime::BlockNumber; mod acceptance_policy; +mod backend; mod block_finalizer; mod block_request; -mod header_backend; mod justification_handler_config; mod proposal; mod session_info; From 2ac588dfaad9f7a312b18a2ca2554b870a98484e Mon Sep 17 00:00:00 2001 From: Marcin Date: Tue, 29 Nov 2022 12:14:02 +0100 Subject: [PATCH 2/7] Reverted changes to cargo lock introduced in 6ae50cab6534337be84f26e7cc1a75000c3a1ad0 (#773) --- Cargo.lock | 386 ++++++++++++++++++++++++----------------------------- 1 file changed, 175 insertions(+), 211 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0e3185a065..19c9d7a2c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" dependencies = [ "memchr", ] @@ -402,30 +402,30 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ - "concurrent-queue 1.2.4", + "concurrent-queue", "event-listener", "futures-core", ] [[package]] name = "async-executor" -version = "1.5.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" dependencies = [ - "async-lock", "async-task", - "concurrent-queue 2.0.0", + "concurrent-queue", "fastrand", "futures-lite", + "once_cell", "slab", ] [[package]] name = "async-global-executor" -version = "2.3.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +checksum = "0da5b41ee986eed3f524c380e6d64965aea573882a8907682ad100f7859305ca" dependencies = [ "async-channel", "async-executor", @@ -438,50 +438,49 @@ dependencies = [ [[package]] name = "async-io" -version = "1.12.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" +checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7" dependencies = [ - "async-lock", "autocfg", - "concurrent-queue 2.0.0", + "concurrent-queue", "futures-lite", "libc", "log", + "once_cell", "parking", "polling", "slab", "socket2", "waker-fn", - "windows-sys 0.42.0", + "winapi", ] [[package]] name = "async-lock" -version = "2.6.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" dependencies = [ "event-listener", - "futures-lite", ] [[package]] name = "async-process" -version = "1.6.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" +checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" dependencies = [ "async-io", - "async-lock", "autocfg", "blocking", "cfg-if", "event-listener", "futures-lite", "libc", + "once_cell", "signal-hook", - "windows-sys 0.42.0", + "winapi", ] [[package]] @@ -534,9 +533,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" dependencies = [ "proc-macro2", "quote", @@ -545,9 +544,9 @@ dependencies = [ [[package]] name = "asynchronous-codec" -version = "0.6.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" +checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" dependencies = [ "bytes", "futures-sink", @@ -598,7 +597,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide 0.5.4", + "miniz_oxide", "object 0.29.0", "rustc-demangle", ] @@ -719,11 +718,11 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.5" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" +checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" dependencies = [ - "digest 0.10.6", + "digest 0.10.5", ] [[package]] @@ -733,7 +732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ "arrayvec 0.4.12", - "constant_time_eq 0.1.5", + "constant_time_eq", ] [[package]] @@ -744,7 +743,7 @@ checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq 0.1.5", + "constant_time_eq", ] [[package]] @@ -755,20 +754,20 @@ checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq 0.1.5", + "constant_time_eq", ] [[package]] name = "blake3" -version = "1.3.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" dependencies = [ "arrayref", "arrayvec 0.7.2", "cc", "cfg-if", - "constant_time_eq 0.2.4", + "constant_time_eq", ] [[package]] @@ -812,16 +811,16 @@ dependencies = [ [[package]] name = "blocking" -version = "1.3.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" +checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" dependencies = [ "async-channel", - "async-lock", "async-task", "atomic-waker", "fastrand", "futures-lite", + "once_cell", ] [[package]] @@ -856,9 +855,9 @@ checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byte-slice-cast" -version = "1.2.2" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" [[package]] name = "byte-tools" @@ -874,9 +873,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "bzip2-sys" @@ -928,9 +927,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -977,9 +976,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" dependencies = [ "iana-time-zone", "js-sys", @@ -1030,14 +1029,14 @@ checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" dependencies = [ "glob", "libc", - "libloading 0.7.4", + "libloading 0.7.3", ] [[package]] name = "clap" -version = "3.2.23" +version = "3.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" dependencies = [ "atty", "bitflags", @@ -1074,9 +1073,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.49" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" dependencies = [ "cc", ] @@ -1100,15 +1099,6 @@ dependencies = [ "cache-padded", ] -[[package]] -name = "concurrent-queue" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "const-oid" version = "0.7.1" @@ -1121,12 +1111,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "constant_time_eq" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" - [[package]] name = "convert_case" version = "0.4.0" @@ -1304,22 +1288,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.7.1", + "memoffset", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" dependencies = [ "cfg-if", ] @@ -1443,9 +1427,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.82" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" dependencies = [ "cc", "cxxbridge-flags", @@ -1455,9 +1439,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.82" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" dependencies = [ "cc", "codespan-reporting", @@ -1470,15 +1454,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.82" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" +checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" [[package]] name = "cxxbridge-macro" -version = "1.0.82" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" dependencies = [ "proc-macro2", "quote", @@ -1564,9 +1548,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -1756,9 +1740,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.3" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" dependencies = [ "atty", "humantime", @@ -1986,13 +1970,13 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ "crc32fast", "libz-sys", - "miniz_oxide 0.6.2", + "miniz_oxide", ] [[package]] @@ -2470,9 +2454,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.15" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" dependencies = [ "bytes", "fnv", @@ -2588,7 +2572,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.5", ] [[package]] @@ -2655,9 +2639,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.23" +version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" dependencies = [ "bytes", "futures-channel", @@ -2679,9 +2663,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" dependencies = [ "http", "hyper", @@ -2694,9 +2678,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2805,9 +2789,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", "hashbrown 0.12.3", @@ -2849,9 +2833,9 @@ checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" [[package]] name = "io-lifetimes" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" +checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0" [[package]] name = "ip_network" @@ -2861,9 +2845,9 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] name = "ipconfig" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" +checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" dependencies = [ "socket2", "widestring", @@ -2873,9 +2857,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "itertools" @@ -3068,12 +3052,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" -dependencies = [ - "cpufeatures", -] +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "kv-log-macro" @@ -3137,9 +3118,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" [[package]] name = "libloading" @@ -3153,9 +3134,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if", "winapi", @@ -3163,9 +3144,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.6" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "libp2p" @@ -3823,9 +3804,9 @@ dependencies = [ [[package]] name = "libp2p-pnet" -version = "0.22.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de160c5631696cea22be326c19bd9d306e254c4964945263aea10f25f6e0864e" +checksum = "1a5a702574223aa55d8878bdc8bf55c84a6086f87ddaddc28ce730b4caa81538" dependencies = [ "futures", "log", @@ -4412,9 +4393,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.5.8" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" dependencies = [ "libc", ] @@ -4428,15 +4409,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memory-db" version = "0.29.0" @@ -4481,25 +4453,16 @@ dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "mio" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys 0.36.1", ] [[package]] @@ -4547,7 +4510,7 @@ dependencies = [ "blake2s_simd", "blake3", "core2", - "digest 0.10.6", + "digest 0.10.5", "multihash-derive", "sha2 0.10.6", "sha3", @@ -4800,9 +4763,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -4831,9 +4794,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.16.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "opaque-debug" @@ -4855,9 +4818,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "os_str_bytes" -version = "6.4.1" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "owning_ref" @@ -5425,7 +5388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.4", + "parking_lot_core 0.9.5", ] [[package]] @@ -5444,9 +5407,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ "cfg-if", "libc", @@ -5485,7 +5448,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest 0.10.6", + "digest 0.10.5", ] [[package]] @@ -5570,9 +5533,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "platforms" @@ -5582,16 +5545,16 @@ checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" [[package]] name = "polling" -version = "2.5.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7d73f1eaed1ca1fb37b54dcc9b38e3b17d6c7b8ecb7abfffcac8d0351f17d4" +checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" dependencies = [ "autocfg", "cfg-if", "libc", "log", "wepoll-ffi", - "windows-sys 0.42.0", + "winapi", ] [[package]] @@ -5619,9 +5582,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "primitive-types" @@ -6006,10 +5969,11 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.6.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ + "autocfg", "crossbeam-deque", "either", "rayon-core", @@ -6017,9 +5981,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -6049,18 +6013,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.13" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" +checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.13" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" +checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" dependencies = [ "proc-macro2", "quote", @@ -6081,9 +6045,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -6101,9 +6065,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "region" @@ -6276,16 +6240,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.35.13" +version = "0.35.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +checksum = "985947f9b6423159c4726323f373be0a21bdb514c5af06a849cb3d2dce2d01e8" dependencies = [ "bitflags", "errno", - "io-lifetimes 0.7.5", + "io-lifetimes 0.7.4", "libc", "linux-raw-sys 0.0.46", - "windows-sys 0.42.0", + "windows-sys 0.36.1", ] [[package]] @@ -6699,7 +6663,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "parity-wasm 0.42.2", - "rustix 0.35.13", + "rustix 0.35.12", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -7190,9 +7154,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.3.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" +checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" dependencies = [ "bitvec", "cfg-if", @@ -7204,9 +7168,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" +checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7278,9 +7242,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" +checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" dependencies = [ "secp256k1-sys", ] @@ -7361,18 +7325,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.148" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.148" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -7381,9 +7345,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -7436,7 +7400,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.5", ] [[package]] @@ -7445,7 +7409,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.6", + "digest 0.10.5", "keccak", ] @@ -7528,9 +7492,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" -version = "1.1.0" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" +checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" [[package]] name = "snow" @@ -7814,7 +7778,7 @@ source = "git+https://github.com/Cardinal-Cryptography/substrate.git?branch=alep dependencies = [ "blake2", "byteorder", - "digest 0.10.6", + "digest 0.10.5", "sha2 0.10.6", "sha3", "sp-std", @@ -8263,9 +8227,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "ss58-registry" -version = "1.35.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0813c10b9dbdc842c2305f949f724c64866e4ef4d09c9151e96f6a2106773c" +checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" dependencies = [ "Inflector", "num-format", @@ -8498,9 +8462,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.104" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -8548,9 +8512,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" +checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" [[package]] name = "tempfile" @@ -8577,9 +8541,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.16.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" @@ -8632,9 +8596,9 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -8705,9 +8669,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" dependencies = [ "autocfg", "bytes", @@ -8982,7 +8946,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "digest 0.10.6", + "digest 0.10.5", "rand 0.8.5", "static_assertions", ] @@ -9451,7 +9415,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.6.5", + "memoffset", "more-asserts", "rand 0.8.5", "region", @@ -9705,18 +9669,18 @@ checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "winreg" -version = "0.10.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ "winapi", ] [[package]] name = "wyz" -version = "0.5.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] @@ -9788,9 +9752,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.4+zstd.1.5.2" +version = "2.0.1+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" +checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" dependencies = [ "cc", "libc", From 285c13de9865b0022750c7974598aca9a8937ecb Mon Sep 17 00:00:00 2001 From: timorl Date: Tue, 29 Nov 2022 13:59:18 +0100 Subject: [PATCH 3/7] A0-1635: Limit nonfinalized block production (#769) (#774) * A0-1635: Limit nonfinalized block production (#769) * Limit nonfinalized block production * Better saturation handling * Add log when delaying block production * Disable two tests that were operating under outdated assumptions * Disable one more test * Turn off the likely broken test --- .github/workflows/e2e-tests-main-devnet.yml | 2 +- Cargo.lock | 4 ++- bin/node/Cargo.toml | 4 ++- bin/node/src/aleph_cli.rs | 14 ++++++++++ bin/node/src/service.rs | 30 +++++++++++++++++++-- 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index 2c4bf8d040..95dc16e129 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -454,7 +454,7 @@ jobs: run-e2e-rewards-stake-change, run-e2e-rewards-change-stake-force-new-era, run-e2e-rewards-points-basic, - run-e2e-authorities-are-staking, +# run-e2e-authorities-are-staking, run-e2e-ban-automatic, run-e2e-version-upgrade, ] diff --git a/Cargo.lock b/Cargo.lock index 19c9d7a2c8..77a28868de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "aleph-node" -version = "0.8.1" +version = "0.8.2" dependencies = [ "aleph-runtime", "clap", @@ -250,6 +250,7 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-consensus-aura", + "sc-consensus-slots", "sc-executor", "sc-keystore", "sc-network", @@ -263,6 +264,7 @@ dependencies = [ "serde_json", "sp-api", "sp-application-crypto", + "sp-arithmetic", "sp-block-builder", "sp-blockchain", "sp-consensus", diff --git a/bin/node/Cargo.toml b/bin/node/Cargo.toml index 08af44903c..e2f4b4998a 100644 --- a/bin/node/Cargo.toml +++ b/bin/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-node" -version = "0.8.1" +version = "0.8.2" authors = ["Cardinal Cryptography"] description = "Aleph node binary" edition = "2021" @@ -43,6 +43,8 @@ sc-network = { git = "https://github.com/Cardinal-Cryptography/substrate.git", b sc-transaction-pool = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } sp-transaction-pool = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } sc-transaction-pool-api = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sp-arithmetic = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } +sc-consensus-slots = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } sc-consensus-aura = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } sp-consensus-aura = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } sp-consensus = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28" } diff --git a/bin/node/src/aleph_cli.rs b/bin/node/src/aleph_cli.rs index c43c3e336f..f2324c14b2 100644 --- a/bin/node/src/aleph_cli.rs +++ b/bin/node/src/aleph_cli.rs @@ -3,6 +3,7 @@ use std::path::PathBuf; use aleph_primitives::DEFAULT_UNIT_CREATION_DELAY; use clap::{ArgGroup, Parser}; use finality_aleph::UnitCreationDelay; +use log::warn; #[derive(Debug, Parser, Clone)] #[clap(group(ArgGroup::new("backup")))] @@ -33,6 +34,12 @@ pub struct AlephCli { /// with `--no-backup`, but note that that limits crash recoverability. #[clap(long, value_name = "PATH", group = "backup")] backup_path: Option, + + /// The maximum number of nonfinalized blocks, after which block production should be locally + /// stopped. DO NOT CHANGE THIS, PRODUCING MORE OR FEWER BLOCKS MIGHT BE CONSIDERED MALICIOUS + /// BEHAVIOUR AND PUNISHED ACCORDINGLY! + #[clap(long, default_value_t = 20)] + max_nonfinalized_blocks: u32, } impl AlephCli { @@ -55,4 +62,11 @@ impl AlephCli { pub fn no_backup(&self) -> bool { self.no_backup } + + pub fn max_nonfinalized_blocks(&self) -> u32 { + if self.max_nonfinalized_blocks != 20 { + warn!("Running block production with a value of max-nonfinalized-blocks {}, which is not the default of 20. THIS MIGHT BE CONSIDERED MALICIOUS BEHAVIOUR AND RESULT IN PENALTIES!", self.max_nonfinalized_blocks); + } + self.max_nonfinalized_blocks + } } diff --git a/bin/node/src/service.rs b/bin/node/src/service.rs index dc959eed0a..7fdf2e2d4a 100644 --- a/bin/node/src/service.rs +++ b/bin/node/src/service.rs @@ -15,6 +15,7 @@ use futures::channel::mpsc; use log::warn; use sc_client_api::{Backend, ExecutorProvider, HeaderBackend}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; +use sc_consensus_slots::BackoffAuthoringBlocksStrategy; use sc_network::NetworkService; use sc_service::{ error::Error as ServiceError, Configuration, KeystoreContainer, NetworkStarter, RpcHandlers, @@ -22,8 +23,9 @@ use sc_service::{ }; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_api::ProvideRuntimeApi; +use sp_arithmetic::traits::BaseArithmetic; use sp_blockchain::Backend as _; -use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; +use sp_consensus_aura::{sr25519::AuthorityPair as AuraPair, Slot}; use sp_runtime::{ generic::BlockId, traits::{Block as BlockT, Header as HeaderT, Zero}, @@ -35,6 +37,30 @@ type FullClient = sc_service::TFullClient; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; +struct LimitNonfinalized(u32); + +impl BackoffAuthoringBlocksStrategy for LimitNonfinalized { + fn should_backoff( + &self, + chain_head_number: N, + _chain_head_slot: Slot, + finalized_number: N, + _slow_now: Slot, + _logging_target: &str, + ) -> bool { + let nonfinalized_blocks: u32 = chain_head_number + .saturating_sub(finalized_number) + .unique_saturated_into(); + match nonfinalized_blocks >= self.0 { + true => { + warn!("We have {} nonfinalized blocks, with the limit being {}, delaying block production.", nonfinalized_blocks, self.0); + true + } + false => false, + } + } +} + fn backup_path(aleph_config: &AlephCli, base_path: &Path) -> Option { if aleph_config.no_backup() { return None; @@ -289,7 +315,7 @@ pub fn new_authority( ); let force_authoring = config.force_authoring; - let backoff_authoring_blocks: Option<()> = None; + let backoff_authoring_blocks = Some(LimitNonfinalized(aleph_config.max_nonfinalized_blocks())); let prometheus_registry = config.prometheus_registry().cloned(); let (_rpc_handlers, network, network_starter) = setup( From 9a665fbbb075da953df1b5408e4e17a7df75f251 Mon Sep 17 00:00:00 2001 From: Marcin Date: Thu, 1 Dec 2022 09:14:47 +0100 Subject: [PATCH 4/7] Changed node version --- bin/node/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/node/Cargo.toml b/bin/node/Cargo.toml index dc786ba0e0..94fc45d1d6 100644 --- a/bin/node/Cargo.toml +++ b/bin/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-node" -version = "0.8.2" +version = "0.8.2+mainnet" authors = ["Cardinal Cryptography"] description = "Aleph node binary" edition = "2021" From 8d217beaeca8531eec93c7b3007cc0debaa45102 Mon Sep 17 00:00:00 2001 From: Marcin Date: Thu, 1 Dec 2022 09:24:59 +0100 Subject: [PATCH 5/7] Fixed leftover conflicted line in lock file --- Cargo.lock | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1af1dc2475..d411818b45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -282,11 +282,7 @@ dependencies = [ [[package]] name = "aleph-runtime" -<<<<<<< HEAD version = "0.8.1" -======= -version = "0.8.0+mainnet" ->>>>>>> release-8-mainnet dependencies = [ "frame-executive", "frame-support", From 2214492483ba8e0d0c1cd8ba5566289e45fc971d Mon Sep 17 00:00:00 2001 From: Marcin Date: Thu, 1 Dec 2022 11:01:32 +0100 Subject: [PATCH 6/7] Reverted unwanted change to runtime/Cargo.toml --- Cargo.lock | 2 +- bin/runtime/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d411818b45..96de49d938 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "aleph-node" -version = "0.8.2" +version = "0.8.2+mainnet" dependencies = [ "aleph-runtime", "clap", diff --git a/bin/runtime/Cargo.toml b/bin/runtime/Cargo.toml index e106960f9e..4a4b30f344 100644 --- a/bin/runtime/Cargo.toml +++ b/bin/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleph-runtime" -version = "0.8.1" +version = "0.8.0+mainnet" authors = ["Cardinal Cryptography"] edition = "2021" homepage = "https://alephzero.org" From c8b3a5c8422b6b652cd39e13f8cefc0e713c1c2f Mon Sep 17 00:00:00 2001 From: Marcin Date: Thu, 1 Dec 2022 11:18:21 +0100 Subject: [PATCH 7/7] Updated Cargo.lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 96de49d938..d07508120c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -282,7 +282,7 @@ dependencies = [ [[package]] name = "aleph-runtime" -version = "0.8.1" +version = "0.8.0+mainnet" dependencies = [ "frame-executive", "frame-support",