Skip to content

Commit

Permalink
cmd/livefuzzer: add pectra spam
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden committed Sep 18, 2024
1 parent 27b84ff commit a5f2cc6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion random.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/MariusVanDerWijden/FuzzyVM/filler"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
)

const (
Expand All @@ -25,7 +26,7 @@ func randomHash() common.Hash {
}

func randomAddress() common.Address {
switch mathRand.Int31n(5) {
switch mathRand.Int31n(8) {
case 0, 1, 2:
b := make([]byte, 20)
_, err := rand.Read(b)
Expand All @@ -37,6 +38,16 @@ func randomAddress() common.Address {
return common.Address{}
case 4:
return common.HexToAddress(ADDR)
case 5:
return params.BeaconRootsAddress
case 6:
return params.WithdrawalRequestsAddress
case 7:
return params.ConsolidationRequestsAddress
case 8:
return params.SystemAddress
case 9:
return params.HistoryStorageAddress
}
return common.Address{}
}
Expand Down
3 changes: 3 additions & 0 deletions transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ func RandomAuthTx(rpc *rpc.Client, f *filler.Filler, sender common.Address, nonc
if err != nil {
return nil, err
}
if rand.Int()%2 == 0 {
conf.to = nil // create a contract half of the time
}
return New7702Tx(conf.nonce, conf.to, conf.gasLimit, conf.chainID, tip, feecap, conf.value, conf.code, big.NewInt(1000000), *list, aList), nil
}

Expand Down

0 comments on commit a5f2cc6

Please sign in to comment.