mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 02:07:56 +00:00
convert SignedAvailabilityBitfields from newtype to typedef (#1342)
Closes #1339.
This commit is contained in:
committed by
GitHub
parent
ac8e1ca206
commit
f3c2db1a28
@@ -27,7 +27,7 @@ use futures::channel::{mpsc, oneshot};
|
||||
use polkadot_primitives::{BlockNumber, Hash, Signature};
|
||||
use polkadot_primitives::parachain::{
|
||||
AbridgedCandidateReceipt, PoVBlock, ErasureChunk, BackedCandidate, Id as ParaId,
|
||||
SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, ValidatorId, ValidationCode, ValidatorIndex,
|
||||
SignedAvailabilityBitfield, SigningContext, ValidatorId, ValidationCode, ValidatorIndex,
|
||||
};
|
||||
use polkadot_node_primitives::{
|
||||
MisbehaviorReport, SignedFullStatement, View, ProtocolId,
|
||||
@@ -194,7 +194,7 @@ pub enum ProvisionableData {
|
||||
/// This data needs to make its way from the provisioner into the InherentData.
|
||||
///
|
||||
/// There, it is used to construct the InclusionInherent.
|
||||
pub type ProvisionerInherentData = (SignedAvailabilityBitfields, Vec<BackedCandidate>);
|
||||
pub type ProvisionerInherentData = (Vec<SignedAvailabilityBitfield>, Vec<BackedCandidate>);
|
||||
|
||||
/// Message to the Provisioner.
|
||||
///
|
||||
|
||||
@@ -736,14 +736,7 @@ impl From<BitVec<bitvec::order::Lsb0, u8>> for AvailabilityBitfield {
|
||||
pub type SignedAvailabilityBitfield = Signed<AvailabilityBitfield>;
|
||||
|
||||
/// A set of signed availability bitfields. Should be sorted by validator index, ascending.
|
||||
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, Default)]
|
||||
pub struct SignedAvailabilityBitfields(pub Vec<SignedAvailabilityBitfield>);
|
||||
|
||||
impl From<Vec<SignedAvailabilityBitfield>> for SignedAvailabilityBitfields {
|
||||
fn from(fields: Vec<SignedAvailabilityBitfield>) -> SignedAvailabilityBitfields {
|
||||
SignedAvailabilityBitfields(fields)
|
||||
}
|
||||
}
|
||||
pub type SignedAvailabilityBitfields = Vec<SignedAvailabilityBitfield>;
|
||||
|
||||
/// A backed (or backable, depending on context) candidate.
|
||||
// TODO: yes, this is roughly the same as AttestedCandidate.
|
||||
|
||||
@@ -190,7 +190,7 @@ impl<T: Trait> Module<T> {
|
||||
session_index,
|
||||
};
|
||||
|
||||
for signed_bitfield in &signed_bitfields.0 {
|
||||
for signed_bitfield in &signed_bitfields {
|
||||
ensure!(
|
||||
signed_bitfield.payload().0.len() == n_bits,
|
||||
Error::<T>::WrongBitfieldSize,
|
||||
@@ -220,7 +220,7 @@ impl<T: Trait> Module<T> {
|
||||
}
|
||||
|
||||
let now = <system::Module<T>>::block_number();
|
||||
for signed_bitfield in signed_bitfields.0 {
|
||||
for signed_bitfield in signed_bitfields {
|
||||
for (bit_idx, _)
|
||||
in signed_bitfield.payload().0.iter().enumerate().filter(|(_, is_av)| **is_av)
|
||||
{
|
||||
@@ -755,7 +755,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert!(Inclusion::process_bitfields(
|
||||
SignedAvailabilityBitfields(vec![signed]),
|
||||
vec![signed],
|
||||
&core_lookup,
|
||||
).is_err());
|
||||
}
|
||||
@@ -771,7 +771,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert!(Inclusion::process_bitfields(
|
||||
SignedAvailabilityBitfields(vec![signed.clone(), signed]),
|
||||
vec![signed.clone(), signed],
|
||||
&core_lookup,
|
||||
).is_err());
|
||||
}
|
||||
@@ -794,7 +794,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert!(Inclusion::process_bitfields(
|
||||
SignedAvailabilityBitfields(vec![signed_1, signed_0]),
|
||||
vec![signed_1, signed_0],
|
||||
&core_lookup,
|
||||
).is_err());
|
||||
}
|
||||
@@ -811,7 +811,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert!(Inclusion::process_bitfields(
|
||||
SignedAvailabilityBitfields(vec![signed]),
|
||||
vec![signed],
|
||||
&core_lookup,
|
||||
).is_err());
|
||||
}
|
||||
@@ -827,7 +827,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert!(Inclusion::process_bitfields(
|
||||
SignedAvailabilityBitfields(vec![signed]),
|
||||
vec![signed],
|
||||
&core_lookup,
|
||||
).is_ok());
|
||||
}
|
||||
@@ -855,7 +855,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert!(Inclusion::process_bitfields(
|
||||
SignedAvailabilityBitfields(vec![signed]),
|
||||
vec![signed],
|
||||
&core_lookup,
|
||||
).is_ok());
|
||||
}
|
||||
@@ -959,7 +959,7 @@ mod tests {
|
||||
}).collect();
|
||||
|
||||
assert!(Inclusion::process_bitfields(
|
||||
SignedAvailabilityBitfields(signed_bitfields),
|
||||
signed_bitfields,
|
||||
&core_lookup,
|
||||
).is_ok());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user