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

feat: add support of eth_estimateGas for L1 transactions #694

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jonesho
Copy link
Contributor

@jonesho jonesho commented Feb 17, 2025

This PR implements issue(s) #3898

Checklist

  • I wrote new tests for my new core changes.
  • I have successfully ran tests, style checker and build against my new changes locally.
  • I have informed the team of any breaking changes if there are any.

@jonesho jonesho self-assigned this Feb 17, 2025
@jonesho jonesho temporarily deployed to docker-build-and-e2e February 17, 2025 12:28 — with GitHub Actions Inactive
@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 52.52525% with 94 lines in your changes missing coverage. Please review.

Project coverage is 68.06%. Comparing base (845dded) to head (3d5be0f).

Files with missing lines Patch % Lines
...nsensys/linea/contract/Web3JContractAsyncHelper.kt 47.97% 58 Missing and 19 partials ⚠️
...ys/linea/contract/l1/LineaRollupEnhancedWrapper.kt 28.57% 5 Missing ⚠️
.../consensys/zkevm/coordinator/app/L1DependentApp.kt 0.00% 4 Missing ⚠️
...ys/zkevm/coordinator/app/BlockchainClientHelper.kt 0.00% 2 Missing ⚠️
...contract/l1/Web3JLineaRollupSmartContractClient.kt 93.54% 2 Missing ⚠️
...kotlin/net/consensys/linea/web3j/Eip4844EthCall.kt 0.00% 1 Missing and 1 partial ⚠️
...ensys/linea/web3j/EthCallWithInformativeReverts.kt 33.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #694      +/-   ##
============================================
- Coverage     68.37%   68.06%   -0.31%     
- Complexity     1197     1207      +10     
============================================
  Files           326      326              
  Lines         13326    13402      +76     
  Branches       1350     1354       +4     
============================================
+ Hits           9111     9122      +11     
- Misses         3658     3719      +61     
- Partials        557      561       +4     
Flag Coverage Δ *Carryforward flag
hardhat 98.52% <ø> (ø) Carriedforward from 4136437
kotlin 65.74% <52.52%> (-0.32%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
.../zkevm/coordinator/app/config/CoordinatorConfig.kt 77.27% <100.00%> (+0.05%) ⬆️
...ys/zkevm/coordinator/app/BlockchainClientHelper.kt 0.00% <0.00%> (ø)
...contract/l1/Web3JLineaRollupSmartContractClient.kt 91.13% <93.54%> (-1.27%) ⬇️
...kotlin/net/consensys/linea/web3j/Eip4844EthCall.kt 74.19% <0.00%> (-5.81%) ⬇️
...ensys/linea/web3j/EthCallWithInformativeReverts.kt 71.42% <33.33%> (+2.19%) ⬆️
.../consensys/zkevm/coordinator/app/L1DependentApp.kt 1.45% <0.00%> (-0.01%) ⬇️
...ys/linea/contract/l1/LineaRollupEnhancedWrapper.kt 58.33% <28.57%> (-19.45%) ⬇️
...nsensys/linea/contract/Web3JContractAsyncHelper.kt 44.81% <47.97%> (-6.92%) ⬇️

... and 1 file with indirect coverage changes

@jonesho jonesho temporarily deployed to docker-build-and-e2e February 17, 2025 13:45 — with GitHub Actions Inactive
@jonesho jonesho marked this pull request as draft February 17, 2025 13:58
@jonesho jonesho temporarily deployed to docker-build-and-e2e February 18, 2025 06:33 — with GitHub Actions Inactive
@jonesho jonesho marked this pull request as ready for review February 18, 2025 19:29
@jonesho jonesho force-pushed the 3898-use-eth_estimategas-for-blob-and-aggregation-submission branch from 1d180a4 to 516b62e Compare February 21, 2025 04:34
@jonesho jonesho temporarily deployed to docker-build-and-e2e February 21, 2025 04:34 — with GitHub Actions Inactive
@jonesho jonesho requested a review from Filter94 February 21, 2025 10:04
@jonesho jonesho force-pushed the 3898-use-eth_estimategas-for-blob-and-aggregation-submission branch from 516b62e to 4136437 Compare February 25, 2025 07:43
@jonesho jonesho temporarily deployed to docker-build-and-e2e February 25, 2025 07:43 — with GitHub Actions Inactive
@jonesho jonesho had a problem deploying to docker-build-and-e2e February 25, 2025 10:19 — with GitHub Actions Failure
@jonesho jonesho temporarily deployed to docker-build-and-e2e February 25, 2025 11:04 — with GitHub Actions Inactive
@jonesho jonesho requested a review from Filter94 February 25, 2025 11:05
contractAddress,
FunctionEncoder.encode(function)
)
return getGasLimit(function)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't quite makes sense because getGasLimit already does what executeEthCall is supposed to do if useEthEstimateGas is enabled

Copy link
Contributor Author

@jonesho jonesho Feb 25, 2025

Choose a reason for hiding this comment

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

Yes, I was thinking the same but indeed it's a bit different, if useEtheEstimateGas is enabled, we would call eth_estimateGas to estimate the gas limit and then explicitly set it as the gas field in the subsequent eth_call to double check against if the "estimated gas limit" is sufficient enough, given that "estimated gas limit" is not a guarantee and could sometimes be insufficient when being used in eth_call or eth_sendRawTransaction

In practice, this mismatch can happen, especially in complex transactions or when dealing with contracts that have unpredictable gas usage. To mitigate this:

  • Test with eth_call: Before relying on the estimate for a real transaction, simulate the call with eth_call using the estimated gas to see if it holds up.

wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It makes sense with a static limit, but when useEtheEstimateGas is set, I don't really see any point in eth_estimateGas -> eth_call -> eth_estimateGas -> eth_sendRawTransaction flow.

@Filter94
Copy link
Collaborator

I think we'll have an issue with blob submissions.

For blob submission the way things work now we'd send 1 eth_estimateGas for the first set of blobs, which would succeed. But if we're sending more than 6 blobs in a single BlobSubmissionCoordinator tick, I think eth_estimateGas would fail for the second sendBlobs transaction. Meaning that essentially BlobSubmissionCoordinator will be restricted to 1 blob submission per tick. That shouldn't disable anything functionally, but I think it may result in some errors in the logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants