Skip to content

feat(fortuna): configurable escalation policy for transactions. #2244

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

Merged
merged 7 commits into from
Jan 13, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 12, 2025

(Jayant: i stole this from devin and did a bunch of work on top, so ignore devin)

This PR adds a configurable escalation policy to fortuna that ramps up both the gas and priority fees on each successive retry. I moved the various escalation control parameters into a struct for tidyness.

I also made a couple of minor changes to other logic that are called out in comments. (some of this is subtle)

Link to Devin run: https://app.devin.ai/sessions/c37cdcd255e449cc97a5423c7b0beaf9

devin-ai-integration bot and others added 3 commits January 12, 2025 16:13
Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz>
…event

Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz>
Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

vercel bot commented Jan 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2025 3:01am
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2025 3:01am
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2025 3:01am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Jan 13, 2025 3:01am
insights ⬜️ Ignored (Inspect) Visit Preview Jan 13, 2025 3:01am

let gas_estimate = gas_estimate.min((gas_limit * DEFAULT_GAS_ESTIMATE_MULTIPLIER_PCT) / 100);
// Apply the configurable cap from backoff_gas_multiplier_cap_pct
let max_gas_estimate = gas_limit.saturating_mul(chain_config.backoff_gas_multiplier_cap_pct.into()) / 100;
let gas_estimate = gas_estimate.min(max_gas_estimate);
Copy link
Contributor

Choose a reason for hiding this comment

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

the correct change is to delete this check and not replace it with another one -- this is a duplicate check now

Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz>
@jayantk jayantk changed the title feat: add backoff_gas_multiplier_cap feat(fortuna): configurable escalation policy for transactions. Jan 13, 2025
# Multiply successive callback transaction's fees by 10% until the cap is reached.
# All numbers are expressed as percentages where 100 = no change.
# (See also priority_fee_multiplier_pct above to generically adjust the priority fee estimates for the chain --
# adjusting that parameter will influence the fee of the first transaction, in addition to other things)
Copy link
Contributor

Choose a reason for hiding this comment

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

note there isn't an initial value here. Instead you adjust the priority_fee_multiplier_pct above. The reason for that is because the other parameter affects all gas estimates for the chain, including the one that is used to determine the keeper's fee

// While we could scale up this value based on the padding, that ends up overcharging users as most transactions cost nowhere
// near the maximum gas limit.
// In the unlikely event that the keeper fees aren't sufficient, the solution to this is to configure the target
// fee percentage to be higher on that specific chain.
Copy link
Contributor

@jayantk jayantk Jan 13, 2025

Choose a reason for hiding this comment

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

reverted the change in the previous PR as it was making the fees aggressively high

@@ -540,7 +546,6 @@ pub async fn process_event(
// Pad the gas estimate after checking it against the simulation gas limit, ensuring that
// the padded gas estimate doesn't exceed the maximum amount of gas we are willing to use.
let gas_estimate = gas_estimate.saturating_mul(gas_estimate_multiplier_pct.into()) / 100;
let gas_estimate = gas_estimate.min((gas_limit * DEFAULT_GAS_ESTIMATE_MULTIPLIER_PCT) / 100);
Copy link
Contributor

Choose a reason for hiding this comment

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

removing the cap on the gas estimate here as it now lives in the escalation policy.

@jayantk jayantk merged commit 3ea2ac7 into main Jan 13, 2025
8 checks passed
@jayantk jayantk deleted the devin/1736698358-cap-backoff-gas branch January 13, 2025 17:14
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.

2 participants