3434use codec:: { Decode , Encode } ;
3535use cumulus_client_collator:: service:: ServiceInterface as CollatorServiceInterface ;
3636use cumulus_client_consensus_common:: {
37- self as consensus_common,
38- ParachainBlockImportMarker , ParachainCandidate , ParentSearchParams ,
37+ self as consensus_common, ParachainBlockImportMarker , ParachainCandidate , ParentSearchParams ,
3938} ;
4039use cumulus_client_consensus_proposer:: ProposerInterface ;
4140use cumulus_primitives_core:: {
@@ -46,7 +45,9 @@ use cumulus_relay_chain_interface::RelayChainInterface;
4645
4746use polkadot_node_primitives:: { CollationResult , MaybeCompressedPoV } ;
4847use polkadot_overseer:: Handle as OverseerHandle ;
49- use polkadot_primitives:: { Block as PBlock , CollatorPair , Header as PHeader , Id as ParaId , OccupiedCoreAssumption } ;
48+ use polkadot_primitives:: {
49+ Block as PBlock , CollatorPair , Header as PHeader , Id as ParaId , OccupiedCoreAssumption ,
50+ } ;
5051
5152use futures:: prelude:: * ;
5253use sc_client_api:: { backend:: AuxStore , BlockBackend , BlockOf } ;
@@ -163,17 +164,21 @@ pub async fn run<Block, P, BI, CIDP, Client, Backend, RClient, SO, Proposer, CS>
163164 // TODO [now]: get asynchronous backing parameters from the relay-chain
164165 // runtime. why? for the parent search parameters.
165166
166- let max_pov_size = match params. relay_client . persisted_validation_data (
167- relay_parent,
168- params. para_id ,
169- OccupiedCoreAssumption :: Included ,
170- ) . await {
167+ let max_pov_size = match params
168+ . relay_client
169+ . persisted_validation_data (
170+ relay_parent,
171+ params. para_id ,
172+ OccupiedCoreAssumption :: Included ,
173+ )
174+ . await
175+ {
171176 Ok ( None ) => continue ,
172177 Ok ( Some ( pvd) ) => pvd. max_pov_size ,
173178 Err ( err) => {
174179 tracing:: error!( target: crate :: LOG_TARGET , ?err, "Failed to gather information from relay-client" ) ;
175- continue ;
176- }
180+ continue
181+ } ,
177182 } ;
178183
179184 let ( slot_now, timestamp) = match consensus_common:: relay_slot_and_timestamp (
@@ -220,14 +225,16 @@ pub async fn run<Block, P, BI, CIDP, Client, Backend, RClient, SO, Proposer, CS>
220225
221226 let para_client = & * params. para_client ;
222227 let keystore = & params. keystore ;
223- let can_build_upon = |block_hash| can_build_upon :: < _ , _ , P > (
224- slot_now,
225- timestamp,
226- block_hash,
227- included_block,
228- para_client,
229- & keystore,
230- ) ;
228+ let can_build_upon = |block_hash| {
229+ can_build_upon :: < _ , _ , P > (
230+ slot_now,
231+ timestamp,
232+ block_hash,
233+ included_block,
234+ para_client,
235+ & keystore,
236+ )
237+ } ;
231238
232239 // Sort by depth, ascending, to choose the longest chain.
233240 //
@@ -258,31 +265,37 @@ pub async fn run<Block, P, BI, CIDP, Client, Backend, RClient, SO, Proposer, CS>
258265
259266 // Build and announce collations recursively until
260267 // `can_build_upon` fails or building a collation fails.
261- let ( parachain_inherent_data, other_inherent_data) = match collator. create_inherent_data (
262- relay_parent,
263- & validation_data,
264- parent_hash,
265- slot_claim. timestamp ( ) ,
266- ) . await {
268+ let ( parachain_inherent_data, other_inherent_data) = match collator
269+ . create_inherent_data (
270+ relay_parent,
271+ & validation_data,
272+ parent_hash,
273+ slot_claim. timestamp ( ) ,
274+ )
275+ . await
276+ {
267277 Err ( err) => {
268278 tracing:: error!( target: crate :: LOG_TARGET , ?err) ;
269- break ;
279+ break
270280 } ,
271281 Ok ( x) => x,
272282 } ;
273283
274- match collator. collate (
275- & parent_header,
276- & slot_claim,
277- None ,
278- ( parachain_inherent_data, other_inherent_data) ,
279- params. authoring_duration ,
280- // Set the block limit to 50% of the maximum PoV size.
281- //
282- // TODO: If we got benchmarking that includes the proof size,
283- // we should be able to use the maximum pov size.
284- ( validation_data. max_pov_size / 2 ) as usize ,
285- ) . await {
284+ match collator
285+ . collate (
286+ & parent_header,
287+ & slot_claim,
288+ None ,
289+ ( parachain_inherent_data, other_inherent_data) ,
290+ params. authoring_duration ,
291+ // Set the block limit to 50% of the maximum PoV size.
292+ //
293+ // TODO: If we got benchmarking that includes the proof size,
294+ // we should be able to use the maximum pov size.
295+ ( validation_data. max_pov_size / 2 ) as usize ,
296+ )
297+ . await
298+ {
286299 Ok ( ( collation, block_data, new_block_hash) ) => {
287300 parent_hash = new_block_hash;
288301 parent_header = block_data. into_header ( ) ;
@@ -293,11 +306,11 @@ pub async fn run<Block, P, BI, CIDP, Client, Backend, RClient, SO, Proposer, CS>
293306
294307 // TODO [https://github.com/paritytech/polkadot/issues/5056]:
295308 // announce collation to relay-chain validators.
296- }
309+ } ,
297310 Err ( err) => {
298311 tracing:: error!( target: crate :: LOG_TARGET , ?err) ;
299- break ;
300- }
312+ break
313+ } ,
301314 }
302315 }
303316 }
0 commit comments