mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Compact proof. (#295)
* compact, need to be made optional and look into/compress child trie roots/state. * proto with child trie support * Missing set_offchain_storage overload. * right name * Ignore offchain indexing in validation function. * patch trie-db * decompress from iter * use compressed proof * remove wasm blob from proof (no inject plugged yet) * change lock * update trie * change in toml * Revert "change in toml" This reverts commit aa5c56850ef461ce3cb774213a92af4b1dd6cee5. * use patch to branches * i * i:wq * switch branch * ii * ok, needed to patch the runtime by putting substrate patch in polkadot project. * test passing with this conf * actual lazy code fetch * patch issue * Code reorg * restore commented tests. * update deps. * remove polka patch * fixes * remove patch * revert cargo.lock * cargo update -p sp-trie polkadot-service * fix collator test (using parent state root). * Update pallets/parachain-system/src/validate_block/implementation.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove encode_witness test function. * Update pallets/parachain-system/src/validate_block/implementation.rs * Fix compilation Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -25,7 +25,7 @@ use sp_consensus::BlockStatus;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header as HeaderT, Zero},
|
||||
traits::{Block as BlockT, Header as HeaderT, Zero, HashFor},
|
||||
};
|
||||
|
||||
use cumulus_client_consensus_common::ParachainConsensus;
|
||||
@@ -225,8 +225,19 @@ where
|
||||
|
||||
let (header, extrinsics) = candidate.block.deconstruct();
|
||||
|
||||
let compact_proof = match candidate.proof.into_compact_proof::<HashFor<Block>>(
|
||||
last_head.state_root().clone(),
|
||||
) {
|
||||
Ok(proof) => proof,
|
||||
Err(e) => {
|
||||
tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e);
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Create the parachain block data for the validators.
|
||||
let b = ParachainBlockData::<Block>::new(header, extrinsics, candidate.proof);
|
||||
let b = ParachainBlockData::<Block>::new(header, extrinsics, compact_proof);
|
||||
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
@@ -440,7 +451,10 @@ mod tests {
|
||||
assert_eq!(1, *block.header().number());
|
||||
|
||||
// Ensure that we did not include `:code` in the proof.
|
||||
let db = block.storage_proof().clone().into_memory_db();
|
||||
let db = block.storage_proof()
|
||||
.to_storage_proof::<BlakeTwo256>(Some(header.state_root()))
|
||||
.unwrap().0
|
||||
.into_memory_db();
|
||||
|
||||
let backend =
|
||||
sp_state_machine::new_in_mem::<BlakeTwo256>().update_backend(*header.state_root(), db);
|
||||
|
||||
Reference in New Issue
Block a user