diff --git a/src/executor/stack/executor.rs b/src/executor/stack/executor.rs index b02d9b05c..c6c42f42a 100644 --- a/src/executor/stack/executor.rs +++ b/src/executor/stack/executor.rs @@ -1582,6 +1582,11 @@ impl<'config, S: StackState<'config>, P: PrecompileSet> PrecompileHandle self.context } + /// Retreive the address of the EOA that originated the transaction. + fn origin(&self) -> H160 { + self.executor.state.origin() + } + /// Is the precompile call is done statically. fn is_static(&self) -> bool { self.is_static @@ -1591,4 +1596,9 @@ impl<'config, S: StackState<'config>, P: PrecompileSet> PrecompileHandle fn gas_limit(&self) -> Option { self.gas_limit } + + /// Check if a given address is a contract being constructed + fn is_contract_being_constructed(&self, address: H160) -> bool { + self.executor.state.created(address) + } } diff --git a/src/executor/stack/precompile.rs b/src/executor/stack/precompile.rs index c59b32752..e2f874131 100644 --- a/src/executor/stack/precompile.rs +++ b/src/executor/stack/precompile.rs @@ -76,11 +76,17 @@ pub trait PrecompileHandle { /// Retreive the context in which the precompile is executed. fn context(&self) -> &Context; + /// Retreive the address of the EOA that originated the transaction. + fn origin(&self) -> H160; + /// Is the precompile call is done statically. fn is_static(&self) -> bool; /// Retreive the gas limit of this call. fn gas_limit(&self) -> Option; + + /// Check if a given address is a contract being constructed + fn is_contract_being_constructed(&self, address: H160) -> bool; } /// A set of precompiles.