Skip to content

Commit

Permalink
rename title to "particle gas costs", edit ewasm section
Browse files Browse the repository at this point in the history
  • Loading branch information
cdetrio committed May 29, 2019
1 parent 7cea392 commit c28074b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion EIPS/eip-1679.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This meta-EIP specifies the changes included in the Ethereum hardfork named Ista
- requirement of EIP-2031
- [EIP-2031](https://eips.ethereum.org/EIPS/eip-2031): State Rent B - Net transaction counter
- [EIP-2035](https://eips.ethereum.org/EIPS/eip-2035): Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs
- [EIP-2045](https://eips.ethereum.org/EIPS/eip-2045): Fractional gas costs for EVM opcodes
- [EIP-2045](https://eips.ethereum.org/EIPS/eip-2045): Particle gas costs for EVM opcodes
- [EIP-2046](https://eips.ethereum.org/EIPS/eip-2046): Reduced gas cost for static calls made to precompiles

## Timeline
Expand Down
7 changes: 3 additions & 4 deletions EIPS/eip-2045.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
eip: 2045
title: Fractional gas costs for EVM opcodes
title: Particle gas costs for EVM opcodes
author: Casey Detrio (@cdetrio), Alex Beregszaszi (@axic)
discussions-to: https://ethereum-magicians.org/t/eip-2045-fractional-gas-costs/3311
status: Draft
Expand All @@ -17,7 +17,7 @@ The transaction capacity of an Ethereum block is determined by the gas cost of t

Another way to boost the transaction capacity of a block is to reduce the gas cost of transactions. Reducing the gas costs of computational opcodes while keeping the cost of storage opcodes the same, is effectively equivalent to raising the block gas limit and simultaneously increasing the cost of storage opcodes. However, reducing the cost of computational opcodes might avoid the adverse side effects of an increase in cost of storage opcodes (again, more research is needed on this topic).

Currently, computational opcode costs are already too close to the minimum unit of 1 gas to achieve the large degree of cost reductions that recent benchmarks<sup>[2](#evmbenchmarks)</sup> indicate would be needed to tune opcode gas costs to the performance of optimized EVM implementations. A smaller minimum unit called a "particle", which is a fraction of 1 gas, would enable large cost reductions.
Currently, computational opcode costs are already too close to the minimum unit of 1 gas to achieve the large degree of cost reductions that recent benchmarks<sup>[2](#evmbenchmarks)</sup> indicate would be needed to tune opcode gas costs to the performance of optimized EVM implementations. A smaller minimum unit called a "particle", which is a fraction (or subdivision) of 1 gas, would enable large cost reductions.

## Specification
A new gas counter `particlesUsed` is added to the EVM, in addition to the existing gas counter `gasUsed`. The unit 1 gas is equal to 10000 particles (`PARTICLES_PER_GAS`). The `particlesUsed` counter is only increased for opcodes priced in particles (i.e. opcodes that cost less than 1 gas). If increasing `particlesUsed` results in an excess of 1 gas, then 1 gas is added to `gasUsed` (and deducted from `particlesUsed`).
Expand Down Expand Up @@ -99,8 +99,7 @@ Many computational opcodes will undergo a cost reduction, with new costs suggest
Adoption of fractional gas costs should only be an implementation detail inside the EVM, and not alter the current user experience around transaction gas limits and block gas limits. The concept of `particles` need not be exposed to Ethereum users nor most contract authors, but only to EVM implementers and contract developers concerned with optimized gas usage. Furthermore, only the EVM logic for charging gas per opcode executed should be affected by this change. All other contexts dealing with gas and gas limits, such as block headers and transaction formats, should be unaffected.

### Ewasm

Particles were first introduced for Ewasm<sup>[3](#particle)</sup>, motivated by keeping compatibility with the EVM, while accounting for the lower cost of the instructions. With particles, state querying or changing operations (e.g. `SSTORE`, `SLOAD`, `BALANCE`, etc.) can keep the same gas costs. Interoperability between Ewasm and EVM contracts is simple, as the particles are hidden from EVM.
The term "particles" was first introduced for Ewasm<sup>[3](#particle)</sup> to enable gas accounting for low cost wasm instructions, while remaining compatible with EVM gas costs. This EIP proposes introducing particles as a new minimum gas unit for EVM opcodes, and is not related to Ewasm.

## Backwards Compatibility
This change is not backwards compatible and requires a hard fork to be activated.
Expand Down

0 comments on commit c28074b

Please sign in to comment.