Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 27f3f92

Browse files
committed
docs and todos for lookahead
1 parent 8dca02a commit 27f3f92

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

client/consensus/aura/src/collators/lookahead.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
1616

17-
// TODO [now]: docs
17+
//! A collator for Aura that looks ahead of the most recently included parachain block
18+
//! when determining what to build upon.
19+
//!
20+
//! This collator also builds additional blocks when the maximum backlog is not saturated.
21+
//! The size of the backlog is determined by invoking a runtime API. If that runtime API
22+
//! is not supported, this assumes a maximum backlog size of 1.
23+
//!
24+
//! This takes more advantage of asynchronous backing, though not complete advantage.
25+
//! When the backlog is not saturated, this approach lets the backlog temporarily 'catch up'
26+
//! with periods of higher throughput. When the backlog is saturated, we typically
27+
//! fall back to the limited cadence of a single parachain block per relay-chain block.
28+
//!
29+
//! Despite this, the fact that there is a backlog at all allows us to spend more time
30+
//! building the block, as there is some buffer before it can get posted to the relay-chain.
31+
//! The main limitation is block propagation time - i.e. the new blocks created by an author
32+
//! must be propagated to the next author before their turn.
1833
1934
use codec::{Decode, Encode};
2035
use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface;
@@ -118,7 +133,9 @@ pub async fn run<Block, P, BI, CIDP, Client, RClient, SO, Proposer, CS>(
118133
let relay_parent = relay_parent_header.hash();
119134

120135
// TODO [now]: get asynchronous backing parameters from the relay-chain
121-
// runtime.
136+
// runtime. why?
137+
138+
// TOOD [now]: get slot from relay parent header
122139

123140
let parent_search_params = ParentSearchParams {
124141
relay_parent,
@@ -175,6 +192,7 @@ where
175192
// all validators doing this every new relay-chain block.
176193
// Actually, as long as sessions are based on slot number then they should
177194
// be the same for all...
195+
// That is, blocks with the same relay-parent should have the same session.
178196
//
179197
// TODO [now]: new runtime API,
180198
// AuraUnincludedSegmentApi::has_space(slot) or something like it.

0 commit comments

Comments
 (0)