mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 20:08:02 +00:00
Return compressed PoV from collation (#942)
* Return compressed PoV from collation This enables us to also print the size of the compressed PoV. * FMT * Update Polkadot & Substrate * Fix compilation * Fixes * FMT
This commit is contained in:
Generated
+518
-388
File diff suppressed because it is too large
Load Diff
@@ -37,10 +37,11 @@ polkadot-node-subsystem-test-helpers = { git = "https://github.com/paritytech/po
|
||||
# Cumulus dependencies
|
||||
cumulus-test-runtime = { path = "../../test/runtime" }
|
||||
cumulus-test-client = { path = "../../test/client" }
|
||||
# Substrate dependencies
|
||||
|
||||
# Substrate dependencies
|
||||
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# Other dependencies
|
||||
async-trait = "0.1.42"
|
||||
|
||||
@@ -33,7 +33,7 @@ use sp_runtime::{
|
||||
|
||||
use cumulus_client_consensus_common::ParachainConsensus;
|
||||
use polkadot_node_primitives::{
|
||||
BlockData, Collation, CollationGenerationConfig, CollationResult, PoV,
|
||||
BlockData, Collation, CollationGenerationConfig, CollationResult, MaybeCompressedPoV, PoV,
|
||||
};
|
||||
use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProtocolMessage};
|
||||
use polkadot_overseer::Handle as OverseerHandle;
|
||||
@@ -184,9 +184,8 @@ where
|
||||
&self,
|
||||
block: ParachainBlockData<Block>,
|
||||
block_hash: Block::Hash,
|
||||
pov: PoV,
|
||||
) -> Option<Collation> {
|
||||
let block_data = BlockData(block.encode());
|
||||
|
||||
let collation_info = self
|
||||
.fetch_collation_info(block_hash, block.header())
|
||||
.map_err(|e| {
|
||||
@@ -206,7 +205,7 @@ where
|
||||
horizontal_messages: collation_info.horizontal_messages,
|
||||
hrmp_watermark: collation_info.hrmp_watermark,
|
||||
head_data: collation_info.head_data,
|
||||
proof_of_validity: PoV { block_data },
|
||||
proof_of_validity: MaybeCompressedPoV::Compressed(pov),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -274,8 +273,17 @@ where
|
||||
b.storage_proof().encode().len() as f64 / 1024f64,
|
||||
);
|
||||
|
||||
let pov =
|
||||
polkadot_node_primitives::maybe_compress_pov(PoV { block_data: BlockData(b.encode()) });
|
||||
|
||||
tracing::info!(
|
||||
target: LOG_TARGET,
|
||||
"Compressed PoV size: {}kb",
|
||||
pov.block_data.0.len() as f64 / 1024f64,
|
||||
);
|
||||
|
||||
let block_hash = b.header().hash();
|
||||
let collation = self.build_collation(b, block_hash)?;
|
||||
let collation = self.build_collation(b, block_hash, pov)?;
|
||||
|
||||
let (result_sender, signed_stmt_recv) = oneshot::channel();
|
||||
|
||||
@@ -452,10 +460,13 @@ mod tests {
|
||||
.expect("Collation is build")
|
||||
.collation;
|
||||
|
||||
let block_data = collation.proof_of_validity.block_data;
|
||||
let pov = collation.proof_of_validity.into_compressed();
|
||||
|
||||
let decompressed =
|
||||
sp_maybe_compressed_blob::decompress(&pov.block_data.0, 1024 * 1024 * 10).unwrap();
|
||||
|
||||
let block =
|
||||
ParachainBlockData::<Block>::decode(&mut &block_data.0[..]).expect("Is a valid block");
|
||||
ParachainBlockData::<Block>::decode(&mut &decompressed[..]).expect("Is a valid block");
|
||||
|
||||
assert_eq!(1, *block.header().number());
|
||||
|
||||
|
||||
@@ -337,6 +337,7 @@ fn build_polkadot_full_node(
|
||||
true,
|
||||
None,
|
||||
telemetry_worker_handle,
|
||||
false,
|
||||
polkadot_service::RealOverseerGen,
|
||||
)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user