Function forest_filecoin::chain_sync::tipset_syncer::validate_block
source ยท async fn validate_block<DB: Blockstore + Sync + Send + 'static>(
state_manager: Arc<StateManager<DB>>,
block: Arc<Block>,
) -> Result<Arc<Block>, (Cid, TipsetRangeSyncerError)>
Expand description
Validate the block according to the rules specific to the consensus being
used, and the common rules that pertain to the assumptions of the
ChainSync
protocol.
Returns the validated block if Ok
.
Returns the block CID (for marking bad) and Error
if invalid (Err
).
Common validation includes:
- Sanity checks
- Clock drifts
- Signatures
- Message inclusion (fees, sequences)
- Parent related fields: base fee, weight, the state root
- NB: This is where the messages in the parent tipset are executed.
Consensus specific validation should include:
- Checking that the messages in the block correspond to the agreed upon total ordering
- That the block is a deterministic derivative of the underlying consensus