Skip to main content

is_later_validation_failure

Function is_later_validation_failure 

Source
pub(crate) fn is_later_validation_failure(
    error: &(dyn Error + Send + Sync + 'static),
) -> bool
Expand description

Returns true if error scores the peer that sent a block, and the block verifier only returns it after the block passed the verifier’s part of the checks that authenticate a block for early relay.

§Security

The draft Compact Block Relay ZIP lets a peer that sets the compact block relay service bit relay a block before it has validated it, once the block passes the ZIP’s early relay checks. The ZIP’s peer misbehaviour rules say a node must not penalize that peer when such an authenticated block fails later validation.

Before it verifies a block’s transactions, the block verifier checks the block’s proof of work, its time against the local clock, its Merkle root, transaction IDs and consensus branch IDs, its coinbase, its shielded action limits, and its subsidy and funding streams when they don’t depend on the chain value pools. It only returns these errors once those checks pass:

  • a transaction failure,
  • too many transparent signature operations,
  • a miner fee failure, or
  • a state commit failure, except authorizing data that doesn’t match the block’s commitment.

early_block_is_authenticated() asks the state for the rest of the early relay checks, and EarlyRelayAllowances bounds the failures that don’t score a peer. Every other error keeps its score, including all the checkpoint verifier’s errors.