Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
261 commits
Select commit Hold shift + click to select a range
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
f10615b
Initial support for ignoring trie nodes
bkchr Mar 27, 2025
c64ac05
Introduce `IgnoredNodes` type to hold the ignored nodes
bkchr Mar 31, 2025
9f70dac
Update cumulus/primitives/core/Cargo.toml
bkchr Mar 31, 2025
55753f4
Try to get the tests working
bkchr Mar 31, 2025
c8ec8e2
Work on the test
bkchr Apr 1, 2025
80e8b3d
Fix the test properly
bkchr Apr 2, 2025
d375bde
Extend the test
bkchr Apr 2, 2025
1d74d6b
Fix test
bkchr Apr 2, 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
a6e621d
Merge branch 'bkchr-parachain-block-data-multiple-blocks' into bkchr-…
bkchr Apr 7, 2025
a303b8c
Update cumulus/primitives/core/src/parachain_block_data.rs
bkchr Apr 7, 2025
0d78e54
Merge remote-tracking branch 'origin/bkchr-parachain-block-data-multi…
bkchr Apr 7, 2025
8becf8c
Fix compile errors
bkchr Apr 7, 2025
085944c
Merge remote-tracking branch 'origin/master' into bkchr-ignore-trie-n…
bkchr Apr 10, 2025
0ac06c5
Ensure no nodes are shared
bkchr Apr 10, 2025
e4c66ee
Take by value
bkchr Apr 11, 2025
b201e25
Start
bkchr Apr 11, 2025
5a7abe6
slot-based-collator: Do not skip slots
bkchr Apr 14, 2025
5df69e5
Make it work
bkchr Apr 15, 2025
ce21979
Start writing a test
bkchr Apr 16, 2025
2701420
Adds failing test
bkchr May 2, 2025
45b336c
Fix the test
bkchr May 16, 2025
0b2941f
Some small code cleanups
bkchr May 19, 2025
f35762e
Improve some stuff
bkchr Jun 3, 2025
36cda25
Let's start
bkchr Jun 20, 2025
c6866b1
More work
bkchr Jun 23, 2025
f8ea621
More work
bkchr Jun 24, 2025
f8ac8e4
Some fixes
bkchr Jun 25, 2025
79f1aab
More fixes
bkchr Jun 26, 2025
8c56db7
Some docs
bkchr Jun 26, 2025
3d738ba
Rename `CoreSelector` to `CoreInfo`
bkchr Jun 26, 2025
e9bc7c7
Remove `SelectCore` runtime logic
bkchr Jun 26, 2025
7649714
Merge branch 'master'
bkchr Jun 26, 2025
35322f4
Merge remote-tracking branch 'origin/master' into bkchr-collator-forw…
bkchr Jun 26, 2025
c6be8a4
Update from github-actions[bot] running command 'fmt'
github-actions[bot] Jun 27, 2025
2a03e75
Fixes
bkchr Jun 27, 2025
5612fbf
Merge remote-tracking branch 'origin/bkchr-collator-forward-core-to-r…
bkchr Jun 29, 2025
b8dd79f
Get the test working
bkchr Jul 1, 2025
b901193
More stuff
bkchr Jul 2, 2025
c1ef7d0
Some stuff
bkchr Jul 3, 2025
031a922
Try to make it more robust
bkchr Jul 4, 2025
8a3d996
Fix test
bkchr Jul 5, 2025
ed945ab
Redo master changes
bkchr Jul 7, 2025
04672c8
Fix
bkchr Jul 7, 2025
cb912d9
Introduce `SlotSchedule` runtime api
bkchr Jul 8, 2025
88794ad
Fix the ranges
bkchr Jul 9, 2025
679d281
Make `SlotTimer` use `relay_slot_duration`
bkchr Jul 10, 2025
943ab42
Handle authoring time and block interval better
bkchr Jul 10, 2025
291ce7a
Adds some test using glutton
bkchr Jul 10, 2025
1afbb0e
Log the core configuration
bkchr Jul 11, 2025
ff38660
Fix the core assignments
bkchr Jul 11, 2025
8296840
Fix test
bkchr Jul 14, 2025
a2b4aec
Fix block building interval
bkchr Jul 14, 2025
a1741fc
Introduce `MaxParachainBlockWeight`
bkchr Jul 14, 2025
a95d05b
Some test improvements
bkchr Jul 17, 2025
9cffb14
Fix and use `MaxParachainBlockWeight`
bkchr Jul 17, 2025
4e82e5d
Do not sleep directly on the last block
bkchr Jul 17, 2025
8024d08
Support skipping the last block in a slot
bkchr Jul 18, 2025
aeb8166
Fixes
bkchr Jul 21, 2025
98446be
Introduce `BundleInfo`
bkchr Jul 23, 2025
7fc391e
Start the transaction extension
bkchr Jul 24, 2025
e9f25de
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Jul 25, 2025
9156382
Adds new test for testing too big transactions
bkchr Jul 25, 2025
975a4b7
Implement the transaction extension
bkchr Jul 25, 2025
a040857
Forward the `BundleInfo` inherent digest
bkchr Jul 27, 2025
7075f4f
Forward the ignored nodes
bkchr Jul 28, 2025
49f5fdb
Handle block import
bkchr Jul 28, 2025
d34efa1
cumulus zombienet: Send transactions as immortal
bkchr Jul 29, 2025
55f057f
Some improvements
bkchr Jul 29, 2025
3a644bf
Merge remote-tracking branch 'origin/bkchr-zombienet-sdk-send-tx-as-i…
bkchr Jul 29, 2025
3f7f4ed
Ensure the block is the first in a core
bkchr Jul 29, 2025
e408165
Introduce `UseFullCore` digest item
bkchr Jul 30, 2025
5ed2fe0
Make one block per PoV working
bkchr Jul 31, 2025
c3eaaff
Move the `pov_bundling` tests to their own module
bkchr Aug 1, 2025
d42d947
Some small changes
bkchr Aug 1, 2025
93ce462
Okay
bkchr Aug 1, 2025
c74a2db
Runtime upgrade test
bkchr Aug 1, 2025
ffa37b9
Leftover changes
bkchr Aug 1, 2025
0ba90f8
Send as usigned transaction
bkchr Aug 2, 2025
46539ea
Rewrite `DynamicWeight` to fix the runtime upgrade test
bkchr Aug 3, 2025
dd20786
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Aug 5, 2025
0a36fce
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Sep 1, 2025
d3f0113
Fixes
bkchr Sep 1, 2025
7ce112d
Adds new test
bkchr Sep 6, 2025
7dde4a9
Start fixing the test
bkchr Sep 6, 2025
5741aa8
Fixes
bkchr Sep 8, 2025
24b3725
Try some things which are not yet perfect
bkchr Sep 8, 2025
5b87420
Fix function
bkchr Sep 9, 2025
894d987
Fix test
bkchr Sep 10, 2025
2725c6f
Introduce new test for inherents
bkchr Sep 12, 2025
3833dd1
Fix
bkchr Sep 12, 2025
e9937f1
Renamings and other fixes
bkchr Sep 12, 2025
f8dbab6
Change `SlotSchedule` runtime api
bkchr Sep 15, 2025
9388405
Do not execute a block again, if we just build it
bkchr Sep 15, 2025
3d7fd40
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Sep 17, 2025
b087795
New scenario
bkchr Sep 17, 2025
a0c4f9e
More tests
bkchr Sep 18, 2025
0970d3f
Rename to `block_bundling`
bkchr Sep 19, 2025
0f864d3
More renamings
bkchr Sep 19, 2025
386f38a
Remove outdated code
bkchr Sep 19, 2025
4a924dc
Forgot
bkchr Sep 19, 2025
ca37589
Adds the `SlotSchedule` runtime api
bkchr Sep 19, 2025
4d81c09
Fix
bkchr Sep 23, 2025
2959c03
Implement `ReplayStorageProofProvider` & `RecordingStorageProofProvider`
bkchr Sep 23, 2025
e0f9c45
Fixes
bkchr Sep 24, 2025
b00a95a
Fixes
bkchr Sep 26, 2025
5932267
Forward extensions to block builder
bkchr Sep 26, 2025
57f97e9
Split up block building and import
bkchr Sep 28, 2025
2b8e955
Introduce `tracing_block` test
bkchr Sep 29, 2025
d9d5a9d
`trace_block`: Support overwriting the `execute_block`
bkchr Sep 29, 2025
08e3250
Aux schema stuff
bkchr Sep 29, 2025
88a273e
FinalityNotification: Directly include stale blocks
bkchr Oct 1, 2025
9a0f6e6
Fix
bkchr Oct 1, 2025
92d166d
Move the proof size recording to its own crate
bkchr Oct 1, 2025
98f0d30
Pass `orig_hash` of the block
bkchr Oct 1, 2025
183bf63
Fix `tracing_block` job
bkchr Oct 1, 2025
cb4c8a6
Fix
bkchr Oct 1, 2025
a67e078
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Oct 2, 2025
eeeba24
Fixes
bkchr Oct 2, 2025
8b6fde5
Split up some stuff and document it
bkchr Oct 8, 2025
ef9b5b5
Docs and other stuff
bkchr Oct 9, 2025
751dc9d
Hacky solution
bkchr Oct 10, 2025
b426fe2
Fixes + comments
bkchr Oct 10, 2025
541d971
Merge remote-tracking branch 'origin/bkchr-wasm-builder-do-not-rebuil…
bkchr Oct 14, 2025
7ff7a77
Rename to block_weight
bkchr Oct 14, 2025
56df092
Fix
bkchr Oct 14, 2025
93c8891
More fixes
bkchr Oct 14, 2025
3079e3d
Fix
bkchr Oct 14, 2025
9480007
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Oct 14, 2025
4f2066b
Fix tests
bkchr Oct 15, 2025
057b7f7
Fixes
bkchr Oct 17, 2025
c9debc5
Tests
bkchr Oct 17, 2025
a4a6d5e
Fix some warnings and extend the tests
bkchr Oct 17, 2025
a281537
Start a benchmark
bkchr Oct 17, 2025
5bf99e4
cumulus-bootnodes: Do not require a specific hash
bkchr Oct 17, 2025
efb7b4a
Finish benchmarks
bkchr Oct 17, 2025
d46dc8e
Use the benchmarked weights in the extension
bkchr Oct 18, 2025
8412f82
Make `ONLY_OPERATIONAL` work
bkchr Oct 18, 2025
634614c
Fixes
bkchr Oct 22, 2025
ffbbf98
Fix tests
bkchr Oct 22, 2025
dc81e1d
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Nov 10, 2025
b5c7f76
Fixes
bkchr Nov 11, 2025
d303dd5
Start more testing
bkchr Nov 11, 2025
36f2c35
More tests
bkchr Nov 12, 2025
df7f0fe
Introduce `MaxParachainBlockWeight` and related functionality
bkchr Nov 13, 2025
e73e10e
Merge remote-tracking branch 'origin/master' into bkchr-parachain-blo…
bkchr Nov 13, 2025
2712aef
Update cumulus/pallets/parachain-system/src/block_weight/transaction_…
bkchr Nov 14, 2025
2917609
Update cumulus/pallets/parachain-system/src/block_weight/transaction_…
bkchr Nov 14, 2025
86ad20f
New test and some fixes
bkchr Nov 14, 2025
5b5190b
Ensure we ignore the block weight mode from the previous block
bkchr Nov 14, 2025
a8641d6
Update cumulus/pallets/parachain-system/src/validate_block/implementa…
bkchr Nov 14, 2025
eba0d14
Allow MBMs to take the full core
bkchr Nov 14, 2025
9de019e
Fixes
bkchr Nov 14, 2025
58620b1
Merge remote-tracking branch 'refs/remotes/origin/bkchr-parachain-blo…
bkchr Nov 14, 2025
8901237
Fix benchmark
bkchr Nov 14, 2025
ef27858
FMT
bkchr Nov 14, 2025
f048570
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Nov 17, 2025
331e22e
Merge remote-tracking branch 'origin/bkchr-parachain-block-weight' in…
bkchr Nov 17, 2025
cfefd6f
Fixes
bkchr Nov 17, 2025
345cd46
Fix basic test
bkchr Nov 18, 2025
0c514fc
Fix glutton tests
bkchr Nov 18, 2025
9d1924e
Fix glutton
bkchr Nov 18, 2025
6a530f2
Support full core weight for pre transactions
bkchr Nov 18, 2025
106baf0
Fix unsigned transactions
bkchr Nov 19, 2025
923b868
Fix runtime upgrade
bkchr Nov 19, 2025
76ca54b
Respect the dispatch class max weight
bkchr Nov 19, 2025
bfd636f
Fix `on_idle`
bkchr Nov 19, 2025
c900555
Test `on_poll`
bkchr Nov 20, 2025
9d1159e
More docs
bkchr Nov 20, 2025
0671a7c
Extend the runtime ugprade test
bkchr Nov 20, 2025
2cd991c
Extend the basic test to verify that restarting a node works
bkchr Nov 21, 2025
e0f55cf
`ExecuteBlock` split up seal verification and actual execution
bkchr Nov 21, 2025
988549c
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Nov 24, 2025
e121a8e
Update from github-actions[bot] running command 'fmt'
github-actions[bot] Nov 24, 2025
5140cbf
Remove unused dep
bkchr Nov 24, 2025
1b0dbd3
Required for the test as well
bkchr Nov 24, 2025
cdb07b9
Merge remote-tracking branch 'origin/bkchr-pallet-aura-ext-fix' into …
bkchr Nov 24, 2025
030cbe6
Work on block import
bkchr Nov 24, 2025
77c4c20
More cleanup
bkchr Nov 24, 2025
408af1c
Finish block import
bkchr Nov 25, 2025
e143583
Some fixes and improvements
bkchr Nov 26, 2025
63817e5
More fixes and improvements
bkchr Nov 26, 2025
f17515c
Fix more tests
bkchr Nov 27, 2025
551787b
Reset changes
bkchr Nov 27, 2025
92dd6a9
wasm-builder: Only overwrite wasm files if they changed
bkchr Nov 27, 2025
0f06e07
Add some more tests
bkchr Nov 28, 2025
9a31b28
Improve some of the elastic scaling tests
bkchr Nov 28, 2025
a54b82f
More improvements
bkchr Nov 28, 2025
90a801b
cumulus-zombienet-tests: Some optimizations and cleanups
bkchr Nov 28, 2025
4954683
Ensure last block has `maybe_last = true`
bkchr Nov 28, 2025
3afdc19
Apply suggestion from @bkchr
bkchr Nov 28, 2025
ef0d57a
Fixes
bkchr Nov 28, 2025
d204912
More fixes
bkchr Nov 28, 2025
fc02b18
Fix docs
bkchr Nov 28, 2025
68f4d22
More fixes
bkchr Nov 28, 2025
f91dd01
Remove copying from CI files
bkchr Nov 28, 2025
a6cf45d
More log fixes
bkchr Nov 28, 2025
0d4373d
Switch to builder pattern
bkchr Nov 28, 2025
d6ffc3d
Fix test
bkchr Nov 29, 2025
7f45fec
Fix
bkchr Nov 29, 2025
5d05910
Merge remote-tracking branch 'origin/bkchr-cumulus-tests-optimization…
bkchr Nov 29, 2025
9e00026
Update from github-actions[bot] running command 'fmt'
github-actions[bot] Nov 30, 2025
d932d48
Fix feature propagation
bkchr Nov 30, 2025
98d81b3
Fixes
bkchr Nov 30, 2025
7b3b7f0
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Dec 1, 2025
6afc275
Remove merge leftover
bkchr Dec 1, 2025
4792e10
Make clippy happy
bkchr Dec 1, 2025
45c8673
Fix tests
bkchr Dec 1, 2025
d5418b3
Fix docs
bkchr Dec 2, 2025
5c35f85
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Dec 2, 2025
4501d8f
Ensure we only build on top of blocks that are last in the core
bkchr Dec 2, 2025
984517e
Make asset hub rococo use 500ms
bkchr Dec 2, 2025
a587616
Please the clippy lord
bkchr Dec 2, 2025
443dd5f
More warnings..
bkchr Dec 2, 2025
4aad17f
Fix test
bkchr Dec 3, 2025
7ecc4e7
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Dec 4, 2025
db06f5b
Merge remote-tracking branch 'origin/master' into bkchr-fast-working-2
bkchr Dec 4, 2025
c0e0c53
FMT
bkchr Dec 4, 2025
7d8f738
Apply suggestion from @bkchr
bkchr Dec 4, 2025
c0871cd
Apply suggestion from @bkchr
bkchr Dec 4, 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
30 changes: 30 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ members = [
"cumulus/client/network",
"cumulus/client/parachain-inherent",
"cumulus/client/pov-recovery",
"cumulus/client/proof-size-recording",
"cumulus/client/relay-chain-inprocess-interface",
"cumulus/client/relay-chain-interface",
"cumulus/client/relay-chain-minimal-node",
Expand Down Expand Up @@ -753,6 +754,7 @@ cumulus-client-consensus-relay-chain = { path = "cumulus/client/consensus/relay-
cumulus-client-network = { path = "cumulus/client/network", default-features = false }
cumulus-client-parachain-inherent = { path = "cumulus/client/parachain-inherent", default-features = false }
cumulus-client-pov-recovery = { path = "cumulus/client/pov-recovery", default-features = false }
cumulus-client-proof-size-recording = { path = "cumulus/client/proof-size-recording", default-features = false }
cumulus-client-service = { path = "cumulus/client/service", default-features = false }
cumulus-pallet-aura-ext = { path = "cumulus/pallets/aura-ext", default-features = false }
cumulus-pallet-dmp-queue = { default-features = false, path = "cumulus/pallets/dmp-queue" }
Expand Down
1 change: 0 additions & 1 deletion cumulus/client/collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// along with Cumulus. If not, see <https://www.gnu.org/licenses/>.

//! Cumulus Collator implementation for Substrate.
use polkadot_node_primitives::CollationGenerationConfig;
use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProtocolMessage};
use polkadot_overseer::Handle as OverseerHandle;
Expand Down
167 changes: 113 additions & 54 deletions cumulus/client/collator/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
use cumulus_client_network::WaitToAnnounce;
use cumulus_primitives_core::{CollationInfo, CollectCollationInfo, ParachainBlockData};

use polkadot_primitives::UMP_SEPARATOR;
use sc_client_api::BlockBackend;
use sp_api::{ApiExt, ProvideRuntimeApi};
use sp_api::{ApiExt, ProvideRuntimeApi, StorageProof};
use sp_consensus::BlockStatus;
use sp_core::traits::SpawnNamed;
use sp_runtime::traits::{Block as BlockT, HashingFor, Header as HeaderT, Zero};
Expand All @@ -36,7 +37,6 @@ use codec::Encode;
use futures::channel::oneshot;
use parking_lot::Mutex;
use std::sync::Arc;

/// The logging target.
const LOG_TARGET: &str = "cumulus-collator";

Expand All @@ -59,6 +59,17 @@ pub trait ServiceInterface<Block: BlockT> {
candidate: ParachainCandidate<Block>,
) -> Option<(Collation, ParachainBlockData<Block>)>;

/// Build a multi-block collation.
///
/// Does the same as [`Self::build_collation`], but includes multiple blocks into one collation.
/// The given `parent_header` should be the header from the parent of the first block.
fn build_multi_block_collation(
&self,
parent_header: &Block::Header,
blocks: Vec<Block>,
proof: StorageProof,
) -> Option<(Collation, ParachainBlockData<Block>)>;

/// Inform networking systems that the block should be announced after a signal has
/// been received to indicate the block has been seconded by a relay-chain validator.
///
Expand Down Expand Up @@ -215,53 +226,82 @@ where
/// as it fetches underlying runtime API data.
///
/// This also returns the unencoded parachain block data, in case that is desired.
pub fn build_collation(
fn build_multi_block_collation(
&self,
parent_header: &Block::Header,
block_hash: Block::Hash,
candidate: ParachainCandidate<Block>,
blocks: Vec<Block>,
proof: StorageProof,
) -> Option<(Collation, ParachainBlockData<Block>)> {
let block = candidate.block;
let compact_proof =
match proof.into_compact_proof::<HashingFor<Block>>(*parent_header.state_root()) {
Ok(proof) => proof,
Err(e) => {
tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e);
return None
},
};

let compact_proof = match candidate
.proof
.into_compact_proof::<HashingFor<Block>>(*parent_header.state_root())
{
Ok(proof) => proof,
Err(e) => {
tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e);
return None
},
};
let mut api_version = 0;
let mut upward_messages = Vec::new();
let mut upward_message_signals = Vec::<Vec<u8>>::with_capacity(4);
let mut horizontal_messages = Vec::new();
let mut new_validation_code = None;
let mut processed_downward_messages = 0;
let mut hrmp_watermark = None;
let mut head_data = None;

for block in &blocks {
// Create the parachain block data for the validators.
let (collation_info, _api_version) = self
.fetch_collation_info(block.hash(), block.header())
.map_err(|e| {
tracing::error!(
target: LOG_TARGET,
error = ?e,
"Failed to collect collation info.",
)
})
.ok()
.flatten()?;

// Workaround for: https://github.com/paritytech/polkadot-sdk/issues/64
//
// We are always using the `api_version` of the parent block. The `api_version` can only
// change with a runtime upgrade and this is when we want to observe the old
// `api_version`. Because this old `api_version` is the one used to validate this
// block. Otherwise, we already assume the `api_version` is higher than what the relay
// chain will use and this will lead to validation errors.
api_version = self
.runtime_api
.runtime_api()
.api_version::<dyn CollectCollationInfo<Block>>(parent_header.hash())
.ok()
.flatten()?;

let mut found_separator = false;
upward_messages.extend(collation_info.upward_messages.into_iter().filter_map(|m| {
// Filter out the `UMP_SEPARATOR` and the `UMPSignals`.
if m == UMP_SEPARATOR {
found_separator = true;
None
} else if found_separator {
if upward_message_signals.iter().all(|s| *s != m) {
upward_message_signals.push(m);
}
None
} else {
// No signal or separator
Some(m)
}
}));
horizontal_messages.extend(collation_info.horizontal_messages);
new_validation_code = new_validation_code.take().or(collation_info.new_validation_code);
processed_downward_messages += collation_info.processed_downward_messages;
hrmp_watermark = Some(collation_info.hrmp_watermark);
head_data = Some(collation_info.head_data);
}

// Create the parachain block data for the validators.
let (collation_info, _api_version) = self
.fetch_collation_info(block_hash, block.header())
.map_err(|e| {
tracing::error!(
target: LOG_TARGET,
error = ?e,
"Failed to collect collation info.",
)
})
.ok()
.flatten()?;

// Workaround for: https://github.com/paritytech/polkadot-sdk/issues/64
//
// We are always using the `api_version` of the parent block. The `api_version` can only
// change with a runtime upgrade and this is when we want to observe the old `api_version`.
// Because this old `api_version` is the one used to validate this block. Otherwise we
// already assume the `api_version` is higher than what the relay chain will use and this
// will lead to validation errors.
let api_version = self
.runtime_api
.runtime_api()
.api_version::<dyn CollectCollationInfo<Block>>(parent_header.hash())
.ok()
.flatten()?;

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

let pov = polkadot_node_primitives::maybe_compress_pov(PoV {
block_data: BlockData(if api_version >= 3 {
Expand All @@ -280,8 +320,13 @@ where
}),
});

let upward_messages = collation_info
.upward_messages
// If we got some signals, push them now.
if !upward_message_signals.is_empty() {
upward_messages.push(UMP_SEPARATOR);
upward_messages.extend(upward_message_signals.into_iter());
}

let upward_messages = upward_messages
.try_into()
.map_err(|e| {
tracing::error!(
Expand All @@ -291,8 +336,7 @@ where
)
})
.ok()?;
let horizontal_messages = collation_info
.horizontal_messages
let horizontal_messages = horizontal_messages
.try_into()
.map_err(|e| {
tracing::error!(
Expand All @@ -305,11 +349,12 @@ where

let collation = Collation {
upward_messages,
new_validation_code: collation_info.new_validation_code,
processed_downward_messages: collation_info.processed_downward_messages,
new_validation_code,
processed_downward_messages,
horizontal_messages,
hrmp_watermark: collation_info.hrmp_watermark,
head_data: collation_info.head_data,
// If these are `None`, there was no block.
hrmp_watermark: hrmp_watermark?,
head_data: head_data?,
proof_of_validity: MaybeCompressedPoV::Compressed(pov),
};

Expand Down Expand Up @@ -342,10 +387,15 @@ where
fn build_collation(
&self,
parent_header: &Block::Header,
block_hash: Block::Hash,
_: Block::Hash,
candidate: ParachainCandidate<Block>,
) -> Option<(Collation, ParachainBlockData<Block>)> {
CollatorService::build_collation(self, parent_header, block_hash, candidate)
CollatorService::build_multi_block_collation(
self,
parent_header,
vec![candidate.block],
candidate.proof,
)
}

fn announce_with_barrier(
Expand All @@ -358,4 +408,13 @@ where
fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>) {
(self.announce_block)(block_hash, data)
}

fn build_multi_block_collation(
&self,
parent_header: &<Block as BlockT>::Header,
blocks: Vec<Block>,
proof: StorageProof,
) -> Option<(Collation, ParachainBlockData<Block>)> {
CollatorService::build_multi_block_collation(self, parent_header, blocks, proof)
}
}
Loading
Loading