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
This commit is contained in:
Robert Habermeier
2020-07-09 21:23:03 -04:00
committed by GitHub
parent 6957847b6b
commit 3b13cd9a85
76 changed files with 1542 additions and 999 deletions
@@ -29,9 +29,8 @@ use polkadot_subsystem::messages::{
RuntimeApiRequest,
};
use node_primitives::{ProtocolId, View, SignedFullStatement};
use polkadot_primitives::Hash;
use polkadot_primitives::parachain::{
CompactStatement, ValidatorIndex, ValidatorId, SigningContext, ValidatorSignature,
use polkadot_primitives::v1::{
Hash, CompactStatement, ValidatorIndex, ValidatorId, SigningContext, ValidatorSignature,
};
use parity_scale_codec::{Encode, Decode};
@@ -891,7 +890,7 @@ mod tests {
use super::*;
use sp_keyring::Sr25519Keyring;
use node_primitives::Statement;
use polkadot_primitives::parachain::{AbridgedCandidateReceipt};
use polkadot_primitives::v1::CommittedCandidateReceipt;
use assert_matches::assert_matches;
use futures::executor::{self, ThreadPool};
@@ -911,23 +910,23 @@ mod tests {
};
let candidate_a = {
let mut c = AbridgedCandidateReceipt::default();
c.relay_parent = parent_hash;
c.parachain_index = 1.into();
let mut c = CommittedCandidateReceipt::default();
c.descriptor.relay_parent = parent_hash;
c.descriptor.para_id = 1.into();
c
};
let candidate_b = {
let mut c = AbridgedCandidateReceipt::default();
c.relay_parent = parent_hash;
c.parachain_index = 2.into();
let mut c = CommittedCandidateReceipt::default();
c.descriptor.relay_parent = parent_hash;
c.descriptor.para_id = 2.into();
c
};
let candidate_c = {
let mut c = AbridgedCandidateReceipt::default();
c.relay_parent = parent_hash;
c.parachain_index = 3.into();
let mut c = CommittedCandidateReceipt::default();
c.descriptor.relay_parent = parent_hash;
c.descriptor.para_id = 3.into();
c
};
@@ -1140,9 +1139,9 @@ mod tests {
let hash_c = [3; 32].into();
let candidate = {
let mut c = AbridgedCandidateReceipt::default();
c.relay_parent = hash_c;
c.parachain_index = 1.into();
let mut c = CommittedCandidateReceipt::default();
c.descriptor.relay_parent = hash_c;
c.descriptor.para_id = 1.into();
c
};
let candidate_hash = candidate.hash();
@@ -1275,9 +1274,9 @@ mod tests {
let hash_c = [3; 32].into();
let candidate = {
let mut c = AbridgedCandidateReceipt::default();
c.relay_parent = hash_b;
c.parachain_index = 1.into();
let mut c = CommittedCandidateReceipt::default();
c.descriptor.relay_parent = hash_b;
c.descriptor.para_id = 1.into();
c
};