Skip to content

Commit

Permalink
Aura: Fix warp syncing (paritytech#13221)
Browse files Browse the repository at this point in the history
* Aura: Fix warp syncing

We need to set the fork choice rule! When using Cumulus this is done by the `ParachainsBlockImport`,
but for standalone chains we still need this!

Closes: paritytech#13220

* Improve fork choice
  • Loading branch information
bkchr authored and ltfschoen committed Feb 22, 2023
1 parent 2d3512b commit 57747a2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions client/consensus/aura/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,15 @@ where
&mut self,
mut block: BlockImportParams<B, ()>,
) -> Result<(BlockImportParams<B, ()>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String> {
// When importing whole state we don't verify the seal as the state is not available.
if block.with_state() {
return Ok((block, Default::default()))
}

// Skip checks that include execution, if being told so.
// Skip checks that include execution, if being told so or when importing only state.
//
// This is done for example when gap syncing and it is expected that the block after the gap
// was checked/chosen properly, e.g. by warp syncing to this block using a finality proof.
if block.state_action.skip_execution_checks() {
// Or when we are importing state only and can not verify the seal.
if block.with_state() || block.state_action.skip_execution_checks() {
// When we are importing only the state of a block, it will be the best block.
block.fork_choice = Some(ForkChoiceStrategy::Custom(block.with_state()));

return Ok((block, Default::default()))
}

Expand Down

0 comments on commit 57747a2

Please sign in to comment.