Test Details Overview

Unify message deserialization (#5205)

* Move message header validation into `nano::deserialize_message_header`

The TCP server checked message headers inline before reading the payload, and the in-process transport carried its own copy of the same checks, in a different order and with different statuses. Header validation now sits next to the payload parser in the messages library, and the TCP server calls it.

* Split message parsing into payload and whole-message entry points

`deserialize_message` only parsed a payload whose header the caller had already read, which is how TCP reads a message but not how a complete serialized message is held in memory. It is now `deserialize_message_payload`, and the new `deserialize_message` parses one complete message, validating its header and requiring the payload to match the length the header declares.

The tests run every message type, and each variant of how a header declares its payload length, through the parser, and fail when a message type has no sample.

* Parse in-process messages with the shared deserializer

The inproc channel parsed messages with `transport::message_deserializer`, which kept its own switch over message types, so a type added to the TCP parser alone was silently dropped over inproc. The channel now uses `deserialize_message` with the destination's uniquers, as the destination parses network input, but without a network filter, which would drop repeats a caller sends on purpose; it had also been the sender's filter rather than the destination's. The sender no longer counts the message as received, which double counted every message on self channels, and a parse failure other than insufficient work trips a debug assert, since a message serialized in process can only fail on its content.

`transport::message_deserializer`, `parse_status` and the `message_size_too_big` stat detail are removed.

* Handle every message type explicitly in message type switches

The parser, `is_valid_message_type` and `payload_length_bytes` ended in a default case, so a new message type compiled and was treated as invalid at runtime. Without a default the compiler flags the type missing from the switch.

* Reject publish headers that do not name a block type

A publish takes its payload length from the block type in its header. A header naming `invalid`, `not_a_block` or an undefined value reached a debug assert in `block::size` while that length was computed, before the payload was parsed. Header validation now rejects it as `invalid_header`.

* Cover payload edge cases in the message deserializer tests

* Fuzz message parsing through the shared deserializer

* Reject telemetry timestamps the system clock cannot hold

__________

Type: commit

Hash: e0d4366114005e9397d85799c2511c704ca8b88e

Created: today

__________

gr0v1ty/nano-node:e0d4366114005e9397d85799c2511c704ca8b88e

Test Results

Test Case Status Duration Median Deviation Log Graph