pub trait LocalContextTr {
// Required methods
fn shared_memory_buffer(&self) -> &Rc<RefCell<Vec<u8>>>;
fn clear(&mut self);
fn set_precompile_error_context(&mut self, _output: String);
fn take_precompile_error_context(&mut self) -> Option<String>;
fn cpsb(&self) -> u64;
fn set_cpsb(&mut self, cpsb: u64);
// Provided method
fn shared_memory_buffer_slice(
&self,
range: Range<usize>,
) -> Option<Ref<'_, [u8]>> { ... }
}Expand description
Local context used for caching initcode from Initcode transactions.
Required Methods§
Interpreter shared memory buffer. A reused memory buffer for calls.
Sourcefn set_precompile_error_context(&mut self, _output: String)
fn set_precompile_error_context(&mut self, _output: String)
Set the error message for a precompile error, if any.
This is used to bubble up precompile error messages when the transaction directly targets a precompile (depth == 1).
Sourcefn take_precompile_error_context(&mut self) -> Option<String>
fn take_precompile_error_context(&mut self) -> Option<String>
Take and clear the precompile error context, if present.
Returns Some(String) if a precompile error message was recorded.
Sourcefn cpsb(&self) -> u64
fn cpsb(&self) -> u64
EIP-8037 cost_per_state_byte cached for the current transaction.
Populated by LocalContextTr::set_cpsb at transaction start so that
the hot-path Host::cpsb is a single field read instead of recomputing
cfg.cpsb().
Provided Methods§
Slice of the shared memory buffer returns None if range is not valid or buffer can’t be borrowed.