Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zjg555543 committed Nov 7, 2024
1 parent 8611dad commit 2debf16
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sequencesender/txbuilder/banana_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package txbuilder

import (
"fmt"
"github.com/0xPolygon/cdk/log"

"github.com/0xPolygon/cdk/etherman"
"github.com/0xPolygon/cdk/sequencesender/seqsendertypes"
Expand Down Expand Up @@ -150,6 +151,7 @@ func (b *BananaSequence) SetLastVirtualBatchNumber(batchNumber uint64) {
}

func calculateMaxL1InfoTreeIndexInsideL2Data(l2data []byte) (uint32, error) {
log.Infof("zjg,l2data len: %v", len(l2data))
batchRawV2, err := state.DecodeBatchV2(l2data)
if err != nil {
return 0, fmt.Errorf("calculateMaxL1InfoTreeIndexInsideL2Data: error decoding batchL2Data, err:%w", err)
Expand All @@ -159,6 +161,7 @@ func calculateMaxL1InfoTreeIndexInsideL2Data(l2data []byte) (uint32, error) {
}
maxIndex := uint32(0)
for _, block := range batchRawV2.Blocks {
log.Infof("zjg,block:%v, IndexL1InfoTree: %v", block.BlockNumber, block.IndexL1InfoTree)
if block.IndexL1InfoTree > maxIndex {
maxIndex = block.IndexL1InfoTree
}
Expand All @@ -172,6 +175,7 @@ func calculateMaxL1InfoTreeIndexInsideSequence(seq *etherman.SequenceBanana) (ui
}
maxIndex := uint32(0)
for _, batch := range seq.Batches {
log.Infof("zjg,batch:%v, batch index:%v", batch.BatchNumber, batch.L1InfoTreeIndex)
index, err := calculateMaxL1InfoTreeIndexInsideL2Data(batch.L2Data)
if err != nil {
return 0, fmt.Errorf("calculateMaxL1InfoTreeIndexInsideBatches: error getting batch L1InfoTree , err:%w", err)
Expand Down

0 comments on commit 2debf16

Please sign in to comment.