Skip to main content

Module precompiles

Module precompiles 

Source

Structs§

G1
G2
Precompile
PrecompileCache
Per-block cache for precompile results shared between warmer and executor.
PrecompileMoves
Precompile-dispatch changes requested by a geth State Override Set. Simulation-only: this is None on every consensus path, in which case precompile dispatch is bit-identical to is_precompile.

Constants§

BLAKE2F
BLAKE2F_ELEMENT_SIZE
BLS12_381_G1_MSM_PAIR_LENGTH
BLS12_381_G2_MSM_PAIR_LENGTH
BLS12_381_PAIRING_CHECK_PAIR_LENGTH
BLS12_G1ADD
BLS12_G1MSM
BLS12_G2ADD
BLS12_G2MSM
BLS12_MAP_FP2_TO_G2
BLS12_MAP_FP_TO_G1
BLS12_PAIRING_CHECK
ECADD
ECMUL
ECPAIRING
ECRECOVER
EXECUTE
EXECUTE precompile address (0x0101) for Native Rollups (EIP-8079). Active only on L1 at or above Fork::LStar. The L1-only + LStar gate is enforced in is_precompile (the matches!(vm_type, VMType::L1) check); execute_precompile’s dispatch only re-checks fork >= LStar and relies on is_precompile having already rejected the L2 case at the call site. NOTE: EXECUTE is intentionally NOT in the PRECOMPILES array, so its active_since_fork below is never consulted by precompiles_for_fork — the gating is entirely the hand-written checks above. The field is set for documentation only.
FIELD_ELEMENT_WITHOUT_PADDING_LENGTH
G1_POINT_AT_INFINITY
G2_POINT_AT_INFINITY
IDENTITY
MODEXP
P256VERIFY
PADDED_FIELD_ELEMENT_SIZE_IN_BYTES
POINT_EVALUATION
PRECOMPILES
PRECOMPILE_CACHE_MAX_BYTES
Upper bound on the memory one PrecompileCache may hold. A cache lives for a single block, and a block’s working set sits far below this, so in normal operation no result is ever turned away.
PRECOMPILE_CACHE_MAX_INPUT_BYTES
Largest precompile input that is looked up in, or added to, the PrecompileCache. A lookup hashes and compares the whole input, while a precompile may read only a small part of it (MODEXP with zero lengths reads 96 bytes of any input), so caching a large input would make a cheap call cost time in proportion to its size. Real calls, such as a pairing check over a few pairs or an RSA-sized MODEXP, are far smaller.
RIPEMD_160
SHA2_256
SIZE_PRECOMPILES_CANCUN
SIZE_PRECOMPILES_PRAGUE
SIZE_PRECOMPILES_PRE_CANCUN

Functions§

blake2f
Returns the result of Blake2 hashing algorithm given a certain parameters from the calldata.
bls12_g1add
bls12_g1msm
bls12_g2add
bls12_g2msm
bls12_map_fp2_to_g2
bls12_map_fp_to_g1
bls12_pairing_check
ecadd
Makes a point addition on the elliptic curve ‘alt_bn128’
ecmul
Makes a scalar multiplication on the elliptic curve ‘alt_bn128’
ecpairing
Performs a bilinear pairing on points on the elliptic curve ‘alt_bn128’, returns 1 on success and 0 on failure
ecrecover
ECRECOVER precompile.
effective_precompile_address
The address whose precompile implementation should execute for a call to address. Identity mapping unless address is a relocation destination.
execute_precompile
identity
Returns the calldata received
increase_left_pad
If the result size is less than needed, pads left with zeros.
is_precompile
is_precompile_with_moves
is_precompile, honoring any simulation-only precompile relocations.
modexp
Returns the result of the module-exponentiation operation
p_256_verify
Signature verification in the “secp256r1” elliptic curve If the verification succeeds, returns 1 in a 32-bit big-endian format. If the verification fails, returns an empty Bytes object. Implemented following https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7951.md
precompiles_for_fork
ripemd_160
Returns the calldata hashed by ripemd-160 algorithm, padded by zeros at left
sha2_256
Returns the calldata hashed by sha2-256 algorithm