Babbage header CDDL possibly incorrect
In the CDDL we have:
header_body =
[ block_number : uint
, slot : uint
, prev_hash : $hash32 / null
, issuer_vkey : $vkey
, vrf_vkey : $vrf_vkey
, vrf_result : $vrf_cert ; New, replaces nonce_vrf and leader_vrf
, block_body_size : uint
, block_body_hash : $hash32 ; merkle triple root
, operational_cert
, protocol_version
]
operational_cert =
( hot_vkey : $kes_vkey
, sequence_number : uint
, kes_period : uint
, sigma : $signature
)
protocol_version = (major_protocol_version, uint)
which would correspond to a size 14 array for header_body as operational_cert and protocol_version are basic groups (note them having only ( and ) instead of [ and ] or [( and )]).
However I am encountering a size 10 array for all babbage blocks where it is treated as if they were written instead as:
operational_cert =
[ hot_vkey : $kes_vkey
, sequence_number : uint
, kes_period : uint
, sigma : $signature
]
protocol_version = [major_protocol_version, uint]
i.e. they are encoded as array groups instead of raw basic groups.
All previous eras seem to have them encoded as basic groups (i.e. their fields are inlined into the header body). It's possible that there's something going on somewhere in the stack I'm receiving it from but it's supposed to be the raw bytes without changes. If that's the case I'll close the issue, but if not we need to update the babbage.cddl file.
Block serialization logic has moved over to consensus repository starting with Babbage, so that's why CDDL spec can't be checked in ledger code for the block header.
I just looked at the implementation and at a glance it does seem the cddl spec is off. We'll do a proper investigation into this and adjust the spec accordingly.
Thanks for reporting this issue.
This issue also seems to affect the sancho testnet so conway.cddl will need updating as well unless that gets changed before making it to mainnet.
Fixed in #3762