-
Notifications
You must be signed in to change notification settings - Fork 6
Add gas configuration support to SignerLock #77
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
base: develop
Are you sure you want to change the base?
Conversation
Introduce a new GasConfig struct to manage gas fees for L1 transactions, allowing for optional max fee and priority fee settings. Update SignerLock to include gas configuration, with methods for creating instances from environment variables. Modify the send_transaction_request method to apply gas settings when sending transactions. Add unit tests for GasConfig and SignerLock to ensure correct behavior and defaults.
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
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.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
|
My understanding is that gas values are added to the transaction in the The alternative approach would be to create a custom one and inject that into the alloy provider. |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
My understanding was that to customize the gas configuration for a transaction, you must use the TransactionRequest struct. If you set there related fields ( |
Enhance the GasConfig struct's from_env method to return a Result, allowing for error handling when environment variables are invalid. Introduce a new helper function, parse_env_var, to streamline the parsing process and provide detailed error messages. Update tests to cover various scenarios, including valid, partial, and invalid environment variable values.
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
Introduce AdaptiveGasConfig and AdaptiveGasOracle to manage gas pricing based on network conditions. Update SignerLock to support adaptive gas pricing, allowing for dynamic fee adjustments when gas prices exceed a specified threshold. Enhance the gas pricing strategy to include options for static and adaptive configurations, with corresponding methods for creating instances from environment variables. Update tests to validate the new functionality and ensure correct behavior of the adaptive gas pricing logic.
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: image Click to expand |
…-of-bounds access. Add unit tests to verify clamping behavior for various edge cases, including out-of-range and special floating-point values.
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: fs Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
|
Scan Type: image Click to expand |
…g configuration - Changed default value for skip_if_gas_above to match max_gas_price_cap for consistency. - Expanded environment variable checks in GasPricingStrategy to include new gas pricing parameters. - Added unit tests to validate behavior when environment variables for gas pricing are missing or set.
… management features - Added validation to ensure RBF_TIMEOUT_SECONDS is greater than 0. - Introduced helper functions to clamp priority fees to max fees and ensure max fees are greater than or equal to priority fees. - Updated gas price estimation logic to respect new fee management rules. - Implemented RBF bumping logic that respects a maximum gas price cap. - Added unit tests for new fee management functions and RBF bumping behavior.
6526e5c to
1f3da2e
Compare
| } | ||
|
|
||
| // Calculate how many timeout periods have passed | ||
| let periods = elapsed.as_secs() / timeout_duration.as_secs(); |
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.
Bug: Division by zero when fallback_timeout_minutes is zero
The get_timeout_increase_factor method divides elapsed.as_secs() by timeout_duration.as_secs(), which causes a division by zero panic when fallback_timeout_minutes is 0. While from_env() validates this value cannot be zero, AdaptiveGasConfig can be directly constructed with fallback_timeout_minutes: 0, and AdaptiveGasOracle::new(config) accepts it without validation. This triggers when gas is above threshold and the high-gas timer is active.
Additional Locations (1)
| /// Optional threshold above which to skip submission entirely (wei). | ||
| /// If current gas exceeds this, the transaction is not submitted. | ||
| /// Set via `SKIP_IF_GAS_ABOVE` environment variable. | ||
| pub skip_if_gas_above: Option<u128>, |
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.
Bug: Skip-if-gas-above check not integrated into transaction sending
The skip_if_gas_above field documentation states "If current gas exceeds this, the transaction is not submitted", but send_transaction_request never calls should_skip_submission. The method exists as a public helper but isn't integrated into the transaction flow. Users setting the SKIP_IF_GAS_ABOVE environment variable would expect transactions to be automatically skipped when gas is high, but they will be submitted regardless. The default value of 15 gwei makes this particularly impactful on mainnet.
Introduce a new GasConfig struct to manage gas fees for L1 transactions, allowing for optional max fee and priority fee settings:
NOTE: PR coded with cursor.
Note
Adds an adaptive EIP-1559 gas pricing system with env-configurable overrides/caps and RBF retries, integrated into
SignerLock, plus extensive tests and atracingdependency.AdaptiveGasConfig(withfrom_env) supporting overrides (MAX_FEE_PER_GAS,MAX_PRIORITY_FEE_PER_GAS), thresholds, history window, multiplier, percentile, caps (MAX_GAS_PRICE_CAP), skip threshold (SKIP_IF_GAS_ABOVE), and RBF settings.AdaptiveGasOracleto compute EIP-1559 fees viaeth_feeHistory, percentile-based smoothing, timeout escalation, and apply toTransactionRequest; supports confirmation notifications and submission skipping.GasPricingStrategy(Default|Adaptive) with env-driven selection.gas_strategy; new constructors (new_with_adaptive_gas,new_with_strategy) and accessors (gas_strategy,gas_oracle,gas_config).send_transaction_requestto apply oracle-estimated fees, fetch and pin nonce, and run RBF loop with configurable bump and cap enforcement.GasPriceEstimateand percentile helpers.tracingtoutils/signer.Written by Cursor Bugbot for commit 523224d. This will update automatically on new commits. Configure here.