Skip to content

fix: account for fee payer in gas estimation#3446

Closed
jxom wants to merge 1 commit intomainfrom
fix/fee-payer-gas-estimation
Closed

fix: account for fee payer in gas estimation#3446
jxom wants to merge 1 commit intomainfrom
fix/fee-payer-gas-estimation

Conversation

@jxom
Copy link
Copy Markdown
Member

@jxom jxom commented Apr 3, 2026

Problem

eth_fillTransaction underestimates gas for sponsored (fee payer) transactions by ~8k gas, causing the second transaction to fail with an out-of-gas error.

When viem sends feePayer: true in the request, the node silently ignores it because TempoTransactionRequest has no such field. Gas estimation then assumes fee_payer == caller, missing the cold storage accesses needed to load the actual fee payer's balance and fee token preference (which are at a different address).

Solution

Add a feePayer: Option<bool> hint field to TempoTransactionRequest. When true, set fee_payer to a sentinel address (Address::ZERO) during try_into_tx_env so estimation incurs the correct cold account/storage access costs for the separate fee payer address.

A corresponding viem-side workaround (gas bump in chainConfig.ts) can be removed once this is deployed.

Add fee_payer hint to TempoTransactionRequest so eth_fillTransaction
can account for cold storage accesses when a separate fee payer will
sponsor the transaction.

Amp-Thread-ID: https://ampcode.com/threads/T-019d5130-90ae-75be-8f7d-c311b11c4fba
Co-authored-by: Amp <amp@ampcode.com>
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