I found it a bit confusing that part of the logic for block verification is in sc_consensus::import_queue::Verifier::verify()
implementation and another part is in sc_consensus::block_import::BlockImport::import_block()
implementation.
Vefifier
description says "Verify a justification of a block", but after looking at https://stackoverflow.com/a/58059237/3806795 and source code of Aura and BABE, it doesn't seem that verifier there has anything to do with finality.
sc-consensus-pow
is much simpler, from it it seems that Verify
is for things that can be verified right away without assuming that any other block was imported and BlockImport
verifies the rest.
Do I understand correctly that Verify
needs to do quick isolated check and BlockImport
everything that requires previous blocks to be imported and there should be no overlap in what they check (in other words it is guaranteed that Verify::verify()
will called be first, so no need to do the same work again in BlockImport::import_block()
)?
For context: I'm working on a custom non-PoS consensus and want to make sure I'm doing it properly.