Skip to content

Conversation

@yperbasis
Copy link
Member

@yperbasis yperbasis commented Oct 27, 2025

See ethereum/go-ethereum#28467. Also removes most of common/crypto/bn254. Completes #14554.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the fuzzers from standalone packages in tests/fuzzers/ into native test functions within their respective packages, following the upstream go-ethereum pattern. The change removes the external fuzzer infrastructure and replaces it with Go's built-in fuzzing support using testing.F.

Key changes:

  • Moved fuzzer implementations from tests/fuzzers/ to native _test.go files in their target packages
  • Converted standalone Fuzz() functions to FuzzXxx(f *testing.F) test functions
  • Removed OSS-Fuzz integration script and external test infrastructure

Reviewed Changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/fuzzers/secp256k1/secp_test.go Removed standalone secp256k1 fuzzer
tests/fuzzers/rlp/rlp_fuzzer.go Removed standalone RLP fuzzer
tests/fuzzers/difficulty/difficulty-fuzz.go Removed standalone difficulty fuzzer
tests/fuzzers/bn254/bn254_fuzz.go Removed standalone bn254 fuzzer
tests/fuzzers/bls12381/precompile_fuzzer.go Removed standalone BLS12-381 fuzzer
tests/fuzzers/bitutil/compress_fuzz.go Removed standalone bitutil fuzzer
tests/fuzzers/abi/abifuzzer_test.go Removed old ABI fuzzer test
execution/vm/runtime/runtime_fuzz_test.go Refactored to native Go fuzzing format
execution/vm/contracts_fuzz_test.go Added new native fuzzer for precompiled contracts
execution/types/rlp_fuzzer_test.go Added native RLP fuzzer to types package
execution/abi/abifuzzer_test.go Refactored ABI fuzzer to native format
common/bitutil/compress_test.go Added native fuzzing functions
oss-fuzz.sh Removed OSS-Fuzz build script
Makefile Removed test-erigon-ext target
.github/workflows/test-erigon-is-library.yml Removed library integration test workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

rlp.Split(input)
if elems, _, err := rlp.SplitList(input); err == nil {
rlp.CountValues(elems)
}
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

Multiple functions (rlp.Split, rlp.SplitList, rlp.CountValues, rlp.NewStream.Decode) are called without checking their errors or return values. While this may be intentional for fuzzing to explore all code paths, consider adding comments explaining why errors are deliberately ignored to improve code clarity.

Suggested change
}
}
// Intentionally ignore errors from Decode to allow fuzzing to explore all code paths.

Copilot uses AI. Check for mistakes.
yperbasis and others added 3 commits October 27, 2025 17:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@taratorio taratorio left a comment

Choose a reason for hiding this comment

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

🚀

@taratorio
Copy link
Member

just a question, is the removal of the secp256k1 fuzzer intentional? we do seem to be using ScalarBaseMult throughout the codebase

@taratorio
Copy link
Member

taratorio commented Oct 28, 2025

also noticed that we can now get rid of erigon/common/crypto/bn254/cloudflare in a follow up PR since there are no usages of it after we moved to gnark - or we can keep it and use it to fuzz against the gnark lib

@yperbasis yperbasis marked this pull request as draft October 28, 2025 09:36
@yperbasis
Copy link
Member Author

just a question, is the removal of the secp256k1 fuzzer intentional? we do seem to be using ScalarBaseMult throughout the codebase

Good catch. Let me move it to erigontech/secp256k1 (erigontech/secp256k1#6).

@yperbasis yperbasis marked this pull request as ready for review October 29, 2025 11:13
@yperbasis
Copy link
Member Author

also noticed that we can now get rid of erigon/common/crypto/bn254/cloudflare in a follow up PR since there are no usages of it after we moved to gnark - or we can keep it and use it to fuzz against the gnark lib

I've restored its fuzzer.

@yperbasis yperbasis marked this pull request as draft October 29, 2025 11:20
@yperbasis
Copy link
Member Author

Actually, I've decided to remove most of common/crypto/bn254, keeping only the gnark (un)marshalling that we use.

@yperbasis yperbasis marked this pull request as ready for review October 29, 2025 11:41
@yperbasis yperbasis enabled auto-merge (squash) October 29, 2025 11:43
@yperbasis yperbasis merged commit 4134d3f into main Oct 29, 2025
24 of 29 checks passed
@yperbasis yperbasis deleted the yperbasis/mv_fuzzers branch October 29, 2025 12:06
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.

4 participants