Skip to content

Commit 1a9e3e7

Browse files
committed
PR Comments
1 parent 58dfa9d commit 1a9e3e7

File tree

14 files changed

+72
-201
lines changed

14 files changed

+72
-201
lines changed

op-batcher/batcher/channel_builder.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,17 @@ func NewChannelBuilder(cfg ChannelConfig, rollupCfg rollup.Config, latestL1Origi
8383
if err != nil {
8484
return nil, err
8585
}
86-
var spanBatch *derive.SpanBatch
86+
var co derive.ChannelOut
8787
if cfg.BatchType == derive.SpanBatchType {
88-
spanBatch = derive.NewSpanBatch(rollupCfg.Genesis.L2Time, rollupCfg.L2ChainID)
89-
}
90-
co, err := derive.NewChannelOut(cfg.BatchType, c, spanBatch)
91-
if err != nil {
92-
return nil, err
88+
co, err = derive.NewSpanChannelOut(rollupCfg.Genesis.L2Time, rollupCfg.L2ChainID, cfg.CompressorConfig.TargetOutputSize)
89+
if err != nil {
90+
return nil, err
91+
}
92+
} else {
93+
co, err = derive.NewChannelOut(c)
94+
if err != nil {
95+
return nil, err
96+
}
9397
}
9498

9599
cb := &ChannelBuilder{

op-batcher/batcher/channel_builder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func TestChannelBuilder_OutputWrongFramePanic(t *testing.T) {
365365
// to construct a single frame
366366
c, err := channelConfig.CompressorConfig.NewCompressor()
367367
require.NoError(t, err)
368-
co, err := derive.NewChannelOut(derive.SingularBatchType, c, nil)
368+
co, err := derive.NewChannelOut(c)
369369
require.NoError(t, err)
370370
var buf bytes.Buffer
371371
fn, err := co.OutputFrame(&buf, channelConfig.MaxFrameSize)

op-batcher/compressor/blind_compressor.go

Lines changed: 0 additions & 77 deletions
This file was deleted.

op-batcher/compressor/blind_compressor_test.go

Lines changed: 0 additions & 30 deletions
This file was deleted.

op-batcher/compressor/compressors.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const (
1010
RatioKind = "ratio"
1111
ShadowKind = "shadow"
1212
NoneKind = "none"
13-
BlindKind = "blind"
1413

1514
// CloseOverheadZlib is the number of final bytes a [zlib.Writer] call writes
1615
// to the output buffer.
@@ -21,7 +20,6 @@ var Kinds = map[string]FactoryFunc{
2120
RatioKind: NewRatioCompressor,
2221
ShadowKind: NewShadowCompressor,
2322
NoneKind: NewNonCompressor,
24-
BlindKind: NewBlindCompressor,
2523
}
2624

2725
var KindKeys []string

op-batcher/compressor/non_compressor.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ func NewNonCompressor(config Config) (derive.Compressor, error) {
3636
return c, nil
3737
}
3838

39-
func (t *NonCompressor) TargetOutputSize() uint64 {
40-
return t.config.TargetOutputSize
41-
}
42-
4339
func (t *NonCompressor) Write(p []byte) (int, error) {
4440
if err := t.compress.Flush(); err != nil {
4541
return 0, err

op-batcher/compressor/ratio_compressor.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ func NewRatioCompressor(config Config) (derive.Compressor, error) {
3434
return c, nil
3535
}
3636

37-
func (t *RatioCompressor) TargetOutputSize() uint64 {
38-
return t.config.TargetOutputSize
39-
}
40-
4137
func (t *RatioCompressor) Write(p []byte) (int, error) {
4238
if err := t.FullErr(); err != nil {
4339
return 0, err

op-batcher/compressor/shadow_compressor.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ func NewShadowCompressor(config Config) (derive.Compressor, error) {
5858
return c, nil
5959
}
6060

61-
func (t *ShadowCompressor) TargetOutputSize() uint64 {
62-
return t.config.TargetOutputSize
63-
}
64-
6561
func (t *ShadowCompressor) Write(p []byte) (int, error) {
6662
if t.fullErr != nil {
6763
return 0, t.fullErr

op-e2e/actions/l2_batcher.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,24 +189,21 @@ func (s *L2Batcher) Buffer(t Testing) error {
189189
if s.l2BatcherCfg.GarbageCfg != nil {
190190
ch, err = NewGarbageChannelOut(s.l2BatcherCfg.GarbageCfg)
191191
} else {
192-
c, e := compressor.NewBlindCompressor(compressor.Config{
193-
TargetOutputSize: batcher.MaxDataSize(1, s.l2BatcherCfg.MaxL1TxSize),
192+
target := batcher.MaxDataSize(1, s.l2BatcherCfg.MaxL1TxSize)
193+
c, e := compressor.NewShadowCompressor(compressor.Config{
194+
TargetOutputSize: target,
194195
})
195196
require.NoError(t, e, "failed to create compressor")
196197

197-
var batchType uint = derive.SingularBatchType
198-
var spanBatch *derive.SpanBatch
199-
200198
if s.l2BatcherCfg.ForceSubmitSingularBatch && s.l2BatcherCfg.ForceSubmitSpanBatch {
201199
t.Fatalf("ForceSubmitSingularBatch and ForceSubmitSpanBatch cannot be set to true at the same time")
202200
} else if s.l2BatcherCfg.ForceSubmitSingularBatch {
203201
// use SingularBatchType
202+
ch, err = derive.NewChannelOut(c)
204203
} else if s.l2BatcherCfg.ForceSubmitSpanBatch || s.rollupCfg.IsDelta(block.Time()) {
205204
// If both ForceSubmitSingularBatch and ForceSubmitSpanbatch are false, use SpanBatch automatically if Delta HF is activated.
206-
batchType = derive.SpanBatchType
207-
spanBatch = derive.NewSpanBatch(s.rollupCfg.Genesis.L2Time, s.rollupCfg.L2ChainID)
205+
ch, err = derive.NewSpanChannelOut(s.rollupCfg.Genesis.L2Time, s.rollupCfg.L2ChainID, target)
208206
}
209-
ch, err = derive.NewChannelOut(batchType, c, spanBatch)
210207
}
211208
require.NoError(t, err, "failed to create channel")
212209
s.l2ChannelOut = ch

op-e2e/actions/sync_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/ethereum-optimism/optimism/op-batcher/compressor"
1110
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
1211
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
1312
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
@@ -27,12 +26,7 @@ import (
2726
)
2827

2928
func newSpanChannelOut(t StatefulTesting, e e2eutils.SetupData) derive.ChannelOut {
30-
c, err := compressor.NewBlindCompressor(compressor.Config{
31-
TargetOutputSize: 128_000,
32-
})
33-
require.NoError(t, err)
34-
spanBatch := derive.NewSpanBatch(e.RollupCfg.Genesis.L2Time, e.RollupCfg.L2ChainID)
35-
channelOut, err := derive.NewChannelOut(derive.SpanBatchType, c, spanBatch)
29+
channelOut, err := derive.NewSpanChannelOut(e.RollupCfg.Genesis.L2Time, e.RollupCfg.L2ChainID, 128_000)
3630
require.NoError(t, err)
3731
return channelOut
3832
}

0 commit comments

Comments
 (0)