Unverified Commit 96af6ead authored by asynchronous rob's avatar asynchronous rob Committed by GitHub
Browse files

Refactor primitives (#1383)

* create a v1 primitives module

* Improve guide on availability types

* punctuate

* new parachains runtime uses new primitives

* tests of new runtime now use new primitives

* add ErasureChunk to guide

* export erasure chunk from v1 primitives

* subsystem crate uses v1 primitives

* node-primitives uses new v1 primitives

* port overseer to new primitives

* new-proposer uses v1 primitives (no ParachainHost anymore)

* fix no-std compilation for primitives

* service-new uses v1 primitives

* network-bridge uses new primitives

* statement distribution uses v1 primitives

* PoV distribution uses v1 primitives; add PoV::hash fn

* move parachain to v0

* remove inclusion_inherent module and place into v1

* remove everything from primitives crate root

* remove some unused old types from v0 primitives

* point everything else at primitives::v0

* squanch some warns up

* add RuntimeDebug import to no-std as well

* port over statement-table and validation

* fix final errors in validation and node-primitives

* add dummy Ord impl to committed candidate receipt

* guide: update CandidateValidationMessage

* add primitive for validationoutputs

* expand CandidateValidationMessage further

* bikeshed

* add some impls to omitted-validation-data and available-data

* expand CandidateValidationMessage

* make erasure-coding generic over v1/v0

* update usages of erasure-coding

* implement commitments.hash()

* use Arc<Pov> for CandidateValidation

* improve new erasure-coding method names

* fix up candidate backing

* update docs a bit

* fix most tests and add short-circuiting to make_pov_available

* fix remainder of candidate backing tests

* squanching warns

* squanch it up

* some fallout

* overseer fallout

* free from polkadot-test-service hell
parent 8845df22
Pipeline #100069 passed with stages
in 25 minutes and 41 seconds
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
use rstd::prelude::*; use rstd::prelude::*;
use codec::{Encode, Decode}; use codec::{Encode, Decode};
use primitives::{ use primitives::v0::{
self as parachain,
AccountId, AccountIndex, Balance, BlockNumber, Hash as HashT, Nonce, Signature, Moment, AccountId, AccountIndex, Balance, BlockNumber, Hash as HashT, Nonce, Signature, Moment,
parachain::{self, ActiveParas, AbridgedCandidateReceipt, SigningContext}, ValidityError, ActiveParas, AbridgedCandidateReceipt, SigningContext, ValidityError,
}; };
use runtime_common::{ use runtime_common::{
attestations, claims, parachains, registrar, slots, SlowAdjustingFeeUpdate, attestations, claims, parachains, registrar, slots, SlowAdjustingFeeUpdate,
...@@ -375,7 +376,7 @@ parameter_types! { ...@@ -375,7 +376,7 @@ parameter_types! {
} }
impl parachains::Trait for Runtime { impl parachains::Trait for Runtime {
type AuthorityId = primitives::fisherman::FishermanAppCrypto; type AuthorityId = primitives::v0::fisherman::FishermanAppCrypto;
type Origin = Origin; type Origin = Origin;
type Call = Call; type Call = Call;
type ParachainCurrency = Balances; type ParachainCurrency = Balances;
...@@ -521,7 +522,7 @@ impl sudo::Trait for Runtime { ...@@ -521,7 +522,7 @@ impl sudo::Trait for Runtime {
construct_runtime! { construct_runtime! {
pub enum Runtime where pub enum Runtime where
Block = Block, Block = Block,
NodeBlock = primitives::Block, NodeBlock = primitives::v0::Block,
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
// Basic stuff; balances is uncallable initially. // Basic stuff; balances is uncallable initially.
...@@ -702,7 +703,7 @@ sp_api::impl_runtime_apis! { ...@@ -702,7 +703,7 @@ sp_api::impl_runtime_apis! {
fn signing_context() -> SigningContext { fn signing_context() -> SigningContext {
Parachains::signing_context() Parachains::signing_context()
} }
fn downward_messages(id: parachain::Id) -> Vec<primitives::DownwardMessage> { fn downward_messages(id: parachain::Id) -> Vec<primitives::v0::DownwardMessage> {
Parachains::downward_messages(id) Parachains::downward_messages(id)
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/// Money matters. /// Money matters.
pub mod currency { pub mod currency {
use primitives::Balance; use primitives::v0::Balance;
pub const DOTS: Balance = 1_000_000_000_000; pub const DOTS: Balance = 1_000_000_000_000;
pub const DOLLARS: Balance = DOTS; pub const DOLLARS: Balance = DOTS;
...@@ -30,7 +30,7 @@ pub mod currency { ...@@ -30,7 +30,7 @@ pub mod currency {
/// Time and blocks. /// Time and blocks.
pub mod time { pub mod time {
use primitives::{Moment, BlockNumber}; use primitives::v0::{Moment, BlockNumber};
pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const MILLISECS_PER_BLOCK: Moment = 6000;
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 1 * HOURS; pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 1 * HOURS;
...@@ -47,7 +47,7 @@ pub mod time { ...@@ -47,7 +47,7 @@ pub mod time {
/// Fee-related. /// Fee-related.
pub mod fee { pub mod fee {
pub use sp_runtime::Perbill; pub use sp_runtime::Perbill;
use primitives::Balance; use primitives::v0::Balance;
use runtime_common::ExtrinsicBaseWeight; use runtime_common::ExtrinsicBaseWeight;
use frame_support::weights::{ use frame_support::weights::{
WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,
......
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
use sp_std::prelude::*; use sp_std::prelude::*;
use codec::{Encode, Decode}; use codec::{Encode, Decode};
use primitives::{ use primitives::v0::{
self as parachain,
AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, Signature, Moment, AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, Signature, Moment,
parachain::{self, ActiveParas, AbridgedCandidateReceipt, SigningContext}, ActiveParas, AbridgedCandidateReceipt, SigningContext,
}; };
use runtime_common::{ use runtime_common::{
attestations, parachains, registrar, SlowAdjustingFeeUpdate, attestations, parachains, registrar, SlowAdjustingFeeUpdate,
...@@ -385,7 +386,7 @@ impl grandpa::Trait for Runtime { ...@@ -385,7 +386,7 @@ impl grandpa::Trait for Runtime {
type HandleEquivocation = grandpa::EquivocationHandler< type HandleEquivocation = grandpa::EquivocationHandler<
Self::KeyOwnerIdentification, Self::KeyOwnerIdentification,
primitives::fisherman::FishermanAppCrypto, primitives::v0::fisherman::FishermanAppCrypto,
Runtime, Runtime,
Offences, Offences,
>; >;
...@@ -421,7 +422,7 @@ parameter_types! { ...@@ -421,7 +422,7 @@ parameter_types! {
} }
impl parachains::Trait for Runtime { impl parachains::Trait for Runtime {
type AuthorityId = primitives::fisherman::FishermanAppCrypto; type AuthorityId = primitives::v0::fisherman::FishermanAppCrypto;
type Origin = Origin; type Origin = Origin;
type Call = Call; type Call = Call;
type ParachainCurrency = Balances; type ParachainCurrency = Balances;
...@@ -698,7 +699,7 @@ impl proxy::Trait for Runtime { ...@@ -698,7 +699,7 @@ impl proxy::Trait for Runtime {
construct_runtime! { construct_runtime! {
pub enum Runtime where pub enum Runtime where
Block = Block, Block = Block,
NodeBlock = primitives::Block, NodeBlock = primitives::v0::Block,
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
// Basic stuff; balances is uncallable initially. // Basic stuff; balances is uncallable initially.
...@@ -887,7 +888,7 @@ sp_api::impl_runtime_apis! { ...@@ -887,7 +888,7 @@ sp_api::impl_runtime_apis! {
fn signing_context() -> SigningContext { fn signing_context() -> SigningContext {
Parachains::signing_context() Parachains::signing_context()
} }
fn downward_messages(id: parachain::Id) -> Vec<primitives::DownwardMessage> { fn downward_messages(id: parachain::Id) -> Vec<primitives::v0::DownwardMessage> {
Parachains::downward_messages(id) Parachains::downward_messages(id)
} }
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
//! Polkadot chain configurations. //! Polkadot chain configurations.
use sp_core::{Pair, Public, crypto::UncheckedInto, sr25519}; use sp_core::{Pair, Public, crypto::UncheckedInto, sr25519};
use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId}; use polkadot_primitives::v0::{AccountId, AccountPublic, ValidatorId};
use polkadot_runtime as polkadot; use polkadot_runtime as polkadot;
use kusama_runtime as kusama; use kusama_runtime as kusama;
use westend_runtime as westend; use westend_runtime as westend;
...@@ -48,9 +48,9 @@ const DEFAULT_PROTOCOL_ID: &str = "dot"; ...@@ -48,9 +48,9 @@ const DEFAULT_PROTOCOL_ID: &str = "dot";
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Extensions { pub struct Extensions {
/// Block numbers with known hashes. /// Block numbers with known hashes.
pub fork_blocks: sc_client_api::ForkBlocks<polkadot_primitives::Block>, pub fork_blocks: sc_client_api::ForkBlocks<polkadot_primitives::v0::Block>,
/// Known bad block hashes. /// Known bad block hashes.
pub bad_blocks: sc_client_api::BadBlocks<polkadot_primitives::Block>, pub bad_blocks: sc_client_api::BadBlocks<polkadot_primitives::v0::Block>,
} }
/// The `ChainSpec parametrised for polkadot runtime`. /// The `ChainSpec parametrised for polkadot runtime`.
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
//! Polkadot-specific GRANDPA integration utilities. //! Polkadot-specific GRANDPA integration utilities.
use polkadot_primitives::Hash; use polkadot_primitives::v0::Hash;
use sp_runtime::traits::{Block as BlockT, NumberFor}; use sp_runtime::traits::{Block as BlockT, NumberFor};
/// A custom GRANDPA voting rule that "pauses" voting (i.e. keeps voting for the /// A custom GRANDPA voting rule that "pauses" voting (i.e. keeps voting for the
...@@ -98,7 +98,7 @@ impl<Block, B> grandpa::VotingRule<Block, B> for PauseAfterBlockFor<NumberFor<Bl ...@@ -98,7 +98,7 @@ impl<Block, B> grandpa::VotingRule<Block, B> for PauseAfterBlockFor<NumberFor<Bl
/// #1500988). /// #1500988).
pub(crate) fn kusama_hard_forks() -> Vec<( pub(crate) fn kusama_hard_forks() -> Vec<(
grandpa_primitives::SetId, grandpa_primitives::SetId,
(Hash, polkadot_primitives::BlockNumber), (Hash, polkadot_primitives::v0::BlockNumber),
grandpa_primitives::AuthorityList, grandpa_primitives::AuthorityList,
)> { )> {
use sp_core::crypto::Ss58Codec; use sp_core::crypto::Ss58Codec;
......
...@@ -22,7 +22,7 @@ mod client; ...@@ -22,7 +22,7 @@ mod client;
use std::sync::Arc; use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use polkadot_primitives::{parachain, Hash, BlockId, AccountId, Nonce, Balance}; use polkadot_primitives::v0::{self as parachain, Hash, BlockId, AccountId, Nonce, Balance};
#[cfg(feature = "full-node")] #[cfg(feature = "full-node")]
use polkadot_network::{legacy::gossip::Known, protocol as network_protocol}; use polkadot_network::{legacy::gossip::Known, protocol as network_protocol};
use service::{error::Error as ServiceError, ServiceBuilder}; use service::{error::Error as ServiceError, ServiceBuilder};
...@@ -42,8 +42,7 @@ pub use sc_consensus::LongestChain; ...@@ -42,8 +42,7 @@ pub use sc_consensus::LongestChain;
pub use sp_api::{Core as CoreApi, ConstructRuntimeApi, ProvideRuntimeApi, StateBackend}; pub use sp_api::{Core as CoreApi, ConstructRuntimeApi, ProvideRuntimeApi, StateBackend};
pub use sp_runtime::traits::{HashFor, NumberFor}; pub use sp_runtime::traits::{HashFor, NumberFor};
pub use consensus_common::{SelectChain, BlockImport, block_validation::Chain}; pub use consensus_common::{SelectChain, BlockImport, block_validation::Chain};
pub use polkadot_primitives::parachain::{CollatorId, ParachainHost}; pub use polkadot_primitives::v0::{Block, CollatorId, ParachainHost};
pub use polkadot_primitives::Block;
pub use sp_runtime::traits::{Block as BlockT, self as runtime_traits, BlakeTwo256}; pub use sp_runtime::traits::{Block as BlockT, self as runtime_traits, BlakeTwo256};
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec}; pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec};
#[cfg(feature = "full-node")] #[cfg(feature = "full-node")]
......
...@@ -28,7 +28,7 @@ use std::collections::hash_map::{HashMap, Entry}; ...@@ -28,7 +28,7 @@ use std::collections::hash_map::{HashMap, Entry};
use std::hash::Hash; use std::hash::Hash;
use std::fmt::Debug; use std::fmt::Debug;
use primitives::parachain::{ValidityAttestation as PrimitiveValidityAttestation, ValidatorSignature}; use primitives::v1::{ValidityAttestation as PrimitiveValidityAttestation, ValidatorSignature};
use codec::{Encode, Decode}; use codec::{Encode, Decode};
......
...@@ -16,75 +16,87 @@ ...@@ -16,75 +16,87 @@
pub mod generic; pub mod generic;
pub use generic::Table; pub use generic::{Table, Context};
use primitives::parachain::{ /// Concrete instantiations suitable for v0 primitives.
Id, AbridgedCandidateReceipt, CompactStatement as PrimitiveStatement, ValidatorSignature, ValidatorIndex, pub mod v0 {
}; use crate::generic;
use primitives::Hash; use primitives::v0::{
Hash,
/// Statements about candidates on the network. Id, AbridgedCandidateReceipt, CompactStatement as PrimitiveStatement, ValidatorSignature, ValidatorIndex,
pub type Statement = generic::Statement<AbridgedCandidateReceipt, Hash>; };
/// Signed statements about candidates. /// Statements about candidates on the network.
pub type SignedStatement = generic::SignedStatement< pub type Statement = generic::Statement<AbridgedCandidateReceipt, Hash>;
AbridgedCandidateReceipt,
Hash, /// Signed statements about candidates.
ValidatorIndex, pub type SignedStatement = generic::SignedStatement<
ValidatorSignature, AbridgedCandidateReceipt,
>; Hash,
ValidatorIndex,
/// Kinds of misbehavior, along with proof. ValidatorSignature,
pub type Misbehavior = generic::Misbehavior< >;
AbridgedCandidateReceipt,
Hash, /// Kinds of misbehavior, along with proof.
ValidatorIndex, pub type Misbehavior = generic::Misbehavior<
ValidatorSignature, AbridgedCandidateReceipt,
>; Hash,
ValidatorIndex,
/// A summary of import of a statement. ValidatorSignature,
pub type Summary = generic::Summary<Hash, Id>; >;
/// Context necessary to construct a table. /// A summary of import of a statement.
pub trait Context { pub type Summary = generic::Summary<Hash, Id>;
/// Whether a authority is a member of a group.
/// Members are meant to submit candidates and vote on validity. impl<'a> From<&'a Statement> for PrimitiveStatement {
fn is_member_of(&self, authority: ValidatorIndex, group: &Id) -> bool; fn from(s: &'a Statement) -> PrimitiveStatement {
match *s {
/// requisite number of votes for validity from a group. generic::Statement::Valid(s) => PrimitiveStatement::Valid(s),
fn requisite_votes(&self, group: &Id) -> usize; generic::Statement::Invalid(s) => PrimitiveStatement::Invalid(s),
} generic::Statement::Candidate(ref s) => PrimitiveStatement::Candidate(s.hash()),
}
impl<C: Context> generic::Context for C { }
type AuthorityId = ValidatorIndex;
type Digest = Hash;
type GroupId = Id;
type Signature = ValidatorSignature;
type Candidate = AbridgedCandidateReceipt;
fn candidate_digest(candidate: &AbridgedCandidateReceipt) -> Hash {
candidate.hash()
}
fn candidate_group(candidate: &AbridgedCandidateReceipt) -> Id {
candidate.parachain_index.clone()
}
fn is_member_of(&self, authority: &Self::AuthorityId, group: &Id) -> bool {
Context::is_member_of(self, *authority, group)
}
fn requisite_votes(&self, group: &Id) -> usize {
Context::requisite_votes(self, group)
} }
} }
impl<'a> From<&'a Statement> for PrimitiveStatement { /// Concrete instantiations suitable for v1 primitives.
fn from(s: &'a Statement) -> PrimitiveStatement { pub mod v1 {
match *s { use crate::generic;
generic::Statement::Valid(s) => PrimitiveStatement::Valid(s), use primitives::v1::{
generic::Statement::Invalid(s) => PrimitiveStatement::Invalid(s), Hash,
generic::Statement::Candidate(ref s) => PrimitiveStatement::Candidate(s.hash()), Id, CommittedCandidateReceipt, CompactStatement as PrimitiveStatement,
ValidatorSignature, ValidatorIndex,
};
/// Statements about candidates on the network.
pub type Statement = generic::Statement<CommittedCandidateReceipt, Hash>;
/// Signed statements about candidates.
pub type SignedStatement = generic::SignedStatement<
CommittedCandidateReceipt,
Hash,
ValidatorIndex,
ValidatorSignature,
>;
/// Kinds of misbehavior, along with proof.
pub type Misbehavior = generic::Misbehavior<
CommittedCandidateReceipt,
Hash,
ValidatorIndex,
ValidatorSignature,
>;
/// A summary of import of a statement.
pub type Summary = generic::Summary<Hash, Id>;
impl<'a> From<&'a Statement> for PrimitiveStatement {
fn from(s: &'a Statement) -> PrimitiveStatement {
match *s {
generic::Statement::Valid(s) => PrimitiveStatement::Valid(s),
generic::Statement::Invalid(s) => PrimitiveStatement::Invalid(s),
generic::Statement::Candidate(ref s) => PrimitiveStatement::Candidate(s.hash()),
}
} }
} }
} }
...@@ -28,8 +28,8 @@ use std::{ ...@@ -28,8 +28,8 @@ use std::{
use sp_blockchain::HeaderBackend; use sp_blockchain::HeaderBackend;
use block_builder::{BlockBuilderApi, BlockBuilderProvider}; use block_builder::{BlockBuilderApi, BlockBuilderProvider};
use consensus::{Proposal, RecordProof}; use consensus::{Proposal, RecordProof};
use polkadot_primitives::{Block, Header}; use polkadot_primitives::v0::{Block, Header};
use polkadot_primitives::parachain::{ use polkadot_primitives::v0::{
ParachainHost, NEW_HEADS_IDENTIFIER, ParachainHost, NEW_HEADS_IDENTIFIER,
}; };
use runtime_primitives::traits::{DigestFor, HashFor}; use runtime_primitives::traits::{DigestFor, HashFor};
......
...@@ -21,11 +21,9 @@ ...@@ -21,11 +21,9 @@
use std::sync::Arc; use std::sync::Arc;
use polkadot_primitives::{ use polkadot_primitives::v0::{
BlakeTwo256, Block, Hash, HashT, BlakeTwo256, Block, Hash, HashT,
parachain::{ CollatorId, ParachainHost, Id as ParaId, Collation, ErasureChunk, CollationInfo,
CollatorId, ParachainHost, Id as ParaId, Collation, ErasureChunk, CollationInfo,
},
}; };
use polkadot_erasure_coding as erasure; use polkadot_erasure_coding as erasure;
use sp_api::ProvideRuntimeApi; use sp_api::ProvideRuntimeApi;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
//! Errors that can occur during the validation process. //! Errors that can occur during the validation process.
use polkadot_primitives::{parachain::ValidatorId, Hash}; use polkadot_primitives::v0::{ValidatorId, Hash};
/// Error type for validation /// Error type for validation
#[derive(Debug, derive_more::Display, derive_more::From)] #[derive(Debug, derive_more::Display, derive_more::From)]
...@@ -77,7 +77,7 @@ pub enum Error { ...@@ -77,7 +77,7 @@ pub enum Error {
CommitmentsMismatch, CommitmentsMismatch,
/// The parachain for which validation work is being done is not active. /// The parachain for which validation work is being done is not active.
#[display(fmt = "Parachain {:?} is not active", _0)] #[display(fmt = "Parachain {:?} is not active", _0)]
InactiveParachain(polkadot_primitives::parachain::Id), InactiveParachain(polkadot_primitives::v0::Id),
/// Block data is too big /// Block data is too big
#[display(fmt = "Block data is too big (maximum allowed size: {}, actual size: {})", size, max_size)] #[display(fmt = "Block data is too big (maximum allowed size: {}, actual size: {})", size, max_size)]
BlockDataTooBig { size: u64, max_size: u64 }, BlockDataTooBig { size: u64, max_size: u64 },
......
...@@ -34,7 +34,7 @@ use std::{ ...@@ -34,7 +34,7 @@ use std::{
sync::Arc, sync::Arc,
}; };
use codec::Encode; use codec::Encode;
use polkadot_primitives::parachain::{ use polkadot_primitives::v0::{
Id as ParaId, Chain, DutyRoster, AbridgedCandidateReceipt, Id as ParaId, Chain, DutyRoster, AbridgedCandidateReceipt,
CompactStatement as PrimitiveStatement, CompactStatement as PrimitiveStatement,
PoVBlock, ErasureChunk, ValidatorSignature, ValidatorIndex, PoVBlock, ErasureChunk, ValidatorSignature, ValidatorIndex,
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
use codec::Encode; use codec::Encode;
use polkadot_erasure_coding as erasure; use polkadot_erasure_coding as erasure;
use polkadot_primitives::parachain::{ use polkadot_primitives::v0::{
CollationInfo, PoVBlock, LocalValidationData, GlobalValidationSchedule, OmittedValidationData, CollationInfo, PoVBlock, LocalValidationData, GlobalValidationSchedule, OmittedValidationData,
AvailableData, FeeSchedule, CandidateCommitments, ErasureChunk, ParachainHost, AvailableData, FeeSchedule, CandidateCommitments, ErasureChunk, ParachainHost,
Id as ParaId, AbridgedCandidateReceipt, ValidationCode, Id as ParaId, AbridgedCandidateReceipt, ValidationCode,
}; };
use polkadot_primitives::{Block, BlockId, Balance, Hash}; use polkadot_primitives::v0::{Block, BlockId, Balance, Hash};
use parachain::{ use parachain::{
wasm_executor::{self, ExecutionMode}, wasm_executor::{self, ExecutionMode},
primitives::{UpwardMessage, ValidationParams}, primitives::{UpwardMessage, ValidationParams},
...@@ -125,7 +125,7 @@ impl<'a> ValidatedCandidate<'a> { ...@@ -125,7 +125,7 @@ impl<'a> ValidatedCandidate<'a> {
omitted_validation, omitted_validation,
}; };
let erasure_chunks = erasure::obtain_chunks( let erasure_chunks = erasure::obtain_chunks_v0(
n_validators, n_validators,
&available_data, &available_data,
)?; )?;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use futures::channel::oneshot; use futures::channel::oneshot;
use polkadot_primitives::Hash; use polkadot_primitives::v0::Hash;
/// Track includability of a set of candidates, /// Track includability of a set of candidates,
pub(super) fn track<I: IntoIterator<Item=(Hash, bool)>>(candidates: I) pub(super) fn track<I: IntoIterator<Item=(Hash, bool)>>(candidates: I)
......
...@@ -21,11 +21,12 @@ use std::collections::hash_map::{HashMap, Entry}; ...@@ -21,11 +21,12 @@ use std::collections::hash_map::{HashMap, Entry};
use std::sync::Arc; use std::sync::Arc;
use availability_store::{Store as AvailabilityStore}; use availability_store::{Store as AvailabilityStore};
use table::{self, Table, Context as TableContextTrait}; use table::{v0 as table_v0, Table, Context as TableContextTrait};
use polkadot_primitives::{Block, Hash}; use polkadot_primitives::v0::{
use polkadot_primitives::parachain::{ Block, Hash,
Id as ParaId, AbridgedCandidateReceipt, ValidatorPair, ValidatorId, Id as ParaId, AbridgedCandidateReceipt, ValidatorPair, ValidatorId,
AttestedCandidate, ParachainHost, PoVBlock, ValidatorIndex, SigningContext, AttestedCandidate, ParachainHost, PoVBlock, ValidatorIndex, SigningContext,
ValidatorSignature,
}; };
use parking_lot::Mutex; use parking_lot::Mutex;
...@@ -44,7 +45,7 @@ use crate::Error; ...@@ -44,7 +45,7 @@ use crate::Error;
mod includable; mod includable;
pub use table::{SignedStatement, Statement}; pub use table_v0::{SignedStatement, Statement};
pub use table::generic::Statement as GenericStatement; pub use table::generic::Statement as GenericStatement;
struct TableContext { struct TableContext {
...@@ -54,9 +55,23 @@ struct TableContext { ...@@ -54,9 +55,23 @@ struct TableContext {
validators: Vec<ValidatorId>, validators: Vec<ValidatorId>,
} }
impl table::Context for TableContext { impl TableContextTrait for TableContext {
fn is_member_of(&self, authority: ValidatorIndex, group: &ParaId) -> bool {