Skip to content

Use different intrinsic-gas for fee-currencies in gas-estimation#356

Merged
gastonponti merged 15 commits intocelo-rebase-12from
gastonponti/fix-gas-estimation-with-fee-currency
Apr 4, 2025
Merged

Use different intrinsic-gas for fee-currencies in gas-estimation#356
gastonponti merged 15 commits intocelo-rebase-12from
gastonponti/fix-gas-estimation-with-fee-currency

Conversation

@gastonponti
Copy link
Copy Markdown

@gastonponti gastonponti commented Apr 1, 2025

Short-circuit for gasEstimation of txs that transfer Celo, with the gas paid with a different feeCurrency
Avoid unnecessary contract calls for rates (every run was calculating it)
Refactor to have the gasestimator self-contained (have the feeCurrency balance calculated inside the gas estimator)

Solves #246

Also:

  • The ethclient function to make a gasEstimation was not adding the feeCurrency, which was returning a smaller gasEstimation due to missing to add the intrinsic gas from that feeCurrency

Copy link
Copy Markdown

@palango palango left a comment

Choose a reason for hiding this comment

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

Changes look good and similar to what's done in celo-blockchain.

A test for this would be nice!

@gastonponti
Copy link
Copy Markdown
Author

gastonponti commented Apr 1, 2025

A test for this would be nice!

I'm trying to understand if there is an easy way to do this without a refactor that will increase the codediff, mostly because we need to mock or set the contracts for erc20 debit and credits
There's no even a test for the gasestimator in geth nor op-geth

@karlb
Copy link
Copy Markdown

karlb commented Apr 2, 2025

Unittests might be hard, but we have fee currencies available in the e2e tests. Maybe you can reproduce the original problem there.

@gastonponti
Copy link
Copy Markdown
Author

Unittests might be hard, but we have fee currencies available in the e2e tests. Maybe you can reproduce the original problem there.

Yes, I thought it was going to be harder with the e2e, but found some examples that are similar and that's my take now. Thanks!

@gastonponti gastonponti changed the title Fix gas estimation with fee currency Use different intrinsic-gas for fee-currencies in gas-estimation Apr 2, 2025
@palango palango requested a review from ezdac April 3, 2025 14:53
Copy link
Copy Markdown

@palango palango left a comment

Choose a reason for hiding this comment

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

Short-circuit for gasEstimation of txs that transfer Celo, with the gas paid with a different feeCurrency
Avoid unnecessary contract calls for rates (every run was calculating it)

For me it looks the other way around

Copy link
Copy Markdown

@palango palango left a comment

Choose a reason for hiding this comment

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

Bugfix with a nice performance improvement 🎉

@gastonponti gastonponti merged commit f695a25 into celo-rebase-12 Apr 4, 2025
8 checks passed
@gastonponti gastonponti deleted the gastonponti/fix-gas-estimation-with-fee-currency branch April 4, 2025 14:37
piersy pushed a commit that referenced this pull request May 6, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
piersy pushed a commit that referenced this pull request May 6, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
piersy pushed a commit that referenced this pull request May 6, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
piersy pushed a commit that referenced this pull request May 8, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
piersy pushed a commit that referenced this pull request May 12, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
piersy pushed a commit that referenced this pull request May 22, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
piersy pushed a commit that referenced this pull request May 22, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 20, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 21, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 26, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 28, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 30, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 30, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 30, 2025
#356)

Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 30, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls

[squash] Use different intrinsic-gas for fee-currencies in gas-estimation (#356)
Kourin1996 pushed a commit that referenced this pull request Jul 31, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 31, 2025
…ion (#356)

Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 31, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 31, 2025
…ion (#356)

Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 31, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Jul 31, 2025
…ion (#356)

Refactor gasestimator. Cleaner and avoid unnecessary contract calls
Kourin1996 pushed a commit that referenced this pull request Aug 1, 2025
Refactor gasestimator. Cleaner and avoid unnecessary contract calls
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.

4 participants