Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

feat(prover): stop retrying when error is vm.ErrExecutionReverted #706

Merged
merged 1 commit into from
Apr 10, 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
7 changes: 6 additions & 1 deletion prover/proof_submitter/transaction/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ func (s *Sender) Send(
}

if receipt.Status != types.ReceiptStatusSuccessful {
log.Error("Failed to submit proof", "txHash", receipt.TxHash)
log.Error(
"Failed to submit proof",
"blockID", proofWithHeader.BlockID,
"tier", proofWithHeader.Tier,
"txHash", receipt.TxHash,
)
metrics.ProverSubmissionRevertedCounter.Inc(1)
return ErrUnretryableSubmission
}
Expand Down
26 changes: 23 additions & 3 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"math/big"
"net/http"
"strings"
"sync"
"time"

Expand All @@ -14,6 +15,7 @@ import (
"github.com/ethereum-optimism/optimism/op-service/txmgr/metrics"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli/v2"

Expand Down Expand Up @@ -286,12 +288,12 @@ func (p *Prover) eventLoop() {
select {
case <-p.ctx.Done():
return
case req := <-p.proofContestCh:
p.withRetry(func() error { return p.contestProofOp(req) })
case proofWithHeader := <-p.proofGenerationCh:
p.withRetry(func() error { return p.submitProofOp(proofWithHeader) })
case req := <-p.proofSubmissionCh:
p.withRetry(func() error { return p.requestProofOp(req.Event, req.Tier) })
case req := <-p.proofContestCh:
p.withRetry(func() error { return p.contestProofOp(req) })
case <-p.proveNotify:
if err := p.proveOp(); err != nil {
log.Error("Prove new blocks error", "error", err)
Expand Down Expand Up @@ -320,7 +322,7 @@ func (p *Prover) Close(ctx context.Context) {
p.wg.Wait()
}

// proveOp iterates through BlockProposed events
// proveOp iterates through BlockProposed events.
func (p *Prover) proveOp() error {
iter, err := eventIterator.NewBlockProposedIterator(p.ctx, &eventIterator.BlockProposedIteratorConfig{
Client: p.rpc.L1,
Expand All @@ -347,6 +349,15 @@ func (p *Prover) contestProofOp(req *proofProducer.ContestRequestBody) error {
req.Meta,
req.Tier,
); err != nil {
if strings.Contains(err.Error(), vm.ErrExecutionReverted.Error()) {
log.Error(
"Proof contest submission reverted",
"blockID", req.BlockID,
"minTier", req.Meta.MinTier,
"error", err,
)
return nil
}
log.Error(
"Request new proof contest error",
"blockID", req.BlockID,
Expand Down Expand Up @@ -385,6 +396,15 @@ func (p *Prover) submitProofOp(proofWithHeader *proofProducer.ProofWithHeader) e
}

if err := submitter.SubmitProof(p.ctx, proofWithHeader); err != nil {
if strings.Contains(err.Error(), vm.ErrExecutionReverted.Error()) {
log.Error(
"Proof submission reverted",
"blockID", proofWithHeader.BlockID,
"minTier", proofWithHeader.Meta.MinTier,
"error", err,
)
return nil
}
log.Error(
"Submit proof error",
"blockID", proofWithHeader.BlockID,
Expand Down
Loading