Skip to content

Fix: Update TXM gasBump max and error resetting on retries - #481

Merged
FelixFan1992 merged 4 commits into
developfrom
fix/txm-edits
Jul 31, 2026
Merged

Fix: Update TXM gasBump max and error resetting on retries#481
FelixFan1992 merged 4 commits into
developfrom
fix/txm-edits

Conversation

@faisal-chainlink

Copy link
Copy Markdown
Collaborator

Describe your changes

..

Issue ticket number and link

..

Describe highly relevant files or code snippets that are critical in the review

..

Are there other PRs that should be merged first?

..

@faisal-chainlink
faisal-chainlink requested a review from a team as a code owner July 31, 2026 12:55
@github-actions

Copy link
Copy Markdown

👋 faisal-chainlink, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copilot AI left a comment

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.

Pull request overview

This PR updates the Sui transaction manager’s retry behavior around gas bumping by ensuring the bumped gas budget is actually serialized into the rebuilt transaction payload, tightening the gas-bump max behavior, and preventing repeated retry scheduling for the same stored broadcast failure.

Changes:

  • Sync tx.GasBudget with Metadata.GasLimit during UpdateTransactionGas so UpdateBSCPayload rebuilds with the bumped budget.
  • Simplify/adjust GasBump max-budget capping behavior and honor the configured percentage increase value.
  • Acknowledge scheduled retries by clearing BroadcastError, and release reserved gas coins when a gas bump cannot be performed.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
relayer/txm/store.go Synces serialized GasBudget with metadata before rebuilding the BCS payload.
relayer/txm/gas_manager.go Adjusts gas bump computation (configured percent) and max-budget handling; removes math dependency.
relayer/txm/gas_manager_test.go Updates gas bump expectations and adds tests for gas update serialization + invalid inputs.
relayer/txm/confirmer.go Clears BroadcastError when scheduling retries and releases coins on gas-bump failure-at-max.
relayer/txm/confirmer_test.go Adds regression coverage for retry acknowledgment and coin release at max budget.
relayer/client/suierrors/errors.go Removes ErrGasBudgetTooHigh from gas-bump retryable errors with rationale.

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

Comment thread relayer/txm/store.go
Comment on lines +309 to 313
if gasBudget == nil || !gasBudget.IsUint64() {
return fmt.Errorf("invalid gas budget: %v", gasBudget)
}

tx.Metadata.GasLimit = gasBudget
Comment on lines 191 to 194
func (s *SuiGasManager) GasBump(ctx context.Context, tx *SuiTx) (big.Int, error) {
// gas budget should be the minimum value between the transaction and the gas manager config

// The max amount of the gas that the Gas manager will allow
gasManagerMaxGasBudget := big.NewInt(int64(s.maxGasBudget.Uint64()))

// Check if tx.GasBudget exceeds int64 max value to prevent overflow
if tx.GasBudget > math.MaxInt64 {
return *big.NewInt(0), fmt.Errorf("tx.GasBudget %d exceeds maximum int64 value", tx.GasBudget)
}

// the max amount of the gas that the transaction will allow
txGasBudget := big.NewInt(int64(tx.GasBudget))

var maxGasLimit *big.Int

// Determine the maximum gas limit to use for bumping.
// The maximum is the lesser of the transaction's gas budget and the gas manager's configured maximum.
// This ensures we do not exceed either the transaction's intended limit or the system's allowed maximum.
if txGasBudget.Cmp(gasManagerMaxGasBudget) < 0 {
maxGasLimit = txGasBudget
} else {
maxGasLimit = gasManagerMaxGasBudget
}

txGasLimit := tx.Metadata.GasLimit
maxGasLimit := &s.maxGasBudget

Comment on lines 92 to 96
func NewSuiGasManager(lggr logger.Logger, ptbClient client.SuiPTBClient, maxGasBudget big.Int, percentualIncrase int64) *SuiGasManager {
if percentualIncrase == 0 {
if percentualIncrase <= percentualNormalization {
percentualIncrase = gasLimitPercentualIncrease
}

@FelixFan1992
FelixFan1992 merged commit 142c898 into develop Jul 31, 2026
73 of 74 checks passed
@FelixFan1992
FelixFan1992 deleted the fix/txm-edits branch July 31, 2026 19:27
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.

4 participants