Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions op-batcher/batcher/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum-optimism/optimism/op-service/eigenda"
"github.com/ethereum-optimism/optimism/op-service/eth"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof "github.com/ethereum-optimism/optimism/op-service/pprof"
Expand Down Expand Up @@ -188,6 +189,13 @@ func (c CLIConfig) Check() error {
if err := c.EigenDAConfig.Check(); err != nil {
return err
}

//Used to ensure that when using an Ethereum blob, a single frame is not larger than MaxBlobDataSize * MaxblobNum
//Considering that the frame needs to go through rlp. EncodeToBytes before submitting da, the maximum size after encoding cannot be accurately calculated.
//So MaxL1TxSize > MaxBlobDataSize is used here to make a rough judgment
if c.MaxL1TxSize > eth.MaxBlobDataSize {
return errors.New("MaxL1TxSize must less than MaxBlobDataSize")
}
return nil
}

Expand Down
5 changes: 5 additions & 0 deletions op-batcher/batcher/driver_da.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ func (l *BatchSubmitter) blobTxCandidates(data [][]byte) ([]*txmgr.TxCandidate,
}

if len(nextEncodeData) > se.MaxBlobDataSize*MaxblobNum {
if len(encodeData) == 0 {
err := fmt.Errorf("single frame data size %d larger than max blob transaction maximum size", len(nextEncodeData))
l.log.Error("empty encodeData", "err", err)
return nil, err
}
blobs := []*se.Blob{}
for idx := 0; idx < len(encodeData); idx += se.MaxBlobDataSize {
blobData := encodeData[idx : idx+minInt(len(encodeData)-idx, se.MaxBlobDataSize)]
Expand Down