Module consensus_signature

Module consensus_signature 

Source
Expand description

Consensus signature layout gating (F90 / PDF #11).

Endorsements and block headers used to be signed with a chain-agnostic hash: the signed hash did not include the chain id, so two legitimate same-(slot, index) signatures produced by the same validator on two different chains (e.g. MAINNET + LABNET) could be combined into a denunciation on either chain and slash the validator for entirely normal cross-chain operation.

The fix folds the chain id into the signed hash, deployed through the existing MIP-0002 network-versioning mechanism (the release that bumps MipComponent::Execution to MIP_0002_EXECUTION_VERSION), so upgraded and un-upgraded nodes keep agreeing on signature validity across the activation boundary - no flag-day change.

This module exposes the single helper that decides, for a given slot, which signed-hash layout to use:

  • None -> legacy (chain-agnostic) layout, identical to the pre-fix one.
  • Some(chain_id) -> chain-scoped layout, folding chain_id into the signed hash.

The decision is based on the network-agreed active Execution component version at the message’s slot timestamp - not any self-claimed header field. Signing, on-receive verification, denunciation creation and denunciation execution must all call this with the same (mip_store, chain_id, slot_ts) so they flip layouts together at the deterministic activation slot.

Functions§

sig_chain_id_for_slot
Returns the sig_chain_id to use for signing / verifying an endorsement or block header whose slot timestamp is slot_ts on the local chain identified by chain_id.