# Week 14 Update 14.1 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](https://ethereum.github.io/yellowpaper/paper.pdf) 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](https://ethereum.github.io/yellowpaper/paper.pdf) for details. | Precompile | Gas cost | | ----------- | -------- | | `ECREC` | 3000 | | `SHA256` | $60+12\left\lceil\frac{\parallel I_d\parallel}{32}\right\rceil$ | | `RIPEMD160`| $60+120\left\lceil\frac{\parallel I_d\parallel}{32}\right\rceil$ | | `ID` | $15+3\left\lceil\frac{\parallel I_d\parallel}{32}\right\rceil$ | | `EXMOD` | $g_{\texttt{exmod}}$ | | `BN_ADD` | 150 | | `BN_MUL` | 6000 | | `SNARKV` | $34000\frac{\parallel I_d \parallel}{192}+45000$ | | `BLAKE2_F` | number of rounds $r$, maximum 4 bytes In the table above $\parallel I_d\parallel$ is the input size in bits. The gas costs for the modular exponentiation contract is given by $$g_{\texttt{exmod}}= \max\left(200,\left\lfloor \frac{f(\max(\ell_M,\ell_B))\cdot\max(\ell_E',1)}{3}\right\rfloor\right),$$ where $f(x)=\lceil x/8 \rceil^2$, $\ell_M$ and $\ell_B$ are positive integers of 4 bytes denoting the lenght in bits of the modulus and the basis, and $$ \ell_E' = \left\{\begin{array}{ll} 0 & \text{if } \ell_E\leq 32\text{ and } E=0\\ \lfloor\log_2 E\rfloor & \text{if } \ell_E \leq 32 \text{ and } E \neq 0\\ 8(\ell_E-32)+\lfloor\log_2(i[(96+\ell_B)\dots(127+\ell_B)])\rfloor & \text{if } 32 < \ell_E \text{ and } i[(96+\ell_B)\dots(127+\ell_B)] \neq 0\\ 8(\ell_E-32) & \text{otherwise.} \end{array}\right. $$ The subvector $i[(96+\ell_B)\dots(127+\ell_B)]$ of the input $i$ is the exponent whose size is given by $\ell_E.$