Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit a1b5e6a

Browse files
committed
Update log to debug, add assertion for nil receipt on commit bundle
1 parent e82869c commit a1b5e6a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

miner/algo_common.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,25 @@ func (envDiff *environmentDiff) commitBundle(bundle *types.SimulatedBundle, chDa
311311
isRevertibleTx := bundle.OriginalBundle.RevertingHash(txHash)
312312
// if drop enabled, and revertible tx has error on commit, we skip the transaction and continue with next one
313313
if algoConf.DropRevertibleTxOnErr && isRevertibleTx {
314-
log.Info("Found error on commit for revertible tx, but discard on err is enabled so skipping.",
314+
log.Debug("Found error on commit for revertible tx, but discard on err is enabled so skipping.",
315315
"tx", txHash, "err", err)
316316
continue
317317
}
318318

319319
log.Trace("Bundle tx error", "bundle", bundle.OriginalBundle.Hash, "tx", txHash, "err", err)
320320
return err
321-
} else if receipt != nil && receipt.Status == types.ReceiptStatusFailed {
322-
isRevertibleTx := bundle.OriginalBundle.RevertingHash(txHash)
323-
if !isRevertibleTx {
321+
}
322+
323+
if receipt != nil {
324+
if receipt.Status == types.ReceiptStatusFailed && !bundle.OriginalBundle.RevertingHash(txHash) {
324325
// if transaction reverted and isn't specified as reverting hash, return error
325326
log.Trace("Bundle tx failed", "bundle", bundle.OriginalBundle.Hash, "tx", txHash, "err", err)
326327
return errors.New("bundle tx revert")
327328
}
329+
} else {
330+
// NOTE: The expectation is that a receipt is only nil if an error occurred.
331+
// If there is no error but receipt is nil, there is likely a programming error.
332+
return errors.New("invalid receipt when no error occurred")
328333
}
329334

330335
gasUsed += receipt.GasUsed
@@ -591,7 +596,7 @@ func (envDiff *environmentDiff) commitSBundleInner(
591596
// if drop enabled, and revertible tx has error on commit,
592597
// we skip the transaction and continue with next one
593598
if algoConf.DropRevertibleTxOnErr && el.CanRevert {
594-
log.Info("Found error on commit for revertible tx, but discard on err is enabled so skipping.",
599+
log.Debug("Found error on commit for revertible tx, but discard on err is enabled so skipping.",
595600
"tx", el.Tx.Hash(), "err", err)
596601
continue
597602
}

0 commit comments

Comments
 (0)