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

l2geth: use minimal EIP 2929 #1568

Merged
merged 1 commit into from
Oct 14, 2021
Merged

l2geth: use minimal EIP 2929 #1568

merged 1 commit into from
Oct 14, 2021

Conversation

tynes
Copy link
Contributor

@tynes tynes commented Oct 13, 2021

Description

Use a minimal version of EIP 2929 for state accessing
opcodes. This does not pull in the access list logic
but instead charges based on cold access assumptions
at all times

@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2021

🦋 Changeset detected

Latest commit: ba65c54

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

This PR includes changesets to release 1 package
Name Type
@eth-optimism/l2geth 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

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2021

Codecov Report

Merging #1568 (ba65c54) into experimental (b690575) will decrease coverage by 0.57%.
The diff coverage is 80.00%.

Impacted file tree graph

@@               Coverage Diff                @@
##           experimental    #1568      +/-   ##
================================================
- Coverage         74.20%   73.62%   -0.58%     
================================================
  Files                67       67              
  Lines              2210     2207       -3     
  Branches            321      324       +3     
================================================
- Hits               1640     1625      -15     
- Misses              570      582      +12     
Flag Coverage Δ
batch-submitter 61.74% <ø> (ø)
contracts 90.44% <100.00%> (-0.74%) ⬇️
core-utils 55.73% <28.57%> (-0.77%) ⬇️
data-transport-layer 38.23% <ø> (ø)
message-relayer 83.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/core-utils/src/common/hex-strings.ts 86.11% <28.57%> (-13.89%) ⬇️
.../contracts/L1/messaging/L1CrossDomainMessenger.sol 96.77% <100.00%> (ø)
.../contracts/L1/rollup/CanonicalTransactionChain.sol 85.04% <100.00%> (-2.89%) ⬇️
...acts/contracts/L1/rollup/ChainStorageContainer.sol 70.00% <0.00%> (-10.00%) ⬇️
...contracts/contracts/libraries/utils/Lib_Buffer.sol 92.85% <0.00%> (-7.15%) ⬇️
packages/batch-submitter/hardhat.config.ts 100.00% <0.00%> (ø)
...ages/contracts/contracts/L2/predeploys/OVM_ETH.sol 100.00% <0.00%> (ø)
.../contracts/contracts/standards/L2StandardERC20.sol 100.00% <0.00%> (ø)
...ontracts/contracts/L1/verification/BondManager.sol 100.00% <0.00%> (ø)
... and 25 more

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 92e76f1...ba65c54. Read the comment docs.

l2geth/params/protocol_params.go Show resolved Hide resolved
l2geth/core/vm/eips.go Show resolved Hide resolved
l2geth/core/vm/eips.go Outdated Show resolved Hide resolved
// Use minimal eip2929
if rcfg.UsingOVM {
jt[SLOAD].constantGas = params.WarmStorageReadCostEIP2929
jt[SLOAD].dynamicGas = gasSLoadEIP2929
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't port the selfdestruct changes because I was thinking that they would be out of scope for this set of changes. We could port them as well if you are opinionated, it would require bringing this function into the codebase and removing the accesslist based logic
https://github.com/ethereum/go-ethereum/blob/a5669ae292274d3b0a223cda07ebe64f943bded4/core/vm/operations_acl.go#L229

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ended up porting the self destruct change as well

return params.ColdAccountAccessCostEIP2929 - params.WarmStorageReadCostEIP2929, nil
}

func makeCallVariantGasCallEIP2929(oldCalculator gasFunc) gasFunc {
Copy link
Contributor

Choose a reason for hiding this comment

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

In Geth, this logic is included in vm/operations_acl.go. Might as well create a file with the same name and move this logic there to simplify the future porting process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved functionality to this file

@tynes tynes force-pushed the l2geth/minimal-eip2929 branch 2 times, most recently from 26b205d to b4a045b Compare October 13, 2021 23:00
Copy link
Contributor

@karlfloersch karlfloersch left a comment

Choose a reason for hiding this comment

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

LGTM!

Use a minimal version of EIP 2929 for state accessing
opcodes. This does not pull in the access list logic
but instead charges based on cold access assumptions
at all times
@tynes tynes merged commit d0f7994 into experimental Oct 14, 2021
@tynes tynes deleted the l2geth/minimal-eip2929 branch October 14, 2021 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cannon Area: cannon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants