EIPs/EIPS/eip-2046.md
Micah Zoltu 15f61ed0fd
Adds rule to EIP-1 that references to other EIPs must use relative path format and the first reference must be linked. (#2947)
I have gone through and updated all existing EIPs to match this rule, including EIP-1.

In some cases, people were using markdown citations, I suspect because the long-form was a bit verbose to inline.  Since the relative path is quite short, I moved these to inline but I wouldn't be opposed to putting them back to citation format if that is desired by the authors.

In doing the migration/cleanup, I found some EIP references to EIPs that don't actually exist.  In these cases I tried to excise the reference from the EIP as best I could.

It is worth noting that the Readme actually already had this rule, it just wasn't expressed properly in EIP-1 and the "Citation Format" section of the readme I think caused people a bit of confusion (when citing externally, you should use the citation format).
2020-09-30 12:22:43 +08:00

2.7 KiB

eip title author discussions-to status type category created requires
2046 Reduced gas cost for static calls made to precompiles Alex Beregszaszi (@axic) https://ethereum-magicians.org/t/eip-2046-reduced-gas-cost-for-static-calls-made-to-precompiles/3291 Draft Standards Track Core 2019-05-17 214, 1352

Simple Summary

This change reduces the gas cost of using precompiled contracts.

Abstract

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.

Motivation

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.

Specification

After block HF the STATICCALL (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 40
  • for every other address the cost remains unchanged (700)

Rationale

Only the 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.

Backwards Compatibility

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 the HF, to do any state changing operation.

Test Cases

TBA

Implementation

TBA

References

This has been previously suggested as part of EIP-1109 and EIP-1231. However EIP-1109 was later changed to a very different approach. The author has suggested to change EIP-1109.

Acknowledgements

Jordi Baylina (@jbaylina) and Matthew Di Ferrante (@mattdf) who have proposed this before.

Copyright and related rights waived via CC0.