Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth/protocols/eth: add protocol handler fuzzers #30417

Merged
merged 1 commit into from
Nov 9, 2024

Conversation

MariusVanDerWijden
Copy link
Member

Adds a protocol handler fuzzer that will try to fuzz the protocol handlers.

Two points of discussion:

  • currently input needs to be valid RLP which makes it harder to reach certain states
  • currently all handlers are fuzzed at the same time which might confuse a mutator, I could pull it out into 12+ individual fuzzers, but that seems overkill to me

wdyt @holiman

@holiman
Copy link
Contributor

holiman commented Sep 13, 2024

wdyt @holiman

Well, the fuzzer will hit a little bit of production code, but the whole backend is a test-backend, so it's only a very small layer of handler-code that we'll fuzz. It's better than nothing, so I guess it's worth it. We might be hit with false positives if the testBackend is not quite stable, but I guess that's a passing phase. So LGTM

@holiman
Copy link
Contributor

holiman commented Sep 13, 2024

  • valid RLP which makes it harder to reach certain states

Yeah that's a big hurdle for the fuzzer. Sure, with some help (seeding) it might stumble upon valid rlp once in a while, but it'll make for very inefficient fuzzing.

Comment on lines +511 to +525

func (d decoder) Decode(val interface{}) error {
buffer := bytes.NewBuffer(d.msg)
s := rlp.NewStream(buffer, uint64(len(d.msg)))
return s.Decode(val)
}

func (d decoder) Time() time.Time {
return time.Now()
}

func setup() (*testBackend, *testPeer) {
// Generate some transactions etc.
acc1Key, _ := crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
acc2Key, _ := crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

holiman sent new code style rules

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I thought I had already approved this

@holiman holiman added this to the 1.14.12 milestone Nov 9, 2024
@holiman holiman merged commit 3f5f2ef into ethereum:master Nov 9, 2024
3 checks passed
holiman pushed a commit that referenced this pull request Nov 19, 2024
Adds a protocol handler fuzzer to fuzz the ETH68 protocol handlers
zfy0701 pushed a commit to sentioxyz/go-ethereum that referenced this pull request Dec 3, 2024
Adds a protocol handler fuzzer to fuzz the ETH68 protocol handlers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants