Expand description
§Architecture Overview
The block building mechanism operates through two coordinated tasks:
- Block Builder Task: Orchestrates the timing and execution of parachain block production
- Collator Task: Processes built blocks into collations for relay chain submission
§Block Builder Task Details
The block builder task manages block production timing and execution through an iterative process:
- Awaits the next production signal from the internal timer
- Retrieves the current best relay chain block and identifies a valid parent block (see find_potential_parents for parent selection criteria)
- Validates that:
- The parachain has an assigned core on the relay chain
- No block has been previously built on the target core
- Executes block building and import operations
- Transmits the completed block to the collator task
§Block Production Timing
When a block is produced is determined by the following parameters:
- Parachain slot duration
- Number of assigned parachain cores
- Parachain runtime configuration
§Timing Examples
The following table demonstrates various timing configurations and their effects. The “AURA Slot” column shows which author is responsible for the block.
Slot Duration (ms) | Cores | Production Attempts (ms) | AURA Slot |
---|---|---|---|
2000 | 3 | 0, 2000, 4000, 6000 | 0, 1, 2, 3 |
6000 | 1 | 0, 6000, 12000, 18000 | 0, 1, 2, 3 |
6000 | 3 | 0, 2000, 4000, 6000 | 0, 0, 0, 1 |
12000 | 1 | 0, 6000, 12000, 18000 | 0, 0, 1, 1 |
12000 | 3 | 0, 2000, 4000, 6000 | 0, 0, 0, 0 |
§Collator Task Details
The collator task receives built blocks from the block builder task and performs two primary functions:
- Block compression
- Submission to the collation-generation subsystem
Structs§
- Parameters for
run
. - Special block import for the slot based collator.
- Handle for receiving the block and the storage proof from the
SlotBasedBlockImport
.
Functions§
- Run aura-based block building and collation task.