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
@@ -81,10 +81,10 @@ const LOG_TARGET: &str = "runtime::inclusion-inherent";
/// A bitfield concerning concluded disputes for candidates
/// associated to the core index equivalent to the bit position.
#[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 {
fn from(inner: BitVec<bitvec::order::Lsb0, u8>) -> Self {
impl From<BitVec<u8, bitvec::order::Lsb0>> for DisputedBitfield {
fn from(inner: BitVec<u8, bitvec::order::Lsb0>) -> Self {
Self(inner)
}
}
@@ -93,7 +93,7 @@ impl From<BitVec<bitvec::order::Lsb0, u8>> for DisputedBitfield {
impl DisputedBitfield {
/// Create a new bitfield, where each bit is set to `false`.
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![]
}
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 };
for unchecked_bitfield in unchecked_bitfields {
// Find and skip invalid bitfields.
@@ -925,10 +925,10 @@ mod sanitizers {
let validator_public = validator_pubkeys(&validators);
let unchecked_bitfields = [
BitVec::<Lsb0, u8>::repeat(true, expected_bits),
BitVec::<Lsb0, u8>::repeat(true, expected_bits),
BitVec::<u8, Lsb0>::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
},