Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
68b48d9e
Unverified
Commit
68b48d9e
authored
Jul 07, 2020
by
Peter Goodspeed-Niklaus
Committed by
GitHub
Jul 07, 2020
Browse files
convert SignedAvailabilityBitfields from newtype to typedef (#1342)
Closes #1339.
parent
8348cc4c
Pipeline
#99599
passed with stages
in 22 minutes
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
node/subsystem/src/messages.rs
View file @
68b48d9e
...
...
@@ -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
=
(
SignedAvailabilityBitfield
s
,
Vec
<
BackedCandidate
>
);
pub
type
ProvisionerInherentData
=
(
Vec
<
SignedAvailabilityBitfield
>
,
Vec
<
BackedCandidate
>
);
/// Message to the Provisioner.
///
...
...
primitives/src/parachain.rs
View file @
68b48d9e
...
...
@@ -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.
...
...
runtime/parachains/src/inclusion.rs
View file @
68b48d9e
...
...
@@ -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
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment