Implement roundtrip encoding property test for Message
s from random bytes
#2448
Labels
A-network
Area: Network protocol updates or fixes
A-rust
Area: Updates to Rust code
C-enhancement
Category: This is an improvement
Motivation
It's important to ensure that incoming random bytes from the network do not cause Zebra to misbehave or crash. Having a test that tries to decode a
Message
from a random byte array is one step in that direction.The idea would be to write a proptest that:
0..=MAX_PROTOCOL_MESSAGE_LEN
;Codec
instance that is used to try to decode aMessage
from those random bytes;Message
variant was decoded, or that the appropriate error was returned;Message
(if available) and checks that the resulting bytes are the same as those in the inputThis test could also become some sort of fuzzing test.
Related Work
There is a similar test for serialization of
InventoryHash
that was implemented in #2446.The text was updated successfully, but these errors were encountered: