When the BIP30 scan is skipped
ProvedBitcoinBlock.bip30_historybip30Checked S height hash = false iff and either the block is one of the two IsBIP30Repeat blocks or the chain has the BIP34 activation block (height 227,931) with hash BIP34Hash as an ancestor. On mainnet the scan is therefore skipped from height 227,932 to 1,983,701 except where BIP34 does not hold, and always performed from 1,983,702.
Deprecated. Superseded by BitcoinBlockV2.bip30_history (revision 2 of the block mission): the p2shSigOpCount of this revision counted every push of scriptSig instead of only the redeem script, over-counting P2SH sigops; the V2 declarations carry the corrected definition.
import Definitions.Def_BitcoinBlock import Definitions.Def_BitcoinSer import Definitions.Def_BitcoinHeader
theorem BitcoinBlock.bip30_history (S : ChainState) (height : Nat) (hash : BitcoinSer.Bytes) :
BitcoinBlock.bip30Checked S height hash = false ↔
height < BIP34_IMPLIES_BIP30_LIMIT ∧
(BitcoinBlock.isBIP30Repeat height hash = true ∨
∃ h, S.headers[BitcoinHeader.BIP34Height]? = some h ∧ BitcoinSer.headerHash h = BitcoinBlock.bip34Hash) := by sorryRead-back
What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: BitcoinBlock.bip30_history
Binders
- : a chain state ; only its header list is consulted here.
- .
- : a byte list (a list of 8-bit words, of any length).
There are no hypotheses.
Conclusion
Left side, unfolded
is the Boolean
where is: if the header list of has an element at index , call it , then ""; if the list is shorter, . is the double-SHA256 of the 80-byte serialization of (version as 4 little-endian bytes of the value modulo , previous hash bytes, merkle root bytes, then time, bits and nonce each as 4 little-endian bytes modulo ). is the fixed 32-byte constant beginning and ending with six zero bytes. The constant is BIP34_IMPLIES_BIP30_LIMIT and is BitcoinHeader.BIP34Height.
is for two fixed 32-byte constants (beginning ) and (beginning ).
Right side, unfolded
, and either holds as just described, or there exists a header such that indexing at position yields (so the list has length at least ) and .
Edge cases silently included
of arbitrary length (then never equal to the 32-byte constants); a header list shorter than (the ancestor clause is false on both sides); makes the left side true regardless of the hash; the ledger of is irrelevant.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.