Skip to main content

PrecompileProvider

Trait PrecompileProvider 

Source
pub trait PrecompileProvider<CTX: ContextTr> {
    type Output;

    // Required methods
    fn set_spec(&mut self, spec: <CTX::Cfg as Cfg>::Spec) -> bool;
    fn run(
        &mut self,
        context: &mut CTX,
        inputs: &CallInputs,
    ) -> Result<Option<Self::Output>, String>;
    fn warm_addresses(&self) -> &AddressSet;

    // Provided method
    fn contains(&self, address: &Address) -> bool { ... }
}
Expand description

Provider for precompiled contracts in the EVM.

Required Associated Types§

Source

type Output

The output type returned by precompile execution.

Required Methods§

Source

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

Sets the spec id and returns true if the spec id was changed. Initial call to set_spec will always return true.

Returns true if precompile addresses should be injected into the journal.

Source

fn run( &mut self, context: &mut CTX, inputs: &CallInputs, ) -> Result<Option<Self::Output>, String>

Run the precompile.

Source

fn warm_addresses(&self) -> &AddressSet

Get the warm addresses.

Provided Methods§

Source

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

Check if the address is a precompile.

Implementations on Foreign Types§

Source§

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

Source§

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

Source§

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

Source§

fn run( &mut self, context: &mut CTX, inputs: &CallInputs, ) -> Result<Option<Self::Output>, String>

Source§

fn warm_addresses(&self) -> &AddressSet

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn run( &mut self, context: &mut CTX, inputs: &CallInputs, ) -> Result<Option<Self::Output>, String>

Source§

fn warm_addresses(&self) -> &AddressSet

Source§

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

Implementors§