Trait PrecompileProvider

Source
pub trait PrecompileProvider {
    type Context: ContextTr;
    type Output;

    // Required methods
    fn set_spec(
        &mut self,
        spec: <<Self::Context as ContextTr>::Cfg as Cfg>::Spec,
    );
    fn run(
        &mut self,
        context: &mut Self::Context,
        address: &Address,
        bytes: &Bytes,
        gas_limit: u64,
    ) -> Result<Option<Self::Output>, PrecompileError>;
    fn warm_addresses(&self) -> Box<impl Iterator<Item = Address> + '_>;
    fn contains(&self, address: &Address) -> bool;
}

Required Associated Types§

Required Methods§

Source

fn set_spec(&mut self, spec: <<Self::Context as ContextTr>::Cfg as Cfg>::Spec)

Source

fn run( &mut self, context: &mut Self::Context, address: &Address, bytes: &Bytes, gas_limit: u64, ) -> Result<Option<Self::Output>, PrecompileError>

Run the precompile.

Source

fn warm_addresses(&self) -> Box<impl Iterator<Item = Address> + '_>

Get the warm addresses.

Source

fn contains(&self, address: &Address) -> bool

Check if the address is a precompile.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + PrecompileProvider + ?Sized> PrecompileProvider for &'a mut T

Source§

type Context = <T as PrecompileProvider>::Context

Source§

type Output = <T as PrecompileProvider>::Output

Source§

fn set_spec(&mut self, spec: <<Self::Context as ContextTr>::Cfg as Cfg>::Spec)

Source§

fn run( &mut self, context: &mut Self::Context, address: &Address, bytes: &Bytes, gas_limit: u64, ) -> Result<Option<Self::Output>, PrecompileError>

Source§

fn warm_addresses(&self) -> Box<impl Iterator<Item = Address> + '_>

Source§

fn contains(&self, address: &Address) -> bool

Source§

impl<T: PrecompileProvider + ?Sized> PrecompileProvider for Box<T>

Source§

type Context = <T as PrecompileProvider>::Context

Source§

type Output = <T as PrecompileProvider>::Output

Source§

fn set_spec(&mut self, spec: <<Self::Context as ContextTr>::Cfg as Cfg>::Spec)

Source§

fn run( &mut self, context: &mut Self::Context, address: &Address, bytes: &Bytes, gas_limit: u64, ) -> Result<Option<Self::Output>, PrecompileError>

Source§

fn warm_addresses(&self) -> Box<impl Iterator<Item = Address> + '_>

Source§

fn contains(&self, address: &Address) -> bool

Implementors§

Source§

impl<CTX> PrecompileProvider for EthPrecompiles<CTX>
where CTX: ContextTr,

Source§

type Context = CTX

Source§

type Output = InterpreterResult