Skip to content

Commit

Permalink
update pricing numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
shamatar committed Jun 2, 2020
1 parent bfa0f86 commit d7b938f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions EIPS/eip-2666.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ Motivation is simple: make pricing formulas accurately reflect resources (CPU ti
This EIP proposes the following changes:
- 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`
- RIPEMD precompile (address `0x03`) was priced as `600` gas plus `120` gas per `32` bytes of input. Now it should be priced as `16 + ((len(input) + 8)/64 + 1) * 6`
- `SHA256` precompile (address `0x02`) was priced as `60` gas plus `12` gas per `32` bytes of input. Now it should be priced as `5 + ((len(input) + 8)/64 + 1) * 9`
- Improvements in Rust implementation can allow to reduce price to `3 + ((len(input) + 8)/64 + 1) * 5` (both constant and length-dependent contributions)
- RIPEMD precompile (address `0x03`) was priced as `600` gas plus `120` gas per `32` bytes of input. Now it should be priced as `6 + ((len(input) + 8)/64 + 1) * 12`
- Improvements in Go implementation can allow to reduce price to `2 + ((len(input) + 8)/64 + 1) * 8` (both constant and length-dependent contributions)
- `BNADD` precompile (address `0x06`) should be repriced from `150` gas to `350` gas
- `BNMUL` precompile (address `0x07`) should be repriced from `6000` gas to `6300` gas
- Keccak256 built-in function was priced as `30` gas plus `6` gas per `32` bytes of the input. Now it should be priced as `16 + (len(input)/136 + 1)*13`
- If Geth implementation of Keccak256 is reworked than formula can be changed further to `16 + (len(input)/136 + 1)*2`
- Keccak256 built-in function was priced as `30` gas plus `6` gas per `32` bytes of the input. Now it should be priced as `13 + (len(input)/136 + 1)*15`
- Improvements in Go implementation can allow to reduce price to `2 + (len(input)/136 + 1)*15` (constant contribution reduction)
- 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 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).
Expand Down

0 comments on commit d7b938f

Please sign in to comment.