From 83a7b059a449ce3f3df9dc2c8a113bcbf9a19981 Mon Sep 17 00:00:00 2001 From: 0xbenyun Date: Mon, 25 Nov 2024 13:54:38 +0900 Subject: [PATCH] feat: review applied --- op-batcher/batcher/channel_builder.go | 7 +++++++ op-batcher/batcher/channel_manager.go | 4 ---- op-batcher/batcher/channel_manager_test.go | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/op-batcher/batcher/channel_builder.go b/op-batcher/batcher/channel_builder.go index b55071f469..2526f0c14c 100644 --- a/op-batcher/batcher/channel_builder.go +++ b/op-batcher/batcher/channel_builder.go @@ -20,6 +20,9 @@ var ( ErrChannelTimeoutClose = errors.New("close to channel timeout") ErrSeqWindowClose = errors.New("close to sequencer window timeout") ErrTerminated = errors.New("channel terminated") + // [Kroma: START] + ErrJustBeforeKromaMPTTime = errors.New("reached the block just before KromaMPTTime") + // [Kroma: END] ) type ChannelFullError struct { @@ -174,7 +177,11 @@ func (c *ChannelBuilder) AddBlock(block *types.Block) (*derive.L1BlockInfo, erro if err = c.co.FullErr(); err != nil { c.setFullErr(err) // Adding this block still worked, so don't return error, just mark as full + + } else /* [Kroma: START] */ if c.rollupCfg.KromaMPTTime != nil && block.Time() == *c.rollupCfg.KromaMPTTime-c.rollupCfg.BlockTime { + c.setFullErr(ErrJustBeforeKromaMPTTime) } + // [Kroma: END] return l1info, nil } diff --git a/op-batcher/batcher/channel_manager.go b/op-batcher/batcher/channel_manager.go index 1915e0cdbf..491837182a 100644 --- a/op-batcher/batcher/channel_manager.go +++ b/op-batcher/batcher/channel_manager.go @@ -260,10 +260,6 @@ func (s *channelManager) processBlocks() error { if s.currentChannel.IsFull() { break } - if s.rollupCfg.KromaMPTTime != nil && block.Time() == *s.rollupCfg.KromaMPTTime-s.rollupCfg.BlockTime { - s.currentChannel.channelBuilder.setFullErr(errors.New("reached the block just before KromaMPTTime")) - break - } } if blocksAdded == len(s.blocks) { diff --git a/op-batcher/batcher/channel_manager_test.go b/op-batcher/batcher/channel_manager_test.go index cb92f8bc45..a3a6380904 100644 --- a/op-batcher/batcher/channel_manager_test.go +++ b/op-batcher/batcher/channel_manager_test.go @@ -529,7 +529,7 @@ func TestChannelManager_Close_BeforeMPTBlock(t *testing.T) { txdata, err := m.TxData(eth.BlockID{}) require.NoError(err) ch1 := m.txChannels[txdata.ID().String()] - require.ErrorContains(ch1.FullErr(), "reached the block just before KromaMPTTime") + require.ErrorIs(ch1.FullErr(), ErrJustBeforeKromaMPTTime) // current channel is not full yet _, err = m.TxData(eth.BlockID{})