Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ethers-core): more accurate priority fee defaults #35

Open
wants to merge 4 commits into
base: hyperlane
Choose a base branch
from

Conversation

aroralanuk
Copy link

Motivation

@christianangelopoulos spotted us overpaying priority fees on low-cost chains because of the default minimum of 0.1 gwei.

Looking deeper into this, there's some hardcoded/unnecessary logic that doesn't suit our needs well for transaction submission on EVM chains.

Solution

Idea is to make it estimate closer to that in alloy/metamask:

  • @christianangelopoulos set the EIP1559_FEE_ESTIMATION_DEFAULT_PRIORITY_FEE to 1wei if say the rewards isn't provided (bc 0 may be problematic for some chains)
  • @christianangelopoulos set base_fee as 2 x last block base fee (conservative compared to metamask's 1.25x for fast mode)
  • max_fee is now unconditionally priority_fee + base_fee (to not starve off base_fee)
  • updated the base_fee to always be non-zero
  • remove outlier rejection from median calculation (median is robust to outliers)
  • 1.2x multipler for median priority fee (conservative compared to metamask which used 0.97x even for fast mode)

Tests

Unit

Note: Failing tests are etherscan API-related, not relevant for this PR.

@aroralanuk aroralanuk marked this pull request as ready for review February 18, 2025 14:17
@christianangelopoulos
Copy link

looks good to me — I like the EIP1559_PRIORITY_FEE_MULTIPLIER to ensure deliverability without too much added overhead cost

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