Skip to main content

const_fold_gas

Function const_fold_gas 

Source
pub(crate) fn const_fold_gas(
    opcode: u8,
    inputs: &[AbsValue],
    interner: &Interner<U256Idx, U256, FbBuildHasher<32>>,
) -> Option<u64>
Expand description

Returns the compiler gas cost of constant-folding the given opcode with the given inputs.

Uses the real EVM gas schedule: most arithmetic is cheap (3–5 gas), but EXP costs 10 + 50 * byte_size(exponent) which can be weaponised with large exponents.

Returns None for opcodes that try_const_fold does not handle.