Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: larger batches for EigenDA #22

Merged
merged 3 commits into from
Aug 8, 2024
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
12 changes: 10 additions & 2 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ type BatchPosterConfig struct {
MaxSize int `koanf:"max-size" reload:"hot"`
// Maximum 4844 blob enabled batch size.
Max4844BatchSize int `koanf:"max-4844-batch-size" reload:"hot"`
// Maximum EigenDA blob enabled batch size.
MaxEigenDABatchSize int `koanf:"max-eigenda-batch-size" reload:"hot"`
// Max batch post delay.
MaxDelay time.Duration `koanf:"max-delay" reload:"hot"`
// Wait for max BatchPost delay.
Expand Down Expand Up @@ -210,6 +212,7 @@ func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.Bool(prefix+".disable-dap-fallback-store-data-on-chain", DefaultBatchPosterConfig.DisableDapFallbackStoreDataOnChain, "If unable to batch to DA provider, disable fallback storing data on chain")
f.Int(prefix+".max-size", DefaultBatchPosterConfig.MaxSize, "maximum batch size")
f.Int(prefix+".max-4844-batch-size", DefaultBatchPosterConfig.Max4844BatchSize, "maximum 4844 blob enabled batch size")
f.Int(prefix+".max-eigenda-batch-size", DefaultBatchPosterConfig.MaxEigenDABatchSize, "maximum EigenDA blob enabled batch size")
f.Duration(prefix+".max-delay", DefaultBatchPosterConfig.MaxDelay, "maximum batch posting delay")
f.Bool(prefix+".wait-for-max-delay", DefaultBatchPosterConfig.WaitForMaxDelay, "wait for the max batch delay, even if the batch is full")
f.Duration(prefix+".poll-interval", DefaultBatchPosterConfig.PollInterval, "how long to wait after no batches are ready to be posted before checking again")
Expand All @@ -236,6 +239,7 @@ var DefaultBatchPosterConfig = BatchPosterConfig{
DisableDapFallbackStoreDataOnChain: false,
// This default is overridden for L3 chains in applyChainParameters in cmd/nitro/nitro.go
MaxSize: 100000,
MaxEigenDABatchSize: 2_000_000,
// Try to fill 3 blobs per batch
Max4844BatchSize: blobs.BlobEncodableData*(params.MaxBlobGasPerBlock/params.BlobTxBlobGasPerBlob)/2 - 2000,
PollInterval: time.Second * 10,
Expand Down Expand Up @@ -270,6 +274,7 @@ var TestBatchPosterConfig = BatchPosterConfig{
Enable: true,
MaxSize: 100000,
Max4844BatchSize: DefaultBatchPosterConfig.Max4844BatchSize,
MaxEigenDABatchSize: DefaultBatchPosterConfig.MaxEigenDABatchSize,
PollInterval: time.Millisecond * 10,
ErrorDelay: time.Millisecond * 10,
MaxDelay: 0,
Expand All @@ -293,6 +298,7 @@ var EigenDABatchPosterConfig = BatchPosterConfig{
Enable: true,
MaxSize: 100000,
Max4844BatchSize: DefaultBatchPosterConfig.Max4844BatchSize,
MaxEigenDABatchSize: DefaultBatchPosterConfig.MaxEigenDABatchSize,
PollInterval: time.Millisecond * 10,
ErrorDelay: time.Millisecond * 10,
MaxDelay: 0,
Expand Down Expand Up @@ -707,10 +713,12 @@ type buildingBatch struct {
useEigenDA bool
}

func newBatchSegments(firstDelayed uint64, config *BatchPosterConfig, backlog uint64, use4844 bool) *batchSegments {
func newBatchSegments(firstDelayed uint64, config *BatchPosterConfig, backlog uint64, use4844 bool, useEigenDA bool) *batchSegments {
maxSize := config.MaxSize
hopeyen marked this conversation as resolved.
Show resolved Hide resolved
if use4844 {
maxSize = config.Max4844BatchSize
} else if useEigenDA {
maxSize = config.MaxEigenDABatchSize
} else {
if maxSize <= 40 {
panic("Maximum batch size too small")
Expand Down Expand Up @@ -1236,7 +1244,7 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error)
}

b.building = &buildingBatch{
segments: newBatchSegments(batchPosition.DelayedMessageCount, b.config(), b.GetBacklogEstimate(), use4844),
segments: newBatchSegments(batchPosition.DelayedMessageCount, b.config(), b.GetBacklogEstimate(), use4844, useEigenDA),
msgCount: batchPosition.MessageCount,
startMsgCount: batchPosition.MessageCount,
use4844: use4844,
Expand Down
12 changes: 12 additions & 0 deletions cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
"github.com/offchainlabs/nitro/cmd/genericconf"
"github.com/offchainlabs/nitro/cmd/util"
"github.com/offchainlabs/nitro/cmd/util/confighelpers"
"github.com/offchainlabs/nitro/eigenda"
"github.com/offchainlabs/nitro/execution/gethexec"
_ "github.com/offchainlabs/nitro/execution/nodeInterface"
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
Expand Down Expand Up @@ -601,6 +602,17 @@ func mainImpl() int {
return 1
}
}

// NOTE: since the SRS is stored within the arbitrator and predetermines the max batch size
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when needed, we can put more srs up to 2^28

// supported for proving stateless execution - it could be possible to read from dynamically
// otherwise it maybe best to expose the max supported batch size from the disperser directly
// to ensure dynamically adaptability within the rollup.
if nodeConfig.Node.BatchPoster.Enable && nodeConfig.Node.EigenDA.Enable {
if nodeConfig.Node.BatchPoster.MaxEigenDABatchSize > eigenda.MaxBatchSize {
hopeyen marked this conversation as resolved.
Show resolved Hide resolved
log.Error("batchPoster's MaxEigenDABatchSize too large.", "MaxEigenDABatchSize", eigenda.MaxBatchSize)
return 1
}
}
// If sequencer is enabled, validate MaxTxDataSize to be at least 5kB below the batch poster's MaxSize to allow space for headers and such.
// And since batchposter's MaxSize is to be at least 10kB below the sequencer inbox’s maxDataSize, this leads to another condition of atlest 15kB below the sequencer inbox’s maxDataSize.
if nodeConfig.Execution.Sequencer.Enable {
Expand Down
Loading
Loading