From 2e72ec964d51d3176d663313f1b9da17f7617091 Mon Sep 17 00:00:00 2001 From: Maduka Terrence Date: Sun, 1 May 2022 19:57:13 +0000 Subject: [PATCH 1/3] Rename Epoch to Session in BABE and throughout any parts in Substrate --- Cargo.lock | 1504 ++++++++--------- bin/node/cli/Cargo.toml | 2 +- bin/node/cli/src/chain_spec.rs | 2 +- bin/node/cli/src/service.rs | 28 +- bin/node/rpc/Cargo.toml | 2 +- bin/node/rpc/src/lib.rs | 14 +- bin/node/runtime/src/constants.rs | 8 +- bin/node/runtime/src/lib.rs | 38 +- bin/node/testing/src/genesis.rs | 4 +- client/consensus/aura/src/lib.rs | 18 +- client/consensus/babe/Cargo.toml | 2 +- client/consensus/babe/README.md | 12 +- client/consensus/babe/rpc/Cargo.toml | 2 +- client/consensus/babe/rpc/src/lib.rs | 70 +- client/consensus/babe/src/authorship.rs | 52 +- client/consensus/babe/src/aux_schema.rs | 86 +- client/consensus/babe/src/lib.rs | 424 ++--- client/consensus/babe/src/migration.rs | 42 +- client/consensus/babe/src/tests.rs | 138 +- client/consensus/babe/src/verification.rs | 42 +- client/consensus/epochs/Cargo.toml | 4 +- client/consensus/epochs/README.md | 2 +- client/consensus/epochs/src/lib.rs | 890 +++++----- client/consensus/epochs/src/migration.rs | 54 +- client/consensus/manual-seal/Cargo.toml | 2 +- .../manual-seal/src/consensus/babe.rs | 120 +- client/consensus/slots/src/lib.rs | 34 +- client/network/README.md | 2 +- client/offchain/src/api/timestamp.rs | 4 +- client/service/src/metrics.rs | 4 +- client/sync-state-rpc/Cargo.toml | 2 +- client/sync-state-rpc/src/lib.rs | 16 +- frame/babe/Cargo.toml | 2 +- frame/babe/README.md | 2 +- frame/babe/src/lib.rs | 306 ++-- frame/babe/src/mock.rs | 8 +- frame/babe/src/randomness.rs | 74 +- frame/babe/src/tests.rs | 138 +- .../election-provider-multi-phase/src/lib.rs | 18 +- .../election-provider-multi-phase/src/mock.rs | 4 +- .../src/weights.rs | 4 +- primitives/beefy/src/commitment.rs | 4 +- primitives/blockchain/src/backend.rs | 4 +- primitives/consensus/babe/src/digests.rs | 28 +- primitives/consensus/babe/src/lib.rs | 78 +- primitives/staking/src/offence.rs | 2 +- test-utils/runtime/src/lib.rs | 34 +- 47 files changed, 2126 insertions(+), 2204 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a5ef8e09ae7b..519f9a5fcc3bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,30 +29,30 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3e798aa0c8239776f54415bc06f3d74b1850f3f830b45c35cfc80556973f70" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] name = "aes" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "495ee669413bfbe9e8cace80f4d3d78e6d8c8d99579f97fb93bde351b185f2d4" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if 1.0.0", "cipher", - "cpufeatures 0.1.5", + "cpufeatures", "opaque-debug 0.3.0", ] [[package]] name = "aes-gcm" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a930fd487faaa92a30afa92cc9dd1526a5cff67124abbbb1c617ce070f4dcf" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ "aead", "aes", @@ -68,9 +68,9 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.6", "once_cell", - "version_check 0.9.2", + "version_check 0.9.4", ] [[package]] @@ -93,24 +93,24 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.38" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" [[package]] name = "approx" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" dependencies = [ "num-traits", ] [[package]] name = "arbitrary" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "698b65a961a9d730fb45b6b0327e20207810c9f61ee421b082b27ba003f49e2b" +checksum = "c38b6b6b79f671c25e1a3e785b7b82d7562ffc9cd3efdc98627e5668a2472490" [[package]] name = "arrayref" @@ -135,21 +135,21 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "asn1_der" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6e24d2cce90c53b948c46271bfb053e4bdc2db9b5d3f65e20f8cf28a1b7fc3" +checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" [[package]] name = "assert_cmd" -version = "2.0.2" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e996dc7940838b7ef1096b882e29ec30a3149a3a443cdc8dba19ed382eca1fe2" +checksum = "93ae1ddd39efd67689deb1979d80bad3bf7f2b09c6e6117c8d1f2443b5e2f83e" dependencies = [ "bstr", "doc-comment", @@ -188,23 +188,23 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb877970c7b440ead138f6321a3b5395d6061183af779340b65e20c0fede9146" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" dependencies = [ "async-task", "concurrent-queue", "fastrand", "futures-lite", "once_cell", - "vec-arena", + "slab", ] [[package]] name = "async-global-executor" -version = "2.0.2" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" +checksum = "c290043c9a95b05d45e952fb6383c67bcb61471f60cfa21e890dba6654234f43" dependencies = [ "async-channel", "async-executor", @@ -230,16 +230,16 @@ dependencies = [ "parking", "polling", "slab", - "socket2 0.4.4", + "socket2", "waker-fn", "winapi 0.3.9", ] [[package]] name = "async-lock" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1996609732bde4a9988bc42125f55f2af5f3c36370e27c778d5191a4a1b63bfb" +checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" dependencies = [ "event-listener", ] @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "async-process" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6" +checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c" dependencies = [ "async-io", "blocking", @@ -282,7 +282,7 @@ dependencies = [ "async-io", "async-lock", "async-process", - "crossbeam-utils 0.8.5", + "crossbeam-utils 0.8.8", "futures-channel", "futures-core", "futures-io", @@ -293,7 +293,7 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "pin-utils", "slab", "wasm-bindgen-futures", @@ -310,15 +310,15 @@ dependencies = [ "futures-io", "futures-util", "pin-utils", - "socket2 0.4.4", + "socket2", "trust-dns-resolver", ] [[package]] name = "async-stream" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" +checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" dependencies = [ "async-stream-impl", "futures-core", @@ -326,9 +326,9 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" +checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" dependencies = [ "proc-macro2", "quote", @@ -337,15 +337,15 @@ dependencies = [ [[package]] name = "async-task" -version = "4.0.3" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" +checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" [[package]] name = "async-trait" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" +checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" dependencies = [ "proc-macro2", "quote", @@ -362,7 +362,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", ] [[package]] @@ -375,16 +375,16 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", ] [[package]] name = "atomic" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281" +checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", ] [[package]] @@ -406,36 +406,39 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.27.1", + "object 0.28.3", "rustc-demangle", ] [[package]] name = "base-x" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" +checksum = "dc19a4937b4fbd3fe3379793130e42060d10627a360f2127802b10b87e7baf74" [[package]] name = "base16ct" @@ -579,17 +582,16 @@ dependencies = [ [[package]] name = "bimap" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50ae17cabbc8a38a1e3e4c1a6a664e9a09672dc14d0896fa8d865d3a5a446b07" +checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" [[package]] name = "bincode" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "byteorder", "serde", ] @@ -632,9 +634,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94ba84325db59637ffc528bbe8c7f86c02c57cff5c0e2b9b00f9a851f42f309" +checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" dependencies = [ "digest 0.10.3", ] @@ -673,9 +675,9 @@ dependencies = [ [[package]] name = "blake3" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f" +checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" dependencies = [ "arrayref", "arrayvec 0.5.2", @@ -705,16 +707,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding 0.2.1", - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] name = "block-buffer" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] @@ -734,9 +736,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "blocking" -version = "1.0.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" +checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" dependencies = [ "async-channel", "async-task", @@ -754,9 +756,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "lazy_static", "memchr", @@ -775,15 +777,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.6.1" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "byte-slice-cast" -version = "1.0.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c1bf4a04a88c54f589125563643d773f3254b5c38571395e2b591c693bbc81" +checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" [[package]] name = "byte-tools" @@ -814,9 +816,9 @@ dependencies = [ [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" @@ -847,24 +849,24 @@ dependencies = [ [[package]] name = "cache-padded" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" +checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" [[package]] name = "camino" -version = "1.0.4" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4648c6d00a709aa069a236adcaae4f605a6241c72bf5bee79331a4b625921a9" +checksum = "6f3132262930b0522068049f5870a856ab8affc80c70d08b6ecb785771a6fc23" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0226944a63d1bf35a3b5f948dd7c59e263db83695c9e8bffc4037de02e30f1d7" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" dependencies = [ "serde", ] @@ -877,25 +879,25 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.4", + "semver 1.0.7", "serde", "serde_json", ] [[package]] name = "cast" -version = "0.2.3" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" dependencies = [ - "rustc_version 0.2.3", + "rustc_version 0.4.0", ] [[package]] name = "cc" -version = "1.0.71" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -929,7 +931,7 @@ checksum = "01b72a433d0cf2aef113ba70f62634c56fddb0f244e6377185c56a7cadbd8f91" dependencies = [ "cfg-if 1.0.0", "cipher", - "cpufeatures 0.2.1", + "cpufeatures", "zeroize", ] @@ -951,9 +953,9 @@ name = "chain-spec-builder" version = "2.0.0" dependencies = [ "ansi_term", - "clap 3.1.6", + "clap 3.1.14", "node-cli", - "rand 0.8.4", + "rand 0.8.5", "sc-chain-spec", "sc-keystore", "sp-core", @@ -990,7 +992,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] @@ -1004,13 +1006,13 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c" +checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" dependencies = [ "glob", "libc", - "libloading 0.7.0", + "libloading 0.7.3", ] [[package]] @@ -1026,16 +1028,16 @@ dependencies = [ [[package]] name = "clap" -version = "3.1.6" +version = "3.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" +checksum = "535434c063ced786eb04aaf529308092c5ab60889e8fe24275d15de07b01fa97" dependencies = [ "atty", "bitflags", "clap_derive", + "clap_lex", "indexmap", "lazy_static", - "os_str_bytes", "strsim", "termcolor", "textwrap 0.15.0", @@ -1043,18 +1045,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "3.0.2" +version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a394f7ec0715b42a4e52b294984c27c9a61f77c8d82f7774c5198350be143f19" +checksum = "1d7ca9141e27e6ebc52e3c378b0c07f3cea52db46ed1cc5861735fb697b56356" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", ] [[package]] name = "clap_derive" -version = "3.1.4" +version = "3.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16" +checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -1063,6 +1065,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "cloudabi" version = "0.0.3" @@ -1126,38 +1137,22 @@ dependencies = [ [[package]] name = "cpp_demangle" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44919ecaf6f99e8e737bc239408931c9a01e9a6c74814fee8242dd2506b65390" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ "cfg-if 1.0.0", - "glob", -] - -[[package]] -name = "cpufeatures" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" -dependencies = [ - "libc", ] [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ "libc", ] -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - [[package]] name = "cranelift-bforest" version = "0.76.0" @@ -1309,9 +1304,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", ] @@ -1356,12 +1351,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.0" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.5", + "crossbeam-utils 0.8.8", ] [[package]] @@ -1372,17 +1367,18 @@ checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", - "crossbeam-utils 0.8.5", + "crossbeam-utils 0.8.8", ] [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ + "autocfg 1.1.0", "cfg-if 1.0.0", - "crossbeam-utils 0.8.5", + "crossbeam-utils 0.8.8", "lazy_static", "memoffset", "scopeguard", @@ -1394,16 +1390,16 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "cfg-if 0.1.10", "lazy_static", ] [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ "cfg-if 1.0.0", "lazy_static", @@ -1421,8 +1417,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" dependencies = [ - "generic-array 0.14.4", - "rand_core 0.6.2", + "generic-array 0.14.5", + "rand_core 0.6.3", "subtle", "zeroize", ] @@ -1433,7 +1429,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", "typenum", ] @@ -1443,7 +1439,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", "subtle", ] @@ -1453,7 +1449,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", "subtle", ] @@ -1485,14 +1481,14 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" dependencies = [ - "sct 0.6.0", + "sct 0.6.1", ] [[package]] name = "ctor" -version = "0.1.19" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19" +checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" dependencies = [ "quote", "syn", @@ -1520,9 +1516,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "434e1720189a637d44fe464f4df1e6eb900b4835255b14354497c78af37d9bb8" +checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" dependencies = [ "byteorder", "digest 0.8.1", @@ -1533,9 +1529,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.0.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ "byteorder", "digest 0.9.0", @@ -1552,16 +1548,16 @@ checksum = "4033478fbf70d6acf2655ac70da91ee65852d69daf7a67bf7a2f518fb47aafcf" dependencies = [ "byteorder", "digest 0.9.0", - "rand_core 0.6.2", + "rand_core 0.6.3", "subtle", "zeroize", ] [[package]] name = "darling" -version = "0.13.0" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "757c0ded2af11d8e739c4daea1ac623dd1624b06c844cf3f5a39f1bdbd99bb12" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ "darling_core", "darling_macro", @@ -1569,23 +1565,22 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.13.0" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c34d8efb62d0c2d7f60ece80f75e5c63c1588ba68032740494b0b9a996466e3" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", "syn", ] [[package]] name = "darling_macro" -version = "0.13.0" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade7bff147130fe5e6d39f089c6bd49ec0250f35d70b2eebf72afdfc919f15cc" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", @@ -1600,9 +1595,9 @@ checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] name = "data-encoding-macro" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a94feec3d2ba66c0b6621bca8bc6f68415b1e5c69af3586fdd0af9fd9f29b17" +checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1610,9 +1605,9 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f83e699727abca3c56e187945f303389590305ab2f0185ea445aa66e8d5f2a" +checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" dependencies = [ "data-encoding", "syn", @@ -1629,14 +1624,14 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.16" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.3.3", + "rustc_version 0.4.0", "syn", ] @@ -1667,7 +1662,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] @@ -1676,7 +1671,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ - "block-buffer 0.10.0", + "block-buffer 0.10.2", "crypto-common", "subtle", ] @@ -1713,12 +1708,12 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", - "redox_users 0.4.0", + "redox_users 0.4.3", "winapi 0.3.9", ] @@ -1729,15 +1724,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users 0.4.0", + "redox_users 0.4.3", "winapi 0.3.9", ] [[package]] name = "dissimilar" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4b29f4b9bb94bf267d57269fd0706d343a160937108e9619fe380645428abb" +checksum = "8c97b9233581d84b8e1e689cdd3a47b6f69770084fc246e86a7f78b0d9c1d4a5" [[package]] name = "dns-parser" @@ -1817,7 +1812,7 @@ checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" dependencies = [ "byteorder", "dynasm", - "memmap2 0.5.0", + "memmap2 0.5.3", ] [[package]] @@ -1834,9 +1829,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.0.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" +checksum = "3d5c4b5e5959dc2c2b89918d8e2cc40fcdd623cef026ed09d2f0ee05199dc8e4" dependencies = [ "signature", ] @@ -1847,11 +1842,11 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ - "curve25519-dalek 3.0.2", + "curve25519-dalek 3.2.0", "ed25519", "rand 0.7.3", "serde", - "sha2 0.9.8", + "sha2 0.9.9", "zeroize", ] @@ -1871,9 +1866,9 @@ dependencies = [ "crypto-bigint", "der", "ff", - "generic-array 0.14.4", + "generic-array 0.14.5", "group", - "rand_core 0.6.2", + "rand_core 0.6.3", "sec1", "subtle", "zeroize", @@ -1919,9 +1914,9 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3ab37dc79652c9d85f1f7b6070d77d321d2467f5fe7b00d6b7a86c57b092ae" +checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" dependencies = [ "enumflags2_derive", ] @@ -1939,18 +1934,18 @@ dependencies = [ [[package]] name = "enumset" -version = "1.0.7" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e76129da36102af021b8e5000dab2c1c30dbef85c1e482beeff8da5dde0e0b0" +checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.5.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6451128aa6655d880755345d085494cf7561a6bee7c8dc821e5d77e6d267ecd4" +checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" dependencies = [ "darling", "proc-macro2", @@ -1958,19 +1953,6 @@ dependencies = [ "syn", ] -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime 1.3.0", - "log 0.4.16", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.8.4" @@ -1988,7 +1970,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" dependencies = [ "atty", - "humantime 2.1.0", + "humantime", "log 0.4.16", "regex", "termcolor", @@ -2013,19 +1995,19 @@ dependencies = [ [[package]] name = "errno-dragonfly" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "gcc", + "cc", "libc", ] [[package]] name = "event-listener" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" +checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" [[package]] name = "exit-future" @@ -2072,17 +2054,17 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2958d04124b9f27f175eaeb9a9f383d026098aa837eadd8ba22c11f13a05b9e" dependencies = [ - "rand_core 0.6.2", + "rand_core 0.6.3", "subtle", ] [[package]] name = "file-per-thread-logger" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126" +checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" dependencies = [ - "env_logger 0.7.1", + "env_logger 0.9.0", "log 0.4.16", ] @@ -2099,7 +2081,7 @@ dependencies = [ "num-traits", "parity-scale-codec", "parking_lot 0.11.2", - "rand 0.8.4", + "rand 0.8.5", "scale-info", ] @@ -2110,22 +2092,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ "byteorder", - "rand 0.8.4", + "rand 0.8.5", "rustc-hex", "static_assertions", ] [[package]] name = "fixedbitset" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e" +checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" [[package]] name = "flate2" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" +checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" dependencies = [ "cfg-if 1.0.0", "crc32fast", @@ -2182,7 +2164,7 @@ dependencies = [ "linregress", "log 0.4.16", "parity-scale-codec", - "paste 1.0.6", + "paste 1.0.7", "scale-info", "serde", "sp-api", @@ -2201,7 +2183,7 @@ version = "4.0.0-dev" dependencies = [ "Inflector", "chrono", - "clap 3.1.6", + "clap 3.1.14", "frame-benchmarking", "frame-support", "frame-system", @@ -2216,7 +2198,7 @@ dependencies = [ "memory-db", "parity-scale-codec", "prettytable-rs", - "rand 0.8.4", + "rand 0.8.5", "rand_pcg 0.3.1", "sc-block-builder", "sc-cli", @@ -2282,13 +2264,13 @@ dependencies = [ name = "frame-election-solution-type-fuzzer" version = "2.0.0-alpha.5" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-support", "honggfuzz", "parity-scale-codec", - "rand 0.8.4", + "rand 0.8.5", "scale-info", "sp-arithmetic", "sp-npos-elections", @@ -2342,7 +2324,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "parity-util-mem", - "paste 1.0.6", + "paste 1.0.7", "pretty_assertions", "scale-info", "serde", @@ -2601,16 +2583,16 @@ checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" [[package]] name = "futures-lite" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" dependencies = [ "fastrand", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "waker-fn", ] @@ -2632,7 +2614,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01fe9932a224b72b45336d96040aa86386d674a31d0af27d800ea7bc8ca97fe" dependencies = [ "futures-io", - "rustls 0.20.2", + "rustls 0.20.4", "webpki 0.22.0", ] @@ -2668,17 +2650,11 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "pin-utils", "slab", ] -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" - [[package]] name = "generate-bags" version = "4.0.0-dev" @@ -2704,12 +2680,12 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", - "version_check 0.9.2", + "version_check 0.9.4", ] [[package]] @@ -2727,9 +2703,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", "libc", @@ -2738,9 +2714,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b442c439366184de619215247d24e908912b175e824a530253845ac4c251a5c1" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug 0.3.0", "polyval", @@ -2778,7 +2754,7 @@ dependencies = [ "libc", "libgit2-sys", "log 0.4.16", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -2789,9 +2765,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" +checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" dependencies = [ "aho-corasick", "bstr", @@ -2802,15 +2778,14 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" dependencies = [ "futures-channel", "futures-core", "js-sys", "wasm-bindgen", - "web-sys", ] [[package]] @@ -2820,15 +2795,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" dependencies = [ "ff", - "rand_core 0.6.2", + "rand_core 0.6.3", "subtle", ] [[package]] name = "h2" -version = "0.3.9" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" dependencies = [ "bytes 1.1.0", "fnv", @@ -2839,15 +2814,15 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.6.7", + "tokio-util 0.7.1", "tracing", ] [[package]] name = "half" -version = "1.7.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "handlebars" @@ -2858,7 +2833,7 @@ dependencies = [ "log 0.4.16", "pest", "pest_derive", - "quick-error 2.0.0", + "quick-error 2.0.1", "serde", "serde_json", ] @@ -2898,9 +2873,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] @@ -2913,9 +2888,9 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] @@ -2965,7 +2940,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", - "generic-array 0.14.4", + "generic-array 0.14.5", "hmac 0.8.1", ] @@ -2993,46 +2968,37 @@ dependencies = [ [[package]] name = "http" -version = "0.2.3" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" dependencies = [ "bytes 1.1.0", "fnv", - "itoa 0.4.8", + "itoa 1.0.1", ] [[package]] name = "http-body" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes 1.1.0", "http", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", ] [[package]] name = "httparse" -version = "1.5.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "httpdate" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" - -[[package]] -name = "humantime" -version = "1.3.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error 1.2.3", -] +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humantime" @@ -3061,9 +3027,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.16" +version = "0.14.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" dependencies = [ "bytes 1.1.0", "futures-channel", @@ -3074,9 +3040,9 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 0.4.8", - "pin-project-lite 0.2.6", - "socket2 0.4.4", + "itoa 1.0.1", + "pin-project-lite 0.2.9", + "socket2", "tokio", "tower-service", "tracing", @@ -3091,7 +3057,7 @@ checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ "ct-logs", "futures-util", - "hyper 0.14.16", + "hyper 0.14.18", "log 0.4.16", "rustls 0.19.1", "rustls-native-certs 0.5.0", @@ -3107,7 +3073,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes 1.1.0", - "hyper 0.14.16", + "hyper 0.14.18", "native-tls", "tokio", "tokio-native-tls", @@ -3180,9 +3146,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" dependencies = [ "serde", ] @@ -3200,11 +3166,11 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "hashbrown 0.11.2", "serde", ] @@ -3254,7 +3220,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" dependencies = [ - "socket2 0.4.4", + "socket2", "widestring", "winapi 0.3.9", "winreg", @@ -3289,18 +3255,18 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "jobserver" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.54" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1866b355d9c878e5e607473cbe3f63282c0b7aad2db1dbebf55076c686918254" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" dependencies = [ "wasm-bindgen", ] @@ -3313,7 +3279,7 @@ checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a" dependencies = [ "derive_more", "futures 0.3.21", - "hyper 0.14.16", + "hyper 0.14.18", "hyper-tls", "jsonrpc-core", "jsonrpc-pubsub", @@ -3369,7 +3335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff" dependencies = [ "futures 0.3.21", - "hyper 0.14.16", + "hyper 0.14.18", "jsonrpc-core", "jsonrpc-server-utils", "log 0.4.16", @@ -3422,7 +3388,7 @@ dependencies = [ "log 0.4.16", "tokio", "tokio-stream", - "tokio-util 0.6.7", + "tokio-util 0.6.9", "unicase 2.6.0", ] @@ -3464,11 +3430,11 @@ dependencies = [ "jsonrpsee-core", "jsonrpsee-types", "pin-project 1.0.10", - "rustls-native-certs 0.6.1", + "rustls-native-certs 0.6.2", "soketto", "thiserror", "tokio", - "tokio-rustls 0.23.2", + "tokio-rustls 0.23.3", "tokio-util 0.7.1", "tracing", "webpki-roots", @@ -3481,12 +3447,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82ef77ecd20c2254d54f5da8c0738eacca61e6b6511268a8f2753e3148c6c706" dependencies = [ "anyhow", - "arrayvec 0.7.1", + "arrayvec 0.7.2", "async-trait", "beef", "futures-channel", "futures-util", - "hyper 0.14.16", + "hyper 0.14.18", "jsonrpsee-types", "rustc-hash", "serde", @@ -3536,9 +3502,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cc5937366afd3b38071f400d1ce5bd8b1d40b5083cc14e6f8dbcc4032a7f5bb" +checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" dependencies = [ "cfg-if 1.0.0", "ecdsa", @@ -3641,15 +3607,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "leb128" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" [[package]] name = "libgit2-sys" @@ -3675,9 +3641,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if 1.0.0", "winapi 0.3.9", @@ -3685,9 +3651,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" [[package]] name = "libp2p" @@ -3699,7 +3665,7 @@ dependencies = [ "bytes 1.1.0", "futures 0.3.21", "futures-timer", - "getrandom 0.2.3", + "getrandom 0.2.6", "instant", "lazy_static", "libp2p-autonat", @@ -3750,7 +3716,7 @@ dependencies = [ "log 0.4.16", "prost", "prost-build", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -3777,7 +3743,7 @@ dependencies = [ "pin-project 1.0.10", "prost", "prost-build", - "rand 0.8.4", + "rand 0.8.5", "ring", "rw-stream-sink", "sha2 0.10.2", @@ -3919,9 +3885,9 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log 0.4.16", - "rand 0.8.4", + "rand 0.8.5", "smallvec 1.8.0", - "socket2 0.4.4", + "socket2", "void", ] @@ -3966,14 +3932,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dd7e0c94051cda67123be68cf6b65211ba3dde7277be9068412de3e7ffd63ef" dependencies = [ "bytes 1.1.0", - "curve25519-dalek 3.0.2", + "curve25519-dalek 3.2.0", "futures 0.3.21", "lazy_static", "libp2p-core", "log 0.4.16", "prost", "prost-build", - "rand 0.8.4", + "rand 0.8.5", "sha2 0.10.2", "snow", "static_assertions", @@ -4046,7 +4012,7 @@ dependencies = [ "pin-project 1.0.10", "prost", "prost-build", - "rand 0.8.4", + "rand 0.8.5", "smallvec 1.8.0", "static_assertions", "thiserror", @@ -4070,7 +4036,7 @@ dependencies = [ "log 0.4.16", "prost", "prost-build", - "rand 0.8.4", + "rand 0.8.5", "sha2 0.10.2", "thiserror", "unsigned-varint 0.7.1", @@ -4139,7 +4105,7 @@ dependencies = [ "libc", "libp2p-core", "log 0.4.16", - "socket2 0.4.4", + "socket2", ] [[package]] @@ -4182,7 +4148,7 @@ dependencies = [ "quicksink", "rw-stream-sink", "soketto", - "url 2.2.1", + "url 2.2.2", "webpki-roots", ] @@ -4227,9 +4193,9 @@ dependencies = [ "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", - "rand 0.8.4", + "rand 0.8.5", "serde", - "sha2 0.9.8", + "sha2 0.9.9", "typenum", ] @@ -4264,9 +4230,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.2" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655" +checksum = "92e7e15d7610cce1d9752e137625f14e61a28cd45929b6e12e47b50fe154ee2e" dependencies = [ "cc", "libc", @@ -4334,10 +4300,11 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg 1.1.0", "scopeguard", ] @@ -4401,9 +4368,9 @@ dependencies = [ [[package]] name = "lz4" -version = "1.23.2" +version = "1.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac20ed6991e01bf6a2e68cc73df2b389707403662a8ba89f68511fb340f724c" +checksum = "4edcb94251b1c375c459e5abe9fb0168c1c826c3370172684844f8f3f8d1a885" dependencies = [ "libc", "lz4-sys", @@ -4411,9 +4378,9 @@ dependencies = [ [[package]] name = "lz4-sys" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca79aa95d8b3226213ad454d328369853be3a1382d89532a854f4d69640acae" +checksum = "d7be8908e2ed6f31c02db8a9fa962f03e36c53fbfde437363eae3306b85d7e17" dependencies = [ "cc", "libc", @@ -4451,15 +4418,15 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "matrixmultiply" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8a15b776d9dfaecd44b03c5828c2199cddff5247215858aac14624f8d6b741" +checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" dependencies = [ "rawpointer", ] @@ -4472,9 +4439,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap" @@ -4488,29 +4455,29 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6" +checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" dependencies = [ "libc", ] [[package]] name = "memmap2" -version = "0.5.0" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4647a11b578fead29cdbb34d4adef8dd3dc35b876c9c6d5240d83f205abfe96e" +checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f" dependencies = [ "libc", ] [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", ] [[package]] @@ -4559,12 +4526,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" dependencies = [ "adler", - "autocfg 1.0.1", ] [[package]] @@ -4588,14 +4554,15 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" +checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" dependencies = [ "libc", "log 0.4.16", - "miow 0.3.6", + "miow 0.3.7", "ntapi", + "wasi 0.11.0+wasi-snapshot-preview1", "winapi 0.3.9", ] @@ -4625,19 +4592,18 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "socket2 0.3.19", "winapi 0.3.9", ] [[package]] name = "more-asserts" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" +checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" [[package]] name = "multiaddr" @@ -4654,7 +4620,7 @@ dependencies = [ "serde", "static_assertions", "unsigned-varint 0.7.1", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -4678,9 +4644,9 @@ dependencies = [ "blake2s_simd", "blake3", "digest 0.9.0", - "generic-array 0.14.4", + "generic-array 0.14.5", "multihash-derive 0.7.2", - "sha2 0.9.8", + "sha2 0.9.9", "sha3 0.9.1", "unsigned-varint 0.5.1", ] @@ -4728,9 +4694,9 @@ dependencies = [ [[package]] name = "multimap" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" @@ -4758,7 +4724,7 @@ dependencies = [ "num-complex", "num-rational 0.4.0", "num-traits", - "rand 0.8.4", + "rand 0.8.5", "rand_distr", "simba", "typenum", @@ -4781,14 +4747,14 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7d66043b25d4a6cccb23619d10c19c25304b355a7dccd4a8e11423dd2382146" dependencies = [ - "rand 0.8.4", + "rand 0.8.5", ] [[package]] name = "native-tls" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" dependencies = [ "lazy_static", "libc", @@ -4847,7 +4813,7 @@ checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" dependencies = [ "anyhow", "byteorder", - "paste 1.0.6", + "paste 1.0.7", "thiserror", ] @@ -4908,7 +4874,7 @@ dependencies = [ name = "node-bench" version = "0.9.0-dev" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "derive_more", "fs_extra", "futures 0.3.21", @@ -4947,7 +4913,7 @@ version = "3.0.0-dev" dependencies = [ "assert_cmd", "async-std", - "clap 3.1.6", + "clap 3.1.14", "clap_complete", "criterion", "frame-benchmarking-cli", @@ -4969,7 +4935,7 @@ dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "platforms", - "rand 0.8.4", + "rand 0.8.5", "regex", "remote-externalities", "sc-authority-discovery", @@ -4981,7 +4947,7 @@ dependencies = [ "sc-client-db", "sc-consensus", "sc-consensus-babe", - "sc-consensus-epochs", + "sc-consensus-sessions", "sc-consensus-slots", "sc-consensus-uncles", "sc-executor", @@ -5061,7 +5027,7 @@ dependencies = [ name = "node-inspect" version = "0.9.0-dev" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "parity-scale-codec", "sc-cli", "sc-client-api", @@ -5098,7 +5064,7 @@ dependencies = [ "sc-client-api", "sc-consensus-babe", "sc-consensus-babe-rpc", - "sc-consensus-epochs", + "sc-consensus-sessions", "sc-finality-grandpa", "sc-finality-grandpa-rpc", "sc-rpc", @@ -5211,7 +5177,7 @@ dependencies = [ name = "node-runtime-generate-bags" version = "3.0.0" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "generate-bags", "node-runtime", ] @@ -5220,7 +5186,7 @@ dependencies = [ name = "node-template" version = "4.0.0-dev" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", @@ -5343,20 +5309,19 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.0" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" dependencies = [ "memchr", "minimal-lexical", - "version_check 0.9.2", ] [[package]] name = "ntapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" dependencies = [ "winapi 0.3.9", ] @@ -5367,16 +5332,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" +checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" dependencies = [ "num-traits", ] @@ -5393,11 +5358,11 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-traits", ] @@ -5407,7 +5372,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-bigint", "num-integer", "num-traits", @@ -5419,7 +5384,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-integer", "num-traits", ] @@ -5430,7 +5395,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "libm", ] @@ -5493,9 +5458,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.35" +version = "0.10.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -5507,17 +5472,17 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.65" +version = "0.9.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" +checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "cc", "libc", "pkg-config", @@ -5529,15 +5494,12 @@ name = "os_str_bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] [[package]] name = "output_vt100" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" +checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ "winapi 0.3.9", ] @@ -5709,7 +5671,7 @@ dependencies = [ "frame-election-provider-support", "honggfuzz", "pallet-bags-list", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -5863,7 +5825,7 @@ dependencies = [ "pallet-utility", "parity-scale-codec", "pretty_assertions", - "rand 0.8.4", + "rand 0.8.5", "rand_pcg 0.3.1", "scale-info", "serde", @@ -6861,9 +6823,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d121a9af17a43efd0a38c6afa508b927ba07785bd4709efb2ac03bf77efef8d" +checksum = "b3e7f385d61562f5834282b90aa50b41f38a35cf64d5209b8b05487b50553dbe" dependencies = [ "blake2-rfc", "crc32fast", @@ -6872,19 +6834,19 @@ dependencies = [ "libc", "log 0.4.16", "lz4", - "memmap2 0.2.1", + "memmap2 0.2.3", "parking_lot 0.11.2", - "rand 0.8.4", + "rand 0.8.5", "snap", ] [[package]] name = "parity-scale-codec" -version = "3.0.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a7f3fcf5e45fc28b84dcdab6b983e77f197ec01f325a33f404ba6855afd1070" +checksum = "e8b44461635bbb1a0300f100a841e571e7d919c81c73075ef5d152ffdb521066" dependencies = [ - "arrayvec 0.7.1", + "arrayvec 0.7.2", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", @@ -6894,9 +6856,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.0.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6e626dc84025ff56bf1476ed0e30d10c84d7f89a475ef46ebabee1095a8fba" +checksum = "c45ed1f39709f5a89338fab50e59816b2e8815f5bb58276e7ddf9afd495f73f8" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -6968,9 +6930,9 @@ checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "parity-ws" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab8a461779bd022964cae2b4989fa9c99deb270bec162da2125ec03c09fcaa" +checksum = "5983d3929ad50f12c3eb9a6743f19d691866ecd44da74c0a3308c3f8a56df0c6" dependencies = [ "byteorder", "bytes 0.4.12", @@ -6981,7 +6943,7 @@ dependencies = [ "rand 0.7.3", "sha-1 0.8.2", "slab", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -7008,7 +6970,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api 0.4.6", + "lock_api 0.4.7", "parking_lot_core 0.8.5", ] @@ -7018,8 +6980,8 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ - "lock_api 0.4.6", - "parking_lot_core 0.9.1", + "lock_api 0.4.7", + "parking_lot_core 0.9.3", ] [[package]] @@ -7046,20 +7008,20 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.10", + "redox_syscall 0.2.13", "smallvec 1.8.0", "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.10", + "redox_syscall 0.2.13", "smallvec 1.8.0", "windows-sys", ] @@ -7076,9 +7038,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" [[package]] name = "paste-impl" @@ -7180,11 +7142,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.27" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909" dependencies = [ - "pin-project-internal 0.4.27", + "pin-project-internal 0.4.29", ] [[package]] @@ -7198,9 +7160,9 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "0.4.27" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a" dependencies = [ "proc-macro2", "quote", @@ -7226,9 +7188,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -7238,9 +7200,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "platforms" @@ -7263,66 +7225,66 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" [[package]] name = "plotters-svg" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" dependencies = [ "plotters-backend", ] [[package]] name = "polling" -version = "2.0.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4" +checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", "log 0.4.16", - "wepoll-sys", + "wepoll-ffi", "winapi 0.3.9", ] [[package]] name = "poly1305" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fcffab1f78ebbdf4b93b68c1ffebc24037eedf271edaca795732b24e5e4e349" +checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ - "cpufeatures 0.1.5", + "cpufeatures", "opaque-debug 0.3.0", "universal-hash", ] [[package]] name = "polyval" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6ba6a405ef63530d6cb12802014b22f9c5751bd17cdcddbe9e46d5c8ae83287" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" dependencies = [ "cfg-if 1.0.0", - "cpufeatures 0.1.5", + "cpufeatures", "opaque-debug 0.3.0", "universal-hash", ] [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "predicates" -version = "2.0.2" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c143348f141cc87aab5b950021bac6145d0e5ae754b0591de23244cee42c9308" +checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c" dependencies = [ "difflib", "itertools", @@ -7331,25 +7293,25 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451" +checksum = "da1c2388b1513e1b605fcec39a95e0a9e8ef088f71443ef37099fa9ae6673fcb" [[package]] name = "predicates-tree" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2" +checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032" dependencies = [ "predicates-core", - "treeline", + "termtree", ] [[package]] name = "pretty_assertions" -version = "1.0.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0cfe1b2403f172ba0f234e500906ee0a3e493fb81092dac23ebefe129301cc" +checksum = "c89f989ac94207d048d92db058e4f6ec7342b0971fc58d1271ca148b799b3563" dependencies = [ "ansi_term", "ctor", @@ -7413,7 +7375,7 @@ dependencies = [ "proc-macro2", "quote", "syn", - "version_check 0.9.2", + "version_check 0.9.4", ] [[package]] @@ -7424,7 +7386,7 @@ checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", - "version_check 0.9.2", + "version_check 0.9.4", ] [[package]] @@ -7496,7 +7458,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" dependencies = [ "bytes 1.1.0", - "heck 0.3.2", + "heck 0.3.3", "itertools", "lazy_static", "log 0.4.16", @@ -7534,9 +7496,9 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.12" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3abf49e5417290756acfd26501536358560c4a5cc4a0934d390939acb3e7083a" +checksum = "871372391786ccec00d3c5d3d6608905b3d4db263639cfe075d3b60a736d115a" dependencies = [ "cc", ] @@ -7569,9 +7531,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-error" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quickcheck" @@ -7581,7 +7543,7 @@ checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" dependencies = [ "env_logger 0.8.4", "log 0.4.16", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -7616,7 +7578,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ - "autocfg 0.1.7", + "autocfg 0.1.8", "libc", "rand_chacha 0.1.1", "rand_core 0.4.2", @@ -7645,14 +7607,13 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", - "rand_hc 0.3.0", + "rand_chacha 0.3.1", + "rand_core 0.6.3", ] [[package]] @@ -7661,7 +7622,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" dependencies = [ - "autocfg 0.1.7", + "autocfg 0.1.8", "rand_core 0.3.1", ] @@ -7677,12 +7638,12 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -7711,11 +7672,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.6", ] [[package]] @@ -7725,7 +7686,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ "num-traits", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -7746,15 +7707,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core 0.6.2", -] - [[package]] name = "rand_isaac" version = "0.1.1" @@ -7795,7 +7747,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" dependencies = [ - "autocfg 0.1.7", + "autocfg 0.1.8", "rand_core 0.4.2", ] @@ -7814,7 +7766,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" dependencies = [ - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -7834,11 +7786,11 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "crossbeam-deque", "either", "rayon-core", @@ -7846,14 +7798,13 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.0" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4" dependencies = [ "crossbeam-channel", "crossbeam-deque", - "crossbeam-utils 0.8.5", - "lazy_static", + "crossbeam-utils 0.8.8", "num_cpus", ] @@ -7874,9 +7825,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] @@ -7894,28 +7845,29 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.3", - "redox_syscall 0.2.10", + "getrandom 0.2.6", + "redox_syscall 0.2.13", + "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +checksum = "685d58625b6c2b83e4cc88a27c4bf65adb7b6b16dbdc413e515c9405b47432ab" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" +checksum = "a043824e29c94169374ac5183ac0ed43f5724dc4556b19568007486bd840fa1f" dependencies = [ "proc-macro2", "quote", @@ -7957,11 +7909,10 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "byteorder", "regex-syntax", ] @@ -8044,9 +7995,9 @@ dependencies = [ [[package]] name = "retain_mut" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "448296241d034b96c11173591deaa1302f2c17b56092106c1f92c1bc0183a8c9" +checksum = "8c31b5c4033f8fdde8700e4657be2c497e7288f01515be52168c631e2e4d4086" [[package]] name = "rfc6979" @@ -8143,14 +8094,14 @@ dependencies = [ "base64 0.13.0", "blake2b_simd", "constant_time_eq", - "crossbeam-utils 0.8.5", + "crossbeam-utils 0.8.8", ] [[package]] name = "rustc-demangle" -version = "0.1.18" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustc-hash" @@ -8173,29 +8124,20 @@ dependencies = [ "semver 0.9.0", ] -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.4", + "semver 1.0.7", ] [[package]] name = "rustix" -version = "0.33.5" +version = "0.33.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03627528abcc4a365554d32a9f3bbf67f7694c102cfeda792dc86a2d6057cc85" +checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0" dependencies = [ "bitflags", "errno", @@ -8214,15 +8156,15 @@ dependencies = [ "base64 0.13.0", "log 0.4.16", "ring", - "sct 0.6.0", + "sct 0.6.1", "webpki 0.21.4", ] [[package]] name = "rustls" -version = "0.20.2" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" +checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921" dependencies = [ "log 0.4.16", "ring", @@ -8244,9 +8186,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca9ebdfa27d3fc180e42879037b5338ab1c040c06affd00d8338598e7800943" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -8256,9 +8198,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "0.2.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" dependencies = [ "base64 0.13.0", ] @@ -8276,15 +8218,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ "futures 0.3.21", - "pin-project 0.4.27", + "pin-project 0.4.29", "static_assertions", ] [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "safe-mix" @@ -8404,7 +8346,7 @@ name = "sc-chain-spec" version = "4.0.0-dev" dependencies = [ "impl-trait-for-tuples", - "memmap2 0.5.0", + "memmap2 0.5.3", "parity-scale-codec", "sc-chain-spec-derive", "sc-network", @@ -8430,7 +8372,7 @@ name = "sc-cli" version = "0.10.0-dev" dependencies = [ "chrono", - "clap 3.1.6", + "clap 3.1.14", "fdlimit", "futures 0.3.21", "hex", @@ -8603,7 +8545,7 @@ dependencies = [ "sc-block-builder", "sc-client-api", "sc-consensus", - "sc-consensus-epochs", + "sc-consensus-sessions", "sc-consensus-slots", "sc-keystore", "sc-network", @@ -8643,7 +8585,7 @@ dependencies = [ "jsonrpc-derive", "sc-consensus", "sc-consensus-babe", - "sc-consensus-epochs", + "sc-consensus-sessions", "sc-keystore", "sc-rpc-api", "serde", @@ -8662,18 +8604,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "sc-consensus-epochs" -version = "0.10.0-dev" -dependencies = [ - "fork-tree", - "parity-scale-codec", - "sc-client-api", - "sc-consensus", - "sp-blockchain", - "sp-runtime", -] - [[package]] name = "sc-consensus-manual-seal" version = "0.10.0-dev" @@ -8691,7 +8621,7 @@ dependencies = [ "sc-consensus", "sc-consensus-aura", "sc-consensus-babe", - "sc-consensus-epochs", + "sc-consensus-sessions", "sc-transaction-pool", "sc-transaction-pool-api", "serde", @@ -8737,6 +8667,18 @@ dependencies = [ "thiserror", ] +[[package]] +name = "sc-consensus-sessions" +version = "0.10.0-dev" +dependencies = [ + "fork-tree", + "parity-scale-codec", + "sc-client-api", + "sc-consensus", + "sp-blockchain", + "sp-runtime", +] + [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" @@ -8783,7 +8725,7 @@ dependencies = [ "lru", "parity-scale-codec", "parking_lot 0.12.0", - "paste 1.0.6", + "paste 1.0.7", "regex", "sc-executor-common", "sc-executor-wasmi", @@ -8878,7 +8820,7 @@ dependencies = [ "log 0.4.16", "parity-scale-codec", "parking_lot 0.12.0", - "rand 0.8.4", + "rand 0.8.5", "sc-block-builder", "sc-chain-spec", "sc-client-api", @@ -9078,7 +9020,7 @@ dependencies = [ "futures 0.3.21", "futures-timer", "hex", - "hyper 0.14.16", + "hyper 0.14.18", "hyper-rustls", "lazy_static", "num_cpus", @@ -9208,7 +9150,7 @@ dependencies = [ name = "sc-runtime-test" version = "2.0.0" dependencies = [ - "paste 1.0.6", + "paste 1.0.7", "sp-core", "sp-io", "sp-runtime", @@ -9345,7 +9287,7 @@ dependencies = [ "sc-chain-spec", "sc-client-api", "sc-consensus-babe", - "sc-consensus-epochs", + "sc-consensus-sessions", "sc-finality-grandpa", "serde", "serde_json", @@ -9491,9 +9433,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0563970d79bcbf3c537ce3ad36d859b30d36fc5b190efd227f1f7a84d7cf0d42" +checksum = "8980cafbe98a7ee7a9cc16b32ebce542c77883f512d83fbf2ddc8f6a85ea74c9" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -9505,9 +9447,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7805950c36512db9e3251c970bb7ac425f326716941862205d612ab3b5e46e2" +checksum = "4260c630e8a8a33429d1688eff2f163f24c65a4e1b1578ef6b565061336e4b6f" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -9533,7 +9475,7 @@ checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" dependencies = [ "arrayref", "arrayvec 0.5.2", - "curve25519-dalek 2.1.2", + "curve25519-dalek 2.1.3", "getrandom 0.1.16", "merlin", "rand 0.7.3", @@ -9551,9 +9493,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sct" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ "ring", "untrusted", @@ -9582,18 +9524,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" dependencies = [ "der", - "generic-array 0.14.4", + "generic-array 0.14.5", "subtle", "zeroize", ] [[package]] name = "secp256k1" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7883017d5b21f011ef8040ea9c6c7ac90834c0df26a69e4c0b06276151f125" +checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" dependencies = [ - "rand 0.6.5", "secp256k1-sys", ] @@ -9617,9 +9558,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.3.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b239a3d5db51252f6f48f42172c65317f37202f4a21021bf5f9d40a408f4592c" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", "core-foundation", @@ -9630,9 +9571,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.3.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ "core-foundation-sys", "libc", @@ -9644,7 +9585,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" dependencies = [ - "semver-parser 0.7.0", + "semver-parser", ] [[package]] @@ -9653,23 +9594,14 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", + "semver-parser", ] [[package]] name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", -] - -[[package]] -name = "semver" -version = "1.0.4" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" dependencies = [ "serde", ] @@ -9680,38 +9612,29 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" dependencies = [ "serde", ] [[package]] name = "serde_cbor" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" dependencies = [ "half", "serde", @@ -9719,9 +9642,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -9730,9 +9653,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "f972498cf015f7c0746cac89ebe1d6ef10c293b94175a243a2d9442c163d9944" dependencies = [ "itoa 1.0.1", "ryu", @@ -9762,22 +9685,31 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.4" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpuid-bool", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] [[package]] name = "sha1" -version = "0.6.0" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" [[package]] name = "sha2" @@ -9793,13 +9725,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpufeatures 0.2.1", + "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -9811,7 +9743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" dependencies = [ "cfg-if 1.0.0", - "cpufeatures 0.2.1", + "cpufeatures", "digest 0.10.3", ] @@ -9829,9 +9761,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f935e31cf406e8c0e96c2815a5516181b7004ae8c5f296293221e9b1e356bd" +checksum = "881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86" dependencies = [ "digest 0.10.3", "keccak", @@ -9839,24 +9771,24 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.1" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" dependencies = [ "lazy_static", ] [[package]] name = "shlex" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.8" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef33d6d0cd06e0840fba9985aab098c147e67e05cee14d412d3345ed14ff30ac" +checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" dependencies = [ "libc", "signal-hook-registry", @@ -9864,9 +9796,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", ] @@ -9878,7 +9810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" dependencies = [ "digest 0.9.0", - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -9890,14 +9822,14 @@ dependencies = [ "approx", "num-complex", "num-traits", - "paste 1.0.6", + "paste 1.0.7", ] [[package]] name = "slab" -version = "0.4.2" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" @@ -9930,24 +9862,13 @@ dependencies = [ "blake2", "chacha20poly1305", "curve25519-dalek 4.0.0-pre.1", - "rand_core 0.6.2", + "rand_core 0.6.3", "ring", "rustc_version 0.4.0", "sha2 0.10.2", "subtle", ] -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "winapi 0.3.9", -] - [[package]] name = "socket2" version = "0.4.4" @@ -9970,8 +9891,8 @@ dependencies = [ "futures 0.3.21", "httparse", "log 0.4.16", - "rand 0.8.4", - "sha-1 0.9.4", + "rand 0.8.5", + "sha-1 0.9.8", ] [[package]] @@ -10276,7 +10197,7 @@ dependencies = [ "byteorder", "digest 0.10.3", "sha2 0.10.2", - "sha3 0.10.0", + "sha3 0.10.1", "sp-std", "twox-hash", ] @@ -10443,10 +10364,10 @@ dependencies = [ name = "sp-npos-elections-fuzzer" version = "2.0.0-alpha.5" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "honggfuzz", "parity-scale-codec", - "rand 0.8.4", + "rand 0.8.5", "scale-info", "sp-npos-elections", "sp-runtime", @@ -10490,7 +10411,7 @@ dependencies = [ "log 0.4.16", "parity-scale-codec", "parity-util-mem", - "paste 1.0.6", + "paste 1.0.7", "rand 0.7.3", "scale-info", "serde", @@ -10840,7 +10761,7 @@ dependencies = [ "lazy_static", "nalgebra", "num-traits", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -10864,7 +10785,7 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" dependencies = [ - "heck 0.3.2", + "heck 0.3.3", "proc-macro2", "quote", "rustversion", @@ -10875,7 +10796,7 @@ dependencies = [ name = "subkey" version = "2.0.1" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "sc-cli", ] @@ -10888,7 +10809,7 @@ dependencies = [ "hmac 0.11.0", "pbkdf2 0.8.0", "schnorrkel", - "sha2 0.9.8", + "sha2 0.9.9", "zeroize", ] @@ -10903,7 +10824,7 @@ dependencies = [ name = "substrate-frame-cli" version = "4.0.0-dev" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "frame-support", "frame-system", "sc-cli", @@ -10956,7 +10877,7 @@ name = "substrate-prometheus-endpoint" version = "0.10.0-dev" dependencies = [ "futures-util", - "hyper 0.14.16", + "hyper 0.14.18", "log 0.4.16", "prometheus", "thiserror", @@ -11138,15 +11059,15 @@ dependencies = [ [[package]] name = "subtle" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.82" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" +checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" dependencies = [ "proc-macro2", "quote", @@ -11155,9 +11076,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", @@ -11207,7 +11128,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall 0.2.10", + "redox_syscall 0.2.13", "remove_dir_all", "winapi 0.3.9", ] @@ -11225,13 +11146,19 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] +[[package]] +name = "termtree" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" + [[package]] name = "textwrap" version = "0.11.0" @@ -11249,18 +11176,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", @@ -11293,9 +11220,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.4.2+5.2.1-patched.2" +version = "0.4.3+5.2.1-patched.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5844e429d797c62945a566f8da4e24c7fe3fbd5d6617fd8bf7a0b7dc1ee0f22e" +checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" dependencies = [ "cc", "fs_extra", @@ -11325,7 +11252,7 @@ dependencies = [ "pbkdf2 0.4.0", "rand 0.7.3", "rustc-hash", - "sha2 0.9.8", + "sha2 0.9.9", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -11353,9 +11280,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.1.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -11368,20 +11295,20 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" +checksum = "0f48b6d60512a392e34dbf7fd456249fd2de3c83669ab642e021903f4015185b" dependencies = [ "bytes 1.1.0", "libc", "memchr", - "mio 0.8.0", + "mio 0.8.2", "num_cpus", "once_cell", "parking_lot 0.12.0", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "signal-hook-registry", - "socket2 0.4.4", + "socket2", "tokio-macros", "winapi 0.3.9", ] @@ -11471,23 +11398,23 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.23.2" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b" +checksum = "4151fda0cf2798550ad0b34bcfc9b9dcc2a9d2471c895c68f3a8818e54f2389e" dependencies = [ - "rustls 0.20.2", + "rustls 0.20.4", "tokio", "webpki 0.22.0", ] [[package]] name = "tokio-stream" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" +checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" dependencies = [ "futures-core", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "tokio", ] @@ -11541,15 +11468,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.7" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" dependencies = [ "bytes 1.1.0", "futures-core", "futures-sink", "log 0.4.16", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "tokio", ] @@ -11563,15 +11490,16 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "tokio", + "tracing", ] [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] @@ -11584,22 +11512,22 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.29" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if 1.0.0", "log 0.4.16", - "pin-project-lite 0.2.6", + "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.18" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" dependencies = [ "proc-macro2", "quote", @@ -11641,9 +11569,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" dependencies = [ "serde", "tracing-core", @@ -11678,12 +11606,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" -[[package]] -name = "treeline" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" - [[package]] name = "trie-bench" version = "0.30.0" @@ -11749,11 +11671,11 @@ dependencies = [ "ipnet", "lazy_static", "log 0.4.16", - "rand 0.8.4", + "rand 0.8.5", "smallvec 1.8.0", "thiserror", "tinyvec", - "url 2.2.1", + "url 2.2.2", ] [[package]] @@ -11785,7 +11707,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" name = "try-runtime-cli" version = "0.10.0-dev" dependencies = [ - "clap 3.1.6", + "clap 3.1.14", "jsonrpsee", "log 0.4.16", "parity-scale-codec", @@ -11807,9 +11729,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da18123d1316f5a65fc9b94e30a0fcf58afb1daff1b8e18f41dc30f5bfc38c8" +checksum = "7fc92f558afb6d1d7c6f175eb8d615b8ef49c227543e68e19c123d4ee43d8a7d" dependencies = [ "dissimilar", "glob", @@ -11835,7 +11757,7 @@ checksum = "4ee73e6e4924fe940354b8d4d98cad5231175d615cd855b758adc658c0aac6a0" dependencies = [ "cfg-if 1.0.0", "digest 0.10.3", - "rand 0.8.4", + "rand 0.8.5", "static_assertions", ] @@ -11859,9 +11781,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "uint" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" +checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" dependencies = [ "byteorder", "crunchy", @@ -11884,38 +11806,35 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check 0.9.2", + "version_check 0.9.4", ] [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-normalization" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" @@ -11925,11 +11844,11 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "universal-hash" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", "subtle", ] @@ -11982,9 +11901,9 @@ dependencies = [ [[package]] name = "url" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", "idna 0.2.3", @@ -12005,20 +11924,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" dependencies = [ "ctor", - "version_check 0.9.2", + "version_check 0.9.4", ] [[package]] name = "vcpkg" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" - -[[package]] -name = "vec-arena" -version = "1.0.0" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" @@ -12028,9 +11941,9 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" [[package]] name = "version_check" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "void" @@ -12086,11 +11999,17 @@ version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" -version = "0.2.77" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e68338db6becec24d3c7977b5bf8a48be992c934b5d07177e3931f5dc9b076c" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -12098,9 +12017,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.77" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34c405b4f0658583dba0c1c7c9b694f3cac32655db463b56c254a1c75269523" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -12113,9 +12032,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.20" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94" +checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -12125,9 +12044,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.77" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d5a6580be83b19dc570a8f9c324251687ab2184e57086f71625feb57ec77c8" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -12135,9 +12054,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.77" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3775a030dc6f5a0afd8a84981a21cc92a781eb429acef9ecce476d0c9113e92" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -12148,9 +12067,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.77" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c279e376c7a8e8752a8f1eaa35b7b0bee6bb9fb0cdacfa97cc3f1f289c87e2b4" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "wasm-gc-api" @@ -12295,7 +12214,7 @@ dependencies = [ "enumset", "lazy_static", "loupe", - "memmap2 0.5.0", + "memmap2 0.5.3", "more-asserts", "rustc-demangle", "serde", @@ -12317,7 +12236,7 @@ dependencies = [ "enum-iterator", "enumset", "leb128", - "libloading 0.7.0", + "libloading 0.7.3", "loupe", "object 0.28.3", "rkyv", @@ -12419,9 +12338,9 @@ dependencies = [ [[package]] name = "wasmi-validation" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb8e860796d8be48efef530b60eebf84e74a88bce107374fffb0da97d504b8" +checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" dependencies = [ "parity-wasm 0.42.2", ] @@ -12454,7 +12373,7 @@ dependencies = [ "log 0.4.16", "object 0.27.1", "once_cell", - "paste 1.0.6", + "paste 1.0.7", "psm", "rayon", "region 2.2.0", @@ -12483,7 +12402,7 @@ dependencies = [ "log 0.4.16", "rustix", "serde", - "sha2 0.9.8", + "sha2 0.9.9", "toml", "winapi 0.3.9", "zstd", @@ -12584,7 +12503,7 @@ dependencies = [ "mach", "memoffset", "more-asserts", - "rand 0.8.4", + "rand 0.8.5", "region 2.2.0", "rustix", "thiserror", @@ -12607,27 +12526,29 @@ dependencies = [ [[package]] name = "wast" -version = "38.0.0" +version = "40.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ebc29df4629f497e0893aacd40f13a4a56b85ef6eb4ab6d603f07244f1a7bf2" +checksum = "9bb4f48a8b083dbc50e291e430afb8f524092bb00428957bcc63f49f856c64ac" dependencies = [ "leb128", + "memchr", + "unicode-width", ] [[package]] name = "wat" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcfaeb27e2578d2c6271a45609f4a055e6d7ba3a12eff35b1fd5ba147bdf046" +checksum = "0401b6395ce0db91629a75b29597ccb66ea29950af9fc859f1bb3a736609c76e" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.54" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a84d70d1ec7d2da2d26a5bd78f4bca1b8c3254805363ce743b7a05bc30d195a" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" dependencies = [ "js-sys", "wasm-bindgen", @@ -12655,9 +12576,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449" +checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" dependencies = [ "webpki 0.22.0", ] @@ -12704,22 +12625,23 @@ dependencies = [ ] [[package]] -name = "wepoll-sys" -version = "3.0.1" +name = "wepoll-ffi" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" dependencies = [ "cc", ] [[package]] name = "which" -version = "4.0.2" +version = "4.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" +checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" dependencies = [ + "either", + "lazy_static", "libc", - "thiserror", ] [[package]] @@ -12786,15 +12708,15 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc 0.32.0", - "windows_i686_gnu 0.32.0", - "windows_i686_msvc 0.32.0", - "windows_x86_64_gnu 0.32.0", - "windows_x86_64_msvc 0.32.0", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", ] [[package]] @@ -12805,9 +12727,9 @@ checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b" [[package]] name = "windows_aarch64_msvc" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_i686_gnu" @@ -12817,9 +12739,9 @@ checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58" [[package]] name = "windows_i686_gnu" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_msvc" @@ -12829,9 +12751,9 @@ checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4" [[package]] name = "windows_i686_msvc" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_x86_64_gnu" @@ -12841,9 +12763,9 @@ checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354" [[package]] name = "windows_x86_64_gnu" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_msvc" @@ -12853,9 +12775,9 @@ checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561" [[package]] name = "windows_x86_64_msvc" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "winreg" @@ -12887,11 +12809,11 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc614d95359fd7afc321b66d2107ede58b246b844cf5d8a0adcca413e439f088" +checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" dependencies = [ - "curve25519-dalek 3.0.2", + "curve25519-dalek 3.2.0", "rand_core 0.5.1", "zeroize", ] @@ -12906,7 +12828,7 @@ dependencies = [ "log 0.4.16", "nohash-hasher", "parking_lot 0.12.0", - "rand 0.8.4", + "rand 0.8.5", "static_assertions", ] diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 6bb36b9f9ab94..20db0182f579e 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -113,7 +113,7 @@ sc-keystore = { version = "4.0.0-dev", path = "../../../client/keystore" } sc-client-db = { version = "0.10.0-dev", path = "../../../client/db" } sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/common" } sc-consensus-babe = { version = "0.10.0-dev", path = "../../../client/consensus/babe" } -sc-consensus-epochs = { version = "0.10.0-dev", path = "../../../client/consensus/epochs" } +sc-consensus-sessions = { version = "0.10.0-dev", path = "../../../client/consensus/epochs" } sc-service-test = { version = "2.0.0", path = "../../../client/service/test" } sc-block-builder = { version = "0.10.0-dev", path = "../../../client/block-builder" } sp-tracing = { version = "5.0.0", path = "../../../primitives/tracing" } diff --git a/bin/node/cli/src/chain_spec.rs b/bin/node/cli/src/chain_spec.rs index 221c229876275..29fa321426dd9 100644 --- a/bin/node/cli/src/chain_spec.rs +++ b/bin/node/cli/src/chain_spec.rs @@ -342,7 +342,7 @@ pub fn testnet_genesis( sudo: SudoConfig { key: Some(root_key) }, babe: BabeConfig { authorities: vec![], - epoch_config: Some(node_runtime::BABE_GENESIS_EPOCH_CONFIG), + session_config: Some(node_runtime::BABE_GENESIS_SESSION_CONFIG), }, im_online: ImOnlineConfig { keys: vec![] }, authority_discovery: AuthorityDiscoveryConfig { keys: vec![] }, diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index 2742e7b113d6d..fc192d2478752 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -244,7 +244,7 @@ pub fn new_partial( ); let babe_config = babe_link.config().clone(); - let shared_epoch_changes = babe_link.epoch_changes().clone(); + let shared_session_changes = babe_link.session_changes().clone(); let client = client.clone(); let pool = transaction_pool.clone(); @@ -262,7 +262,7 @@ pub fn new_partial( deny_unsafe, babe: node_rpc::BabeDeps { babe_config: babe_config.clone(), - shared_epoch_changes: shared_epoch_changes.clone(), + shared_session_changes: shared_session_changes.clone(), keystore: keystore.clone(), }, grandpa: node_rpc::GrandpaDeps { @@ -573,7 +573,7 @@ mod tests { use sc_client_api::BlockBackend; use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy}; use sc_consensus_babe::{BabeIntermediate, CompatibleDigestItem, INTERMEDIATE_KEY}; - use sc_consensus_epochs::descendent_query; + use sc_consensus_sessions::descendent_query; use sc_keystore::LocalKeystore; use sc_service_test::TestNetNode; use sc_transaction_pool_api::{ChainEvent, MaintainedTransactionPool}; @@ -662,11 +662,11 @@ mod tests { // even though there's only one authority some slots might be empty, // so we must keep trying the next slots until we can claim one. - let (babe_pre_digest, epoch_descriptor) = loop { - let epoch_descriptor = babe_link - .epoch_changes() + let (babe_pre_digest, session_descriptor) = loop { + let session_descriptor = babe_link + .session_changes() .shared_data() - .epoch_descriptor_for_child_of( + .session_descriptor_for_child_of( descendent_query(&*service.client()), &parent_hash, parent_number, @@ -675,11 +675,11 @@ mod tests { .unwrap() .unwrap(); - let epoch = babe_link - .epoch_changes() + let session = babe_link + .session_changes() .shared_data() - .epoch_data(&epoch_descriptor, |slot| { - sc_consensus_babe::Epoch::genesis( + .session_data(&session_descriptor, |slot| { + sc_consensus_babe::Session::genesis( babe_link.config().genesis_config(), slot, ) @@ -687,10 +687,10 @@ mod tests { .unwrap(); if let Some(babe_pre_digest) = - sc_consensus_babe::authorship::claim_slot(slot.into(), &epoch, &keystore) + sc_consensus_babe::authorship::claim_slot(slot.into(), &session, &keystore) .map(|(digest, _)| digest) { - break (babe_pre_digest, epoch_descriptor) + break (babe_pre_digest, session_descriptor) } slot += 1; @@ -740,7 +740,7 @@ mod tests { params.body = Some(new_body); params.intermediates.insert( Cow::from(INTERMEDIATE_KEY), - Box::new(BabeIntermediate:: { epoch_descriptor }) as Box<_>, + Box::new(BabeIntermediate:: { session_descriptor }) as Box<_>, ); params.fork_choice = Some(ForkChoiceStrategy::LongestChain); diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml index 6c18e70f0d634..84260fbdc9aeb 100644 --- a/bin/node/rpc/Cargo.toml +++ b/bin/node/rpc/Cargo.toml @@ -19,7 +19,7 @@ pallet-transaction-payment-rpc = { version = "4.0.0-dev", path = "../../../frame sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" } sc-consensus-babe = { version = "0.10.0-dev", path = "../../../client/consensus/babe" } sc-consensus-babe-rpc = { version = "0.10.0-dev", path = "../../../client/consensus/babe/rpc" } -sc-consensus-epochs = { version = "0.10.0-dev", path = "../../../client/consensus/epochs" } +sc-consensus-sessions = { version = "0.10.0-dev", path = "../../../client/consensus/epochs" } sc-chain-spec = { version = "4.0.0-dev", path = "../../../client/chain-spec" } sc-finality-grandpa = { version = "0.10.0-dev", path = "../../../client/finality-grandpa" } sc-finality-grandpa-rpc = { version = "0.10.0-dev", path = "../../../client/finality-grandpa/rpc" } diff --git a/bin/node/rpc/src/lib.rs b/bin/node/rpc/src/lib.rs index b8349e26cd1da..9287c9407faf7 100644 --- a/bin/node/rpc/src/lib.rs +++ b/bin/node/rpc/src/lib.rs @@ -34,9 +34,9 @@ use std::sync::Arc; use node_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Index}; use sc_client_api::AuxStore; -use sc_consensus_babe::{Config, Epoch}; +use sc_consensus_babe::{Config, Session}; use sc_consensus_babe_rpc::BabeRpcHandler; -use sc_consensus_epochs::SharedEpochChanges; +use sc_consensus_sessions::SharedSessionChanges; use sc_finality_grandpa::{ FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState, }; @@ -55,8 +55,8 @@ use sp_keystore::SyncCryptoStorePtr; pub struct BabeDeps { /// BABE protocol config. pub babe_config: Config, - /// BABE pending epoch changes. - pub shared_epoch_changes: SharedEpochChanges, + /// BABE pending session changes. + pub shared_session_changes: SharedSessionChanges, /// The keystore that manages the keys of the node. pub keystore: SyncCryptoStorePtr, } @@ -130,7 +130,7 @@ where let mut io = jsonrpc_core::IoHandler::default(); let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa } = deps; - let BabeDeps { keystore, babe_config, shared_epoch_changes } = babe; + let BabeDeps { keystore, babe_config, shared_session_changes } = babe; let GrandpaDeps { shared_voter_state, shared_authority_set, @@ -148,7 +148,7 @@ where io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone()))); io.extend_with(sc_consensus_babe_rpc::BabeApi::to_delegate(BabeRpcHandler::new( client.clone(), - shared_epoch_changes.clone(), + shared_session_changes.clone(), keystore, babe_config, select_chain, @@ -169,7 +169,7 @@ where chain_spec, client.clone(), shared_authority_set, - shared_epoch_changes, + shared_session_changes, )?, )); io.extend_with(DevApi::to_delegate(Dev::new(client, deny_unsafe))); diff --git a/bin/node/runtime/src/constants.rs b/bin/node/runtime/src/constants.rs index 23fb13cfb0492..be4e9f75660c4 100644 --- a/bin/node/runtime/src/constants.rs +++ b/bin/node/runtime/src/constants.rs @@ -61,13 +61,13 @@ pub mod time { // 1 in 4 blocks (on average, not counting collisions) will be primary BABE blocks. pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); - // NOTE: Currently it is not possible to change the epoch duration after the chain has started. + // NOTE: Currently it is not possible to change the session duration after the chain has started. // Attempting to do so will brick block production. - pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES; - pub const EPOCH_DURATION_IN_SLOTS: u64 = { + pub const SESSION_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES; + pub const SESSION_DURATION_IN_SLOTS: u64 = { const SLOT_FILL_RATE: f64 = MILLISECS_PER_BLOCK as f64 / SLOT_DURATION as f64; - (EPOCH_DURATION_IN_BLOCKS as f64 * SLOT_FILL_RATE) as u64 + (SESSION_DURATION_IN_BLOCKS as f64 * SLOT_FILL_RATE) as u64 }; // These time units are defined in number of blocks. diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index 18ce64c29f8e8..454368ec43ddc 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -129,9 +129,9 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 1, }; -/// The BABE epoch configuration at genesis. -pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration = - sp_consensus_babe::BabeEpochConfiguration { +/// The BABE session configuration at genesis. +pub const BABE_GENESIS_SESSION_CONFIG: sp_consensus_babe::BabeSessionConfiguration = + sp_consensus_babe::BabeSessionConfiguration { c: PRIMARY_PROBABILITY, allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryPlainSlots, }; @@ -369,18 +369,18 @@ impl pallet_preimage::Config for Runtime { } parameter_types! { - // NOTE: Currently it is not possible to change the epoch duration after the chain has started. + // NOTE: Currently it is not possible to change the session duration after the chain has started. // Attempting to do so will brick block production. - pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS; + pub const SessionDuration: u64 = SESSION_DURATION_IN_SLOTS; pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; pub const ReportLongevity: u64 = - BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); + BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * SessionDuration::get(); } impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDuration; + type SessionDuration = SessionDuration; type ExpectedBlockTime = ExpectedBlockTime; - type EpochChangeTrigger = pallet_babe::ExternalTrigger; + type SessionChangeTrigger = pallet_babe::ExternalTrigger; type DisabledValidators = Session; type KeyOwnerProofSystem = Historical; @@ -568,8 +568,8 @@ impl pallet_staking::Config for Runtime { parameter_types! { // phase durations. 1/4 of the last session for each. - pub const SignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; - pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; + pub const SignedPhase: u32 = SESSION_DURATION_IN_BLOCKS / 4; + pub const UnsignedPhase: u32 = SESSION_DURATION_IN_BLOCKS / 4; // signed config pub const SignedRewardBase: Balance = 1 * DOLLARS; @@ -1711,24 +1711,24 @@ impl_runtime_apis! { // sp_consensus_babe::BabeGenesisConfiguration { slot_duration: Babe::slot_duration(), - epoch_length: EpochDuration::get(), - c: BABE_GENESIS_EPOCH_CONFIG.c, + session_length: SessionDuration::get(), + c: BABE_GENESIS_SESSION_CONFIG.c, genesis_authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), - allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots, + allowed_slots: BABE_GENESIS_SESSION_CONFIG.allowed_slots, } } - fn current_epoch_start() -> sp_consensus_babe::Slot { - Babe::current_epoch_start() + fn current_session_start() -> sp_consensus_babe::Slot { + Babe::current_session_start() } - fn current_epoch() -> sp_consensus_babe::Epoch { - Babe::current_epoch() + fn current_session() -> sp_consensus_babe::Session { + Babe::current_session() } - fn next_epoch() -> sp_consensus_babe::Epoch { - Babe::next_epoch() + fn next_session() -> sp_consensus_babe::Session { + Babe::next_session() } fn generate_key_ownership_proof( diff --git a/bin/node/testing/src/genesis.rs b/bin/node/testing/src/genesis.rs index 73e7ea50261d3..0611459f2a329 100644 --- a/bin/node/testing/src/genesis.rs +++ b/bin/node/testing/src/genesis.rs @@ -22,7 +22,7 @@ use crate::keyring::*; use node_runtime::{ constants::currency::*, wasm_binary_unwrap, AccountId, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, IndicesConfig, SessionConfig, SocietyConfig, StakerStatus, - StakingConfig, SystemConfig, BABE_GENESIS_EPOCH_CONFIG, + StakingConfig, SystemConfig, BABE_GENESIS_SESSION_CONFIG, }; use sp_keyring::{Ed25519Keyring, Sr25519Keyring}; use sp_runtime::Perbill; @@ -75,7 +75,7 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen invulnerables: vec![alice(), bob(), charlie()], ..Default::default() }, - babe: BabeConfig { authorities: vec![], epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG) }, + babe: BabeConfig { authorities: vec![], session_config: Some(BABE_GENESIS_SESSION_CONFIG) }, grandpa: GrandpaConfig { authorities: vec![] }, im_online: Default::default(), authority_discovery: Default::default(), diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index d803aa4ae97f8..d40624e3bda9f 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -264,7 +264,7 @@ pub fn build_aura_worker( SyncOracle = SO, JustificationSyncLink = L, Claim = P::Public, - EpochData = Vec>, + SessionData = Vec>, > where B: BlockT, @@ -337,7 +337,7 @@ where Pin> + Send + 'static>>; type Proposer = E::Proposer; type Claim = P::Public; - type EpochData = Vec>; + type SessionData = Vec>; fn logging_target(&self) -> &'static str { "aura" @@ -347,25 +347,25 @@ where &mut self.block_import } - fn epoch_data( + fn session_data( &self, header: &B::Header, _slot: Slot, - ) -> Result { + ) -> Result { authorities(self.client.as_ref(), &BlockId::Hash(header.hash())) } - fn authorities_len(&self, epoch_data: &Self::EpochData) -> Option { - Some(epoch_data.len()) + fn authorities_len(&self, session_data: &Self::SessionData) -> Option { + Some(session_data.len()) } async fn claim_slot( &self, _header: &B::Header, slot: Slot, - epoch_data: &Self::EpochData, + session_data: &Self::SessionData, ) -> Option { - let expected_author = slot_author::

(slot, epoch_data); + let expected_author = slot_author::

(slot, session_data); expected_author.and_then(|p| { if SyncCryptoStore::has_keys( &*self.keystore, @@ -389,7 +389,7 @@ where body: Vec, storage_changes: StorageChanges<>::Transaction, B>, public: Self::Claim, - _epoch: Self::EpochData, + _session: Self::SessionData, ) -> Result< sc_consensus::BlockImportParams>::Transaction>, sp_consensus::Error, diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml index 48313cd0437e0..ba36744b1da97 100644 --- a/client/consensus/babe/Cargo.toml +++ b/client/consensus/babe/Cargo.toml @@ -32,7 +32,7 @@ sp-inherents = { version = "4.0.0-dev", path = "../../../primitives/inherents" } sc-telemetry = { version = "4.0.0-dev", path = "../../telemetry" } sc-keystore = { version = "4.0.0-dev", path = "../../keystore" } sc-client-api = { version = "4.0.0-dev", path = "../../api" } -sc-consensus-epochs = { version = "0.10.0-dev", path = "../epochs" } +sc-consensus-sessions = { version = "0.10.0-dev", path = "../epochs" } sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" } sp-block-builder = { version = "4.0.0-dev", path = "../../../primitives/block-builder" } sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" } diff --git a/client/consensus/babe/README.md b/client/consensus/babe/README.md index a404d2ea44706..6c28f35920e10 100644 --- a/client/consensus/babe/README.md +++ b/client/consensus/babe/README.md @@ -8,12 +8,12 @@ right to produce a block. The proof of the VRF function execution will be used by other peer to validate the legitimacy of the slot claim. The engine is also responsible for collecting entropy on-chain which will be -used to seed the given VRF PRNG. An epoch is a contiguous number of slots -under which we will be using the same authority set. During an epoch all VRF +used to seed the given VRF PRNG. An session is a contiguous number of slots +under which we will be using the same authority set. During an session all VRF outputs produced as a result of block production will be collected on an -on-chain randomness pool. Epoch changes are announced one epoch in advance, -i.e. when ending epoch N, we announce the parameters (randomness, -authorities, etc.) for epoch N+2. +on-chain randomness pool. Session changes are announced one session in advance, +i.e. when ending session N, we announce the parameters (randomness, +authorities, etc.) for session N+2. Since the slot assignment is randomized, it is possible that a slot is assigned to multiple validators in which case we will have a temporary fork, @@ -31,7 +31,7 @@ authoring the node starts by trying to claim a primary slot and falls back to a secondary slot claim attempt. The secondary slot assignment is done by picking the authority at index: -`blake2_256(epoch_randomness ++ slot_number) % authorities_len`. +`blake2_256(session_randomness ++ slot_number) % authorities_len`. The secondary slots supports either a `SecondaryPlain` or `SecondaryVRF` variant. Comparing with `SecondaryPlain` variant, the `SecondaryVRF` variant diff --git a/client/consensus/babe/rpc/Cargo.toml b/client/consensus/babe/rpc/Cargo.toml index cce4544f09705..30f79a12d5118 100644 --- a/client/consensus/babe/rpc/Cargo.toml +++ b/client/consensus/babe/rpc/Cargo.toml @@ -22,7 +22,7 @@ sp-consensus-babe = { version = "0.10.0-dev", path = "../../../../primitives/con serde = { version = "1.0.136", features = ["derive"] } sp-blockchain = { version = "4.0.0-dev", path = "../../../../primitives/blockchain" } sp-runtime = { version = "6.0.0", path = "../../../../primitives/runtime" } -sc-consensus-epochs = { version = "0.10.0-dev", path = "../../epochs" } +sc-consensus-sessions = { version = "0.10.0-dev", path = "../../epochs" } futures = "0.3.21" thiserror = "1.0" sp-api = { version = "4.0.0-dev", path = "../../../../primitives/api" } diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index 1fbe23e54f50d..9252c9d56a33c 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -21,8 +21,8 @@ use futures::{FutureExt, TryFutureExt}; use jsonrpc_core::Error as RpcError; use jsonrpc_derive::rpc; -use sc_consensus_babe::{authorship, Config, Epoch}; -use sc_consensus_epochs::{descendent_query, Epoch as EpochT, SharedEpochChanges}; +use sc_consensus_babe::{authorship, Config, Session}; +use sc_consensus_sessions::{descendent_query, Session as SessionT, SharedSessionChanges}; use sc_rpc_api::DenyUnsafe; use serde::{Deserialize, Serialize}; use sp_api::{BlockId, ProvideRuntimeApi}; @@ -40,18 +40,18 @@ type FutureResult = jsonrpc_core::BoxFuture>; /// Provides rpc methods for interacting with Babe. #[rpc] pub trait BabeApi { - /// Returns data about which slots (primary or secondary) can be claimed in the current epoch + /// Returns data about which slots (primary or secondary) can be claimed in the current session /// with the keys in the keystore. - #[rpc(name = "babe_epochAuthorship")] - fn epoch_authorship(&self) -> FutureResult>; + #[rpc(name = "babe_sessionAuthorship")] + fn session_authorship(&self) -> FutureResult>; } /// Implements the BabeRpc trait for interacting with Babe. pub struct BabeRpcHandler { /// shared reference to the client. client: Arc, - /// shared reference to EpochChanges - shared_epoch_changes: SharedEpochChanges, + /// shared reference to SessionChanges + shared_session_changes: SharedSessionChanges, /// shared reference to the Keystore keystore: SyncCryptoStorePtr, /// config (actually holds the slot duration) @@ -66,13 +66,13 @@ impl BabeRpcHandler { /// Creates a new instance of the BabeRpc handler. pub fn new( client: Arc, - shared_epoch_changes: SharedEpochChanges, + shared_session_changes: SharedSessionChanges, keystore: SyncCryptoStorePtr, babe_config: Config, select_chain: SC, deny_unsafe: DenyUnsafe, ) -> Self { - Self { client, shared_epoch_changes, keystore, babe_config, select_chain, deny_unsafe } + Self { client, shared_session_changes, keystore, babe_config, select_chain, deny_unsafe } } } @@ -86,34 +86,34 @@ where C::Api: BabeRuntimeApi, SC: SelectChain + Clone + 'static, { - fn epoch_authorship(&self) -> FutureResult> { + fn session_authorship(&self) -> FutureResult> { if let Err(err) = self.deny_unsafe.check_if_safe() { return async move { Err(err.into()) }.boxed() } - let (babe_config, keystore, shared_epoch, client, select_chain) = ( + let (babe_config, keystore, shared_session, client, select_chain) = ( self.babe_config.clone(), self.keystore.clone(), - self.shared_epoch_changes.clone(), + self.shared_session_changes.clone(), self.client.clone(), self.select_chain.clone(), ); async move { let header = select_chain.best_chain().map_err(Error::Consensus).await?; - let epoch_start = client + let session_start = client .runtime_api() - .current_epoch_start(&BlockId::Hash(header.hash())) + .current_session_start(&BlockId::Hash(header.hash())) .map_err(|err| Error::StringError(err.to_string()))?; - let epoch = - epoch_data(&shared_epoch, &client, &babe_config, *epoch_start, &select_chain) + let session = + session_data(&shared_session, &client, &babe_config, *session_start, &select_chain) .await?; - let (epoch_start, epoch_end) = (epoch.start_slot(), epoch.end_slot()); + let (session_start, session_end) = (session.start_slot(), session.end_slot()); - let mut claims: HashMap = HashMap::new(); + let mut claims: HashMap = HashMap::new(); let keys = { - epoch + session .authorities .iter() .enumerate() @@ -130,9 +130,9 @@ where .collect::>() }; - for slot in *epoch_start..*epoch_end { + for slot in *session_start..*session_end { if let Some((claim, key)) = - authorship::claim_slot_using_keys(slot.into(), &epoch, &keystore, &keys) + authorship::claim_slot_using_keys(slot.into(), &session, &keystore, &keys) { match claim { PreDigest::Primary { .. } => { @@ -156,7 +156,7 @@ where /// Holds information about the `slot`'s that can be claimed by a given key. #[derive(Default, Debug, Deserialize, Serialize)] -pub struct EpochAuthorship { +pub struct SessionAuthorship { /// the array of primary slots that can be claimed primary: Vec, /// the array of secondary slots that can be claimed @@ -186,28 +186,28 @@ impl From for jsonrpc_core::Error { } } -/// Fetches the epoch data for a given slot. -async fn epoch_data( - epoch_changes: &SharedEpochChanges, +/// Fetches the session data for a given slot. +async fn session_data( + session_changes: &SharedSessionChanges, client: &Arc, babe_config: &Config, slot: u64, select_chain: &SC, -) -> Result +) -> Result where B: BlockT, C: HeaderBackend + HeaderMetadata + 'static, SC: SelectChain, { let parent = select_chain.best_chain().await?; - epoch_changes + session_changes .shared_data() - .epoch_data_for_child_of( + .session_data_for_child_of( descendent_query(&**client), &parent.hash(), parent.number().clone(), slot.into(), - |slot| Epoch::genesis(babe_config.genesis_config(), slot), + |slot| Session::genesis(babe_config.genesis_config(), slot), ) .map_err(|e| Error::Consensus(ConsensusError::ChainLookup(e.to_string())))? .ok_or(Error::Consensus(ConsensusError::InvalidAuthoritiesSet)) @@ -253,12 +253,12 @@ mod tests { let (_, link) = block_import(config.clone(), client.clone(), client.clone()) .expect("can initialize block-import"); - let epoch_changes = link.epoch_changes().clone(); + let session_changes = link.session_changes().clone(); let keystore = create_temp_keystore::(Sr25519Keyring::Alice).0; BabeRpcHandler::new( client.clone(), - epoch_changes, + session_changes, keystore, config, longest_chain, @@ -267,24 +267,24 @@ mod tests { } #[test] - fn epoch_authorship_works() { + fn session_authorship_works() { let handler = test_babe_rpc_handler(DenyUnsafe::No); let mut io = IoHandler::new(); io.extend_with(BabeApi::to_delegate(handler)); - let request = r#"{"jsonrpc":"2.0","method":"babe_epochAuthorship","params": [],"id":1}"#; + let request = r#"{"jsonrpc":"2.0","method":"babe_sessionAuthorship","params": [],"id":1}"#; let response = r#"{"jsonrpc":"2.0","result":{"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY":{"primary":[0],"secondary":[1,2,4],"secondary_vrf":[]}},"id":1}"#; assert_eq!(Some(response.into()), io.handle_request_sync(request)); } #[test] - fn epoch_authorship_is_unsafe() { + fn session_authorship_is_unsafe() { let handler = test_babe_rpc_handler(DenyUnsafe::Yes); let mut io = IoHandler::new(); io.extend_with(BabeApi::to_delegate(handler)); - let request = r#"{"jsonrpc":"2.0","method":"babe_epochAuthorship","params": [],"id":1}"#; + let request = r#"{"jsonrpc":"2.0","method":"babe_sessionAuthorship","params": [],"id":1}"#; let response = io.handle_request_sync(request).unwrap(); let mut response: serde_json::Value = serde_json::from_str(&response).unwrap(); diff --git a/client/consensus/babe/src/authorship.rs b/client/consensus/babe/src/authorship.rs index 1f74afb0e78b4..dce320c3b2029 100644 --- a/client/consensus/babe/src/authorship.rs +++ b/client/consensus/babe/src/authorship.rs @@ -18,7 +18,7 @@ //! BABE authority selection and slot claiming. -use super::Epoch; +use super::Session; use codec::Encode; use schnorrkel::{keys::PublicKey, vrf::VRFInOut}; use sp_application_crypto::AppKey; @@ -122,12 +122,12 @@ pub(super) fn secondary_slot_author( /// to propose. fn claim_secondary_slot( slot: Slot, - epoch: &Epoch, + session: &Session, keys: &[(AuthorityId, usize)], keystore: &SyncCryptoStorePtr, author_secondary_vrf: bool, ) -> Option<(PreDigest, AuthorityId)> { - let Epoch { authorities, randomness, epoch_index, .. } = epoch; + let Session { authorities, randomness, session_index, .. } = session; if authorities.is_empty() { return None @@ -138,7 +138,7 @@ fn claim_secondary_slot( for (authority_id, authority_index) in keys { if authority_id == expected_author { let pre_digest = if author_secondary_vrf { - let transcript_data = make_transcript_data(randomness, slot, *epoch_index); + let transcript_data = make_transcript_data(randomness, slot, *session_index); let result = SyncCryptoStore::sr25519_vrf_sign( &**keystore, AuthorityId::ID, @@ -178,40 +178,40 @@ fn claim_secondary_slot( /// Tries to claim the given slot number. This method starts by trying to claim /// a primary VRF based slot. If we are not able to claim it, then if we have -/// secondary slots enabled for the given epoch, we will fallback to trying to +/// secondary slots enabled for the given session, we will fallback to trying to /// claim a secondary slot. pub fn claim_slot( slot: Slot, - epoch: &Epoch, + session: &Session, keystore: &SyncCryptoStorePtr, ) -> Option<(PreDigest, AuthorityId)> { - let authorities = epoch + let authorities = session .authorities .iter() .enumerate() .map(|(index, a)| (a.0.clone(), index)) .collect::>(); - claim_slot_using_keys(slot, epoch, keystore, &authorities) + claim_slot_using_keys(slot, session, keystore, &authorities) } /// Like `claim_slot`, but allows passing an explicit set of key pairs. Useful if we intend /// to make repeated calls for different slots using the same key pairs. pub fn claim_slot_using_keys( slot: Slot, - epoch: &Epoch, + session: &Session, keystore: &SyncCryptoStorePtr, keys: &[(AuthorityId, usize)], ) -> Option<(PreDigest, AuthorityId)> { - claim_primary_slot(slot, epoch, epoch.config.c, keystore, &keys).or_else(|| { - if epoch.config.allowed_slots.is_secondary_plain_slots_allowed() || - epoch.config.allowed_slots.is_secondary_vrf_slots_allowed() + claim_primary_slot(slot, session, session.config.c, keystore, &keys).or_else(|| { + if session.config.allowed_slots.is_secondary_plain_slots_allowed() || + session.config.allowed_slots.is_secondary_vrf_slots_allowed() { claim_secondary_slot( slot, - &epoch, + &session, keys, &keystore, - epoch.config.allowed_slots.is_secondary_vrf_slots_allowed(), + session.config.allowed_slots.is_secondary_vrf_slots_allowed(), ) } else { None @@ -220,21 +220,21 @@ pub fn claim_slot_using_keys( } /// Claim a primary slot if it is our turn. Returns `None` if it is not our turn. -/// This hashes the slot number, epoch, genesis hash, and chain randomness into +/// This hashes the slot number, session, genesis hash, and chain randomness into /// the VRF. If the VRF produces a value less than `threshold`, it is our turn, /// so it returns `Some(_)`. Otherwise, it returns `None`. fn claim_primary_slot( slot: Slot, - epoch: &Epoch, + session: &Session, c: (u64, u64), keystore: &SyncCryptoStorePtr, keys: &[(AuthorityId, usize)], ) -> Option<(PreDigest, AuthorityId)> { - let Epoch { authorities, randomness, epoch_index, .. } = epoch; + let Session { authorities, randomness, session_index, .. } = session; for (authority_id, authority_index) in keys { - let transcript = make_transcript(randomness, slot, *epoch_index); - let transcript_data = make_transcript_data(randomness, slot, *epoch_index); + let transcript = make_transcript(randomness, slot, *session_index); + let transcript_data = make_transcript_data(randomness, slot, *session_index); // Compute the threshold we will use. // // We already checked that authorities contains `key.public()`, so it can't @@ -273,7 +273,7 @@ fn claim_primary_slot( mod tests { use super::*; use sc_keystore::LocalKeystore; - use sp_consensus_babe::{AllowedSlots, AuthorityId, BabeEpochConfiguration}; + use sp_consensus_babe::{AllowedSlots, AuthorityId, BabeSessionConfiguration}; use sp_core::{crypto::Pair as _, sr25519::Pair}; use std::sync::Arc; @@ -292,21 +292,21 @@ mod tests { (AuthorityId::from(Pair::generate().0.public()), 7), ]; - let mut epoch = Epoch { - epoch_index: 10, + let mut session = Session { + session_index: 10, start_slot: 0.into(), duration: 20, authorities: authorities.clone(), randomness: Default::default(), - config: BabeEpochConfiguration { + config: BabeSessionConfiguration { c: (3, 10), allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots, }, }; - assert!(claim_slot(10.into(), &epoch, &keystore).is_none()); + assert!(claim_slot(10.into(), &session, &keystore).is_none()); - epoch.authorities.push((valid_public_key.clone().into(), 10)); - assert_eq!(claim_slot(10.into(), &epoch, &keystore).unwrap().1, valid_public_key.into()); + session.authorities.push((valid_public_key.clone().into(), 10)); + assert_eq!(claim_slot(10.into(), &session, &keystore).unwrap().1, valid_public_key.into()); } } diff --git a/client/consensus/babe/src/aux_schema.rs b/client/consensus/babe/src/aux_schema.rs index 2ab84b9b132cc..038c43729bf20 100644 --- a/client/consensus/babe/src/aux_schema.rs +++ b/client/consensus/babe/src/aux_schema.rs @@ -16,23 +16,23 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! Schema for BABE epoch changes in the aux-db. +//! Schema for BABE session changes in the aux-db. use codec::{Decode, Encode}; use log::info; -use crate::{migration::EpochV0, Epoch}; +use crate::{migration::SessionV0, Session}; use sc_client_api::backend::AuxStore; -use sc_consensus_epochs::{ - migration::{EpochChangesV0For, EpochChangesV1For}, - EpochChangesFor, SharedEpochChanges, +use sc_consensus_sessions::{ + migration::{SessionChangesV0For, SessionChangesV1For}, + SessionChangesFor, SharedSessionChanges, }; use sp_blockchain::{Error as ClientError, Result as ClientResult}; use sp_consensus_babe::{BabeBlockWeight, BabeGenesisConfiguration}; use sp_runtime::traits::Block as BlockT; -const BABE_EPOCH_CHANGES_VERSION: &[u8] = b"babe_epoch_changes_version"; -const BABE_EPOCH_CHANGES_KEY: &[u8] = b"babe_epoch_changes"; +const BABE_EPOCH_CHANGES_VERSION: &[u8] = b"babe_session_changes_version"; +const BABE_EPOCH_CHANGES_KEY: &[u8] = b"babe_session_changes"; const BABE_EPOCH_CHANGES_CURRENT_VERSION: u32 = 3; /// The aux storage key used to store the block weight of the given block hash. @@ -54,61 +54,61 @@ where } } -/// Load or initialize persistent epoch change data from backend. -pub fn load_epoch_changes( +/// Load or initialize persistent session change data from backend. +pub fn load_session_changes( backend: &B, config: &BabeGenesisConfiguration, -) -> ClientResult> { +) -> ClientResult> { let version = load_decode::<_, u32>(backend, BABE_EPOCH_CHANGES_VERSION)?; - let maybe_epoch_changes = match version { + let maybe_session_changes = match version { None => - load_decode::<_, EpochChangesV0For>(backend, BABE_EPOCH_CHANGES_KEY)? - .map(|v0| v0.migrate().map(|_, _, epoch| epoch.migrate(config))), + load_decode::<_, SessionChangesV0For>(backend, BABE_EPOCH_CHANGES_KEY)? + .map(|v0| v0.migrate().map(|_, _, session| session.migrate(config))), Some(1) => - load_decode::<_, EpochChangesV1For>(backend, BABE_EPOCH_CHANGES_KEY)? - .map(|v1| v1.migrate().map(|_, _, epoch| epoch.migrate(config))), + load_decode::<_, SessionChangesV1For>(backend, BABE_EPOCH_CHANGES_KEY)? + .map(|v1| v1.migrate().map(|_, _, session| session.migrate(config))), Some(2) => { - // v2 still uses `EpochChanges` v1 format but with a different `Epoch` type. - load_decode::<_, EpochChangesV1For>(backend, BABE_EPOCH_CHANGES_KEY)? + // v2 still uses `SessionChanges` v1 format but with a different `Session` type. + load_decode::<_, SessionChangesV1For>(backend, BABE_EPOCH_CHANGES_KEY)? .map(|v2| v2.migrate()) }, Some(BABE_EPOCH_CHANGES_CURRENT_VERSION) => - load_decode::<_, EpochChangesFor>(backend, BABE_EPOCH_CHANGES_KEY)?, + load_decode::<_, SessionChangesFor>(backend, BABE_EPOCH_CHANGES_KEY)?, Some(other) => return Err(ClientError::Backend(format!("Unsupported BABE DB version: {:?}", other))), }; - let epoch_changes = - SharedEpochChanges::::new(maybe_epoch_changes.unwrap_or_else(|| { + let session_changes = + SharedSessionChanges::::new(maybe_session_changes.unwrap_or_else(|| { info!( target: "babe", - "👶 Creating empty BABE epoch changes on what appears to be first startup.", + "👶 Creating empty BABE session changes on what appears to be first startup.", ); - EpochChangesFor::::default() + SessionChangesFor::::default() })); // rebalance the tree after deserialization. this isn't strictly necessary // since the tree is now rebalanced on every update operation. but since the // tree wasn't rebalanced initially it's useful to temporarily leave it here // to avoid having to wait until an import for rebalancing. - epoch_changes.shared_data().rebalance(); + session_changes.shared_data().rebalance(); - Ok(epoch_changes) + Ok(session_changes) } -/// Update the epoch changes on disk after a change. -pub(crate) fn write_epoch_changes( - epoch_changes: &EpochChangesFor, +/// Update the session changes on disk after a change. +pub(crate) fn write_session_changes( + session_changes: &SessionChangesFor, write_aux: F, ) -> R where F: FnOnce(&[(&'static [u8], &[u8])]) -> R, { BABE_EPOCH_CHANGES_CURRENT_VERSION.using_encoded(|version| { - let encoded_epoch_changes = epoch_changes.encode(); + let encoded_session_changes = session_changes.encode(); write_aux(&[ - (BABE_EPOCH_CHANGES_KEY, encoded_epoch_changes.as_slice()), + (BABE_EPOCH_CHANGES_KEY, encoded_session_changes.as_slice()), (BABE_EPOCH_CHANGES_VERSION, version), ]) }) @@ -138,9 +138,9 @@ pub fn load_block_weight( #[cfg(test)] mod test { use super::*; - use crate::migration::EpochV0; + use crate::migration::SessionV0; use fork_tree::ForkTree; - use sc_consensus_epochs::{EpochHeader, PersistedEpoch, PersistedEpochHeader}; + use sc_consensus_sessions::{SessionHeader, PersistedSession, PersistedSessionHeader}; use sc_network_test::Block as TestBlock; use sp_consensus::Error as ConsensusError; use sp_consensus_babe::{AllowedSlots, BabeGenesisConfiguration}; @@ -149,12 +149,12 @@ mod test { use substrate_test_runtime_client; #[test] - fn load_decode_from_v0_epoch_changes() { - let epoch = EpochV0 { + fn load_decode_from_v0_session_changes() { + let session = SessionV0 { start_slot: 0.into(), authorities: vec![], randomness: [0; 32], - epoch_index: 1, + session_index: 1, duration: 100, }; let client = substrate_test_runtime_client::new(); @@ -163,7 +163,7 @@ mod test { .import::<_, ConsensusError>( Default::default(), Default::default(), - PersistedEpoch::Regular(epoch), + PersistedSession::Regular(session), &|_, _| Ok(false), // Test is single item only so this can be set to false. ) .unwrap(); @@ -172,7 +172,7 @@ mod test { .insert_aux( &[( BABE_EPOCH_CHANGES_KEY, - &EpochChangesV0For::::from_raw(v0_tree).encode()[..], + &SessionChangesV0For::::from_raw(v0_tree).encode()[..], )], &[], ) @@ -180,11 +180,11 @@ mod test { assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), None); - let epoch_changes = load_epoch_changes::( + let session_changes = load_session_changes::( &client, &BabeGenesisConfiguration { slot_duration: 10, - epoch_length: 4, + session_length: 4, c: (3, 10), genesis_authorities: Vec::new(), randomness: Default::default(), @@ -194,19 +194,19 @@ mod test { .unwrap(); assert!( - epoch_changes + session_changes .shared_data() .tree() .iter() - .map(|(_, _, epoch)| epoch.clone()) + .map(|(_, _, session)| session.clone()) .collect::>() == - vec![PersistedEpochHeader::Regular(EpochHeader { + vec![PersistedSessionHeader::Regular(SessionHeader { start_slot: 0.into(), end_slot: 100.into(), })], - ); // PersistedEpochHeader does not implement Debug, so we use assert! directly. + ); // PersistedSessionHeader does not implement Debug, so we use assert! directly. - write_epoch_changes::(&epoch_changes.shared_data(), |values| { + write_session_changes::(&session_changes.shared_data(), |values| { client.insert_aux(values, &[]).unwrap(); }); diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs index be5c2809bd796..e183fb5d99b98 100644 --- a/client/consensus/babe/src/lib.rs +++ b/client/consensus/babe/src/lib.rs @@ -26,12 +26,12 @@ //! used by other peer to validate the legitimacy of the slot claim. //! //! The engine is also responsible for collecting entropy on-chain which will be -//! used to seed the given VRF PRNG. An epoch is a contiguous number of slots -//! under which we will be using the same authority set. During an epoch all VRF +//! used to seed the given VRF PRNG. An session is a contiguous number of slots +//! under which we will be using the same authority set. During an session all VRF //! outputs produced as a result of block production will be collected on an -//! on-chain randomness pool. Epoch changes are announced one epoch in advance, -//! i.e. when ending epoch N, we announce the parameters (randomness, -//! authorities, etc.) for epoch N+2. +//! on-chain randomness pool. Session changes are announced one session in advance, +//! i.e. when ending session N, we announce the parameters (randomness, +//! authorities, etc.) for session N+2. //! //! Since the slot assignment is randomized, it is possible that a slot is //! assigned to multiple validators in which case we will have a temporary fork, @@ -49,7 +49,7 @@ //! to a secondary slot claim attempt. The secondary slot assignment is done //! by picking the authority at index: //! -//! `blake2_256(epoch_randomness ++ slot_number) % authorities_len`. +//! `blake2_256(session_randomness ++ slot_number) % authorities_len`. //! //! The secondary slots supports either a `SecondaryPlain` or `SecondaryVRF` //! variant. Comparing with `SecondaryPlain` variant, the `SecondaryVRF` variant @@ -101,8 +101,8 @@ use sc_consensus::{ }, import_queue::{BasicQueue, BoxJustificationImport, DefaultImportQueue, Verifier}, }; -use sc_consensus_epochs::{ - descendent_query, Epoch as EpochT, EpochChangesFor, SharedEpochChanges, ViableEpochDescriptor, +use sc_consensus_sessions::{ + descendent_query, Session as SessionT, SessionChangesFor, SharedSessionChanges, ViableSessionDescriptor, }; use sc_consensus_slots::{ check_equivocation, BackoffAuthoringBlocksStrategy, CheckedHeader, InherentDataProviderExt, @@ -134,11 +134,11 @@ pub use sc_consensus_slots::SlotProportion; pub use sp_consensus::SyncOracle; pub use sp_consensus_babe::{ digests::{ - CompatibleDigestItem, NextConfigDescriptor, NextEpochDescriptor, PreDigest, + CompatibleDigestItem, NextConfigDescriptor, NextSessionDescriptor, PreDigest, PrimaryPreDigest, SecondaryPlainPreDigest, }, AuthorityId, AuthorityPair, AuthoritySignature, BabeApi, BabeAuthorityWeight, BabeBlockWeight, - BabeEpochConfiguration, BabeGenesisConfiguration, ConsensusLog, BABE_ENGINE_ID, + BabeSessionConfiguration, BabeGenesisConfiguration, ConsensusLog, BABE_ENGINE_ID, VRF_OUTPUT_LENGTH, }; @@ -152,33 +152,33 @@ pub mod aux_schema; #[cfg(test)] mod tests; -/// BABE epoch information +/// BABE session information #[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)] -pub struct Epoch { - /// The epoch index. - pub epoch_index: u64, - /// The starting slot of the epoch. +pub struct Session { + /// The session index. + pub session_index: u64, + /// The starting slot of the session. pub start_slot: Slot, - /// The duration of this epoch. + /// The duration of this session. pub duration: u64, /// The authorities and their weights. pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, - /// Randomness for this epoch. + /// Randomness for this session. pub randomness: [u8; VRF_OUTPUT_LENGTH], - /// Configuration of the epoch. - pub config: BabeEpochConfiguration, + /// Configuration of the session. + pub config: BabeSessionConfiguration, } -impl EpochT for Epoch { - type NextEpochDescriptor = (NextEpochDescriptor, BabeEpochConfiguration); +impl SessionT for Session { + type NextSessionDescriptor = (NextSessionDescriptor, BabeSessionConfiguration); type Slot = Slot; fn increment( &self, - (descriptor, config): (NextEpochDescriptor, BabeEpochConfiguration), - ) -> Epoch { - Epoch { - epoch_index: self.epoch_index + 1, + (descriptor, config): (NextSessionDescriptor, BabeSessionConfiguration), + ) -> Session { + Session { + session_index: self.session_index + 1, start_slot: self.start_slot + self.duration, duration: self.duration, authorities: descriptor.authorities, @@ -196,30 +196,30 @@ impl EpochT for Epoch { } } -impl From for Epoch { - fn from(epoch: sp_consensus_babe::Epoch) -> Self { - Epoch { - epoch_index: epoch.epoch_index, - start_slot: epoch.start_slot, - duration: epoch.duration, - authorities: epoch.authorities, - randomness: epoch.randomness, - config: epoch.config, +impl From for Session { + fn from(session: sp_consensus_babe::Session) -> Self { + Session { + session_index: session.session_index, + start_slot: session.start_slot, + duration: session.duration, + authorities: session.authorities, + randomness: session.randomness, + config: session.config, } } } -impl Epoch { - /// Create the genesis epoch (epoch #0). This is defined to start at the slot of +impl Session { + /// Create the genesis session (session #0). This is defined to start at the slot of /// the first block, so that has to be provided. - pub fn genesis(genesis_config: &BabeGenesisConfiguration, slot: Slot) -> Epoch { - Epoch { - epoch_index: 0, + pub fn genesis(genesis_config: &BabeGenesisConfiguration, slot: Slot) -> Session { + Session { + session_index: 0, start_slot: slot, - duration: genesis_config.epoch_length, + duration: genesis_config.session_length, authorities: genesis_config.genesis_authorities.clone(), randomness: genesis_config.randomness, - config: BabeEpochConfiguration { + config: BabeSessionConfiguration { c: genesis_config.c, allowed_slots: genesis_config.allowed_slots, }, @@ -236,18 +236,18 @@ pub enum Error { /// No BABE pre-runtime digest found #[error("No BABE pre-runtime digest found")] NoPreRuntimeDigest, - /// Multiple BABE epoch change digests - #[error("Multiple BABE epoch change digests, rejecting!")] - MultipleEpochChangeDigests, + /// Multiple BABE session change digests + #[error("Multiple BABE session change digests, rejecting!")] + MultipleSessionChangeDigests, /// Multiple BABE config change digests #[error("Multiple BABE config change digests, rejecting!")] MultipleConfigChangeDigests, /// Could not extract timestamp and slot #[error("Could not extract timestamp and slot: {0}")] Extraction(sp_consensus::Error), - /// Could not fetch epoch - #[error("Could not fetch epoch at {0:?}")] - FetchEpoch(B::Hash), + /// Could not fetch session + #[error("Could not fetch session at {0:?}")] + FetchSession(B::Hash), /// Header rejected: too far in the future #[error("Header {0:?} rejected: too far in the future")] TooFarInFuture(B::Hash), @@ -266,8 +266,8 @@ pub enum Error { /// Slot author not found #[error("Slot author not found")] SlotAuthorNotFound, - /// Secondary slot assignments are disabled for the current epoch. - #[error("Secondary slot assignments are disabled for the current epoch.")] + /// Secondary slot assignments are disabled for the current session. + #[error("Secondary slot assignments are disabled for the current session.")] SecondarySlotAssignmentsDisabled, /// Bad signature #[error("Bad signature on {0:?}")] @@ -287,15 +287,15 @@ pub enum Error { /// Could not fetch parent header #[error("Could not fetch parent header: {0}")] FetchParentHeader(sp_blockchain::Error), - /// Expected epoch change to happen. - #[error("Expected epoch change to happen at {0:?}, s{1}")] - ExpectedEpochChange(B::Hash, Slot), + /// Expected session change to happen. + #[error("Expected session change to happen at {0:?}, s{1}")] + ExpectedSessionChange(B::Hash, Slot), /// Unexpected config change. #[error("Unexpected config change")] UnexpectedConfigChange, - /// Unexpected epoch change - #[error("Unexpected epoch change")] - UnexpectedEpochChange, + /// Unexpected session change + #[error("Unexpected session change")] + UnexpectedSessionChange, /// Parent block has no associated weight #[error("Parent block of {0} has no associated weight")] ParentBlockNoAssociatedWeight(B::Hash), @@ -332,8 +332,8 @@ fn babe_err(error: Error) -> Error { /// Intermediate value passed to block importer. pub struct BabeIntermediate { - /// The epoch descriptor. - pub epoch_descriptor: ViableEpochDescriptor, Epoch>, + /// The session descriptor. + pub session_descriptor: ViableSessionDescriptor, Session>, } /// Intermediate key for Babe engine. @@ -506,7 +506,7 @@ where force_authoring, backoff_authoring_blocks, keystore, - epoch_changes: babe_link.epoch_changes.clone(), + session_changes: babe_link.session_changes.clone(), slot_notification_sinks: slot_notification_sinks.clone(), config: babe_link.config.clone(), block_proposal_slot_portion, @@ -528,7 +528,7 @@ where let (worker_tx, worker_rx) = channel(HANDLE_BUFFER_SIZE); let answer_requests = - answer_requests(worker_rx, babe_link.config, client, babe_link.epoch_changes.clone()); + answer_requests(worker_rx, babe_link.config, client, babe_link.session_changes.clone()); let inner = future::select(Box::pin(slot_worker), Box::pin(answer_requests)); Ok(BabeWorker { @@ -614,7 +614,7 @@ async fn answer_requests( mut request_rx: Receiver>, config: Config, client: Arc, - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, ) where C: ProvideRuntimeApi + ProvideUncles @@ -627,32 +627,32 @@ async fn answer_requests( { while let Some(request) = request_rx.next().await { match request { - BabeRequest::EpochForChild(parent_hash, parent_number, slot_number, response) => { + BabeRequest::SessionForChild(parent_hash, parent_number, slot_number, response) => { let lookup = || { - let epoch_changes = epoch_changes.shared_data(); - let epoch_descriptor = epoch_changes - .epoch_descriptor_for_child_of( + let session_changes = session_changes.shared_data(); + let session_descriptor = session_changes + .session_descriptor_for_child_of( descendent_query(&*client), &parent_hash, parent_number, slot_number, ) .map_err(|e| Error::::ForkTree(Box::new(e)))? - .ok_or_else(|| Error::::FetchEpoch(parent_hash))?; + .ok_or_else(|| Error::::FetchSession(parent_hash))?; - let viable_epoch = epoch_changes - .viable_epoch(&epoch_descriptor, |slot| { - Epoch::genesis(&config.genesis_config, slot) + let viable_session = session_changes + .viable_session(&session_descriptor, |slot| { + Session::genesis(&config.genesis_config, slot) }) - .ok_or_else(|| Error::::FetchEpoch(parent_hash))?; - - Ok(sp_consensus_babe::Epoch { - epoch_index: viable_epoch.as_ref().epoch_index, - start_slot: viable_epoch.as_ref().start_slot, - duration: viable_epoch.as_ref().duration, - authorities: viable_epoch.as_ref().authorities.clone(), - randomness: viable_epoch.as_ref().randomness, - config: viable_epoch.as_ref().config.clone(), + .ok_or_else(|| Error::::FetchSession(parent_hash))?; + + Ok(sp_consensus_babe::Session { + session_index: viable_session.as_ref().session_index, + start_slot: viable_session.as_ref().start_slot, + duration: viable_session.as_ref().duration, + authorities: viable_session.as_ref().authorities.clone(), + randomness: viable_session.as_ref().randomness, + config: viable_session.as_ref().config.clone(), }) }; @@ -665,14 +665,14 @@ async fn answer_requests( /// Requests to the BABE service. #[non_exhaustive] pub enum BabeRequest { - /// Request the epoch that a child of the given block, with the given slot number would have. + /// Request the session that a child of the given block, with the given slot number would have. /// /// The parent block is identified by its hash and number. - EpochForChild( + SessionForChild( B::Hash, NumberFor, Slot, - oneshot::Sender>>, + oneshot::Sender>>, ), } @@ -699,10 +699,10 @@ pub struct BabeWorker { impl BabeWorker { /// Return an event stream of notifications for when new slot happens, and the corresponding - /// epoch descriptor. + /// session descriptor. pub fn slot_notification_stream( &self, - ) -> Receiver<(Slot, ViableEpochDescriptor, Epoch>)> { + ) -> Receiver<(Slot, ViableSessionDescriptor, Session>)> { const CHANNEL_BUFFER_SIZE: usize = 1024; let (sink, stream) = channel(CHANNEL_BUFFER_SIZE); @@ -726,7 +726,7 @@ impl Future for BabeWorker { /// Slot notification sinks. type SlotNotificationSinks = Arc< - Mutex::Hash, NumberFor, Epoch>)>>>, + Mutex::Hash, NumberFor, Session>)>>>, >; struct BabeSlotWorker { @@ -738,7 +738,7 @@ struct BabeSlotWorker { force_authoring: bool, backoff_authoring_blocks: Option, keystore: SyncCryptoStorePtr, - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, slot_notification_sinks: SlotNotificationSinks, config: Config, block_proposal_slot_portion: SlotProportion, @@ -761,7 +761,7 @@ where BS: BackoffAuthoringBlocksStrategy> + Sync, Error: std::error::Error + Send + From + From + 'static, { - type EpochData = ViableEpochDescriptor, Epoch>; + type SessionData = ViableSessionDescriptor, Session>; type Claim = (PreDigest, AuthorityId); type SyncOracle = SO; type JustificationSyncLink = L; @@ -778,14 +778,14 @@ where &mut self.block_import } - fn epoch_data( + fn session_data( &self, parent: &B::Header, slot: Slot, - ) -> Result { - self.epoch_changes + ) -> Result { + self.session_changes .shared_data() - .epoch_descriptor_for_child_of( + .session_descriptor_for_child_of( descendent_query(&*self.client), &parent.hash(), parent.number().clone(), @@ -795,28 +795,28 @@ where .ok_or(sp_consensus::Error::InvalidAuthoritiesSet) } - fn authorities_len(&self, epoch_descriptor: &Self::EpochData) -> Option { - self.epoch_changes + fn authorities_len(&self, session_descriptor: &Self::SessionData) -> Option { + self.session_changes .shared_data() - .viable_epoch(&epoch_descriptor, |slot| { - Epoch::genesis(&self.config.genesis_config, slot) + .viable_session(&session_descriptor, |slot| { + Session::genesis(&self.config.genesis_config, slot) }) - .map(|epoch| epoch.as_ref().authorities.len()) + .map(|session| session.as_ref().authorities.len()) } async fn claim_slot( &self, _parent_header: &B::Header, slot: Slot, - epoch_descriptor: &ViableEpochDescriptor, Epoch>, + session_descriptor: &ViableSessionDescriptor, Session>, ) -> Option { debug!(target: "babe", "Attempting to claim slot {}", slot); let s = authorship::claim_slot( slot, - self.epoch_changes + self.session_changes .shared_data() - .viable_epoch(&epoch_descriptor, |slot| { - Epoch::genesis(&self.config.genesis_config, slot) + .viable_session(&session_descriptor, |slot| { + Session::genesis(&self.config.genesis_config, slot) })? .as_ref(), &self.keystore, @@ -833,10 +833,10 @@ where &self, _parent_header: &B::Header, slot: Slot, - epoch_descriptor: &ViableEpochDescriptor, Epoch>, + session_descriptor: &ViableSessionDescriptor, Session>, ) { RetainMut::retain_mut(&mut *self.slot_notification_sinks.lock(), |sink| { - match sink.try_send((slot, epoch_descriptor.clone())) { + match sink.try_send((slot, session_descriptor.clone())) { Ok(()) => true, Err(e) => if e.is_full() { @@ -860,7 +860,7 @@ where body: Vec, storage_changes: StorageChanges<>::Transaction, B>, (_, public): Self::Claim, - epoch_descriptor: Self::EpochData, + session_descriptor: Self::SessionData, ) -> Result< sc_consensus::BlockImportParams>::Transaction>, sp_consensus::Error, @@ -895,7 +895,7 @@ where StateAction::ApplyChanges(sc_consensus::StorageChanges::Changes(storage_changes)); import_block.intermediates.insert( Cow::from(INTERMEDIATE_KEY), - Box::new(BabeIntermediate:: { epoch_descriptor }) as Box<_>, + Box::new(BabeIntermediate:: { session_descriptor }) as Box<_>, ); Ok(import_block) @@ -980,23 +980,23 @@ pub fn find_pre_digest(header: &B::Header) -> Result( +/// Extract the BABE session change digest from the given header, if it exists. +fn find_next_session_digest( header: &B::Header, -) -> Result, Error> { - let mut epoch_digest: Option<_> = None; +) -> Result, Error> { + let mut session_digest: Option<_> = None; for log in header.digest().logs() { - trace!(target: "babe", "Checking log {:?}, looking for epoch change digest.", log); + trace!(target: "babe", "Checking log {:?}, looking for session change digest.", log); let log = log.try_to::(OpaqueDigestItemId::Consensus(&BABE_ENGINE_ID)); - match (log, epoch_digest.is_some()) { - (Some(ConsensusLog::NextEpochData(_)), true) => - return Err(babe_err(Error::MultipleEpochChangeDigests)), - (Some(ConsensusLog::NextEpochData(epoch)), false) => epoch_digest = Some(epoch), + match (log, session_digest.is_some()) { + (Some(ConsensusLog::NextSessionData(_)), true) => + return Err(babe_err(Error::MultipleSessionChangeDigests)), + (Some(ConsensusLog::NextSessionData(session)), false) => session_digest = Some(session), _ => trace!(target: "babe", "Ignoring digest not meant for us"), } } - Ok(epoch_digest) + Ok(session_digest) } /// Extract the BABE config change digest from the given header, if it exists. @@ -1005,7 +1005,7 @@ fn find_next_config_digest( ) -> Result, Error> { let mut config_digest: Option<_> = None; for log in header.digest().logs() { - trace!(target: "babe", "Checking log {:?}, looking for epoch change digest.", log); + trace!(target: "babe", "Checking log {:?}, looking for session change digest.", log); let log = log.try_to::(OpaqueDigestItemId::Consensus(&BABE_ENGINE_ID)); match (log, config_digest.is_some()) { (Some(ConsensusLog::NextConfigData(_)), true) => @@ -1021,14 +1021,14 @@ fn find_next_config_digest( /// State that must be shared between the import queue and the authoring logic. #[derive(Clone)] pub struct BabeLink { - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, config: Config, } impl BabeLink { - /// Get the epoch changes of this link. - pub fn epoch_changes(&self) -> &SharedEpochChanges { - &self.epoch_changes + /// Get the session changes of this link. + pub fn session_changes(&self) -> &SharedSessionChanges { + &self.session_changes } /// Get the config of this link. @@ -1043,7 +1043,7 @@ pub struct BabeVerifier { select_chain: SelectChain, create_inherent_data_providers: CIDP, config: Config, - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, can_author_with: CAW, telemetry: Option, } @@ -1212,7 +1212,7 @@ where let parent_hash = *block.header.parent_hash(); if block.with_state() { - // When importing whole state we don't calculate epoch descriptor, but rather + // When importing whole state we don't calculate session descriptor, but rather // read it from the state after import. We also skip all verifications // because there's no parent state and we trust the sync module to verify // that the state is correct and finalized. @@ -1235,22 +1235,22 @@ where .map_err(Error::::FetchParentHeader)?; let pre_digest = find_pre_digest::(&block.header)?; - let (check_header, epoch_descriptor) = { - let epoch_changes = self.epoch_changes.shared_data(); - let epoch_descriptor = epoch_changes - .epoch_descriptor_for_child_of( + let (check_header, session_descriptor) = { + let session_changes = self.session_changes.shared_data(); + let session_descriptor = session_changes + .session_descriptor_for_child_of( descendent_query(&*self.client), &parent_hash, parent_header_metadata.number, pre_digest.slot(), ) .map_err(|e| Error::::ForkTree(Box::new(e)))? - .ok_or_else(|| Error::::FetchEpoch(parent_hash))?; - let viable_epoch = epoch_changes - .viable_epoch(&epoch_descriptor, |slot| { - Epoch::genesis(&self.config.genesis_config, slot) + .ok_or_else(|| Error::::FetchSession(parent_hash))?; + let viable_session = session_changes + .viable_session(&session_descriptor, |slot| { + Session::genesis(&self.config.genesis_config, slot) }) - .ok_or_else(|| Error::::FetchEpoch(parent_hash))?; + .ok_or_else(|| Error::::FetchSession(parent_hash))?; // We add one to the current slot to allow for some small drift. // FIXME #1019 in the future, alter this queue to allow deferring of headers @@ -1258,10 +1258,10 @@ where header: block.header.clone(), pre_digest: Some(pre_digest), slot_now: slot_now + 1, - epoch: viable_epoch.as_ref(), + session: viable_session.as_ref(), }; - (verification::check_header::(v_params)?, epoch_descriptor) + (verification::check_header::(v_params)?, session_descriptor) }; match check_header { @@ -1323,7 +1323,7 @@ where block.post_digests.push(verified_info.seal); block.intermediates.insert( Cow::from(INTERMEDIATE_KEY), - Box::new(BabeIntermediate:: { epoch_descriptor }) as Box<_>, + Box::new(BabeIntermediate:: { session_descriptor }) as Box<_>, ); block.post_hash = Some(hash); @@ -1345,16 +1345,16 @@ where /// A block-import handler for BABE. /// -/// This scans each imported block for epoch change signals. The signals are -/// tracked in a tree (of all forks), and the import logic validates all epoch -/// change transitions, i.e. whether a given epoch change is expected or whether +/// This scans each imported block for session change signals. The signals are +/// tracked in a tree (of all forks), and the import logic validates all session +/// change transitions, i.e. whether a given session change is expected or whether /// it is missing. /// -/// The epoch change tree should be pruned as blocks are finalized. +/// The session change tree should be pruned as blocks are finalized. pub struct BabeBlockImport { inner: I, client: Arc, - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, config: Config, } @@ -1363,7 +1363,7 @@ impl Clone for BabeBlockImport Clone for BabeBlockImport BabeBlockImport { fn new( client: Arc, - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, block_import: I, config: Config, ) -> Self { - BabeBlockImport { client, inner: block_import, epoch_changes, config } + BabeBlockImport { client, inner: block_import, session_changes, config } } } @@ -1425,18 +1425,18 @@ where Err(r) => return Err(r.into()), }; - // Read epoch info from the imported state. + // Read session info from the imported state. let block_id = BlockId::hash(hash); - let current_epoch = self.client.runtime_api().current_epoch(&block_id).map_err(|e| { + let current_session = self.client.runtime_api().current_session(&block_id).map_err(|e| { ConsensusError::ClientImport(babe_err::(Error::RuntimeApi(e)).into()) })?; - let next_epoch = self.client.runtime_api().next_epoch(&block_id).map_err(|e| { + let next_session = self.client.runtime_api().next_session(&block_id).map_err(|e| { ConsensusError::ClientImport(babe_err::(Error::RuntimeApi(e)).into()) })?; - let mut epoch_changes = self.epoch_changes.shared_data_locked(); - epoch_changes.reset(parent_hash, hash, number, current_epoch.into(), next_epoch.into()); - aux_schema::write_epoch_changes::(&*epoch_changes, |insert| { + let mut session_changes = self.session_changes.shared_data_locked(); + session_changes.reset(parent_hash, hash, number, current_session.into(), next_session.into()); + aux_schema::write_session_changes::(&*session_changes, |insert| { self.client.insert_aux(insert, []) }) .map_err(|e| ConsensusError::ClientImport(e.to_string()))?; @@ -1471,7 +1471,7 @@ where let number = *block.header.number(); // early exit if block already in chain, otherwise the check for - // epoch changes will error when trying to re-import an epoch change + // session changes will error when trying to re-import an session change match self.client.status(BlockId::Hash(hash)) { Ok(sp_blockchain::BlockStatus::InChain) => { // When re-importing existing block strip away intermediates. @@ -1515,21 +1515,21 @@ where )) } - // if there's a pending epoch we'll save the previous epoch changes here + // if there's a pending session we'll save the previous session changes here // this way we can revert it if there's any error - let mut old_epoch_changes = None; + let mut old_session_changes = None; // Use an extra scope to make the compiler happy, because otherwise he complains about the // mutex, even if we dropped it... - let mut epoch_changes = { - let mut epoch_changes = self.epoch_changes.shared_data_locked(); + let mut session_changes = { + let mut session_changes = self.session_changes.shared_data_locked(); - // check if there's any epoch change expected to happen at this slot. - // `epoch` is the epoch to verify the block under, and `first_in_epoch` is true - // if this is the first block in its chain for that epoch. + // check if there's any session change expected to happen at this slot. + // `session` is the session to verify the block under, and `first_in_session` is true + // if this is the first block in its chain for that session. // // also provides the total weight of the chain, including the imported block. - let (epoch_descriptor, first_in_epoch, parent_weight) = { + let (session_descriptor, first_in_session, parent_weight) = { let parent_weight = if *parent_header.number() == Zero::zero() { 0 } else { @@ -1546,20 +1546,20 @@ where let intermediate = block.take_intermediate::>(INTERMEDIATE_KEY)?; - let epoch_descriptor = intermediate.epoch_descriptor; - let first_in_epoch = parent_slot < epoch_descriptor.start_slot(); - (epoch_descriptor, first_in_epoch, parent_weight) + let session_descriptor = intermediate.session_descriptor; + let first_in_session = parent_slot < session_descriptor.start_slot(); + (session_descriptor, first_in_session, parent_weight) }; let total_weight = parent_weight + pre_digest.added_weight(); // search for this all the time so we can reject unexpected announcements. - let next_epoch_digest = find_next_epoch_digest::(&block.header) + let next_session_digest = find_next_session_digest::(&block.header) .map_err(|e| ConsensusError::ClientImport(e.to_string()))?; let next_config_digest = find_next_config_digest::(&block.header) .map_err(|e| ConsensusError::ClientImport(e.to_string()))?; - match (first_in_epoch, next_epoch_digest.is_some(), next_config_digest.is_some()) { + match (first_in_session, next_session_digest.is_some(), next_config_digest.is_some()) { (true, true, _) => {}, (false, false, false) => {}, (false, false, true) => @@ -1568,30 +1568,30 @@ where )), (true, false, _) => return Err(ConsensusError::ClientImport( - babe_err(Error::::ExpectedEpochChange(hash, slot)).into(), + babe_err(Error::::ExpectedSessionChange(hash, slot)).into(), )), (false, true, _) => return Err(ConsensusError::ClientImport( - babe_err(Error::::UnexpectedEpochChange).into(), + babe_err(Error::::UnexpectedSessionChange).into(), )), } let info = self.client.info(); - if let Some(next_epoch_descriptor) = next_epoch_digest { - old_epoch_changes = Some((*epoch_changes).clone()); + if let Some(next_session_descriptor) = next_session_digest { + old_session_changes = Some((*session_changes).clone()); - let viable_epoch = epoch_changes - .viable_epoch(&epoch_descriptor, |slot| { - Epoch::genesis(&self.config.genesis_config, slot) + let viable_session = session_changes + .viable_session(&session_descriptor, |slot| { + Session::genesis(&self.config.genesis_config, slot) }) .ok_or_else(|| { - ConsensusError::ClientImport(Error::::FetchEpoch(parent_hash).into()) + ConsensusError::ClientImport(Error::::FetchSession(parent_hash).into()) })?; - let epoch_config = next_config_digest + let session_config = next_config_digest .map(Into::into) - .unwrap_or_else(|| viable_epoch.as_ref().config.clone()); + .unwrap_or_else(|| viable_session.as_ref().config.clone()); // restrict info logging during initial sync to avoid spam let log_level = if block.origin == BlockOrigin::NetworkInitialSync { @@ -1602,42 +1602,42 @@ where log!(target: "babe", log_level, - "👶 New epoch {} launching at block {} (block slot {} >= start slot {}).", - viable_epoch.as_ref().epoch_index, + "👶 New session {} launching at block {} (block slot {} >= start slot {}).", + viable_session.as_ref().session_index, hash, slot, - viable_epoch.as_ref().start_slot, + viable_session.as_ref().start_slot, ); - let next_epoch = viable_epoch.increment((next_epoch_descriptor, epoch_config)); + let next_session = viable_session.increment((next_session_descriptor, session_config)); log!(target: "babe", log_level, - "👶 Next epoch starts at slot {}", - next_epoch.as_ref().start_slot, + "👶 Next session starts at slot {}", + next_session.as_ref().start_slot, ); - // prune the tree of epochs not part of the finalized chain or - // that are not live anymore, and then track the given epoch change + // prune the tree of sessions not part of the finalized chain or + // that are not live anymore, and then track the given session change // in the tree. // NOTE: it is important that these operations are done in this // order, otherwise if pruning after import the `is_descendent_of` // used by pruning may not know about the block that is being // imported. let prune_and_import = || { - prune_finalized(self.client.clone(), &mut epoch_changes)?; + prune_finalized(self.client.clone(), &mut session_changes)?; - epoch_changes + session_changes .import( descendent_query(&*self.client), hash, number, *block.header.parent_hash(), - next_epoch, + next_session, ) .map_err(|e| { ConsensusError::ClientImport(format!( - "Error importing epoch changes: {}", + "Error importing session changes: {}", e )) })?; @@ -1645,13 +1645,13 @@ where }; if let Err(e) = prune_and_import() { - debug!(target: "babe", "Failed to launch next epoch: {}", e); - *epoch_changes = - old_epoch_changes.expect("set `Some` above and not taken; qed"); + debug!(target: "babe", "Failed to launch next session: {}", e); + *session_changes = + old_session_changes.expect("set `Some` above and not taken; qed"); return Err(e) } - crate::aux_schema::write_epoch_changes::(&*epoch_changes, |insert| { + crate::aux_schema::write_session_changes::(&*session_changes, |insert| { block .auxiliary .extend(insert.iter().map(|(k, v)| (k.to_vec(), Some(v.to_vec())))) @@ -1694,16 +1694,16 @@ where }; // Release the mutex, but it stays locked - epoch_changes.release_mutex() + session_changes.release_mutex() }; let import_result = self.inner.import_block(block, new_cache).await; - // revert to the original epoch changes in case there's an error + // revert to the original session changes in case there's an error // importing the block if import_result.is_err() { - if let Some(old_epoch_changes) = old_epoch_changes { - *epoch_changes.upgrade() = old_epoch_changes; + if let Some(old_session_changes) = old_session_changes { + *session_changes.upgrade() = old_session_changes; } } @@ -1718,10 +1718,10 @@ where } } -/// Gets the best finalized block and its slot, and prunes the given epoch tree. +/// Gets the best finalized block and its slot, and prunes the given session tree. fn prune_finalized( client: Arc, - epoch_changes: &mut EpochChangesFor, + session_changes: &mut SessionChangesFor, ) -> Result<(), ConsensusError> where Block: BlockT, @@ -1729,7 +1729,7 @@ where { let info = client.info(); if info.block_gap.is_none() { - epoch_changes.clear_gap(); + session_changes.clear_gap(); } let finalized_slot = { @@ -1745,7 +1745,7 @@ where .slot() }; - epoch_changes + session_changes .prune_finalized( descendent_query(&*client), &info.finalized_hash, @@ -1774,14 +1774,14 @@ where + PreCommitActions + 'static, { - let epoch_changes = - aux_schema::load_epoch_changes::(&*client, &config.genesis_config)?; - let link = BabeLink { epoch_changes: epoch_changes.clone(), config: config.clone() }; + let session_changes = + aux_schema::load_session_changes::(&*client, &config.genesis_config)?; + let link = BabeLink { session_changes: session_changes.clone(), config: config.clone() }; // NOTE: this isn't entirely necessary, but since we didn't use to prune the - // epoch tree it is useful as a migration, so that nodes prune long trees on - // startup rather than waiting until importing the next epoch change block. - prune_finalized(client.clone(), &mut epoch_changes.shared_data())?; + // session tree it is useful as a migration, so that nodes prune long trees on + // startup rather than waiting until importing the next session change block. + prune_finalized(client.clone(), &mut session_changes.shared_data())?; let client_clone = client.clone(); let on_finality = move |summary: &FinalityNotification| { @@ -1789,7 +1789,7 @@ where }; client.register_finality_action(Box::new(on_finality)); - let import = BabeBlockImport::new(client, epoch_changes, wrapped_block_import, config); + let import = BabeBlockImport::new(client, session_changes, wrapped_block_import, config); Ok((import, link)) } @@ -1799,7 +1799,7 @@ where /// This method returns the import queue, some data that needs to be passed to the block authoring /// logic (`BabeLink`), and a future that must be run to /// completion and is responsible for listening to finality notifications and -/// pruning the epoch changes tree. +/// pruning the session changes tree. /// /// The block import object provided must be the `BabeBlockImport` or a wrapper /// of it, otherwise crucial import logic will be omitted. @@ -1840,7 +1840,7 @@ where select_chain, create_inherent_data_providers, config: babe_link.config, - epoch_changes: babe_link.epoch_changes, + session_changes: babe_link.session_changes, can_author_with, telemetry, client, @@ -1850,7 +1850,7 @@ where } /// Reverts protocol aux data to at most the last finalized block. -/// In particular, epoch-changes and block weights announced after the revert +/// In particular, session-changes and block weights announced after the revert /// point are removed. pub fn revert( client: Arc, @@ -1879,18 +1879,18 @@ where number )))?; - // Revert epoch changes tree. + // Revert session changes tree. let config = Config::get(&*client)?; - let epoch_changes = - aux_schema::load_epoch_changes::(&*client, config.genesis_config())?; - let mut epoch_changes = epoch_changes.shared_data(); + let session_changes = + aux_schema::load_session_changes::(&*client, config.genesis_config())?; + let mut session_changes = session_changes.shared_data(); if number == Zero::zero() { - // Special case, no epoch changes data were present on genesis. - *epoch_changes = EpochChangesFor::::default(); + // Special case, no session changes data were present on genesis. + *session_changes = SessionChangesFor::::default(); } else { - epoch_changes.revert(descendent_query(&*client), hash, number); + session_changes.revert(descendent_query(&*client), hash, number); } // Remove block weights added after the revert point. @@ -1916,8 +1916,8 @@ where } let weight_keys: Vec<_> = weight_keys.iter().map(|val| val.as_slice()).collect(); - // Write epoch changes and remove weights in one shot. - aux_schema::write_epoch_changes::(&epoch_changes, |values| { + // Write session changes and remove weights in one shot. + aux_schema::write_session_changes::(&session_changes, |values| { client.insert_aux(values, weight_keys.iter()) }) } diff --git a/client/consensus/babe/src/migration.rs b/client/consensus/babe/src/migration.rs index a8c3772bbefb8..ab6ae954e5d0d 100644 --- a/client/consensus/babe/src/migration.rs +++ b/client/consensus/babe/src/migration.rs @@ -17,35 +17,35 @@ // along with this program. If not, see . use crate::{ - AuthorityId, BabeAuthorityWeight, BabeEpochConfiguration, BabeGenesisConfiguration, Epoch, - NextEpochDescriptor, VRF_OUTPUT_LENGTH, + AuthorityId, BabeAuthorityWeight, BabeSessionConfiguration, BabeGenesisConfiguration, Session, + NextSessionDescriptor, VRF_OUTPUT_LENGTH, }; use codec::{Decode, Encode}; -use sc_consensus_epochs::Epoch as EpochT; +use sc_consensus_sessions::Session as SessionT; use sp_consensus_slots::Slot; -/// BABE epoch information, version 0. +/// BABE session information, version 0. #[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)] -pub struct EpochV0 { - /// The epoch index. - pub epoch_index: u64, - /// The starting slot of the epoch. +pub struct SessionV0 { + /// The session index. + pub session_index: u64, + /// The starting slot of the session. pub start_slot: Slot, - /// The duration of this epoch. + /// The duration of this session. pub duration: u64, /// The authorities and their weights. pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, - /// Randomness for this epoch. + /// Randomness for this session. pub randomness: [u8; VRF_OUTPUT_LENGTH], } -impl EpochT for EpochV0 { - type NextEpochDescriptor = NextEpochDescriptor; +impl SessionT for SessionV0 { + type NextSessionDescriptor = NextSessionDescriptor; type Slot = Slot; - fn increment(&self, descriptor: NextEpochDescriptor) -> EpochV0 { - EpochV0 { - epoch_index: self.epoch_index + 1, + fn increment(&self, descriptor: NextSessionDescriptor) -> SessionV0 { + SessionV0 { + session_index: self.session_index + 1, start_slot: self.start_slot + self.duration, duration: self.duration, authorities: descriptor.authorities, @@ -62,16 +62,16 @@ impl EpochT for EpochV0 { } } -impl EpochV0 { - /// Migrate the sturct to current epoch version. - pub fn migrate(self, config: &BabeGenesisConfiguration) -> Epoch { - Epoch { - epoch_index: self.epoch_index, +impl SessionV0 { + /// Migrate the sturct to current session version. + pub fn migrate(self, config: &BabeGenesisConfiguration) -> Session { + Session { + session_index: self.session_index, start_slot: self.start_slot, duration: self.duration, authorities: self.authorities, randomness: self.randomness, - config: BabeEpochConfiguration { c: config.c, allowed_slots: config.allowed_slots }, + config: BabeSessionConfiguration { c: config.c, allowed_slots: config.allowed_slots }, } } } diff --git a/client/consensus/babe/src/tests.rs b/client/consensus/babe/src/tests.rs index db19deda06fd8..dee9d9f07b4ee 100644 --- a/client/consensus/babe/src/tests.rs +++ b/client/consensus/babe/src/tests.rs @@ -74,7 +74,7 @@ type BabeBlockImport = #[derive(Clone)] struct DummyFactory { client: Arc, - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, config: Config, mutator: Mutator, } @@ -136,27 +136,27 @@ impl DummyProposer { // figure out if we should add a consensus digest, since the test runtime // doesn't. - let epoch_changes = self.factory.epoch_changes.shared_data(); - let epoch = epoch_changes - .epoch_data_for_child_of( + let session_changes = self.factory.session_changes.shared_data(); + let session = session_changes + .session_data_for_child_of( descendent_query(&*self.factory.client), &self.parent_hash, self.parent_number, this_slot, - |slot| Epoch::genesis(self.factory.config.genesis_config(), slot), + |slot| Session::genesis(self.factory.config.genesis_config(), slot), ) - .expect("client has data to find epoch") - .expect("can compute epoch for baked block"); + .expect("client has data to find session") + .expect("can compute session for baked block"); - let first_in_epoch = self.parent_slot < epoch.start_slot; - if first_in_epoch { + let first_in_session = self.parent_slot < session.start_slot; + if first_in_session { // push a `Consensus` digest signalling next change. // we just reuse the same randomness and authorities as the prior - // epoch. this will break when we add light client support, since + // session. this will break when we add light client support, since // that will re-check the randomness logic off-chain. - let digest_data = ConsensusLog::NextEpochData(NextEpochDescriptor { - authorities: epoch.authorities.clone(), - randomness: epoch.randomness.clone(), + let digest_data = ConsensusLog::NextSessionData(NextSessionDescriptor { + authorities: session.authorities.clone(), + randomness: session.randomness.clone(), }) .encode(); let digest = DigestItem::Consensus(BABE_ENGINE_ID, digest_data); @@ -344,7 +344,7 @@ impl TestNetFactory for BabeTestNet { Ok((timestamp, slot)) }), config: data.link.config.clone(), - epoch_changes: data.link.epoch_changes.clone(), + session_changes: data.link.session_changes.clone(), can_author_with: AlwaysCanAuthor, telemetry: None, }, @@ -413,7 +413,7 @@ fn run_one_test(mutator: impl Fn(&mut TestHeader, Stage) + Send + Sync + 'static let environ = DummyFactory { client: client.clone(), config: data.link.config.clone(), - epoch_changes: data.link.epoch_changes.clone(), + session_changes: data.link.session_changes.clone(), mutator: mutator.clone(), }; @@ -521,7 +521,7 @@ fn rejects_missing_consensus_digests() { let v = std::mem::take(&mut header.digest_mut().logs); header.digest_mut().logs = v .into_iter() - .filter(|v| stage == Stage::PostSeal || v.as_next_epoch_descriptor().is_none()) + .filter(|v| stage == Stage::PostSeal || v.as_next_session_descriptor().is_none()) .collect() }); } @@ -561,13 +561,13 @@ fn can_author_block() { .expect("Generates authority pair"); let mut i = 0; - let epoch = Epoch { + let session = Session { start_slot: 0.into(), authorities: vec![(public.into(), 1)], randomness: [0; 32], - epoch_index: 1, + session_index: 1, duration: 100, - config: BabeEpochConfiguration { + config: BabeSessionConfiguration { c: (3, 10), allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots, }, @@ -575,7 +575,7 @@ fn can_author_block() { let mut config = crate::BabeGenesisConfiguration { slot_duration: 1000, - epoch_length: 100, + session_length: 100, c: (3, 10), genesis_authorities: Vec::new(), randomness: [0; 32], @@ -583,7 +583,7 @@ fn can_author_block() { }; // with secondary slots enabled it should never be empty - match claim_slot(i.into(), &epoch, &keystore) { + match claim_slot(i.into(), &session, &keystore) { None => i += 1, Some(s) => debug!(target: "babe", "Authored block {:?}", s.0), } @@ -592,7 +592,7 @@ fn can_author_block() { // of times. config.allowed_slots = AllowedSlots::PrimarySlots; loop { - match claim_slot(i.into(), &epoch, &keystore) { + match claim_slot(i.into(), &session, &keystore) { None => i += 1, Some(s) => { debug!(target: "babe", "Authored block {:?}", s.0); @@ -627,10 +627,10 @@ fn propose_and_import_block( let mut block = block_on(proposer.propose_with(pre_digest)).unwrap().block; - let epoch_descriptor = proposer_factory - .epoch_changes + let session_descriptor = proposer_factory + .session_changes .shared_data() - .epoch_descriptor_for_child_of( + .session_descriptor_for_child_of( descendent_query(&*proposer_factory.client), &parent_hash, *parent.number(), @@ -660,7 +660,7 @@ fn propose_and_import_block( import.body = Some(block.extrinsics); import.intermediates.insert( Cow::from(INTERMEDIATE_KEY), - Box::new(BabeIntermediate:: { epoch_descriptor }) as Box<_>, + Box::new(BabeIntermediate:: { session_descriptor }) as Box<_>, ); import.fork_choice = Some(ForkChoiceStrategy::LongestChain); let import_result = block_on(block_import.import_block(import, Default::default())).unwrap(); @@ -674,7 +674,7 @@ fn propose_and_import_block( } // Propose and import n valid BABE blocks that are built on top of the given parent. -// The proposer takes care of producing epoch change digests according to the epoch +// The proposer takes care of producing session change digests according to the session // duration (which is set to 6 slots in the test runtime). fn propose_and_import_blocks( client: &PeersFullClient, @@ -697,7 +697,7 @@ fn propose_and_import_blocks( } #[test] -fn importing_block_one_sets_genesis_epoch() { +fn importing_block_one_sets_genesis_session() { let mut net = BabeTestNet::new(1); let peer = net.peer(0); @@ -707,7 +707,7 @@ fn importing_block_one_sets_genesis_epoch() { let mut proposer_factory = DummyFactory { client: client.clone(), config: data.link.config.clone(), - epoch_changes: data.link.epoch_changes.clone(), + session_changes: data.link.session_changes.clone(), mutator: Arc::new(|_, _| ()), }; @@ -722,21 +722,21 @@ fn importing_block_one_sets_genesis_epoch() { &mut block_import, ); - let genesis_epoch = Epoch::genesis(data.link.config.genesis_config(), 999.into()); + let genesis_session = Session::genesis(data.link.config.genesis_config(), 999.into()); - let epoch_changes = data.link.epoch_changes.shared_data(); - let epoch_for_second_block = epoch_changes - .epoch_data_for_child_of(descendent_query(&*client), &block_hash, 1, 1000.into(), |slot| { - Epoch::genesis(data.link.config.genesis_config(), slot) + let session_changes = data.link.session_changes.shared_data(); + let session_for_second_block = session_changes + .session_data_for_child_of(descendent_query(&*client), &block_hash, 1, 1000.into(), |slot| { + Session::genesis(data.link.config.genesis_config(), slot) }) .unwrap() .unwrap(); - assert_eq!(epoch_for_second_block, genesis_epoch); + assert_eq!(session_for_second_block, genesis_session); } #[test] -fn revert_prunes_epoch_changes_and_removes_weights() { +fn revert_prunes_session_changes_and_removes_weights() { let mut net = BabeTestNet::new(1); let peer = net.peer(0); @@ -745,12 +745,12 @@ fn revert_prunes_epoch_changes_and_removes_weights() { let client = peer.client().as_client(); let backend = peer.client().as_backend(); let mut block_import = data.block_import.lock().take().expect("import set up during init"); - let epoch_changes = data.link.epoch_changes.clone(); + let session_changes = data.link.session_changes.clone(); let mut proposer_factory = DummyFactory { client: client.clone(), config: data.link.config.clone(), - epoch_changes: data.link.epoch_changes.clone(), + session_changes: data.link.session_changes.clone(), mutator: Arc::new(|_, _| ()), }; @@ -759,9 +759,9 @@ fn revert_prunes_epoch_changes_and_removes_weights() { }; // Test scenario. - // Information for epoch 19 is produced on three different forks at block #13. - // One branch starts before the revert point (epoch data should be maintained). - // One branch starts after the revert point (epoch data should be removed). + // Information for session 19 is produced on three different forks at block #13. + // One branch starts before the revert point (session data should be maintained). + // One branch starts after the revert point (session data should be removed). // // *----------------- F(#13) --#18 < fork #2 // / @@ -775,21 +775,21 @@ fn revert_prunes_epoch_changes_and_removes_weights() { let fork2 = propose_and_import_blocks_wrap(BlockId::Hash(canon[7]), 10); let fork3 = propose_and_import_blocks_wrap(BlockId::Hash(canon[11]), 8); - // We should be tracking a total of 9 epochs in the fork tree - assert_eq!(epoch_changes.shared_data().tree().iter().count(), 8); + // We should be tracking a total of 9 sessions in the fork tree + assert_eq!(session_changes.shared_data().tree().iter().count(), 8); // And only one root - assert_eq!(epoch_changes.shared_data().tree().roots().count(), 1); + assert_eq!(session_changes.shared_data().tree().roots().count(), 1); // Revert canon chain to block #10 (best(21) - 11) revert(client.clone(), backend, 11).expect("revert should work for baked test scenario"); - // Load and check epoch changes. + // Load and check session changes. - let actual_nodes = aux_schema::load_epoch_changes::( + let actual_nodes = aux_schema::load_session_changes::( &*client, data.link.config.genesis_config(), ) - .expect("load epoch changes") + .expect("load session changes") .shared_data() .tree() .iter() @@ -818,7 +818,7 @@ fn revert_prunes_epoch_changes_and_removes_weights() { } #[test] -fn importing_epoch_change_block_prunes_tree() { +fn importing_session_change_block_prunes_tree() { let mut net = BabeTestNet::new(1); let peer = net.peer(0); @@ -826,12 +826,12 @@ fn importing_epoch_change_block_prunes_tree() { let client = peer.client().as_client(); let mut block_import = data.block_import.lock().take().expect("import set up during init"); - let epoch_changes = data.link.epoch_changes.clone(); + let session_changes = data.link.session_changes.clone(); let mut proposer_factory = DummyFactory { client: client.clone(), config: data.link.config.clone(), - epoch_changes: data.link.epoch_changes.clone(), + session_changes: data.link.session_changes.clone(), mutator: Arc::new(|_, _| ()), }; @@ -840,7 +840,7 @@ fn importing_epoch_change_block_prunes_tree() { }; // This is the block tree that we're going to use in this test. Each node - // represents an epoch change block, the epoch duration is 6 slots. + // represents an session change block, the session duration is 6 slots. // // *---- F (#7) // / *------ G (#19) - H (#25) @@ -858,34 +858,34 @@ fn importing_epoch_change_block_prunes_tree() { let fork_2 = propose_and_import_blocks_wrap(BlockId::Hash(canon_hashes[12]), 15); let fork_3 = propose_and_import_blocks_wrap(BlockId::Hash(canon_hashes[18]), 10); - // We should be tracking a total of 9 epochs in the fork tree - assert_eq!(epoch_changes.shared_data().tree().iter().count(), 9); + // We should be tracking a total of 9 sessions in the fork tree + assert_eq!(session_changes.shared_data().tree().iter().count(), 9); // And only one root - assert_eq!(epoch_changes.shared_data().tree().roots().count(), 1); + assert_eq!(session_changes.shared_data().tree().roots().count(), 1); - // We finalize block #13 from the canon chain, so on the next epoch + // We finalize block #13 from the canon chain, so on the next session // change the tree should be pruned, to not contain F (#7). client.finalize_block(BlockId::Hash(canon_hashes[12]), None, false).unwrap(); propose_and_import_blocks_wrap(BlockId::Hash(client.chain_info().best_hash), 7); // at this point no hashes from the first fork must exist on the tree - assert!(!epoch_changes + assert!(!session_changes .shared_data() .tree() .iter() .map(|(h, _, _)| h) .any(|h| fork_1.contains(h)),); - // but the epoch changes from the other forks must still exist - assert!(epoch_changes + // but the session changes from the other forks must still exist + assert!(session_changes .shared_data() .tree() .iter() .map(|(h, _, _)| h) .any(|h| fork_2.contains(h))); - assert!(epoch_changes + assert!(session_changes .shared_data() .tree() .iter() @@ -897,15 +897,15 @@ fn importing_epoch_change_block_prunes_tree() { propose_and_import_blocks_wrap(BlockId::Hash(client.chain_info().best_hash), 8); // at this point no hashes from the second fork must exist on the tree - assert!(!epoch_changes + assert!(!session_changes .shared_data() .tree() .iter() .map(|(h, _, _)| h) .any(|h| fork_2.contains(h)),); - // while epoch changes from the last fork should still exist - assert!(epoch_changes + // while session changes from the last fork should still exist + assert!(session_changes .shared_data() .tree() .iter() @@ -927,7 +927,7 @@ fn verify_slots_are_strictly_increasing() { let mut proposer_factory = DummyFactory { client: client.clone(), config: data.link.config.clone(), - epoch_changes: data.link.epoch_changes.clone(), + session_changes: data.link.session_changes.clone(), mutator: Arc::new(|_, _| ()), }; @@ -957,20 +957,20 @@ fn babe_transcript_generation_match() { let public = SyncCryptoStore::sr25519_generate_new(&*keystore, BABE, Some("//Alice")) .expect("Generates authority pair"); - let epoch = Epoch { + let session = Session { start_slot: 0.into(), authorities: vec![(public.into(), 1)], randomness: [0; 32], - epoch_index: 1, + session_index: 1, duration: 100, - config: BabeEpochConfiguration { + config: BabeSessionConfiguration { c: (3, 10), allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots, }, }; - let orig_transcript = make_transcript(&epoch.randomness.clone(), 1.into(), epoch.epoch_index); - let new_transcript = make_transcript_data(&epoch.randomness, 1.into(), epoch.epoch_index); + let orig_transcript = make_transcript(&session.randomness.clone(), 1.into(), session.session_index); + let new_transcript = make_transcript_data(&session.randomness, 1.into(), session.session_index); let test = |t: merlin::Transcript| -> [u8; 16] { let mut b = [0u8; 16]; @@ -998,7 +998,7 @@ fn obsolete_blocks_aux_data_cleanup() { let mut proposer_factory = DummyFactory { client: client.clone(), config: data.link.config.clone(), - epoch_changes: data.link.epoch_changes.clone(), + session_changes: data.link.session_changes.clone(), mutator: Arc::new(|_, _| ()), }; diff --git a/client/consensus/babe/src/verification.rs b/client/consensus/babe/src/verification.rs index 41d1e1bfa5d36..75b1c7bd5e257 100644 --- a/client/consensus/babe/src/verification.rs +++ b/client/consensus/babe/src/verification.rs @@ -19,7 +19,7 @@ //! Verification for BABE headers. use super::{ authorship::{calculate_primary_threshold, check_primary_threshold, secondary_slot_author}, - babe_err, find_pre_digest, BlockT, Epoch, Error, + babe_err, find_pre_digest, BlockT, Session, Error, }; use log::{debug, trace}; use sc_consensus_slots::CheckedHeader; @@ -44,8 +44,8 @@ pub(super) struct VerificationParams<'a, B: 'a + BlockT> { pub(super) pre_digest: Option, /// The slot number of the current time. pub(super) slot_now: Slot, - /// Epoch descriptor of the epoch this block _should_ be under, if it's valid. - pub(super) epoch: &'a Epoch, + /// Session descriptor of the session this block _should_ be under, if it's valid. + pub(super) session: &'a Session, } /// Check a header has been signed by the right key. If the slot is too far in @@ -62,9 +62,9 @@ pub(super) struct VerificationParams<'a, B: 'a + BlockT> { pub(super) fn check_header( params: VerificationParams, ) -> Result, Error> { - let VerificationParams { mut header, pre_digest, slot_now, epoch } = params; + let VerificationParams { mut header, pre_digest, slot_now, session } = params; - let authorities = &epoch.authorities; + let authorities = &session.authorities; let pre_digest = pre_digest.map(Ok).unwrap_or_else(|| find_pre_digest::(&header))?; trace!(target: "babe", "Checking header"); @@ -99,10 +99,10 @@ pub(super) fn check_header( primary.slot, ); - check_primary_header::(pre_hash, primary, sig, &epoch, epoch.config.c)?; + check_primary_header::(pre_hash, primary, sig, &session, session.config.c)?; }, PreDigest::SecondaryPlain(secondary) - if epoch.config.allowed_slots.is_secondary_plain_slots_allowed() => + if session.config.allowed_slots.is_secondary_plain_slots_allowed() => { debug!(target: "babe", "Verifying secondary plain block #{} at slot: {}", @@ -110,10 +110,10 @@ pub(super) fn check_header( secondary.slot, ); - check_secondary_plain_header::(pre_hash, secondary, sig, &epoch)?; + check_secondary_plain_header::(pre_hash, secondary, sig, &session)?; }, PreDigest::SecondaryVRF(secondary) - if epoch.config.allowed_slots.is_secondary_vrf_slots_allowed() => + if session.config.allowed_slots.is_secondary_vrf_slots_allowed() => { debug!(target: "babe", "Verifying secondary VRF block #{} at slot: {}", @@ -121,7 +121,7 @@ pub(super) fn check_header( secondary.slot, ); - check_secondary_vrf_header::(pre_hash, secondary, sig, &epoch)?; + check_secondary_vrf_header::(pre_hash, secondary, sig, &session)?; }, _ => return Err(babe_err(Error::SecondarySlotAssignmentsDisabled)), } @@ -148,14 +148,14 @@ fn check_primary_header( pre_hash: B::Hash, pre_digest: &PrimaryPreDigest, signature: AuthoritySignature, - epoch: &Epoch, + session: &Session, c: (u64, u64), ) -> Result<(), Error> { - let author = &epoch.authorities[pre_digest.authority_index as usize].0; + let author = &session.authorities[pre_digest.authority_index as usize].0; if AuthorityPair::verify(&signature, pre_hash, &author) { let (inout, _) = { - let transcript = make_transcript(&epoch.randomness, pre_digest.slot, epoch.epoch_index); + let transcript = make_transcript(&session.randomness, pre_digest.slot, session.session_index); schnorrkel::PublicKey::from_bytes(author.as_slice()) .and_then(|p| { @@ -165,7 +165,7 @@ fn check_primary_header( }; let threshold = - calculate_primary_threshold(c, &epoch.authorities, pre_digest.authority_index as usize); + calculate_primary_threshold(c, &session.authorities, pre_digest.authority_index as usize); if !check_primary_threshold(&inout, threshold) { return Err(babe_err(Error::VRFVerificationOfBlockFailed(author.clone(), threshold))) @@ -185,15 +185,15 @@ fn check_secondary_plain_header( pre_hash: B::Hash, pre_digest: &SecondaryPlainPreDigest, signature: AuthoritySignature, - epoch: &Epoch, + session: &Session, ) -> Result<(), Error> { // check the signature is valid under the expected authority and // chain state. let expected_author = - secondary_slot_author(pre_digest.slot, &epoch.authorities, epoch.randomness) + secondary_slot_author(pre_digest.slot, &session.authorities, session.randomness) .ok_or_else(|| Error::NoSecondaryAuthorExpected)?; - let author = &epoch.authorities[pre_digest.authority_index as usize].0; + let author = &session.authorities[pre_digest.authority_index as usize].0; if expected_author != author { return Err(Error::InvalidAuthor(expected_author.clone(), author.clone())) @@ -211,22 +211,22 @@ fn check_secondary_vrf_header( pre_hash: B::Hash, pre_digest: &SecondaryVRFPreDigest, signature: AuthoritySignature, - epoch: &Epoch, + session: &Session, ) -> Result<(), Error> { // check the signature is valid under the expected authority and // chain state. let expected_author = - secondary_slot_author(pre_digest.slot, &epoch.authorities, epoch.randomness) + secondary_slot_author(pre_digest.slot, &session.authorities, session.randomness) .ok_or_else(|| Error::NoSecondaryAuthorExpected)?; - let author = &epoch.authorities[pre_digest.authority_index as usize].0; + let author = &session.authorities[pre_digest.authority_index as usize].0; if expected_author != author { return Err(Error::InvalidAuthor(expected_author.clone(), author.clone())) } if AuthorityPair::verify(&signature, pre_hash.as_ref(), author) { - let transcript = make_transcript(&epoch.randomness, pre_digest.slot, epoch.epoch_index); + let transcript = make_transcript(&session.randomness, pre_digest.slot, session.session_index); schnorrkel::PublicKey::from_bytes(author.as_slice()) .and_then(|p| p.vrf_verify(transcript, &pre_digest.vrf_output, &pre_digest.vrf_proof)) diff --git a/client/consensus/epochs/Cargo.toml b/client/consensus/epochs/Cargo.toml index 2caf60547cceb..e64458048dc22 100644 --- a/client/consensus/epochs/Cargo.toml +++ b/client/consensus/epochs/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "sc-consensus-epochs" +name = "sc-consensus-sessions" version = "0.10.0-dev" authors = ["Parity Technologies "] -description = "Generic epochs-based utilities for consensus" +description = "Generic sessions-based utilities for consensus" edition = "2021" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" homepage = "https://substrate.io" diff --git a/client/consensus/epochs/README.md b/client/consensus/epochs/README.md index 1e74e04172c24..3455d7f8d9fbc 100644 --- a/client/consensus/epochs/README.md +++ b/client/consensus/epochs/README.md @@ -1,3 +1,3 @@ -Generic utilities for epoch-based consensus engines. +Generic utilities for session-based consensus engines. License: GPL-3.0-or-later WITH Classpath-exception-2.0 \ No newline at end of file diff --git a/client/consensus/epochs/src/lib.rs b/client/consensus/epochs/src/lib.rs index 90081bf9af442..d79ce21e3e54a 100644 --- a/client/consensus/epochs/src/lib.rs +++ b/client/consensus/epochs/src/lib.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! Generic utilities for epoch-based consensus engines. +//! Generic utilities for session-based consensus engines. pub mod migration; @@ -74,150 +74,150 @@ where } } -/// Epoch data, distinguish whether it is genesis or not. +/// Session data, distinguish whether it is genesis or not. /// -/// Once an epoch is created, it must have a known `start_slot` and `end_slot`, which cannot be -/// changed. Consensus engine may modify any other data in the epoch, if needed. -pub trait Epoch: std::fmt::Debug { - /// Descriptor for the next epoch. - type NextEpochDescriptor; +/// Once an session is created, it must have a known `start_slot` and `end_slot`, which cannot be +/// changed. Consensus engine may modify any other data in the session, if needed. +pub trait Session: std::fmt::Debug { + /// Descriptor for the next session. + type NextSessionDescriptor; /// Type of the slot number. type Slot: Ord + Copy + std::fmt::Debug; - /// The starting slot of the epoch. + /// The starting slot of the session. fn start_slot(&self) -> Self::Slot; - /// Produce the "end slot" of the epoch. This is NOT inclusive to the epoch, - /// i.e. the slots covered by the epoch are `self.start_slot() .. self.end_slot()`. + /// Produce the "end slot" of the session. This is NOT inclusive to the session, + /// i.e. the slots covered by the session are `self.start_slot() .. self.end_slot()`. fn end_slot(&self) -> Self::Slot; - /// Increment the epoch data, using the next epoch descriptor. - fn increment(&self, descriptor: Self::NextEpochDescriptor) -> Self; + /// Increment the session data, using the next session descriptor. + fn increment(&self, descriptor: Self::NextSessionDescriptor) -> Self; } -impl<'a, E: Epoch> From<&'a E> for EpochHeader { - fn from(epoch: &'a E) -> EpochHeader { - Self { start_slot: epoch.start_slot(), end_slot: epoch.end_slot() } +impl<'a, E: Session> From<&'a E> for SessionHeader { + fn from(session: &'a E) -> SessionHeader { + Self { start_slot: session.start_slot(), end_slot: session.end_slot() } } } -/// Header of epoch data, consisting of start and end slot. +/// Header of session data, consisting of start and end slot. #[derive(Eq, PartialEq, Encode, Decode, Debug)] -pub struct EpochHeader { - /// The starting slot of the epoch. +pub struct SessionHeader { + /// The starting slot of the session. pub start_slot: E::Slot, - /// The end slot of the epoch. This is NOT inclusive to the epoch, - /// i.e. the slots covered by the epoch are `self.start_slot() .. self.end_slot()`. + /// The end slot of the session. This is NOT inclusive to the session, + /// i.e. the slots covered by the session are `self.start_slot() .. self.end_slot()`. pub end_slot: E::Slot, } -impl Clone for EpochHeader { +impl Clone for SessionHeader { fn clone(&self) -> Self { Self { start_slot: self.start_slot, end_slot: self.end_slot } } } -/// Position of the epoch identifier. +/// Position of the session identifier. #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Debug)] -pub enum EpochIdentifierPosition { - /// The identifier points to a genesis epoch `epoch_0`. +pub enum SessionIdentifierPosition { + /// The identifier points to a genesis session `session_0`. Genesis0, - /// The identifier points to a genesis epoch `epoch_1`. + /// The identifier points to a genesis session `session_1`. Genesis1, - /// The identifier points to a regular epoch. + /// The identifier points to a regular session. Regular, } -/// Epoch identifier. +/// Session identifier. #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug)] -pub struct EpochIdentifier { - /// Location of the epoch. - pub position: EpochIdentifierPosition, - /// Hash of the block when the epoch is signaled. +pub struct SessionIdentifier { + /// Location of the session. + pub position: SessionIdentifierPosition, + /// Hash of the block when the session is signaled. pub hash: Hash, - /// Number of the block when the epoch is signaled. + /// Number of the block when the session is signaled. pub number: Number, } -/// The viable epoch under which a block can be verified. +/// The viable session under which a block can be verified. /// /// If this is the first non-genesis block in the chain, then it will -/// hold an `UnimportedGenesis` epoch. -pub enum ViableEpoch { - /// Unimported genesis viable epoch data. +/// hold an `UnimportedGenesis` session. +pub enum ViableSession { + /// Unimported genesis viable session data. UnimportedGenesis(E), - /// Regular viable epoch data. + /// Regular viable session data. Signaled(ERef), } -impl AsRef for ViableEpoch +impl AsRef for ViableSession where ERef: Borrow, { fn as_ref(&self) -> &E { match *self { - ViableEpoch::UnimportedGenesis(ref e) => e, - ViableEpoch::Signaled(ref e) => e.borrow(), + ViableSession::UnimportedGenesis(ref e) => e, + ViableSession::Signaled(ref e) => e.borrow(), } } } -impl AsMut for ViableEpoch +impl AsMut for ViableSession where ERef: BorrowMut, { fn as_mut(&mut self) -> &mut E { match *self { - ViableEpoch::UnimportedGenesis(ref mut e) => e, - ViableEpoch::Signaled(ref mut e) => e.borrow_mut(), + ViableSession::UnimportedGenesis(ref mut e) => e, + ViableSession::Signaled(ref mut e) => e.borrow_mut(), } } } -impl ViableEpoch +impl ViableSession where - E: Epoch + Clone, + E: Session + Clone, ERef: Borrow, { - /// Extract the underlying epoch, disregarding the fact that a genesis - /// epoch may be unimported. + /// Extract the underlying session, disregarding the fact that a genesis + /// session may be unimported. pub fn into_cloned_inner(self) -> E { match self { - ViableEpoch::UnimportedGenesis(e) => e, - ViableEpoch::Signaled(e) => e.borrow().clone(), + ViableSession::UnimportedGenesis(e) => e, + ViableSession::Signaled(e) => e.borrow().clone(), } } - /// Get cloned value for the viable epoch. - pub fn into_cloned(self) -> ViableEpoch { + /// Get cloned value for the viable session. + pub fn into_cloned(self) -> ViableSession { match self { - ViableEpoch::UnimportedGenesis(e) => ViableEpoch::UnimportedGenesis(e), - ViableEpoch::Signaled(e) => ViableEpoch::Signaled(e.borrow().clone()), + ViableSession::UnimportedGenesis(e) => ViableSession::UnimportedGenesis(e), + ViableSession::Signaled(e) => ViableSession::Signaled(e.borrow().clone()), } } - /// Increment the epoch, yielding an `IncrementedEpoch` to be imported + /// Increment the session, yielding an `IncrementedSession` to be imported /// into the fork-tree. - pub fn increment(&self, next_descriptor: E::NextEpochDescriptor) -> IncrementedEpoch { + pub fn increment(&self, next_descriptor: E::NextSessionDescriptor) -> IncrementedSession { let next = self.as_ref().increment(next_descriptor); let to_persist = match *self { - ViableEpoch::UnimportedGenesis(ref epoch_0) => - PersistedEpoch::Genesis(epoch_0.clone(), next), - ViableEpoch::Signaled(_) => PersistedEpoch::Regular(next), + ViableSession::UnimportedGenesis(ref session_0) => + PersistedSession::Genesis(session_0.clone(), next), + ViableSession::Signaled(_) => PersistedSession::Regular(next), }; - IncrementedEpoch(to_persist) + IncrementedSession(to_persist) } } -/// Descriptor for a viable epoch. +/// Descriptor for a viable session. #[derive(PartialEq, Eq, Clone, Debug)] -pub enum ViableEpochDescriptor { - /// The epoch is an unimported genesis, with given start slot number. +pub enum ViableSessionDescriptor { + /// The session is an unimported genesis, with given start slot number. UnimportedGenesis(E::Slot), - /// The epoch is signaled and has been imported, with given identifier and header. - Signaled(EpochIdentifier, EpochHeader), + /// The session is signaled and has been imported, with given identifier and header. + Signaled(SessionIdentifier, SessionHeader), } -impl ViableEpochDescriptor { +impl ViableSessionDescriptor { /// Start slot of the descriptor. pub fn start_slot(&self) -> E::Slot { match self { @@ -227,222 +227,222 @@ impl ViableEpochDescriptor { } } -/// Persisted epoch stored in EpochChanges. +/// Persisted session stored in SessionChanges. #[derive(Clone, Encode, Decode, Debug)] -pub enum PersistedEpoch { - /// Genesis persisted epoch data. epoch_0, epoch_1. +pub enum PersistedSession { + /// Genesis persisted session data. session_0, session_1. Genesis(E, E), - /// Regular persisted epoch data. epoch_n. + /// Regular persisted session data. session_n. Regular(E), } -impl PersistedEpoch { - /// Returns if this is a genesis epoch. +impl PersistedSession { + /// Returns if this is a genesis session. pub fn is_genesis(&self) -> bool { matches!(self, Self::Genesis(_, _)) } } -impl<'a, E: Epoch> From<&'a PersistedEpoch> for PersistedEpochHeader { - fn from(epoch: &'a PersistedEpoch) -> Self { - match epoch { - PersistedEpoch::Genesis(ref epoch_0, ref epoch_1) => - PersistedEpochHeader::Genesis(epoch_0.into(), epoch_1.into()), - PersistedEpoch::Regular(ref epoch_n) => PersistedEpochHeader::Regular(epoch_n.into()), +impl<'a, E: Session> From<&'a PersistedSession> for PersistedSessionHeader { + fn from(session: &'a PersistedSession) -> Self { + match session { + PersistedSession::Genesis(ref session_0, ref session_1) => + PersistedSessionHeader::Genesis(session_0.into(), session_1.into()), + PersistedSession::Regular(ref session_n) => PersistedSessionHeader::Regular(session_n.into()), } } } -impl PersistedEpoch { - /// Map the epoch to a different type using a conversion function. - pub fn map(self, h: &Hash, n: &Number, f: &mut F) -> PersistedEpoch +impl PersistedSession { + /// Map the session to a different type using a conversion function. + pub fn map(self, h: &Hash, n: &Number, f: &mut F) -> PersistedSession where - B: Epoch, + B: Session, F: FnMut(&Hash, &Number, E) -> B, { match self { - PersistedEpoch::Genesis(epoch_0, epoch_1) => - PersistedEpoch::Genesis(f(h, n, epoch_0), f(h, n, epoch_1)), - PersistedEpoch::Regular(epoch_n) => PersistedEpoch::Regular(f(h, n, epoch_n)), + PersistedSession::Genesis(session_0, session_1) => + PersistedSession::Genesis(f(h, n, session_0), f(h, n, session_1)), + PersistedSession::Regular(session_n) => PersistedSession::Regular(f(h, n, session_n)), } } } -/// Persisted epoch header stored in ForkTree. +/// Persisted session header stored in ForkTree. #[derive(Encode, Decode, PartialEq, Eq, Debug)] -pub enum PersistedEpochHeader { - /// Genesis persisted epoch header. epoch_0, epoch_1. - Genesis(EpochHeader, EpochHeader), - /// Regular persisted epoch header. epoch_n. - Regular(EpochHeader), +pub enum PersistedSessionHeader { + /// Genesis persisted session header. session_0, session_1. + Genesis(SessionHeader, SessionHeader), + /// Regular persisted session header. session_n. + Regular(SessionHeader), } -impl Clone for PersistedEpochHeader { +impl Clone for PersistedSessionHeader { fn clone(&self) -> Self { match self { - Self::Genesis(epoch_0, epoch_1) => Self::Genesis(epoch_0.clone(), epoch_1.clone()), - Self::Regular(epoch_n) => Self::Regular(epoch_n.clone()), + Self::Genesis(session_0, session_1) => Self::Genesis(session_0.clone(), session_1.clone()), + Self::Regular(session_n) => Self::Regular(session_n.clone()), } } } -impl PersistedEpochHeader { - /// Map the epoch header to a different type. - pub fn map(self) -> PersistedEpochHeader +impl PersistedSessionHeader { + /// Map the session header to a different type. + pub fn map(self) -> PersistedSessionHeader where - B: Epoch, + B: Session, { match self { - PersistedEpochHeader::Genesis(epoch_0, epoch_1) => PersistedEpochHeader::Genesis( - EpochHeader { start_slot: epoch_0.start_slot, end_slot: epoch_0.end_slot }, - EpochHeader { start_slot: epoch_1.start_slot, end_slot: epoch_1.end_slot }, + PersistedSessionHeader::Genesis(session_0, session_1) => PersistedSessionHeader::Genesis( + SessionHeader { start_slot: session_0.start_slot, end_slot: session_0.end_slot }, + SessionHeader { start_slot: session_1.start_slot, end_slot: session_1.end_slot }, ), - PersistedEpochHeader::Regular(epoch_n) => PersistedEpochHeader::Regular(EpochHeader { - start_slot: epoch_n.start_slot, - end_slot: epoch_n.end_slot, + PersistedSessionHeader::Regular(session_n) => PersistedSessionHeader::Regular(SessionHeader { + start_slot: session_n.start_slot, + end_slot: session_n.end_slot, }), } } } -/// A fresh, incremented epoch to import into the underlying fork-tree. +/// A fresh, incremented session to import into the underlying fork-tree. /// -/// Create this with `ViableEpoch::increment`. -#[must_use = "Freshly-incremented epoch must be imported with `EpochChanges::import`"] -pub struct IncrementedEpoch(PersistedEpoch); +/// Create this with `ViableSession::increment`. +#[must_use = "Freshly-incremented session must be imported with `SessionChanges::import`"] +pub struct IncrementedSession(PersistedSession); -impl AsRef for IncrementedEpoch { +impl AsRef for IncrementedSession { fn as_ref(&self) -> &E { match self.0 { - PersistedEpoch::Genesis(_, ref epoch_1) => epoch_1, - PersistedEpoch::Regular(ref epoch_n) => epoch_n, + PersistedSession::Genesis(_, ref session_1) => session_1, + PersistedSession::Regular(ref session_n) => session_n, } } } -/// A pair of epochs for the gap block download validation. +/// A pair of sessions for the gap block download validation. /// Block gap is created after the warp sync is complete. Blocks /// are imported both at the tip of the chain and at the start of the gap. -/// This holds a pair of epochs that are required to validate headers +/// This holds a pair of sessions that are required to validate headers /// at the start of the gap. Since gap download does not allow forks we don't -/// need to keep a tree of epochs. +/// need to keep a tree of sessions. #[derive(Clone, Encode, Decode, Debug)] -pub struct GapEpochs { - current: (Hash, Number, PersistedEpoch), +pub struct GapSessions { + current: (Hash, Number, PersistedSession), next: Option<(Hash, Number, E)>, } -impl GapEpochs +impl GapSessions where Hash: Copy + PartialEq + std::fmt::Debug, Number: Copy + PartialEq + std::fmt::Debug, - E: Epoch, + E: Session, { - /// Check if given slot matches one of the gap epochs. - /// Returns epoch identifier if it does. + /// Check if given slot matches one of the gap sessions. + /// Returns session identifier if it does. fn matches( &self, slot: E::Slot, - ) -> Option<(Hash, Number, EpochHeader, EpochIdentifierPosition)> { + ) -> Option<(Hash, Number, SessionHeader, SessionIdentifierPosition)> { match &self.current { - (_, _, PersistedEpoch::Genesis(epoch_0, _)) - if slot >= epoch_0.start_slot() && slot < epoch_0.end_slot() => + (_, _, PersistedSession::Genesis(session_0, _)) + if slot >= session_0.start_slot() && slot < session_0.end_slot() => return Some(( self.current.0, self.current.1, - epoch_0.into(), - EpochIdentifierPosition::Genesis0, + session_0.into(), + SessionIdentifierPosition::Genesis0, )), - (_, _, PersistedEpoch::Genesis(_, epoch_1)) - if slot >= epoch_1.start_slot() && slot < epoch_1.end_slot() => + (_, _, PersistedSession::Genesis(_, session_1)) + if slot >= session_1.start_slot() && slot < session_1.end_slot() => return Some(( self.current.0, self.current.1, - epoch_1.into(), - EpochIdentifierPosition::Genesis1, + session_1.into(), + SessionIdentifierPosition::Genesis1, )), - (_, _, PersistedEpoch::Regular(epoch_n)) - if slot >= epoch_n.start_slot() && slot < epoch_n.end_slot() => + (_, _, PersistedSession::Regular(session_n)) + if slot >= session_n.start_slot() && slot < session_n.end_slot() => return Some(( self.current.0, self.current.1, - epoch_n.into(), - EpochIdentifierPosition::Regular, + session_n.into(), + SessionIdentifierPosition::Regular, )), _ => {}, }; match &self.next { - Some((h, n, epoch_n)) if slot >= epoch_n.start_slot() && slot < epoch_n.end_slot() => - Some((*h, *n, epoch_n.into(), EpochIdentifierPosition::Regular)), + Some((h, n, session_n)) if slot >= session_n.start_slot() && slot < session_n.end_slot() => + Some((*h, *n, session_n.into(), SessionIdentifierPosition::Regular)), _ => None, } } - /// Returns epoch data if it matches given identifier. - pub fn epoch(&self, id: &EpochIdentifier) -> Option<&E> { + /// Returns session data if it matches given identifier. + pub fn session(&self, id: &SessionIdentifier) -> Option<&E> { match (&self.current, &self.next) { ((h, n, e), _) if h == &id.hash && n == &id.number => match e { - PersistedEpoch::Genesis(ref epoch_0, _) - if id.position == EpochIdentifierPosition::Genesis0 => - Some(epoch_0), - PersistedEpoch::Genesis(_, ref epoch_1) - if id.position == EpochIdentifierPosition::Genesis1 => - Some(epoch_1), - PersistedEpoch::Regular(ref epoch_n) - if id.position == EpochIdentifierPosition::Regular => - Some(epoch_n), + PersistedSession::Genesis(ref session_0, _) + if id.position == SessionIdentifierPosition::Genesis0 => + Some(session_0), + PersistedSession::Genesis(_, ref session_1) + if id.position == SessionIdentifierPosition::Genesis1 => + Some(session_1), + PersistedSession::Regular(ref session_n) + if id.position == SessionIdentifierPosition::Regular => + Some(session_n), _ => None, }, (_, Some((h, n, e))) if h == &id.hash && - n == &id.number && id.position == EpochIdentifierPosition::Regular => + n == &id.number && id.position == SessionIdentifierPosition::Regular => Some(e), _ => None, } } - /// Import a new gap epoch, potentially replacing an old epoch. - fn import(&mut self, slot: E::Slot, hash: Hash, number: Number, epoch: E) -> Result<(), E> { + /// Import a new gap session, potentially replacing an old session. + fn import(&mut self, slot: E::Slot, hash: Hash, number: Number, session: E) -> Result<(), E> { match (&mut self.current, &mut self.next) { - ((_, _, PersistedEpoch::Genesis(_, epoch_1)), _) if slot == epoch_1.end_slot() => { - self.next = Some((hash, number, epoch)); + ((_, _, PersistedSession::Genesis(_, session_1)), _) if slot == session_1.end_slot() => { + self.next = Some((hash, number, session)); Ok(()) }, - (_, Some((_, _, epoch_n))) if slot == epoch_n.end_slot() => { - let (cur_h, cur_n, cur_epoch) = + (_, Some((_, _, session_n))) if slot == session_n.end_slot() => { + let (cur_h, cur_n, cur_session) = self.next.take().expect("Already matched as `Some`"); - self.current = (cur_h, cur_n, PersistedEpoch::Regular(cur_epoch)); - self.next = Some((hash, number, epoch)); + self.current = (cur_h, cur_n, PersistedSession::Regular(cur_session)); + self.next = Some((hash, number, session)); Ok(()) }, - _ => Err(epoch), + _ => Err(session), } } } -/// Tree of all epoch changes across all *seen* forks. Data stored in tree is -/// the hash and block number of the block signaling the epoch change, and the -/// epoch that was signalled at that block. +/// Tree of all session changes across all *seen* forks. Data stored in tree is +/// the hash and block number of the block signaling the session change, and the +/// session that was signalled at that block. /// -/// The first epoch, epoch_0, is special cased by saying that it starts at +/// The first session, session_0, is special cased by saying that it starts at /// slot number of the first block in the chain. When bootstrapping a chain, /// there can be multiple competing block #1s, so we have to ensure that the overlayed /// DAG doesn't get confused. /// -/// The first block of every epoch should be producing a descriptor for the next -/// epoch - this is checked in higher-level code. So the first block of epoch_0 contains -/// a descriptor for epoch_1. We special-case these and bundle them together in the +/// The first block of every session should be producing a descriptor for the next +/// session - this is checked in higher-level code. So the first block of session_0 contains +/// a descriptor for session_1. We special-case these and bundle them together in the /// same DAG entry, pinned to a specific block #1. /// -/// Further epochs (epoch_2, ..., epoch_n) each get their own entry. +/// Further sessions (session_2, ..., session_n) each get their own entry. /// -/// Also maintains a pair of epochs for the start of the gap, +/// Also maintains a pair of sessions for the start of the gap, /// as long as there's an active gap download after a warp sync. #[derive(Clone, Encode, Decode, Debug)] -pub struct EpochChanges { - inner: ForkTree>, - epochs: BTreeMap<(Hash, Number), PersistedEpoch>, - gap: Option>, +pub struct SessionChanges { + inner: ForkTree>, + sessions: BTreeMap<(Hash, Number), PersistedSession>, + gap: Option>, } // create a fake header hash which hasn't been included in the chain. @@ -454,58 +454,58 @@ fn fake_head_hash + AsMut<[u8]> + Clone>(parent_hash: &H) -> H { h } -impl Default for EpochChanges +impl Default for SessionChanges where Hash: PartialEq + Ord, Number: Ord, { fn default() -> Self { - EpochChanges { inner: ForkTree::new(), epochs: BTreeMap::new(), gap: None } + SessionChanges { inner: ForkTree::new(), sessions: BTreeMap::new(), gap: None } } } -impl EpochChanges +impl SessionChanges where Hash: PartialEq + Ord + AsRef<[u8]> + AsMut<[u8]> + Copy + std::fmt::Debug, Number: Ord + One + Zero + Add + Sub + Copy + std::fmt::Debug, { - /// Create a new epoch change. + /// Create a new session change. pub fn new() -> Self { Self::default() } - /// Rebalances the tree of epoch changes so that it is sorted by length of + /// Rebalances the tree of session changes so that it is sorted by length of /// fork (longest fork first). pub fn rebalance(&mut self) { self.inner.rebalance() } - /// Clear gap epochs if any. + /// Clear gap sessions if any. pub fn clear_gap(&mut self) { self.gap = None; } - /// Map the epoch changes from one storing data to a different one. - pub fn map(self, mut f: F) -> EpochChanges + /// Map the session changes from one storing data to a different one. + pub fn map(self, mut f: F) -> SessionChanges where - B: Epoch, + B: Session, F: FnMut(&Hash, &Number, E) -> B, { - EpochChanges { - inner: self.inner.map(&mut |_, _, header: PersistedEpochHeader| header.map()), - gap: self.gap.map(|GapEpochs { current: (h, n, header), next }| GapEpochs { + SessionChanges { + inner: self.inner.map(&mut |_, _, header: PersistedSessionHeader| header.map()), + gap: self.gap.map(|GapSessions { current: (h, n, header), next }| GapSessions { current: (h, n, header.map(&h, &n, &mut f)), next: next.map(|(h, n, e)| (h, n, f(&h, &n, e))), }), - epochs: self - .epochs + sessions: self + .sessions .into_iter() - .map(|((hash, number), epoch)| ((hash, number), epoch.map(&hash, &number, &mut f))) + .map(|((hash, number), session)| ((hash, number), session.map(&hash, &number, &mut f))) .collect(), } } - /// Prune out finalized epochs, except for the ancestor of the finalized + /// Prune out finalized sessions, except for the ancestor of the finalized /// block. The given slot should be the slot number at which the finalized /// block was authored. pub fn prune_finalized>( @@ -517,99 +517,99 @@ where ) -> Result<(), fork_tree::Error> { let is_descendent_of = descendent_of_builder.build_is_descendent_of(None); - let predicate = |epoch: &PersistedEpochHeader| match *epoch { - PersistedEpochHeader::Genesis(_, ref epoch_1) => slot >= epoch_1.end_slot, - PersistedEpochHeader::Regular(ref epoch_n) => slot >= epoch_n.end_slot, + let predicate = |session: &PersistedSessionHeader| match *session { + PersistedSessionHeader::Genesis(_, ref session_1) => slot >= session_1.end_slot, + PersistedSessionHeader::Regular(ref session_n) => slot >= session_n.end_slot, }; - // prune any epochs which could not be _live_ as of the children of the + // prune any sessions which could not be _live_ as of the children of the // finalized block, i.e. re-root the fork tree to the oldest ancestor of - // (hash, number) where epoch.end_slot() >= finalized_slot + // (hash, number) where session.end_slot() >= finalized_slot let removed = self.inner.prune(hash, &number, &is_descendent_of, &predicate)?; for (hash, number, _) in removed { - self.epochs.remove(&(hash, number)); + self.sessions.remove(&(hash, number)); } Ok(()) } - /// Get a reference to an epoch with given identifier. - pub fn epoch(&self, id: &EpochIdentifier) -> Option<&E> { - if let Some(e) = &self.gap.as_ref().and_then(|gap| gap.epoch(id)) { + /// Get a reference to an session with given identifier. + pub fn session(&self, id: &SessionIdentifier) -> Option<&E> { + if let Some(e) = &self.gap.as_ref().and_then(|gap| gap.session(id)) { return Some(e) } - self.epochs.get(&(id.hash, id.number)).and_then(|v| match v { - PersistedEpoch::Genesis(ref epoch_0, _) - if id.position == EpochIdentifierPosition::Genesis0 => - Some(epoch_0), - PersistedEpoch::Genesis(_, ref epoch_1) - if id.position == EpochIdentifierPosition::Genesis1 => - Some(epoch_1), - PersistedEpoch::Regular(ref epoch_n) - if id.position == EpochIdentifierPosition::Regular => - Some(epoch_n), + self.sessions.get(&(id.hash, id.number)).and_then(|v| match v { + PersistedSession::Genesis(ref session_0, _) + if id.position == SessionIdentifierPosition::Genesis0 => + Some(session_0), + PersistedSession::Genesis(_, ref session_1) + if id.position == SessionIdentifierPosition::Genesis1 => + Some(session_1), + PersistedSession::Regular(ref session_n) + if id.position == SessionIdentifierPosition::Regular => + Some(session_n), _ => None, }) } - /// Get a reference to a viable epoch with given descriptor. - pub fn viable_epoch( + /// Get a reference to a viable session with given descriptor. + pub fn viable_session( &self, - descriptor: &ViableEpochDescriptor, + descriptor: &ViableSessionDescriptor, make_genesis: G, - ) -> Option> + ) -> Option> where G: FnOnce(E::Slot) -> E, { match descriptor { - ViableEpochDescriptor::UnimportedGenesis(slot) => - Some(ViableEpoch::UnimportedGenesis(make_genesis(*slot))), - ViableEpochDescriptor::Signaled(identifier, _) => - self.epoch(&identifier).map(ViableEpoch::Signaled), + ViableSessionDescriptor::UnimportedGenesis(slot) => + Some(ViableSession::UnimportedGenesis(make_genesis(*slot))), + ViableSessionDescriptor::Signaled(identifier, _) => + self.session(&identifier).map(ViableSession::Signaled), } } - /// Get a mutable reference to an epoch with given identifier. - pub fn epoch_mut(&mut self, id: &EpochIdentifier) -> Option<&mut E> { - self.epochs.get_mut(&(id.hash, id.number)).and_then(|v| match v { - PersistedEpoch::Genesis(ref mut epoch_0, _) - if id.position == EpochIdentifierPosition::Genesis0 => - Some(epoch_0), - PersistedEpoch::Genesis(_, ref mut epoch_1) - if id.position == EpochIdentifierPosition::Genesis1 => - Some(epoch_1), - PersistedEpoch::Regular(ref mut epoch_n) - if id.position == EpochIdentifierPosition::Regular => - Some(epoch_n), + /// Get a mutable reference to an session with given identifier. + pub fn session_mut(&mut self, id: &SessionIdentifier) -> Option<&mut E> { + self.sessions.get_mut(&(id.hash, id.number)).and_then(|v| match v { + PersistedSession::Genesis(ref mut session_0, _) + if id.position == SessionIdentifierPosition::Genesis0 => + Some(session_0), + PersistedSession::Genesis(_, ref mut session_1) + if id.position == SessionIdentifierPosition::Genesis1 => + Some(session_1), + PersistedSession::Regular(ref mut session_n) + if id.position == SessionIdentifierPosition::Regular => + Some(session_n), _ => None, }) } - /// Get a mutable reference to a viable epoch with given descriptor. - pub fn viable_epoch_mut( + /// Get a mutable reference to a viable session with given descriptor. + pub fn viable_session_mut( &mut self, - descriptor: &ViableEpochDescriptor, + descriptor: &ViableSessionDescriptor, make_genesis: G, - ) -> Option> + ) -> Option> where G: FnOnce(E::Slot) -> E, { match descriptor { - ViableEpochDescriptor::UnimportedGenesis(slot) => - Some(ViableEpoch::UnimportedGenesis(make_genesis(*slot))), - ViableEpochDescriptor::Signaled(identifier, _) => - self.epoch_mut(&identifier).map(ViableEpoch::Signaled), + ViableSessionDescriptor::UnimportedGenesis(slot) => + Some(ViableSession::UnimportedGenesis(make_genesis(*slot))), + ViableSessionDescriptor::Signaled(identifier, _) => + self.session_mut(&identifier).map(ViableSession::Signaled), } } - /// Get the epoch data from an epoch descriptor. + /// Get the session data from an session descriptor. /// - /// Note that this function ignores the fact that an genesis epoch might need to be imported. + /// Note that this function ignores the fact that an genesis session might need to be imported. /// Mostly useful for testing. - pub fn epoch_data( + pub fn session_data( &self, - descriptor: &ViableEpochDescriptor, + descriptor: &ViableSessionDescriptor, make_genesis: G, ) -> Option where @@ -617,17 +617,17 @@ where E: Clone, { match descriptor { - ViableEpochDescriptor::UnimportedGenesis(slot) => Some(make_genesis(*slot)), - ViableEpochDescriptor::Signaled(identifier, _) => self.epoch(&identifier).cloned(), + ViableSessionDescriptor::UnimportedGenesis(slot) => Some(make_genesis(*slot)), + ViableSessionDescriptor::Signaled(identifier, _) => self.session(&identifier).cloned(), } } - /// Finds the epoch data for a child of the given block. Similar to - /// `epoch_descriptor_for_child_of` but returns the full data. + /// Finds the session data for a child of the given block. Similar to + /// `session_descriptor_for_child_of` but returns the full data. /// - /// Note that this function ignores the fact that an genesis epoch might need to be imported. + /// Note that this function ignores the fact that an genesis session might need to be imported. /// Mostly useful for testing. - pub fn epoch_data_for_child_of, G>( + pub fn session_data_for_child_of, G>( &self, descendent_of_builder: D, parent_hash: &Hash, @@ -639,43 +639,43 @@ where G: FnOnce(E::Slot) -> E, E: Clone, { - let descriptor = self.epoch_descriptor_for_child_of( + let descriptor = self.session_descriptor_for_child_of( descendent_of_builder, parent_hash, parent_number, slot, )?; - Ok(descriptor.and_then(|des| self.epoch_data(&des, make_genesis))) + Ok(descriptor.and_then(|des| self.session_data(&des, make_genesis))) } - /// Finds the epoch for a child of the given block, assuming the given slot number. + /// Finds the session for a child of the given block, assuming the given slot number. /// - /// If the returned epoch is an `UnimportedGenesis` epoch, it should be imported into the + /// If the returned session is an `UnimportedGenesis` session, it should be imported into the /// tree. - pub fn epoch_descriptor_for_child_of>( + pub fn session_descriptor_for_child_of>( &self, descendent_of_builder: D, parent_hash: &Hash, parent_number: Number, slot: E::Slot, - ) -> Result>, fork_tree::Error> { + ) -> Result>, fork_tree::Error> { if parent_number == Zero::zero() { - // need to insert the genesis epoch. - return Ok(Some(ViableEpochDescriptor::UnimportedGenesis(slot))) + // need to insert the genesis session. + return Ok(Some(ViableSessionDescriptor::UnimportedGenesis(slot))) } if let Some(gap) = &self.gap { if let Some((hash, number, hdr, position)) = gap.matches(slot) { - return Ok(Some(ViableEpochDescriptor::Signaled( - EpochIdentifier { position, hash, number }, + return Ok(Some(ViableSessionDescriptor::Signaled( + SessionIdentifier { position, hash, number }, hdr, ))) } } // find_node_where will give you the node in the fork-tree which is an ancestor - // of the `parent_hash` by default. if the last epoch was signalled at the parent_hash, + // of the `parent_hash` by default. if the last session was signalled at the parent_hash, // then it won't be returned. we need to create a new fake chain head hash which // "descends" from our parent-hash. let fake_head_hash = fake_head_hash(parent_hash); @@ -684,13 +684,13 @@ where descendent_of_builder.build_is_descendent_of(Some((fake_head_hash, *parent_hash))); // We want to find the deepest node in the tree which is an ancestor - // of our block and where the start slot of the epoch was before the + // of our block and where the start slot of the session was before the // slot of our block. The genesis special-case doesn't need to look - // at epoch_1 -- all we're doing here is figuring out which node + // at session_1 -- all we're doing here is figuring out which node // we need. - let predicate = |epoch: &PersistedEpochHeader| match *epoch { - PersistedEpochHeader::Genesis(ref epoch_0, _) => epoch_0.start_slot <= slot, - PersistedEpochHeader::Regular(ref epoch_n) => epoch_n.start_slot <= slot, + let predicate = |session: &PersistedSessionHeader| match *session { + PersistedSessionHeader::Genesis(ref session_0, _) => session_0.start_slot <= slot, + PersistedSessionHeader::Regular(ref session_n) => session_n.start_slot <= slot, }; self.inner @@ -705,31 +705,31 @@ where ( match node.data { // Ok, we found our node. - // and here we figure out which of the internal epochs + // and here we figure out which of the internal sessions // of a genesis node to use based on their start slot. - PersistedEpochHeader::Genesis(ref epoch_0, ref epoch_1) => { - if epoch_1.start_slot <= slot { - (EpochIdentifierPosition::Genesis1, epoch_1.clone()) + PersistedSessionHeader::Genesis(ref session_0, ref session_1) => { + if session_1.start_slot <= slot { + (SessionIdentifierPosition::Genesis1, session_1.clone()) } else { - (EpochIdentifierPosition::Genesis0, epoch_0.clone()) + (SessionIdentifierPosition::Genesis0, session_0.clone()) } }, - PersistedEpochHeader::Regular(ref epoch_n) => - (EpochIdentifierPosition::Regular, epoch_n.clone()), + PersistedSessionHeader::Regular(ref session_n) => + (SessionIdentifierPosition::Regular, session_n.clone()), }, node, ) }) .map(|((position, header), node)| { - ViableEpochDescriptor::Signaled( - EpochIdentifier { position, hash: node.hash, number: node.number }, + ViableSessionDescriptor::Signaled( + SessionIdentifier { position, hash: node.hash, number: node.number }, header, ) }) }) } - /// Import a new epoch-change, signalled at the given block. + /// Import a new session-change, signalled at the given block. /// /// This assumes that the given block is prospective (i.e. has not been /// imported yet), but its parent has. This is why the parent hash needs @@ -740,26 +740,26 @@ where hash: Hash, number: Number, parent_hash: Hash, - epoch: IncrementedEpoch, + session: IncrementedSession, ) -> Result<(), fork_tree::Error> { let is_descendent_of = descendent_of_builder.build_is_descendent_of(Some((hash, parent_hash))); - let slot = epoch.as_ref().start_slot(); - let IncrementedEpoch(mut epoch) = epoch; - let header = PersistedEpochHeader::::from(&epoch); + let slot = session.as_ref().start_slot(); + let IncrementedSession(mut session) = session; + let header = PersistedSessionHeader::::from(&session); if let Some(gap) = &mut self.gap { - if let PersistedEpoch::Regular(e) = epoch { - epoch = match gap.import(slot, hash.clone(), number.clone(), e) { + if let PersistedSession::Regular(e) = session { + session = match gap.import(slot, hash.clone(), number.clone(), e) { Ok(()) => return Ok(()), - Err(e) => PersistedEpoch::Regular(e), + Err(e) => PersistedSession::Regular(e), } } - } else if epoch.is_genesis() && !self.epochs.values().all(|e| e.is_genesis()) { - // There's a genesis epoch imported when we already have an active epoch. + } else if session.is_genesis() && !self.sessions.values().all(|e| e.is_genesis()) { + // There's a genesis session imported when we already have an active session. // This happens after the warp sync as the ancient blocks download start. - // We need to start tracking gap epochs here. - self.gap = Some(GapEpochs { current: (hash, number, epoch), next: None }); + // We need to start tracking gap sessions here. + self.gap = Some(GapSessions { current: (hash, number, session), next: None }); return Ok(()) } @@ -767,7 +767,7 @@ where match res { Ok(_) | Err(fork_tree::Error::Duplicate) => { - self.epochs.insert((hash, number), epoch); + self.sessions.insert((hash, number), session); Ok(()) }, Err(e) => Err(e), @@ -775,32 +775,32 @@ where } /// Return the inner fork tree. - pub fn tree(&self) -> &ForkTree> { + pub fn tree(&self) -> &ForkTree> { &self.inner } - /// Reset to a specified pair of epochs, as if they were announced at blocks `parent_hash` and + /// Reset to a specified pair of sessions, as if they were announced at blocks `parent_hash` and /// `hash`. pub fn reset(&mut self, parent_hash: Hash, hash: Hash, number: Number, current: E, next: E) { self.inner = ForkTree::new(); - self.epochs.clear(); - let persisted = PersistedEpoch::Regular(current); - let header = PersistedEpochHeader::from(&persisted); + self.sessions.clear(); + let persisted = PersistedSession::Regular(current); + let header = PersistedSessionHeader::from(&persisted); let _res = self.inner.import(parent_hash, number - One::one(), header, &|_, _| { Ok(false) as Result> }); - self.epochs.insert((parent_hash, number - One::one()), persisted); + self.sessions.insert((parent_hash, number - One::one()), persisted); - let persisted = PersistedEpoch::Regular(next); - let header = PersistedEpochHeader::from(&persisted); + let persisted = PersistedSession::Regular(next); + let header = PersistedSessionHeader::from(&persisted); let _res = self.inner.import(hash, number, header, &|_, _| { Ok(true) as Result> }); - self.epochs.insert((hash, number), persisted); + self.sessions.insert((hash, number), persisted); } /// Revert to a specified block given its `hash` and `number`. - /// This removes all the epoch changes information that were announced by + /// This removes all the session changes information that were announced by /// all the given block descendents. pub fn revert>( &mut self, @@ -810,7 +810,7 @@ where ) { let is_descendent_of = descendent_of_builder.build_is_descendent_of(None); - let filter = |node_hash: &Hash, node_num: &Number, _: &PersistedEpochHeader| { + let filter = |node_hash: &Hash, node_num: &Number, _: &PersistedSessionHeader| { if number >= *node_num && (is_descendent_of(node_hash, &hash).unwrap_or_default() || *node_hash == hash) { @@ -826,22 +826,22 @@ where }; self.inner.drain_filter(filter).for_each(|(h, n, _)| { - self.epochs.remove(&(h, n)); + self.sessions.remove(&(h, n)); }); } } -/// Type alias to produce the epoch-changes tree from a block type. -pub type EpochChangesFor = - EpochChanges<::Hash, NumberFor, Epoch>; +/// Type alias to produce the session-changes tree from a block type. +pub type SessionChangesFor = + SessionChanges<::Hash, NumberFor, Session>; -/// A shared epoch changes tree. -pub type SharedEpochChanges = - sc_consensus::shared_data::SharedData>; +/// A shared session changes tree. +pub type SharedSessionChanges = + sc_consensus::shared_data::SharedData>; #[cfg(test)] mod tests { - use super::{Epoch as EpochT, *}; + use super::{Session as SessionT, *}; #[derive(Debug, PartialEq)] pub struct TestError; @@ -885,17 +885,17 @@ mod tests { type Slot = u64; #[derive(Debug, Clone, Eq, PartialEq)] - struct Epoch { + struct Session { start_slot: Slot, duration: Slot, } - impl EpochT for Epoch { - type NextEpochDescriptor = (); + impl SessionT for Session { + type NextSessionDescriptor = (); type Slot = Slot; fn increment(&self, _: ()) -> Self { - Epoch { start_slot: self.start_slot + self.duration, duration: self.duration } + Session { start_slot: self.start_slot + self.duration, duration: self.duration } } fn end_slot(&self) -> Slot { @@ -908,7 +908,7 @@ mod tests { } #[test] - fn genesis_epoch_is_created_but_not_imported() { + fn genesis_session_is_created_but_not_imported() { // // A - B // \ @@ -923,26 +923,26 @@ mod tests { } }; - let epoch_changes = EpochChanges::<_, _, Epoch>::new(); - let genesis_epoch = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 10101) + let session_changes = SessionChanges::<_, _, Session>::new(); + let genesis_session = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 10101) .unwrap() .unwrap(); - match genesis_epoch { - ViableEpochDescriptor::UnimportedGenesis(slot) => { + match genesis_session { + ViableSessionDescriptor::UnimportedGenesis(slot) => { assert_eq!(slot, 10101u64); }, _ => panic!("should be unimported genesis"), }; - let genesis_epoch_2 = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 10102) + let genesis_session_2 = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 10102) .unwrap() .unwrap(); - match genesis_epoch_2 { - ViableEpochDescriptor::UnimportedGenesis(slot) => { + match genesis_session_2 { + ViableSessionDescriptor::UnimportedGenesis(slot) => { assert_eq!(slot, 10102u64); }, _ => panic!("should be unimported genesis"), @@ -950,7 +950,7 @@ mod tests { } #[test] - fn epoch_changes_between_blocks() { + fn session_changes_between_blocks() { // // A - B // \ @@ -965,66 +965,66 @@ mod tests { } }; - let make_genesis = |slot| Epoch { start_slot: slot, duration: 100 }; + let make_genesis = |slot| Session { start_slot: slot, duration: 100 }; - let mut epoch_changes = EpochChanges::<_, _, Epoch>::new(); - let genesis_epoch = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) + let mut session_changes = SessionChanges::<_, _, Session>::new(); + let genesis_session = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) .unwrap() .unwrap(); - assert_eq!(genesis_epoch, ViableEpochDescriptor::UnimportedGenesis(100)); + assert_eq!(genesis_session, ViableSessionDescriptor::UnimportedGenesis(100)); - let import_epoch_1 = - epoch_changes.viable_epoch(&genesis_epoch, &make_genesis).unwrap().increment(()); - let epoch_1 = import_epoch_1.as_ref().clone(); + let import_session_1 = + session_changes.viable_session(&genesis_session, &make_genesis).unwrap().increment(()); + let session_1 = import_session_1.as_ref().clone(); - epoch_changes - .import(&is_descendent_of, *b"A", 1, *b"0", import_epoch_1) + session_changes + .import(&is_descendent_of, *b"A", 1, *b"0", import_session_1) .unwrap(); - let genesis_epoch = epoch_changes.epoch_data(&genesis_epoch, &make_genesis).unwrap(); + let genesis_session = session_changes.session_data(&genesis_session, &make_genesis).unwrap(); assert!(is_descendent_of(b"0", b"A").unwrap()); - let end_slot = genesis_epoch.end_slot(); - assert_eq!(end_slot, epoch_1.start_slot); + let end_slot = genesis_session.end_slot(); + assert_eq!(end_slot, session_1.start_slot); { - // x is still within the genesis epoch. - let x = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"A", 1, end_slot - 1, &make_genesis) + // x is still within the genesis session. + let x = session_changes + .session_data_for_child_of(&is_descendent_of, b"A", 1, end_slot - 1, &make_genesis) .unwrap() .unwrap(); - assert_eq!(x, genesis_epoch); + assert_eq!(x, genesis_session); } { - // x is now at the next epoch, because the block is now at the - // start slot of epoch 1. - let x = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"A", 1, end_slot, &make_genesis) + // x is now at the next session, because the block is now at the + // start slot of session 1. + let x = session_changes + .session_data_for_child_of(&is_descendent_of, b"A", 1, end_slot, &make_genesis) .unwrap() .unwrap(); - assert_eq!(x, epoch_1); + assert_eq!(x, session_1); } { - // x is now at the next epoch, because the block is now after - // start slot of epoch 1. - let x = epoch_changes - .epoch_data_for_child_of( + // x is now at the next session, because the block is now after + // start slot of session 1. + let x = session_changes + .session_data_for_child_of( &is_descendent_of, b"A", 1, - epoch_1.end_slot() - 1, + session_1.end_slot() - 1, &make_genesis, ) .unwrap() .unwrap(); - assert_eq!(x, epoch_1); + assert_eq!(x, session_1); } } @@ -1045,75 +1045,75 @@ mod tests { let duration = 100; - let make_genesis = |slot| Epoch { start_slot: slot, duration }; + let make_genesis = |slot| Session { start_slot: slot, duration }; - let mut epoch_changes = EpochChanges::new(); + let mut session_changes = SessionChanges::new(); let next_descriptor = (); - // insert genesis epoch for A + // insert genesis session for A { - let genesis_epoch_a_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) + let genesis_session_a_descriptor = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) .unwrap() .unwrap(); - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_a_descriptor, &make_genesis) + let incremented_session = session_changes + .viable_session(&genesis_session_a_descriptor, &make_genesis) .unwrap() .increment(next_descriptor.clone()); - epoch_changes - .import(&is_descendent_of, *b"A", 1, *b"0", incremented_epoch) + session_changes + .import(&is_descendent_of, *b"A", 1, *b"0", incremented_session) .unwrap(); } - // insert genesis epoch for X + // insert genesis session for X { - let genesis_epoch_x_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 1000) + let genesis_session_x_descriptor = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 1000) .unwrap() .unwrap(); - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_x_descriptor, &make_genesis) + let incremented_session = session_changes + .viable_session(&genesis_session_x_descriptor, &make_genesis) .unwrap() .increment(next_descriptor.clone()); - epoch_changes - .import(&is_descendent_of, *b"X", 1, *b"0", incremented_epoch) + session_changes + .import(&is_descendent_of, *b"X", 1, *b"0", incremented_session) .unwrap(); } - // now check that the genesis epochs for our respective block 1s + // now check that the genesis sessions for our respective block 1s // respect the chain structure. { - let epoch_for_a_child = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"A", 1, 101, &make_genesis) + let session_for_a_child = session_changes + .session_data_for_child_of(&is_descendent_of, b"A", 1, 101, &make_genesis) .unwrap() .unwrap(); - assert_eq!(epoch_for_a_child, make_genesis(100)); + assert_eq!(session_for_a_child, make_genesis(100)); - let epoch_for_x_child = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"X", 1, 1001, &make_genesis) + let session_for_x_child = session_changes + .session_data_for_child_of(&is_descendent_of, b"X", 1, 1001, &make_genesis) .unwrap() .unwrap(); - assert_eq!(epoch_for_x_child, make_genesis(1000)); + assert_eq!(session_for_x_child, make_genesis(1000)); - let epoch_for_x_child_before_genesis = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"X", 1, 101, &make_genesis) + let session_for_x_child_before_genesis = session_changes + .session_data_for_child_of(&is_descendent_of, b"X", 1, 101, &make_genesis) .unwrap(); - // even though there is a genesis epoch at that slot, it's not in + // even though there is a genesis session at that slot, it's not in // this chain. - assert!(epoch_for_x_child_before_genesis.is_none()); + assert!(session_for_x_child_before_genesis.is_none()); } } /// Test that ensures that the gap is not enabled when we import multiple genesis blocks. #[test] - fn gap_is_not_enabled_when_multiple_genesis_epochs_are_imported() { + fn gap_is_not_enabled_when_multiple_genesis_sessions_are_imported() { // X // / // 0 - A @@ -1127,62 +1127,62 @@ mod tests { let duration = 100; - let make_genesis = |slot| Epoch { start_slot: slot, duration }; + let make_genesis = |slot| Session { start_slot: slot, duration }; - let mut epoch_changes = EpochChanges::new(); + let mut session_changes = SessionChanges::new(); let next_descriptor = (); - // insert genesis epoch for A + // insert genesis session for A { - let genesis_epoch_a_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) + let genesis_session_a_descriptor = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) .unwrap() .unwrap(); - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_a_descriptor, &make_genesis) + let incremented_session = session_changes + .viable_session(&genesis_session_a_descriptor, &make_genesis) .unwrap() .increment(next_descriptor.clone()); - epoch_changes - .import(&is_descendent_of, *b"A", 1, *b"0", incremented_epoch) + session_changes + .import(&is_descendent_of, *b"A", 1, *b"0", incremented_session) .unwrap(); } - // insert genesis epoch for X + // insert genesis session for X { - let genesis_epoch_x_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 1000) + let genesis_session_x_descriptor = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 1000) .unwrap() .unwrap(); - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_x_descriptor, &make_genesis) + let incremented_session = session_changes + .viable_session(&genesis_session_x_descriptor, &make_genesis) .unwrap() .increment(next_descriptor.clone()); - epoch_changes - .import(&is_descendent_of, *b"X", 1, *b"0", incremented_epoch) + session_changes + .import(&is_descendent_of, *b"X", 1, *b"0", incremented_session) .unwrap(); } // Clearing the gap should be a no-op. - epoch_changes.clear_gap(); + session_changes.clear_gap(); - // Check that both epochs are available. - epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"A", 1, 101, &make_genesis) + // Check that both sessions are available. + session_changes + .session_data_for_child_of(&is_descendent_of, b"A", 1, 101, &make_genesis) .unwrap() .unwrap(); - epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"X", 1, 1001, &make_genesis) + session_changes + .session_data_for_child_of(&is_descendent_of, b"X", 1, 1001, &make_genesis) .unwrap() .unwrap(); } #[test] - fn gap_epochs_advance() { + fn gap_sessions_advance() { // 0 - 1 - 2 - 3 - .... 42 - 43 let is_descendent_of = |base: &Hash, block: &Hash| -> Result { match (base, *block) { @@ -1196,96 +1196,96 @@ mod tests { let duration = 100; - let make_genesis = |slot| Epoch { start_slot: slot, duration }; + let make_genesis = |slot| Session { start_slot: slot, duration }; - let mut epoch_changes = EpochChanges::new(); + let mut session_changes = SessionChanges::new(); let next_descriptor = (); - let epoch42 = Epoch { start_slot: 42, duration: 100 }; - let epoch43 = Epoch { start_slot: 43, duration: 100 }; - epoch_changes.reset(*b"0", *b"1", 4200, epoch42, epoch43); - assert!(epoch_changes.gap.is_none()); + let session42 = Session { start_slot: 42, duration: 100 }; + let session43 = Session { start_slot: 43, duration: 100 }; + session_changes.reset(*b"0", *b"1", 4200, session42, session43); + assert!(session_changes.gap.is_none()); - // Import a new genesis epoch, this should crate the gap. - let genesis_epoch_a_descriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) + // Import a new genesis session, this should crate the gap. + let genesis_session_a_descriptor = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) .unwrap() .unwrap(); - let incremented_epoch = epoch_changes - .viable_epoch(&genesis_epoch_a_descriptor, &make_genesis) + let incremented_session = session_changes + .viable_session(&genesis_session_a_descriptor, &make_genesis) .unwrap() .increment(next_descriptor.clone()); - epoch_changes - .import(&is_descendent_of, *b"1", 1, *b"0", incremented_epoch) + session_changes + .import(&is_descendent_of, *b"1", 1, *b"0", incremented_session) .unwrap(); - assert!(epoch_changes.gap.is_some()); + assert!(session_changes.gap.is_some()); - let genesis_epoch = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) + let genesis_session = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"0", 0, 100) .unwrap() .unwrap(); - assert_eq!(genesis_epoch, ViableEpochDescriptor::UnimportedGenesis(100)); + assert_eq!(genesis_session, ViableSessionDescriptor::UnimportedGenesis(100)); - // Import more epochs and check that gap advances. - let import_epoch_1 = - epoch_changes.viable_epoch(&genesis_epoch, &make_genesis).unwrap().increment(()); + // Import more sessions and check that gap advances. + let import_session_1 = + session_changes.viable_session(&genesis_session, &make_genesis).unwrap().increment(()); - let epoch_1 = import_epoch_1.as_ref().clone(); - epoch_changes - .import(&is_descendent_of, *b"1", 1, *b"0", import_epoch_1) + let session_1 = import_session_1.as_ref().clone(); + session_changes + .import(&is_descendent_of, *b"1", 1, *b"0", import_session_1) .unwrap(); - let genesis_epoch_data = epoch_changes.epoch_data(&genesis_epoch, &make_genesis).unwrap(); - let end_slot = genesis_epoch_data.end_slot(); - let x = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"1", 1, end_slot, &make_genesis) + let genesis_session_data = session_changes.session_data(&genesis_session, &make_genesis).unwrap(); + let end_slot = genesis_session_data.end_slot(); + let x = session_changes + .session_data_for_child_of(&is_descendent_of, b"1", 1, end_slot, &make_genesis) .unwrap() .unwrap(); - assert_eq!(x, epoch_1); - assert_eq!(epoch_changes.gap.as_ref().unwrap().current.0, *b"1"); - assert!(epoch_changes.gap.as_ref().unwrap().next.is_none()); + assert_eq!(x, session_1); + assert_eq!(session_changes.gap.as_ref().unwrap().current.0, *b"1"); + assert!(session_changes.gap.as_ref().unwrap().next.is_none()); - let epoch_1_desriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"1", 1, end_slot) + let session_1_desriptor = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"1", 1, end_slot) .unwrap() .unwrap(); - let epoch_1 = epoch_changes.epoch_data(&epoch_1_desriptor, &make_genesis).unwrap(); - let import_epoch_2 = epoch_changes - .viable_epoch(&epoch_1_desriptor, &make_genesis) + let session_1 = session_changes.session_data(&session_1_desriptor, &make_genesis).unwrap(); + let import_session_2 = session_changes + .viable_session(&session_1_desriptor, &make_genesis) .unwrap() .increment(()); - let epoch_2 = import_epoch_2.as_ref().clone(); - epoch_changes - .import(&is_descendent_of, *b"2", 2, *b"1", import_epoch_2) + let session_2 = import_session_2.as_ref().clone(); + session_changes + .import(&is_descendent_of, *b"2", 2, *b"1", import_session_2) .unwrap(); - let end_slot = epoch_1.end_slot(); - let x = epoch_changes - .epoch_data_for_child_of(&is_descendent_of, b"2", 2, end_slot, &make_genesis) + let end_slot = session_1.end_slot(); + let x = session_changes + .session_data_for_child_of(&is_descendent_of, b"2", 2, end_slot, &make_genesis) .unwrap() .unwrap(); - assert_eq!(epoch_changes.gap.as_ref().unwrap().current.0, *b"1"); - assert_eq!(epoch_changes.gap.as_ref().unwrap().next.as_ref().unwrap().0, *b"2"); - assert_eq!(x, epoch_2); + assert_eq!(session_changes.gap.as_ref().unwrap().current.0, *b"1"); + assert_eq!(session_changes.gap.as_ref().unwrap().next.as_ref().unwrap().0, *b"2"); + assert_eq!(x, session_2); - let epoch_2_desriptor = epoch_changes - .epoch_descriptor_for_child_of(&is_descendent_of, b"2", 2, end_slot) + let session_2_desriptor = session_changes + .session_descriptor_for_child_of(&is_descendent_of, b"2", 2, end_slot) .unwrap() .unwrap(); - let import_epoch_3 = epoch_changes - .viable_epoch(&epoch_2_desriptor, &make_genesis) + let import_session_3 = session_changes + .viable_session(&session_2_desriptor, &make_genesis) .unwrap() .increment(()); - epoch_changes - .import(&is_descendent_of, *b"3", 3, *b"2", import_epoch_3) + session_changes + .import(&is_descendent_of, *b"3", 3, *b"2", import_session_3) .unwrap(); - assert_eq!(epoch_changes.gap.as_ref().unwrap().current.0, *b"2"); + assert_eq!(session_changes.gap.as_ref().unwrap().current.0, *b"2"); - epoch_changes.clear_gap(); - assert!(epoch_changes.gap.is_none()); + session_changes.clear_gap(); + assert!(session_changes.gap.is_none()); } } diff --git a/client/consensus/epochs/src/migration.rs b/client/consensus/epochs/src/migration.rs index c4ed47e9c1c05..5e5428bb21fe4 100644 --- a/client/consensus/epochs/src/migration.rs +++ b/client/consensus/epochs/src/migration.rs @@ -16,65 +16,65 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! Migration types for epoch changes. +//! Migration types for session changes. -use crate::{Epoch, EpochChanges, PersistedEpoch, PersistedEpochHeader}; +use crate::{Session, SessionChanges, PersistedSession, PersistedSessionHeader}; use codec::{Decode, Encode}; use fork_tree::ForkTree; use sp_runtime::traits::{Block as BlockT, NumberFor}; use std::collections::BTreeMap; -/// Legacy definition of epoch changes. +/// Legacy definition of session changes. #[derive(Clone, Encode, Decode)] -pub struct EpochChangesV0 { - inner: ForkTree>, +pub struct SessionChangesV0 { + inner: ForkTree>, } -/// Legacy definition of epoch changes. +/// Legacy definition of session changes. #[derive(Clone, Encode, Decode)] -pub struct EpochChangesV1 { - inner: ForkTree>, - epochs: BTreeMap<(Hash, Number), PersistedEpoch>, +pub struct SessionChangesV1 { + inner: ForkTree>, + sessions: BTreeMap<(Hash, Number), PersistedSession>, } -/// Type alias for v0 definition of epoch changes. -pub type EpochChangesV0For = - EpochChangesV0<::Hash, NumberFor, Epoch>; -/// Type alias for v1 and v2 definition of epoch changes. -pub type EpochChangesV1For = - EpochChangesV1<::Hash, NumberFor, Epoch>; +/// Type alias for v0 definition of session changes. +pub type SessionChangesV0For = + SessionChangesV0<::Hash, NumberFor, Session>; +/// Type alias for v1 and v2 definition of session changes. +pub type SessionChangesV1For = + SessionChangesV1<::Hash, NumberFor, Session>; -impl EpochChangesV0 +impl SessionChangesV0 where Hash: PartialEq + Ord + Copy, Number: Ord + Copy, { /// Create a new value of this type from raw. - pub fn from_raw(inner: ForkTree>) -> Self { + pub fn from_raw(inner: ForkTree>) -> Self { Self { inner } } - /// Migrate the type into current epoch changes definition. - pub fn migrate(self) -> EpochChanges { - let mut epochs = BTreeMap::new(); + /// Migrate the type into current session changes definition. + pub fn migrate(self) -> SessionChanges { + let mut sessions = BTreeMap::new(); let inner = self.inner.map(&mut |hash, number, data| { - let header = PersistedEpochHeader::from(&data); - epochs.insert((*hash, *number), data); + let header = PersistedSessionHeader::from(&data); + sessions.insert((*hash, *number), data); header }); - EpochChanges { inner, epochs, gap: None } + SessionChanges { inner, sessions, gap: None } } } -impl EpochChangesV1 +impl SessionChangesV1 where Hash: PartialEq + Ord + Copy, Number: Ord + Copy, { - /// Migrate the type into current epoch changes definition. - pub fn migrate(self) -> EpochChanges { - EpochChanges { inner: self.inner, epochs: self.epochs, gap: None } + /// Migrate the type into current session changes definition. + pub fn migrate(self) -> SessionChanges { + SessionChanges { inner: self.inner, sessions: self.sessions, gap: None } } } diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index c1568ea488337..03db89d18b2d8 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -28,7 +28,7 @@ sc-client-api = { path = "../../api", version = "4.0.0-dev" } sc-consensus = { version = "0.10.0-dev", path = "../../consensus/common" } sc-consensus-babe = { path = "../../consensus/babe", version = "0.10.0-dev" } sc-consensus-aura = { path = "../../consensus/aura", version = "0.10.0-dev" } -sc-consensus-epochs = { path = "../../consensus/epochs", version = "0.10.0-dev" } +sc-consensus-sessions = { path = "../../consensus/epochs", version = "0.10.0-dev" } sp-consensus-babe = { path = "../../../primitives/consensus/babe", version = "0.10.0-dev" } sp-consensus-aura = { path = "../../../primitives/consensus/aura", version = "0.10.0-dev" } diff --git a/client/consensus/manual-seal/src/consensus/babe.rs b/client/consensus/manual-seal/src/consensus/babe.rs index 53cc58df30a36..424550483ca35 100644 --- a/client/consensus/manual-seal/src/consensus/babe.rs +++ b/client/consensus/manual-seal/src/consensus/babe.rs @@ -24,11 +24,11 @@ use crate::Error; use codec::Encode; use sc_client_api::{AuxStore, UsageProvider}; use sc_consensus_babe::{ - authorship, find_pre_digest, BabeIntermediate, CompatibleDigestItem, Config, Epoch, + authorship, find_pre_digest, BabeIntermediate, CompatibleDigestItem, Config, Session, INTERMEDIATE_KEY, }; -use sc_consensus_epochs::{ - descendent_query, EpochHeader, SharedEpochChanges, ViableEpochDescriptor, +use sc_consensus_sessions::{ + descendent_query, SessionHeader, SharedSessionChanges, ViableSessionDescriptor, }; use sp_keystore::SyncCryptoStorePtr; use std::{borrow::Cow, sync::Arc}; @@ -38,7 +38,7 @@ use sp_api::{ProvideRuntimeApi, TransactionFor}; use sp_blockchain::{HeaderBackend, HeaderMetadata}; use sp_consensus::CacheKeyId; use sp_consensus_babe::{ - digests::{NextEpochDescriptor, PreDigest, SecondaryPlainPreDigest}, + digests::{NextSessionDescriptor, PreDigest, SecondaryPlainPreDigest}, inherents::BabeInherentData, AuthorityId, BabeApi, BabeAuthorityWeight, ConsensusLog, BABE_ENGINE_ID, }; @@ -60,8 +60,8 @@ pub struct BabeConsensusDataProvider { /// Shared reference to the client. client: Arc, - /// Shared epoch changes - epoch_changes: SharedEpochChanges, + /// Shared session changes + session_changes: SharedSessionChanges, /// BABE config, gotten from the runtime. config: Config, @@ -72,8 +72,8 @@ pub struct BabeConsensusDataProvider { /// Verifier to be used for babe chains pub struct BabeVerifier { - /// Shared epoch changes - epoch_changes: SharedEpochChanges, + /// Shared session changes + session_changes: SharedSessionChanges, /// Shared reference to the client. client: Arc, @@ -81,8 +81,8 @@ pub struct BabeVerifier { impl BabeVerifier { /// create a nrew verifier - pub fn new(epoch_changes: SharedEpochChanges, client: Arc) -> BabeVerifier { - BabeVerifier { epoch_changes, client } + pub fn new(session_changes: SharedSessionChanges, client: Arc) -> BabeVerifier { + BabeVerifier { session_changes, client } } } @@ -109,22 +109,22 @@ where .ok() .flatten() .ok_or_else(|| format!("header for block {} not found", parent_hash))?; - let epoch_changes = self.epoch_changes.shared_data(); - let epoch_descriptor = epoch_changes - .epoch_descriptor_for_child_of( + let session_changes = self.session_changes.shared_data(); + let session_descriptor = session_changes + .session_descriptor_for_child_of( descendent_query(&*self.client), &parent.hash(), parent.number().clone(), pre_digest.slot(), ) - .map_err(|e| format!("failed to fetch epoch_descriptor: {}", e))? + .map_err(|e| format!("failed to fetch session_descriptor: {}", e))? .ok_or_else(|| format!("{}", sp_consensus::Error::InvalidAuthoritiesSet))?; // drop the lock - drop(epoch_changes); + drop(session_changes); import_params.intermediates.insert( Cow::from(INTERMEDIATE_KEY), - Box::new(BabeIntermediate:: { epoch_descriptor }) as Box<_>, + Box::new(BabeIntermediate:: { session_descriptor }) as Box<_>, ); Ok((import_params, None)) @@ -144,7 +144,7 @@ where pub fn new( client: Arc, keystore: SyncCryptoStorePtr, - epoch_changes: SharedEpochChanges, + session_changes: SharedSessionChanges, authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, ) -> Result { if authorities.is_empty() { @@ -153,31 +153,31 @@ where let config = Config::get(&*client)?; - Ok(Self { config, client, keystore, epoch_changes, authorities }) + Ok(Self { config, client, keystore, session_changes, authorities }) } - fn epoch(&self, parent: &B::Header, slot: Slot) -> Result { - let epoch_changes = self.epoch_changes.shared_data(); - let epoch_descriptor = epoch_changes - .epoch_descriptor_for_child_of( + fn session(&self, parent: &B::Header, slot: Slot) -> Result { + let session_changes = self.session_changes.shared_data(); + let session_descriptor = session_changes + .session_descriptor_for_child_of( descendent_query(&*self.client), &parent.hash(), parent.number().clone(), slot, ) - .map_err(|e| Error::StringError(format!("failed to fetch epoch_descriptor: {}", e)))? + .map_err(|e| Error::StringError(format!("failed to fetch session_descriptor: {}", e)))? .ok_or_else(|| sp_consensus::Error::InvalidAuthoritiesSet)?; - let epoch = epoch_changes - .viable_epoch(&epoch_descriptor, |slot| { - Epoch::genesis(self.config.genesis_config(), slot) + let session = session_changes + .viable_session(&session_descriptor, |slot| { + Session::genesis(self.config.genesis_config(), slot) }) .ok_or_else(|| { - log::info!(target: "babe", "create_digest: no viable_epoch :("); + log::info!(target: "babe", "create_digest: no viable_session :("); sp_consensus::Error::InvalidAuthoritiesSet })?; - Ok(epoch.as_ref().clone()) + Ok(session.as_ref().clone()) } } @@ -197,54 +197,54 @@ where let slot = inherents .babe_inherent_data()? .ok_or_else(|| Error::StringError("No babe inherent data".into()))?; - let epoch = self.epoch(parent, slot)?; + let session = self.session(parent, slot)?; // this is a dev node environment, we should always be able to claim a slot. let logs = if let Some((predigest, _)) = - authorship::claim_slot(slot, &epoch, &self.keystore) + authorship::claim_slot(slot, &session, &self.keystore) { vec![::babe_pre_digest(predigest)] } else { // well we couldn't claim a slot because this is an existing chain and we're not in the - // authorities. we need to tell BabeBlockImport that the epoch has changed, and we put + // authorities. we need to tell BabeBlockImport that the session has changed, and we put // ourselves in the authorities. let predigest = PreDigest::SecondaryPlain(SecondaryPlainPreDigest { slot, authority_index: 0_u32 }); - let mut epoch_changes = self.epoch_changes.shared_data(); - let epoch_descriptor = epoch_changes - .epoch_descriptor_for_child_of( + let mut session_changes = self.session_changes.shared_data(); + let session_descriptor = session_changes + .session_descriptor_for_child_of( descendent_query(&*self.client), &parent.hash(), parent.number().clone(), slot, ) .map_err(|e| { - Error::StringError(format!("failed to fetch epoch_descriptor: {}", e)) + Error::StringError(format!("failed to fetch session_descriptor: {}", e)) })? .ok_or_else(|| sp_consensus::Error::InvalidAuthoritiesSet)?; - match epoch_descriptor { - ViableEpochDescriptor::Signaled(identifier, _epoch_header) => { - let epoch_mut = epoch_changes - .epoch_mut(&identifier) + match session_descriptor { + ViableSessionDescriptor::Signaled(identifier, _session_header) => { + let session_mut = session_changes + .session_mut(&identifier) .ok_or_else(|| sp_consensus::Error::InvalidAuthoritiesSet)?; - // mutate the current epoch - epoch_mut.authorities = self.authorities.clone(); + // mutate the current session + session_mut.authorities = self.authorities.clone(); - let next_epoch = ConsensusLog::NextEpochData(NextEpochDescriptor { + let next_session = ConsensusLog::NextSessionData(NextSessionDescriptor { authorities: self.authorities.clone(), // copy the old randomness - randomness: epoch_mut.randomness.clone(), + randomness: session_mut.randomness.clone(), }); vec![ DigestItem::PreRuntime(BABE_ENGINE_ID, predigest.encode()), - DigestItem::Consensus(BABE_ENGINE_ID, next_epoch.encode()), + DigestItem::Consensus(BABE_ENGINE_ID, next_session.encode()), ] }, - ViableEpochDescriptor::UnimportedGenesis(_) => { + ViableSessionDescriptor::UnimportedGenesis(_) => { // since this is the genesis, secondary predigest works for now. vec![DigestItem::PreRuntime(BABE_ENGINE_ID, predigest.encode())] }, @@ -263,22 +263,22 @@ where let slot = inherents .babe_inherent_data()? .ok_or_else(|| Error::StringError("No babe inherent data".into()))?; - let epoch_changes = self.epoch_changes.shared_data(); - let mut epoch_descriptor = epoch_changes - .epoch_descriptor_for_child_of( + let session_changes = self.session_changes.shared_data(); + let mut session_descriptor = session_changes + .session_descriptor_for_child_of( descendent_query(&*self.client), &parent.hash(), parent.number().clone(), slot, ) - .map_err(|e| Error::StringError(format!("failed to fetch epoch_descriptor: {}", e)))? + .map_err(|e| Error::StringError(format!("failed to fetch session_descriptor: {}", e)))? .ok_or_else(|| sp_consensus::Error::InvalidAuthoritiesSet)?; // drop the lock - drop(epoch_changes); + drop(session_changes); // a quick check to see if we're in the authorities - let epoch = self.epoch(parent, slot)?; + let session = self.session(parent, slot)?; let (authority, _) = self.authorities.first().expect("authorities is non-emptyp; qed"); - let has_authority = epoch.authorities.iter().any(|(id, _)| *id == *authority); + let has_authority = session.authorities.iter().any(|(id, _)| *id == *authority); if !has_authority { log::info!(target: "manual-seal", "authority not found"); @@ -288,25 +288,25 @@ where let slot = Slot::from_timestamp(timestamp, self.config.slot_duration()); - // manually hard code epoch descriptor - epoch_descriptor = match epoch_descriptor { - ViableEpochDescriptor::Signaled(identifier, _header) => - ViableEpochDescriptor::Signaled( + // manually hard code session descriptor + session_descriptor = match session_descriptor { + ViableSessionDescriptor::Signaled(identifier, _header) => + ViableSessionDescriptor::Signaled( identifier, - EpochHeader { + SessionHeader { start_slot: slot, - end_slot: (*slot * self.config.genesis_config().epoch_length).into(), + end_slot: (*slot * self.config.genesis_config().session_length).into(), }, ), _ => unreachable!( - "we're not in the authorities, so this isn't the genesis epoch; qed" + "we're not in the authorities, so this isn't the genesis session; qed" ), }; } params.intermediates.insert( Cow::from(INTERMEDIATE_KEY), - Box::new(BabeIntermediate:: { epoch_descriptor }) as Box<_>, + Box::new(BabeIntermediate:: { session_descriptor }) as Box<_>, ); Ok(()) diff --git a/client/consensus/slots/src/lib.rs b/client/consensus/slots/src/lib.rs index a97469fbcc300..76ca638fa792a 100644 --- a/client/consensus/slots/src/lib.rs +++ b/client/consensus/slots/src/lib.rs @@ -105,8 +105,8 @@ pub trait SimpleSlotWorker { /// Data associated with a slot claim. type Claim: Send + 'static; - /// Epoch data necessary for authoring. - type EpochData: Send + Sync + 'static; + /// Session data necessary for authoring. + type SessionData: Send + Sync + 'static; /// The logging target to use when logging messages. fn logging_target(&self) -> &'static str; @@ -114,29 +114,29 @@ pub trait SimpleSlotWorker { /// A handle to a `BlockImport`. fn block_import(&mut self) -> &mut Self::BlockImport; - /// Returns the epoch data necessary for authoring. For time-dependent epochs, + /// Returns the session data necessary for authoring. For time-dependent sessions, /// use the provided slot number as a canonical source of time. - fn epoch_data( + fn session_data( &self, header: &B::Header, slot: Slot, - ) -> Result; + ) -> Result; - /// Returns the number of authorities given the epoch data. + /// Returns the number of authorities given the session data. /// None indicate that the authorities information is incomplete. - fn authorities_len(&self, epoch_data: &Self::EpochData) -> Option; + fn authorities_len(&self, session_data: &Self::SessionData) -> Option; /// Tries to claim the given slot, returning an object with claim data if successful. async fn claim_slot( &self, header: &B::Header, slot: Slot, - epoch_data: &Self::EpochData, + session_data: &Self::SessionData, ) -> Option; /// Notifies the given slot. Similar to `claim_slot`, but will be called no matter whether we /// need to author blocks or not. - fn notify_slot(&self, _header: &B::Header, _slot: Slot, _epoch_data: &Self::EpochData) {} + fn notify_slot(&self, _header: &B::Header, _slot: Slot, _session_data: &Self::SessionData) {} /// Return the pre digest data to include in a block authored with the given claim. fn pre_digest_data(&self, slot: Slot, claim: &Self::Claim) -> Vec; @@ -149,7 +149,7 @@ pub trait SimpleSlotWorker { body: Vec, storage_changes: StorageChanges<>::Transaction, B>, public: Self::Claim, - epoch: Self::EpochData, + session: Self::SessionData, ) -> Result< sc_consensus::BlockImportParams>::Transaction>, sp_consensus::Error, @@ -208,12 +208,12 @@ pub trait SimpleSlotWorker { Delay::new(proposing_remaining_duration) }; - let epoch_data = match self.epoch_data(&slot_info.chain_head, slot) { - Ok(epoch_data) => epoch_data, + let session_data = match self.session_data(&slot_info.chain_head, slot) { + Ok(session_data) => session_data, Err(err) => { warn!( target: logging_target, - "Unable to fetch epoch data at block {:?}: {}", + "Unable to fetch session data at block {:?}: {}", slot_info.chain_head.hash(), err, ); @@ -230,9 +230,9 @@ pub trait SimpleSlotWorker { }, }; - self.notify_slot(&slot_info.chain_head, slot, &epoch_data); + self.notify_slot(&slot_info.chain_head, slot, &session_data); - let authorities_len = self.authorities_len(&epoch_data); + let authorities_len = self.authorities_len(&session_data); if !self.force_authoring() && self.sync_oracle().is_offline() && @@ -249,7 +249,7 @@ pub trait SimpleSlotWorker { return None } - let claim = self.claim_slot(&slot_info.chain_head, slot, &epoch_data).await?; + let claim = self.claim_slot(&slot_info.chain_head, slot, &session_data).await?; if self.should_backoff(slot, &slot_info.chain_head) { return None @@ -343,7 +343,7 @@ pub trait SimpleSlotWorker { body.clone(), proposal.storage_changes, claim, - epoch_data, + session_data, ) .await { diff --git a/client/network/README.md b/client/network/README.md index c361bc9249f71..0bf61aa9383e5 100644 --- a/client/network/README.md +++ b/client/network/README.md @@ -254,7 +254,7 @@ header hash, until it arrives at some recent header. Once the finality chain is proved for a header, the state matching the header is downloaded much like during the fast sync. The state is verified to match the header storage root. After the state is imported into the database it is queried for the information that allows GRANDPA and BABE to continue operating from that state. -This includes BABE epoch information and GRANDPA authority set id. +This includes BABE session information and GRANDPA authority set id. ### Background block download. diff --git a/client/offchain/src/api/timestamp.rs b/client/offchain/src/api/timestamp.rs index 4b3f5efddf275..2f568be21aeb5 100644 --- a/client/offchain/src/api/timestamp.rs +++ b/client/offchain/src/api/timestamp.rs @@ -24,8 +24,8 @@ use std::time::{Duration, SystemTime}; /// Returns the current time as a `Timestamp`. pub fn now() -> Timestamp { let now = SystemTime::now(); - let epoch_duration = now.duration_since(SystemTime::UNIX_EPOCH); - match epoch_duration { + let session_duration = now.duration_since(SystemTime::UNIX_EPOCH); + match session_duration { Err(_) => { // Current time is earlier than UNIX_EPOCH. Timestamp::from_unix_millis(0) diff --git a/client/service/src/metrics.rs b/client/service/src/metrics.rs index 9fbf2c3ea3fca..3cd14dd2f3457 100644 --- a/client/service/src/metrics.rs +++ b/client/service/src/metrics.rs @@ -73,7 +73,7 @@ impl PrometheusMetrics { register_globals(registry)?; - let start_time_since_epoch = + let start_time_since_session = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap_or_default(); register( Gauge::::new( @@ -82,7 +82,7 @@ impl PrometheusMetrics { )?, registry, )? - .set(start_time_since_epoch.as_secs()); + .set(start_time_since_session.as_secs()); Ok(Self { // generic internals diff --git a/client/sync-state-rpc/Cargo.toml b/client/sync-state-rpc/Cargo.toml index e13631f210bc0..d430e752736e9 100644 --- a/client/sync-state-rpc/Cargo.toml +++ b/client/sync-state-rpc/Cargo.toml @@ -20,7 +20,7 @@ jsonrpc-derive = "18.0.0" sc-chain-spec = { version = "4.0.0-dev", path = "../chain-spec" } sc-client-api = { version = "4.0.0-dev", path = "../api" } sc-consensus-babe = { version = "0.10.0-dev", path = "../consensus/babe" } -sc-consensus-epochs = { version = "0.10.0-dev", path = "../consensus/epochs" } +sc-consensus-sessions = { version = "0.10.0-dev", path = "../consensus/epochs" } sc-finality-grandpa = { version = "0.10.0-dev", path = "../finality-grandpa" } serde_json = "1.0.79" serde = { version = "1.0.136", features = ["derive"] } diff --git a/client/sync-state-rpc/src/lib.rs b/client/sync-state-rpc/src/lib.rs index 6fc0d17800fed..138ab7315afe1 100644 --- a/client/sync-state-rpc/src/lib.rs +++ b/client/sync-state-rpc/src/lib.rs @@ -53,8 +53,8 @@ use jsonrpc_derive::rpc; type SharedAuthoritySet = sc_finality_grandpa::SharedAuthoritySet<::Hash, NumberFor>; -type SharedEpochChanges = - sc_consensus_epochs::SharedEpochChanges; +type SharedSessionChanges = + sc_consensus_sessions::SharedSessionChanges; /// Error type used by this crate. #[derive(Debug, thiserror::Error)] @@ -109,9 +109,9 @@ pub struct LightSyncState { /// The header of the best finalized block. #[serde(serialize_with = "serialize_encoded")] pub finalized_block_header: ::Header, - /// The epoch changes tree for babe. + /// The session changes tree for babe. #[serde(serialize_with = "serialize_encoded")] - pub babe_epoch_changes: sc_consensus_epochs::EpochChangesFor, + pub babe_session_changes: sc_consensus_sessions::SessionChangesFor, /// The babe weight of the finalized block. pub babe_finalized_block_weight: sc_consensus_babe::BabeBlockWeight, /// The authority set for grandpa. @@ -133,7 +133,7 @@ pub struct SyncStateRpcHandler { chain_spec: Box, client: Arc, shared_authority_set: SharedAuthoritySet, - shared_epoch_changes: SharedEpochChanges, + shared_session_changes: SharedSessionChanges, } impl SyncStateRpcHandler @@ -146,12 +146,12 @@ where chain_spec: Box, client: Arc, shared_authority_set: SharedAuthoritySet, - shared_epoch_changes: SharedEpochChanges, + shared_session_changes: SharedSessionChanges, ) -> Result> { if sc_chain_spec::get_extension::(chain_spec.extensions()) .is_some() { - Ok(Self { chain_spec, client, shared_authority_set, shared_epoch_changes }) + Ok(Self { chain_spec, client, shared_authority_set, shared_session_changes }) } else { Err(Error::::LightSyncStateExtensionNotFound) } @@ -170,7 +170,7 @@ where Ok(LightSyncState { finalized_block_header: finalized_header, - babe_epoch_changes: self.shared_epoch_changes.shared_data().clone(), + babe_session_changes: self.shared_session_changes.shared_data().clone(), babe_finalized_block_weight: finalized_block_weight, grandpa_authority_set: self.shared_authority_set.clone_inner(), }) diff --git a/frame/babe/Cargo.toml b/frame/babe/Cargo.toml index 2c3af69b3b4a1..72cd0deba39ee 100644 --- a/frame/babe/Cargo.toml +++ b/frame/babe/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" homepage = "https://substrate.io" repository = "https://github.com/paritytech/substrate/" -description = "Consensus extension module for BABE consensus. Collects on-chain randomness from VRF outputs and manages epoch transitions." +description = "Consensus extension module for BABE consensus. Collects on-chain randomness from VRF outputs and manages session transitions." readme = "README.md" [package.metadata.docs.rs] diff --git a/frame/babe/README.md b/frame/babe/README.md index 6f20be89efc0c..8f08a0e02b7fd 100644 --- a/frame/babe/README.md +++ b/frame/babe/README.md @@ -1,4 +1,4 @@ Consensus extension module for BABE consensus. Collects on-chain randomness -from VRF outputs and manages epoch transitions. +from VRF outputs and manages session transitions. License: Apache-2.0 \ No newline at end of file diff --git a/frame/babe/src/lib.rs b/frame/babe/src/lib.rs index 87ae762707ccd..4ef9041c68054 100644 --- a/frame/babe/src/lib.rs +++ b/frame/babe/src/lib.rs @@ -16,7 +16,7 @@ // limitations under the License. //! Consensus extension module for BABE consensus. Collects on-chain randomness -//! from VRF outputs and manages epoch transitions. +//! from VRF outputs and manages session transitions. #![cfg_attr(not(feature = "std"), no_std)] #![warn(unused_must_use, unsafe_code, unused_variables, unused_must_use)] @@ -41,8 +41,8 @@ use sp_session::{GetSessionNumber, GetValidatorCount}; use sp_std::prelude::*; use sp_consensus_babe::{ - digests::{NextConfigDescriptor, NextEpochDescriptor, PreDigest}, - BabeAuthorityWeight, BabeEpochConfiguration, ConsensusLog, Epoch, EquivocationProof, Slot, + digests::{NextConfigDescriptor, NextSessionDescriptor, PreDigest}, + BabeAuthorityWeight, BabeSessionConfiguration, ConsensusLog, Session, EquivocationProof, Slot, BABE_ENGINE_ID, }; use sp_consensus_vrf::schnorrkel; @@ -62,7 +62,7 @@ mod tests; pub use equivocation::{BabeEquivocationOffence, EquivocationHandler, HandleEquivocation}; pub use randomness::{ - CurrentBlockRandomness, RandomnessFromOneEpochAgo, RandomnessFromTwoEpochsAgo, + CurrentBlockRandomness, RandomnessFromOneSessionAgo, RandomnessFromTwoSessionsAgo, }; pub use pallet::*; @@ -72,32 +72,32 @@ pub trait WeightInfo { fn report_equivocation(validator_count: u32) -> Weight; } -/// Trigger an epoch change, if any should take place. -pub trait EpochChangeTrigger { - /// Trigger an epoch change, if any should take place. This should be called +/// Trigger an session change, if any should take place. +pub trait SessionChangeTrigger { + /// Trigger an session change, if any should take place. This should be called /// during every block, after initialization is done. fn trigger(now: T::BlockNumber); } /// A type signifying to BABE that an external trigger -/// for epoch changes (e.g. pallet-session) is used. +/// for session changes (e.g. pallet-session) is used. pub struct ExternalTrigger; -impl EpochChangeTrigger for ExternalTrigger { +impl SessionChangeTrigger for ExternalTrigger { fn trigger(_: T::BlockNumber) {} // nothing - trigger is external. } -/// A type signifying to BABE that it should perform epoch changes +/// A type signifying to BABE that it should perform session changes /// with an internal trigger, recycling the same authorities forever. pub struct SameAuthoritiesForever; -impl EpochChangeTrigger for SameAuthoritiesForever { +impl SessionChangeTrigger for SameAuthoritiesForever { fn trigger(now: T::BlockNumber) { - if >::should_epoch_change(now) { + if >::should_session_change(now) { let authorities = >::authorities(); let next_authorities = authorities.clone(); - >::enact_epoch_change(authorities, next_authorities); + >::enact_session_change(authorities, next_authorities); } } } @@ -120,11 +120,11 @@ pub mod pallet { #[pallet::config] #[pallet::disable_frame_system_supertrait_check] pub trait Config: pallet_timestamp::Config { - /// The amount of time, in slots, that each epoch should last. - /// NOTE: Currently it is not possible to change the epoch duration after + /// The amount of time, in slots, that each session should last. + /// NOTE: Currently it is not possible to change the session duration after /// the chain has started. Attempting to do so will brick block production. #[pallet::constant] - type EpochDuration: Get; + type SessionDuration: Get; /// The expected average block time at which BABE should be creating /// blocks. Since BABE is probabilistic it is not trivial to figure out @@ -134,12 +134,12 @@ pub mod pallet { #[pallet::constant] type ExpectedBlockTime: Get; - /// BABE requires some logic to be triggered on every block to query for whether an epoch - /// has ended and to perform the transition to the next epoch. + /// BABE requires some logic to be triggered on every block to query for whether an session + /// has ended and to perform the transition to the next session. /// /// Typically, the `ExternalTrigger` type should be used. An internal trigger should only be /// used when no other module is responsible for changing authority set. - type EpochChangeTrigger: EpochChangeTrigger; + type SessionChangeTrigger: SessionChangeTrigger; /// A way to check whether a given validator is disabled and should not be authoring blocks. /// Blocks authored by a disabled validator will lead to a panic as part of this module's @@ -187,12 +187,12 @@ pub mod pallet { DuplicateOffenceReport, } - /// Current epoch index. + /// Current session index. #[pallet::storage] - #[pallet::getter(fn epoch_index)] - pub type EpochIndex = StorageValue<_, u64, ValueQuery>; + #[pallet::getter(fn session_index)] + pub type SessionIndex = StorageValue<_, u64, ValueQuery>; - /// Current epoch authorities. + /// Current session authorities. #[pallet::storage] #[pallet::getter(fn authorities)] pub type Authorities = StorageValue< @@ -201,7 +201,7 @@ pub mod pallet { ValueQuery, >; - /// The slot at which the first epoch actually started. This is 0 + /// The slot at which the first session actually started. This is 0 /// until the first block of the chain. #[pallet::storage] #[pallet::getter(fn genesis_slot)] @@ -212,7 +212,7 @@ pub mod pallet { #[pallet::getter(fn current_slot)] pub type CurrentSlot = StorageValue<_, Slot, ValueQuery>; - /// The epoch randomness for the *current* epoch. + /// The session randomness for the *current* session. /// /// # Security /// @@ -229,15 +229,15 @@ pub mod pallet { #[pallet::getter(fn randomness)] pub type Randomness = StorageValue<_, schnorrkel::Randomness, ValueQuery>; - /// Pending epoch configuration change that will be applied when the next epoch is enacted. + /// Pending session configuration change that will be applied when the next session is enacted. #[pallet::storage] - pub(super) type PendingEpochConfigChange = StorageValue<_, NextConfigDescriptor>; + pub(super) type PendingSessionConfigChange = StorageValue<_, NextConfigDescriptor>; - /// Next epoch randomness. + /// Next session randomness. #[pallet::storage] pub(super) type NextRandomness = StorageValue<_, schnorrkel::Randomness, ValueQuery>; - /// Next epoch authorities. + /// Next session authorities. #[pallet::storage] pub(super) type NextAuthorities = StorageValue< _, @@ -253,7 +253,7 @@ pub mod pallet { /// /// Once a segment reaches this length, we begin the next one. /// We reset all segments and return to `0` at the beginning of every - /// epoch. + /// session. #[pallet::storage] pub(super) type SegmentIndex = StorageValue<_, u32, ValueQuery>; @@ -281,13 +281,13 @@ pub mod pallet { #[pallet::getter(fn author_vrf_randomness)] pub(super) type AuthorVrfRandomness = StorageValue<_, MaybeRandomness, ValueQuery>; - /// The block numbers when the last and current epoch have started, respectively `N-1` and + /// The block numbers when the last and current session have started, respectively `N-1` and /// `N`. /// NOTE: We track this is in order to annotate the block number when a given pool of - /// entropy was fixed (i.e. it was known to chain observers). Since epochs are defined in + /// entropy was fixed (i.e. it was known to chain observers). Since sessions are defined in /// slots, which may be skipped, the block numbers may not line up with the slot numbers. #[pallet::storage] - pub(super) type EpochStart = + pub(super) type SessionStart = StorageValue<_, (T::BlockNumber, T::BlockNumber), ValueQuery>; /// How late the current block is compared to its parent. @@ -299,21 +299,21 @@ pub mod pallet { #[pallet::getter(fn lateness)] pub(super) type Lateness = StorageValue<_, T::BlockNumber, ValueQuery>; - /// The configuration for the current epoch. Should never be `None` as it is initialized in + /// The configuration for the current session. Should never be `None` as it is initialized in /// genesis. #[pallet::storage] - pub(super) type EpochConfig = StorageValue<_, BabeEpochConfiguration>; + pub(super) type SessionConfig = StorageValue<_, BabeSessionConfiguration>; - /// The configuration for the next epoch, `None` if the config will not change - /// (you can fallback to `EpochConfig` instead in that case). + /// The configuration for the next session, `None` if the config will not change + /// (you can fallback to `SessionConfig` instead in that case). #[pallet::storage] - pub(super) type NextEpochConfig = StorageValue<_, BabeEpochConfiguration>; + pub(super) type NextSessionConfig = StorageValue<_, BabeSessionConfiguration>; #[cfg_attr(feature = "std", derive(Default))] #[pallet::genesis_config] pub struct GenesisConfig { pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, - pub epoch_config: Option, + pub session_config: Option, } #[pallet::genesis_build] @@ -321,8 +321,8 @@ pub mod pallet { fn build(&self) { SegmentIndex::::put(0); Pallet::::initialize_authorities(&self.authorities); - EpochConfig::::put( - self.epoch_config.clone().expect("epoch_config must not be None"), + SessionConfig::::put( + self.session_config.clone().expect("session_config must not be None"), ); } } @@ -339,9 +339,9 @@ pub mod pallet { fn on_finalize(_n: BlockNumberFor) { // at the end of the block, we can safely include the new VRF output // from this block into the under-construction randomness. If we've determined - // that this block was the first in a new epoch, the changeover logic has + // that this block was the first in a new session, the changeover logic has // already occurred at this point, so the under-construction randomness - // will only contain outputs from the right epoch. + // will only contain outputs from the right session. if let Some(Some(randomness)) = Initialized::::take() { Self::deposit_randomness(&randomness); } @@ -395,8 +395,8 @@ pub mod pallet { ) } - /// Plan an epoch config change. The epoch config change is recorded and will be enacted on - /// the next call to `enact_epoch_change`. The config will be activated one epoch after. + /// Plan an session config change. The session config change is recorded and will be enacted on + /// the next call to `enact_session_change`. The config will be activated one session after. /// Multiple calls to this method will replace any existing planned config change that had /// not been enacted yet. #[pallet::weight(::WeightInfo::plan_config_change())] @@ -405,7 +405,7 @@ pub mod pallet { config: NextConfigDescriptor, ) -> DispatchResult { ensure_root(origin)?; - PendingEpochConfigChange::::put(config); + PendingSessionConfigChange::::put(config); Ok(()) } } @@ -456,7 +456,7 @@ impl pallet_session::ShouldEndSession for Pallet { // that we have synced with digest before checking if session should be ended. Self::do_initialize(now); - Self::should_epoch_change(now) + Self::should_session_change(now) } } @@ -468,24 +468,24 @@ impl Pallet { ::MinimumPeriod::get().saturating_mul(2u32.into()) } - /// Determine whether an epoch change should take place at this block. + /// Determine whether an session change should take place at this block. /// Assumes that initialization has already taken place. - pub fn should_epoch_change(now: T::BlockNumber) -> bool { - // The epoch has technically ended during the passage of time - // between this block and the last, but we have to "end" the epoch now, + pub fn should_session_change(now: T::BlockNumber) -> bool { + // The session has technically ended during the passage of time + // between this block and the last, but we have to "end" the session now, // since there is no earlier possible block we could have done it. // // The exception is for block 1: the genesis has slot 0, so we treat - // epoch 0 as having started at the slot of block 1. We want to use + // session 0 as having started at the slot of block 1. We want to use // the same randomness and validator set as signalled in the genesis, - // so we don't rotate the epoch. + // so we don't rotate the session. now != One::one() && { - let diff = CurrentSlot::::get().saturating_sub(Self::current_epoch_start()); - *diff >= T::EpochDuration::get() + let diff = CurrentSlot::::get().saturating_sub(Self::current_session_start()); + *diff >= T::SessionDuration::get() } } - /// Return the _best guess_ block number, at which the next epoch change is predicted to happen. + /// Return the _best guess_ block number, at which the next session change is predicted to happen. /// /// Returns None if the prediction is in the past; This implies an error internally in the Babe /// and should not happen under normal circumstances. @@ -495,13 +495,13 @@ impl Pallet { /// upper bound. // ## IMPORTANT NOTE // - // This implementation is linked to how [`should_epoch_change`] is working. This might need to - // be updated accordingly, if the underlying mechanics of slot and epochs change. + // This implementation is linked to how [`should_session_change`] is working. This might need to + // be updated accordingly, if the underlying mechanics of slot and sessions change. // // WEIGHT NOTE: This function is tied to the weight of `EstimateNextSessionRotation`. If you // update this function, you must also update the corresponding weight. - pub fn next_expected_epoch_change(now: T::BlockNumber) -> Option { - let next_slot = Self::current_epoch_start().saturating_add(T::EpochDuration::get()); + pub fn next_expected_session_change(now: T::BlockNumber) -> Option { + let next_slot = Self::current_session_start().saturating_add(T::SessionDuration::get()); next_slot.checked_sub(*CurrentSlot::::get()).map(|slots_remaining| { // This is a best effort guess. Drifts in the slot/block ratio will cause errors here. let blocks_remaining: T::BlockNumber = slots_remaining.saturated_into(); @@ -509,12 +509,12 @@ impl Pallet { }) } - /// DANGEROUS: Enact an epoch change. Should be done on every block where `should_epoch_change` + /// DANGEROUS: Enact an session change. Should be done on every block where `should_session_change` /// has returned `true`, and the caller is the only caller of this function. /// /// Typically, this is not handled directly by the user, but by higher-level validator-set /// manager logic like `pallet-session`. - pub fn enact_epoch_change( + pub fn enact_session_change( authorities: WeakBoundedVec<(AuthorityId, BabeAuthorityWeight), T::MaxAuthorities>, next_authorities: WeakBoundedVec<(AuthorityId, BabeAuthorityWeight), T::MaxAuthorities>, ) { @@ -522,107 +522,107 @@ impl Pallet { // by the session module to be called before this. debug_assert!(Self::initialized().is_some()); - // Update epoch index - let epoch_index = EpochIndex::::get() + // Update session index + let session_index = SessionIndex::::get() .checked_add(1) - .expect("epoch indices will never reach 2^64 before the death of the universe; qed"); + .expect("session indices will never reach 2^64 before the death of the universe; qed"); - EpochIndex::::put(epoch_index); + SessionIndex::::put(session_index); Authorities::::put(authorities); - // Update epoch randomness. - let next_epoch_index = epoch_index + // Update session randomness. + let next_session_index = session_index .checked_add(1) - .expect("epoch indices will never reach 2^64 before the death of the universe; qed"); + .expect("session indices will never reach 2^64 before the death of the universe; qed"); - // Returns randomness for the current epoch and computes the *next* - // epoch randomness. - let randomness = Self::randomness_change_epoch(next_epoch_index); + // Returns randomness for the current session and computes the *next* + // session randomness. + let randomness = Self::randomness_change_session(next_session_index); Randomness::::put(randomness); - // Update the next epoch authorities. + // Update the next session authorities. NextAuthorities::::put(&next_authorities); - // Update the start blocks of the previous and new current epoch. - >::mutate(|(previous_epoch_start_block, current_epoch_start_block)| { - *previous_epoch_start_block = sp_std::mem::take(current_epoch_start_block); - *current_epoch_start_block = >::block_number(); + // Update the start blocks of the previous and new current session. + >::mutate(|(previous_session_start_block, current_session_start_block)| { + *previous_session_start_block = sp_std::mem::take(current_session_start_block); + *current_session_start_block = >::block_number(); }); - // After we update the current epoch, we signal the *next* epoch change + // After we update the current session, we signal the *next* session change // so that nodes can track changes. let next_randomness = NextRandomness::::get(); - let next_epoch = NextEpochDescriptor { + let next_session = NextSessionDescriptor { authorities: next_authorities.to_vec(), randomness: next_randomness, }; - Self::deposit_consensus(ConsensusLog::NextEpochData(next_epoch)); + Self::deposit_consensus(ConsensusLog::NextSessionData(next_session)); - if let Some(next_config) = NextEpochConfig::::get() { - EpochConfig::::put(next_config); + if let Some(next_config) = NextSessionConfig::::get() { + SessionConfig::::put(next_config); } - if let Some(pending_epoch_config_change) = PendingEpochConfigChange::::take() { - let next_epoch_config: BabeEpochConfiguration = - pending_epoch_config_change.clone().into(); - NextEpochConfig::::put(next_epoch_config); + if let Some(pending_session_config_change) = PendingSessionConfigChange::::take() { + let next_session_config: BabeSessionConfiguration = + pending_session_config_change.clone().into(); + NextSessionConfig::::put(next_session_config); - Self::deposit_consensus(ConsensusLog::NextConfigData(pending_epoch_config_change)); + Self::deposit_consensus(ConsensusLog::NextConfigData(pending_session_config_change)); } } - /// Finds the start slot of the current epoch. only guaranteed to + /// Finds the start slot of the current session. only guaranteed to /// give correct results after `do_initialize` of the first block /// in the chain (as its result is based off of `GenesisSlot`). - pub fn current_epoch_start() -> Slot { - Self::epoch_start(EpochIndex::::get()) + pub fn current_session_start() -> Slot { + Self::session_start(SessionIndex::::get()) } - /// Produces information about the current epoch. - pub fn current_epoch() -> Epoch { - Epoch { - epoch_index: EpochIndex::::get(), - start_slot: Self::current_epoch_start(), - duration: T::EpochDuration::get(), + /// Produces information about the current session. + pub fn current_session() -> Session { + Session { + session_index: SessionIndex::::get(), + start_slot: Self::current_session_start(), + duration: T::SessionDuration::get(), authorities: Self::authorities().to_vec(), randomness: Self::randomness(), - config: EpochConfig::::get() - .expect("EpochConfig is initialized in genesis; we never `take` or `kill` it; qed"), + config: SessionConfig::::get() + .expect("SessionConfig is initialized in genesis; we never `take` or `kill` it; qed"), } } - /// Produces information about the next epoch (which was already previously + /// Produces information about the next session (which was already previously /// announced). - pub fn next_epoch() -> Epoch { - let next_epoch_index = EpochIndex::::get().checked_add(1).expect( - "epoch index is u64; it is always only incremented by one; \ + pub fn next_session() -> Session { + let next_session_index = SessionIndex::::get().checked_add(1).expect( + "session index is u64; it is always only incremented by one; \ if u64 is not enough we should crash for safety; qed.", ); - Epoch { - epoch_index: next_epoch_index, - start_slot: Self::epoch_start(next_epoch_index), - duration: T::EpochDuration::get(), + Session { + session_index: next_session_index, + start_slot: Self::session_start(next_session_index), + duration: T::SessionDuration::get(), authorities: NextAuthorities::::get().to_vec(), randomness: NextRandomness::::get(), - config: NextEpochConfig::::get().unwrap_or_else(|| { - EpochConfig::::get().expect( - "EpochConfig is initialized in genesis; we never `take` or `kill` it; qed", + config: NextSessionConfig::::get().unwrap_or_else(|| { + SessionConfig::::get().expect( + "SessionConfig is initialized in genesis; we never `take` or `kill` it; qed", ) }), } } - fn epoch_start(epoch_index: u64) -> Slot { - // (epoch_index * epoch_duration) + genesis_slot + fn session_start(session_index: u64) -> Slot { + // (session_index * session_duration) + genesis_slot const PROOF: &str = "slot number is u64; it should relate in some way to wall clock time; \ if u64 is not enough we should crash for safety; qed."; - let epoch_start = epoch_index.checked_mul(T::EpochDuration::get()).expect(PROOF); + let session_start = session_index.checked_mul(T::SessionDuration::get()).expect(PROOF); - epoch_start.checked_add(*GenesisSlot::::get()).expect(PROOF).into() + session_start.checked_add(*GenesisSlot::::get()).expect(PROOF).into() } fn deposit_consensus(new: U) { @@ -675,21 +675,21 @@ impl Pallet { let maybe_randomness: MaybeRandomness = maybe_pre_digest.and_then(|digest| { // on the first non-zero block (i.e. block #1) - // this is where the first epoch (epoch #0) actually starts. + // this is where the first session (session #0) actually starts. // we need to adjust internal storage accordingly. if *GenesisSlot::::get() == 0 { GenesisSlot::::put(digest.slot()); debug_assert_ne!(*GenesisSlot::::get(), 0); - // deposit a log because this is the first block in epoch #0 + // deposit a log because this is the first block in session #0 // we use the same values as genesis because we haven't collected any // randomness yet. - let next = NextEpochDescriptor { + let next = NextSessionDescriptor { authorities: Self::authorities().to_vec(), randomness: Self::randomness(), }; - Self::deposit_consensus(ConsensusLog::NextEpochData(next)) + Self::deposit_consensus(ConsensusLog::NextSessionData(next)) } // the slot number of the current block being initialized @@ -721,7 +721,7 @@ impl Pallet { let transcript = sp_consensus_babe::make_transcript( &Self::randomness(), current_slot, - EpochIndex::::get(), + SessionIndex::::get(), ); vrf_output.0.attach_input_hash(&pubkey, transcript).ok() @@ -732,20 +732,20 @@ impl Pallet { // For primary VRF output we place it in the `Initialized` storage // item and it'll be put onto the under-construction randomness later, - // once we've decided which epoch this block is in. + // once we've decided which session this block is in. Initialized::::put(if is_primary { maybe_randomness } else { None }); // Place either the primary or secondary VRF output into the // `AuthorVrfRandomness` storage item. AuthorVrfRandomness::::put(maybe_randomness); - // enact epoch change, if necessary. - T::EpochChangeTrigger::trigger::(now) + // enact session change, if necessary. + T::SessionChangeTrigger::trigger::(now) } - /// Call this function exactly once when an epoch changes, to update the + /// Call this function exactly once when an session changes, to update the /// randomness. Returns the new randomness. - fn randomness_change_epoch(next_epoch_index: u64) -> schnorrkel::Randomness { + fn randomness_change_session(next_session_index: u64) -> schnorrkel::Randomness { let this_randomness = NextRandomness::::get(); let segment_idx: u32 = SegmentIndex::::mutate(|s| sp_std::mem::replace(s, 0)); @@ -754,7 +754,7 @@ impl Pallet { let next_randomness = compute_randomness( this_randomness, - next_epoch_index, + next_session_index, (0..segment_idx).flat_map(|i| UnderConstruction::::take(&i)), Some(rho_size), ); @@ -789,12 +789,12 @@ impl Pallet { let validator_set_count = key_owner_proof.validator_count(); let session_index = key_owner_proof.session(); - let epoch_index = (*slot.saturating_sub(GenesisSlot::::get()) / T::EpochDuration::get()) + let session_index = (*slot.saturating_sub(GenesisSlot::::get()) / T::SessionDuration::get()) .saturated_into::(); // check that the slot number is consistent with the session index - // in the key ownership proof (i.e. slot is for that epoch) - if epoch_index != session_index { + // in the key ownership proof (i.e. slot is for that session) + if session_index != session_index { return Err(Error::::InvalidKeyOwnershipProof.into()) } @@ -851,23 +851,23 @@ impl OnTimestampSet for Pallet { impl frame_support::traits::EstimateNextSessionRotation for Pallet { fn average_session_length() -> T::BlockNumber { - T::EpochDuration::get().saturated_into() + T::SessionDuration::get().saturated_into() } fn estimate_current_session_progress(_now: T::BlockNumber) -> (Option, Weight) { - let elapsed = CurrentSlot::::get().saturating_sub(Self::current_epoch_start()) + 1; + let elapsed = CurrentSlot::::get().saturating_sub(Self::current_session_start()) + 1; ( - Some(Permill::from_rational(*elapsed, T::EpochDuration::get())), - // Read: Current Slot, Epoch Index, Genesis Slot + Some(Permill::from_rational(*elapsed, T::SessionDuration::get())), + // Read: Current Slot, Session Index, Genesis Slot T::DbWeight::get().reads(3), ) } fn estimate_next_session_rotation(now: T::BlockNumber) -> (Option, Weight) { ( - Self::next_expected_epoch_change(now), - // Read: Current Slot, Epoch Index, Genesis Slot + Self::next_expected_session_change(now), + // Read: Current Slot, Session Index, Genesis Slot T::DbWeight::get().reads(3), ) } @@ -916,7 +916,7 @@ impl OneSessionHandler for Pallet { ), ); - Self::enact_epoch_change(bounded_authorities, next_bounded_authorities) + Self::enact_session_change(bounded_authorities, next_bounded_authorities) } fn on_disabled(i: u32) { @@ -924,19 +924,19 @@ impl OneSessionHandler for Pallet { } } -// compute randomness for a new epoch. rho is the concatenation of all -// VRF outputs in the prior epoch. +// compute randomness for a new session. rho is the concatenation of all +// VRF outputs in the prior session. // // an optional size hint as to how many VRF outputs there were may be provided. fn compute_randomness( - last_epoch_randomness: schnorrkel::Randomness, - epoch_index: u64, + last_session_randomness: schnorrkel::Randomness, + session_index: u64, rho: impl Iterator, rho_size_hint: Option, ) -> schnorrkel::Randomness { let mut s = Vec::with_capacity(40 + rho_size_hint.unwrap_or(0) * VRF_OUTPUT_LENGTH); - s.extend_from_slice(&last_epoch_randomness); - s.extend_from_slice(&epoch_index.to_le_bytes()); + s.extend_from_slice(&last_session_randomness); + s.extend_from_slice(&session_index.to_le_bytes()); for vrf_output in rho { s.extend_from_slice(&vrf_output[..]); @@ -954,37 +954,37 @@ pub mod migrations { fn pallet_prefix() -> &'static str; } - struct __OldNextEpochConfig(sp_std::marker::PhantomData); - impl frame_support::traits::StorageInstance for __OldNextEpochConfig { + struct __OldNextSessionConfig(sp_std::marker::PhantomData); + impl frame_support::traits::StorageInstance for __OldNextSessionConfig { fn pallet_prefix() -> &'static str { T::pallet_prefix() } - const STORAGE_PREFIX: &'static str = "NextEpochConfig"; + const STORAGE_PREFIX: &'static str = "NextSessionConfig"; } - type OldNextEpochConfig = - StorageValue<__OldNextEpochConfig, Option, ValueQuery>; + type OldNextSessionConfig = + StorageValue<__OldNextSessionConfig, Option, ValueQuery>; - /// A storage migration that adds the current epoch configuration for Babe + /// A storage migration that adds the current session configuration for Babe /// to storage. - pub fn add_epoch_configuration( - epoch_config: BabeEpochConfiguration, + pub fn add_session_configuration( + session_config: BabeSessionConfiguration, ) -> Weight { let mut writes = 0; let mut reads = 0; - if let Some(pending_change) = OldNextEpochConfig::::get() { - PendingEpochConfigChange::::put(pending_change); + if let Some(pending_change) = OldNextSessionConfig::::get() { + PendingSessionConfigChange::::put(pending_change); writes += 1; } reads += 1; - OldNextEpochConfig::::kill(); + OldNextSessionConfig::::kill(); - EpochConfig::::put(epoch_config.clone()); - NextEpochConfig::::put(epoch_config); + SessionConfig::::put(session_config.clone()); + NextSessionConfig::::put(session_config); writes += 3; diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index 5677eb7e28e49..78ca5852f6f59 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -215,15 +215,15 @@ impl pallet_offences::Config for Test { } parameter_types! { - pub const EpochDuration: u64 = 3; + pub const SessionDuration: u64 = 3; pub const ReportLongevity: u64 = - BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); + BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * SessionDuration::get(); } impl Config for Test { - type EpochDuration = EpochDuration; + type SessionDuration = SessionDuration; type ExpectedBlockTime = ConstU64<1>; - type EpochChangeTrigger = crate::ExternalTrigger; + type SessionChangeTrigger = crate::ExternalTrigger; type DisabledValidators = Session; type KeyOwnerProofSystem = Historical; diff --git a/frame/babe/src/randomness.rs b/frame/babe/src/randomness.rs index 7be27f568e9fb..eb9299941a610 100644 --- a/frame/babe/src/randomness.rs +++ b/frame/babe/src/randomness.rs @@ -15,89 +15,89 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Provides multiple implementations of the randomness trait based on the on-chain epoch +//! Provides multiple implementations of the randomness trait based on the on-chain session //! randomness collected from VRF outputs. use super::{ - AuthorVrfRandomness, Config, EpochStart, NextRandomness, Randomness, VRF_OUTPUT_LENGTH, + AuthorVrfRandomness, Config, SessionStart, NextRandomness, Randomness, VRF_OUTPUT_LENGTH, }; use frame_support::traits::Randomness as RandomnessT; use sp_runtime::traits::Hash; /// Randomness usable by consensus protocols that **depend** upon finality and take action -/// based upon on-chain commitments made during the epoch before the previous epoch. +/// based upon on-chain commitments made during the session before the previous session. /// /// An off-chain consensus protocol requires randomness be finalized before usage, but one -/// extra epoch delay beyond `RandomnessFromOneEpochAgo` suffices, under the assumption -/// that finality never stalls for longer than one epoch. +/// extra session delay beyond `RandomnessFromOneSessionAgo` suffices, under the assumption +/// that finality never stalls for longer than one session. /// /// All randomness is relative to commitments to any other inputs to the computation: If /// Alice samples randomness near perfectly using radioactive decay, but then afterwards /// Eve selects an arbitrary value with which to xor Alice's randomness, then Eve always /// wins whatever game they play. /// -/// All input commitments used with `RandomnessFromTwoEpochsAgo` should come from at least -/// three epochs ago. We require BABE session keys be registered at least three epochs +/// All input commitments used with `RandomnessFromTwoSessionsAgo` should come from at least +/// three sessions ago. We require BABE session keys be registered at least three sessions /// before being used to derive `CurrentBlockRandomness` for example. /// -/// All users learn `RandomnessFromTwoEpochsAgo` when epoch `current_epoch - 1` starts, -/// although some learn it a few block earlier inside epoch `current_epoch - 2`. +/// All users learn `RandomnessFromTwoSessionsAgo` when session `current_session - 1` starts, +/// although some learn it a few block earlier inside session `current_session - 2`. /// /// Adversaries with enough block producers could bias this randomness by choosing upon -/// what their block producers build at the end of epoch `current_epoch - 2` or the -/// beginning epoch `current_epoch - 1`, or skipping slots at the end of epoch -/// `current_epoch - 2`. +/// what their block producers build at the end of session `current_session - 2` or the +/// beginning session `current_session - 1`, or skipping slots at the end of session +/// `current_session - 2`. /// /// Adversaries should not possess many block production slots towards the beginning or -/// end of every epoch, but they possess some influence over when they possess more slots. -pub struct RandomnessFromTwoEpochsAgo(sp_std::marker::PhantomData); +/// end of every session, but they possess some influence over when they possess more slots. +pub struct RandomnessFromTwoSessionsAgo(sp_std::marker::PhantomData); /// Randomness usable by on-chain code that **does not depend** upon finality and takes -/// action based upon on-chain commitments made during the previous epoch. +/// action based upon on-chain commitments made during the previous session. /// /// All randomness is relative to commitments to any other inputs to the computation: If /// Alice samples randomness near perfectly using radioactive decay, but then afterwards /// Eve selects an arbitrary value with which to xor Alice's randomness, then Eve always /// wins whatever game they play. /// -/// All input commitments used with `RandomnessFromOneEpochAgo` should come from at least -/// two epochs ago, although the previous epoch might work in special cases under +/// All input commitments used with `RandomnessFromOneSessionAgo` should come from at least +/// two sessions ago, although the previous session might work in special cases under /// additional assumption. /// -/// All users learn `RandomnessFromOneEpochAgo` at the end of the previous epoch, although +/// All users learn `RandomnessFromOneSessionAgo` at the end of the previous session, although /// some block producers learn it several block earlier. /// /// Adversaries with enough block producers could bias this randomness by choosing upon -/// what their block producers build at either the end of the previous epoch or the -/// beginning of the current epoch, or electing to skipping some of their own block -/// production slots towards the end of the previous epoch. +/// what their block producers build at either the end of the previous session or the +/// beginning of the current session, or electing to skipping some of their own block +/// production slots towards the end of the previous session. /// /// Adversaries should not possess many block production slots towards the beginning or -/// end of every epoch, but they possess some influence over when they possess more slots. +/// end of every session, but they possess some influence over when they possess more slots. /// /// As an example usage, we determine parachain auctions ending times in Polkadot using -/// `RandomnessFromOneEpochAgo` because it reduces bias from `CurrentBlockRandomness` and -/// does not require the extra finality delay of `RandomnessFromTwoEpochsAgo`. -pub struct RandomnessFromOneEpochAgo(sp_std::marker::PhantomData); +/// `RandomnessFromOneSessionAgo` because it reduces bias from `CurrentBlockRandomness` and +/// does not require the extra finality delay of `RandomnessFromTwoSessionsAgo`. +pub struct RandomnessFromOneSessionAgo(sp_std::marker::PhantomData); /// Randomness produced semi-freshly with each block, but inherits limitations of -/// `RandomnessFromTwoEpochsAgo` from which it derives. +/// `RandomnessFromTwoSessionsAgo` from which it derives. /// /// All randomness is relative to commitments to any other inputs to the computation: If /// Alice samples randomness near perfectly using radioactive decay, but then afterwards /// Eve selects an arbitrary value with which to xor Alice's randomness, then Eve always /// wins whatever game they play. /// -/// As with `RandomnessFromTwoEpochsAgo`, all input commitments combined with -/// `CurrentBlockRandomness` should come from at least two epoch ago, except preferably -/// not near epoch ending, and thus ideally three epochs ago. +/// As with `RandomnessFromTwoSessionsAgo`, all input commitments combined with +/// `CurrentBlockRandomness` should come from at least two session ago, except preferably +/// not near session ending, and thus ideally three sessions ago. /// /// Almost all users learn this randomness for a block when the block producer announces /// the block, which makes this randomness appear quite fresh. Yet, the block producer -/// themselves learned this randomness at the beginning of epoch `current_epoch - 2`, at -/// the same time as they learn `RandomnessFromTwoEpochsAgo`. +/// themselves learned this randomness at the beginning of session `current_session - 2`, at +/// the same time as they learn `RandomnessFromTwoSessionsAgo`. /// -/// Aside from just biasing `RandomnessFromTwoEpochsAgo`, adversaries could also bias +/// Aside from just biasing `RandomnessFromTwoSessionsAgo`, adversaries could also bias /// `CurrentBlockRandomness` by never announcing their block if doing so yields an /// unfavorable randomness. As such, `CurrentBlockRandomness` should be considered weaker /// than both other randomness sources provided by BABE, but `CurrentBlockRandomness` @@ -110,26 +110,26 @@ pub struct RandomnessFromOneEpochAgo(sp_std::marker::PhantomData); /// slashing. Any parachain with slashing could operate BABE itself or perhaps better yet /// a BABE-like approach that derives its `CurrentBlockRandomness`, and authorizes block /// production, based upon the relay parent's `CurrentBlockRandomness` or more likely the -/// relay parent's `RandomnessFromTwoEpochsAgo`. +/// relay parent's `RandomnessFromTwoSessionsAgo`. pub struct CurrentBlockRandomness(sp_std::marker::PhantomData); -impl RandomnessT for RandomnessFromTwoEpochsAgo { +impl RandomnessT for RandomnessFromTwoSessionsAgo { fn random(subject: &[u8]) -> (T::Hash, T::BlockNumber) { let mut subject = subject.to_vec(); subject.reserve(VRF_OUTPUT_LENGTH); subject.extend_from_slice(&Randomness::::get()[..]); - (T::Hashing::hash(&subject[..]), EpochStart::::get().0) + (T::Hashing::hash(&subject[..]), SessionStart::::get().0) } } -impl RandomnessT for RandomnessFromOneEpochAgo { +impl RandomnessT for RandomnessFromOneSessionAgo { fn random(subject: &[u8]) -> (T::Hash, T::BlockNumber) { let mut subject = subject.to_vec(); subject.reserve(VRF_OUTPUT_LENGTH); subject.extend_from_slice(&NextRandomness::::get()[..]); - (T::Hashing::hash(&subject[..]), EpochStart::::get().1) + (T::Hashing::hash(&subject[..]), SessionStart::::get().1) } } diff --git a/frame/babe/src/tests.rs b/frame/babe/src/tests.rs index 65c9de85586e4..71bc04def17f2 100644 --- a/frame/babe/src/tests.rs +++ b/frame/babe/src/tests.rs @@ -25,7 +25,7 @@ use frame_support::{ }; use mock::*; use pallet_session::ShouldEndSession; -use sp_consensus_babe::{AllowedSlots, BabeEpochConfiguration, Slot}; +use sp_consensus_babe::{AllowedSlots, BabeSessionConfiguration, Slot}; use sp_core::crypto::Pair; const EMPTY_RANDOMNESS: [u8; 32] = [ @@ -50,13 +50,13 @@ fn check_module() { assert!(!Babe::should_end_session(0), "Genesis does not change sessions"); assert!( !Babe::should_end_session(200000), - "BABE does not include the block number in epoch calculations" + "BABE does not include the block number in session calculations" ); }) } #[test] -fn first_block_epoch_zero_start() { +fn first_block_session_zero_start() { let (pairs, mut ext) = new_test_ext_with_pairs(4); ext.execute_with(|| { @@ -71,11 +71,11 @@ fn first_block_epoch_zero_start() { System::initialize(&1, &Default::default(), &pre_digest); // see implementation of the function for details why: we issue an - // epoch-change digest but don't do it via the normal session mechanism. + // session-change digest but don't do it via the normal session mechanism. assert!(!Babe::should_end_session(1)); assert_eq!(Babe::genesis_slot(), genesis_slot); assert_eq!(Babe::current_slot(), genesis_slot); - assert_eq!(Babe::epoch_index(), 0); + assert_eq!(Babe::session_index(), 0); assert_eq!(Babe::author_vrf_randomness(), Some(vrf_randomness)); Babe::on_finalize(1); @@ -91,15 +91,15 @@ fn first_block_epoch_zero_start() { assert_eq!(pre_digest.logs.len(), 1); assert_eq!(header.digest.logs[0], pre_digest.logs[0]); - let consensus_log = sp_consensus_babe::ConsensusLog::NextEpochData( - sp_consensus_babe::digests::NextEpochDescriptor { + let consensus_log = sp_consensus_babe::ConsensusLog::NextSessionData( + sp_consensus_babe::digests::NextSessionDescriptor { authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), }, ); let consensus_digest = DigestItem::Consensus(BABE_ENGINE_ID, consensus_log.encode()); - // first epoch descriptor has same info as last. + // first session descriptor has same info as last. assert_eq!(header.digest.logs[1], consensus_digest.clone()) }) } @@ -178,39 +178,39 @@ fn authority_index() { } #[test] -fn can_predict_next_epoch_change() { +fn can_predict_next_session_change() { new_test_ext(1).execute_with(|| { - assert_eq!(::EpochDuration::get(), 3); + assert_eq!(::SessionDuration::get(), 3); // this sets the genesis slot to 6; go_to_block(1, 6); assert_eq!(*Babe::genesis_slot(), 6); assert_eq!(*Babe::current_slot(), 6); - assert_eq!(Babe::epoch_index(), 0); + assert_eq!(Babe::session_index(), 0); progress_to_block(5); - assert_eq!(Babe::epoch_index(), 5 / 3); + assert_eq!(Babe::session_index(), 5 / 3); assert_eq!(*Babe::current_slot(), 10); - // next epoch change will be at - assert_eq!(*Babe::current_epoch_start(), 9); // next change will be 12, 2 slots from now - assert_eq!(Babe::next_expected_epoch_change(System::block_number()), Some(5 + 2)); + // next session change will be at + assert_eq!(*Babe::current_session_start(), 9); // next change will be 12, 2 slots from now + assert_eq!(Babe::next_expected_session_change(System::block_number()), Some(5 + 2)); }) } #[test] -fn can_estimate_current_epoch_progress() { +fn can_estimate_current_session_progress() { new_test_ext(1).execute_with(|| { - assert_eq!(::EpochDuration::get(), 3); + assert_eq!(::SessionDuration::get(), 3); - // with BABE the genesis block is not part of any epoch, the first epoch starts at block #1, + // with BABE the genesis block is not part of any session, the first session starts at block #1, // therefore its last block should be #3 for i in 1u64..4 { progress_to_block(i); assert_eq!(Babe::estimate_next_session_rotation(i).0.unwrap(), 4); - // the last block of the epoch must have 100% progress. + // the last block of the session must have 100% progress. if Babe::estimate_next_session_rotation(i).0.unwrap() - 1 == i { assert_eq!( Babe::estimate_current_session_progress(i).0.unwrap(), @@ -224,7 +224,7 @@ fn can_estimate_current_epoch_progress() { } } - // the first block of the new epoch counts towards the epoch progress as well + // the first block of the new session counts towards the session progress as well progress_to_block(4); assert_eq!( Babe::estimate_current_session_progress(4).0.unwrap(), @@ -236,33 +236,33 @@ fn can_estimate_current_epoch_progress() { #[test] fn can_enact_next_config() { new_test_ext(1).execute_with(|| { - assert_eq!(::EpochDuration::get(), 3); + assert_eq!(::SessionDuration::get(), 3); // this sets the genesis slot to 6; go_to_block(1, 6); assert_eq!(*Babe::genesis_slot(), 6); assert_eq!(*Babe::current_slot(), 6); - assert_eq!(Babe::epoch_index(), 0); + assert_eq!(Babe::session_index(), 0); go_to_block(2, 7); - let current_config = BabeEpochConfiguration { + let current_config = BabeSessionConfiguration { c: (0, 4), allowed_slots: sp_consensus_babe::AllowedSlots::PrimarySlots, }; - let next_config = BabeEpochConfiguration { + let next_config = BabeSessionConfiguration { c: (1, 4), allowed_slots: sp_consensus_babe::AllowedSlots::PrimarySlots, }; - let next_next_config = BabeEpochConfiguration { + let next_next_config = BabeSessionConfiguration { c: (2, 4), allowed_slots: sp_consensus_babe::AllowedSlots::PrimarySlots, }; - EpochConfig::::put(current_config); - NextEpochConfig::::put(next_config.clone()); + SessionConfig::::put(current_config); + NextSessionConfig::::put(next_config.clone()); - assert_eq!(NextEpochConfig::::get(), Some(next_config.clone())); + assert_eq!(NextSessionConfig::::get(), Some(next_config.clone())); Babe::plan_config_change( Origin::root(), @@ -277,8 +277,8 @@ fn can_enact_next_config() { Babe::on_finalize(9); let header = System::finalize(); - assert_eq!(EpochConfig::::get(), Some(next_config)); - assert_eq!(NextEpochConfig::::get(), Some(next_next_config.clone())); + assert_eq!(SessionConfig::::get(), Some(next_config)); + assert_eq!(NextSessionConfig::::get(), Some(next_next_config.clone())); let consensus_log = sp_consensus_babe::ConsensusLog::NextConfigData(NextConfigDescriptor::V1 { @@ -314,61 +314,61 @@ fn only_root_can_enact_config_change() { } #[test] -fn can_fetch_current_and_next_epoch_data() { +fn can_fetch_current_and_next_session_data() { new_test_ext(5).execute_with(|| { - EpochConfig::::put(BabeEpochConfiguration { + SessionConfig::::put(BabeSessionConfiguration { c: (1, 4), allowed_slots: sp_consensus_babe::AllowedSlots::PrimarySlots, }); - // genesis authorities should be used for the first and second epoch - assert_eq!(Babe::current_epoch().authorities, Babe::next_epoch().authorities); - // 1 era = 3 epochs - // 1 epoch = 3 slots + // genesis authorities should be used for the first and second session + assert_eq!(Babe::current_session().authorities, Babe::next_session().authorities); + // 1 era = 3 sessions + // 1 session = 3 slots // Eras start from 0. - // Therefore at era 1 we should be starting epoch 3 with slot 10. + // Therefore at era 1 we should be starting session 3 with slot 10. start_era(1); - let current_epoch = Babe::current_epoch(); - assert_eq!(current_epoch.epoch_index, 3); - assert_eq!(*current_epoch.start_slot, 10); - assert_eq!(current_epoch.authorities.len(), 5); + let current_session = Babe::current_session(); + assert_eq!(current_session.session_index, 3); + assert_eq!(*current_session.start_slot, 10); + assert_eq!(current_session.authorities.len(), 5); - let next_epoch = Babe::next_epoch(); - assert_eq!(next_epoch.epoch_index, 4); - assert_eq!(*next_epoch.start_slot, 13); - assert_eq!(next_epoch.authorities.len(), 5); + let next_session = Babe::next_session(); + assert_eq!(next_session.session_index, 4); + assert_eq!(*next_session.start_slot, 13); + assert_eq!(next_session.authorities.len(), 5); - // the on-chain randomness should always change across epochs - assert!(current_epoch.randomness != next_epoch.randomness); + // the on-chain randomness should always change across sessions + assert!(current_session.randomness != next_session.randomness); // but in this case the authorities stay the same - assert!(current_epoch.authorities == next_epoch.authorities); + assert!(current_session.authorities == next_session.authorities); }); } #[test] -fn tracks_block_numbers_when_current_and_previous_epoch_started() { +fn tracks_block_numbers_when_current_and_previous_session_started() { new_test_ext(5).execute_with(|| { - // an epoch is 3 slots therefore at block 8 we should be in epoch #3 - // with the previous epochs having the following blocks: - // epoch 1 - [1, 2, 3] - // epoch 2 - [4, 5, 6] - // epoch 3 - [7, 8, 9] + // an session is 3 slots therefore at block 8 we should be in session #3 + // with the previous sessions having the following blocks: + // session 1 - [1, 2, 3] + // session 2 - [4, 5, 6] + // session 3 - [7, 8, 9] progress_to_block(8); - let (last_epoch, current_epoch) = EpochStart::::get(); + let (last_session, current_session) = SessionStart::::get(); - assert_eq!(last_epoch, 4); - assert_eq!(current_epoch, 7); + assert_eq!(last_session, 4); + assert_eq!(current_session, 7); - // once we reach block 10 we switch to epoch #4 + // once we reach block 10 we switch to session #4 progress_to_block(10); - let (last_epoch, current_epoch) = EpochStart::::get(); + let (last_session, current_session) = SessionStart::::get(); - assert_eq!(last_epoch, 7); - assert_eq!(current_epoch, 10); + assert_eq!(last_session, 7); + assert_eq!(current_session, 10); }); } @@ -862,7 +862,7 @@ fn valid_equivocation_reports_dont_pay_fees() { } #[test] -fn add_epoch_configurations_migration_works() { +fn add_session_configurations_migration_works() { use frame_support::storage::migration::{get_storage_value, put_storage_value}; impl crate::migrations::BabePalletPrefix for Test { @@ -875,30 +875,30 @@ fn add_epoch_configurations_migration_works() { let next_config_descriptor = NextConfigDescriptor::V1 { c: (3, 4), allowed_slots: AllowedSlots::PrimarySlots }; - put_storage_value(b"Babe", b"NextEpochConfig", &[], Some(next_config_descriptor.clone())); + put_storage_value(b"Babe", b"NextSessionConfig", &[], Some(next_config_descriptor.clone())); assert!(get_storage_value::>( b"Babe", - b"NextEpochConfig", + b"NextSessionConfig", &[], ) .is_some()); - let current_epoch = BabeEpochConfiguration { + let current_session = BabeSessionConfiguration { c: (1, 4), allowed_slots: sp_consensus_babe::AllowedSlots::PrimarySlots, }; - crate::migrations::add_epoch_configuration::(current_epoch.clone()); + crate::migrations::add_session_configuration::(current_session.clone()); assert!(get_storage_value::>( b"Babe", - b"NextEpochConfig", + b"NextSessionConfig", &[], ) .is_none()); - assert_eq!(EpochConfig::::get(), Some(current_epoch)); - assert_eq!(PendingEpochConfigChange::::get(), Some(next_config_descriptor)); + assert_eq!(SessionConfig::::get(), Some(current_session)); + assert_eq!(PendingSessionConfigChange::::get(), Some(next_config_descriptor)); }); } diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index a9e341bad600f..f1ffa076953ed 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -1612,7 +1612,7 @@ mod feasibility_check { use super::*; use crate::mock::{ - raw_solution, roll_to, EpochLength, ExtBuilder, MultiPhase, Runtime, SignedPhase, + raw_solution, roll_to, SessionLength, ExtBuilder, MultiPhase, Runtime, SignedPhase, TargetIndex, UnsignedPhase, VoterIndex, }; use frame_support::{assert_noop, assert_ok}; @@ -1622,7 +1622,7 @@ mod feasibility_check { #[test] fn snapshot_is_there() { ExtBuilder::default().build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let solution = raw_solution(); @@ -1639,7 +1639,7 @@ mod feasibility_check { #[test] fn round() { ExtBuilder::default().build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let mut solution = raw_solution(); @@ -1654,7 +1654,7 @@ mod feasibility_check { #[test] fn desired_targets_gets_capped() { ExtBuilder::default().desired_targets(8).build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let raw = raw_solution(); @@ -1671,7 +1671,7 @@ mod feasibility_check { #[test] fn less_than_desired_targets_fails() { ExtBuilder::default().desired_targets(8).build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let mut raw = raw_solution(); @@ -1694,7 +1694,7 @@ mod feasibility_check { #[test] fn winner_indices() { ExtBuilder::default().desired_targets(2).build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let mut raw = raw_solution(); @@ -1728,7 +1728,7 @@ mod feasibility_check { fn voter_indices() { // Should be caught in `solution.into_assignment`. ExtBuilder::default().desired_targets(2).build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let mut solution = raw_solution(); @@ -1755,7 +1755,7 @@ mod feasibility_check { #[test] fn voter_votes() { ExtBuilder::default().desired_targets(2).build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let mut solution = raw_solution(); @@ -1784,7 +1784,7 @@ mod feasibility_check { #[test] fn score() { ExtBuilder::default().desired_targets(2).build_and_execute(|| { - roll_to(::get() - ::get() - ::get()); + roll_to(::get() - ::get() - ::get()); assert!(MultiPhase::current_phase().is_signed()); let mut solution = raw_solution(); diff --git a/frame/election-provider-multi-phase/src/mock.rs b/frame/election-provider-multi-phase/src/mock.rs index 38d9c8dfc1b7e..080ddcd577155 100644 --- a/frame/election-provider-multi-phase/src/mock.rs +++ b/frame/election-provider-multi-phase/src/mock.rs @@ -273,7 +273,7 @@ parameter_types! { pub static MaxElectingVoters: VoterIndex = u32::max_value(); pub static MaxElectableTargets: TargetIndex = TargetIndex::max_value(); - pub static EpochLength: u64 = 30; + pub static SessionLength: u64 = 30; pub static OnChainFallback: bool = true; } @@ -492,7 +492,7 @@ impl ElectionDataProvider for StakingMock { } fn next_election_prediction(now: u64) -> u64 { - now + EpochLength::get() - now % EpochLength::get() + now + SessionLength::get() - now % SessionLength::get() } #[cfg(feature = "runtime-benchmarks")] diff --git a/frame/election-provider-multi-phase/src/weights.rs b/frame/election-provider-multi-phase/src/weights.rs index 54c519681922b..60d43a14033fd 100644 --- a/frame/election-provider-multi-phase/src/weights.rs +++ b/frame/election-provider-multi-phase/src/weights.rs @@ -62,7 +62,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Staking CurrentEra (r:1 w:0) // Storage: Staking CurrentPlannedSession (r:1 w:0) // Storage: Staking ErasStartSessionIndex (r:1 w:0) - // Storage: Babe EpochIndex (r:1 w:0) + // Storage: Babe SessionIndex (r:1 w:0) // Storage: Babe GenesisSlot (r:1 w:0) // Storage: Babe CurrentSlot (r:1 w:0) // Storage: Staking ForceEra (r:1 w:0) @@ -179,7 +179,7 @@ impl WeightInfo for () { // Storage: Staking CurrentEra (r:1 w:0) // Storage: Staking CurrentPlannedSession (r:1 w:0) // Storage: Staking ErasStartSessionIndex (r:1 w:0) - // Storage: Babe EpochIndex (r:1 w:0) + // Storage: Babe SessionIndex (r:1 w:0) // Storage: Babe GenesisSlot (r:1 w:0) // Storage: Babe CurrentSlot (r:1 w:0) // Storage: Staking ForceEra (r:1 w:0) diff --git a/primitives/beefy/src/commitment.rs b/primitives/beefy/src/commitment.rs index ed392139de13f..82d049bab3a49 100644 --- a/primitives/beefy/src/commitment.rs +++ b/primitives/beefy/src/commitment.rs @@ -100,13 +100,13 @@ pub struct Commitment { /// There might be multiple rounds in progress (depending on the block choice rule), however /// since the payload is supposed to be cumulative, it is not required to import all /// commitments. - /// BEEFY light client is expected to import at least one commitment per epoch, + /// BEEFY light client is expected to import at least one commitment per session, /// but is free to import as many as it requires. pub block_number: TBlockNumber, /// BEEFY validator set supposed to sign this commitment. /// - /// Validator set is changing once per epoch. The Light Client must be provided by details + /// Validator set is changing once per session. The Light Client must be provided by details /// about the validator set whenever it's importing first commitment with a new /// `validator_set_id`. Validator set data MUST be verifiable, for instance using /// [payload](Commitment::payload) information. diff --git a/primitives/blockchain/src/backend.rs b/primitives/blockchain/src/backend.rs index 84b34105e59b8..7a94af739c196 100644 --- a/primitives/blockchain/src/backend.rs +++ b/primitives/blockchain/src/backend.rs @@ -279,8 +279,8 @@ pub mod well_known_cache_keys { /// A list of authorities. pub const AUTHORITIES: Id = *b"auth"; - /// Current Epoch data. - pub const EPOCH: Id = *b"epch"; + /// Current Session data. + pub const SESSION: Id = *b"epch"; /// Changes trie configuration. pub const CHANGES_TRIE_CONFIG: Id = *b"chtr"; diff --git a/primitives/consensus/babe/src/digests.rs b/primitives/consensus/babe/src/digests.rs index 0f21c913ac57e..dcf70a7a096ed 100644 --- a/primitives/consensus/babe/src/digests.rs +++ b/primitives/consensus/babe/src/digests.rs @@ -19,7 +19,7 @@ use super::{ AllowedSlots, AuthorityId, AuthorityIndex, AuthoritySignature, BabeAuthorityWeight, - BabeEpochConfiguration, Slot, BABE_ENGINE_ID, + BabeSessionConfiguration, Slot, BABE_ENGINE_ID, }; use codec::{Decode, Encode, MaxEncodedLen}; use sp_runtime::{DigestItem, RuntimeDebug}; @@ -46,7 +46,7 @@ pub struct SecondaryPlainPreDigest { /// Authority index /// /// This is not strictly-speaking necessary, since the secondary slots - /// are assigned based on slot number and epoch randomness. But including + /// are assigned based on slot number and session randomness. But including /// it makes things easier for higher-level users of the chain data to /// be aware of the author of a secondary-slot block. pub authority_index: super::AuthorityIndex, @@ -121,10 +121,10 @@ impl PreDigest { } } -/// Information about the next epoch. This is broadcast in the first block -/// of the epoch. +/// Information about the next session. This is broadcast in the first block +/// of the session. #[derive(Decode, Encode, PartialEq, Eq, Clone, RuntimeDebug)] -pub struct NextEpochDescriptor { +pub struct NextSessionDescriptor { /// The authorities. pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, @@ -132,8 +132,8 @@ pub struct NextEpochDescriptor { pub randomness: Randomness, } -/// Information about the next epoch config, if changed. This is broadcast in the first -/// block of the epoch, and applies using the same rules as `NextEpochDescriptor`. +/// Information about the next session config, if changed. This is broadcast in the first +/// block of the session, and applies using the same rules as `NextSessionDescriptor`. #[derive( Decode, Encode, PartialEq, Eq, Clone, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, )] @@ -141,14 +141,14 @@ pub enum NextConfigDescriptor { /// Version 1. #[codec(index = 1)] V1 { - /// Value of `c` in `BabeEpochConfiguration`. + /// Value of `c` in `BabeSessionConfiguration`. c: (u64, u64), - /// Value of `allowed_slots` in `BabeEpochConfiguration`. + /// Value of `allowed_slots` in `BabeSessionConfiguration`. allowed_slots: AllowedSlots, }, } -impl From for BabeEpochConfiguration { +impl From for BabeSessionConfiguration { fn from(desc: NextConfigDescriptor) -> Self { match desc { NextConfigDescriptor::V1 { c, allowed_slots } => Self { c, allowed_slots }, @@ -170,8 +170,8 @@ pub trait CompatibleDigestItem: Sized { /// If this item is a BABE signature, return the signature. fn as_babe_seal(&self) -> Option; - /// If this item is a BABE epoch descriptor, return it. - fn as_next_epoch_descriptor(&self) -> Option; + /// If this item is a BABE session descriptor, return it. + fn as_next_session_descriptor(&self) -> Option; /// If this item is a BABE config descriptor, return it. fn as_next_config_descriptor(&self) -> Option; @@ -194,10 +194,10 @@ impl CompatibleDigestItem for DigestItem { self.seal_try_to(&BABE_ENGINE_ID) } - fn as_next_epoch_descriptor(&self) -> Option { + fn as_next_session_descriptor(&self) -> Option { self.consensus_try_to(&BABE_ENGINE_ID) .and_then(|x: super::ConsensusLog| match x { - super::ConsensusLog::NextEpochData(n) => Some(n), + super::ConsensusLog::NextSessionData(n) => Some(n), _ => None, }) } diff --git a/primitives/consensus/babe/src/lib.rs b/primitives/consensus/babe/src/lib.rs index 492d1a9a7238f..769376046bb05 100644 --- a/primitives/consensus/babe/src/lib.rs +++ b/primitives/consensus/babe/src/lib.rs @@ -37,7 +37,7 @@ use sp_keystore::vrf::{VRFTranscriptData, VRFTranscriptValue}; use sp_runtime::{traits::Header, ConsensusEngineId, RuntimeDebug}; use sp_std::vec::Vec; -use crate::digests::{NextConfigDescriptor, NextEpochDescriptor}; +use crate::digests::{NextConfigDescriptor, NextSessionDescriptor}; /// Key type for BABE module. pub const KEY_TYPE: sp_core::crypto::KeyTypeId = sp_application_crypto::key_types::BABE; @@ -73,7 +73,7 @@ pub const PUBLIC_KEY_LENGTH: usize = 32; /// How many blocks to wait before running the median algorithm for relative time /// This will not vary from chain to chain as it is not dependent on slot duration -/// or epoch length. +/// or session length. pub const MEDIAN_ALGORITHM_CARDINALITY: usize = 1200; // arbitrary suggestion by w3f-research. /// The index of an authority. @@ -96,23 +96,23 @@ pub type BabeAuthorityWeight = u64; /// of 0 (regardless of whether they are plain or vrf secondary blocks). pub type BabeBlockWeight = u32; -/// Make a VRF transcript from given randomness, slot number and epoch. -pub fn make_transcript(randomness: &Randomness, slot: Slot, epoch: u64) -> Transcript { +/// Make a VRF transcript from given randomness, slot number and session. +pub fn make_transcript(randomness: &Randomness, slot: Slot, session: u64) -> Transcript { let mut transcript = Transcript::new(&BABE_ENGINE_ID); transcript.append_u64(b"slot number", *slot); - transcript.append_u64(b"current epoch", epoch); + transcript.append_u64(b"current session", session); transcript.append_message(b"chain randomness", &randomness[..]); transcript } /// Make a VRF transcript data container #[cfg(feature = "std")] -pub fn make_transcript_data(randomness: &Randomness, slot: Slot, epoch: u64) -> VRFTranscriptData { +pub fn make_transcript_data(randomness: &Randomness, slot: Slot, session: u64) -> VRFTranscriptData { VRFTranscriptData { label: &BABE_ENGINE_ID, items: vec![ ("slot number", VRFTranscriptValue::U64(*slot)), - ("current epoch", VRFTranscriptValue::U64(epoch)), + ("current session", VRFTranscriptValue::U64(session)), ("chain randomness", VRFTranscriptValue::Bytes(randomness.to_vec())), ], } @@ -121,16 +121,16 @@ pub fn make_transcript_data(randomness: &Randomness, slot: Slot, epoch: u64) -> /// An consensus log item for BABE. #[derive(Decode, Encode, Clone, PartialEq, Eq)] pub enum ConsensusLog { - /// The epoch has changed. This provides information about the _next_ - /// epoch - information about the _current_ epoch (i.e. the one we've just + /// The session has changed. This provides information about the _next_ + /// session - information about the _current_ session (i.e. the one we've just /// entered) should already be available earlier in the chain. #[codec(index = 1)] - NextEpochData(NextEpochDescriptor), + NextSessionData(NextSessionDescriptor), /// Disable the authority with given index. #[codec(index = 2)] OnDisabled(AuthorityIndex), - /// The epoch has changed, and the epoch after the current one will - /// enact different epoch configurations. + /// The session has changed, and the session after the current one will + /// enact different session configurations. #[codec(index = 3)] NextConfigData(NextConfigDescriptor), } @@ -144,8 +144,8 @@ pub struct BabeGenesisConfigurationV1 { /// Dynamic slot duration may be supported in the future. pub slot_duration: u64, - /// The duration of epochs in slots. - pub epoch_length: u64, + /// The duration of sessions in slots. + pub session_length: u64, /// A constant value that is used in the threshold calculation formula. /// Expressed as a rational where the first member of the tuple is the @@ -155,10 +155,10 @@ pub struct BabeGenesisConfigurationV1 { /// of a slot being empty. pub c: (u64, u64), - /// The authorities for the genesis epoch. + /// The authorities for the genesis session. pub genesis_authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, - /// The randomness for the genesis epoch. + /// The randomness for the genesis session. pub randomness: Randomness, /// Whether this chain should run with secondary slots, which are assigned @@ -170,7 +170,7 @@ impl From for BabeGenesisConfiguration { fn from(v1: BabeGenesisConfigurationV1) -> Self { Self { slot_duration: v1.slot_duration, - epoch_length: v1.epoch_length, + session_length: v1.session_length, c: v1.c, genesis_authorities: v1.genesis_authorities, randomness: v1.randomness, @@ -192,8 +192,8 @@ pub struct BabeGenesisConfiguration { /// Dynamic slot duration may be supported in the future. pub slot_duration: u64, - /// The duration of epochs in slots. - pub epoch_length: u64, + /// The duration of sessions in slots. + pub session_length: u64, /// A constant value that is used in the threshold calculation formula. /// Expressed as a rational where the first member of the tuple is the @@ -203,10 +203,10 @@ pub struct BabeGenesisConfiguration { /// of a slot being empty. pub c: (u64, u64), - /// The authorities for the genesis epoch. + /// The authorities for the genesis session. pub genesis_authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, - /// The randomness for the genesis epoch. + /// The randomness for the genesis session. pub randomness: Randomness, /// Type of allowed slots. @@ -240,7 +240,7 @@ impl AllowedSlots { /// Configuration data used by the BABE consensus engine. #[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct BabeEpochConfiguration { +pub struct BabeSessionConfiguration { /// A constant value that is used in the threshold calculation formula. /// Expressed as a rational where the first member of the tuple is the /// numerator and the second is the denominator. The rational should @@ -336,21 +336,21 @@ impl OpaqueKeyOwnershipProof { } } -/// BABE epoch information +/// BABE session information #[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)] -pub struct Epoch { - /// The epoch index. - pub epoch_index: u64, - /// The starting slot of the epoch. +pub struct Session { + /// The session index. + pub session_index: u64, + /// The starting slot of the session. pub start_slot: Slot, - /// The duration of this epoch. + /// The duration of this session. pub duration: u64, /// The authorities and their weights. pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, - /// Randomness for this epoch. + /// Randomness for this session. pub randomness: [u8; VRF_OUTPUT_LENGTH], - /// Configuration of the epoch. - pub config: BabeEpochConfiguration, + /// Configuration of the session. + pub config: BabeSessionConfiguration, } sp_api::decl_runtime_apis! { @@ -364,25 +364,25 @@ sp_api::decl_runtime_apis! { #[changed_in(2)] fn configuration() -> BabeGenesisConfigurationV1; - /// Returns the slot that started the current epoch. - fn current_epoch_start() -> Slot; + /// Returns the slot that started the current session. + fn current_session_start() -> Slot; - /// Returns information regarding the current epoch. - fn current_epoch() -> Epoch; + /// Returns information regarding the current session. + fn current_session() -> Session; - /// Returns information regarding the next epoch (which was already + /// Returns information regarding the next session (which was already /// previously announced). - fn next_epoch() -> Epoch; + fn next_session() -> Session; /// Generates a proof of key ownership for the given authority in the - /// current epoch. An example usage of this module is coupled with the + /// current session. An example usage of this module is coupled with the /// session historical module to prove that a given authority key is /// tied to a given staking identity during a specific session. Proofs /// of key ownership are necessary for submitting equivocation reports. /// NOTE: even though the API takes a `slot` as parameter the current /// implementations ignores this parameter and instead relies on this /// method being called at the correct block height, i.e. any point at - /// which the epoch for the given slot is live on-chain. Future + /// which the session for the given slot is live on-chain. Future /// implementations will instead use indexed data through an offchain /// worker, not requiring older states to be available. fn generate_key_ownership_proof( diff --git a/primitives/staking/src/offence.rs b/primitives/staking/src/offence.rs index 4261063993a52..d290199516000 100644 --- a/primitives/staking/src/offence.rs +++ b/primitives/staking/src/offence.rs @@ -99,7 +99,7 @@ pub trait Offence { /// both `session_index` and `time_slot` are equal. /// /// As an example, for GRANDPA timescale could be a round number and for BABE it could be a slot - /// number. Note that for GRANDPA the round number is reset each epoch. + /// number. Note that for GRANDPA the round number is reset each session. fn time_slot(&self) -> Self::TimeSlot; /// In which cases this offence needs to disable offenders until the next era starts. diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 94325ae9c1ab1..91822b1fea2ce 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -599,16 +599,16 @@ impl pallet_timestamp::Config for Runtime { } parameter_types! { - pub const EpochDuration: u64 = 6; + pub const SessionDuration: u64 = 6; } impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDuration; + type SessionDuration = SessionDuration; type ExpectedBlockTime = ConstU64<10_000>; // there is no actual runtime in this test-runtime, so testing crates // are manually adding the digests. normally in this situation you'd use // pallet_babe::SameAuthoritiesForever. - type EpochChangeTrigger = pallet_babe::ExternalTrigger; + type SessionChangeTrigger = pallet_babe::ExternalTrigger; type DisabledValidators = (); type KeyOwnerProofSystem = (); @@ -841,7 +841,7 @@ cfg_if! { fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration { sp_consensus_babe::BabeGenesisConfiguration { slot_duration: 1000, - epoch_length: EpochDuration::get(), + session_length: SessionDuration::get(), c: (3, 10), genesis_authorities: system::authorities() .into_iter().map(|x|(x, 1)).collect(), @@ -850,16 +850,16 @@ cfg_if! { } } - fn current_epoch_start() -> Slot { - >::current_epoch_start() + fn current_session_start() -> Slot { + >::current_session_start() } - fn current_epoch() -> sp_consensus_babe::Epoch { - >::current_epoch() + fn current_session() -> sp_consensus_babe::Session { + >::current_session() } - fn next_epoch() -> sp_consensus_babe::Epoch { - >::next_epoch() + fn next_session() -> sp_consensus_babe::Session { + >::next_session() } fn submit_report_equivocation_unsigned_extrinsic( @@ -1105,7 +1105,7 @@ cfg_if! { fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration { sp_consensus_babe::BabeGenesisConfiguration { slot_duration: 1000, - epoch_length: EpochDuration::get(), + session_length: SessionDuration::get(), c: (3, 10), genesis_authorities: system::authorities() .into_iter().map(|x|(x, 1)).collect(), @@ -1114,16 +1114,16 @@ cfg_if! { } } - fn current_epoch_start() -> Slot { - >::current_epoch_start() + fn current_session_start() -> Slot { + >::current_session_start() } - fn current_epoch() -> sp_consensus_babe::Epoch { - >::current_epoch() + fn current_session() -> sp_consensus_babe::Session { + >::current_session() } - fn next_epoch() -> sp_consensus_babe::Epoch { - >::next_epoch() + fn next_session() -> sp_consensus_babe::Session { + >::next_session() } fn submit_report_equivocation_unsigned_extrinsic( From 860fa3feadb558678c451a00924efe374b9cba11 Mon Sep 17 00:00:00 2001 From: Maduka Terrence Date: Fri, 6 May 2022 07:43:47 +0000 Subject: [PATCH 2/3] refactor renaming based on api_version --- client/consensus/babe/src/aux_schema.rs | 6 +++--- primitives/consensus/babe/src/lib.rs | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/client/consensus/babe/src/aux_schema.rs b/client/consensus/babe/src/aux_schema.rs index 038c43729bf20..ff337ff4dc28b 100644 --- a/client/consensus/babe/src/aux_schema.rs +++ b/client/consensus/babe/src/aux_schema.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! Schema for BABE session changes in the aux-db. +//! Schema for BABE session(formerly known as 'BABE epoch') changes in the aux-db. use codec::{Decode, Encode}; use log::info; @@ -31,8 +31,8 @@ use sp_blockchain::{Error as ClientError, Result as ClientResult}; use sp_consensus_babe::{BabeBlockWeight, BabeGenesisConfiguration}; use sp_runtime::traits::Block as BlockT; -const BABE_EPOCH_CHANGES_VERSION: &[u8] = b"babe_session_changes_version"; -const BABE_EPOCH_CHANGES_KEY: &[u8] = b"babe_session_changes"; +const BABE_EPOCH_CHANGES_VERSION: &[u8] = b"babe_epoch_changes_version"; +const BABE_EPOCH_CHANGES_KEY: &[u8] = b"babe_epoch_changes"; const BABE_EPOCH_CHANGES_CURRENT_VERSION: u32 = 3; /// The aux storage key used to store the block weight of the given block hash. diff --git a/primitives/consensus/babe/src/lib.rs b/primitives/consensus/babe/src/lib.rs index 769376046bb05..267a217f63173 100644 --- a/primitives/consensus/babe/src/lib.rs +++ b/primitives/consensus/babe/src/lib.rs @@ -73,7 +73,7 @@ pub const PUBLIC_KEY_LENGTH: usize = 32; /// How many blocks to wait before running the median algorithm for relative time /// This will not vary from chain to chain as it is not dependent on slot duration -/// or session length. +/// or session(formerly known as epoch) length. pub const MEDIAN_ALGORITHM_CARDINALITY: usize = 1200; // arbitrary suggestion by w3f-research. /// The index of an authority. @@ -364,25 +364,28 @@ sp_api::decl_runtime_apis! { #[changed_in(2)] fn configuration() -> BabeGenesisConfigurationV1; - /// Returns the slot that started the current session. + /// Returns the slot that started the current epoch. + #[renamed("current_epoch_start", 2)] fn current_session_start() -> Slot; - /// Returns information regarding the current session. + /// Returns information regarding the current epoch. + #[renamed("current_epoch", 2)] fn current_session() -> Session; - /// Returns information regarding the next session (which was already + /// Returns information regarding the next epoch (which was already /// previously announced). + #[renamed("next_epoch", 2)] fn next_session() -> Session; /// Generates a proof of key ownership for the given authority in the - /// current session. An example usage of this module is coupled with the - /// session historical module to prove that a given authority key is - /// tied to a given staking identity during a specific session. Proofs + /// current epoch. An example usage of this module is coupled with the + /// epoch historical module to prove that a given authority key is + /// tied to a given staking identity during a specific epoch. Proofs /// of key ownership are necessary for submitting equivocation reports. /// NOTE: even though the API takes a `slot` as parameter the current /// implementations ignores this parameter and instead relies on this /// method being called at the correct block height, i.e. any point at - /// which the session for the given slot is live on-chain. Future + /// which the epoch for the given slot is live on-chain. Future /// implementations will instead use indexed data through an offchain /// worker, not requiring older states to be available. fn generate_key_ownership_proof( From 8cc1984b60a9e02f042388e4f5402a7d1e0a74f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 7 May 2022 09:51:24 +0000 Subject: [PATCH 3/3] Bump tokio from 1.18.0 to 1.18.1 Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.18.0 to 1.18.1. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.18.0...tokio-1.18.1) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- bin/node/cli/Cargo.toml | 2 +- client/beefy/Cargo.toml | 2 +- client/cli/Cargo.toml | 2 +- client/consensus/manual-seal/Cargo.toml | 2 +- client/finality-grandpa/Cargo.toml | 2 +- client/offchain/Cargo.toml | 2 +- client/rpc-servers/Cargo.toml | 2 +- client/service/Cargo.toml | 2 +- client/service/test/Cargo.toml | 2 +- frame/state-trie-migration/Cargo.toml | 2 +- test-utils/test-crate/Cargo.toml | 2 +- utils/frame/remote-externalities/Cargo.toml | 2 +- utils/frame/rpc/support/Cargo.toml | 2 +- utils/prometheus/Cargo.toml | 4 ++-- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 519f9a5fcc3bc..48bce4e030530 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11295,9 +11295,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.18.0" +version = "1.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f48b6d60512a392e34dbf7fd456249fd2de3c83669ab642e021903f4015185b" +checksum = "dce653fb475565de9f6fb0614b28bca8df2c430c0cf84bcd9c843f15de5414cc" dependencies = [ "bytes 1.1.0", "libc", diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 20db0182f579e..5fc28199e353d 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -128,7 +128,7 @@ platforms = "2.0" async-std = { version = "1.11.0", features = ["attributes"] } soketto = "0.7.1" criterion = { version = "0.3.5", features = ["async_tokio"] } -tokio = { version = "1.17.0", features = ["macros", "time", "parking_lot"] } +tokio = { version = "1.18.1", features = ["macros", "time", "parking_lot"] } wait-timeout = "0.2" remote-externalities = { path = "../../../utils/frame/remote-externalities" } pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" } diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml index 96248249200af..ab8f2e2f465f8 100644 --- a/client/beefy/Cargo.toml +++ b/client/beefy/Cargo.toml @@ -51,5 +51,5 @@ substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/ru serde = "1.0.136" strum = { version = "0.23", features = ["derive"] } -tokio = "1.15" +tokio = "1.18" tempfile = "3.1.0" diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 0495f522c1ade..6620046c448e0 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -28,7 +28,7 @@ serde = "1.0.136" serde_json = "1.0.79" thiserror = "1.0.30" tiny-bip39 = "0.8.2" -tokio = { version = "1.17.0", features = ["signal", "rt-multi-thread", "parking_lot"] } +tokio = { version = "1.18.1", features = ["signal", "rt-multi-thread", "parking_lot"] } parity-scale-codec = "3.0.0" sc-client-api = { version = "4.0.0-dev", path = "../api" } diff --git a/client/consensus/manual-seal/Cargo.toml b/client/consensus/manual-seal/Cargo.toml index 03db89d18b2d8..bafdcafc618a6 100644 --- a/client/consensus/manual-seal/Cargo.toml +++ b/client/consensus/manual-seal/Cargo.toml @@ -47,7 +47,7 @@ sp-timestamp = { path = "../../../primitives/timestamp", version = "4.0.0-dev" } prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.10.0-dev" } [dev-dependencies] -tokio = { version = "1.17.0", features = ["rt-multi-thread", "macros"] } +tokio = { version = "1.18.1", features = ["rt-multi-thread", "macros"] } sc-basic-authorship = { path = "../../basic-authorship", version = "0.10.0-dev" } substrate-test-runtime-client = { path = "../../../test-utils/runtime/client", version = "2.0.0" } substrate-test-runtime-transaction-pool = { path = "../../../test-utils/runtime/transaction-pool", version = "2.0.0" } diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml index 2d011fb96be59..542d53858283d 100644 --- a/client/finality-grandpa/Cargo.toml +++ b/client/finality-grandpa/Cargo.toml @@ -61,5 +61,5 @@ substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/ru sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" } serde = "1.0.136" -tokio = "1.17.0" +tokio = "1.18.1" tempfile = "3.1.0" diff --git a/client/offchain/Cargo.toml b/client/offchain/Cargo.toml index 6cb1f83e360be..8764fcbcf4320 100644 --- a/client/offchain/Cargo.toml +++ b/client/offchain/Cargo.toml @@ -43,7 +43,7 @@ sc-transaction-pool-api = { version = "4.0.0-dev", path = "../transaction-pool/a sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" } sp-consensus = { version = "0.10.0-dev", path = "../../primitives/consensus/common" } substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" } -tokio = "1.17.0" +tokio = "1.18.1" lazy_static = "1.4.0" [features] diff --git a/client/rpc-servers/Cargo.toml b/client/rpc-servers/Cargo.toml index 12f5c23493ad8..aa3bf40e9343e 100644 --- a/client/rpc-servers/Cargo.toml +++ b/client/rpc-servers/Cargo.toml @@ -19,7 +19,7 @@ pubsub = { package = "jsonrpc-pubsub", version = "18.0.0" } log = "0.4.16" prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.10.0-dev"} serde_json = "1.0.79" -tokio = { version = "1.17.0", features = ["parking_lot"] } +tokio = { version = "1.18.1", features = ["parking_lot"] } http = { package = "jsonrpc-http-server", version = "18.0.0" } ipc = { package = "jsonrpc-ipc-server", version = "18.0.0" } ws = { package = "jsonrpc-ws-server", version = "18.0.0" } diff --git a/client/service/Cargo.toml b/client/service/Cargo.toml index 575305a597798..5f80fff673dad 100644 --- a/client/service/Cargo.toml +++ b/client/service/Cargo.toml @@ -79,7 +79,7 @@ parity-util-mem = { version = "0.11.0", default-features = false, features = [ "primitive-types", ] } async-trait = "0.1.50" -tokio = { version = "1.17.0", features = ["time", "rt-multi-thread", "parking_lot"] } +tokio = { version = "1.18.1", features = ["time", "rt-multi-thread", "parking_lot"] } tempfile = "3.1.0" directories = "4.0.1" diff --git a/client/service/test/Cargo.toml b/client/service/test/Cargo.toml index 854e8f5b74659..84f51a23ff226 100644 --- a/client/service/test/Cargo.toml +++ b/client/service/test/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] hex = "0.4" hex-literal = "0.3.4" tempfile = "3.1.0" -tokio = { version = "1.17.0", features = ["time"] } +tokio = { version = "1.18.1", features = ["time"] } log = "0.4.16" fdlimit = "0.2.1" parking_lot = "0.12.0" diff --git a/frame/state-trie-migration/Cargo.toml b/frame/state-trie-migration/Cargo.toml index 0c6ad240281e1..158d8d8192d8f 100644 --- a/frame/state-trie-migration/Cargo.toml +++ b/frame/state-trie-migration/Cargo.toml @@ -36,7 +36,7 @@ zstd = { version = "0.10.0", default-features = false, optional = true } pallet-balances = { path = "../balances" } parking_lot = "0.12.0" sp-tracing = { path = "../../primitives/tracing" } -tokio = { version = "1.10", features = ["macros"] } +tokio = { version = "1.18", features = ["macros"] } [features] default = ["std"] diff --git a/test-utils/test-crate/Cargo.toml b/test-utils/test-crate/Cargo.toml index f6fea8407eaa7..ad20f7a941565 100644 --- a/test-utils/test-crate/Cargo.toml +++ b/test-utils/test-crate/Cargo.toml @@ -12,6 +12,6 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dev-dependencies] -tokio = { version = "1.17.0", features = ["macros"] } +tokio = { version = "1.18.1", features = ["macros"] } test-utils = { version = "4.0.0-dev", path = "..", package = "substrate-test-utils" } sc-service = { version = "0.10.0-dev", path = "../../client/service" } diff --git a/utils/frame/remote-externalities/Cargo.toml b/utils/frame/remote-externalities/Cargo.toml index 7ca5b2f255e28..b29e17e2f4fd2 100644 --- a/utils/frame/remote-externalities/Cargo.toml +++ b/utils/frame/remote-externalities/Cargo.toml @@ -28,7 +28,7 @@ sp-runtime = { version = "6.0.0", path = "../../../primitives/runtime" } sp-version = { version = "5.0.0", path = "../../../primitives/version" } [dev-dependencies] -tokio = { version = "1.17.0", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.18.1", features = ["macros", "rt-multi-thread"] } pallet-elections-phragmen = { path = "../../../frame/elections-phragmen", version = "5.0.0-dev" } frame-support = { path = "../../../frame/support", version = "4.0.0-dev" } diff --git a/utils/frame/rpc/support/Cargo.toml b/utils/frame/rpc/support/Cargo.toml index fe304370727f0..489ae48f6b4f7 100644 --- a/utils/frame/rpc/support/Cargo.toml +++ b/utils/frame/rpc/support/Cargo.toml @@ -26,4 +26,4 @@ sc-rpc-api = { version = "0.10.0-dev", path = "../../../../client/rpc-api" } [dev-dependencies] frame-system = { version = "4.0.0-dev", path = "../../../../frame/system" } scale-info = "2.0.1" -tokio = "1.17.0" +tokio = "1.18.1" diff --git a/utils/prometheus/Cargo.toml b/utils/prometheus/Cargo.toml index a9c3fd03e1688..7244f95caae14 100644 --- a/utils/prometheus/Cargo.toml +++ b/utils/prometheus/Cargo.toml @@ -17,9 +17,9 @@ log = "0.4.16" prometheus = { version = "0.13.0", default-features = false } futures-util = { version = "0.3.19", default-features = false, features = ["io"] } thiserror = "1.0" -tokio = { version = "1.17.0", features = ["parking_lot"] } +tokio = { version = "1.18.1", features = ["parking_lot"] } hyper = { version = "0.14.16", default-features = false, features = ["http1", "server", "tcp"] } [dev-dependencies] hyper = { version = "0.14.16", features = ["client"] } -tokio = { version = "1.17.0", features = ["rt-multi-thread"] } +tokio = { version = "1.18.1", features = ["rt-multi-thread"] }