-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Aura: Fix warp syncing #13221
Aura: Fix warp syncing #13221
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another observation. Babe currently perform this a bit later here. In the And as per @skunert comment on cumulus here Can't we refactor all this assignment to where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the cumulus one needs to stay anyway, as it is unrelated to all the state-business. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I was just trying to find out if there is a way to have these less scattered around. |
||
|
||
return Ok((block, Default::default())) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that:
A)
state_action.skip_execution_checks()
returns true iffstate_action == StateAction::Skip
... AND that ...
B)
block.state_action
is set toSkip
by the import queue here if imported block has no state andblock.skip_execution == true
... AND that 😃 ...
C)
block.skip_execution
is true under one of the following conditions:1. peer sync state is
DownloadingGap
here2. is a block announcement here
3. in all the other cases if
skip_execution()
returns true hereAll this boombastic introduction to ask: do you thing that we can replace this check in babe with the same check? (i.e. replace the
s <= num <= e
part withstate_action.skip_execution_checks()
)Intuitively it can, but I'm not super familiar with the
sync
crate and not 100% sure that the two conditions are (in practice for this use case) equivalent.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are correct.