Trait ContextTr
pub trait ContextTr {
type Block: Block;
type Tx: Transaction;
type Cfg: Cfg;
type Db: Database;
type Journal: JournalTr<Database = Self::Db>;
type Chain;
type Local: LocalContextTr;
Show 18 methods
// Required methods
fn tx(&self) -> &Self::Tx;
fn block(&self) -> &Self::Block;
fn cfg(&self) -> &Self::Cfg;
fn journal(&self) -> &Self::Journal;
fn journal_mut(&mut self) -> &mut Self::Journal;
fn db(&self) -> &Self::Db;
fn db_mut(&mut self) -> &mut Self::Db;
fn chain(&self) -> &Self::Chain;
fn chain_mut(&mut self) -> &mut Self::Chain;
fn local(&self) -> &Self::Local;
fn local_mut(&mut self) -> &mut Self::Local;
fn error(
&mut self,
) -> &mut Result<(), ContextError<<Self::Db as Database>::Error>>;
fn tx_journal_mut(&mut self) -> (&Self::Tx, &mut Self::Journal);
fn tx_local_mut(&mut self) -> (&Self::Tx, &mut Self::Local);
// Provided methods
fn journal_ref(&self) -> &Self::Journal { ... }
fn db_ref(&self) -> &Self::Db { ... }
fn chain_ref(&self) -> &Self::Chain { ... }
fn local_ref(&self) -> &Self::Local { ... }
}
Expand description
Trait that defines the context of the EVM execution.
This trait is used to access the environment and state of the EVM. It is used to access the transaction, block, configuration, database, journal, and chain. It is also used to set the error of the EVM.
All function has a *_mut
variant except the function for ContextTr::tx
and ContextTr::block
.
Required Associated Types§
type Tx: Transaction
type Tx: Transaction
Transaction type
type Chain
type Chain
Chain type
type Local: LocalContextTr
type Local: LocalContextTr
Local context type
Required Methods§
fn journal_mut(&mut self) -> &mut Self::Journal
fn journal_mut(&mut self) -> &mut Self::Journal
Get the journal mutably
fn tx_journal_mut(&mut self) -> (&Self::Tx, &mut Self::Journal)
fn tx_journal_mut(&mut self) -> (&Self::Tx, &mut Self::Journal)
Get the transaction and journal. It is used to efficiently load access list into journal without copying them from transaction.
fn tx_local_mut(&mut self) -> (&Self::Tx, &mut Self::Local)
fn tx_local_mut(&mut self) -> (&Self::Tx, &mut Self::Local)
Get the transaction and local context. It is used to efficiently load initcode into local context without copying them from transaction.
Provided Methods§
fn journal_ref(&self) -> &Self::Journal
fn journal_ref(&self) -> &Self::Journal
Get the journal reference