les: implement server handler fuzzer#22237
les: implement server handler fuzzer#22237rjl493456442 wants to merge 3 commits intoethereum:masterfrom
Conversation
There was a problem hiding this comment.
Just curious, would it be possible to abstract away the reqID from the method handler, and have that handled on the outside?
Like, reply.SetReqId(reqID) ?
I'm wondering, because for eth, when we implement eth/66, it would be neat to use a similar handling, but only set the reqId on the response in the cases where the protocol is 66.
There was a problem hiding this comment.
Well. Not sure it's necessary. REQID exists in the protocol all the time.
cceec68 to
fb1f727
Compare
fb1f727 to
41f2410
Compare
e928f34 to
4312690
Compare
tests: update les fuzzer tests/fuzzer/les: release resources tests/fuzzer/les: pre-initialize all resources
4312690 to
1263724
Compare
|
Looks like the fuzzer now works correctly
|
| } | ||
| }() | ||
| } | ||
| r := GetBlockHeadersReq{} |
There was a problem hiding this comment.
@zsfelfoldi I change this to the struct instead of the pointer. Because I think the pointer is unnecessary.
holiman
left a comment
There was a problem hiding this comment.
I'm a bit torn. You've rearchitected it so the basic pattern is
- Unmarshall
message. - Call
message.Serve(backend, foo, bar...).
I'd prefer that it's not based on the actual messages doing the handling but instead
- Unmarshall the message
- Lookup the
handlerbased on message id or type hander( msg, backend, foo, bar, ...)
| github.com/dvyukov/go-fuzz v0.0.0-20210103155950-6a8e9d1f2415 h1:q1oJaUPdmpDm/VyXosjgPgr6wS7c5iV2p0PwJD73bUI= | ||
| github.com/dvyukov/go-fuzz v0.0.0-20210103155950-6a8e9d1f2415/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= |
There was a problem hiding this comment.
These shouldn't really be needed...?
|
@holiman I need a struct type definition for each message type in order to unmarshall so it just seemed logical to define the handler function over the message type structs. What is the drawback? Would you prefer putting the decoding of the actual request inside the handler functions? (that just seemed like unnecessary duplicated code to me because I want to do the same rlp decodind and decode error handling for each message type) |
This PR adds the LES fuzzer for fuzzing server handler.
Please keep the two commits from @zsfelfoldi if we decide to merge this PR.