Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
aa7ae3f
add availability bitfield types to primitives
rphmeier Jun 11, 2020
2c62c23
begin inclusion module
rphmeier Jun 11, 2020
08f3bad
use GitHub issue link for limitation
rphmeier Jun 11, 2020
c817204
fix some compiler errors
rphmeier Jun 11, 2020
ee1c9c0
integrate validators into initializer
rphmeier Jun 11, 2020
7b7306a
add generic signing context
rphmeier Jun 11, 2020
6b3969e
make signing-context more generic
rphmeier Jun 11, 2020
8a01422
fix issues with inclusion module
rphmeier Jun 11, 2020
795bc54
add TODO
rphmeier Jun 11, 2020
221b99e
guide: add validators and session index to inclusion
rphmeier Jun 11, 2020
412d88c
guide: add session index to change notification
rphmeier Jun 11, 2020
c5131b8
implement session change logic
rphmeier Jun 11, 2020
7e702cd
add BackedCandidate type
rphmeier Jun 11, 2020
48c0467
guide: refine inclusion pipeline
rphmeier Jun 12, 2020
d1d7fa9
guide: rename group_on to group_validators
rphmeier Jun 12, 2020
80613a4
guide: add check about collator for parathread
rphmeier Jun 12, 2020
4a2ee63
guide: add last_code_upgrade to paras and use in inclusion
rphmeier Jun 12, 2020
c8be591
implement Paras::last_code_upgrade
rphmeier Jun 12, 2020
ab81eef
implement most checks in process_candidates
rphmeier Jun 12, 2020
d4585a1
make candidate receipt structs more generic
rphmeier Jun 12, 2020
5ce3860
make BackedCandidate struct more generic
rphmeier Jun 12, 2020
cf28820
use hash param, not block number
rphmeier Jun 12, 2020
b4bbf4c
check that candidate is in context of the parent block
rphmeier Jun 12, 2020
976c289
include inclusion module in initializer
rphmeier Jun 12, 2020
b37a08c
implement enact-candidate
rphmeier Jun 12, 2020
7ca3527
check that only occupied cores have bits set
rphmeier Jun 12, 2020
383db96
finish implementing bitfield processing
rphmeier Jun 12, 2020
f5372b7
restructure consistency checks on candidates
rphmeier Jun 13, 2020
3a19591
make some more primitives generic
rphmeier Jun 13, 2020
b2e2754
signature checking logic for backed candidates
rphmeier Jun 13, 2020
7a74656
finish implementing process_candidates
rphmeier Jun 13, 2020
8f1774a
implement collect_pending
rphmeier Jun 13, 2020
058e2f3
add some trait implementations to primitives
rphmeier Jun 13, 2020
6b000bc
implement InclusionInherent and squash warnings
rphmeier Jun 13, 2020
11cf8a0
test bitfield signing checks
rphmeier Jun 15, 2020
d4fac49
rename parachain head to para_head
rphmeier Jun 15, 2020
58184eb
fix note_new_head bug in paras
rphmeier Jun 15, 2020
9ed14c5
test bitfield enactment in inclusion
rphmeier Jun 15, 2020
4e5b648
helpers for candidate checks
rphmeier Jun 15, 2020
9340aba
add test for most candidate checks
rphmeier Jun 16, 2020
cf44264
add test for backing setting storage
rphmeier Jun 16, 2020
bd88a20
test session change logic
rphmeier Jun 16, 2020
17dd6b2
remove extraneous type parameter
rphmeier Jun 16, 2020
93cce07
Merge branch 'master' into rh-para-inclusion
rphmeier Jun 17, 2020
dc9bff0
remove some allow(unused)s
rphmeier Jun 17, 2020
4bf6519
extract threshold computation to const fn
rphmeier Jun 17, 2020
b6c55a4
remove some more allow(unused)s
rphmeier Jun 17, 2020
0dc9072
improve doc
rphmeier Jun 17, 2020
3c43c1a
add debug assertion
rphmeier Jun 17, 2020
c080c14
Merge branch 'master' into rh-para-inclusion
rphmeier Jun 17, 2020
2f7059b
fix primitive test compilation
rphmeier Jun 17, 2020
1587db7
tag unanimous variant as unused
rphmeier Jun 17, 2020
70f041f
Merge branch 'master' into rh-para-inclusion
rphmeier Jun 18, 2020
86280f2
Merge branch 'master' into rh-para-inclusion
rphmeier Jun 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make signing-context more generic
  • Loading branch information
rphmeier committed Jun 11, 2020
commit 6b3969ea1771c512d69619f683635648b8f66b9d
28 changes: 13 additions & 15 deletions primitives/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,19 +606,9 @@ pub enum ValidityAttestation {
#[codec(index = "2")]
Explicit(ValidatorSignature),
}

/// A type returned by runtime with current session index and a parent hash.
#[derive(Clone, Eq, PartialEq, Default, Decode, Encode, RuntimeDebug)]
pub struct SigningContext {
/// Current session index.
pub session_index: sp_staking::SessionIndex,
/// Hash of the parent.
pub parent_hash: Hash,
}

/// A type returned by runtime with current session index and a parent hash.
#[derive(Clone, Eq, PartialEq, Default, Decode, Encode, RuntimeDebug)]
pub struct GenericSigningContext<H> {
pub struct SigningContext<H = Hash> {
/// Current session index.
pub session_index: sp_staking::SessionIndex,
/// Hash of the parent.
Expand Down Expand Up @@ -683,13 +673,21 @@ impl From<BitVec<bitvec::order::Lsb0, u8>> for AvailabilityBitfield {

impl AvailabilityBitfield {
/// Encodes the signing payload into the given buffer.
pub fn encode_signing_payload_into(&self, signing_context: &SigningContext, buf: &mut Vec<u8>) {
pub fn encode_signing_payload_into<H: Encode>(
&self,
signing_context: &SigningContext<H>,
buf: &mut Vec<u8>,
) {
self.0.encode_to(buf);
signing_context.encode_to(buf);
}

/// Encodes the signing payload into a fresh byte-vector.
pub fn encode_signing_payload(&self, signing_context: &SigningContext) -> Vec<u8> {
pub fn encode_signing_payload<H: Encode>(
&self,
signing_context:
&SigningContext<H>,
) -> Vec<u8> {
let mut v = Vec::new();
self.encode_signing_payload_into(signing_context, &mut v);
v
Expand All @@ -713,11 +711,11 @@ pub struct SignedAvailabilityBitfield {
/// the signature, the signing context, and an optional buffer in which to encode.
///
/// If the buffer is provided, it is assumed to be empty.
pub fn check_availability_bitfield_signature(
pub fn check_availability_bitfield_signature<H: Encode>(
bitfield: &AvailabilityBitfield,
validator: &ValidatorId,
signature: &ValidatorSignature,
signing_context: &SigningContext,
signing_context: &SigningContext<H>,
payload_encode_buf: Option<&mut Vec<u8>>,
) -> Result<(),()> {
use runtime_primitives::traits::AppVerify;
Expand Down