From d76539568b76092d00ebe57158d4d6d7fb6e4594 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 22 Jun 2023 13:13:11 +0200 Subject: [PATCH] Move record_external_operation to StackState trait --- src/backend/mod.rs | 10 +--------- src/executor/stack/executor.rs | 7 +++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 2309c85e6..297f475f7 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -5,7 +5,6 @@ mod memory; pub use self::memory::{MemoryAccount, MemoryBackend, MemoryVicinity}; -use crate::ExitError; use alloc::vec::Vec; use primitive_types::{H160, H256, U256}; /// Basic account information. @@ -49,7 +48,7 @@ pub enum Apply { } /// EVM backend. -//#[auto_impl::auto_impl(&, Arc, Box)] +#[auto_impl::auto_impl(&, Arc, Box)] pub trait Backend { /// Gas price. Unused for London. fn gas_price(&self) -> U256; @@ -84,13 +83,6 @@ pub trait Backend { fn storage(&self, address: H160, index: H256) -> H256; /// Get original storage value of address at index, if available. fn original_storage(&self, address: H160, index: H256) -> Option; - - fn record_external_operation( - &mut self, - _op: crate::ExternalOperation, - ) -> Result<(), ExitError> { - Ok(()) - } } /// EVM backend that can apply changes. diff --git a/src/executor/stack/executor.rs b/src/executor/stack/executor.rs index 856e6fe2b..a2e6e7cc8 100644 --- a/src/executor/stack/executor.rs +++ b/src/executor/stack/executor.rs @@ -230,6 +230,13 @@ pub trait StackState<'config>: Backend { H256::from_slice(Keccak256::digest(self.code(address)).as_slice()) } + fn record_external_operation( + &mut self, + _op: crate::ExternalOperation, + ) -> Result<(), ExitError> { + Ok(()) + } + fn record_external_dynamic_opcode_cost( &mut self, _opcode: Opcode,