From 42b82a829da2d55c5b684cf169144aecbf2ab885 Mon Sep 17 00:00:00 2001 From: Islam Nofl Date: Thu, 29 Feb 2024 04:20:28 +0200 Subject: [PATCH 1/2] Add `db` and `db_mut` to evm --- crates/revm/src/evm.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/revm/src/evm.rs b/crates/revm/src/evm.rs index 02ea18700a..4c11e3a757 100644 --- a/crates/revm/src/evm.rs +++ b/crates/revm/src/evm.rs @@ -141,6 +141,18 @@ impl Evm<'_, EXT, DB> { &mut self.context.evm.env.tx } + /// Returns the reference of database + #[inline] + pub fn db(&self) -> &DB { + &self.context.evm.db + } + + /// Returns the mutable reference of database + #[inline] + pub fn db_mut(&mut self) -> &mut DB { + &mut self.context.evm.db + } + /// Returns the reference of block #[inline] pub fn block(&self) -> &BlockEnv { From a6517c28d4de75d403693950c25a4a8b727b6845 Mon Sep 17 00:00:00 2001 From: Islam Nofl Date: Thu, 29 Feb 2024 04:29:30 +0200 Subject: [PATCH 2/2] Fix format --- crates/revm/src/evm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/revm/src/evm.rs b/crates/revm/src/evm.rs index 4c11e3a757..bc857ed1f2 100644 --- a/crates/revm/src/evm.rs +++ b/crates/revm/src/evm.rs @@ -146,7 +146,7 @@ impl Evm<'_, EXT, DB> { pub fn db(&self) -> &DB { &self.context.evm.db } - + /// Returns the mutable reference of database #[inline] pub fn db_mut(&mut self) -> &mut DB {