PrecompileId

Enum PrecompileId 

Source
pub enum PrecompileId {
Show 19 variants EcRec, Sha256, Ripemd160, Identity, ModExp, Bn254Add, Bn254Mul, Bn254Pairing, Blake2F, KzgPointEvaluation, Bls12G1Add, Bls12G1Msm, Bls12G2Add, Bls12G2Msm, Bls12Pairing, Bls12MapFpToGp1, Bls12MapFp2ToGp2, P256Verify, Custom(Cow<'static, str>),
}
Expand description

Precompile with address and function. Unique precompile identifier.

Variants§

§

EcRec

Elliptic curve digital signature algorithm (ECDSA) public key recovery function.

§

Sha256

SHA2-256 hash function.

§

Ripemd160

RIPEMD-160 hash function.

§

Identity

Identity precompile.

§

ModExp

Arbitrary-precision exponentiation under modulo.

§

Bn254Add

Point addition (ADD) on the elliptic curve ‘alt_bn128’.

§

Bn254Mul

Scalar multiplication (MUL) on the elliptic curve ‘alt_bn128’.

§

Bn254Pairing

Bilinear function on groups on the elliptic curve ‘alt_bn128’.

§

Blake2F

Compression function F used in the BLAKE2 cryptographic hashing algorithm.

§

KzgPointEvaluation

Verify p(z) = y given commitment that corresponds to the polynomial p(x) and a KZG proof. Also verify that the provided commitment matches the provided versioned_hash.

§

Bls12G1Add

Point addition in G1 (curve over base prime field).

§

Bls12G1Msm

Multi-scalar-multiplication (MSM) in G1 (curve over base prime field).

§

Bls12G2Add

Point addition in G2 (curve over quadratic extension of the base prime field).

§

Bls12G2Msm

Multi-scalar-multiplication (MSM) in G2 (curve over quadratic extension of the base prime field).

§

Bls12Pairing

Pairing operations between a set of pairs of (G1, G2) points.

§

Bls12MapFpToGp1

Base field element mapping into the G1 point.

§

Bls12MapFp2ToGp2

Extension field element mapping into the G2 point.

§

P256Verify

ECDSA signature verification over the secp256r1 elliptic curve (also known as P-256 or prime256v1).

§

Custom(Cow<'static, str>)

Custom precompile identifier.

Implementations§

Source§

impl PrecompileId

Source

pub fn custom<I>(id: I) -> Self
where I: Into<Cow<'static, str>>,

Create new custom precompile ID.

Source

pub fn mainnet_address(&self) -> Option<Address>

Returns the mainnet address for the precompile.

Source

pub fn name(&self) -> &str

Returns the name of the precompile as defined in EIP-7910.

Source

pub fn precompile(&self, spec: PrecompileSpecId) -> Option<Precompile>

Returns the precompile function for the given spec.

If case of PrecompileId::Custom it will return None.

For case where precompile was still not introduced in the spec, it will return Some with fork closest to activation.

Trait Implementations§

Source§

impl Clone for PrecompileId

Source§

fn clone(&self) -> PrecompileId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PrecompileId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for PrecompileId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PrecompileId

Source§

fn eq(&self, other: &PrecompileId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for PrecompileId

Source§

impl StructuralPartialEq for PrecompileId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V