Skip to content

Commit 28267e8

Browse files
authored
Fix batcher restart test (#222)
* Fix batcher restart test * Tune parameters to be more realistic (in particular, increasing parallelism to reduce bottleneck on slow L1) * Improve logging * Fix go lint
1 parent 78ec986 commit 28267e8

File tree

6 files changed

+23
-4
lines changed

6 files changed

+23
-4
lines changed

espresso/devnet-tests/batcher_restart_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func TestBatcherRestart(t *testing.T) {
1313
defer cancel()
1414

1515
d := NewDevnet(ctx, t)
16-
require.NoError(t, d.Up())
16+
require.NoError(t, d.Up(testing.Verbose()))
1717
defer func() {
1818
require.NoError(t, d.Down())
1919
}()

espresso/devnet-tests/devnet_tools.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func NewDevnet(ctx context.Context, t *testing.T) *Devnet {
6565
return d
6666
}
6767

68-
func (d *Devnet) Up() (err error) {
68+
func (d *Devnet) Up(verbose bool) (err error) {
6969
cmd := exec.CommandContext(
7070
d.ctx,
7171
"docker", "compose", "up", "-d",
@@ -95,6 +95,18 @@ func (d *Devnet) Up() (err error) {
9595
}
9696
}()
9797

98+
if verbose {
99+
// Stream logs to stdout while the test runs. This goroutine will automatically exit when
100+
// the context is cancelled.
101+
go func() {
102+
cmd = exec.CommandContext(d.ctx, "docker", "compose", "logs", "-f")
103+
cmd.Stdout = os.Stdout
104+
// We don't care about the error return of this command, since it's always going to be
105+
// killed by the context cancellation.
106+
_ = cmd.Run()
107+
}()
108+
}
109+
98110
// Open RPC clients for the different nodes.
99111
d.L2Seq, err = d.serviceClient("op-geth-sequencer", 8546)
100112
if err != nil {
@@ -196,6 +208,8 @@ func (d *Devnet) SubmitL2Tx(applyTxOpts helpers.TxOptsFn) (*types.Receipt, error
196208
return nil, fmt.Errorf("wrong status: have %d, want %d", receipt.Status, opts.ExpectedStatus)
197209
}
198210

211+
log.Info("submitted transaction to sequencer", "hash", tx.Hash(), "receipt", receipt)
212+
199213
return receipt, nil
200214
}
201215

espresso/docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,11 @@ services:
311311
- --mnemonic=test test test test test test test test test test test junk # Arbitrary value for testing
312312
- --hd-path=m/44'/60'/0'/0/0 # Arbitrary value for testing
313313
- --throttle-threshold=0
314-
- --max-channel-duration=1
314+
- --max-channel-duration=2
315315
- --target-num-frames=1
316+
- --max-pending-tx=32
317+
- --altda.max-concurrent-da-requests=32
318+
- --espresso-poll-interval=1s
316319

317320
# HTTP proxy for enclave Odyn proxy requirement
318321
http-proxy:

espresso/streamer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ func NewEspressoStreamer[B Batch](
124124

125125
// Reset the state to the last safe batch
126126
func (s *EspressoStreamer[B]) Reset() {
127+
s.Log.Info("reset espresso streamer", "hotshot pos", s.fallbackHotShotPos, "batch pos", s.fallbackBatchPos)
127128
s.hotShotPos = s.fallbackHotShotPos
128129
s.BatchPos = s.fallbackBatchPos + 1
129130
s.BatchBuffer.Clear()

op-batcher/batcher/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,7 @@ func (l *BatchSubmitter) sendTx(txdata txData, isCancel bool, candidate *txmgr.T
984984
},
985985
)
986986
if !goroutineSpawned {
987+
log.Warn("failed to spawn Espresso tx goroutine")
987988
l.recordFailedDARequest(txdata.ID(), nil)
988989
}
989990
return

op-batcher/batcher/espresso.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ func (c *AdaptL1BlockRefClient) HeaderHashByNumber(ctx context.Context, number *
736736

737737
// Periodically refreshes the sync status and polls Espresso streamer for new batches
738738
func (l *BatchSubmitter) espressoBatchLoadingLoop(ctx context.Context, wg *sync.WaitGroup, publishSignal chan struct{}) {
739-
l.Log.Info("Starting EspressoBatchLoadingLoop")
739+
l.Log.Info("Starting EspressoBatchLoadingLoop", "polling interval", l.Config.EspressoPollInterval)
740740

741741
defer wg.Done()
742742
ticker := time.NewTicker(l.Config.EspressoPollInterval)

0 commit comments

Comments
 (0)