feat(core): add read only protection for opcodes #33637#1984
feat(core): add read only protection for opcodes #33637#1984AnilChinchawale merged 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR reverts a portion of changes introduced in PR #1960 by restoring read-only protection checks at the opcode level for state-modifying operations. The change ensures that read-only validation acts as a defensive gatekeeper, preventing potential bugs from future gas measurement logic modifications that might omit these critical checks.
Changes:
- Restored read-only checks in
opSstore,opCall,opSelfdestruct, andopSelfdestruct6780opcodes - Modified
makeSelfdestructGasFnto returnErrOutOfGasinstead of the gas value when insufficient gas remains
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| core/vm/instructions.go | Re-added read-only protection checks to SSTORE, CALL (when transferring value), SELFDESTRUCT, and SELFDESTRUCT6780 opcodes as defensive programming |
| core/vm/operations_acl.go | Changed error handling in selfdestruct gas function to return ErrOutOfGas immediately when gas is insufficient, preventing state access |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed changes
This PR reverts a part of changes brought by the PR #1960.
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.
Ref: ethereum#33637
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that