github.com/ledgerwatch/erigon-lib@v1.0.0/types/txn_types_fuzz_test.go (about) 1 //go:build !nofuzz 2 3 package types 4 5 import ( 6 "testing" 7 8 "github.com/ledgerwatch/erigon-lib/common/u256" 9 ) 10 11 // golang.org/s/draft-fuzzing-design 12 //go doc testing 13 //go doc testing.F 14 //go doc testing.F.AddRemoteTxs 15 //go doc testing.F.Fuzz 16 17 // go test -trimpath -v -fuzz=Fuzz -fuzztime=10s ./txpool 18 19 //func init() { 20 // log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StderrHandler)) 21 //} 22 23 func FuzzParseTx(f *testing.F) { 24 f.Add([]byte{1}, 0) 25 f.Fuzz(func(t *testing.T, in []byte, pos int) { 26 t.Parallel() 27 ctx := NewTxParseContext(*u256.N1) 28 txn := &TxSlot{} 29 sender := make([]byte, 20) 30 _, _ = ctx.ParseTransaction(in, pos, txn, sender, false /* hasEnvelope */, true /* wrappedWithBlobs */, nil) 31 }) 32 }