1 suggestion
Optional improvements
[suggestion] · The increment-overflow test leaves 2^39 unexplained
The unexplained constant makes this unit test's connection to the decoder's increment-overflow boundary difficult to verify.
Location: src/test/serialize_tests.cpp:165 (head).
Details and suggested fix
WriteVarInt encodes uint64_t{1} << 39 as 8e fe fe fe ff 00. Before the ff byte, the uint32_t decoder's accumulator equals UINT32_MAX >> 7, so it passes the first overflow guard. Processing that continuation byte then produces UINT32_MAX and triggers the increment guard. Add a short comment next to the assertion explaining this relationship so maintainers do not have to reconstruct the encoding. The distinct exception-message checks already distinguish the guards, so this is a maintainability suggestion, not missing overflow coverage.