This change reduces the gas cost of using precompiled contracts.
Reduce the base gas cost of calling precompiles using
STATICCALL from 700 to 40. This should allow more efficient use of precompiles as well as precompiles with a total cost below 700.
The Spurious Dragon hard fork increased the cost of calls significantly to account for loading contract code from the state without making an exception for precompiles, whose “code” is always loaded.
This made use of certain precompiles impractical.
FIXME: extend this with recent reasoning about ECC repricings.
0xfa) instruction charges different basic gas cost (Gcall in Yellow Paper’s notation) depending on the destination address provided:
- for precompiles (address range as per EIP-1352) the cost is
- for every other address the cost remains unchanged (
STATICCALL instruction was changed to reduce the impact of the change. This should not be a limiting factor, given precompiles (currently) do not have a state and cannot change the state.
However, contracts created and deployed before Byzantium likely will not use
STATICCALL and as a result this change will not reduce their costs.
Contrary to EIP-1109 gas reduction to
0 is not proposed. The cost
40 is kept as a cost representing the context switching needed.
This EIP should be backwards compatible. The only effect is that the cost is reduced. Since the cost is not reduced to zero, it should not be possible for a malicious proxy contract, when deployed before
HF, to do any state changing operation.
Jordi Baylina (@jbaylina) and Matthew Di Ferrante (@mattdf) who have proposed this before.
Copyright and related rights waived via CC0.
Please cite this document as:
Alex Beregszaszi, "EIP-2046: Reduced gas cost for static calls made to precompiles [DRAFT]," Ethereum Improvement Proposals, no. 2046, May 2019. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2046.