-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
l2_gossip_test.go
38 lines (32 loc) · 1.12 KB
/
l2_gossip_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package op_e2e
import (
"math/big"
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
)
func TestTxGossip(t *testing.T) {
InitParallel(t)
cfg := DefaultSystemConfig(t)
gethOpts := []geth.GethOption{
geth.WithP2P(),
}
cfg.GethOptions["sequencer"] = append(cfg.GethOptions["sequencer"], gethOpts...)
cfg.GethOptions["verifier"] = append(cfg.GethOptions["verifier"], gethOpts...)
sys, err := cfg.Start(t)
require.NoError(t, err, "Start system")
seqClient := sys.NodeClient("sequencer")
verifClient := sys.NodeClient("verifier")
geth.ConnectP2P(t, seqClient, verifClient)
// This prevents the below tx-sending from flaking in CI
_, err = geth.WaitForBlock(big.NewInt(10), verifClient, time.Minute)
require.NoError(t, err)
// Send a transaction to the verifier and it should be gossiped to the sequencer and included in a block.
SendL2Tx(t, cfg, verifClient, cfg.Secrets.Alice, func(opts *TxOpts) {
opts.ToAddr = &common.Address{0xaa}
opts.Value = common.Big1
opts.VerifyOnClients(seqClient, verifClient)
})
}