Trait evm::executor::stack::PrecompileSet
source · pub trait PrecompileSet {
fn execute(
&self,
handle: &mut impl PrecompileHandle
) -> Option<Result<PrecompileOutput, PrecompileFailure>>;
fn is_precompile(&self, address: H160) -> bool;
}
Expand description
A set of precompiles. Checks of the provided address being in the precompile set should be as cheap as possible since it may be called often.
Required Methods
sourcefn execute(
&self,
handle: &mut impl PrecompileHandle
) -> Option<Result<PrecompileOutput, PrecompileFailure>>
fn execute(
&self,
handle: &mut impl PrecompileHandle
) -> Option<Result<PrecompileOutput, PrecompileFailure>>
Tries to execute a precompile in the precompile set. If the provided address is not a precompile, returns None.
sourcefn is_precompile(&self, address: H160) -> bool
fn is_precompile(&self, address: H160) -> bool
Check if the given address is a precompile. Should only be called to
perform the check while not executing the precompile afterward, since
execute
already performs a check internally.
Implementations on Foreign Types
sourceimpl PrecompileSet for ()
impl PrecompileSet for ()
fn execute(
&self,
_: &mut impl PrecompileHandle
) -> Option<Result<PrecompileOutput, PrecompileFailure>>
fn is_precompile(&self, _: H160) -> bool
sourceimpl PrecompileSet for BTreeMap<H160, PrecompileFn>
impl PrecompileSet for BTreeMap<H160, PrecompileFn>
sourcefn is_precompile(&self, address: H160) -> bool
fn is_precompile(&self, address: H160) -> bool
Check if the given address is a precompile. Should only be called to
perform the check while not executing the precompile afterward, since
execute
already performs a check internally.