The binary block codec encodes lease_renew blocks and then refuses to decode them
Report
Suggested severity tier: Minor
Summary: MarshalBlock writes a lease_renew block with type byte 0x0E. UnmarshalBlock has no case for that byte and returns an error, so a block the codec produced cannot be read back by the same codec. Every other block type round trips. One honest limit on this report: a search of the repository finds no caller of MarshalBlock or UnmarshalBlock outside core/encoding.go, and the doc comment on MarshalBlock states that JSON is the wire and store format. The defect is latent today. It will break the first binary consumer, debug tool, or port that assumes round trip parity, and lease_renew is the newest block type.
Evidence:
- core/encoding.go: MarshalBlockCanonical handles BlockLeaseRenew and writes source, amount, duration, and the locked parameters.
- core/encoding.go, the type switch in unmarshalBlock at around lines 370 to 406: cases exist for the other twelve block types and none for the lease renew byte. There is no leaseRenewTailSize constant.
- A proof of concept run is available on request. MarshalBlock on a lease_renew block returns 202 bytes and no error. UnmarshalBlock on that output returns the error "UnmarshalBlock: unknown type byte 0x0e". A send block marshals and unmarshals with no error.
Impact: Any tool that stores or moves blocks in the binary form fails on lease_renew blocks while working on all others. No live path in the current tree hits this, and this draft says so plainly.
Suggested fix: Add the lease_renew case and its tail size to unmarshalBlock, and add a round trip test that covers every block type, so a future type cannot drift in the same way.
Thread
Nothing public yet.