ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Cardano.TxId

Description

The allocation-free Eq/Ord instances for OneEraGenTxId must agree with the raw-hash reference: order by hash bytes, ignore the era.

The comparison distinguishes four classes of input:

  • same era, equal hashes
  • same era, unequal hashes
  • different eras, equal hashes
  • different eras, unequal hashes

For Cardano, same-era comparisons use the era's own Eq/Ord and cross-era comparisons go through PackedBytes; neither is the raw-hash reference, so every class is a real check. The cross-era cells in particular check that packed-word order agrees with raw-byte order across the Byron and Shelley representations.

The test builds a txid in every era for each probe hash, then compares every id with every other and checks the result against the reference. The probe hashes (see hashes) put a single 1 at each byte in turn, so a wrong byte order anywhere makes the era's Ord disagree with the reference.

Documentation