Skip to content

fix(transaction): improve gas estimation reliability and error handling#5344

Open
gacevicljubisa wants to merge 4 commits intomasterfrom
fix/improve-gas-estimation-and-fallback-handling
Open

fix(transaction): improve gas estimation reliability and error handling#5344
gacevicljubisa wants to merge 4 commits intomasterfrom
fix/improve-gas-estimation-and-fallback-handling

Conversation

@gacevicljubisa
Copy link
Member

@gacevicljubisa gacevicljubisa commented Feb 3, 2026

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

This PR improves gas estimation reliability and introduces a configurable
fallback gas limit for contract transactions.

Gas estimation fix:
Fixes "intrinsic gas too low" errors when MinEstimatedGasLimit was 0 and
gas estimation failed. The fallback ensures transactions can proceed even
when RPC balance checks fail, since actual transaction cost is typically
much lower than the maximum theoretical cost used in estimation.

Configurable --gas-limit-fallback flag:
Adds a new --gas-limit-fallback CLI flag (default: 500,000) to make the
fallback gas limit configurable.

Contract gas limit API refactor:
Refactors contract constructors (postagecontract, staking,
redistribution) to accept an explicit gasLimit uint64 parameter instead
of a setGasLimit bool. This removes the hidden coupling to
transaction.DefaultGasLimit and gives callers direct control over the gas
limit value. The node computes contractGasLimit once based on
TrxDebugMode and passes it to all contract constructors.

The existing Gas-Limit HTTP header already provides per-request override
for API-triggered transactions via sctx.GetGasLimit(ctx).

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@acud acud added this to the v2.8.0 milestone Feb 4, 2026
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