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

ODA-03 fix: Optimized failover to ETH DA #50

Merged
merged 2 commits into from
Dec 5, 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
11 changes: 4 additions & 7 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ type BatchPosterConfig struct {
RedisLock redislock.SimpleCfg `koanf:"redis-lock" reload:"hot"`
ExtraBatchGas uint64 `koanf:"extra-batch-gas" reload:"hot"`
Post4844Blobs bool `koanf:"post-4844-blobs" reload:"hot"`
PostEigenDA bool `koanf:"post-eigen-da" reload:"hot"`
IgnoreBlobPrice bool `koanf:"ignore-blob-price" reload:"hot"`
ParentChainWallet genericconf.WalletConfig `koanf:"parent-chain-wallet"`
L1BlockBound string `koanf:"l1-block-bound" reload:"hot"`
Expand Down Expand Up @@ -231,7 +230,6 @@ func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.String(prefix+".gas-refunder-address", DefaultBatchPosterConfig.GasRefunderAddress, "The gas refunder contract address (optional)")
f.Uint64(prefix+".extra-batch-gas", DefaultBatchPosterConfig.ExtraBatchGas, "use this much more gas than estimation says is necessary to post batches")
f.Bool(prefix+".post-4844-blobs", DefaultBatchPosterConfig.Post4844Blobs, "if the parent chain supports 4844 blobs and they're well priced, post EIP-4844 blobs")
f.Bool(prefix+".post-eigen-da", DefaultBatchPosterConfig.PostEigenDA, "Post data to EigenDA")
f.Bool(prefix+".ignore-blob-price", DefaultBatchPosterConfig.IgnoreBlobPrice, "if the parent chain supports 4844 blobs and ignore-blob-price is true, post 4844 blobs even if it's not price efficient")
f.String(prefix+".redis-url", DefaultBatchPosterConfig.RedisUrl, "if non-empty, the Redis URL to store queued transactions in")
f.String(prefix+".l1-block-bound", DefaultBatchPosterConfig.L1BlockBound, "only post messages to batches when they're within the max future block/timestamp as of this L1 block tag (\"safe\", \"finalized\", \"latest\", or \"ignore\" to ignore this check)")
Expand Down Expand Up @@ -263,7 +261,6 @@ var DefaultBatchPosterConfig = BatchPosterConfig{
GasRefunderAddress: "",
ExtraBatchGas: 50_000,
Post4844Blobs: false,
PostEigenDA: false,
IgnoreBlobPrice: false,
DataPoster: dataposter.DefaultDataPosterConfig,
ParentChainWallet: DefaultBatchPosterL1WalletConfig,
Expand Down Expand Up @@ -298,7 +295,6 @@ var TestBatchPosterConfig = BatchPosterConfig{
GasRefunderAddress: "",
ExtraBatchGas: 10_000,
Post4844Blobs: true,
PostEigenDA: false,
IgnoreBlobPrice: false,
DataPoster: dataposter.TestDataPosterConfig,
ParentChainWallet: DefaultBatchPosterL1WalletConfig,
Expand All @@ -323,7 +319,6 @@ var EigenDABatchPosterConfig = BatchPosterConfig{
GasRefunderAddress: "",
ExtraBatchGas: 10_000,
Post4844Blobs: false,
PostEigenDA: true,
IgnoreBlobPrice: false,
DataPoster: dataposter.TestDataPosterConfig,
ParentChainWallet: DefaultBatchPosterL1WalletConfig,
Expand Down Expand Up @@ -1490,17 +1485,19 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error)
// However, this is a rare event and the performance impact is minimal.

log.Error("EigenDA service is unavailable and anytrust is disabled, failing over to ETH DA")
b.eigenDAFailoverToETHDA = true

// // if the batch's size exceeds the native DA max size limit, we must re-encode the batch to accomodate the AnyTrust, calldata, and 4844 size limits
// if the batch's size exceeds the native DA max size limit, we must re-encode the batch to accomodate the AnyTrust, calldata, and 4844 size limits
if (len(sequencerMsg) > b.config().MaxSize && !b.building.use4844) || (len(sequencerMsg) > b.config().Max4844BatchSize && b.building.use4844) {
batchPosterDAFailureCounter.Inc(1)
batchPosterDAFailoverCount.Inc(1)

b.eigenDAFailoverToETHDA = true
b.building = nil
return false, nil
}

b.building.useEigenDA = false
failOver = true
}

if err != nil && !failOver {
Expand Down
5 changes: 3 additions & 2 deletions system_tests/eigenda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestEigenDAProxyBatchPosting(t *testing.T) {
}
}

func TestEigenDAProxyFailOverToETHDA(t *testing.T) {
func TestFailOverFromEigenDAToCallData(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer func() {
cancel()
Expand Down Expand Up @@ -105,6 +105,7 @@ func TestEigenDAProxyFailOverToETHDA(t *testing.T) {
// 2 - Cause EigenDA to fail and ensure that the system falls back to anytrust in the presence of 503 eigenda-proxy errors
builder.L2.ConsensusNode.BatchPoster.SetEigenDAClientMock()
checkBatchPosting(t, ctx, builder.L1.Client, builder.L2.Client, builder.L1Info, builder.L2Info, big.NewInt(2000000000000), l2B.Client)

// 3 - Emulate EigenDA becoming healthy again and ensure that the system starts using it for DA
eigenWriter, _ := eigenda.NewEigenDA(&eigenda.EigenDAConfig{
Enable: true,
Expand All @@ -119,7 +120,7 @@ func TestEigenDAProxyFailOverToETHDA(t *testing.T) {
}
}

func TestEigenDAProxyFailOverToAnyTrust(t *testing.T) {
func TestFailOverFromEigenDAToAnyTrust(t *testing.T) {
initTest(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
Loading