This is the first week since the start of the program that I slowed down a bit. I spent the week rereading the yellow paper to make a proposal of the gas cost of a potential Poseidon precompile.
Some precompiles have a fixed gas cost, while others have a dependency on the input size. Te table below summarizes the gas costs for each precompile contract. See the the yellow paper for details.
Precompile | Gas cost |
---|---|
ECREC |
3000 |
SHA256 |
|
RIPEMD160 |
|
ID |
|
EXMOD |
|
BN_ADD |
150 |
BN_MUL |
6000 |
SNARKV |
|
BLAKE2_F |
number of rounds , maximum 4 bytes |
In the table above is the input size in bits. The gas costs for the modular exponentiation contract is given by
where , and are positive integers of 4 bytes denoting the lenght in bits of the modulus and the basis, and
The subvector of the input is the exponent whose size is given by