diff --git a/cmd/bot/run.go b/cmd/bot/run.go index 1c4e225..7a1eb5f 100644 --- a/cmd/bot/run.go +++ b/cmd/bot/run.go @@ -103,25 +103,29 @@ func ProcessUnprovenBotDelegatedWithdrawals(ctx context.Context, log log.Logger, for _, unproven := range unprovens { err := processor.ProveWithdrawalTransaction(ctx, &unproven) if err != nil { - if strings.Contains(err.Error(), "OptimismPortal: withdrawal hash has already been proven") { + errStr := err.Error() + if strings.Contains(errStr, "OptimismPortal: withdrawal hash has already been proven") { // The withdrawal has already proven, mark it result := db.Model(&unproven).Update("proven", true) if result.Error != nil { log.Error("failed to update proven l2_contract_events", "error", result.Error) } - } else if strings.Contains(err.Error(), "L2OutputOracle: cannot get output for a block that has not been proposed") { + } else if strings.Contains(errStr, "L2OutputOracle: cannot get output for a block that has not been proposed") { // Since the unproven withdrawals are sorted by the on-chain order, we can break here because we know // that the subsequent of the withdrawals are not ready to be proven yet. return - } else if strings.Contains(err.Error(), "execution reverted") { + } else if strings.Contains(errStr, "execution reverted") { // Proven transaction reverted, mark it with the failure reason - result := db.Model(&unproven).Update("failure_reason", err.Error()) + if len(errStr) >= 255 { + errStr = errStr[len(errStr)-255:] + } + result := db.Model(&unproven).Update("failure_reason", errStr) if result.Error != nil { log.Error("failed to update failure reason of l2_contract_events", "error", result.Error) } } else { // non-revert error, stop processing the subsequent withdrawals - log.Error("ProveWithdrawalTransaction", "non-revert error", err.Error()) + log.Error("ProveWithdrawalTransaction", "non-revert error", errStr) return } }