Skip to content

Commit

Permalink
Only log gas estimation error for assertion creation/confirmation if …
Browse files Browse the repository at this point in the history
…persistent (#733)
  • Loading branch information
amsanghi authored Feb 26, 2025
1 parent ed22078 commit 996a463
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assertions/confirmation.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (m *Manager) keepTryingAssertionConfirmation(ctx context.Context, assertion
return
}
exceedsMaxMempoolSizeEphemeralErrorHandler := ephemeral.NewEphemeralErrorHandler(10*time.Minute, "posting this transaction will exceed max mempool size", 0)
gasEstimationEphemeralErrorHandler := ephemeral.NewEphemeralErrorHandler(10*time.Minute, "gas estimation errored for tx with hash", 0)
ticker := time.NewTicker(m.times.confInterval)
defer ticker.Stop()
for {
Expand Down Expand Up @@ -98,6 +99,7 @@ func (m *Manager) keepTryingAssertionConfirmation(ctx context.Context, assertion
if !strings.Contains(err.Error(), "PREV_NOT_LATEST_CONFIRMED") {
logLevel := log.Error
logLevel = exceedsMaxMempoolSizeEphemeralErrorHandler.LogLevel(err, logLevel)
logLevel = gasEstimationEphemeralErrorHandler.LogLevel(err, logLevel)

logLevel("Could not confirm assertion", "err", err, "assertionHash", assertionHash.Hash)
errorConfirmingAssertionByTimeCounter.Inc(1)
Expand Down
2 changes: 2 additions & 0 deletions assertions/poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (m *Manager) postAssertionRoutine(ctx context.Context) {
}

exceedsMaxMempoolSizeEphemeralErrorHandler := ephemeral.NewEphemeralErrorHandler(10*time.Minute, "posting this transaction will exceed max mempool size", 0)
gasEstimationEphemeralErrorHandler := ephemeral.NewEphemeralErrorHandler(10*time.Minute, "gas estimation errored for tx with hash", 0)

log.Info("Ready to post")
ticker := time.NewTicker(m.times.postInterval)
Expand All @@ -51,6 +52,7 @@ func (m *Manager) postAssertionRoutine(ctx context.Context) {
default:
logLevel := log.Error
logLevel = exceedsMaxMempoolSizeEphemeralErrorHandler.LogLevel(err, logLevel)
logLevel = gasEstimationEphemeralErrorHandler.LogLevel(err, logLevel)

logLevel("Could not submit latest assertion", "err", err, "validatorName", m.validatorName)
errorPostingAssertionCounter.Inc(1)
Expand Down
2 changes: 2 additions & 0 deletions challenge-manager/chain-watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ func (w *Watcher) confirmAssertionByChallengeWinner(ctx context.Context, edge pr
)

exceedsMaxMempoolSizeEphemeralErrorHandler := ephemeral.NewEphemeralErrorHandler(10*time.Minute, "posting this transaction will exceed max mempool size", 0)
gasEstimationEphemeralErrorHandler := ephemeral.NewEphemeralErrorHandler(10*time.Minute, "gas estimation errored for tx with hash", 0)

// Compute the number of blocks until we reach the assertion's
// deadline for confirmation.
Expand All @@ -903,6 +904,7 @@ func (w *Watcher) confirmAssertionByChallengeWinner(ctx context.Context, edge pr
if err != nil {
logLevel := log.Error
logLevel = exceedsMaxMempoolSizeEphemeralErrorHandler.LogLevel(err, logLevel)
logLevel = gasEstimationEphemeralErrorHandler.LogLevel(err, logLevel)

logLevel("Could not confirm assertion", "err", err, "assertionHash", claimedAssertion)
errorConfirmingAssertionByWinnerCounter.Inc(1)
Expand Down

0 comments on commit 996a463

Please sign in to comment.