Skip to content
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

fix: aggregator 2x bump in mainnet #1551

Merged

Conversation

MarcosNicolau
Copy link
Collaborator

@MarcosNicolau MarcosNicolau commented Dec 2, 2024

Description

TL;DR

This issue arises because of the mixed use of dynamic transactions and legacy transactions between the simulation and the actual transaction. We fixed it by avoiding the usage of simulation.GasPrice as previousGasPrice in the first iteration as it returns the baseFee * 2 (doubling the gas price).

Detailed explanation

In the simulation, the sendResponseTransaction was executed without a specified tx.GasPrice(). This made sense, as simulations do not require actual gas pricing. When no gasPrice is provided, the library treats the transaction as dynamic.

In a dynamic transaction, the library sets:

  • priorityFee = suggestPriorityFee()
  • maxFee = 2 × BaseFee

This approach is standard practice, as setting maxFee = 2 × baseFee ensures the transaction remains valid for approximately six blocks.

On the first iteration, we were setting PreviousGasPrice to the value of simulation.GasPrice(). However, for dynamic transactions, calling GasPrice() returns the maxFee. In subsequent steps, the code calculates the new transaction’s gas price as the maximum of calculatedGasPrice and previousGasPrice.

Since previousGasPrice was erroneously set to maxFee (2 × BaseFee), the resulting gas price was being doubled.

Why This Didn’t Appear Earlier

The issue went unnoticed in Holesky due to its extremely low base gas cost—four orders of magnitude smaller than typical gas prices. Under such conditions, the 2 × BaseFee did not significantly interfere with calculatedGasPrice.

Type of change

Please delete options that are not relevant.

  • Bug fix

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@MarcosNicolau MarcosNicolau linked an issue Dec 2, 2024 that may be closed by this pull request
Copy link
Collaborator

@Oppen Oppen left a comment

Choose a reason for hiding this comment

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

LGTM

@MarcosNicolau MarcosNicolau changed the title fix: aggregator bump fix: aggregator 2x bump in mainnet Dec 3, 2024
Copy link
Collaborator

@JulianVentura JulianVentura left a comment

Choose a reason for hiding this comment

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

LGTM

@MarcosNicolau MarcosNicolau self-assigned this Dec 3, 2024
@JuArce JuArce merged commit f0af68a into testnet Dec 4, 2024
3 checks passed
@JuArce JuArce deleted the 1540-hotfixaggregator-aggregator-is-bumping-to-much-in-mainnet branch December 4, 2024 14:24
PatStiles pushed a commit that referenced this pull request Dec 6, 2024
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.

hotfix(aggregator): aggregator is bumping to much in mainnet
5 participants