Skip to content

Commit

Permalink
feat: review applied
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbenyun committed Nov 25, 2024
1 parent 1d8b828 commit 83a7b05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 7 additions & 0 deletions op-batcher/batcher/channel_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 0 additions & 4 deletions op-batcher/batcher/channel_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion op-batcher/batcher/channel_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down

0 comments on commit 83a7b05

Please sign in to comment.