Skip to content

Upgrade error handler#408

Draft
dimriou wants to merge 2 commits intodevelopfrom
oev-1176_upgrade_handler
Draft

Upgrade error handler#408
dimriou wants to merge 2 commits intodevelopfrom
oev-1176_upgrade_handler

Conversation

@dimriou
Copy link
Copy Markdown
Contributor

@dimriou dimriou commented Apr 2, 2026

This PR upgrades error handler for TXMv2. We no longer throw an error if the handler decides there was no transmission, which results in a better observability. Additionally, if the error handler fails to parse the error, txm will check if the pending nonce increased instead of returning an error, which follows the standard flow.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-evm

⚠️ Breaking Changes (3)

pkg/txm.(*txmMetrics) (1)
  • SetRPCNonce — 🗑️ Removed
pkg/txm.ErrorHandler (1)
  • HandleError — Type changed:
func(
  context.Context, 
  + github.com/smartcontractkit/chainlink-common/pkg/logger.Logger, 
  *github.com/smartcontractkit/chainlink-evm/pkg/txm/types.Transaction, 
  error, 
  TxStore, 
  func(github.com/ethereum/go-ethereum/common.Address, 
  - uint64), 
  - bool
  + uint64)
)
- error
+ (bool, error)
pkg/txm/clientwrappers/dualbroadcast.(*errorHandler) (1)
  • HandleError — Type changed:
func(
  context.Context, 
  + github.com/smartcontractkit/chainlink-common/pkg/logger.Logger, 
  *github.com/smartcontractkit/chainlink-evm/pkg/txm/types.Transaction, 
  error, 
  github.com/smartcontractkit/chainlink-evm/pkg/txm.TxStore, 
  func(github.com/ethereum/go-ethereum/common.Address, 
  - uint64), 
  - bool
  + uint64)
)
- error
+ (bool, error)

📄 View full apidiff report

@dimriou dimriou force-pushed the oev-1176_upgrade_handler branch from cab58c2 to d34d05d Compare April 2, 2026 13:01
txErr error,
txStore txm.TxStore,
setNonce func(common.Address, uint64),
isFromBroadcastMethod bool,
Copy link
Copy Markdown
Contributor

@cll-gg cll-gg Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the unused isFromBroadcastMethod while we're touching this func anyway

txStore txm.TxStore,
setNonce func(common.Address, uint64),
isFromBroadcastMethod bool,
) (noTransmission bool, err error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I somewhat dislike negations in var names, since it will lead to double negations, which can lead to confusion.

Maybe flip it around and use something like transmissionHappened?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me, but the issue with this particular case is that there is guarantee a transmission happened and we can only be sure about the noTransmission. If we flip the name to transmissionHappened or transmissionMayHappened and we check for the inversed result, the reader might assume that the error handler can deterministically returned if a transaction was broadcasted. It feels like noTransmission provides better conviction as to what happened.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, so otherwise it would be transmissionMightHaveHappened, which is not great 😅
Let's leave it like this then. Might be worthwhile to add a comment to the code about that we can only be 100% sure a transmission has not happened

}
setNonce(tx.FromAddress, *tx.Nonce)
return fmt.Errorf("transaction with txID: %d marked as fatal", tx.ID)
lggr.Infof("transaction with txID: %d marked as fatal", tx.ID)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we log the transactionLifecycleID here?

if hErr != nil {
return hErr
}
if noTransmission {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be helpful to add a debug log here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now the only ErrorHandler we have implemented is the MetaErrorHandler which already logs a message if noTransmission is true, so I think we already get the information from that.

@dimriou dimriou force-pushed the oev-1176_upgrade_handler branch from 5cb2762 to 156bdfc Compare April 8, 2026 14:08
@dimriou dimriou force-pushed the oev-1176_upgrade_handler branch from 156bdfc to 37483bb Compare April 8, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants