Skip to content

[NONEVM-4760] [TXM] Classify "insufficient funds" as fatal in broadcastWithRetry#726

Open
patricios-space wants to merge 22 commits intotxm/fix/check-rpc-health-and-balance-before-transmitfrom
txm/fix/classify-insufficient-funds-as-fatal-error-in-broadcastWithRetry
Open

[NONEVM-4760] [TXM] Classify "insufficient funds" as fatal in broadcastWithRetry#726
patricios-space wants to merge 22 commits intotxm/fix/check-rpc-health-and-balance-before-transmitfrom
txm/fix/classify-insufficient-funds-as-fatal-error-in-broadcastWithRetry

Conversation

@patricios-space
Copy link
Copy Markdown
Collaborator

@patricios-space patricios-space commented Apr 24, 2026

NONEVM-4760

Depends on #721

@patricios-space patricios-space force-pushed the txm/fix/classify-insufficient-funds-as-fatal-error-in-broadcastWithRetry branch from 701ccdb to 2cdcb4a Compare April 24, 2026 12:16
@patricios-space patricios-space requested a review from Copilot April 24, 2026 19:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the TON TxManager to stop retrying broadcasts when the failure indicates insufficient funds/zero balance, and refactors client usage to an interface so callers no longer access wallet/client fields directly.

Changes:

  • Classify a specific “insufficient funds / cannot apply external message …” wallet error as fatal (no retry) in broadcastWithRetry.
  • Introduce SignedAPIClientInterface and migrate TXM/relay/CCIP transmitter call sites to use GetClient() / GetWallet().
  • Expand TXM integration tests to cover “zero balance” and “insufficient balance” scenarios; add a new tracetracking transfer integration test; fix a docs typo.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pkg/txm/txm.go Adds fatal classification for insufficient-funds wallet errors; logs when no outgoing messages; migrates to client interface accessors.
pkg/ton/tracetracking/signed_api_client.go Introduces SignedAPIClientInterface; wraps send failures in WalletTXError; adds GetClient/GetWallet.
pkg/relay/service.go Updates relay Tx sending to use GetWallet() accessor.
pkg/relay/relay.go Updates relay TxManager interface to return SignedAPIClientInterface.
pkg/relay/chain.go Updates lazy client provider to return SignedAPIClientInterface and uses GetClient().
pkg/ccip/ocr/contract_transmitter.go Updates transmitter to use GetWallet() accessor.
integration-tests/txm/txm_test.go Refactors/extends TXM integration tests; adds insufficient-funds coverage and log assertions.
integration-tests/tracetracking/transfer_test.go Adds a new integration test around transfer/fees behavior.
docs/contracts/overview/ccip/offramp/arbitrary-msg.md Fixes “transmiter” → “transmitter” typo in diagram note.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread integration-tests/tracetracking/transfer_test.go Outdated
Comment thread pkg/txm/txm.go Outdated
Comment thread pkg/ton/tracetracking/signed_api_client.go Outdated
Comment thread integration-tests/txm/txm_test.go Outdated
@smartcontractkit smartcontractkit deleted a comment from Copilot AI Apr 24, 2026
@patricios-space patricios-space marked this pull request as ready for review April 25, 2026 02:16
@patricios-space patricios-space requested a review from a team as a code owner April 25, 2026 02:16
@patricios-space patricios-space force-pushed the txm/fix/classify-insufficient-funds-as-fatal-error-in-broadcastWithRetry branch from 24e599b to f9a1cd8 Compare April 27, 2026 13:20
@patricios-space patricios-space changed the base branch from main to txm/fix/check-rpc-health-and-balance-before-transmit April 27, 2026 13:20
@patricios-space patricios-space requested a review from Copilot April 27, 2026 13:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/txm/txm.go
Comment thread pkg/ccip/ocr/contract_transmitter.go
Comment thread pkg/txm/txm.go Outdated
Comment thread integration-tests/txm/txm_test.go Outdated
@patricios-space patricios-space force-pushed the txm/fix/classify-insufficient-funds-as-fatal-error-in-broadcastWithRetry branch from 7bff969 to 1e769fd Compare April 27, 2026 14:57
Comment thread pkg/txm/txm.go Outdated
GetWallet() *wallet.Wallet
}

var _ SignedAPIClientInterface = (*SignedAPIClient)(nil)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I can see you're trying to avoid duplication but adding interface suffix seems redundant

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I know, I haven't think of a better name yet. I could hide the struct as private, but tracetracking.SignedAPIClient has 43 uses in integration-tests and pkg has 10. I wanted to keep this fix contained instead of changing so many files.

Comment thread pkg/txm/txm.go
Comment thread pkg/txm/txm.go Outdated
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.

3 participants