feat: txmgr return ErrReverted if confirmed tx reverts#2338
Conversation
🦋 Changeset detectedLatest commit: 6856b21 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report
@@ Coverage Diff @@
## develop #2338 +/- ##
========================================
Coverage 80.14% 80.14%
========================================
Files 77 77
Lines 2458 2458
Branches 450 450
========================================
Hits 1970 1970
Misses 488 488
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
Currently the txmgr treats confirmation of a transaction as successful if it achieves the proper confirmation depth, however it fails to acknowledge the possibility that the transaction reverts. Thus to an external caller the transaction silently succeeds. This commit now inspects the receipt and returns an ErrReverted failure in the event that receipt.Status is not 1. This allows higher level applications to add logging/telemetry or take action on these events.
16d3910 to
6856b21
Compare
| sendTx := func(ctx context.Context, tx *types.Transaction) error { | ||
| if gasPricer.shouldMine(tx.GasFeeCap()) { | ||
| txHash := tx.Hash() | ||
| h.backend.mineWithStatus(&txHash, tx.GasFeeCap(), true) |
There was a problem hiding this comment.
I see here the true is being passed through which will set the reverted status on the receipt and below its asserted that the reverted error is returned after sending the transaction
Fixes #2338 --------- Co-authored-by: Arun Dhyani <dhyaniarun7@gmail.com>
Fixes #2338 --------- Co-authored-by: Arun Dhyani <dhyaniarun7@gmail.com>
Description
Currently the txmgr treats confirmation of a transaction as successful
if it achieves the proper confirmation depth, however it fails to
acknowledge the possibility that the transaction reverts. Thus to an
external caller the transaction silently succeeds.
This commit now inspects the receipt and returns an ErrReverted failure
in the event that receipt.Status is not 1. This allows higher level
applications to add logging/telemetry or take action on these events.
Metadata