Skip to content

Commit

Permalink
update polkadot-parachain to use lookahead collator
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophia-Gold committed Nov 14, 2023
1 parent d303549 commit a68dc3b
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions cumulus/polkadot-parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ where
CollatorPair,
OverseerHandle,
Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
Arc<ParachainBackend>,
) -> Result<(), sc_service::Error>,
{
let parachain_config = prepare_node_config(parachain_config);
Expand Down Expand Up @@ -693,6 +694,7 @@ where
collator_key.expect("Command line arguments do not allow this. qed"),
overseer_handle,
announce_block,
backend.clone(),
)?;
}

Expand Down Expand Up @@ -953,7 +955,8 @@ pub async fn start_rococo_parachain_node(
para_id,
collator_key,
overseer_handle,
announce_block| {
announce_block,
backend| {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;

let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
Expand All @@ -972,11 +975,15 @@ pub async fn start_rococo_parachain_node(
client.clone(),
);

let params = BasicAuraParams {
let params = AuraParams {
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
block_import,
para_client: client,
para_client: client.clone(),
para_backend: backend.clone(),
relay_client: relay_chain_interface,
code_hash_provider: move |block_hash| {
client.code_at(block_hash).ok().map(ValidationCode).map(|c| c.hash())
},
sync_oracle,
keystore,
collator_key,
Expand All @@ -986,12 +993,10 @@ pub async fn start_rococo_parachain_node(
relay_chain_slot_duration,
proposer,
collator_service,
// Very limited proposal time.
authoring_duration: Duration::from_millis(500),
collation_request_receiver: None,
authoring_duration: Duration::from_millis(1500),
};

let fut = basic_aura::run::<
let fut = aura::run::<
Block,
sp_consensus_aura::sr25519::AuthorityPair,
_,
Expand All @@ -1001,6 +1006,8 @@ pub async fn start_rococo_parachain_node(
_,
_,
_,
_,
_,
>(params);
task_manager.spawn_essential_handle().spawn("aura", None, fut);

Expand Down Expand Up @@ -1346,7 +1353,8 @@ where
para_id,
collator_key,
overseer_handle,
announce_block| {
announce_block,
_backend| {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;

let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
Expand Down Expand Up @@ -1441,7 +1449,8 @@ where
para_id,
collator_key,
overseer_handle,
announce_block| {
announce_block,
_backend| {
let relay_chain_interface2 = relay_chain_interface.clone();

let collator_service = CollatorService::new(
Expand Down Expand Up @@ -1683,6 +1692,7 @@ where
CollatorPair,
OverseerHandle,
Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
Arc<ParachainBackend>,
) -> Result<(), sc_service::Error>,
{
let parachain_config = prepare_node_config(parachain_config);
Expand Down Expand Up @@ -1815,6 +1825,7 @@ where
collator_key.expect("Command line arguments do not allow this. qed"),
overseer_handle,
announce_block,
backend.clone(),
)?;
}

Expand Down Expand Up @@ -1893,7 +1904,8 @@ pub async fn start_contracts_rococo_node(
para_id,
collator_key,
overseer_handle,
announce_block| {
announce_block,
_backend| {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;

let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
Expand Down

0 comments on commit a68dc3b

Please sign in to comment.