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

Piersy/cherrypick goetherum access list gas fix #1873

Closed

Conversation

piersy
Copy link
Contributor

@piersy piersy commented Mar 21, 2022

Description

This cherry picks ethereum/go-ethereum#24515

Which is a change to ensure that the access list is always emptied before applying a new transaction.

EIP-2929 Added the access list as a way to lower the cost of repeated accesses to the same address within the processing of a single transaction.

Prior to this fix certain code paths allowed gas estimation for a transaction to be initiated with a non empty access list. This resulted in gas estimations being lower than they should be, ultimately resulting in the transaction being rejected when an attempt to execute it is made.

Other changes

This change broke some of our code in the mycelo/genesis package where we were previously attempting to revert across multiple transaction boundaries.

There could be other situations in the code where we attempt to revert across multiple transaction boundaries, so before we can confidently merge this pr we will need to analyse these cases to see if they could introduce any problems.

Tested

An explanation of how the changes were tested or an explanation as to why they don't need to be.

Related issues

  • Fixes #[issue number here]

Backwards compatibility

Brief explanation of why these changes are/are not backwards compatible.

@piersy
Copy link
Contributor Author

piersy commented Mar 21, 2022

Coverage from tests in ./e2e_test/... for ./consensus/istanbul/... at commit ddf8ea1

coverage: 51.6% of statements across all listed packages
coverage:  61.4% of statements in consensus/istanbul
coverage:  43.1% of statements in consensus/istanbul/announce
coverage:  56.1% of statements in consensus/istanbul/backend
coverage:   0.0% of statements in consensus/istanbul/backend/backendtest
coverage:  24.3% of statements in consensus/istanbul/backend/internal/replica
coverage:  70.8% of statements in consensus/istanbul/core
coverage:  50.0% of statements in consensus/istanbul/db
coverage:   0.0% of statements in consensus/istanbul/proxy
coverage:  65.0% of statements in consensus/istanbul/uptime
coverage:  51.8% of statements in consensus/istanbul/validator
coverage:  79.2% of statements in consensus/istanbul/validator/random
CommentID: 18d97595a4

karalabe and others added 5 commits March 24, 2022 11:43
Looks like revert is not safe for use across transaction boundaries.
So instead of reverting changes to state we make a copy.
@piersy piersy force-pushed the piersy/cherrypick-goetherum-access-list-gas-fix branch from 6a9a3ec to a9a5cf6 Compare March 24, 2022 11:43
@codecov
Copy link

codecov bot commented Mar 30, 2022

Codecov Report

Merging #1873 (ddf8ea1) into master (5db2af7) will increase coverage by 0.02%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1873      +/-   ##
==========================================
+ Coverage   54.32%   54.35%   +0.02%     
==========================================
  Files         675      675              
  Lines       88959    88959              
==========================================
+ Hits        48330    48355      +25     
+ Misses      36981    36952      -29     
- Partials     3648     3652       +4     
Impacted Files Coverage Δ
core/state/access_list.go 92.45% <0.00%> (ø)
core/state/statedb.go 58.00% <0.00%> (ø)
rlp/raw.go 80.11% <0.00%> (-5.27%) ⬇️
p2p/simulations/mocker.go 37.86% <0.00%> (-2.92%) ⬇️
les/utils/exec_queue.go 89.13% <0.00%> (-2.18%) ⬇️
les/vflux/client/serverpool.go 77.49% <0.00%> (-1.48%) ⬇️
les/odr.go 89.79% <0.00%> (-1.03%) ⬇️
p2p/simulations/http.go 69.56% <0.00%> (-0.55%) ⬇️
eth/protocols/snap/sync.go 72.01% <0.00%> (-0.28%) ⬇️
p2p/discover/v5_udp.go 81.08% <0.00%> (-0.23%) ⬇️
... and 13 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 5db2af7...ddf8ea1. Read the comment docs.

@piersy
Copy link
Contributor Author

piersy commented Nov 21, 2022

The gas estimation problem was addressed in #1900, were currently merged up to v1.10.9 and the fix from upstream is included in 1.10.17 so we'll eventually get the upstream fix when we merge v1.10.17

@piersy piersy closed this Nov 21, 2022
@palango palango deleted the piersy/cherrypick-goetherum-access-list-gas-fix branch January 18, 2023 11:27
@palango palango restored the piersy/cherrypick-goetherum-access-list-gas-fix branch January 18, 2023 11:27
@palango palango deleted the piersy/cherrypick-goetherum-access-list-gas-fix branch January 18, 2023 11:28
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.

3 participants