From 5faa6bac6ebeebcf5f4872f815ab37f0b4108ed1 Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Wed, 10 Jul 2024 19:48:28 +0200 Subject: [PATCH 1/2] fix: fixed case when tx hash is empty --- p2p/pkg/preconfirmation/tracker/tracker.go | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/p2p/pkg/preconfirmation/tracker/tracker.go b/p2p/pkg/preconfirmation/tracker/tracker.go index 00fc6ca5f..bddfa3177 100644 --- a/p2p/pkg/preconfirmation/tracker/tracker.go +++ b/p2p/pkg/preconfirmation/tracker/tracker.go @@ -294,7 +294,10 @@ func (t *Tracker) handleNewL1Block( settled := 0 for _, commitment := range commitments { if commitment.CommitmentIndex == nil { - failedCommitments = append(failedCommitments, commitment.TxnHash) + t.logger.Debug("commitment index not found", "commitment", commitment) + if commitment.TxnHash != (common.Hash{}) { + failedCommitments = append(failedCommitments, commitment.TxnHash) + } continue } if common.BytesToAddress(commitment.ProviderAddress).Cmp(newL1Block.Winner) != 0 { @@ -367,20 +370,20 @@ func (t *Tracker) handleNewL1Block( t.metrics.totalOpenedCommitments.Add(float64(settled)) t.metrics.blockCommitmentProcessDuration.Set(float64(openDuration)) - if len(failedCommitments) > 0 { - t.logger.Info("processing failed commitments", "count", len(failedCommitments)) - receipts, err := t.receiptGetter.BatchReceipts(ctx, failedCommitments) - if err != nil { - t.logger.Warn("failed to get receipts for failed commitments", "error", err) - return nil - } - for i, receipt := range receipts { - t.logger.Debug("receipt for failed commitment", - "txHash", failedCommitments[i], - "error", receipt.Err, - ) - } - } + // if len(failedCommitments) > 0 { + // t.logger.Info("processing failed commitments", "count", len(failedCommitments)) + // receipts, err := t.receiptGetter.BatchReceipts(ctx, failedCommitments) + // if err != nil { + // t.logger.Warn("failed to get receipts for failed commitments", "error", err) + // return nil + // } + // for i, receipt := range receipts { + // t.logger.Debug("receipt for failed commitment", + // "txHash", failedCommitments[i], + // "error", receipt.Err, + // ) + // } + // } return nil } From a96dd3625de037029759d7414b369e46c1515251 Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Wed, 10 Jul 2024 19:49:43 +0200 Subject: [PATCH 2/2] fix: uncommented code --- p2p/pkg/preconfirmation/tracker/tracker.go | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/p2p/pkg/preconfirmation/tracker/tracker.go b/p2p/pkg/preconfirmation/tracker/tracker.go index bddfa3177..0c4bf53aa 100644 --- a/p2p/pkg/preconfirmation/tracker/tracker.go +++ b/p2p/pkg/preconfirmation/tracker/tracker.go @@ -370,20 +370,20 @@ func (t *Tracker) handleNewL1Block( t.metrics.totalOpenedCommitments.Add(float64(settled)) t.metrics.blockCommitmentProcessDuration.Set(float64(openDuration)) - // if len(failedCommitments) > 0 { - // t.logger.Info("processing failed commitments", "count", len(failedCommitments)) - // receipts, err := t.receiptGetter.BatchReceipts(ctx, failedCommitments) - // if err != nil { - // t.logger.Warn("failed to get receipts for failed commitments", "error", err) - // return nil - // } - // for i, receipt := range receipts { - // t.logger.Debug("receipt for failed commitment", - // "txHash", failedCommitments[i], - // "error", receipt.Err, - // ) - // } - // } + if len(failedCommitments) > 0 { + t.logger.Info("processing failed commitments", "count", len(failedCommitments)) + receipts, err := t.receiptGetter.BatchReceipts(ctx, failedCommitments) + if err != nil { + t.logger.Warn("failed to get receipts for failed commitments", "error", err) + return nil + } + for i, receipt := range receipts { + t.logger.Debug("receipt for failed commitment", + "txHash", failedCommitments[i], + "error", receipt.Err, + ) + } + } return nil }