Companion to "Updating scale to v3" (#4958)

* Updating dependencies

* Adapting code to scale v3

* Upgrade bitvec to 1.0.0

* Fix bitvec arithmetics

* Update Cargo.lock

* Update sp-io

* Fixing the build

* Yanked scale-info 2.0.0

Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
wigy
2022-02-25 13:07:06 +01:00
committed by GitHub
parent d0c9f75a0b
commit e8cb6cdaac
106 changed files with 680 additions and 556 deletions
+387 -235
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -15,7 +15,7 @@ readme = "README.md"
[dependencies] [dependencies]
polkadot-cli = { path = "cli", features = [ "kusama-native", "westend-native", "rococo-native" ] } polkadot-cli = { path = "cli", features = [ "kusama-native", "westend-native", "rococo-native" ] }
color-eyre = { version = "0.6.0", default-features = false } color-eyre = { version = "0.6.0", default-features = false }
parity-util-mem = { version = "*", default-features = false, features = ["jemalloc-global"] } parity-util-mem = { version = "0.11.0", default-features = false, features = ["jemalloc-global"] }
[dev-dependencies] [dev-dependencies]
assert_cmd = "2.0.4" assert_cmd = "2.0.4"
@@ -21,8 +21,6 @@
#![recursion_limit = "256"] #![recursion_limit = "256"]
// Runtime-generated enums // Runtime-generated enums
#![allow(clippy::large_enum_variant)] #![allow(clippy::large_enum_variant)]
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
// From construct_runtime macro // From construct_runtime macro
#![allow(clippy::from_over_into)] #![allow(clippy::from_over_into)]
@@ -21,8 +21,6 @@
#![recursion_limit = "256"] #![recursion_limit = "256"]
// Runtime-generated enums // Runtime-generated enums
#![allow(clippy::large_enum_variant)] #![allow(clippy::large_enum_variant)]
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
// From construct_runtime macro // From construct_runtime macro
#![allow(clippy::from_over_into)] #![allow(clippy::from_over_into)]
@@ -8,10 +8,10 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
ed25519-dalek = { version = "1.0", default-features = false, optional = true } ed25519-dalek = { version = "1.0", default-features = false, optional = true }
hash-db = { version = "0.15.2", default-features = false } hash-db = { version = "0.15.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
+2 -2
View File
@@ -7,9 +7,9 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
+3 -3
View File
@@ -8,11 +8,11 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
finality-grandpa = { version = "0.14.0", default-features = false } finality-grandpa = { version = "0.15.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
# Bridge Dependencies # Bridge Dependencies
+3 -3
View File
@@ -7,11 +7,11 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
bitvec = { version = "0.20", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -530,7 +530,7 @@ pub fn unrewarded_relayer(
begin, begin,
end, end,
dispatch_results: if end >= begin { dispatch_results: if end >= begin {
bitvec![Msb0, u8; 1; (end - begin + 1) as _] bitvec![u8, Msb0; 1; (end - begin + 1) as _]
} else { } else {
Default::default() Default::default()
}, },
@@ -260,7 +260,7 @@ mod tests {
DeliveredMessages { DeliveredMessages {
begin: *nonces.start(), begin: *nonces.start(),
end: *nonces.end(), end: *nonces.end(),
dispatch_results: bitvec![Msb0, u8; 1; (nonces.end() - nonces.start() + 1) as _], dispatch_results: bitvec![u8, Msb0; 1; (nonces.end() - nonces.start() + 1) as _],
} }
} }
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState}; use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
use frame_support::weights::{ use frame_support::weights::{
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
mod millau_hash; mod millau_hash;
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState}; use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
use frame_support::weights::{ use frame_support::weights::{
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_runtime::Chain; use bp_runtime::Chain;
use frame_support::{ use frame_support::{
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState}; use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
use bp_runtime::Chain; use bp_runtime::Chain;
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
smallvec = "1.7" smallvec = "1.7"
# Bridge Dependencies # Bridge Dependencies
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState}; use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
use frame_support::weights::{ use frame_support::weights::{
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState}; use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
use frame_support::weights::{ use frame_support::weights::{
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
# Bridge Dependencies # Bridge Dependencies
bp-messages = { path = "../messages", default-features = false } bp-messages = { path = "../messages", default-features = false }
@@ -17,8 +17,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState}; use bp_messages::{LaneId, MessageDetails, MessageNonce, UnrewardedRelayersState};
use sp_std::prelude::*; use sp_std::prelude::*;
@@ -7,9 +7,9 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
finality-grandpa = { version = "0.14.0", default-features = false } finality-grandpa = { version = "0.15.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }
# Substrate Dependencies # Substrate Dependencies
@@ -8,8 +8,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
bp-runtime = { path = "../runtime", default-features = false } bp-runtime = { path = "../runtime", default-features = false }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
# Substrate Dependencies # Substrate Dependencies
@@ -7,10 +7,10 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
bitvec = { version = "0.20", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive", "bit-vec"] } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "bit-vec"] }
impl-trait-for-tuples = "0.2" impl-trait-for-tuples = "0.2"
scale-info = { version = "1.0", default-features = false, features = ["bit-vec", "derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["bit-vec", "derive"] }
serde = { version = "1.0", optional = true, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] }
# Bridge dependencies # Bridge dependencies
@@ -19,8 +19,6 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// RuntimeApi generated functions // RuntimeApi generated functions
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
// Generated by `DecodeLimit::decode_with_depth_limit`
#![allow(clippy::unnecessary_mut_passed)]
use bitvec::prelude::*; use bitvec::prelude::*;
use bp_runtime::messages::DispatchFeePayment; use bp_runtime::messages::DispatchFeePayment;
@@ -193,7 +191,7 @@ pub struct MessageDetails<OutboundMessageFee> {
} }
/// Bit vector of message dispatch results. /// Bit vector of message dispatch results.
pub type DispatchResultsBitVec = BitVec<Msb0, u8>; pub type DispatchResultsBitVec = BitVec<u8, Msb0>;
/// Unrewarded relayer entry stored in the inbound lane data. /// Unrewarded relayer entry stored in the inbound lane data.
/// ///
@@ -227,7 +225,11 @@ impl DeliveredMessages {
DeliveredMessages { DeliveredMessages {
begin: nonce, begin: nonce,
end: nonce, end: nonce,
dispatch_results: bitvec![Msb0, u8; if dispatch_result { 1 } else { 0 }], dispatch_results: if dispatch_result {
bitvec![u8, Msb0; 1]
} else {
bitvec![u8, Msb0; 0]
},
} }
} }
@@ -367,7 +369,7 @@ mod tests {
messages: DeliveredMessages::new(i as _, true), messages: DeliveredMessages::new(i as _, true),
}; };
entry.messages.dispatch_results = bitvec![ entry.messages.dispatch_results = bitvec![
Msb0, u8; u8, Msb0;
1; 1;
(messages_count / relayer_entries) as _ (messages_count / relayer_entries) as _
]; ];
@@ -393,7 +395,7 @@ mod tests {
#[test] #[test]
fn message_dispatch_result_works() { fn message_dispatch_result_works() {
let delivered_messages = let delivered_messages =
DeliveredMessages { begin: 100, end: 150, dispatch_results: bitvec![Msb0, u8; 1; 151] }; DeliveredMessages { begin: 100, end: 150, dispatch_results: bitvec![u8, Msb0; 1; 151] };
assert!(!delivered_messages.contains_message(99)); assert!(!delivered_messages.contains_message(99));
assert!(delivered_messages.contains_message(100)); assert!(delivered_messages.contains_message(100));
@@ -7,8 +7,8 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
# Bridge Dependencies # Bridge Dependencies
@@ -7,10 +7,10 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
hash-db = { version = "0.15.2", default-features = false } hash-db = { version = "0.15.2", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
# Substrate Dependencies # Substrate Dependencies
@@ -7,9 +7,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies] [dependencies]
bp-header-chain = { path = "../header-chain", default-features = false } bp-header-chain = { path = "../header-chain", default-features = false }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] } ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] }
finality-grandpa = { version = "0.14.4", default-features = false } finality-grandpa = { version = "0.15.0", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+3 -3
View File
@@ -8,9 +8,9 @@ edition = "2021"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = [ "derive" ] } parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
parity-util-mem = { version = "0.10.0", default-features = false, optional = true } parity-util-mem = { version = "0.11.0", default-features = false, optional = true }
[features] [features]
default = [ "std" ] default = [ "std" ]
+1 -1
View File
@@ -8,7 +8,7 @@ edition = "2021"
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
polkadot-node-primitives = { package = "polkadot-node-primitives", path = "../node/primitives" } polkadot-node-primitives = { package = "polkadot-node-primitives", path = "../node/primitives" }
novelpoly = { package = "reed-solomon-novelpoly", version = "1.0.0" } novelpoly = { package = "reed-solomon-novelpoly", version = "1.0.0" }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["std", "derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["std", "derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master" } trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master" }
thiserror = "1.0.30" thiserror = "1.0.30"
@@ -15,7 +15,7 @@ polkadot-primitives = { path = "../../primitives" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" }
thiserror = "1.0.30" thiserror = "1.0.30"
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["bit-vec", "derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["bit-vec", "derive"] }
[dev-dependencies] [dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" } polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" }
@@ -7,13 +7,13 @@ edition = "2021"
[dependencies] [dependencies]
futures = "0.3.21" futures = "0.3.21"
futures-timer = "3.0.2" futures-timer = "3.0.2"
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["bit-vec", "derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["bit-vec", "derive"] }
tracing = "0.1.31" tracing = "0.1.31"
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
lru = "0.7" lru = "0.7"
merlin = "2.0" merlin = "2.0"
schnorrkel = "0.9.1" schnorrkel = "0.9.1"
kvdb = "0.10.0" kvdb = "0.11.0"
derive_more = "0.99.17" derive_more = "0.99.17"
polkadot-node-subsystem = { path = "../../subsystem" } polkadot-node-subsystem = { path = "../../subsystem" }
@@ -38,5 +38,5 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
assert_matches = "1.4.0" assert_matches = "1.4.0"
kvdb-memorydb = "0.10.0" kvdb-memorydb = "0.11.0"
test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../../primitives/test-helpers" } test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../../primitives/test-helpers" }
@@ -129,7 +129,7 @@ pub fn check_approval(
let n_assigned = assigned_mask.count_ones(); let n_assigned = assigned_mask.count_ones();
// Filter the amount of assigned validators by those which have approved. // Filter the amount of assigned validators by those which have approved.
assigned_mask &= approvals.iter().by_val(); assigned_mask &= approvals;
let n_approved = assigned_mask.count_ones(); let n_approved = assigned_mask.count_ones();
// note: the process of computing `required` only chooses `exact` if // note: the process of computing `required` only chooses `exact` if
@@ -326,7 +326,7 @@ fn filled_tranche_iterator<'a>(
/// - if `tick` > `clock_drift`: the value is equal to `tick` + `no_show_duration`. /// - if `tick` > `clock_drift`: the value is equal to `tick` + `no_show_duration`.
fn count_no_shows( fn count_no_shows(
assignments: &[(ValidatorIndex, Tick)], assignments: &[(ValidatorIndex, Tick)],
approvals: &BitSlice<BitOrderLsb0, u8>, approvals: &BitSlice<u8, BitOrderLsb0>,
clock_drift: Tick, clock_drift: Tick,
block_tick: Tick, block_tick: Tick,
no_show_duration: Tick, no_show_duration: Tick,
@@ -367,7 +367,7 @@ fn count_no_shows(
/// Determine the amount of tranches of assignments needed to determine approval of a candidate. /// Determine the amount of tranches of assignments needed to determine approval of a candidate.
pub fn tranches_to_approve( pub fn tranches_to_approve(
approval_entry: &ApprovalEntry, approval_entry: &ApprovalEntry,
approvals: &BitSlice<BitOrderLsb0, u8>, approvals: &BitSlice<u8, BitOrderLsb0>,
tranche_now: DelayTranche, tranche_now: DelayTranche,
block_tick: Tick, block_tick: Tick,
no_show_duration: Tick, no_show_duration: Tick,
@@ -501,7 +501,7 @@ mod tests {
candidate: dummy_candidate_receipt(dummy_hash()), candidate: dummy_candidate_receipt(dummy_hash()),
session: 0, session: 0,
block_assignments: BTreeMap::default(), block_assignments: BTreeMap::default(),
approvals: bitvec![BitOrderLsb0, u8; 0; 10], approvals: bitvec![u8, BitOrderLsb0; 0; 10],
} }
.into(); .into();
@@ -524,7 +524,7 @@ mod tests {
assignments: (5..10).map(|i| (ValidatorIndex(i), 0.into())).collect(), assignments: (5..10).map(|i| (ValidatorIndex(i), 0.into())).collect(),
}, },
], ],
assignments: bitvec![BitOrderLsb0, u8; 1; 10], assignments: bitvec![u8, BitOrderLsb0; 1; 10],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -573,7 +573,7 @@ mod tests {
candidate: dummy_candidate_receipt(dummy_hash()), candidate: dummy_candidate_receipt(dummy_hash()),
session: 0, session: 0,
block_assignments: BTreeMap::default(), block_assignments: BTreeMap::default(),
approvals: bitvec![BitOrderLsb0, u8; 0; 10], approvals: bitvec![u8, BitOrderLsb0; 0; 10],
} }
.into(); .into();
@@ -596,7 +596,7 @@ mod tests {
assignments: (6..10).map(|i| (ValidatorIndex(i), 0.into())).collect(), assignments: (6..10).map(|i| (ValidatorIndex(i), 0.into())).collect(),
}, },
], ],
assignments: bitvec![BitOrderLsb0, u8; 1; 10], assignments: bitvec![u8, BitOrderLsb0; 1; 10],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -649,7 +649,7 @@ mod tests {
let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry { let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
tranches: Vec::new(), tranches: Vec::new(),
assignments: bitvec![BitOrderLsb0, u8; 0; 5], assignments: bitvec![u8, BitOrderLsb0; 0; 5],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -665,7 +665,7 @@ mod tests {
approval_entry.import_assignment(2, ValidatorIndex(4), block_tick + 2); approval_entry.import_assignment(2, ValidatorIndex(4), block_tick + 2);
let approvals = bitvec![BitOrderLsb0, u8; 1; 5]; let approvals = bitvec![u8, BitOrderLsb0; 1; 5];
assert_eq!( assert_eq!(
tranches_to_approve( tranches_to_approve(
@@ -693,7 +693,7 @@ mod tests {
let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry { let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
tranches: Vec::new(), tranches: Vec::new(),
assignments: bitvec![BitOrderLsb0, u8; 0; 10], assignments: bitvec![u8, BitOrderLsb0; 0; 10],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -704,7 +704,7 @@ mod tests {
approval_entry.import_assignment(0, ValidatorIndex(0), block_tick); approval_entry.import_assignment(0, ValidatorIndex(0), block_tick);
approval_entry.import_assignment(1, ValidatorIndex(2), block_tick); approval_entry.import_assignment(1, ValidatorIndex(2), block_tick);
let approvals = bitvec![BitOrderLsb0, u8; 0; 10]; let approvals = bitvec![u8, BitOrderLsb0; 0; 10];
let tranche_now = 2; let tranche_now = 2;
assert_eq!( assert_eq!(
@@ -733,7 +733,7 @@ mod tests {
let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry { let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
tranches: Vec::new(), tranches: Vec::new(),
assignments: bitvec![BitOrderLsb0, u8; 0; 10], assignments: bitvec![u8, BitOrderLsb0; 0; 10],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -746,7 +746,7 @@ mod tests {
approval_entry.import_assignment(1, ValidatorIndex(2), block_tick); approval_entry.import_assignment(1, ValidatorIndex(2), block_tick);
let mut approvals = bitvec![BitOrderLsb0, u8; 0; 10]; let mut approvals = bitvec![u8, BitOrderLsb0; 0; 10];
approvals.set(0, true); approvals.set(0, true);
approvals.set(1, true); approvals.set(1, true);
@@ -778,7 +778,7 @@ mod tests {
let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry { let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
tranches: Vec::new(), tranches: Vec::new(),
assignments: bitvec![BitOrderLsb0, u8; 0; n_validators], assignments: bitvec![u8, BitOrderLsb0; 0; n_validators],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -792,7 +792,7 @@ mod tests {
approval_entry.import_assignment(1, ValidatorIndex(2), block_tick); approval_entry.import_assignment(1, ValidatorIndex(2), block_tick);
approval_entry.import_assignment(1, ValidatorIndex(3), block_tick); approval_entry.import_assignment(1, ValidatorIndex(3), block_tick);
let mut approvals = bitvec![BitOrderLsb0, u8; 0; n_validators]; let mut approvals = bitvec![u8, BitOrderLsb0; 0; n_validators];
approvals.set(0, true); approvals.set(0, true);
approvals.set(1, true); approvals.set(1, true);
// skip 2 // skip 2
@@ -845,7 +845,7 @@ mod tests {
let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry { let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
tranches: Vec::new(), tranches: Vec::new(),
assignments: bitvec![BitOrderLsb0, u8; 0; n_validators], assignments: bitvec![u8, BitOrderLsb0; 0; n_validators],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -862,7 +862,7 @@ mod tests {
approval_entry.import_assignment(2, ValidatorIndex(4), block_tick + no_show_duration + 2); approval_entry.import_assignment(2, ValidatorIndex(4), block_tick + no_show_duration + 2);
approval_entry.import_assignment(2, ValidatorIndex(5), block_tick + no_show_duration + 2); approval_entry.import_assignment(2, ValidatorIndex(5), block_tick + no_show_duration + 2);
let mut approvals = bitvec![BitOrderLsb0, u8; 0; n_validators]; let mut approvals = bitvec![u8, BitOrderLsb0; 0; n_validators];
approvals.set(0, true); approvals.set(0, true);
approvals.set(1, true); approvals.set(1, true);
// skip 2 // skip 2
@@ -936,7 +936,7 @@ mod tests {
let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry { let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
tranches: Vec::new(), tranches: Vec::new(),
assignments: bitvec![BitOrderLsb0, u8; 0; n_validators], assignments: bitvec![u8, BitOrderLsb0; 0; n_validators],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -953,7 +953,7 @@ mod tests {
approval_entry.import_assignment(2, ValidatorIndex(4), block_tick + no_show_duration + 2); approval_entry.import_assignment(2, ValidatorIndex(4), block_tick + no_show_duration + 2);
approval_entry.import_assignment(2, ValidatorIndex(5), block_tick + no_show_duration + 2); approval_entry.import_assignment(2, ValidatorIndex(5), block_tick + no_show_duration + 2);
let mut approvals = bitvec![BitOrderLsb0, u8; 0; n_validators]; let mut approvals = bitvec![u8, BitOrderLsb0; 0; n_validators];
approvals.set(0, true); approvals.set(0, true);
approvals.set(1, true); approvals.set(1, true);
// skip 2 // skip 2
@@ -1033,7 +1033,7 @@ mod tests {
candidate: dummy_candidate_receipt(dummy_hash()), candidate: dummy_candidate_receipt(dummy_hash()),
session: 0, session: 0,
block_assignments: BTreeMap::default(), block_assignments: BTreeMap::default(),
approvals: bitvec![BitOrderLsb0, u8; 0; 3], approvals: bitvec![u8, BitOrderLsb0; 0; 3],
} }
.into(); .into();
@@ -1049,7 +1049,7 @@ mod tests {
assignments: (2..5).map(|i| (ValidatorIndex(i), 1.into())).collect(), assignments: (2..5).map(|i| (ValidatorIndex(i), 1.into())).collect(),
}, },
], ],
assignments: bitvec![BitOrderLsb0, u8; 1; 3], assignments: bitvec![u8, BitOrderLsb0; 1; 3],
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
@@ -1057,7 +1057,7 @@ mod tests {
} }
.into(); .into();
let approvals = bitvec![BitOrderLsb0, u8; 0; 3]; let approvals = bitvec![u8, BitOrderLsb0; 0; 3];
let tranche_now = 10; let tranche_now = 10;
assert_eq!( assert_eq!(
@@ -1099,7 +1099,7 @@ mod tests {
backing_group: GroupIndex(0), backing_group: GroupIndex(0),
our_assignment: None, our_assignment: None,
our_approval_sig: None, our_approval_sig: None,
assignments: bitvec![BitOrderLsb0, u8; 0; 3], assignments: bitvec![u8, BitOrderLsb0; 0; 3],
approved: false, approved: false,
} }
.into(); .into();
@@ -1137,7 +1137,7 @@ mod tests {
let n_validators = 4; let n_validators = 4;
let block_tick = 20; let block_tick = 20;
let mut approvals = bitvec![BitOrderLsb0, u8; 0; n_validators]; let mut approvals = bitvec![u8, BitOrderLsb0; 0; n_validators];
for &v_index in &test.approvals { for &v_index in &test.approvals {
approvals.set(v_index, true); approvals.set(v_index, true);
} }
@@ -140,7 +140,7 @@ pub struct StoredBlockRange(pub BlockNumber, pub BlockNumber);
pub struct Tick(u64); pub struct Tick(u64);
/// Convenience type definition /// Convenience type definition
pub type Bitfield = BitVec<BitOrderLsb0, u8>; pub type Bitfield = BitVec<u8, BitOrderLsb0>;
/// The database config. /// The database config.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@@ -37,8 +37,8 @@ fn make_db() -> (DbBackend, Arc<dyn KeyValueDB>) {
(DbBackend::new(db_writer.clone(), TEST_CONFIG), db_writer) (DbBackend::new(db_writer.clone(), TEST_CONFIG), db_writer)
} }
fn make_bitvec(len: usize) -> BitVec<BitOrderLsb0, u8> { fn make_bitvec(len: usize) -> BitVec<u8, BitOrderLsb0> {
bitvec::bitvec![BitOrderLsb0, u8; 0; len] bitvec::bitvec![u8, BitOrderLsb0; 0; len]
} }
fn make_block_entry( fn make_block_entry(
@@ -463,9 +463,9 @@ pub(crate) async fn handle_new_head(
block_hash = ?block_hash, block_hash = ?block_hash,
"Insta-approving all candidates", "Insta-approving all candidates",
); );
bitvec::bitvec![BitOrderLsb0, u8; 1; num_candidates] bitvec::bitvec![u8, BitOrderLsb0; 1; num_candidates]
} else { } else {
let mut result = bitvec::bitvec![BitOrderLsb0, u8; 0; num_candidates]; let mut result = bitvec::bitvec![u8, BitOrderLsb0; 0; num_candidates];
for (i, &(_, _, _, backing_group)) in included_candidates.iter().enumerate() { for (i, &(_, _, _, backing_group)) in included_candidates.iter().enumerate() {
let backing_group_size = let backing_group_size =
validator_group_lens.get(backing_group.0 as usize).copied().unwrap_or(0); validator_group_lens.get(backing_group.0 as usize).copied().unwrap_or(0);
@@ -1257,7 +1257,7 @@ async fn handle_approved_ancestor(
let mut block_descriptions = Vec::new(); let mut block_descriptions = Vec::new();
let mut bits: BitVec<Lsb0, u8> = Default::default(); let mut bits: BitVec<u8, Lsb0> = Default::default();
for (i, block_hash) in std::iter::once(target).chain(ancestry).enumerate() { for (i, block_hash) in std::iter::once(target).chain(ancestry).enumerate() {
// Block entries should be present as the assumption is that // Block entries should be present as the assumption is that
// nothing here is finalized. If we encounter any missing block // nothing here is finalized. If we encounter any missing block
@@ -1344,7 +1344,7 @@ async fn handle_approved_ancestor(
let n_approvals = c_entry let n_approvals = c_entry
.approvals() .approvals()
.iter() .iter()
.by_val() .by_vals()
.enumerate() .enumerate()
.filter(|(i, approved)| { .filter(|(i, approved)| {
*approved && a_entry.is_assigned(ValidatorIndex(*i as _)) *approved && a_entry.is_assigned(ValidatorIndex(*i as _))
@@ -242,7 +242,7 @@ pub fn add_block_entry(
candidate, candidate,
session, session,
block_assignments: BTreeMap::new(), block_assignments: BTreeMap::new(),
approvals: bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators], approvals: bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators],
} }
}); });
@@ -253,7 +253,7 @@ pub fn add_block_entry(
backing_group, backing_group,
our_assignment.map(|v| v.into()), our_assignment.map(|v| v.into()),
None, None,
bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators], bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators],
false, false,
), ),
); );
@@ -80,7 +80,7 @@ pub struct ApprovalEntry {
our_assignment: Option<OurAssignment>, our_assignment: Option<OurAssignment>,
our_approval_sig: Option<ValidatorSignature>, our_approval_sig: Option<ValidatorSignature>,
// `n_validators` bits. // `n_validators` bits.
assignments: BitVec<BitOrderLsb0, u8>, assignments: BitVec<u8, BitOrderLsb0>,
approved: bool, approved: bool,
} }
@@ -92,7 +92,7 @@ impl ApprovalEntry {
our_assignment: Option<OurAssignment>, our_assignment: Option<OurAssignment>,
our_approval_sig: Option<ValidatorSignature>, our_approval_sig: Option<ValidatorSignature>,
// `n_validators` bits. // `n_validators` bits.
assignments: BitVec<BitOrderLsb0, u8>, assignments: BitVec<u8, BitOrderLsb0>,
approved: bool, approved: bool,
) -> Self { ) -> Self {
Self { tranches, backing_group, our_assignment, our_approval_sig, assignments, approved } Self { tranches, backing_group, our_assignment, our_approval_sig, assignments, approved }
@@ -163,9 +163,9 @@ impl ApprovalEntry {
// Produce a bitvec indicating the assignments of all validators up to and // Produce a bitvec indicating the assignments of all validators up to and
// including `tranche`. // including `tranche`.
pub fn assignments_up_to(&self, tranche: DelayTranche) -> BitVec<BitOrderLsb0, u8> { pub fn assignments_up_to(&self, tranche: DelayTranche) -> BitVec<u8, BitOrderLsb0> {
self.tranches.iter().take_while(|e| e.tranche <= tranche).fold( self.tranches.iter().take_while(|e| e.tranche <= tranche).fold(
bitvec::bitvec![BitOrderLsb0, u8; 0; self.assignments.len()], bitvec::bitvec![u8, BitOrderLsb0; 0; self.assignments.len()],
|mut a, e| { |mut a, e| {
for &(v, _) in &e.assignments { for &(v, _) in &e.assignments {
a.set(v.0 as _, true); a.set(v.0 as _, true);
@@ -253,12 +253,12 @@ pub struct CandidateEntry {
// Assignments are based on blocks, so we need to track assignments separately // Assignments are based on blocks, so we need to track assignments separately
// based on the block we are looking at. // based on the block we are looking at.
pub block_assignments: BTreeMap<Hash, ApprovalEntry>, pub block_assignments: BTreeMap<Hash, ApprovalEntry>,
pub approvals: BitVec<BitOrderLsb0, u8>, pub approvals: BitVec<u8, BitOrderLsb0>,
} }
impl CandidateEntry { impl CandidateEntry {
/// Access the bit-vec of approvals. /// Access the bit-vec of approvals.
pub fn approvals(&self) -> &BitSlice<BitOrderLsb0, u8> { pub fn approvals(&self) -> &BitSlice<u8, BitOrderLsb0> {
&self.approvals &self.approvals
} }
@@ -336,7 +336,7 @@ pub struct BlockEntry {
// A bitfield where the i'th bit corresponds to the i'th candidate in `candidates`. // A bitfield where the i'th bit corresponds to the i'th candidate in `candidates`.
// The i'th bit is `true` iff the candidate has been approved in the context of this // The i'th bit is `true` iff the candidate has been approved in the context of this
// block. The block can be considered approved if the bitfield has all bits set to `true`. // block. The block can be considered approved if the bitfield has all bits set to `true`.
pub approved_bitfield: BitVec<BitOrderLsb0, u8>, pub approved_bitfield: BitVec<u8, BitOrderLsb0>,
pub children: Vec<Hash>, pub children: Vec<Hash>,
} }
+4 -4
View File
@@ -7,12 +7,12 @@ edition = "2021"
[dependencies] [dependencies]
futures = "0.3.21" futures = "0.3.21"
futures-timer = "3.0.2" futures-timer = "3.0.2"
kvdb = "0.10.0" kvdb = "0.11.0"
thiserror = "1.0.30" thiserror = "1.0.30"
tracing = "0.1.31" tracing = "0.1.31"
bitvec = "0.20.1" bitvec = "1.0.0"
parity-scale-codec = { version = "2.3.1", features = ["derive"] } parity-scale-codec = { version = "3.0.0", features = ["derive"] }
erasure = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" } erasure = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" } polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" } polkadot-node-subsystem-util = { path = "../../subsystem-util" }
@@ -24,7 +24,7 @@ polkadot-node-primitives = { path = "../../primitives" }
log = "0.4.13" log = "0.4.13"
env_logger = "0.9.0" env_logger = "0.9.0"
assert_matches = "1.4.0" assert_matches = "1.4.0"
kvdb-memorydb = "0.10.0" kvdb-memorydb = "0.11.0"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" } polkadot-node-subsystem-util = { path = "../../subsystem-util" }
+3 -3
View File
@@ -148,7 +148,7 @@ enum State {
struct CandidateMeta { struct CandidateMeta {
state: State, state: State,
data_available: bool, data_available: bool,
chunks_stored: BitVec<BitOrderLsb0, u8>, chunks_stored: BitVec<u8, BitOrderLsb0>,
} }
fn query_inner<D: Decode>( fn query_inner<D: Decode>(
@@ -727,7 +727,7 @@ fn note_block_backed(
let meta = CandidateMeta { let meta = CandidateMeta {
state: State::Unavailable(now.into()), state: State::Unavailable(now.into()),
data_available: false, data_available: false,
chunks_stored: bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators], chunks_stored: bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators],
}; };
let prune_at = now + pruning_config.keep_unavailable_for; let prune_at = now + pruning_config.keep_unavailable_for;
@@ -1210,7 +1210,7 @@ fn store_available_data(
} }
meta.data_available = true; meta.data_available = true;
meta.chunks_stored = bitvec::bitvec![BitOrderLsb0, u8; 1; n_validators]; meta.chunks_stored = bitvec::bitvec![u8, BitOrderLsb0; 1; n_validators];
write_meta(&mut tx, &subsystem.config, &candidate_hash, &meta); write_meta(&mut tx, &subsystem.config, &candidate_hash, &meta);
write_available_data(&mut tx, &subsystem.config, &candidate_hash, &available_data); write_available_data(&mut tx, &subsystem.config, &candidate_hash, &available_data);
+3 -3
View File
@@ -291,7 +291,7 @@ fn store_chunk_works() {
&candidate_hash, &candidate_hash,
&CandidateMeta { &CandidateMeta {
data_available: false, data_available: false,
chunks_stored: bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators], chunks_stored: bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators],
state: State::Unavailable(BETimestamp(0)), state: State::Unavailable(BETimestamp(0)),
}, },
); );
@@ -364,7 +364,7 @@ fn query_chunk_checks_meta() {
&CandidateMeta { &CandidateMeta {
data_available: false, data_available: false,
chunks_stored: { chunks_stored: {
let mut v = bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators]; let mut v = bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators];
v.set(validator_index.0 as usize, true); v.set(validator_index.0 as usize, true);
v v
}, },
@@ -528,7 +528,7 @@ fn query_all_chunks_works() {
&candidate_hash_2, &candidate_hash_2,
&CandidateMeta { &CandidateMeta {
data_available: false, data_available: false,
chunks_stored: bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators as _], chunks_stored: bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators as _],
state: State::Unavailable(BETimestamp(0)), state: State::Unavailable(BETimestamp(0)),
}, },
); );
+1 -1
View File
@@ -13,7 +13,7 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
polkadot-node-subsystem-util = { path = "../../subsystem-util" } polkadot-node-subsystem-util = { path = "../../subsystem-util" }
erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" } erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" } statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" }
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
tracing = "0.1.31" tracing = "0.1.31"
thiserror = "1.0.30" thiserror = "1.0.30"
+2 -2
View File
@@ -752,7 +752,7 @@ fn backing_works_while_validation_ongoing() {
.contains(&ValidityAttestation::Explicit(signed_c.signature().clone()))); .contains(&ValidityAttestation::Explicit(signed_c.signature().clone())));
assert_eq!( assert_eq!(
candidates[0].validator_indices, candidates[0].validator_indices,
bitvec::bitvec![bitvec::order::Lsb0, u8; 1, 0, 1, 1], bitvec::bitvec![u8, bitvec::order::Lsb0; 1, 0, 1, 1],
); );
virtual_overseer virtual_overseer
@@ -1484,7 +1484,7 @@ fn candidate_backing_reorders_votes() {
let backed = table_attested_to_backed(attested, &table_context).unwrap(); let backed = table_attested_to_backed(attested, &table_context).unwrap();
let expected_bitvec = { let expected_bitvec = {
let mut validator_indices = BitVec::<bitvec::order::Lsb0, u8>::with_capacity(6); let mut validator_indices = BitVec::<u8, bitvec::order::Lsb0>::with_capacity(6);
validator_indices.resize(6, false); validator_indices.resize(6, false);
validator_indices.set(1, true); validator_indices.set(1, true);
@@ -10,7 +10,7 @@ futures = "0.3.21"
tracing = "0.1.31" tracing = "0.1.31"
sp-maybe-compressed-blob = { package = "sp-maybe-compressed-blob", git = "https://github.com/paritytech/substrate", branch = "master" } sp-maybe-compressed-blob = { package = "sp-maybe-compressed-blob", git = "https://github.com/paritytech/substrate", branch = "master" }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["bit-vec", "derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["bit-vec", "derive"] }
polkadot-primitives = { path = "../../../primitives" } polkadot-primitives = { path = "../../../primitives" }
polkadot-parachain = { path = "../../../parachain" } polkadot-parachain = { path = "../../../parachain" }
+1 -1
View File
@@ -17,7 +17,7 @@ sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch =
[dev-dependencies] [dev-dependencies]
futures = { version = "0.3.21", features = ["thread-pool"] } futures = { version = "0.3.21", features = ["thread-pool"] }
maplit = "1.0.2" maplit = "1.0.2"
parity-scale-codec = "2.3.1" parity-scale-codec = "3.0.0"
polkadot-node-primitives = { path = "../../primitives" } polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -13,13 +13,13 @@ polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" } polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" } polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" } polkadot-node-subsystem-util = { path = "../../subsystem-util" }
kvdb = "0.10.0" kvdb = "0.11.0"
thiserror = "1.0.30" thiserror = "1.0.30"
parity-scale-codec = "2" parity-scale-codec = "3.0.0"
[dev-dependencies] [dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
parking_lot = "0.12" parking_lot = "0.12.0"
assert_matches = "1" assert_matches = "1"
kvdb-memorydb = "0.10.0" kvdb-memorydb = "0.11.0"
@@ -7,8 +7,8 @@ edition = "2021"
[dependencies] [dependencies]
futures = "0.3.21" futures = "0.3.21"
tracing = "0.1.31" tracing = "0.1.31"
parity-scale-codec = "2" parity-scale-codec = "3.0.0"
kvdb = "0.10.0" kvdb = "0.11.0"
thiserror = "1.0.30" thiserror = "1.0.30"
lru = "0.7.2" lru = "0.7.2"
@@ -20,7 +20,7 @@ polkadot-node-subsystem-util = { path = "../../subsystem-util" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
[dev-dependencies] [dev-dependencies]
kvdb-memorydb = "0.10.0" kvdb-memorydb = "0.11.0"
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
+1 -1
View File
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
futures = "0.3.21" futures = "0.3.21"
tracing = "0.1.31" tracing = "0.1.31"
thiserror = "1.0.30" thiserror = "1.0.30"
+1 -1
View File
@@ -291,7 +291,7 @@ impl ProvisionerJob {
} }
} }
type CoreAvailability = BitVec<bitvec::order::Lsb0, u8>; type CoreAvailability = BitVec<u8, bitvec::order::Lsb0>;
/// The provisioner is the subsystem best suited to choosing which specific /// The provisioner is the subsystem best suited to choosing which specific
/// backed candidates and availability bitfields should be assembled into the /// backed candidates and availability bitfields should be assembled into the
+2 -2
View File
@@ -10,7 +10,7 @@ pub fn occupied_core(para_id: u32) -> CoreState {
occupied_since: 100_u32, occupied_since: 100_u32,
time_out_at: 200_u32, time_out_at: 200_u32,
next_up_on_time_out: None, next_up_on_time_out: None,
availability: bitvec![bitvec::order::Lsb0, u8; 0; 32], availability: bitvec![u8, bitvec::order::Lsb0; 0; 32],
candidate_descriptor: dummy_candidate_descriptor(dummy_hash()), candidate_descriptor: dummy_candidate_descriptor(dummy_hash()),
candidate_hash: Default::default(), candidate_hash: Default::default(),
}) })
@@ -31,7 +31,7 @@ where
} }
pub fn default_bitvec(n_cores: usize) -> CoreAvailability { pub fn default_bitvec(n_cores: usize) -> CoreAvailability {
bitvec![bitvec::order::Lsb0, u8; 0; n_cores] bitvec![u8, bitvec::order::Lsb0; 0; n_cores]
} }
pub fn scheduled_core(id: u32) -> ScheduledCore { pub fn scheduled_core(id: u32) -> ScheduledCore {
+1 -1
View File
@@ -19,7 +19,7 @@ slotmap = "1.0"
tracing = "0.1.31" tracing = "0.1.31"
pin-project = "1.0.9" pin-project = "1.0.9"
rand = "0.8.5" rand = "0.8.5"
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
polkadot-parachain = { path = "../../../parachain" } polkadot-parachain = { path = "../../../parachain" }
polkadot-core-primitives = { path = "../../../core-primitives" } polkadot-core-primitives = { path = "../../../core-primitives" }
polkadot-node-subsystem-util = { path = "../../subsystem-util"} polkadot-node-subsystem-util = { path = "../../subsystem-util"}
+1 -1
View File
@@ -8,7 +8,7 @@ edition = "2021"
futures = "0.3.21" futures = "0.3.21"
tracing = "0.1.31" tracing = "0.1.31"
memory-lru = "0.1.0" memory-lru = "0.1.0"
parity-util-mem = { version = "0.10.0", default-features = false } parity-util-mem = { version = "0.11.0", default-features = false }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
+1 -1
View File
@@ -16,4 +16,4 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "master
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
thiserror = "1.0.30" thiserror = "1.0.30"
log = "0.4.13" log = "0.4.13"
parity-scale-codec = { version = "2.3.1", default-features = false } parity-scale-codec = { version = "3.0.0", default-features = false }
+1 -1
View File
@@ -23,7 +23,7 @@ polkadot-node-core-backing = { path = "../core/backing" }
polkadot-node-primitives = { path = "../primitives" } polkadot-node-primitives = { path = "../primitives" }
polkadot-primitives = { path = "../../primitives" } polkadot-primitives = { path = "../../primitives" }
polkadot-node-core-pvf = { path = "../core/pvf" } polkadot-node-core-pvf = { path = "../core/pvf" }
parity-util-mem = { version = "0.10.0", default-features = false, features = ["jemalloc-global"] } parity-util-mem = { version = "0.11.0", default-features = false, features = ["jemalloc-global"] }
color-eyre = { version = "0.6.0", default-features = false } color-eyre = { version = "0.6.0", default-features = false }
assert_matches = "1.5" assert_matches = "1.5"
async-trait = "0.1.52" async-trait = "0.1.52"
+1 -1
View File
@@ -18,7 +18,7 @@ sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
codec = { package = "parity-scale-codec", version = "2.2.0" } codec = { package = "parity-scale-codec", version = "3.0.0" }
primitives = { package = "polkadot-primitives", path = "../../primitives/" } primitives = { package = "polkadot-primitives", path = "../../primitives/" }
bs58 = { version = "0.4.0", features = ["alloc"] } bs58 = { version = "0.4.0", features = ["alloc"] }
log = "0.4.13" log = "0.4.13"
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies] [dependencies]
futures = "0.3.21" futures = "0.3.21"
tracing = "0.1.31" tracing = "0.1.31"
parity-scale-codec = { version = "2.3.1", features = ["std"] } parity-scale-codec = { version = "3.0.0", features = ["std"] }
polkadot-primitives = { path = "../../../primitives" } polkadot-primitives = { path = "../../../primitives" }
polkadot-erasure-coding = { path = "../../../erasure-coding" } polkadot-erasure-coding = { path = "../../../erasure-coding" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" } polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
@@ -17,7 +17,7 @@ polkadot-node-primitives = { path = "../../primitives" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" } polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" } polkadot-node-subsystem-util = { path = "../../subsystem-util" }
polkadot-node-network-protocol = { path = "../../network/protocol" } polkadot-node-network-protocol = { path = "../../network/protocol" }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
[dev-dependencies] [dev-dependencies]
@@ -14,7 +14,7 @@ polkadot-node-network-protocol = { path = "../../network/protocol" }
[dev-dependencies] [dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" } polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -124,7 +124,7 @@ fn receive_invalid_signature() {
let validator_1 = SyncCryptoStore::sr25519_generate_new(&*keystore, ValidatorId::ID, None) let validator_1 = SyncCryptoStore::sr25519_generate_new(&*keystore, ValidatorId::ID, None)
.expect("key created"); .expect("key created");
let payload = AvailabilityBitfield(bitvec![bitvec::order::Lsb0, u8; 1u8; 32]); let payload = AvailabilityBitfield(bitvec![u8, bitvec::order::Lsb0; 1u8; 32]);
let invalid_signed = executor::block_on(Signed::<AvailabilityBitfield>::sign( let invalid_signed = executor::block_on(Signed::<AvailabilityBitfield>::sign(
&keystore, &keystore,
payload.clone(), payload.clone(),
@@ -236,7 +236,7 @@ fn receive_invalid_validator_index() {
state.peer_views.insert(peer_b.clone(), view![hash_a]); state.peer_views.insert(peer_b.clone(), view![hash_a]);
let payload = AvailabilityBitfield(bitvec![bitvec::order::Lsb0, u8; 1u8; 32]); let payload = AvailabilityBitfield(bitvec![u8, bitvec::order::Lsb0; 1u8; 32]);
let signed = executor::block_on(Signed::<AvailabilityBitfield>::sign( let signed = executor::block_on(Signed::<AvailabilityBitfield>::sign(
&keystore, &keystore,
payload, payload,
@@ -294,7 +294,7 @@ fn receive_duplicate_messages() {
state_with_view(our_view![hash_a, hash_b], hash_a.clone()); state_with_view(our_view![hash_a, hash_b], hash_a.clone());
// create a signed message by validator 0 // create a signed message by validator 0
let payload = AvailabilityBitfield(bitvec![bitvec::order::Lsb0, u8; 1u8; 32]); let payload = AvailabilityBitfield(bitvec![u8, bitvec::order::Lsb0; 1u8; 32]);
let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign( let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign(
&keystore, &keystore,
payload, payload,
@@ -403,7 +403,7 @@ fn do_not_relay_message_twice() {
state_with_view(our_view![hash], hash.clone()); state_with_view(our_view![hash], hash.clone());
// create a signed message by validator 0 // create a signed message by validator 0
let payload = AvailabilityBitfield(bitvec![bitvec::order::Lsb0, u8; 1u8; 32]); let payload = AvailabilityBitfield(bitvec![u8, bitvec::order::Lsb0; 1u8; 32]);
let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign( let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign(
&keystore, &keystore,
payload, payload,
@@ -507,7 +507,7 @@ fn changing_view() {
state_with_view(our_view![hash_a, hash_b], hash_a.clone()); state_with_view(our_view![hash_a, hash_b], hash_a.clone());
// create a signed message by validator 0 // create a signed message by validator 0
let payload = AvailabilityBitfield(bitvec![bitvec::order::Lsb0, u8; 1u8; 32]); let payload = AvailabilityBitfield(bitvec![u8, bitvec::order::Lsb0; 1u8; 32]);
let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign( let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign(
&keystore, &keystore,
payload, payload,
@@ -655,7 +655,7 @@ fn do_not_send_message_back_to_origin() {
let (mut state, signing_context, keystore, validator) = state_with_view(our_view![hash], hash); let (mut state, signing_context, keystore, validator) = state_with_view(our_view![hash], hash);
// create a signed message by validator 0 // create a signed message by validator 0
let payload = AvailabilityBitfield(bitvec![bitvec::order::Lsb0, u8; 1u8; 32]); let payload = AvailabilityBitfield(bitvec![u8, bitvec::order::Lsb0; 1u8; 32]);
let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign( let signed_bitfield = executor::block_on(Signed::<AvailabilityBitfield>::sign(
&keystore, &keystore,
payload, payload,
+1 -1
View File
@@ -9,7 +9,7 @@ async-trait = "0.1.52"
futures = "0.3.21" futures = "0.3.21"
tracing = "0.1.31" tracing = "0.1.31"
polkadot-primitives = { path = "../../../primitives" } polkadot-primitives = { path = "../../../primitives" }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" } polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
@@ -30,7 +30,7 @@ assert_matches = "1.4.0"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
parity-scale-codec = { version = "2.3.1", features = ["std"] } parity-scale-codec = { version = "3.0.0", features = ["std"] }
polkadot-subsystem-testhelpers = { package = "polkadot-node-subsystem-test-helpers", path = "../../subsystem-test-helpers" } polkadot-subsystem-testhelpers = { package = "polkadot-node-subsystem-test-helpers", path = "../../subsystem-test-helpers" }
polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" } polkadot-primitives-test-helpers = { path = "../../../primitives/test-helpers" }
@@ -8,7 +8,7 @@ edition = "2021"
futures = "0.3.21" futures = "0.3.21"
tracing = "0.1.31" tracing = "0.1.31"
derive_more = "0.99.17" derive_more = "0.99.17"
parity-scale-codec = { version = "2.3.1", features = ["std"] } parity-scale-codec = { version = "3.0.0", features = ["std"] }
polkadot-primitives = { path = "../../../primitives" } polkadot-primitives = { path = "../../../primitives" }
polkadot-erasure-coding = { path = "../../../erasure-coding" } polkadot-erasure-coding = { path = "../../../erasure-coding" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" } polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
+1 -1
View File
@@ -10,7 +10,7 @@ async-trait = "0.1.52"
polkadot-primitives = { path = "../../../primitives" } polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" } polkadot-node-primitives = { path = "../../primitives" }
polkadot-node-jaeger = { path = "../../jaeger" } polkadot-node-jaeger = { path = "../../jaeger" }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
strum = { version = "0.24", features = ["derive"] } strum = { version = "0.24", features = ["derive"] }
@@ -17,7 +17,7 @@ polkadot-node-subsystem-util = { path = "../../subsystem-util" }
polkadot-node-network-protocol = { path = "../../network/protocol" } polkadot-node-network-protocol = { path = "../../network/protocol" }
arrayvec = "0.5.2" arrayvec = "0.5.2"
indexmap = "1.8.0" indexmap = "1.8.0"
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
derive_more = "0.99.17" derive_more = "0.99.17"
thiserror = "1.0.30" thiserror = "1.0.30"
+1 -1
View File
@@ -18,7 +18,7 @@ polkadot-primitives = { path = "../../primitives" }
polkadot-overseer-gen = { path = "./overseer-gen" } polkadot-overseer-gen = { path = "./overseer-gen" }
tracing = "0.1.31" tracing = "0.1.31"
lru = "0.7" lru = "0.7"
parity-util-mem = { version = ">= 0.10.1", default-features = false } parity-util-mem = { version = "0.11.0", default-features = false }
[dev-dependencies] [dev-dependencies]
metered-channel = { path = "../metered-channel" } metered-channel = { path = "../metered-channel" }
+1 -1
View File
@@ -9,7 +9,7 @@ description = "Primitives types for the Node-side"
bounded-vec = "0.5" bounded-vec = "0.5"
futures = "0.3.21" futures = "0.3.21"
polkadot-primitives = { path = "../../primitives" } polkadot-primitives = { path = "../../primitives" }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus-vrf = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus-vrf = { git = "https://github.com/paritytech/substrate", branch = "master" }
+2 -2
View File
@@ -66,8 +66,8 @@ hex-literal = "0.3.4"
tracing = "0.1.31" tracing = "0.1.31"
serde = { version = "1.0.136", features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] }
thiserror = "1.0.30" thiserror = "1.0.30"
kvdb = "0.10.0" kvdb = "0.11.0"
kvdb-rocksdb = { version = "0.14.0", optional = true } kvdb-rocksdb = { version = "0.15.1", optional = true }
async-trait = "0.1.52" async-trait = "0.1.52"
lru = "0.7" lru = "0.7"
+1 -1
View File
@@ -9,7 +9,7 @@ description = "Subsystem traits and message definitions"
async-trait = "0.1.52" async-trait = "0.1.52"
futures = "0.3.21" futures = "0.3.21"
itertools = "0.10" itertools = "0.10"
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
pin-project = "1.0.9" pin-project = "1.0.9"
rand = "0.8.5" rand = "0.8.5"
thiserror = "1.0.30" thiserror = "1.0.30"
+1 -1
View File
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
# Polkadot dependencies # Polkadot dependencies
polkadot-test-runtime = { path = "../../../runtime/test-runtime" } polkadot-test-runtime = { path = "../../../runtime/test-runtime" }
@@ -14,7 +14,7 @@ url = "2.0.0"
tokio-tungstenite = "0.17" tokio-tungstenite = "0.17"
futures-util = "0.3.21" futures-util = "0.3.21"
lazy_static = "1.4.0" lazy_static = "1.4.0"
parity-scale-codec = { version = "2.3.1", features = ["derive"] } parity-scale-codec = { version = "3.0.0", features = ["derive"] }
reqwest = "0.11" reqwest = "0.11"
thiserror = "1.0.30" thiserror = "1.0.30"
tracing = "0.1.31" tracing = "0.1.31"
+3 -3
View File
@@ -9,9 +9,9 @@ edition = "2021"
# note: special care is taken to avoid inclusion of `sp-io` externals when compiling # note: special care is taken to avoid inclusion of `sp-io` externals when compiling
# this crate for WASM. This is critical to avoid forcing all parachain WASM into implementing # this crate for WASM. This is critical to avoid forcing all parachain WASM into implementing
# various unnecessary Substrate-specific endpoints. # various unnecessary Substrate-specific endpoints.
parity-scale-codec = { version = "2.0.0", default-features = false, features = [ "derive" ] } parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
parity-util-mem = { version = "0.10.0", default-features = false, optional = true } parity-util-mem = { version = "0.11.0", default-features = false, optional = true }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies] [dependencies]
tiny-keccak = "2.0.2" tiny-keccak = "2.0.2"
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
adder = { package = "test-parachain-adder", path = "adder" } adder = { package = "test-parachain-adder", path = "adder" }
halt = { package = "test-parachain-halt", path = "halt" } halt = { package = "test-parachain-halt", path = "halt" }
@@ -8,7 +8,7 @@ build = "build.rs"
[dependencies] [dependencies]
parachain = { package = "polkadot-parachain", path = "../../", default-features = false, features = [ "wasm-api" ] } parachain = { package = "polkadot-parachain", path = "../../", default-features = false, features = [ "wasm-api" ] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
tiny-keccak = { version = "2.0.2", features = ["keccak"] } tiny-keccak = { version = "2.0.2", features = ["keccak"] }
dlmalloc = { version = "0.2.3", features = [ "global" ] } dlmalloc = { version = "0.2.3", features = [ "global" ] }
@@ -14,7 +14,7 @@ name = "adder_collator_puppet_worker"
path = "bin/puppet_worker.rs" path = "bin/puppet_worker.rs"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
clap = { version = "3.1", features = ["derive"] } clap = { version = "3.1", features = ["derive"] }
futures = "0.3.21" futures = "0.3.21"
futures-timer = "3.0.2" futures-timer = "3.0.2"
+4 -4
View File
@@ -6,8 +6,8 @@ edition = "2021"
[dependencies] [dependencies]
serde = { version = "1.0.136", optional = true, features = ["derive"] } serde = { version = "1.0.136", optional = true, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["bit-vec", "derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["bit-vec", "derive"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["bit-vec", "derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["bit-vec", "derive"] }
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -24,10 +24,10 @@ runtime_primitives = { package = "sp-runtime", git = "https://github.com/parityt
polkadot-parachain = { path = "../parachain", default-features = false } polkadot-parachain = { path = "../parachain", default-features = false }
polkadot-core-primitives = { path = "../core-primitives", default-features = false } polkadot-core-primitives = { path = "../core-primitives", default-features = false }
trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
hex-literal = "0.3.4" hex-literal = "0.3.4"
parity-util-mem = { version = "0.10.0", default-features = false, optional = true } parity-util-mem = { version = "0.11.0", default-features = false, optional = true }
[features] [features]
default = ["std"] default = ["std"]
+1 -1
View File
@@ -797,7 +797,7 @@ pub struct AttestedCandidate {
/// Validity attestations. /// Validity attestations.
pub validity_votes: Vec<ValidityAttestation>, pub validity_votes: Vec<ValidityAttestation>,
/// Indices of the corresponding validity votes. /// Indices of the corresponding validity votes.
pub validator_indices: BitVec<bitvec::order::Lsb0, u8>, pub validator_indices: BitVec<u8, bitvec::order::Lsb0>,
} }
impl AttestedCandidate { impl AttestedCandidate {
+7 -7
View File
@@ -545,10 +545,10 @@ impl CandidateCommitments {
/// ///
/// Every bit refers to an availability core index. /// Every bit refers to an availability core index.
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct AvailabilityBitfield(pub BitVec<bitvec::order::Lsb0, u8>); pub struct AvailabilityBitfield(pub BitVec<u8, bitvec::order::Lsb0>);
impl From<BitVec<bitvec::order::Lsb0, u8>> for AvailabilityBitfield { impl From<BitVec<u8, bitvec::order::Lsb0>> for AvailabilityBitfield {
fn from(inner: BitVec<bitvec::order::Lsb0, u8>) -> Self { fn from(inner: BitVec<u8, bitvec::order::Lsb0>) -> Self {
AvailabilityBitfield(inner) AvailabilityBitfield(inner)
} }
} }
@@ -574,7 +574,7 @@ pub struct BackedCandidate<H = Hash> {
/// The validity votes themselves, expressed as signatures. /// The validity votes themselves, expressed as signatures.
pub validity_votes: Vec<ValidityAttestation>, pub validity_votes: Vec<ValidityAttestation>,
/// The indices of the validators within the group, expressed as a bitfield. /// The indices of the validators within the group, expressed as a bitfield.
pub validator_indices: BitVec<bitvec::order::Lsb0, u8>, pub validator_indices: BitVec<u8, bitvec::order::Lsb0>,
} }
impl<H> BackedCandidate<H> { impl<H> BackedCandidate<H> {
@@ -810,7 +810,7 @@ pub struct OccupiedCore<H = Hash, N = BlockNumber> {
/// validators has attested to availability on-chain. A 2/3+ majority of `1` bits means that /// validators has attested to availability on-chain. A 2/3+ majority of `1` bits means that
/// this will be available. /// this will be available.
#[cfg_attr(feature = "std", ignore_malloc_size_of = "outside type")] #[cfg_attr(feature = "std", ignore_malloc_size_of = "outside type")]
pub availability: BitVec<bitvec::order::Lsb0, u8>, pub availability: BitVec<u8, bitvec::order::Lsb0>,
/// The group assigned to distribute availability pieces of this candidate. /// The group assigned to distribute availability pieces of this candidate.
pub group_responsible: GroupIndex, pub group_responsible: GroupIndex,
/// The hash of the candidate occupying the core. /// The hash of the candidate occupying the core.
@@ -1331,9 +1331,9 @@ pub type CheckedMultiDisputeStatementSet = Vec<CheckedDisputeStatementSet>;
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, TypeInfo)] #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, TypeInfo)]
pub struct DisputeState<N = BlockNumber> { pub struct DisputeState<N = BlockNumber> {
/// A bitfield indicating all validators for the candidate. /// A bitfield indicating all validators for the candidate.
pub validators_for: BitVec<bitvec::order::Lsb0, u8>, // one bit per validator. pub validators_for: BitVec<u8, bitvec::order::Lsb0>, // one bit per validator.
/// A bitfield indicating all validators against the candidate. /// A bitfield indicating all validators against the candidate.
pub validators_against: BitVec<bitvec::order::Lsb0, u8>, // one bit per validator. pub validators_against: BitVec<u8, bitvec::order::Lsb0>, // one bit per validator.
/// The block number at which the dispute started on-chain. /// The block number at which the dispute started on-chain.
pub start: N, pub start: N,
/// The block number at which the dispute concluded on-chain. /// The block number at which the dispute concluded on-chain.
+3 -3
View File
@@ -6,11 +6,11 @@ edition = "2021"
[dependencies] [dependencies]
impl-trait-for-tuples = "0.2.2" impl-trait-for-tuples = "0.2.2"
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.13", default-features = false } log = { version = "0.4.13", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false } rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.136", default-features = false } serde = { version = "1.0.136", default-features = false }
serde_derive = { version = "1.0.117", optional = true } serde_derive = { version = "1.0.117", optional = true }
static_assertions = "1.1.0" static_assertions = "1.1.0"
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies] [dependencies]
paste = "1.0" paste = "1.0"
enumn = "0.1.3" enumn = "0.1.3"
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+3 -3
View File
@@ -6,9 +6,9 @@ edition = "2021"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive", "max-encoded-len"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false } rustc-hex = { version = "2.1.0", default-features = false }
serde = { version = "1.0.136", default-features = false } serde = { version = "1.0.136", default-features = false }
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies] [dependencies]
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false} sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false}
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
parity-scale-codec = { version = "2.3.1", default-features = false } parity-scale-codec = { version = "3.0.0", default-features = false }
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false } primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
bs58 = { version = "0.4.0", default-features = false, features = ["alloc"] } bs58 = { version = "0.4.0", default-features = false, features = ["alloc"] }
+3 -3
View File
@@ -5,11 +5,11 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false } rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.136", features = [ "derive" ], optional = true } serde = { version = "1.0.136", features = [ "derive" ], optional = true }
derive_more = "0.99.17" derive_more = "0.99.17"
bitflags = "1.3.2" bitflags = "1.3.2"
+6 -6
View File
@@ -257,7 +257,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
group_idx: GroupIndex, group_idx: GroupIndex,
core_idx: CoreIndex, core_idx: CoreIndex,
candidate_hash: CandidateHash, candidate_hash: CandidateHash,
availability_votes: BitVec<BitOrderLsb0, u8>, availability_votes: BitVec<u8, BitOrderLsb0>,
) -> inclusion::CandidatePendingAvailability<T::Hash, T::BlockNumber> { ) -> inclusion::CandidatePendingAvailability<T::Hash, T::BlockNumber> {
inclusion::CandidatePendingAvailability::<T::Hash, T::BlockNumber>::new( inclusion::CandidatePendingAvailability::<T::Hash, T::BlockNumber>::new(
core_idx, // core core_idx, // core
@@ -280,7 +280,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
para_id: ParaId, para_id: ParaId,
core_idx: CoreIndex, core_idx: CoreIndex,
group_idx: GroupIndex, group_idx: GroupIndex,
availability_votes: BitVec<BitOrderLsb0, u8>, availability_votes: BitVec<u8, BitOrderLsb0>,
candidate_hash: CandidateHash, candidate_hash: CandidateHash,
) { ) {
let candidate_availability = Self::candidate_availability_mock( let candidate_availability = Self::candidate_availability_mock(
@@ -304,7 +304,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
/// Create an `AvailabilityBitfield` where `concluding` is a map where each key is a core index /// Create an `AvailabilityBitfield` where `concluding` is a map where each key is a core index
/// that is concluding and `cores` is the total number of cores in the system. /// that is concluding and `cores` is the total number of cores in the system.
fn availability_bitvec(concluding: &BTreeMap<u32, u32>, cores: u32) -> AvailabilityBitfield { fn availability_bitvec(concluding: &BTreeMap<u32, u32>, cores: u32) -> AvailabilityBitfield {
let mut bitfields = bitvec::bitvec![bitvec::order::Lsb0, u8; 0; 0]; let mut bitfields = bitvec::bitvec![u8, bitvec::order::Lsb0; 0; 0];
for i in 0..cores { for i in 0..cores {
if concluding.get(&(i as u32)).is_some() { if concluding.get(&(i as u32)).is_some() {
bitfields.push(true); bitfields.push(true);
@@ -373,9 +373,9 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
} }
/// Create a bitvec of `validators` length with all yes votes. /// Create a bitvec of `validators` length with all yes votes.
fn validator_availability_votes_yes(validators: usize) -> BitVec<bitvec::order::Lsb0, u8> { fn validator_availability_votes_yes(validators: usize) -> BitVec<u8, bitvec::order::Lsb0> {
// every validator confirms availability. // every validator confirms availability.
bitvec::bitvec![bitvec::order::Lsb0, u8; 1; validators as usize] bitvec::bitvec![u8, bitvec::order::Lsb0; 1; validators as usize]
} }
/// Setup session 1 and create `self.validators_map` and `self.validators`. /// Setup session 1 and create `self.validators_map` and `self.validators`.
@@ -565,7 +565,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
BackedCandidate::<T::Hash> { BackedCandidate::<T::Hash> {
candidate, candidate,
validity_votes, validity_votes,
validator_indices: bitvec::bitvec![bitvec::order::Lsb0, u8; 1; group_validators.len()], validator_indices: bitvec::bitvec![u8, bitvec::order::Lsb0; 1; group_validators.len()],
} }
}) })
.collect() .collect()
+14 -24
View File
@@ -530,11 +530,7 @@ impl DisputeStateFlags {
let supermajority_threshold = supermajority_threshold(n); let supermajority_threshold = supermajority_threshold(n);
let mut flags = DisputeStateFlags::default(); let mut flags = DisputeStateFlags::default();
let all_participants = { let all_participants = state.validators_for.clone() | state.validators_against.clone();
let mut a = state.validators_for.clone();
*a |= state.validators_against.iter().by_val();
a
};
if all_participants.count_ones() > byzantine_threshold { if all_participants.count_ones() > byzantine_threshold {
flags |= DisputeStateFlags::CONFIRMED; flags |= DisputeStateFlags::CONFIRMED;
} }
@@ -567,7 +563,7 @@ struct ImportSummary<BlockNumber> {
// Validators to slash for being (wrongly) on the FOR side. // Validators to slash for being (wrongly) on the FOR side.
slash_for: Vec<ValidatorIndex>, slash_for: Vec<ValidatorIndex>,
// New participants in the dispute. // New participants in the dispute.
new_participants: bitvec::vec::BitVec<BitOrderLsb0, u8>, new_participants: bitvec::vec::BitVec<u8, BitOrderLsb0>,
// Difference in state flags from previous. // Difference in state flags from previous.
new_flags: DisputeStateFlags, new_flags: DisputeStateFlags,
} }
@@ -597,14 +593,14 @@ struct ImportUndo {
struct DisputeStateImporter<BlockNumber> { struct DisputeStateImporter<BlockNumber> {
state: DisputeState<BlockNumber>, state: DisputeState<BlockNumber>,
now: BlockNumber, now: BlockNumber,
new_participants: bitvec::vec::BitVec<BitOrderLsb0, u8>, new_participants: bitvec::vec::BitVec<u8, BitOrderLsb0>,
pre_flags: DisputeStateFlags, pre_flags: DisputeStateFlags,
} }
impl<BlockNumber: Clone> DisputeStateImporter<BlockNumber> { impl<BlockNumber: Clone> DisputeStateImporter<BlockNumber> {
fn new(state: DisputeState<BlockNumber>, now: BlockNumber) -> Self { fn new(state: DisputeState<BlockNumber>, now: BlockNumber) -> Self {
let pre_flags = DisputeStateFlags::from_state(&state); let pre_flags = DisputeStateFlags::from_state(&state);
let new_participants = bitvec::bitvec![BitOrderLsb0, u8; 0; state.validators_for.len()]; let new_participants = bitvec::bitvec![u8, BitOrderLsb0; 0; state.validators_for.len()];
DisputeStateImporter { state, now, new_participants, pre_flags } DisputeStateImporter { state, now, new_participants, pre_flags }
} }
@@ -675,16 +671,10 @@ impl<BlockNumber: Clone> DisputeStateImporter<BlockNumber> {
.collect() .collect()
}, },
(false, true) => { (false, true) => {
let prev_participants = { // all participants, which are not new participants
// all participants let prev_participants = (self.state.validators_for.clone() |
let mut a = self.state.validators_for.clone(); self.state.validators_against.clone()) &
*a |= self.state.validators_against.iter().by_val(); !self.new_participants.clone();
// which are not new participants
*a &= self.new_participants.iter().by_val().map(|b| !b);
a
};
prev_participants prev_participants
.iter_ones() .iter_ones()
@@ -942,8 +932,8 @@ impl<T: Config> Pallet<T> {
dispute_state dispute_state
} else { } else {
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0; n_validators], validators_for: bitvec![u8, BitOrderLsb0; 0; n_validators],
validators_against: bitvec![BitOrderLsb0, u8; 0; n_validators], validators_against: bitvec![u8, BitOrderLsb0; 0; n_validators],
start: now, start: now,
concluded_at: None, concluded_at: None,
} }
@@ -1106,8 +1096,8 @@ impl<T: Config> Pallet<T> {
( (
true, true,
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0; n_validators], validators_for: bitvec![u8, BitOrderLsb0; 0; n_validators],
validators_against: bitvec![BitOrderLsb0, u8; 0; n_validators], validators_against: bitvec![u8, BitOrderLsb0; 0; n_validators],
start: now, start: now,
concluded_at: None, concluded_at: None,
}, },
@@ -1271,10 +1261,10 @@ fn has_supermajority_against<BlockNumber>(dispute: &DisputeState<BlockNumber>) -
fn decrement_spam<BlockNumber>( fn decrement_spam<BlockNumber>(
spam_slots: &mut [u32], spam_slots: &mut [u32],
dispute: &DisputeState<BlockNumber>, dispute: &DisputeState<BlockNumber>,
) -> bitvec::vec::BitVec<BitOrderLsb0, u8> { ) -> bitvec::vec::BitVec<u8, BitOrderLsb0> {
let byzantine_threshold = byzantine_threshold(spam_slots.len()); let byzantine_threshold = byzantine_threshold(spam_slots.len());
let participating = dispute.validators_for.clone() | dispute.validators_against.iter().by_val(); let participating = dispute.validators_for.clone() | dispute.validators_against.clone();
let decrement_spam = participating.count_ones() <= byzantine_threshold; let decrement_spam = participating.count_ones() <= byzantine_threshold;
for validator_index in participating.iter_ones() { for validator_index in participating.iter_ones() {
if decrement_spam { if decrement_spam {
@@ -105,8 +105,8 @@ fn test_contains_duplicates_in_sorted_iter() {
fn test_dispute_state_flag_from_state() { fn test_dispute_state_flag_from_state() {
assert_eq!( assert_eq!(
DisputeStateFlags::from_state(&DisputeState { DisputeStateFlags::from_state(&DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0, 0, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 0, 0, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 0, 0, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 0, 0, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}), }),
@@ -115,8 +115,8 @@ fn test_dispute_state_flag_from_state() {
assert_eq!( assert_eq!(
DisputeStateFlags::from_state(&DisputeState { DisputeStateFlags::from_state(&DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 1, 1, 1, 1, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 1, 1, 1, 1, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 0, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 0, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}), }),
@@ -125,8 +125,8 @@ fn test_dispute_state_flag_from_state() {
assert_eq!( assert_eq!(
DisputeStateFlags::from_state(&DisputeState { DisputeStateFlags::from_state(&DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 0, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 1, 1, 1, 1, 1, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 1, 1, 1, 1, 1, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}), }),
@@ -138,8 +138,8 @@ fn test_dispute_state_flag_from_state() {
fn test_import_new_participant_spam_inc() { fn test_import_new_participant_spam_inc() {
let mut importer = DisputeStateImporter::new( let mut importer = DisputeStateImporter::new(
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 0, 0, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 0, 0, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}, },
@@ -165,8 +165,8 @@ fn test_import_new_participant_spam_inc() {
assert_eq!( assert_eq!(
summary.state, summary.state,
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}, },
@@ -174,15 +174,15 @@ fn test_import_new_participant_spam_inc() {
assert_eq!(summary.spam_slot_changes, vec![(ValidatorIndex(2), SpamSlotChange::Inc)]); assert_eq!(summary.spam_slot_changes, vec![(ValidatorIndex(2), SpamSlotChange::Inc)]);
assert!(summary.slash_for.is_empty()); assert!(summary.slash_for.is_empty());
assert!(summary.slash_against.is_empty()); assert!(summary.slash_against.is_empty());
assert_eq!(summary.new_participants, bitvec![BitOrderLsb0, u8; 0, 0, 1, 0, 0, 0, 0, 0]); assert_eq!(summary.new_participants, bitvec![u8, BitOrderLsb0; 0, 0, 1, 0, 0, 0, 0, 0]);
} }
#[test] #[test]
fn test_import_prev_participant_spam_dec_confirmed() { fn test_import_prev_participant_spam_dec_confirmed() {
let mut importer = DisputeStateImporter::new( let mut importer = DisputeStateImporter::new(
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 1, 0, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 1, 0, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}, },
@@ -195,8 +195,8 @@ fn test_import_prev_participant_spam_dec_confirmed() {
assert_eq!( assert_eq!(
summary.state, summary.state,
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 1, 0, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 1, 0, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}, },
@@ -207,7 +207,7 @@ fn test_import_prev_participant_spam_dec_confirmed() {
); );
assert!(summary.slash_for.is_empty()); assert!(summary.slash_for.is_empty());
assert!(summary.slash_against.is_empty()); assert!(summary.slash_against.is_empty());
assert_eq!(summary.new_participants, bitvec![BitOrderLsb0, u8; 0, 0, 1, 0, 0, 0, 0, 0]); assert_eq!(summary.new_participants, bitvec![u8, BitOrderLsb0; 0, 0, 1, 0, 0, 0, 0, 0]);
assert_eq!(summary.new_flags, DisputeStateFlags::CONFIRMED); assert_eq!(summary.new_flags, DisputeStateFlags::CONFIRMED);
} }
@@ -215,8 +215,8 @@ fn test_import_prev_participant_spam_dec_confirmed() {
fn test_import_prev_participant_spam_dec_confirmed_slash_for() { fn test_import_prev_participant_spam_dec_confirmed_slash_for() {
let mut importer = DisputeStateImporter::new( let mut importer = DisputeStateImporter::new(
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 1, 0, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 1, 0, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}, },
@@ -234,8 +234,8 @@ fn test_import_prev_participant_spam_dec_confirmed_slash_for() {
assert_eq!( assert_eq!(
summary.state, summary.state,
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 1, 1, 1, 1, 1, 1, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 1, 1, 1, 1, 1, 1, 0],
start: 0, start: 0,
concluded_at: Some(0), concluded_at: Some(0),
}, },
@@ -246,7 +246,7 @@ fn test_import_prev_participant_spam_dec_confirmed_slash_for() {
); );
assert_eq!(summary.slash_for, vec![ValidatorIndex(0), ValidatorIndex(2)]); assert_eq!(summary.slash_for, vec![ValidatorIndex(0), ValidatorIndex(2)]);
assert!(summary.slash_against.is_empty()); assert!(summary.slash_against.is_empty());
assert_eq!(summary.new_participants, bitvec![BitOrderLsb0, u8; 0, 0, 1, 1, 1, 1, 1, 0]); assert_eq!(summary.new_participants, bitvec![u8, BitOrderLsb0; 0, 0, 1, 1, 1, 1, 1, 0]);
assert_eq!( assert_eq!(
summary.new_flags, summary.new_flags,
DisputeStateFlags::CONFIRMED | DisputeStateFlags::AGAINST_SUPERMAJORITY, DisputeStateFlags::CONFIRMED | DisputeStateFlags::AGAINST_SUPERMAJORITY,
@@ -257,8 +257,8 @@ fn test_import_prev_participant_spam_dec_confirmed_slash_for() {
fn test_import_slash_against() { fn test_import_slash_against() {
let mut importer = DisputeStateImporter::new( let mut importer = DisputeStateImporter::new(
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 1, 0, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 1, 0, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}, },
@@ -275,8 +275,8 @@ fn test_import_slash_against() {
assert_eq!( assert_eq!(
summary.state, summary.state,
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 1, 1, 1, 0, 1, 1], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 1, 1, 1, 0, 1, 1],
validators_against: bitvec![BitOrderLsb0, u8; 0, 1, 0, 0, 0, 1, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 1, 0, 0, 0, 1, 0, 0],
start: 0, start: 0,
concluded_at: Some(0), concluded_at: Some(0),
}, },
@@ -284,7 +284,7 @@ fn test_import_slash_against() {
assert!(summary.spam_slot_changes.is_empty()); assert!(summary.spam_slot_changes.is_empty());
assert!(summary.slash_for.is_empty()); assert!(summary.slash_for.is_empty());
assert_eq!(summary.slash_against, vec![ValidatorIndex(1), ValidatorIndex(5)]); assert_eq!(summary.slash_against, vec![ValidatorIndex(1), ValidatorIndex(5)]);
assert_eq!(summary.new_participants, bitvec![BitOrderLsb0, u8; 0, 0, 0, 1, 1, 1, 1, 1]); assert_eq!(summary.new_participants, bitvec![u8, BitOrderLsb0; 0, 0, 0, 1, 1, 1, 1, 1]);
assert_eq!(summary.new_flags, DisputeStateFlags::FOR_SUPERMAJORITY); assert_eq!(summary.new_flags, DisputeStateFlags::FOR_SUPERMAJORITY);
} }
@@ -1021,8 +1021,8 @@ fn test_provide_multi_dispute_success_and_other() {
5, 5,
candidate_hash.clone(), candidate_hash.clone(),
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0, 0, 0, 0, 0, 1, 0], validators_for: bitvec![u8, BitOrderLsb0; 0, 0, 0, 0, 0, 1, 0],
validators_against: bitvec![BitOrderLsb0, u8; 1, 1, 1, 0, 1, 0, 1], validators_against: bitvec![u8, BitOrderLsb0; 1, 1, 1, 0, 1, 0, 1],
start: 6, start: 6,
concluded_at: Some(6), // 5 vote against concluded_at: Some(6), // 5 vote against
} }
@@ -1031,8 +1031,8 @@ fn test_provide_multi_dispute_success_and_other() {
3, 3,
candidate_hash.clone(), candidate_hash.clone(),
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 1, 0, 1, 1, 0, 1], validators_for: bitvec![u8, BitOrderLsb0; 1, 1, 0, 1, 1, 0, 1],
validators_against: bitvec![BitOrderLsb0, u8; 0, 0, 1, 0, 0, 1, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 0, 1, 0, 0, 1, 0],
start: 6, start: 6,
concluded_at: Some(6), // 5 vote for concluded_at: Some(6), // 5 vote for
} }
@@ -1041,8 +1041,8 @@ fn test_provide_multi_dispute_success_and_other() {
4, 4,
candidate_hash.clone(), candidate_hash.clone(),
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0, 0, 0, 1, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 0, 0, 0, 1, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 0, 0, 1, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 0, 0, 1, 0, 0, 0, 0],
start: 6, start: 6,
concluded_at: None, concluded_at: None,
} }
@@ -1154,8 +1154,8 @@ fn test_revert_and_freeze_merges() {
fn test_has_supermajority_against() { fn test_has_supermajority_against() {
assert_eq!( assert_eq!(
has_supermajority_against(&DisputeState { has_supermajority_against(&DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 1, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 1, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 1, 1, 1, 1, 1, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 1, 1, 1, 1, 1, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}), }),
@@ -1164,8 +1164,8 @@ fn test_has_supermajority_against() {
assert_eq!( assert_eq!(
has_supermajority_against(&DisputeState { has_supermajority_against(&DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 1, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 1, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 1, 1, 1, 1, 1, 1, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 1, 1, 1, 1, 1, 1, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}), }),
@@ -1180,23 +1180,23 @@ fn test_decrement_spam() {
// Test confirm is no-op // Test confirm is no-op
let mut spam_slots = original_spam_slots.clone(); let mut spam_slots = original_spam_slots.clone();
let dispute_state_confirm = DisputeState { let dispute_state_confirm = DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 1, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 1, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}; };
assert_eq!(DisputeStateFlags::from_state(&dispute_state_confirm), DisputeStateFlags::CONFIRMED); assert_eq!(DisputeStateFlags::from_state(&dispute_state_confirm), DisputeStateFlags::CONFIRMED);
assert_eq!( assert_eq!(
decrement_spam(spam_slots.as_mut(), &dispute_state_confirm), decrement_spam(spam_slots.as_mut(), &dispute_state_confirm),
bitvec![BitOrderLsb0, u8; 1, 1, 1, 0, 0, 0, 0, 0], bitvec![u8, BitOrderLsb0; 1, 1, 1, 0, 0, 0, 0, 0],
); );
assert_eq!(spam_slots, original_spam_slots); assert_eq!(spam_slots, original_spam_slots);
// Test not confirm is decreasing spam // Test not confirm is decreasing spam
let mut spam_slots = original_spam_slots.clone(); let mut spam_slots = original_spam_slots.clone();
let dispute_state_no_confirm = DisputeState { let dispute_state_no_confirm = DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 1, 0, 0, 0, 0, 0, 0, 0], validators_for: bitvec![u8, BitOrderLsb0; 1, 0, 0, 0, 0, 0, 0, 0],
validators_against: bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], validators_against: bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
start: 0, start: 0,
concluded_at: None, concluded_at: None,
}; };
@@ -1206,7 +1206,7 @@ fn test_decrement_spam() {
); );
assert_eq!( assert_eq!(
decrement_spam(spam_slots.as_mut(), &dispute_state_no_confirm), decrement_spam(spam_slots.as_mut(), &dispute_state_no_confirm),
bitvec![BitOrderLsb0, u8; 1, 0, 1, 0, 0, 0, 0, 0], bitvec![u8, BitOrderLsb0; 1, 0, 1, 0, 0, 0, 0, 0],
); );
assert_eq!(spam_slots, vec![0, 1, 1, 3, 4, 5, 6, 7]); assert_eq!(spam_slots, vec![0, 1, 1, 3, 4, 5, 6, 7]);
} }
@@ -2090,8 +2090,8 @@ fn filter_removes_concluded_ancient() {
&1, &1,
&candidate_hash_a, &candidate_hash_a,
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0; 4], validators_for: bitvec![u8, BitOrderLsb0; 0; 4],
validators_against: bitvec![BitOrderLsb0, u8; 1; 4], validators_against: bitvec![u8, BitOrderLsb0; 1; 4],
start: 0, start: 0,
concluded_at: Some(0), concluded_at: Some(0),
}, },
@@ -2101,8 +2101,8 @@ fn filter_removes_concluded_ancient() {
&1, &1,
&candidate_hash_b, &candidate_hash_b,
DisputeState { DisputeState {
validators_for: bitvec![BitOrderLsb0, u8; 0; 4], validators_for: bitvec![u8, BitOrderLsb0; 0; 4],
validators_against: bitvec![BitOrderLsb0, u8; 1; 4], validators_against: bitvec![u8, BitOrderLsb0; 1; 4],
start: 0, start: 0,
concluded_at: Some(1), concluded_at: Some(1),
}, },
@@ -78,9 +78,9 @@ pub struct CandidatePendingAvailability<H, N> {
/// The candidate descriptor. /// The candidate descriptor.
descriptor: CandidateDescriptor<H>, descriptor: CandidateDescriptor<H>,
/// The received availability votes. One bit per validator. /// The received availability votes. One bit per validator.
availability_votes: BitVec<BitOrderLsb0, u8>, availability_votes: BitVec<u8, BitOrderLsb0>,
/// The backers of the candidate pending availability. /// The backers of the candidate pending availability.
backers: BitVec<BitOrderLsb0, u8>, backers: BitVec<u8, BitOrderLsb0>,
/// The block number of the relay-parent of the receipt. /// The block number of the relay-parent of the receipt.
relay_parent_number: N, relay_parent_number: N,
/// The block number of the relay-chain block this was backed in. /// The block number of the relay-chain block this was backed in.
@@ -91,7 +91,7 @@ pub struct CandidatePendingAvailability<H, N> {
impl<H, N> CandidatePendingAvailability<H, N> { impl<H, N> CandidatePendingAvailability<H, N> {
/// Get the availability votes on the candidate. /// Get the availability votes on the candidate.
pub(crate) fn availability_votes(&self) -> &BitVec<BitOrderLsb0, u8> { pub(crate) fn availability_votes(&self) -> &BitVec<u8, BitOrderLsb0> {
&self.availability_votes &self.availability_votes
} }
@@ -120,8 +120,8 @@ impl<H, N> CandidatePendingAvailability<H, N> {
core: CoreIndex, core: CoreIndex,
hash: CandidateHash, hash: CandidateHash,
descriptor: CandidateDescriptor<H>, descriptor: CandidateDescriptor<H>,
availability_votes: BitVec<BitOrderLsb0, u8>, availability_votes: BitVec<u8, BitOrderLsb0>,
backers: BitVec<BitOrderLsb0, u8>, backers: BitVec<u8, BitOrderLsb0>,
relay_parent_number: N, relay_parent_number: N,
backed_in_number: N, backed_in_number: N,
backing_group: GroupIndex, backing_group: GroupIndex,
@@ -544,7 +544,7 @@ impl<T: Config> Pallet<T> {
} }
let para_id = backed_candidate.descriptor().para_id; let para_id = backed_candidate.descriptor().para_id;
let mut backers = bitvec::bitvec![BitOrderLsb0, u8; 0; validators.len()]; let mut backers = bitvec::bitvec![u8, BitOrderLsb0; 0; validators.len()];
for (i, assignment) in scheduled[skip..].iter().enumerate() { for (i, assignment) in scheduled[skip..].iter().enumerate() {
check_assignment_in_order(assignment)?; check_assignment_in_order(assignment)?;
@@ -649,8 +649,8 @@ impl<T: Config> Pallet<T> {
let para_id = candidate.descriptor().para_id; let para_id = candidate.descriptor().para_id;
// initialize all availability votes to 0. // initialize all availability votes to 0.
let availability_votes: BitVec<BitOrderLsb0, u8> = let availability_votes: BitVec<u8, BitOrderLsb0> =
bitvec::bitvec![BitOrderLsb0, u8; 0; validators.len()]; bitvec::bitvec![u8, BitOrderLsb0; 0; validators.len()];
Self::deposit_event(Event::<T>::CandidateBacked( Self::deposit_event(Event::<T>::CandidateBacked(
candidate.candidate.to_plain(), candidate.candidate.to_plain(),
@@ -721,8 +721,8 @@ impl<T: Config> Pallet<T> {
fn enact_candidate( fn enact_candidate(
relay_parent_number: T::BlockNumber, relay_parent_number: T::BlockNumber,
receipt: CommittedCandidateReceipt<T::Hash>, receipt: CommittedCandidateReceipt<T::Hash>,
backers: BitVec<BitOrderLsb0, u8>, backers: BitVec<u8, BitOrderLsb0>,
availability_votes: BitVec<BitOrderLsb0, u8>, availability_votes: BitVec<u8, BitOrderLsb0>,
core_index: CoreIndex, core_index: CoreIndex,
backing_group: GroupIndex, backing_group: GroupIndex,
) -> Weight { ) -> Weight {
@@ -113,7 +113,7 @@ pub(crate) async fn back_candidate(
signing_context: &SigningContext, signing_context: &SigningContext,
kind: BackingKind, kind: BackingKind,
) -> BackedCandidate { ) -> BackedCandidate {
let mut validator_indices = bitvec::bitvec![BitOrderLsb0, u8; 0; group.len()]; let mut validator_indices = bitvec::bitvec![u8, BitOrderLsb0; 0; group.len()];
let threshold = minimum_backing_votes(group.len()); let threshold = minimum_backing_votes(group.len());
let signing = match kind { let signing = match kind {
@@ -201,18 +201,18 @@ pub(crate) fn expected_bits() -> usize {
} }
fn default_bitfield() -> AvailabilityBitfield { fn default_bitfield() -> AvailabilityBitfield {
AvailabilityBitfield(bitvec::bitvec![BitOrderLsb0, u8; 0; expected_bits()]) AvailabilityBitfield(bitvec::bitvec![u8, BitOrderLsb0; 0; expected_bits()])
} }
fn default_availability_votes() -> BitVec<BitOrderLsb0, u8> { fn default_availability_votes() -> BitVec<u8, BitOrderLsb0> {
bitvec::bitvec![BitOrderLsb0, u8; 0; ParasShared::active_validator_keys().len()] bitvec::bitvec![u8, BitOrderLsb0; 0; ParasShared::active_validator_keys().len()]
} }
fn default_backing_bitfield() -> BitVec<BitOrderLsb0, u8> { fn default_backing_bitfield() -> BitVec<u8, BitOrderLsb0> {
bitvec::bitvec![BitOrderLsb0, u8; 0; ParasShared::active_validator_keys().len()] bitvec::bitvec![u8, BitOrderLsb0; 0; ParasShared::active_validator_keys().len()]
} }
fn backing_bitfield(v: &[usize]) -> BitVec<BitOrderLsb0, u8> { fn backing_bitfield(v: &[usize]) -> BitVec<u8, BitOrderLsb0> {
let mut b = default_backing_bitfield(); let mut b = default_backing_bitfield();
for i in v { for i in v {
b.set(*i, true); b.set(*i, true);
+4 -4
View File
@@ -339,8 +339,8 @@ struct PvfCheckActiveVoteState<BlockNumber> {
// makes a vote. Once a 1 is set for either of the vectors, that validator cannot vote anymore. // makes a vote. Once a 1 is set for either of the vectors, that validator cannot vote anymore.
// Since the active validator set changes each session, the bit vectors are reinitialized as // Since the active validator set changes each session, the bit vectors are reinitialized as
// well: zeroed and resized so that each validator gets its own bit. // well: zeroed and resized so that each validator gets its own bit.
votes_accept: BitVec<BitOrderLsb0, u8>, votes_accept: BitVec<u8, BitOrderLsb0>,
votes_reject: BitVec<BitOrderLsb0, u8>, votes_reject: BitVec<u8, BitOrderLsb0>,
/// The number of session changes this PVF vote has observed. Therefore, this number is /// The number of session changes this PVF vote has observed. Therefore, this number is
/// increased at each session boundary. When created, it is initialized with 0. /// increased at each session boundary. When created, it is initialized with 0.
@@ -359,8 +359,8 @@ impl<BlockNumber> PvfCheckActiveVoteState<BlockNumber> {
causes.push(cause); causes.push(cause);
Self { Self {
created_at: now, created_at: now,
votes_accept: bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators], votes_accept: bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators],
votes_reject: bitvec::bitvec![BitOrderLsb0, u8; 0; n_validators], votes_reject: bitvec::bitvec![u8, BitOrderLsb0; 0; n_validators],
age: 0, age: 0,
causes, causes,
} }
@@ -81,10 +81,10 @@ const LOG_TARGET: &str = "runtime::inclusion-inherent";
/// A bitfield concerning concluded disputes for candidates /// A bitfield concerning concluded disputes for candidates
/// associated to the core index equivalent to the bit position. /// associated to the core index equivalent to the bit position.
#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] #[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
pub(crate) struct DisputedBitfield(pub(crate) BitVec<bitvec::order::Lsb0, u8>); pub(crate) struct DisputedBitfield(pub(crate) BitVec<u8, bitvec::order::Lsb0>);
impl From<BitVec<bitvec::order::Lsb0, u8>> for DisputedBitfield { impl From<BitVec<u8, bitvec::order::Lsb0>> for DisputedBitfield {
fn from(inner: BitVec<bitvec::order::Lsb0, u8>) -> Self { fn from(inner: BitVec<u8, bitvec::order::Lsb0>) -> Self {
Self(inner) Self(inner)
} }
} }
@@ -93,7 +93,7 @@ impl From<BitVec<bitvec::order::Lsb0, u8>> for DisputedBitfield {
impl DisputedBitfield { impl DisputedBitfield {
/// Create a new bitfield, where each bit is set to `false`. /// Create a new bitfield, where each bit is set to `false`.
pub fn zeros(n: usize) -> Self { pub fn zeros(n: usize) -> Self {
Self::from(BitVec::<bitvec::order::Lsb0, u8>::repeat(false, n)) Self::from(BitVec::<u8, bitvec::order::Lsb0>::repeat(false, n))
} }
} }
@@ -964,7 +964,7 @@ pub(crate) fn sanitize_bitfields<T: crate::inclusion::Config>(
return vec![] return vec![]
} }
let all_zeros = BitVec::<bitvec::order::Lsb0, u8>::repeat(false, expected_bits); let all_zeros = BitVec::<u8, bitvec::order::Lsb0>::repeat(false, expected_bits);
let signing_context = SigningContext { parent_hash, session_index }; let signing_context = SigningContext { parent_hash, session_index };
for unchecked_bitfield in unchecked_bitfields { for unchecked_bitfield in unchecked_bitfields {
// Find and skip invalid bitfields. // Find and skip invalid bitfields.
@@ -925,10 +925,10 @@ mod sanitizers {
let validator_public = validator_pubkeys(&validators); let validator_public = validator_pubkeys(&validators);
let unchecked_bitfields = [ let unchecked_bitfields = [
BitVec::<Lsb0, u8>::repeat(true, expected_bits), BitVec::<u8, Lsb0>::repeat(true, expected_bits),
BitVec::<Lsb0, u8>::repeat(true, expected_bits), BitVec::<u8, Lsb0>::repeat(true, expected_bits),
{ {
let mut bv = BitVec::<Lsb0, u8>::repeat(false, expected_bits); let mut bv = BitVec::<u8, Lsb0>::repeat(false, expected_bits);
bv.set(expected_bits - 1, true); bv.set(expected_bits - 1, true);
bv bv
}, },
+2 -2
View File
@@ -89,7 +89,7 @@ fn upward_message_id(data: &[u8]) -> MessageId {
impl<XcmExecutor: xcm::latest::ExecuteXcm<C::Call>, C: Config> UmpSink for XcmSink<XcmExecutor, C> { impl<XcmExecutor: xcm::latest::ExecuteXcm<C::Call>, C: Config> UmpSink for XcmSink<XcmExecutor, C> {
fn process_upward_message( fn process_upward_message(
origin: ParaId, origin: ParaId,
data: &[u8], mut data: &[u8],
max_weight: Weight, max_weight: Weight,
) -> Result<Weight, (MessageId, Weight)> { ) -> Result<Weight, (MessageId, Weight)> {
use parity_scale_codec::DecodeLimit; use parity_scale_codec::DecodeLimit;
@@ -101,7 +101,7 @@ impl<XcmExecutor: xcm::latest::ExecuteXcm<C::Call>, C: Config> UmpSink for XcmSi
let id = upward_message_id(&data[..]); let id = upward_message_id(&data[..]);
let maybe_msg = VersionedXcm::<C::Call>::decode_all_with_depth_limit( let maybe_msg = VersionedXcm::<C::Call>::decode_all_with_depth_limit(
xcm::MAX_XCM_DECODE_DEPTH, xcm::MAX_XCM_DECODE_DEPTH,
&mut &data[..], &mut data,
) )
.map(Xcm::<C::Call>::try_from); .map(Xcm::<C::Call>::try_from);
match maybe_msg { match maybe_msg {
+3 -3
View File
@@ -6,9 +6,9 @@ edition = "2021"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive", "max-encoded-len"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false } rustc-hex = { version = "2.1.0", default-features = false }
serde = { version = "1.0.136", default-features = false } serde = { version = "1.0.136", default-features = false }
+2 -2
View File
@@ -6,8 +6,8 @@ edition = "2021"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive", "max-encoded-len"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.136", default-features = false } serde = { version = "1.0.136", default-features = false }
serde_derive = { version = "1.0.117", optional = true } serde_derive = { version = "1.0.117", optional = true }
smallvec = "1.8.0" smallvec = "1.8.0"
+3 -3
View File
@@ -6,11 +6,11 @@ edition = "2021"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false } rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.136", default-features = false } serde = { version = "1.0.136", default-features = false }
serde_derive = { version = "1.0.117", optional = true } serde_derive = { version = "1.0.117", optional = true }
smallvec = "1.8.0" smallvec = "1.8.0"
+3 -3
View File
@@ -6,9 +6,9 @@ edition = "2021"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive", "max-encoded-len"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false } rustc-hex = { version = "2.1.0", default-features = false }
serde = { version = "1.0.136", default-features = false } serde = { version = "1.0.136", default-features = false }
+1 -1
View File
@@ -5,6 +5,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] } parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
primitives = { package = "polkadot-primitives", path = "../primitives" } primitives = { package = "polkadot-primitives", path = "../primitives" }
+1 -1
View File
@@ -5,8 +5,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0" }
clap = { version = "3.1", features = ["derive", "env"] } clap = { version = "3.1", features = ["derive", "env"] }
codec = { package = "parity-scale-codec", version = "2.0.0" }
tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } tracing-subscriber = { version = "0.3.9", features = ["env-filter"] }
jsonrpsee = { version = "0.8", features = ["ws-client", "macros"] } jsonrpsee = { version = "0.8", features = ["ws-client", "macros"] }
log = "0.4.11" log = "0.4.11"
+2 -2
View File
@@ -7,8 +7,8 @@ edition = "2021"
[dependencies] [dependencies]
impl-trait-for-tuples = "0.2.2" impl-trait-for-tuples = "0.2.2"
parity-scale-codec = { version = "2.3.1", default-features = false, features = [ "derive" ] } parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
derivative = {version = "2.2.0", default-features = false, features = [ "use_core" ] } derivative = {version = "2.2.0", default-features = false, features = [ "use_core" ] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }
xcm-procedural = { path = "procedural" } xcm-procedural = { path = "procedural" }
@@ -8,8 +8,8 @@ version = "0.9.17"
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
frame-support = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" } frame-support = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" }
frame-system = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" } frame-system = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" }
sp-runtime = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" } sp-runtime = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" }
+2 -2
View File
@@ -5,8 +5,8 @@ name = "pallet-xcm"
version = "0.9.17" version = "0.9.17"
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.136", optional = true, features = ["derive"] } serde = { version = "1.0.136", optional = true, features = ["derive"] }
log = { version = "0.4.14", default-features = false } log = { version = "0.4.14", default-features = false }

Some files were not shown because too many files have changed in this diff Show More