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: improve Gas Fee Estimation by Integrating Filecoin's EIP-1559-Compatible APIs #1182

Merged
merged 7 commits into from
Nov 25, 2024

Conversation

karlem
Copy link
Contributor

@karlem karlem commented Oct 23, 2024

Close #1175
Close #982

This PR updates our gas fee estimation to leverage the eth_maxPriorityFeePerGas and eth_getBlockByNumber (to retrieve the current base_fee_per_gas from the latest mined block) API calls, using Eth-standard APIs available through Filecoin. Since Filecoin supports EIP-1559, these calls are fully compatible with Filecoin's implementation, aligning with standard EVM practices and ensuring interoperability across EVM chains.

Key Changes:

  • The max_priority_fee_per_gas() and base_fee_per_gas() functions retrieve gas fee estimates based on Filecoin's adherence to EIP-1559.
  • Gas fee calculation buffers the base fee with a multiplier of 2 to accommodate potential cumulative increases, aligning with the 12.5% maximum cap on base fee growth per block. By doubling the base fee, we account for possible surges in consecutive blocks, ensuring that estimates remain responsive to rapid market changes while providing a buffer for handling block-to-block volatility.

This approach simplifies our fee estimation logic by utilizing available EIP-1559-compatible APIs, improving chances of capturing better gas market dynamics on specific networks (Filecoin in this case) to increase chance of fast transaction inclusion within a block.

@karlem karlem changed the title feat: use estimation from Alloy feat: align wi Oct 25, 2024
@karlem karlem changed the title feat: align wi feat: align with Filecoin implementation Oct 25, 2024
@karlem karlem changed the title feat: align with Filecoin implementation Improve Gas Fee Estimation by Integrating Filecoin's EIP-1559-Compatible APIs Oct 25, 2024
@karlem karlem changed the title Improve Gas Fee Estimation by Integrating Filecoin's EIP-1559-Compatible APIs fix: improve Gas Fee Estimation by Integrating Filecoin's EIP-1559-Compatible APIs Oct 28, 2024
@karlem karlem marked this pull request as ready for review October 28, 2024 13:22
@karlem karlem requested a review from a team as a code owner October 28, 2024 13:22
@karlem karlem self-assigned this Oct 28, 2024
@karlem karlem merged commit bcc73c9 into main Nov 25, 2024
15 checks passed
@karlem karlem deleted the review-premium-estimate branch November 25, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Review ipc-cli gas parameters ipc relayer uses fixed gas parameters
2 participants