reth icon indicating copy to clipboard operation
reth copied to clipboard

Implement roundtrip tests for every message type

Open Rjected opened this issue 2 years ago • 2 comments

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

Rjected avatar Dec 05 '22 06:12 Rjected

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

joshieDo avatar Dec 05 '22 06:12 joshieDo

woah yeah exactly like this, test-fuzz support is super interesting too! I'll take a look and will probably do something similar

Rjected avatar Dec 05 '22 06:12 Rjected

Completed in #350

Rjected avatar Dec 13 '22 17:12 Rjected