Trait PrecompileProvider

pub trait PrecompileProvider<CTX>
where CTX: ContextTr,
{ type Output; // Required methods fn set_spec(&mut self, spec: <<CTX as ContextTr>::Cfg as Cfg>::Spec); fn run( &mut self, context: &mut CTX, 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§

type Output

Required Methods§

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

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

Run the precompile.

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

Get the warm addresses.

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§

§

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

§

type Output = <T as PrecompileProvider<CTX>>::Output

§

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

§

fn run( &mut self, context: &mut CTX, address: &Address, bytes: &Bytes, gas_limit: u64, ) -> Result<Option<<&'a mut T as PrecompileProvider<CTX>>::Output>, PrecompileError>

§

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

§

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

§

impl<CTX> PrecompileProvider<CTX> for OpPrecompiles
where CTX: ContextTr, <CTX as ContextTr>::Cfg: Cfg<Spec = OpSpecId>,

§

type Output = InterpreterResult

§

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

§

fn run( &mut self, context: &mut CTX, address: &Address, bytes: &Bytes, gas_limit: u64, ) -> Result<Option<<OpPrecompiles as PrecompileProvider<CTX>>::Output>, PrecompileError>

§

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

§

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

§

impl<CTX, T> PrecompileProvider<CTX> for Box<T>
where CTX: ContextTr, T: PrecompileProvider<CTX> + ?Sized,

§

type Output = <T as PrecompileProvider<CTX>>::Output

§

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

§

fn run( &mut self, context: &mut CTX, address: &Address, bytes: &Bytes, gas_limit: u64, ) -> Result<Option<<Box<T> as PrecompileProvider<CTX>>::Output>, PrecompileError>

§

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

§

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

Implementors§