2

So it's often seen in Precompile implementations as a trait bound :

impl<T: LinearCostPrecompile> Precompile for T {

and the trait itself :

pub trait LinearCostPrecompile {
    const BASE: u64;
    const WORD: u64;

    fn execute(
        input: &[u8],
        cost: u64,
    ) -> core::result::Result<(ExitSucceed, Vec<u8>), PrecompileFailure>;
}

Can someone explain the why and what of this trait?

1
  • Putting this as a comment because I'm not that sure about the answer but I think the idea of that trait is to tell that a precompile has a simple (linear) way to calculate its final cost (inside the EVM). Commented Aug 3, 2023 at 12:12

0

Browse other questions tagged or ask your own question.