Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transaction status function for external components to use #13040

Conversation

amit-momin
Copy link
Contributor

@amit-momin amit-momin commented Apr 29, 2024

Description

  • Adds a new transaction status function that external components or product teams can use to check their transaction's status
  • Adheres to the GetTransactionStatus method outlined in the ChainWriter doc
  • Immediate use case enables CCIP and Automation to determine if a transaction has failed due to ZK overflow so that it is not retried.
  • Intentionally skipped implementing Finalized status to tackle as separate work and discussion

@amit-momin amit-momin force-pushed the BCI-3055-Add-new-TXM-method-to-allow-products-to-query-transaction-status branch from febcf21 to 42c0eb5 Compare April 30, 2024 17:39
@amit-momin amit-momin marked this pull request as ready for review April 30, 2024 18:39
@amit-momin amit-momin requested review from a team as code owners April 30, 2024 18:39

// Provides error classification to external components in a chain agnostic way
// Only exposes the error types that could be set in the transaction error field
type TxError interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would personally think of another way to return status.
Maybe we discuss this in the ChainWriter design?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the ChainWriter discussions, we wouldn't return the status using this interface but I think I would still need it internally to classify errors between the Failed and Fatal state in the common TXM code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although to avoid adding a new file, I don't think there's a reason for this to be in client. I can move this to the common/txmgr/types/tx file instead.

@amit-momin amit-momin force-pushed the BCI-3055-Add-new-TXM-method-to-allow-products-to-query-transaction-status branch from 0d3366f to 607700a Compare May 23, 2024 21:37
@amit-momin amit-momin force-pushed the BCI-3055-Add-new-TXM-method-to-allow-products-to-query-transaction-status branch from 4ee2006 to 3e1c1f5 Compare May 24, 2024 21:19
Base automatically changed from BCI-2941-Implement-auto-purge-stuck-transaction-feature-in-TXM to develop May 27, 2024 15:53
@amit-momin amit-momin requested a review from a team as a code owner May 27, 2024 15:53
@amit-momin amit-momin force-pushed the BCI-3055-Add-new-TXM-method-to-allow-products-to-query-transaction-status branch from 39bef86 to 9f43854 Compare May 28, 2024 17:54

// Naming discrepancy is due to the generic transaction states introduced by ChainWriter
// Errors classified as terminally stuck are considered fatal since the transaction payload should NOT be retried by external callers
func (s *SendError) IsFatal() bool {
Copy link
Collaborator

@dimriou dimriou Jun 17, 2024

Choose a reason for hiding this comment

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

Not sure if this is a good idea. There is already a Fatal method at the top. Adding IsFatal is a bit confusing to me. Shouldn't we aggregate those? If the notion of Failed transactions for the CW includes transactions that can be retried, shouldn't we returned the retryable type there instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there's a distinction between what's fatal/retryable at the TXM level and what's fatal/retryable(failed) at the product level. SendError classifies these errors for the TXM level so something that's classified as retryable here doesn't necessarily require any action from the product side. The only time they need to take action is once the transaction is in a completed state like fatal_error. The CW errors require us to split the reason for fatal_error into two. This is sort of where the confusion is introduced. What's fatal from the product's perspective is ZK overflow (terminally stuck) errors. The rest are considered failed which are classified as fatal in SendError.
I think I'm probably making things confusing here by trying to leverage SendError errors for CW error classification. I considered creating a wrapper but felt it was adding more bloat when we could already idenitfy ZK overflow through it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I could rename this and also update the ErrorClassifier type to make it less confusing. Would you be ok with IsFatalForProducts or I could make it CW specific with IsChainWriterFatal

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm I see the distinction now. I think IsFatalForProducts is a bad name, as we would expose product level information to the underlying component. Same goes for IsChainWriterFatal. Personally, I would just keep the IsTerminallyStuck name, but I think once the txm gets degeneralize, we'll have to change that so it's not a big deal, you can keep it as it.

dimriou
dimriou previously approved these changes Jun 17, 2024
@jmank88 jmank88 added this pull request to the merge queue Jun 19, 2024
Merged via the queue into develop with commit 0ac790b Jun 19, 2024
108 checks passed
@jmank88 jmank88 deleted the BCI-3055-Add-new-TXM-method-to-allow-products-to-query-transaction-status branch June 19, 2024 16:38
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.

6 participants