From 1ccf47ba06fb813b52f9404312c319671a82031f Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 2 Dec 2024 17:03:34 -0500 Subject: [PATCH] Fix anytrust fallback - Fix anytrust fallback issues - Add `Type()` to dapWritter to differentiate which dapWritter is being used (`celestia` or `anytrust`) - pin contracts branch and nitro testnode branch --- arbnode/batch_poster.go | 7 ++++--- arbnode/node.go | 2 ++ arbstate/daprovider/writer.go | 7 +++++++ contracts | 2 +- das/celestia/types/writer.go | 4 ++++ nitro-testnode | 2 +- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go index 5b6fd41659..a7882af2aa 100644 --- a/arbnode/batch_poster.go +++ b/arbnode/batch_poster.go @@ -1367,15 +1367,16 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error) } // attempt to store data using one of the dapWriters, if it fails and fallbacks are disabled, return a hard error + seqMsg := sequencerMsg for _, writer := range b.dapWriters { - // #nosec G115 - sequencerMsg, err = writer.Store(ctx, sequencerMsg, uint64(time.Now().Add(config.DASRetentionPeriod).Unix()), config.DisableDapFallbackStoreDataOnChain) + log.Info("Attempting to store data with dapWriter", "type", writer.Type()) + sequencerMsg, err = writer.Store(ctx, seqMsg, uint64(time.Now().Add(config.DASRetentionPeriod).Unix()), config.DisableDapFallbackStoreDataOnChain) if err != nil { if config.DisableDapFallbackStoreDataOnChain { log.Error("Error while attempting to post batch and on chain fallback is disabled", "error", err) return false, err } - log.Error("Error when trying to store data with dapWriter", "error", err) + log.Error("Error when trying to store data with dapWriter", "type", writer.Type()) continue } // if we succesffuly posted a batch with a dapWriter, we move on and ignore the rest diff --git a/arbnode/node.go b/arbnode/node.go index 81cfa239c4..92bf586f10 100644 --- a/arbnode/node.go +++ b/arbnode/node.go @@ -733,12 +733,14 @@ func createNodeImpl( nilWriter := false switch strings.ToLower(providerName) { case "anytrust": + log.Info("Adding DapWriter", "type", "anytrust") if daWriter != nil { dapWriters = append(dapWriters, daprovider.NewWriterForDAS(daWriter)) } else { nilWriter = true } case "celestia": + log.Info("Adding DapWriter", "type", "celestia") if celestiaWriter != nil { dapWriters = append(dapWriters, celestiaTypes.NewWriterForCelestia(celestiaWriter)) } else { diff --git a/arbstate/daprovider/writer.go b/arbstate/daprovider/writer.go index a26e53c94d..040d2a1880 100644 --- a/arbstate/daprovider/writer.go +++ b/arbstate/daprovider/writer.go @@ -19,6 +19,9 @@ type Writer interface { timeout uint64, disableFallbackStoreDataOnChain bool, ) ([]byte, error) + + // Identifies a Writer by type + Type() string } // DAProviderWriterForDAS is generally meant to be only used by nitro. @@ -45,3 +48,7 @@ func (d *writerForDAS) Store(ctx context.Context, message []byte, timeout uint64 return Serialize(cert), nil } } + +func (d *writerForDAS) Type() string { + return "anytrust" +} diff --git a/contracts b/contracts index 4f8c65c163..8e5836b8c3 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 4f8c65c163a25296777d30813a10022b1d287b65 +Subproject commit 8e5836b8c39657d27a6c7ef69e658720b34b6fb8 diff --git a/das/celestia/types/writer.go b/das/celestia/types/writer.go index 56f3fd1a4d..bdf547fc83 100644 --- a/das/celestia/types/writer.go +++ b/das/celestia/types/writer.go @@ -24,3 +24,7 @@ func (c *writerForCelestia) Store(ctx context.Context, message []byte, timeout u message = msg return message, nil } + +func (d *writerForCelestia) Type() string { + return "celestia" +} diff --git a/nitro-testnode b/nitro-testnode index df7d16e57c..9cfbe1d4e6 160000 --- a/nitro-testnode +++ b/nitro-testnode @@ -1 +1 @@ -Subproject commit df7d16e57c187dbbe0e48484761be697c81f7d3f +Subproject commit 9cfbe1d4e66c37f3973b35101368ca8140f90353