Code, PoV compression and remove CompressedPoV struct (#2852)

* use compressed blob in candidate-validation

* add some tests for compressed code blobs

* remove CompressedPoV and apply compression in collation-generation

* decompress BlockData before executing

* don't produce oversized collations

* add test for PoV decompression failure

* fix tests and clean up

* fix test

* address review and fix CI

* take this )
This commit is contained in:
Robert Habermeier
2021-04-08 22:09:36 +02:00
committed by GitHub
parent bb48c47fbf
commit 896ec8dbc3
16 changed files with 489 additions and 380 deletions
@@ -36,7 +36,7 @@ use std::borrow::Cow;
use std::time::Duration;
use futures::channel::mpsc;
use polkadot_node_primitives::MAX_COMPRESSED_POV_SIZE;
use polkadot_node_primitives::MAX_POV_SIZE;
use strum::EnumIter;
pub use sc_network::config as network;
@@ -84,7 +84,7 @@ const MIN_BANDWIDTH_BYTES: u64 = 50 * 1024 * 1024;
/// Timeout for PoV like data, 2 times what it should take, assuming we can fully utilize the
/// bandwidth. This amounts to two seconds right now.
const POV_REQUEST_TIMEOUT_CONNECTED: Duration =
Duration::from_millis(2 * 1000 * (MAX_COMPRESSED_POV_SIZE as u64) / MIN_BANDWIDTH_BYTES);
Duration::from_millis(2 * 1000 * (MAX_POV_SIZE as u64) / MIN_BANDWIDTH_BYTES);
impl Protocol {
/// Get a configuration for a given Request response protocol.
@@ -114,7 +114,7 @@ impl Protocol {
Protocol::CollationFetching => RequestResponseConfig {
name: p_name,
max_request_size: 10_000,
max_response_size: MAX_COMPRESSED_POV_SIZE as u64,
max_response_size: MAX_POV_SIZE as u64,
// Taken from initial implementation in collator protocol:
request_timeout: POV_REQUEST_TIMEOUT_CONNECTED,
inbound_queue: Some(tx),
@@ -122,7 +122,7 @@ impl Protocol {
Protocol::PoVFetching => RequestResponseConfig {
name: p_name,
max_request_size: 1_000,
max_response_size: MAX_COMPRESSED_POV_SIZE as u64,
max_response_size: MAX_POV_SIZE as u64,
request_timeout: POV_REQUEST_TIMEOUT_CONNECTED,
inbound_queue: Some(tx),
},
@@ -130,7 +130,7 @@ impl Protocol {
name: p_name,
max_request_size: 1_000,
// Available data size is dominated by the PoV size.
max_response_size: MAX_COMPRESSED_POV_SIZE as u64,
max_response_size: MAX_POV_SIZE as u64,
request_timeout: POV_REQUEST_TIMEOUT_CONNECTED,
inbound_queue: Some(tx),
},
@@ -23,7 +23,7 @@ use polkadot_primitives::v1::{
Hash,
};
use polkadot_primitives::v1::Id as ParaId;
use polkadot_node_primitives::{AvailableData, CompressedPoV, ErasureChunk};
use polkadot_node_primitives::{AvailableData, PoV, ErasureChunk};
use super::request::IsRequest;
use super::Protocol;
@@ -107,7 +107,7 @@ pub struct CollationFetchingRequest {
pub enum CollationFetchingResponse {
/// Deliver requested collation.
#[codec(index = 0)]
Collation(CandidateReceipt, CompressedPoV),
Collation(CandidateReceipt, PoV),
}
impl IsRequest for CollationFetchingRequest {
@@ -127,7 +127,7 @@ pub struct PoVFetchingRequest {
pub enum PoVFetchingResponse {
/// Deliver requested PoV.
#[codec(index = 0)]
PoV(CompressedPoV),
PoV(PoV),
/// PoV was not found in store.
#[codec(index = 1)]
NoSuchPoV,