Skip to content

Provide L2 transaction gasLimit to OVM#1008

Closed
tynes wants to merge 28 commits intodevelopfrom
feat/pass-through-gaslimit
Closed

Provide L2 transaction gasLimit to OVM#1008
tynes wants to merge 28 commits intodevelopfrom
feat/pass-through-gaslimit

Conversation

@tynes
Copy link
Copy Markdown
Contributor

@tynes tynes commented Jun 2, 2021

Description
Allows the L2 gas limit to be specified instead of passing in the block gas limit for the transaction. Not 100% sure of the best approach, we should specify this codepath into the most minimal changes required to function.

Inside of toExecutionManagerRun, the geth types.Message is converted into a new types.Message where its data is serialized into the form that ExecutionManager.run accepts. This means that the fields are packed into the calldata, see the call to abi.Pack. The call to modMessage is updated such that it now accepts the decoded L2 Gas Limit. This should make it so that this is the gas limit passed through to the EVM execution. Previously the max gas limit was always passed through to the execution and the fee was only being paid for tx.gasPrice * tx.gasLimit so a malicious contract could use way more gas than a user pays for.

A dependency of this working is adding the additional gas used to the return value of eth_call - since eth_call goes through ExecutionManager.simulateMessage, it skips the gas used in the previous call frames. We propose to implement a function in Go that accepts the calldata and returns the extra gas used to add to the result of legacyDoEstimateGas

Metadata

Fixes OP-694

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jun 2, 2021

🦋 Changeset detected

Latest commit: 5e8d8df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@eth-optimism/integration-tests Patch
@eth-optimism/l2geth Patch
@eth-optimism/contracts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tynes tynes changed the title feat/pass through gaslimit feat: pass through gaslimit Jun 2, 2021
@tynes tynes requested a review from karlfloersch June 2, 2021 20:53
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 2, 2021

Codecov Report

Merging #1008 (5e8d8df) into regenesis/0.4.0 (ef0df81) will decrease coverage by 0.10%.
The diff coverage is 77.77%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           regenesis/0.4.0    #1008      +/-   ##
===================================================
- Coverage            86.37%   86.26%   -0.11%     
===================================================
  Files                   48       49       +1     
  Lines                 1923     1937      +14     
  Branches               304      305       +1     
===================================================
+ Hits                  1661     1671      +10     
- Misses                 262      266       +4     
Impacted Files Coverage Δ
...ic-ethereum/OVM/execution/OVM_ExecutionManager.sol 74.00% <0.00%> (-0.86%) ⬇️
...hereum/OVM/predeploys/OVM_ECDSAContractAccount.sol 95.45% <100.00%> (+1.01%) ⬆️
...stic-ethereum/libraries/utils/Lib_IntrinsicGas.sol 100.00% <100.00%> (ø)
...libraries/wrappers/Lib_ExecutionManagerWrapper.sol 66.66% <100.00%> (+4.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef0df81...5e8d8df. Read the comment docs.

@tynes
Copy link
Copy Markdown
Contributor Author

tynes commented Jun 2, 2021

The tests are currently failing because transactions are failing - this is expected as the gas limit is being underestimated

@tynes
Copy link
Copy Markdown
Contributor Author

tynes commented Jun 2, 2021

This should be based off of the next regenesis branch

@tynes tynes changed the base branch from develop to regenesis/0.4.0 June 2, 2021 22:24
@tynes tynes force-pushed the feat/pass-through-gaslimit branch from f64d5c3 to 796aada Compare June 2, 2021 22:27
@tynes tynes force-pushed the feat/pass-through-gaslimit branch from 796aada to 02966b6 Compare June 3, 2021 00:07
@tynes

This comment has been minimized.

@snario snario changed the title feat: pass through gaslimit Provide L2 transaction gasLimit to OVM Jun 7, 2021
@tynes tynes marked this pull request as ready for review June 8, 2021 02:22
@ben-chain ben-chain force-pushed the feat/pass-through-gaslimit branch from b85ce16 to 837daa0 Compare June 15, 2021 03:18
@ben-chain ben-chain force-pushed the feat/pass-through-gaslimit branch from 837daa0 to 8bcbc45 Compare June 15, 2021 03:24
@ben-chain ben-chain force-pushed the feat/pass-through-gaslimit branch from 7b669c9 to 5e8d8df Compare June 15, 2021 03:31
@tynes
Copy link
Copy Markdown
Contributor Author

tynes commented Jun 17, 2021

If I understand correctly, this should now be based off of regenesis/0.5.0

@snario snario force-pushed the regenesis/0.4.0 branch from 2bd4973 to db1574a Compare June 18, 2021 16:49
Base automatically changed from regenesis/0.4.0 to develop June 22, 2021 19:48
@ben-chain
Copy link
Copy Markdown
Collaborator

Let's close this out until progress on it picks back up around 0.5.0.

@ben-chain ben-chain closed this Jun 29, 2021
@ben-chain ben-chain deleted the feat/pass-through-gaslimit branch November 4, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-pkg-core-utils Area: packages/core-utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reintroduce a gasLimit in EOA wallet / eth_estimateGas

6 participants