I spent the last couple weeks studing TLV encoder in Rust type length value the oldest trick for packing data so it can grow without breaking old readers. Once I thought it through for Dusk the reason clicked. A chain like @Dusk moves messages over the wire nonstop peers gossiping contracts calling in wallets syncing up. All of it needs a format that survives someone bolting on a new field two years from now.
Rust makes the annoying part almost boring, and that's the whole point. Bounds checking. Refusing to trust a length byte that claims read 4GB.
A parser that panics on garbage input is a parser you can't run on a network where random bytes show up uninvited. I stick to plain &[u8] slices skip copying until I actually need to, and lean on an enum for the type byte so the compiler catches any case I forget.
Don't skip the ugly byte pushing code. Write it first and write it paranoid. Everything else you build depends on it not lying to you. #dusk
$DUSK