Commit 2662ebb6 authored by Matthew Slipper's avatar Matthew Slipper

op-e2e: Use deterministic RNG in l2 batcher test

parent 3adc2cc4
package actions package actions
import ( import (
"crypto/rand"
"errors" "errors"
"math/big" "math/big"
"math/rand"
"testing" "testing"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
...@@ -467,6 +467,8 @@ func BigL2Txs(gt *testing.T, deltaTimeOffset *hexutil.Uint64) { ...@@ -467,6 +467,8 @@ func BigL2Txs(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
tx.GasFeeCap = e2eutils.Ether(1) // be very generous with basefee, since we're spamming L1 tx.GasFeeCap = e2eutils.Ether(1) // be very generous with basefee, since we're spamming L1
} }
rng := rand.New(rand.NewSource(555))
// build many L2 blocks filled to the brim with large txs of random data // build many L2 blocks filled to the brim with large txs of random data
for i := 0; i < 40; i++ { for i := 0; i < 40; i++ {
aliceNonce, err := cl.PendingNonceAt(t.Ctx(), dp.Addresses.Alice) aliceNonce, err := cl.PendingNonceAt(t.Ctx(), dp.Addresses.Alice)
...@@ -483,7 +485,7 @@ func BigL2Txs(gt *testing.T, deltaTimeOffset *hexutil.Uint64) { ...@@ -483,7 +485,7 @@ func BigL2Txs(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
require.NoError(t, err) require.NoError(t, err)
signer := types.LatestSigner(sd.L2Cfg.Config) signer := types.LatestSigner(sd.L2Cfg.Config)
data := make([]byte, 120_000) // very large L2 txs, as large as the tx-pool will accept data := make([]byte, 120_000) // very large L2 txs, as large as the tx-pool will accept
_, err := rand.Read(data[:]) // fill with random bytes, to make compression ineffective _, err := rng.Read(data[:]) // fill with random bytes, to make compression ineffective
require.NoError(t, err) require.NoError(t, err)
gas, err := core.IntrinsicGas(data, nil, false, true, true, false) gas, err := core.IntrinsicGas(data, nil, false, true, true, false)
require.NoError(t, err) require.NoError(t, err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment