Skip to content

fix(fortuna): fix too high fees #2532

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 1 commit into from
Mar 28, 2025
Merged

fix(fortuna): fix too high fees #2532

merged 1 commit into from
Mar 28, 2025

Conversation

m30m
Copy link
Collaborator

@m30m m30m commented Mar 28, 2025

Summary

Reject setting the fees too high

Rationale

We estimate priority fees similar to how ethers.rs library does it. This is the general algo:
1- Get the priority fees of the last 10 blocks
2- Sort them
3- Get the median OR if there is any sudden increase, take the median from that index forward (https://github.com/gakonst/ethers-rs/blob/master/ethers-core/src/utils/mod.rs#L590)

Now the way priority fees are calculated for a block is just the average of priority fees for the transactions in that block. So if a block (https://berascan.com/block/2933426) only includes a single tx with very high priority fee, that would be overall priority fee for that block. So what happened for fortuna is we took that priority fee (because of that sudden increase heuristic) and set our fees according to that and that led to a super high fee.
This is what happens once in a while in berachain. When there is not a lot of activity on-chain, it's pretty easy to skew the priority fees.
I think adjusting the algo is a bit futile, I just set some hard caps. Also, in case we exceed that hardcap, we don't even attempt to set it but just try to wait a minute and recalculate again.

Copy link

vercel bot commented Mar 28, 2025

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

6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Mar 28, 2025 4:29pm
component-library ⬜️ Ignored (Inspect) Mar 28, 2025 4:29pm
entropy-debugger ⬜️ Ignored (Inspect) Mar 28, 2025 4:29pm
insights ⬜️ Ignored (Inspect) Mar 28, 2025 4:29pm
proposals ⬜️ Ignored (Inspect) Mar 28, 2025 4:29pm
staking ⬜️ Ignored (Inspect) Mar 28, 2025 4:29pm

@mariobern mariobern self-requested a review March 28, 2025 21:21
@m30m m30m merged commit 05b7928 into main Mar 28, 2025
9 checks passed
@m30m m30m deleted the fortuna-high-fees branch March 28, 2025 22:04
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