Skip to content

fix: raise DEFAULT_GAS_LIMIT to 1M for Tempo AA transactions#90

Merged
brendanjryan merged 2 commits intomainfrom
fix/aa-gas-limit
Mar 18, 2026
Merged

fix: raise DEFAULT_GAS_LIMIT to 1M for Tempo AA transactions#90
brendanjryan merged 2 commits intomainfrom
fix/aa-gas-limit

Conversation

@brendanjryan
Copy link
Collaborator

@brendanjryan brendanjryan commented Mar 18, 2026

Problem

Payment settlement failing with the following in some mainnet transactions:

Insufficient gas for AA transaction: gas limit 100000 is less than intrinsic gas 271976

Cause

Tempo type-0x76 (AA) transactions have ~270k intrinsic gas for a single TIP-20 transfer. The legacy-style eth_estimateGas call doesn't send the full AA envelope (calls, feeToken, nonceKey, etc.), so estimation always fails and silently falls back to the hardcoded DEFAULT_GAS_LIMIT = 100_000 — which is below intrinsic gas.

Fix

Bump DEFAULT_GAS_LIMIT from 100_000 to 1_000_000, matching the approach used by mpp-rs.

brendanjryan and others added 2 commits March 18, 2026 16:12
Tempo type-0x76 (AA) transactions have ~270k intrinsic gas for a single
TIP-20 transfer, well above the previous 100k default. The legacy-style
eth_estimateGas call doesn't send the full AA envelope, so the estimate
always failed and silently fell back to the 100k hardcode — causing
'Insufficient gas for AA transaction' errors on settlement.

Bump the static limit to 1M, matching the approach used by mpp-rs.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 836b431aca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# Tempo AA (type-0x76) transactions have higher intrinsic gas than legacy txs
# (~270k for a single TIP-20 transfer). A safe static limit avoids the need for
# AA-aware eth_estimateGas calls, matching the approach used by mpp-rs.
DEFAULT_GAS_LIMIT = 1_000_000

Choose a reason for hiding this comment

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

P2 Badge Use 1M gas only as the estimation fallback

Because _build_tempo_transfer() later does gas_limit = max(DEFAULT_GAS_LIMIT, estimated + 5_000), raising DEFAULT_GAS_LIMIT to 1_000_000 makes every Tempo transaction carry a 1M cap, even when eth_estimateGas succeeds with a much smaller AA cost (~270k). For self-paid transfers (fee_token=currency) and fee-payer flows alike, Tempo validates balances against gas_limit * max_fee_per_gas before execution, so accounts that can afford the real gas but not a 1M reserve will now fail with insufficient-funds errors. The larger number should be kept as the fallback when estimation fails, not as the floor for all transactions.

Useful? React with 👍 / 👎.

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.

1 participant