Skip to content

refactor(evm): drop silent fallbacks in token gas estimation#3698

Merged
TaprootFreak merged 1 commit into
developfrom
refactor/evm-gas-no-fallback
May 16, 2026
Merged

refactor(evm): drop silent fallbacks in token gas estimation#3698
TaprootFreak merged 1 commit into
developfrom
refactor/evm-gas-no-fallback

Conversation

@TaprootFreak
Copy link
Copy Markdown
Collaborator

Summary

Remove two implicit defaults in getTokenGasLimitForContact so that callers always work with a real estimate or see the error explicitly.

Changes

  • amount parameter is now required — the previous amount ?? 1 hid the intent at the call site. getTokenGasLimitForAsset now passes an explicit BigNumber.from(1) documented as fee-estimation sample only.
  • The try/catch returning a hardcoded 100k gas fallback on estimateGas failure is removed. Errors now propagate to the caller. Existing outer error handlers (in EvmStrategy.doPayout, the sell prepare flow, and the Polygon bridge adapter) already log and let the affected flow retry on the next cron pass.

Why

A silent 100k fallback could send a transaction with a gas limit that doesn't reflect the real cost — either over-paying or under-paying. Failing loudly is preferable: the caller knows the estimate is unreliable and can decide what to do (retry, alert, etc.) instead of silently shipping a wrong number.

Test plan

  • CI green (format / type-check / lint / jest)
  • Verify on DEV that a normal token payout still works

Remove two implicit defaults in getTokenGasLimitForContact:

- the amount parameter is now required; the previous `amount ?? 1`
  hid the intent at the call site
- the try/catch returning a hardcoded 100k gas limit on estimateGas
  failure is removed; estimation errors now propagate to the caller
  (existing outer error handlers log and let the affected flow retry
  on the next cron pass)

getTokenGasLimitForAsset passes an explicit 1-wei sample amount,
documented as fee-estimation only.
@TaprootFreak TaprootFreak marked this pull request as ready for review May 12, 2026 15:26
@TaprootFreak TaprootFreak requested a review from davidleomay as a code owner May 12, 2026 15:26
@TaprootFreak TaprootFreak merged commit b222d36 into develop May 16, 2026
7 checks passed
@TaprootFreak TaprootFreak deleted the refactor/evm-gas-no-fallback branch May 16, 2026 19:05
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