diff --git a/go.mod b/go.mod
index 9eed6e5c78..148c826513 100644
--- a/go.mod
+++ b/go.mod
@@ -76,6 +76,8 @@ require (
)
require (
+ github.com/AdaLogics/go-fuzz-headers v0.0.0-20221206110420-d395f97c4830 // indirect
+ github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
@@ -99,6 +101,7 @@ require (
github.com/consensys/bavard v0.1.13 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80 // indirect
+ github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/deepmap/oapi-codegen v1.6.0 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
diff --git a/go.sum b/go.sum
index 44b705336a..fac1528292 100644
--- a/go.sum
+++ b/go.sum
@@ -31,6 +31,10 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
+github.com/AdaLogics/go-fuzz-headers v0.0.0-20221206110420-d395f97c4830 h1:u8scGKApGy+gXpYDw2f+nh60R0FqCfrpDRIQki+5o3U=
+github.com/AdaLogics/go-fuzz-headers v0.0.0-20221206110420-d395f97c4830/go.mod h1:VzwV+t+dZ9j/H867F1M2ziD+yLHtB46oM35FxxMJ4d0=
+github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA=
+github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0/go.mod h1:OahwfttHWG6eJ0clwcfBAHoDI6X/LV/15hx/wlMZSrU=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8u3fcIHyqkLjcFpNRHQ=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q=
@@ -151,6 +155,8 @@ github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uz
github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
+github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
+github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
diff --git a/oss-fuzz.sh b/oss-fuzz.sh
index 745a5ba7c7..f70fc92748 100644
--- a/oss-fuzz.sh
+++ b/oss-fuzz.sh
@@ -1,5 +1,5 @@
-#/bin/bash -eu
-# Copyright 2020 Google Inc.
+#!/bin/bash -eu
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,77 +15,44 @@
#
################################################################################
-# This file is for integration with Google OSS-Fuzz.
-# The following ENV variables are available when executing on OSS-fuzz:
-#
-# /out/ $OUT Directory to store build artifacts (fuzz targets, dictionaries, options files, seed corpus archives).
-# /src/ $SRC Directory to checkout source files.
-# /work/ $WORK Directory to store intermediate files.
-#
-# $CC, $CXX, $CCC The C and C++ compiler binaries.
-# $CFLAGS, $CXXFLAGS C and C++ compiler flags.
-# $LIB_FUZZING_ENGINE C++ compiler argument to link fuzz target against the prebuilt engine library (e.g. libFuzzer).
+function build_native_go_fuzzer() {
+ fuzzer=$1
+ function=$2
+ path=$3
+ tags="-tags gofuzz"
-# This sets the -coverpgk for the coverage report when the corpus is executed through go test
-coverpkg="github.com/ethereum/go-ethereum/..."
+ if [[ $SANITIZER == *coverage* ]]; then
+ current_dir=$(pwd)
+ mkdir $OUT/rawfuzzers || true
+ cd $abs_file_dir
+ go test $tags -c -run $fuzzer -o $OUT/$fuzzer -cover
+ cp "${fuzzer_filename}" "${OUT}/rawfuzzers/${fuzzer}"
-function coverbuild {
- path=$1
- function=$2
- fuzzer=$3
- tags=""
+ fuzzed_repo=$(go list $tags -f {{.Module}} "$path")
+ abspath_repo=`go list -m $tags -f {{.Dir}} $fuzzed_repo || go list $tags -f {{.Dir}} $fuzzed_repo`
+ # give equivalence to absolute paths in another file, as go test -cover uses golangish pkg.Dir
+ echo "s=$fuzzed_repo"="$abspath_repo"= > $OUT/$fuzzer.gocovpath
- if [[ $# -eq 4 ]]; then
- tags="-tags $4"
- fi
- cd $path
- fuzzed_package=`pwd | rev | cut -d'/' -f 1 | rev`
- cp $GOPATH/ossfuzz_coverage_runner.go ./"${function,,}"_test.go
- sed -i -e 's/FuzzFunction/'$function'/' ./"${function,,}"_test.go
- sed -i -e 's/mypackagebeingfuzzed/'$fuzzed_package'/' ./"${function,,}"_test.go
- sed -i -e 's/TestFuzzCorpus/Test'$function'Corpus/' ./"${function,,}"_test.go
-
-cat << DOG > $OUT/$fuzzer
-#/bin/sh
-
- cd $OUT/$path
- go test -run Test${function}Corpus -v $tags -coverprofile \$1 -coverpkg $coverpkg
-
-DOG
-
- chmod +x $OUT/$fuzzer
- #echo "Built script $OUT/$fuzzer"
- #cat $OUT/$fuzzer
- cd -
+ cd $current_dir
+ else
+ go-118-fuzz-build $tags -o $fuzzer.a -func $function $path
+ $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer
+ fi
}
-function compile_fuzzer {
- # Inputs:
- # $1: The package to fuzz, within go-ethereum
- # $2: The name of the fuzzing function
- # $3: The name to give to the final fuzzing-binary
-
+function compile_fuzzer() {
path=$GOPATH/src/github.com/ethereum/go-ethereum/$1
- func=$2
+ function=$2
fuzzer=$3
echo "Building $fuzzer"
- # Do a coverage-build or a regular build
- if [[ $SANITIZER = *coverage* ]]; then
- coverbuild $path $func $fuzzer $coverpkg
- else
- (cd $path && \
- go-fuzz -func $func -o $WORK/$fuzzer.a . && \
- $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $WORK/$fuzzer.a -o $OUT/$fuzzer)
- fi
-
- ## Check if there exists a seed corpus file
- corpusfile="${path}/testdata/${fuzzer}_seed_corpus.zip"
- if [ -f $corpusfile ]
+ # Test if file contains a line with "func $function" and "testing.F".
+ if [ $(grep -r "func $function" $path | grep "testing.F" | wc -l) -eq 1 ]
then
- cp $corpusfile $OUT/
- echo "Found seed corpus: $corpusfile"
+ build_native_go_fuzzer $fuzzer $function $path
+ else
+ echo "Could not find the function: func ${function}(f *testing.F)"
fi
}
@@ -95,7 +62,7 @@ compile_fuzzer tests/fuzzers/bn256 FuzzMul fuzzBn256Mul
compile_fuzzer tests/fuzzers/bn256 FuzzPair fuzzBn256Pair
compile_fuzzer tests/fuzzers/runtime Fuzz fuzzVmRuntime
compile_fuzzer tests/fuzzers/keystore Fuzz fuzzKeystore
-compile_fuzzer tests/fuzzers/txfetcher Fuzz fuzzTxfetcher
+compile_fuzzer tests/fuzzers/txfetcher FuzzFetcher fuzzTxfetcher
compile_fuzzer tests/fuzzers/rlp Fuzz fuzzRlp
compile_fuzzer tests/fuzzers/trie Fuzz fuzzTrie
compile_fuzzer tests/fuzzers/stacktrie Fuzz fuzzStackTrie
diff --git a/tests/fuzzers/abi/abifuzzer.go b/tests/fuzzers/abi/abifuzzer.go
index 60233d158a..c13a80006c 100644
--- a/tests/fuzzers/abi/abifuzzer.go
+++ b/tests/fuzzers/abi/abifuzzer.go
@@ -153,7 +153,7 @@ func runFuzzer(input []byte) int {
return 0
}
-func Fuzz(input []byte) int {
+func FuzzAbi(input []byte) int {
return runFuzzer(input)
}
diff --git a/tests/fuzzers/abi/abifuzzer_test.go b/tests/fuzzers/abi/abifuzzer_test.go
index c66399e1b7..f23a0612c8 100644
--- a/tests/fuzzers/abi/abifuzzer_test.go
+++ b/tests/fuzzers/abi/abifuzzer_test.go
@@ -41,3 +41,9 @@ func TestGenerateCorpus(t *testing.T) {
}
*/
}
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ FuzzAbi(data)
+ })
+}
diff --git a/tests/fuzzers/bitutil/compress_fuzz.go b/tests/fuzzers/bitutil/compress_fuzz.go
index 5903cf2f93..36ed06c8aa 100644
--- a/tests/fuzzers/bitutil/compress_fuzz.go
+++ b/tests/fuzzers/bitutil/compress_fuzz.go
@@ -24,7 +24,7 @@ import (
// Fuzz implements a go-fuzz fuzzer method to test various encoding method
// invocations.
-func Fuzz(data []byte) int {
+func FuzzBitutil(data []byte) int {
if len(data) == 0 {
return 0
}
diff --git a/tests/fuzzers/stacktrie/debug/main.go b/tests/fuzzers/bitutil/compress_test.go
similarity index 63%
rename from tests/fuzzers/stacktrie/debug/main.go
rename to tests/fuzzers/bitutil/compress_test.go
index 6b634f05c2..3207c9baf3 100644
--- a/tests/fuzzers/stacktrie/debug/main.go
+++ b/tests/fuzzers/bitutil/compress_test.go
@@ -1,4 +1,4 @@
-// Copyright 2020 The go-ethereum Authors
+// Copyright 2023 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
@@ -14,25 +14,12 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package main
+package bitutil
-import (
- "fmt"
- "os"
+import "testing"
- "github.com/ethereum/go-ethereum/tests/fuzzers/stacktrie"
-)
-
-func main() {
- if len(os.Args) != 2 {
- fmt.Fprintf(os.Stderr, "Usage: debug ")
- os.Exit(1)
- }
- crasher := os.Args[1]
- data, err := os.ReadFile(crasher)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
- os.Exit(1)
- }
- stacktrie.Debug(data)
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ FuzzBitutil(data)
+ })
}
diff --git a/tests/fuzzers/bls12381/bls12381_fuzz.go b/tests/fuzzers/bls12381/bls12381_fuzz.go
index ced87dd41a..f04524f76a 100644
--- a/tests/fuzzers/bls12381/bls12381_fuzz.go
+++ b/tests/fuzzers/bls12381/bls12381_fuzz.go
@@ -14,9 +14,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-//go:build gofuzz
-// +build gofuzz
-
package bls
import (
@@ -35,7 +32,7 @@ import (
blst "github.com/supranational/blst/bindings/go"
)
-func FuzzCrossPairing(data []byte) int {
+func fuzzCrossPairing(data []byte) int {
input := bytes.NewReader(data)
// get random G1 points
@@ -101,7 +98,7 @@ func massageBLST(in []byte) []byte {
return out
}
-func FuzzCrossG1Add(data []byte) int {
+func fuzzCrossG1Add(data []byte) int {
input := bytes.NewReader(data)
// get random G1 points
@@ -139,7 +136,7 @@ func FuzzCrossG1Add(data []byte) int {
return 1
}
-func FuzzCrossG2Add(data []byte) int {
+func fuzzCrossG2Add(data []byte) int {
input := bytes.NewReader(data)
// get random G2 points
@@ -177,7 +174,7 @@ func FuzzCrossG2Add(data []byte) int {
return 1
}
-func FuzzCrossG1MultiExp(data []byte) int {
+func fuzzCrossG1MultiExp(data []byte) int {
var (
input = bytes.NewReader(data)
gethScalars []*big.Int
diff --git a/tests/fuzzers/bls12381/bls12381_test.go b/tests/fuzzers/bls12381/bls12381_test.go
new file mode 100644
index 0000000000..39ea124a57
--- /dev/null
+++ b/tests/fuzzers/bls12381/bls12381_test.go
@@ -0,0 +1,94 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package bls
+
+import "testing"
+
+func FuzzCrossPairing(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzCrossPairing(data)
+ })
+}
+
+func FuzzCrossG1Add(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzCrossG1Add(data)
+ })
+}
+
+func FuzzCrossG2Add(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzCrossG2Add(data)
+ })
+}
+
+func FuzzCrossG1MultiExp(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzCrossG1MultiExp(data)
+ })
+}
+
+func FuzzG1Add(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsG1Add, data)
+ })
+}
+
+func FuzzG1Mul(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsG1Mul, data)
+ })
+}
+
+func FuzzG1MultiExp(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsG1MultiExp, data)
+ })
+}
+
+func FuzzG2Add(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsG2Add, data)
+ })
+}
+func FuzzG2Mul(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsG2Mul, data)
+ })
+}
+func FuzzG2MultiExp(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsG2MultiExp, data)
+ })
+}
+func FuzzPairing(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsPairing, data)
+ })
+}
+
+func FuzzMapG1(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsMapG1, data)
+ })
+}
+
+func FuzzMapG2(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(blsMapG2, data)
+ })
+}
diff --git a/tests/fuzzers/bls12381/precompile_fuzzer.go b/tests/fuzzers/bls12381/precompile_fuzzer.go
index cab2bcba38..763ed56e9f 100644
--- a/tests/fuzzers/bls12381/precompile_fuzzer.go
+++ b/tests/fuzzers/bls12381/precompile_fuzzer.go
@@ -36,16 +36,6 @@ const (
blsMapG2 = byte(18)
)
-func FuzzG1Add(data []byte) int { return fuzz(blsG1Add, data) }
-func FuzzG1Mul(data []byte) int { return fuzz(blsG1Mul, data) }
-func FuzzG1MultiExp(data []byte) int { return fuzz(blsG1MultiExp, data) }
-func FuzzG2Add(data []byte) int { return fuzz(blsG2Add, data) }
-func FuzzG2Mul(data []byte) int { return fuzz(blsG2Mul, data) }
-func FuzzG2MultiExp(data []byte) int { return fuzz(blsG2MultiExp, data) }
-func FuzzPairing(data []byte) int { return fuzz(blsPairing, data) }
-func FuzzMapG1(data []byte) int { return fuzz(blsMapG1, data) }
-func FuzzMapG2(data []byte) int { return fuzz(blsMapG2, data) }
-
func checkInput(id byte, inputLen int) bool {
switch id {
case blsG1Add:
diff --git a/tests/fuzzers/bn256/bn256_fuzz.go b/tests/fuzzers/bn256/bn256_fuzz.go
index abf1b88615..75f7d59dee 100644
--- a/tests/fuzzers/bn256/bn256_fuzz.go
+++ b/tests/fuzzers/bn256/bn256_fuzz.go
@@ -14,9 +14,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-//go:build gofuzz
-// +build gofuzz
-
package bn256
import (
@@ -64,8 +61,8 @@ func getG2Points(input io.Reader) (*cloudflare.G2, *google.G2, *bn254.G2Affine)
return xc, xg, xs
}
-// FuzzAdd fuzzez bn256 addition between the Google and Cloudflare libraries.
-func FuzzAdd(data []byte) int {
+// fuzzAdd fuzzez bn256 addition between the Google and Cloudflare libraries.
+func fuzzAdd(data []byte) int {
input := bytes.NewReader(data)
xc, xg, xs := getG1Points(input)
if xc == nil {
@@ -97,9 +94,9 @@ func FuzzAdd(data []byte) int {
return 1
}
-// FuzzMul fuzzez bn256 scalar multiplication between the Google and Cloudflare
+// fuzzMul fuzzez bn256 scalar multiplication between the Google and Cloudflare
// libraries.
-func FuzzMul(data []byte) int {
+func fuzzMul(data []byte) int {
input := bytes.NewReader(data)
pc, pg, ps := getG1Points(input)
if pc == nil {
@@ -139,7 +136,7 @@ func FuzzMul(data []byte) int {
return 1
}
-func FuzzPair(data []byte) int {
+func fuzzPair(data []byte) int {
input := bytes.NewReader(data)
pc, pg, ps := getG1Points(input)
if pc == nil {
diff --git a/tests/fuzzers/snap/debug/main.go b/tests/fuzzers/bn256/bn256_test.go
similarity index 64%
rename from tests/fuzzers/snap/debug/main.go
rename to tests/fuzzers/bn256/bn256_test.go
index df46bb1e22..8b2f962284 100644
--- a/tests/fuzzers/snap/debug/main.go
+++ b/tests/fuzzers/bn256/bn256_test.go
@@ -1,4 +1,4 @@
-// Copyright 2020 The go-ethereum Authors
+// Copyright 2023 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
@@ -14,25 +14,24 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package main
+package bn256
-import (
- "fmt"
- "os"
+import "testing"
- "github.com/ethereum/go-ethereum/tests/fuzzers/snap"
-)
-
-func main() {
- if len(os.Args) != 2 {
- fmt.Fprintf(os.Stderr, "Usage: debug \n")
- os.Exit(1)
- }
- crasher := os.Args[1]
- data, err := os.ReadFile(crasher)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
- os.Exit(1)
- }
- snap.FuzzTrieNodes(data)
+func FuzzAdd(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzAdd(data)
+ })
+}
+
+func FuzzMul(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzMul(data)
+ })
+}
+
+func FuzzPair(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzPair(data)
+ })
}
diff --git a/tests/fuzzers/difficulty/difficulty-fuzz.go b/tests/fuzzers/difficulty/difficulty-fuzz.go
index e8753bb623..fbbd7f6876 100644
--- a/tests/fuzzers/difficulty/difficulty-fuzz.go
+++ b/tests/fuzzers/difficulty/difficulty-fuzz.go
@@ -75,7 +75,7 @@ func (f *fuzzer) readBool() bool {
// - 0 otherwise
//
// other values are reserved for future use.
-func Fuzz(data []byte) int {
+func fuzz(data []byte) int {
f := fuzzer{
input: bytes.NewReader(data),
exhausted: false,
diff --git a/tests/fuzzers/difficulty/debug/main.go b/tests/fuzzers/difficulty/difficulty_test.go
similarity index 63%
rename from tests/fuzzers/difficulty/debug/main.go
rename to tests/fuzzers/difficulty/difficulty_test.go
index 70cf092568..49beedb486 100644
--- a/tests/fuzzers/difficulty/debug/main.go
+++ b/tests/fuzzers/difficulty/difficulty_test.go
@@ -1,4 +1,4 @@
-// Copyright 2020 The go-ethereum Authors
+// Copyright 2023 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
@@ -14,25 +14,12 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package main
+package difficulty
-import (
- "fmt"
- "os"
+import "testing"
- "github.com/ethereum/go-ethereum/tests/fuzzers/difficulty"
-)
-
-func main() {
- if len(os.Args) != 2 {
- fmt.Fprintf(os.Stderr, "Usage: debug ")
- os.Exit(1)
- }
- crasher := os.Args[1]
- data, err := os.ReadFile(crasher)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
- os.Exit(1)
- }
- difficulty.Fuzz(data)
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
}
diff --git a/tests/fuzzers/keystore/corpus/0176eaf52ed014ec5c91cf4afa070dd3fd469077-1 b/tests/fuzzers/keystore/corpus/0176eaf52ed014ec5c91cf4afa070dd3fd469077-1
deleted file mode 100644
index 1c0ecf5250..0000000000
--- a/tests/fuzzers/keystore/corpus/0176eaf52ed014ec5c91cf4afa070dd3fd469077-1
+++ /dev/null
@@ -1 +0,0 @@
-ns©›,²Ô
\ No newline at end of file
diff --git a/tests/fuzzers/keystore/keystore-fuzzer.go b/tests/fuzzers/keystore/keystore-fuzzer.go
index e3bcae92e1..07a85d77b5 100644
--- a/tests/fuzzers/keystore/keystore-fuzzer.go
+++ b/tests/fuzzers/keystore/keystore-fuzzer.go
@@ -22,7 +22,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/keystore"
)
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
ks := keystore.NewKeyStore("/tmp/ks", keystore.LightScryptN, keystore.LightScryptP)
a, err := ks.NewAccount(string(input))
diff --git a/tests/fuzzers/les/debug/main.go b/tests/fuzzers/keystore/keystore_test.go
similarity index 58%
rename from tests/fuzzers/les/debug/main.go
rename to tests/fuzzers/keystore/keystore_test.go
index 77a6127030..167ff6c471 100644
--- a/tests/fuzzers/les/debug/main.go
+++ b/tests/fuzzers/keystore/keystore_test.go
@@ -1,4 +1,4 @@
-// Copyright 2020 The go-ethereum Authors
+// Copyright 2023 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
@@ -14,27 +14,12 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package main
+package keystore
-import (
- "fmt"
- "os"
+import "testing"
- "github.com/ethereum/go-ethereum/tests/fuzzers/les"
-)
-
-func main() {
- if len(os.Args) != 2 {
- fmt.Fprintf(os.Stderr, "Usage: debug \n")
- fmt.Fprintf(os.Stderr, "Example\n")
- fmt.Fprintf(os.Stderr, " $ debug ../crashers/4bbef6857c733a87ecf6fd8b9e7238f65eb9862a\n")
- os.Exit(1)
- }
- crasher := os.Args[1]
- data, err := os.ReadFile(crasher)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
- os.Exit(1)
- }
- les.Fuzz(data)
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
}
diff --git a/tests/fuzzers/les/les-fuzzer.go b/tests/fuzzers/les/les-fuzzer.go
index c29bb2ef12..e18b83ff3b 100644
--- a/tests/fuzzers/les/les-fuzzer.go
+++ b/tests/fuzzers/les/les-fuzzer.go
@@ -279,7 +279,7 @@ func (f *fuzzer) doFuzz(msgCode uint64, packet interface{}) {
fn(f, peer, func() bool { return true })
}
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
// We expect some large inputs
if len(input) < 100 {
return -1
diff --git a/tests/fuzzers/les/les_test.go b/tests/fuzzers/les/les_test.go
new file mode 100644
index 0000000000..53af45ceb4
--- /dev/null
+++ b/tests/fuzzers/les/les_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package les
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
+}
diff --git a/tests/fuzzers/rangeproof/debug/main.go b/tests/fuzzers/rangeproof/debug/main.go
deleted file mode 100644
index d4cab8ec46..0000000000
--- a/tests/fuzzers/rangeproof/debug/main.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2020 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see .
-
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/ethereum/go-ethereum/tests/fuzzers/rangeproof"
-)
-
-func main() {
- if len(os.Args) != 2 {
- fmt.Fprintf(os.Stderr, "Usage: debug \n")
- fmt.Fprintf(os.Stderr, "Example\n")
- fmt.Fprintf(os.Stderr, " $ debug ../crashers/4bbef6857c733a87ecf6fd8b9e7238f65eb9862a\n")
- os.Exit(1)
- }
- crasher := os.Args[1]
- data, err := os.ReadFile(crasher)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
- os.Exit(1)
- }
- rangeproof.Fuzz(data)
-}
diff --git a/tests/fuzzers/rangeproof/rangeproof-fuzzer.go b/tests/fuzzers/rangeproof/rangeproof-fuzzer.go
index c9d7815536..6b5ca90880 100644
--- a/tests/fuzzers/rangeproof/rangeproof-fuzzer.go
+++ b/tests/fuzzers/rangeproof/rangeproof-fuzzer.go
@@ -185,7 +185,7 @@ func (f *fuzzer) fuzz() int {
// - 0 otherwise
//
// other values are reserved for future use.
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
if len(input) < 100 {
return 0
}
diff --git a/tests/fuzzers/rangeproof/rangeproof_test.go b/tests/fuzzers/rangeproof/rangeproof_test.go
new file mode 100644
index 0000000000..bc7badc5b3
--- /dev/null
+++ b/tests/fuzzers/rangeproof/rangeproof_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package rangeproof
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
+}
diff --git a/tests/fuzzers/rlp/rlp_fuzzer.go b/tests/fuzzers/rlp/rlp_fuzzer.go
index 9fcdb57769..0da8ccdd77 100644
--- a/tests/fuzzers/rlp/rlp_fuzzer.go
+++ b/tests/fuzzers/rlp/rlp_fuzzer.go
@@ -38,7 +38,7 @@ func decodeEncode(input []byte, val interface{}, i int) {
}
}
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
if len(input) == 0 {
return 0
}
diff --git a/tests/fuzzers/rlp/rlp_test.go b/tests/fuzzers/rlp/rlp_test.go
new file mode 100644
index 0000000000..377b3961bf
--- /dev/null
+++ b/tests/fuzzers/rlp/rlp_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package rlp
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
+}
diff --git a/tests/fuzzers/runtime/runtime_fuzz.go b/tests/fuzzers/runtime/runtime_fuzz.go
index b30e9243d8..44c8ea1847 100644
--- a/tests/fuzzers/runtime/runtime_fuzz.go
+++ b/tests/fuzzers/runtime/runtime_fuzz.go
@@ -24,7 +24,7 @@ import (
//
// This returns 1 for valid parse:able/runnable code, 0
// for invalid opcode.
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
_, _, err := runtime.Execute(input, input, &runtime.Config{
GasLimit: 12000000,
})
diff --git a/tests/fuzzers/runtime/runtime_test.go b/tests/fuzzers/runtime/runtime_test.go
new file mode 100644
index 0000000000..7c4e58db8b
--- /dev/null
+++ b/tests/fuzzers/runtime/runtime_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package runtime
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
+}
diff --git a/tests/fuzzers/secp256k1/secp_fuzzer.go b/tests/fuzzers/secp256k1/secp_fuzzer.go
index 47083d5fe3..b6200aeffa 100644
--- a/tests/fuzzers/secp256k1/secp_fuzzer.go
+++ b/tests/fuzzers/secp256k1/secp_fuzzer.go
@@ -23,12 +23,12 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
- fuzz "github.com/google/gofuzz"
+ gofuzz "github.com/google/gofuzz"
)
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
var (
- fuzzer = fuzz.NewFromGoFuzz(input)
+ fuzzer = gofuzz.NewFromGoFuzz(input)
curveA = secp256k1.S256()
curveB = btcec.S256()
dataP1 []byte
diff --git a/tests/fuzzers/secp256k1/secp_test.go b/tests/fuzzers/secp256k1/secp_test.go
index 0ca16cb9bf..c4aa2c8bae 100644
--- a/tests/fuzzers/secp256k1/secp_test.go
+++ b/tests/fuzzers/secp256k1/secp_test.go
@@ -20,5 +20,11 @@ import "testing"
func TestFuzzer(t *testing.T) {
test := "00000000N0000000/R00000000000000000U0000S0000000mkhP000000000000000U"
- Fuzz([]byte(test))
+ fuzz([]byte(test))
+}
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
}
diff --git a/tests/fuzzers/snap/fuzz_handler.go b/tests/fuzzers/snap/fuzz_handler.go
index 784b526dc0..20521bb92a 100644
--- a/tests/fuzzers/snap/fuzz_handler.go
+++ b/tests/fuzzers/snap/fuzz_handler.go
@@ -141,20 +141,3 @@ func doFuzz(input []byte, obj interface{}, code int) int {
}
return 1
}
-
-// To run a fuzzer, do
-// $ CGO_ENABLED=0 go-fuzz-build -func FuzzTrieNodes
-// $ go-fuzz
-
-func FuzzARange(input []byte) int {
- return doFuzz(input, &snap.GetAccountRangePacket{}, snap.GetAccountRangeMsg)
-}
-func FuzzSRange(input []byte) int {
- return doFuzz(input, &snap.GetStorageRangesPacket{}, snap.GetStorageRangesMsg)
-}
-func FuzzByteCodes(input []byte) int {
- return doFuzz(input, &snap.GetByteCodesPacket{}, snap.GetByteCodesMsg)
-}
-func FuzzTrieNodes(input []byte) int {
- return doFuzz(input, &snap.GetTrieNodesPacket{}, snap.GetTrieNodesMsg)
-}
diff --git a/tests/fuzzers/vflux/debug/main.go b/tests/fuzzers/snap/fuzz_test.go
similarity index 51%
rename from tests/fuzzers/vflux/debug/main.go
rename to tests/fuzzers/snap/fuzz_test.go
index e6cec04606..1c39f2bb50 100644
--- a/tests/fuzzers/vflux/debug/main.go
+++ b/tests/fuzzers/snap/fuzz_test.go
@@ -1,4 +1,4 @@
-// Copyright 2020 The go-ethereum Authors
+// Copyright 2023 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
@@ -14,30 +14,34 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package main
+package snap
import (
- "fmt"
- "os"
+ "testing"
- "github.com/ethereum/go-ethereum/log"
- "github.com/ethereum/go-ethereum/tests/fuzzers/vflux"
+ "github.com/ethereum/go-ethereum/eth/protocols/snap"
)
-func main() {
- log.Root().SetHandler(log.LvlFilterHandler(log.LvlTrace, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
-
- if len(os.Args) != 2 {
- fmt.Fprintf(os.Stderr, "Usage: debug \n")
- fmt.Fprintf(os.Stderr, "Example\n")
- fmt.Fprintf(os.Stderr, " $ debug ../crashers/4bbef6857c733a87ecf6fd8b9e7238f65eb9862a\n")
- os.Exit(1)
- }
- crasher := os.Args[1]
- data, err := os.ReadFile(crasher)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
- os.Exit(1)
- }
- vflux.FuzzClientPool(data)
+func FuzzARange(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ doFuzz(data, &snap.GetAccountRangePacket{}, snap.GetAccountRangeMsg)
+ })
+}
+
+func FuzzSRange(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ doFuzz(data, &snap.GetStorageRangesPacket{}, snap.GetStorageRangesMsg)
+ })
+}
+
+func FuzzByteCodes(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ doFuzz(data, &snap.GetByteCodesPacket{}, snap.GetByteCodesMsg)
+ })
+}
+
+func FuzzTrieNodes(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ doFuzz(data, &snap.GetTrieNodesPacket{}, snap.GetTrieNodesMsg)
+ })
}
diff --git a/tests/fuzzers/stacktrie/trie_fuzzer.go b/tests/fuzzers/stacktrie/trie_fuzzer.go
index 20b8ca24b3..3d88b308fd 100644
--- a/tests/fuzzers/stacktrie/trie_fuzzer.go
+++ b/tests/fuzzers/stacktrie/trie_fuzzer.go
@@ -115,7 +115,7 @@ type kv struct {
// - 0 otherwise
//
// other values are reserved for future use.
-func Fuzz(data []byte) int {
+func fuzz(data []byte) int {
f := fuzzer{
input: bytes.NewReader(data),
exhausted: false,
diff --git a/tests/fuzzers/stacktrie/trie_test.go b/tests/fuzzers/stacktrie/trie_test.go
new file mode 100644
index 0000000000..f6f755f76a
--- /dev/null
+++ b/tests/fuzzers/stacktrie/trie_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package stacktrie
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
+}
diff --git a/tests/fuzzers/trie/corpus/data b/tests/fuzzers/trie/corpus/data
deleted file mode 100644
index c4a4839cb8..0000000000
--- a/tests/fuzzers/trie/corpus/data
+++ /dev/null
@@ -1 +0,0 @@
-asdlfkjasf23oiejfasdfadkfqlkjfasdlkfjalwk4jfalsdkfjawlefkjsadlfkjasldkfjwalefkjasdlfkjM
\ No newline at end of file
diff --git a/tests/fuzzers/trie/trie-fuzzer.go b/tests/fuzzers/trie/trie-fuzzer.go
index 687f5efb1c..a505fa78a0 100644
--- a/tests/fuzzers/trie/trie-fuzzer.go
+++ b/tests/fuzzers/trie/trie-fuzzer.go
@@ -130,7 +130,7 @@ func Generate(input []byte) randTest {
// - 0 otherwise
//
// other values are reserved for future use.
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
program := Generate(input)
if len(program) == 0 {
return 0
diff --git a/tests/fuzzers/trie/trie_test.go b/tests/fuzzers/trie/trie_test.go
new file mode 100644
index 0000000000..a7d28a806e
--- /dev/null
+++ b/tests/fuzzers/trie/trie_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package trie
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
+}
diff --git a/tests/fuzzers/txfetcher/txfetcher_fuzzer.go b/tests/fuzzers/txfetcher/txfetcher_fuzzer.go
index 8b501645b6..51f2fc3b4d 100644
--- a/tests/fuzzers/txfetcher/txfetcher_fuzzer.go
+++ b/tests/fuzzers/txfetcher/txfetcher_fuzzer.go
@@ -48,7 +48,7 @@ func init() {
}
}
-func Fuzz(input []byte) int {
+func fuzz(input []byte) int {
// Don't generate insanely large test cases, not much value in them
if len(input) > 16*1024 {
return 0
diff --git a/tests/fuzzers/txfetcher/txfetcher_test.go b/tests/fuzzers/txfetcher/txfetcher_test.go
new file mode 100644
index 0000000000..a7d28a806e
--- /dev/null
+++ b/tests/fuzzers/txfetcher/txfetcher_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package trie
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzz(data)
+ })
+}
diff --git a/tests/fuzzers/vflux/clientpool-fuzzer.go b/tests/fuzzers/vflux/clientpool-fuzzer.go
index b3b523cc82..de694a7b3f 100644
--- a/tests/fuzzers/vflux/clientpool-fuzzer.go
+++ b/tests/fuzzers/vflux/clientpool-fuzzer.go
@@ -214,7 +214,7 @@ func (f *fuzzer) atomicBalanceOp(balance vfs.AtomicBalanceOperator, id enode.ID)
}
}
-func FuzzClientPool(input []byte) int {
+func fuzzClientPool(input []byte) int {
if len(input) > 10000 {
return -1
}
diff --git a/tests/fuzzers/vflux/clientpool_test.go b/tests/fuzzers/vflux/clientpool_test.go
new file mode 100644
index 0000000000..40c5f22905
--- /dev/null
+++ b/tests/fuzzers/vflux/clientpool_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+package vflux
+
+import "testing"
+
+func FuzzClientPool(f *testing.F) {
+ f.Fuzz(func(t *testing.T, data []byte) {
+ fuzzClientPool(data)
+ })
+}