core/vm: add read only protection for opcodes#33637
Merged
Merged
Conversation
lightclient
previously approved these changes
Jan 19, 2026
lightclient
left a comment
Member
There was a problem hiding this comment.
Seems nice to have this additional safeguard.
jwasinger
reviewed
Jan 19, 2026
| // it can effectively prevent accessing the states in the following steps | ||
| if contract.Gas < gas { | ||
| return gas, nil | ||
| return 0, ErrOutOfGas |
Contributor
There was a problem hiding this comment.
it's effectively a no-op change, because either way, it will be caught in the interpreter loop. It's fine though, and the comment is nice.
Member
Author
There was a problem hiding this comment.
Yes, two approaches are equivalent. We use error in some other places and it's better to keep them consistent.
jwasinger
approved these changes
Jan 19, 2026
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Jan 23, 2026
19 tasks
AnilChinchawale
pushed a commit
to XinFinOrg/XDPoSChain
that referenced
this pull request
Feb 5, 2026
gballet
pushed a commit
to BZO95/go-ethereum
that referenced
this pull request
May 21, 2026
This PR reverts a part of changes brought by https://github.com/ethereum/go-ethereum/pull/33281/changes Specifically, read-only protection should always be enforced at the opcode level, regardless of whether the check has already been performed during gas metering. It should act as a gatekeeper, otherwise, it is easy to introduce errors by adding new gas measurement logic without consistently applying the read-only protection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR reverts a part of changes brought by https://github.com/ethereum/go-ethereum/pull/33281/changes
Specifically, read-only protection should always be enforced at the opcode level,
regardless of whether the check has already been performed during gas metering.
It should act as a gatekeeper, otherwise, it is easy to introduce errors by adding
new gas measurement logic without consistently applying the read-only protection.