From 0c16743cb525c9a194f8c1f3ebcce8302a0969dc Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Thu, 13 Feb 2025 19:22:24 -0500 Subject: [PATCH] chore: better logs in batcher --- op-batcher/batcher/channel.go | 1 + op-batcher/batcher/channel_manager.go | 2 +- op-batcher/batcher/tx_data.go | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/op-batcher/batcher/channel.go b/op-batcher/batcher/channel.go index b65a27e8a803..751110839250 100644 --- a/op-batcher/batcher/channel.go +++ b/op-batcher/batcher/channel.go @@ -65,6 +65,7 @@ func (c *channel) TxFailed(id string, failoverToEthDA bool) { // and is only used while the altDA is down, so we can afford to be inefficient here. // TODO: figure out how to switch to blobs/auto instead. Might need to make // batcherService.initChannelConfig function stateless so that we can reuse it. + c.log.Info("Failing over to calldata txs", "id", c.ID()) c.cfg.DaType = DaTypeCalldata } c.metr.RecordBatchTxFailed() diff --git a/op-batcher/batcher/channel_manager.go b/op-batcher/batcher/channel_manager.go index 38a3d8dcce44..309a4aa77eb2 100644 --- a/op-batcher/batcher/channel_manager.go +++ b/op-batcher/batcher/channel_manager.go @@ -318,7 +318,7 @@ func (s *channelManager) ensureChannelWithSpace(l1Head eth.BlockID) error { "compression_algo", cfg.CompressorConfig.CompressionAlgo, "target_num_frames", cfg.TargetNumFrames, "max_frame_size", cfg.MaxFrameSize, - "da_type", cfg.DaType, + "da_type", cfg.DaType.String(), ) s.metr.RecordChannelOpened(pc.ID(), s.pendingBlocks()) diff --git a/op-batcher/batcher/tx_data.go b/op-batcher/batcher/tx_data.go index 1e38a372e3ff..79783e63f4b4 100644 --- a/op-batcher/batcher/tx_data.go +++ b/op-batcher/batcher/tx_data.go @@ -21,6 +21,19 @@ const ( DaTypeAltDA ) +func (d DaType) String() string { + switch d { + case DaTypeCalldata: + return "calldata" + case DaTypeBlob: + return "blob" + case DaTypeAltDA: + return "alt_da" + default: + return fmt.Sprintf("unknown_da_type_%d", d) + } +} + // txData represents the data for a single transaction. // // Note: The batcher currently sends exactly one frame per transaction. This