From 5f91e0e4f2788b71f3ea6c814171a0d4532c0918 Mon Sep 17 00:00:00 2001 From: Gavin Yu Date: Mon, 1 Apr 2024 21:31:58 +0800 Subject: [PATCH] fix(prover): do not retry when the status in receipt is not `types.ReceiptStatusSuccessful` (#675) Co-authored-by: David --- internal/metrics/metrics.go | 1 + prover/proof_submitter/transaction/sender.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go index 002b1dc8a..9b82b87a7 100644 --- a/internal/metrics/metrics.go +++ b/internal/metrics/metrics.go @@ -42,6 +42,7 @@ var ( ProverSubmissionErrorCounter = metrics.NewRegisteredCounter("prover/proof/submission/error", nil) ProverSgxProofGeneratedCounter = metrics.NewRegisteredCounter("prover/proof/sgx/generated", nil) ProverPseProofGeneratedCounter = metrics.NewRegisteredCounter("prover/proof/pse/generated", nil) + ProverSubmissionRevertedCounter = metrics.NewRegisteredCounter("prover/proof/submission/reverted", nil) // Transaction sender TxSenderSentCounter = metrics.NewRegisteredCounter("sender/sent/txs", nil) diff --git a/prover/proof_submitter/transaction/sender.go b/prover/proof_submitter/transaction/sender.go index 322496dee..0bf9f4f45 100644 --- a/prover/proof_submitter/transaction/sender.go +++ b/prover/proof_submitter/transaction/sender.go @@ -2,7 +2,6 @@ package transaction import ( "context" - "fmt" "math/big" "strings" @@ -61,7 +60,9 @@ func (s *Sender) Send( } if receipt.Status != types.ReceiptStatusSuccessful { - return fmt.Errorf("failed to submit proof: %s", receipt.TxHash) + log.Error("Failed to submit proof", "txHash", receipt.TxHash) + metrics.ProverSubmissionRevertedCounter.Inc(1) + return ErrUnretryableSubmission } log.Info(