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
fix: msg.data mutability #2140
Merged
Merged
fix: msg.data mutability #2140
Conversation
This file contains 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
this commit modifies `msg.data` so that it is an immutable `bytes` copy of the input. the issue is that right now it is a view of memory, which means the caller can trample the msg.data buffer after the call returns (and `msg.data` gets mutated). this is not necessarily a problem for the VM correctness, but it is an issue for integrators that inspect `msg.data` after a call, because `msg.data` will not retain its original value. as a refactor, since `Computation.memory_read()` is completely dead (and more importantly, probably a footgun), this commit also removes `memory_read()` from the `ComputationAPI` interface as well as the `Computation` implementation.
we could also get rid of $ python
Python 3.10.12 (main, Jul 7 2023, 18:23:44) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> s = b"12345"
>>> t = bytes(s)
>>> id(t), id(s)
(139843084676256, 139843084676256) |
fselmo
added a commit
to charles-cooper/py-evm
that referenced
this pull request
Feb 15, 2024
fselmo
force-pushed
the
fix/msg-data-inspection
branch
from
February 15, 2024 18:01
6563113
to
8e0d9a9
Compare
fselmo
approved these changes
Feb 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks 👍🏼
pacrob
pushed a commit
to charles-cooper/py-evm
that referenced
this pull request
Feb 21, 2024
pacrob
added a commit
that referenced
this pull request
Feb 21, 2024
* Fix error in epub docs build, add epub and pdf docs build to CI, delete unused auto-gen docs that appear with `make build-docs` * set up separate validate-docs-ci make command to avoid heavy local latex reqs * Compile release notes for v0.9.0-beta.1 * Bump version: 0.8.0-beta.1 → 0.9.0-beta.1 * fix: msg.data mutability this commit modifies `msg.data` so that it is an immutable `bytes` copy of the input. the issue is that right now it is a view of memory, which means the caller can trample the msg.data buffer after the call returns (and `msg.data` gets mutated). this is not necessarily a problem for the VM correctness, but it is an issue for integrators that inspect `msg.data` after a call, because `msg.data` will not retain its original value. as a refactor, since `Computation.memory_read()` is completely dead (and more importantly, probably a footgun), this commit also removes `memory_read()` from the `ComputationAPI` interface as well as the `Computation` implementation. * newsfragment for #2140 * Establish base feature branch for Cancun network upgrade * Add cancun to tests / helpers * Fix lint issues * Create test run for cancun; silence in circleci for now * Add Cancun network to chain_vm_configuration * Update Cancun header to include new fields - Update ``CancunMiningHeader``, ``CancunBlockHeader`` and ``CancunBlock`` to include the new fields: ``blob_gas_used``, ``excess_blob_gas``, and ``parent_beacon_block_root``. - Inherit from ``ShanghaiBackwardsHeader`` and create a ``CanunBackwardsHeader`` that can serialize all known headers. * newsfragment for #2134 * Get rid of Cancun mining header concept * Implement most of EIP-4788 - considerations: - Should we make sure to update the Cancun state with the contract at BEACON_ROOTS_ADDRESS if it doesn't exist yet since it is vital to this EIP? * newsfragment for #2135 * If no code exists at the BEACON_ROOTS_ADDRESS, make it so. --------- Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com> Co-authored-by: fselmo <fselmo2@gmail.com>
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 commit modifies
msg.data
so that it is an immutablebytes
copy of the input. the issue is that right now it is a view of memory, which means the caller can trample the msg.data buffer after the call returns (andmsg.data
gets mutated). this is not necessarily a problem for the VM correctness, but it is an issue for integrators that inspectmsg.data
after a call, becausemsg.data
will not retain its original value.as a refactor, since
Computation.memory_read()
is completely dead (and more importantly, probably a footgun), this commit also removesmemory_read()
from theComputationAPI
interface as well as theComputation
implementation.What was wrong?
Related to Issue #
Closes #
How was it fixed?
Todo:
Cute Animal Picture