Erasure encoding availability (#345)

* Erasure encoding availability initial commit

 * Modifications to availability store to keep chunks as well as
   reconstructed blocks and extrinsics.
 * Gossip messages containig signed erasure chunks.
 * Requesting eraure chunks with polkadot-specific messages.
 * Validation of erasure chunk messages.

* Apply suggestions from code review

Co-Authored-By: Luke Schoen <ltfschoen@users.noreply.github.com>

* Fix build after a merge

* Gossip erasure chunk messages under their own topic

* erasure_chunks should use the appropriate topic

* Updates Cargo.lock

* Fixes after merge

* Removes a couple of leftover pieces of code

* Fixes simple stuff from review

* Updates erasure and storage for more flexible logic

* Changes validation and candidate receipt production.

* Adds add_erasure_chunks method

* Fixes most of the nits

* Better validate_collation and validate_receipt functions

* Fixes the tests

* Apply suggestions from code review

Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>

* Removes unwrap() calls

* Removes ErasureChunks primitive

* Removes redundant fields from ErasureChunk struct

* AvailabilityStore should store CandidateReceipt

* Changes the way chunk messages are imported and validated.

 * Availability store now stores a validator_index and n_validators for
 each relay_parent.
 * Availability store now also stores candidate receipts.
 * Removes importing chunks in the table and moves it into network
 gossip validation.
 * Validation of erasure messages id done against receipts that are
 stored in the availability store.

* Correctly compute topics for erasure messages

* Removes an unused parameter

* Refactors availability db querying into a helper

* Adds the apis described in the writeup

* Adds a runtime api to extract erasure roots form raw extrinsics.

* Adds a barebone BlockImport impl for avalability store

* Adds the implementation of the availability worker

* Fix build after the merge with master.

* Make availability store API async

* Bring back the default wasmtime feature

* Lines width

* Bump runtime version

* Formatting and dead code elimination

* some style nits (#1)

* More nits and api cleanup

* Disable wasm CI for availability-store

* Another nit

* Formatting
This commit is contained in:
Fedor Sakharov
2019-12-03 17:49:07 +03:00
committed by Robert Habermeier
parent ec54d5b1e4
commit 99d164b5e7
29 changed files with 2957 additions and 572 deletions
+18 -3
View File
@@ -224,7 +224,7 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
}
};
let gossip_validator = network_gossip::register_validator(
let mut gossip_validator = network_gossip::register_validator(
service.network(),
(is_known, client.clone()),
);
@@ -239,7 +239,9 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
av_store::Store::new(::av_store::Config {
cache_size: None,
path,
})?
},
polkadot_network::AvailabilityNetworkShim(service.network()),
)?
};
{
@@ -249,6 +251,11 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
);
}
{
let availability_store = availability_store.clone();
gossip_validator.register_availability_store(availability_store);
}
// collator connections and validation network both fulfilled by this
let validation_network = ValidationNetwork::new(
service.network(),
@@ -265,7 +272,7 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
service.transaction_pool(),
Arc::new(service.spawn_task_handle()),
service.keystore(),
availability_store,
availability_store.clone(),
polkadot_runtime::constants::time::SLOT_DURATION,
max_block_data_size,
);
@@ -275,6 +282,14 @@ pub fn new_full(config: Configuration<CustomConfiguration, GenesisConfig>)
let can_author_with =
consensus_common::CanAuthorWithNativeVersion::new(client.executor().clone());
let block_import = availability_store.block_import(
block_import,
client.clone(),
Arc::new(service.spawn_task_handle()),
service.keystore(),
)?;
let babe_config = babe::BabeParams {
keystore: service.keystore(),
client,