@tevm/voltaire / primitives/GasConstants / Precompile
Precompile
Variables
blake2f()
Defined in: src/primitives/GasConstants/Precompile.js:285 Convenience alias for BLAKE2F cost calculation Calculate BLAKE2F precompile costconstblake2f: (rounds) =>bigint=calculateBlake2fCost
Parameters
rounds
bigint
Number of compression rounds
Returns
bigint
Gas cost
Param
Number of compression roundsReturns
Gas costBlake2fPerRound
Defined in: src/primitives/GasConstants/Precompile.js:268 BLAKE2F (address 0x09) - Cost per roundconstBlake2fPerRound:1n=1n
Bls12G1Add
Defined in: src/primitives/GasConstants/Precompile.js:310 BLS12_G1ADD (address 0x0b) - Fixed costconstBls12G1Add:500n=500n
Bls12G1MsmBase
Defined in: src/primitives/GasConstants/Precompile.js:322 BLS12_G1MSM (address 0x0d) - Base cost per pointconstBls12G1MsmBase:12000n=12000n
Bls12G1Mul
Defined in: src/primitives/GasConstants/Precompile.js:316 BLS12_G1MUL (address 0x0c) - Fixed costconstBls12G1Mul:12000n=12000n
Bls12G2Add
Defined in: src/primitives/GasConstants/Precompile.js:328 BLS12_G2ADD (address 0x0e) - Fixed costconstBls12G2Add:800n=800n
Bls12G2MsmBase
Defined in: src/primitives/GasConstants/Precompile.js:340 BLS12_G2MSM (address 0x10) - Base cost per pointconstBls12G2MsmBase:45000n=45000n
Bls12G2Mul
Defined in: src/primitives/GasConstants/Precompile.js:334 BLS12_G2MUL (address 0x0f) - Fixed costconstBls12G2Mul:45000n=45000n
Bls12MapFp2ToG2
Defined in: src/primitives/GasConstants/Precompile.js:364 BLS12_MAP_FP2_TO_G2 (address 0x13) - Fixed costconstBls12MapFp2ToG2:75000n=75000n
Bls12MapFpToG1
Defined in: src/primitives/GasConstants/Precompile.js:358 BLS12_MAP_FP_TO_G1 (address 0x12) - Fixed costconstBls12MapFpToG1:5500n=5500n
Bls12PairingBase
Defined in: src/primitives/GasConstants/Precompile.js:346 BLS12_PAIRING (address 0x11) - Base costconstBls12PairingBase:65000n=65000n
Bls12PairingPerPair
Defined in: src/primitives/GasConstants/Precompile.js:352 BLS12_PAIRING - Per-pair costconstBls12PairingPerPair:43000n=43000n
EcAddByzantium
Defined in: src/primitives/GasConstants/Precompile.js:154 BN254 ECADD - Byzantium to BerlinconstEcAddByzantium:500n=500n
EcAddIstanbul
Defined in: src/primitives/GasConstants/Precompile.js:148 BN254 ECADD (address 0x06) - Istanbul onwardsconstEcAddIstanbul:150n=150n
EcMulByzantium
Defined in: src/primitives/GasConstants/Precompile.js:166 BN254 ECMUL - Byzantium to BerlinconstEcMulByzantium:40000n=40000n
EcMulIstanbul
Defined in: src/primitives/GasConstants/Precompile.js:160 BN254 ECMUL (address 0x07) - Istanbul onwardsconstEcMulIstanbul:6000n=6000n
EcPairingBaseByzantium
Defined in: src/primitives/GasConstants/Precompile.js:184 BN254 ECPAIRING - Base cost (Byzantium to Berlin)constEcPairingBaseByzantium:100000n=100000n
EcPairingBaseIstanbul
Defined in: src/primitives/GasConstants/Precompile.js:172 BN254 ECPAIRING (address 0x08) - Base cost (Istanbul onwards)constEcPairingBaseIstanbul:45000n=45000n
EcPairingPerPairByzantium
Defined in: src/primitives/GasConstants/Precompile.js:190 BN254 ECPAIRING - Per-pair cost (Byzantium to Berlin)constEcPairingPerPairByzantium:80000n=80000n
EcPairingPerPairIstanbul
Defined in: src/primitives/GasConstants/Precompile.js:178 BN254 ECPAIRING - Per-pair cost (Istanbul onwards)constEcPairingPerPairIstanbul:34000n=34000n
EcRecover
Defined in: src/primitives/GasConstants/Precompile.js:11 ECRECOVER (address 0x01) - Fixed costconstEcRecover:3000n=3000n
IdentityBase
Defined in: src/primitives/GasConstants/Precompile.js:63 IDENTITY (address 0x04) - Base costconstIdentityBase:15n=15n
IdentityWord
Defined in: src/primitives/GasConstants/Precompile.js:69 IDENTITY - Per-word costconstIdentityWord:3n=3n
ModExpLinearThreshold
Defined in: src/primitives/GasConstants/Precompile.js:98 MODEXP - Linear threshold (1024 bytes)constModExpLinearThreshold:1024n=1024n
ModExpMin
Defined in: src/primitives/GasConstants/Precompile.js:86 MODEXP (address 0x05) - Minimum cost (EIP-2565)constModExpMin:200n=200n
ModExpQuadraticThreshold
Defined in: src/primitives/GasConstants/Precompile.js:92 MODEXP - Quadratic threshold (64 bytes)constModExpQuadraticThreshold:64n=64n
PointEvaluation
Defined in: src/primitives/GasConstants/Precompile.js:291 POINT_EVALUATION (address 0x0a) - Fixed cost (EIP-4844)constPointEvaluation:50000n=50000n
Ripemd160Base
Defined in: src/primitives/GasConstants/Precompile.js:40 RIPEMD160 (address 0x03) - Base costconstRipemd160Base:600n=600n
Ripemd160Word
Defined in: src/primitives/GasConstants/Precompile.js:46 RIPEMD160 - Per-word costconstRipemd160Word:120n=120n
Sha256Base
Defined in: src/primitives/GasConstants/Precompile.js:17 SHA256 (address 0x02) - Base costconstSha256Base:60n=60n
Sha256Word
Defined in: src/primitives/GasConstants/Precompile.js:23 SHA256 - Per-word costconstSha256Word:12n=12n
Functions
calculateBlake2fCost()
calculateBlake2fCost(Defined in: src/primitives/GasConstants/Precompile.js:276 Calculate BLAKE2F precompile costrounds):bigint
Parameters
rounds
bigint
Number of compression rounds
Returns
bigint
Gas cost
calculateBls12G1MsmCost()
calculateBls12G1MsmCost(Defined in: src/primitives/GasConstants/Precompile.js:403 Calculate BLS12_G1MSM precompile costpairCount):bigint
Parameters
pairCount
bigint
Number of point-scalar pairs
Returns
bigint
Gas cost
calculateBls12G2MsmCost()
calculateBls12G2MsmCost(Defined in: src/primitives/GasConstants/Precompile.js:416 Calculate BLS12_G2MSM precompile costpairCount):bigint
Parameters
pairCount
bigint
Number of point-scalar pairs
Returns
bigint
Gas cost
calculateBls12PairingCost()
calculateBls12PairingCost(Defined in: src/primitives/GasConstants/Precompile.js:429 Calculate BLS12_PAIRING precompile costpairCount):bigint
Parameters
pairCount
bigint
Number of G1-G2 pairs
Returns
bigint
Gas cost
calculateEcPairingCost()
calculateEcPairingCost(Defined in: src/primitives/GasConstants/Precompile.js:205 Calculate ECPAIRING precompile costpairCount,hardfork):bigint
Parameters
pairCount
bigint
Number of point pairs
hardfork
Hardfork
EVM hardfork
Returns
bigint
Gas cost
Example
calculateIdentityCost()
calculateIdentityCost(Defined in: src/primitives/GasConstants/Precompile.js:77 Calculate IDENTITY precompile costdataSize):bigint
Parameters
dataSize
bigint
Size of data in bytes
Returns
bigint
Gas cost
calculateModExpCost()
calculateModExpCost(Defined in: src/primitives/GasConstants/Precompile.js:126 Calculate MODEXP precompile costbaseLength,expLength,modLength,expHead):bigint
Parameters
baseLength
bigint
Length of base in bytes
expLength
bigint
Length of exponent in bytes
modLength
bigint
Length of modulus in bytes
expHead
bigint
First 32 bytes of exponent
Returns
bigint
Gas cost
calculatePointEvaluationCost()
calculatePointEvaluationCost(): bigint
Defined in: src/primitives/GasConstants/Precompile.js:298
Calculate POINT_EVALUATION precompile cost
Returns
bigint
Gas cost (fixed at 50000)
calculateRipemd160Cost()
calculateRipemd160Cost(Defined in: src/primitives/GasConstants/Precompile.js:54 Calculate RIPEMD160 precompile costdataSize):bigint
Parameters
dataSize
bigint
Size of data in bytes
Returns
bigint
Gas cost
calculateSha256Cost()
calculateSha256Cost(Defined in: src/primitives/GasConstants/Precompile.js:31 Calculate SHA256 precompile costdataSize):bigint
Parameters
dataSize
bigint
Size of data in bytes
Returns
bigint
Gas cost
ecPairingCost()
ecPairingCost(Defined in: src/primitives/GasConstants/Precompile.js:260 Calculate ECPAIRING precompile cost (convenience form with this:)this):bigint
Parameters
this
hardfork
Hardfork
pairCount
bigint
Returns
bigint
getEcAddCost()
getEcAddCost(Defined in: src/primitives/GasConstants/Precompile.js:226 Get ECADD cost for hardforkhardfork):bigint
Parameters
hardfork
Hardfork
EVM hardfork
Returns
bigint
Gas cost
getEcMulCost()
getEcMulCost(Defined in: src/primitives/GasConstants/Precompile.js:243 Get ECMUL cost for hardforkhardfork):bigint
Parameters
hardfork
Hardfork
EVM hardfork
Returns
bigint
Gas cost
