@ethereumjs/evm
Version:
JavaScript Ethereum Virtual Machine (EVM) implementation
35 lines • 1.52 kB
TypeScript
import type { PrecompileInput } from '../types.ts';
/**
* Calculates the gas used for the MSM precompiles based on the number of pairs and
* calculating in some discount in relation to the number of pairs.
*
* @param numPairs - Number of pairings provided to the precompile
* @param gasUsedPerPair - Base gas cost per pairing
* @param discountTable - Discount table (pair count -> multiplier)
* @returns Total gas to charge after applying the discount table
*/
export declare const msmGasUsed: (numPairs: number, gasUsedPerPair: bigint, discountTable: [number, number][]) => bigint;
/**
* BLS-specific zero check to check that the top 16 bytes of a 64 byte field element provided
* are always zero (see EIP notes on field element encoding).
*
* Zero byte ranges are expected to be passed in the following format (and so each referencing
* 16-byte ranges):
*
* ```ts
* const zeroByteRanges = [
* [0, 16],
* [64, 80],
* [128, 144]
*
* ]
* ```
*
* @param opts - Precompile input wrapper containing the data to inspect
* @param zeroByteRanges - Ranges (as [start, end]) within which bytes must be zero
* @param pName - Human readable precompile name for logging
* @param pairStart - Optional offset into the data when iterating through pairs
* @returns `true` if every specified range contains only zero bytes
*/
export declare const leading16ZeroBytesCheck: (opts: PrecompileInput, zeroByteRanges: number[][], pName: string, pairStart?: number) => boolean;
//# sourceMappingURL=util.d.ts.map