Skip to content

Conversation

Tofel
Copy link
Contributor

@Tofel Tofel commented Oct 17, 2025

This pull request introduces support for an "auto" priority mode for gas price estimation in the Seth Ethereum client, allowing the RPC node to automatically determine appropriate gas prices and fees. The changes improve flexibility and reliability of transaction fee estimation, clarify configuration validation, and enhance test coverage for new features. Additionally, error handling and logging around gas estimation are improved for better debugging and transparency.

Gas Estimation Logic and Auto Priority Support

  • Added a new Priority_Auto mode to allow the RPC node to auto-estimate gas prices and fees; when selected, all gas price fields are set to nil and the estimation logic defers to the node. [1] [2] [3]
  • Updated the gas estimation logic for both legacy and EIP-1559 transactions to check for auto priority and skip manual calculations when enabled. [1] [2] [3]

Configuration and Validation

  • Enhanced configuration validation to accept auto as a valid priority and prevent incompatible settings, such as gas bumping with auto priority. Improved error messages for invalid combinations.

API and Data Structure Updates

  • Updated GasEstimations and GasSuggestions structs to clarify field usage and ensure correct handling of nil values when auto-estimation is enabled. [1] [2]
  • Refactored the gas statistics API to accept a context, improve error handling, and clarify percentile fields for base fee and tip cap. [1] [2] [3]

Logging and Error Handling

  • Improved logging to indicate when auto-estimation is used and added more detailed error messages for failures in gas estimation and fee history retrieval. [1] [2] [3] [4]

Testing Enhancements

  • Added new tests to verify correct behavior of simulated backend with auto priority and handling of cases with no historical fees.

These changes collectively make gas estimation more robust, configurable, and easier to debug, while providing safer defaults for transaction fee selection.


Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes introduce dynamic and context-aware adjustments to gas price estimations for both legacy and EIP-1559 transactions, optimizing transaction fee calculations based on network conditions and transaction priority. It also enhances the client's ability to work with simulated networks by allowing auto priority for gas price estimations and handling no historical fee data scenarios. Additionally, it ensures the reliability of transactions under varying network conditions by implementing retry mechanisms with adjusted gas prices.

What

  • book/src/libs/seth.md
    • Added explanations on the logic used for gas price estimation for transactions when the priority is not set to auto.
  • seth/client.go
    • Introduced context with timeout for GetSuggestedLegacyFees to handle transaction timeout configurations.
    • Refactored NewClientRaw to utilize the network's transaction timeout setting more effectively.
    • Improved error handling and logging for transaction preparation and RPC health check.
    • Updated gas estimation strategies to accommodate auto priority, enabling automatic gas price estimation by the RPC node.
  • seth/client_builder_test.go
    • Added tests to validate the handling of auto priority for gas price estimations and the behavior in simulated network environments without historical fee data.
  • seth/cmd/seth.go
    • Modified gas statistics output to reflect base fee and tip cap percentiles accurately.
  • seth/config.go
    • Introduced validation to ensure compatibility of gas bumping strategies with auto priority setting.
  • seth/gas.go
    • Enhanced gas estimation logic to support auto priority, enabling RPC node-based gas price estimation.
    • Included additional error checks and context-aware operations to improve the robustness of gas estimation.
  • seth/gas_adjuster.go
    • Implemented a gas bumping strategy that respects the auto priority setting, preventing gas price adjustments when auto priority is selected.
  • seth/gas_test.go
    • Updated unit tests to verify the correct calculation of gas price suggestions with the inclusion of base fee percentiles and support for auto priority.
  • seth/keyfile.go
    • Adjusted the ReturnFunds function to utilize context with timeout for better management of transactions.
  • seth/retry.go
    • Added logic to handle the auto priority setting during transaction retries, ensuring that gas bumping strategies are appropriately applied.
  • seth/seth.toml
    • Updated configuration examples to include auto priority as a valid option for gas price estimation transactions.

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