Skip to content

Commit

Permalink
extend list of required EIPs
Browse files Browse the repository at this point in the history
  • Loading branch information
shamatar committed May 22, 2020
1 parent 927ea81 commit 886c257
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions EIPS/eip-2666.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ status: Draft
type: Standards Track
category: Core
created: 2020-05-22
requires: 2565
replaces : 2046
requires: 1352, 2046, 2565
---

<!--You can leave these HTML comments in your merged EIP and delete the visible duplicate text guides, they will not appear and may be helpful to refer to if you edit it again. This is the suggested template for new EIPs. Note that an EIP number will be assigned by an editor. When opening a pull request to submit your EIP, please use an abbreviated title in the filename, `eip-draft_title_abbrev.md`. The title should be 44 characters or less.-->

## Simple Summary
<!--"If you can't explain it simply, you don't understand it well enough." Provide a simplified and layman-accessible explanation of the EIP.-->
This EIP tries to solve problems with Ethereum precompiles and built-in EVM function:
- `STATICCALL` to precompiles is insanely expensive for nothing: we call a pure function without storage access, but still pay `700` gas for it
- If price of such calls is changed it may be necessary to adjust costs of some precompiles that have taken those wasted `700` gas into account
- "Older" precompiles are overpriced and their pricing formulas to not reflect the structure of underlying function
This EIP tries to fix the problems with Ethereum precompiles and built-in EVM function:
- EIP-2046 changes a `STATICCALL` cost to precompile and it may be necessary to adjust costs of some precompiles that have taken old large cost (`700` gas) into account
- Some precompiles are overpriced and their pricing formulas to not reflect the structure of underlying function
- Keccak256 built-in function in EVM has pricing that does not reflect underlying hash function structure

## Abstract
<!--A short (~200 word) description of the technical issue being addressed.-->
`STATICCALL` opcode when used to call precompiles wastes gas. Costs of many precompiles and built-in functions are invalid at the current state of the clients.
Costs of many precompiles and built-in functions are invalid at the current state of the clients. This EIP contains a list of changes to the pricing formulas to better reflect underlying computations' structure.

## Motivation
<!--The motivation is critical for EIPs that want to change the Ethereum protocol. It should clearly explain why the existing protocol specification is inadequate to address the problem that the EIP solves. EIP submissions without sufficient motivation may be rejected outright.-->
Expand All @@ -33,7 +31,6 @@ Motivation is simple: make pricing formulas accurately reflect resources (CPU ti
<!--The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (go-ethereum, parity, cpp-ethereum, ethereumj, ethereumjs, and [others](https://github.com/ethereum/wiki/wiki/Clients)).-->

This EIP proposes the following changes:
- `STATICCALL` cost to addresses below `1024` is set to zero
- Small running time to perform gas estimation for precompile call is absorbed into the precompile cost itself
- Precompiles are repricied as:
- `SHA256` precompile (address `0x02`) was priced as `60` gas plus `12` gas per `32` bytes of input. Now it should be priced as `12 + ((len(input) + 8)/64 + 1) * 5`
Expand All @@ -44,11 +41,12 @@ This EIP proposes the following changes:
- If Geth implementation of Keccak256 is reworked than formula can be changed further to `16 + (len(input)/136 + 1)*2`
- Client implementations of gas metering function SHOULD be implemented with efficiency in mind, e.g. use `uint64` type instead of `uint256` that is sufficient for all reasonable prices taking into the account gas limits in the block

This EIP assumes that `MODEXP` repricing is [implemented](https://eips.ethereum.org/EIPS/eip-2565) to also accurately reflect that there is implicit compensation for a wasted `STATICCALL` cost.
This EIP requires that `MODEXP` repricing is [implemented](https://eips.ethereum.org/EIPS/eip-2565) to also accurately reflect that there is implicit compensation for an old `STATICCALL` cost (pre-2046).

## Rationale
<!--The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. The rationale may also provide evidence of consensus within the community, and should discuss important objections or concerns raised during discussion.-->

Cost of functions being executed must accurately reflect real CPU time spent on computations, so benchmarking was performed for current precompiles and Keccak256 function to measure running time versus input parameters.

## Backwards Compatibility
<!--All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The EIP must explain how the author proposes to deal with these incompatibilities. EIP submissions without a sufficient backwards compatibility treatise may be rejected outright.-->
Expand Down

0 comments on commit 886c257

Please sign in to comment.