Skip to content

Allow solvers to set custom gas fees in their solution#4299

Merged
squadgazzz merged 5 commits intomainfrom
solver-custom-gas-fees
Mar 31, 2026
Merged

Allow solvers to set custom gas fees in their solution#4299
squadgazzz merged 5 commits intomainfrom
solver-custom-gas-fees

Conversation

@squadgazzz
Copy link
Copy Markdown
Contributor

@squadgazzz squadgazzz commented Mar 27, 2026

Summary

Adds optional maxFeePerGas and maxPriorityFeePerGas fields to the solver Solution response. When provided, these override the driver's default gas price estimation during settlement submission.

Behavior

  • Both fields must be provided together or both absent
  • Solvers can set fees higher or lower than the driver default, since the solver pays from their own balance, so they self-regulate
  • When a replacement transaction is pending (same nonce), the solver's values are raised to at least the replacement minimum (node requirement to accept the replacement)
  • Merged solutions discard gas fee overrides (no meaningful way to merge per-solution gas preferences)

Changes

  • Add max_fee_per_gas and max_priority_fee_per_gas to Solution
  • Add GasFeeOverride type, carry through SolutionSettlement
  • Apply override to final_gas_price before submission

How to test

New e2e test

Related issues

Fixes #4297

Adds optional `maxFeePerGas` and `maxPriorityFeePerGas` fields to the
Solution DTO. When provided, these override the driver's default gas
price estimation during settlement submission.

Both fields must be set together or both absent. When a replacement
transaction is pending, the solver's values are raised to at least
the replacement minimum (node requirement). Otherwise the solver's
values are used as-is, allowing both higher and lower fees than the
driver default.

Closes #4297
@github-actions
Copy link
Copy Markdown

Reminder: Please consider backward compatibility when modifying the API specification.
If breaking changes are unavoidable, ensure:

  • You explicitly pointed out breaking changes.
  • You communicate the changes to affected teams (at least Frontend team and SAFE team).
  • You provide proper versioning and migration mechanisms.

Caused by:

Verifies that a solution with custom maxFeePerGas and
maxPriorityFeePerGas settles successfully end-to-end.
@squadgazzz squadgazzz marked this pull request as ready for review March 27, 2026 19:25
@squadgazzz squadgazzz requested a review from a team as a code owner March 27, 2026 19:25
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the ability for solvers to provide optional gas fee overrides (max_fee_per_gas and max_priority_fee_per_gas) for settlement transactions. These overrides are integrated into the Solution domain model, DTOs, and the settlement submission logic in Mempools, where they are used to replace driver-side estimations while still respecting replacement transaction bidding requirements. The changes include updates to the OpenAPI specification, internal solver DTOs, and comprehensive test coverage for the new functionality. No critical issues were found in the implementation.

/// Verify that a solution with custom gas fee overrides settles successfully.
#[tokio::test]
#[ignore]
async fn settle_with_gas_fee_override() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be difficult to assert the overrides were actually used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the tx assertions.

@squadgazzz squadgazzz requested review from fafk and jmg-duarte March 30, 2026 11:58
Copy link
Copy Markdown
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@squadgazzz squadgazzz added this pull request to the merge queue Mar 31, 2026
Merged via the queue into main with commit e1ae348 Mar 31, 2026
20 checks passed
@squadgazzz squadgazzz deleted the solver-custom-gas-fees branch March 31, 2026 10:45
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Allow solvers to set a custom gas fees in their solution

3 participants