Skip to content
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c71487f
Support multiple blocks in `ParachainBlockData`
bkchr Oct 16, 2024
0cdb13d
Comments
bkchr Oct 16, 2024
4415530
Add a test
bkchr Oct 18, 2024
109b3f2
Only set the head on the last block
bkchr Oct 18, 2024
6f7667d
Handle versioning in collation generation
bkchr Oct 18, 2024
a8a64bc
Write tests for pov-recovery
bkchr Oct 18, 2024
3c0f51a
Use enum to be future proof
bkchr Oct 18, 2024
9dd1704
Merge branch 'master'
bkchr Oct 18, 2024
f7b2bbf
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Oct 18, 2024
e8caeb9
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Nov 6, 2024
fbf15b9
Merge remote-tracking branch 'refs/remotes/origin/master'
bkchr Nov 15, 2024
acb64ae
Use scale
bkchr Nov 15, 2024
70e7d50
Handle UMPSignals
bkchr Nov 15, 2024
91767c1
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Jan 2, 2025
aae2d2b
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Jan 31, 2025
e5277ff
Ensure the blocks match
bkchr Jan 31, 2025
8779f5f
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Mar 21, 2025
7f20108
Only one proof
bkchr Mar 21, 2025
ce343a6
Fix warnings
bkchr Mar 23, 2025
44ab288
Fix compilation errors
bkchr Mar 24, 2025
8e46176
More fixes
bkchr Mar 24, 2025
b0b041d
FMT..
bkchr Mar 24, 2025
b6cfcda
More
bkchr Mar 24, 2025
05096af
MIGHTY CLIPPY ACCEPT MY SACRIFICE
bkchr Mar 25, 2025
4c1557b
Merge branch 'master'
bkchr Mar 25, 2025
fa08898
Update from github-actions[bot] running command 'prdoc --bump major -…
github-actions[bot] Mar 25, 2025
4f5ffb3
Fix doc issue
bkchr Mar 25, 2025
99f814c
Update from github-actions[bot] running command 'fmt'
github-actions[bot] Mar 25, 2025
146f29d
Fix some issues
bkchr Mar 25, 2025
96791f5
Merge branch 'bkchr-parachain-block-data-multiple-blocks' of github.c…
bkchr Mar 25, 2025
06dba39
Fix bug
bkchr Mar 25, 2025
cedb8e2
Fix more zombienet tests
bkchr Mar 26, 2025
d79ebcf
Let's sleep longer
bkchr Mar 26, 2025
aae6db9
Use debug for logging
bkchr Mar 27, 2025
a178766
Merge branch 'master' into bkchr-parachain-block-data-multiple-blocks
bkchr Mar 27, 2025
93365e1
Merge branch 'master' into bkchr-parachain-block-data-multiple-blocks
bkchr Mar 27, 2025
9f70dac
Update cumulus/primitives/core/Cargo.toml
bkchr Mar 31, 2025
c2f867f
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Apr 3, 2025
d4904ec
Review comments
bkchr Apr 3, 2025
58ddac0
Merge branch 'master' into bkchr-parachain-block-data-multiple-blocks
bkchr Apr 4, 2025
583efc2
Make it backwards and forwards compatible
bkchr Apr 4, 2025
16d95c9
Update pr_6137.prdoc
bkchr Apr 4, 2025
80e2a82
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Apr 7, 2025
a303b8c
Update cumulus/primitives/core/src/parachain_block_data.rs
bkchr Apr 7, 2025
c7c5b06
Update cumulus/pallets/parachain-system/src/validate_block/implementa…
bkchr Apr 8, 2025
369cd53
Merge branch 'master' into bkchr-parachain-block-data-multiple-blocks
bkchr Apr 8, 2025
1e130c6
Ensure we don't share the `recorder`
bkchr Apr 9, 2025
cd7ebf7
Merge branch 'master' into bkchr-parachain-block-data-multiple-blocks
bkchr Apr 9, 2025
1ef54b5
Fix warning
bkchr Apr 9, 2025
8e9f19e
Merge branch 'bkchr-parachain-block-data-multiple-blocks' of github.c…
bkchr Apr 9, 2025
225dd99
Remove more warnings
bkchr Apr 9, 2025
585e78a
Merge branch 'master' into bkchr-parachain-block-data-multiple-blocks
bkchr Apr 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/zombienet-reusable-preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ jobs:
echo "::warning::No CI workflow runs found for this commit"
exit 1
fi
sleep 10
sleep 60
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking - is it intentional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. 10 seconds are not enough and I have seen CI issues because of this.

done

#check if the build succeeded
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions cumulus/client/collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProt
use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::{CollatorPair, Id as ParaId};

use codec::{Decode, Encode};
use codec::Decode;
use futures::prelude::*;
use std::sync::Arc;

Expand Down Expand Up @@ -121,13 +121,7 @@ where

let (collation, b) = self.service.build_collation(&last_head, block_hash, candidate)?;

tracing::info!(
target: LOG_TARGET,
"PoV size {{ header: {}kb, extrinsics: {}kb, storage_proof: {}kb }}",
b.header().encode().len() as f64 / 1024f64,
b.extrinsics().encode().len() as f64 / 1024f64,
b.storage_proof().encode().len() as f64 / 1024f64,
);
b.log_size_info();

if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity {
tracing::info!(
Expand Down Expand Up @@ -337,6 +331,7 @@ pub fn start_collator_sync<Block, RA, BS, Spawner>(
mod tests {
use super::*;
use async_trait::async_trait;
use codec::Encode;
use cumulus_client_consensus_common::ParachainCandidate;
use cumulus_primitives_core::ParachainBlockData;
use cumulus_test_client::{
Expand Down Expand Up @@ -459,10 +454,10 @@ mod tests {
let block =
ParachainBlockData::<Block>::decode(&mut &decompressed[..]).expect("Is a valid block");

assert_eq!(1, *block.header().number());
assert_eq!(1, *block.blocks()[0].header().number());

// Ensure that we did not include `:code` in the proof.
let proof = block.storage_proof();
let proof = block.proof().clone();

let backend = sp_state_machine::create_proof_check_backend::<BlakeTwo256>(
*header.state_root(),
Expand Down
32 changes: 23 additions & 9 deletions cumulus/client/collator/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,14 @@ where

/// Fetch the collation info from the runtime.
///
/// Returns `Ok(Some(_))` on success, `Err(_)` on error or `Ok(None)` if the runtime api isn't
/// implemented by the runtime.
/// Returns `Ok(Some((CollationInfo, ApiVersion)))` on success, `Err(_)` on error or `Ok(None)`
/// if the runtime api isn't implemented by the runtime. `ApiVersion` being the version of the
/// [`CollectCollationInfo`] runtime api.
pub fn fetch_collation_info(
&self,
block_hash: Block::Hash,
header: &Block::Header,
) -> Result<Option<CollationInfo>, sp_api::ApiError> {
) -> Result<Option<(CollationInfo, u32)>, sp_api::ApiError> {
let runtime_api = self.runtime_api.runtime_api();

let api_version =
Expand All @@ -206,7 +207,7 @@ where
runtime_api.collect_collation_info(block_hash, header)?
};

Ok(Some(collation_info))
Ok(Some((collation_info, api_version)))
}

/// Build a full [`Collation`] from a given [`ParachainCandidate`]. This requires
Expand All @@ -220,7 +221,7 @@ where
block_hash: Block::Hash,
candidate: ParachainCandidate<Block>,
) -> Option<(Collation, ParachainBlockData<Block>)> {
let (header, extrinsics) = candidate.block.deconstruct();
let block = candidate.block;

let compact_proof = match candidate
.proof
Expand All @@ -234,8 +235,8 @@ where
};

// Create the parachain block data for the validators.
let collation_info = self
.fetch_collation_info(block_hash, &header)
let (collation_info, api_version) = self
.fetch_collation_info(block_hash, block.header())
.map_err(|e| {
tracing::error!(
target: LOG_TARGET,
Expand All @@ -246,10 +247,23 @@ where
.ok()
.flatten()?;

let block_data = ParachainBlockData::<Block>::new(header, extrinsics, compact_proof);
let block_data = ParachainBlockData::<Block>::new(vec![block], compact_proof);

let pov = polkadot_node_primitives::maybe_compress_pov(PoV {
block_data: BlockData(block_data.encode()),
block_data: BlockData(if api_version >= 3 {
block_data.encode()
} else {
let block_data = block_data.as_v0();

if block_data.is_none() {
tracing::error!(
target: LOG_TARGET,
"Trying to submit a collation with multiple blocks is not supported by the current runtime."
);
}

block_data?.encode()
}),
});

let upward_messages = collation_info
Expand Down
20 changes: 5 additions & 15 deletions cumulus/client/consensus/aura/src/collator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//! This module also exposes some standalone functions for common operations when building
//! aura-based collators.

use codec::{Codec, Encode};
use codec::Codec;
use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface;
use cumulus_client_consensus_common::{
self as consensus_common, ParachainBlockImportMarker, ParachainCandidate,
Expand Down Expand Up @@ -229,10 +229,7 @@ where
inherent_data: (ParachainInherentData, InherentData),
proposal_duration: Duration,
max_pov_size: usize,
) -> Result<
Option<(Collation, ParachainBlockData<Block>, Block::Hash)>,
Box<dyn Error + Send + 'static>,
> {
) -> Result<Option<(Collation, ParachainBlockData<Block>)>, Box<dyn Error + Send + 'static>> {
let maybe_candidate = self
.build_block_and_import(
parent_header,
Expand All @@ -250,13 +247,7 @@ where
if let Some((collation, block_data)) =
self.collator_service.build_collation(parent_header, hash, candidate)
{
tracing::info!(
target: crate::LOG_TARGET,
"PoV size {{ header: {}kb, extrinsics: {}kb, storage_proof: {}kb }}",
block_data.header().encode().len() as f64 / 1024f64,
block_data.extrinsics().encode().len() as f64 / 1024f64,
block_data.storage_proof().encode().len() as f64 / 1024f64,
);
block_data.log_size_info();

if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity {
tracing::info!(
Expand All @@ -266,10 +257,9 @@ where
);
}

Ok(Some((collation, block_data, hash)))
Ok(Some((collation, block_data)))
} else {
Err(Box::<dyn Error + Send + Sync>::from("Unable to produce collation")
as Box<dyn Error + Send>)
Err(Box::<dyn Error + Send + Sync>::from("Unable to produce collation"))
}
}

Expand Down
7 changes: 5 additions & 2 deletions cumulus/client/consensus/aura/src/collators/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,12 @@ where
.await
);

if let Some((collation, _, post_hash)) = maybe_collation {
if let Some((collation, block_data)) = maybe_collation {
let Some(block_hash) = block_data.blocks().first().map(|b| b.hash()) else {
continue
};
let result_sender =
Some(collator.collator_service().announce_with_barrier(post_hash));
Some(collator.collator_service().announce_with_barrier(block_hash));
request.complete(Some(CollationResult { collation, result_sender }));
} else {
request.complete(None);
Expand Down
15 changes: 12 additions & 3 deletions cumulus/client/consensus/aura/src/collators/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,16 @@ where
)
.await
{
Ok(Some((collation, block_data, new_block_hash))) => {
Ok(Some((collation, block_data))) => {
let Some(new_block_header) =
block_data.blocks().first().map(|b| b.header().clone())
else {
tracing::error!(target: crate::LOG_TARGET, "Produced PoV doesn't contain any blocks");
break
};

let new_block_hash = new_block_header.hash();

// Here we are assuming that the import logic protects against equivocations
// and provides sybil-resistance, as it should.
collator.collator_service().announce_block(new_block_hash, None);
Expand All @@ -409,7 +418,7 @@ where
export_pov.clone(),
collation.proof_of_validity.clone().into_compressed(),
new_block_hash,
*block_data.header().number(),
*new_block_header.number(),
parent_header.clone(),
*relay_parent_header.state_root(),
*relay_parent_header.number(),
Expand Down Expand Up @@ -439,7 +448,7 @@ where
.await;

parent_hash = new_block_hash;
parent_header = block_data.into_header();
parent_header = new_block_header;
},
Ok(None) => {
tracing::debug!(target: crate::LOG_TARGET, "No block proposal");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,25 @@ async fn handle_collation_message<Block: BlockT, RClient: RelayChainInterface +
},
};

tracing::info!(
target: LOG_TARGET,
"PoV size {{ header: {:.2}kB, extrinsics: {:.2}kB, storage_proof: {:.2}kB }}",
block_data.header().encoded_size() as f64 / 1024f64,
block_data.extrinsics().encoded_size() as f64 / 1024f64,
block_data.storage_proof().encoded_size() as f64 / 1024f64,
);
block_data.log_size_info();

if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity {
if let Some(pov_path) = export_pov {
if let Ok(Some(relay_parent_header)) =
relay_client.header(BlockId::Hash(relay_parent)).await
{
export_pov_to_path::<Block>(
pov_path.clone(),
pov.clone(),
block_data.header().hash(),
*block_data.header().number(),
parent_header.clone(),
relay_parent_header.state_root,
relay_parent_header.number,
max_pov_size,
);
if let Some(header) = block_data.blocks().first().map(|b| b.header()) {
export_pov_to_path::<Block>(
pov_path.clone(),
pov.clone(),
header.hash(),
*header.number(),
parent_header.clone(),
relay_parent_header.state_root,
relay_parent_header.number,
max_pov_size,
);
}
} else {
tracing::error!(target: LOG_TARGET, "Failed to get relay parent header from hash: {relay_parent:?}");
}
Expand Down
Loading
Loading