Summary
No formal golden/snapshot testing framework exists. Wire format regressions are only caught indirectly via integration tests or live network testing. Golden tests would catch serialization drift immediately.
Proposed Approach
Use the insta crate (or a simpler hex-comparison approach) to capture known-good CBOR byte sequences and detect any changes.
Golden Test Categories
Protocol Messages
- N2N handshake (propose/accept for V14/V15)
- N2C handshake (V16-V22 with bit-15 encoding)
- ChainSync messages (RequestNext, RollForward, RollBackward, FindIntersect)
- BlockFetch messages (RequestRange, StartBatch, Block, NoBlocks)
- TxSubmission2 messages (all message types)
- LocalStateQuery messages (Acquire, Query, Result, Release)
Data Structures
- Protocol parameters (integer-key CBOR array(31))
- Transaction bodies (all eras: Shelley through Conway)
- Block headers (all eras)
- Certificates (all types: delegation, pool, governance)
- Governance actions (all Conway action types)
- Values (ADA-only uint vs multi-asset array encoding)
Query Responses
query tip response format
query protocol-parameters response
query utxo response (various value types)
query stake-distribution response
query constitution response
Benefits
- Instant detection of wire format regressions
- Documentation of expected byte formats
- Enables safe refactoring of serialization code
- Reference for protocol compliance auditing
Summary
No formal golden/snapshot testing framework exists. Wire format regressions are only caught indirectly via integration tests or live network testing. Golden tests would catch serialization drift immediately.
Proposed Approach
Use the
instacrate (or a simpler hex-comparison approach) to capture known-good CBOR byte sequences and detect any changes.Golden Test Categories
Protocol Messages
Data Structures
Query Responses
query tipresponse formatquery protocol-parametersresponsequery utxoresponse (various value types)query stake-distributionresponsequery constitutionresponseBenefits