reth
reth copied to clipboard
Implement roundtrip tests for every message type
Bugs like #324 would be easily detected by roundtrip encoding and decoding tests for message types. This bug can be pretty severe, and would lead to kicking other reth peers on the network, for example.
The message types this would need to be implemented on are:
- [ ]
EthMessage - [ ]
P2PMessage - [ ]
ProtocolMessage
we have something similar for db codecs. Also has built-in fuzzing support using trailofbits/test-fuzz. Maybe it's interesting here as well?
https://github.com/foundry-rs/reth/blob/c0db65c86fd1c5ddde03a3b7d0a487ed93c178ec/crates/interfaces/src/db/codecs/fuzz/mod.rs#L30-L45
and here: https://github.com/foundry-rs/reth/blob/c0db65c86fd1c5ddde03a3b7d0a487ed93c178ec/crates/codecs/derive/src/compact/generator.rs#L18-L31
woah yeah exactly like this, test-fuzz support is super interesting too! I'll take a look and will probably do something similar
Completed in #350