Closed charles-cooper closed 4 months ago
we could also get rid of Message.data_as_bytes()
since it doesn't do anything additional now besides just return the Message.data
bytes object, but it would be a hygiene thing.
$ 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)
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