pub trait Memory {
fn check_write(&self, index: U256) -> Result<(), NotSupportedError>;
fn check_write_range(
&self,
start: U256,
len: U256
) -> Result<(), NotSupportedError>;
fn write(&mut self, index: U256, value: M256) -> Result<(), NotSupportedError>;
fn write_raw(
&mut self,
index: U256,
value: u8
) -> Result<(), NotSupportedError>;
fn read(&self, index: U256) -> M256;
fn read_raw(&self, index: U256) -> u8;
}
Expand description
Represent a memory in EVM. Read should always succeed. Write can fall.
Required Methods
sourcefn check_write(&self, index: U256) -> Result<(), NotSupportedError>
fn check_write(&self, index: U256) -> Result<(), NotSupportedError>
Check whether write on this index would result in an error. If
this function returns Ok, then both write
and write_raw
on
this index should succeed.
sourcefn check_write_range(
&self,
start: U256,
len: U256
) -> Result<(), NotSupportedError>
fn check_write_range(
&self,
start: U256,
len: U256
) -> Result<(), NotSupportedError>
Check whether write on the given index range would result in
an error. If this function returns Ok, then both write
and
write_raw
on the given index range should succeed.
sourcefn write(&mut self, index: U256, value: M256) -> Result<(), NotSupportedError>
fn write(&mut self, index: U256, value: M256) -> Result<(), NotSupportedError>
Write value into the index.