Commit d1d67e80 authored by Tei Im's avatar Tei Im

Set batch type explicitly for l2 batcher

parent f03327d6
...@@ -44,6 +44,9 @@ type BatcherCfg struct { ...@@ -44,6 +44,9 @@ type BatcherCfg struct {
BatcherKey *ecdsa.PrivateKey BatcherKey *ecdsa.PrivateKey
GarbageCfg *GarbageChannelCfg GarbageCfg *GarbageChannelCfg
ForceSubmitSingularBatch bool
ForceSubmitSpanBatch bool
} }
type L2BlockRefs interface { type L2BlockRefs interface {
...@@ -157,7 +160,13 @@ func (s *L2Batcher) Buffer(t Testing) error { ...@@ -157,7 +160,13 @@ func (s *L2Batcher) Buffer(t Testing) error {
var batchType uint = derive.SingularBatchType var batchType uint = derive.SingularBatchType
var spanBatchBuilder *derive.SpanBatchBuilder = nil var spanBatchBuilder *derive.SpanBatchBuilder = nil
if s.rollupCfg.IsDelta(block.Time()) {
if s.l2BatcherCfg.ForceSubmitSingularBatch && s.l2BatcherCfg.ForceSubmitSpanBatch {
t.Fatalf("ForceSubmitSingularBatch and ForceSubmitSpanBatch cannot be set to true at the same time")
} else if s.l2BatcherCfg.ForceSubmitSingularBatch {
// use SingularBatchType
} else if s.l2BatcherCfg.ForceSubmitSpanBatch || s.rollupCfg.IsDelta(block.Time()) {
// If both ForceSubmitSingularBatch and ForceSubmitSpanbatch are false, use SpanBatch automatically if Delta HF is activated.
batchType = derive.SpanBatchType batchType = derive.SpanBatchType
spanBatchBuilder = derive.NewSpanBatchBuilder(s.rollupCfg.Genesis.L2Time, s.rollupCfg.L2ChainID) spanBatchBuilder = derive.NewSpanBatchBuilder(s.rollupCfg.Genesis.L2Time, s.rollupCfg.L2ChainID)
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment