-
Notifications
You must be signed in to change notification settings - Fork 39
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
base: main
Are you sure you want to change the base?
Conversation
|
||
*tx = TypedTransaction::Eip1559(tx_req); | ||
} else { | ||
return Err(Eip1559GasEstimatorError::failed_to_estimate_gas_not_supported()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just skip the error so that other types of txns can go through so that it's more general. Or the purpose is only supporting EIP1559?
|
||
// Set the gas fees directly on the transaction. | ||
let tx_req = inner | ||
.clone() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need to clone here instead of directly assign?
|
||
// Delegate to the inner middleware for filling remaining transaction fields. | ||
self.inner() | ||
.fill_transaction(tx, block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will the gas be overwritten by inner fill transaction? Will call inner first then overwrite the gas params be safer?
|
||
// Proceed to send the transaction with the inner middleware. | ||
self.inner() | ||
.send_transaction(tx, block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question here, the inner will not overwrite the gas params updated right?
Close #1175
Close #982
This PR updates our gas fee estimation to leverage the
eth_maxPriorityFeePerGas
andeth_getBlockByNumber
(to retrieve the currentbase_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:
max_priority_fee_per_gas()
andbase_fee_per_gas()
functions retrieve gas fee estimates based on Filecoin's adherence to EIP-1559.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.