Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP-5022: Increase price of SSTORE from zero to non-zero to 40k gas #5022

Merged
merged 3 commits into from
May 6, 2022
Merged

EIP-5022: Increase price of SSTORE from zero to non-zero to 40k gas #5022

merged 3 commits into from
May 6, 2022

Conversation

greenlucid
Copy link
Contributor

No description provided.

@greenlucid greenlucid changed the title EIP XXX: Increase price of SSTORE from zero to non-zero to 40k gas EIP 5022: Increase price of SSTORE from zero to non-zero to 40k gas Apr 20, 2022
@greenlucid greenlucid changed the title EIP 5022: Increase price of SSTORE from zero to non-zero to 40k gas EIP-5022: Increase price of SSTORE from zero to non-zero to 40k gas Apr 20, 2022
@greenlucid greenlucid marked this pull request as ready for review April 20, 2022 21:12
@Pandapip1
Copy link
Member

@greenlucid - please close this PR and then immediately re-open it

@eth-bot
Copy link
Collaborator

eth-bot commented Apr 22, 2022

All tests passed; auto-merging...

(pass) eip-5022.md

classification
updateEIP
  • passed!

Copy link
Contributor

@MicahZoltu MicahZoltu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor adjustments, generally seems fine for draft though.


### Abstract

Increase the price of the SSTORE opcode from `20_000` gas to `40_000` gas when the original slot is zero and the resultant slot is non-zero.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Increase the price of the SSTORE opcode from `20_000` gas to `40_000` gas when the original slot is zero and the resultant slot is non-zero.
Increase the price of the SSTORE (0x55) opcode from `20_000` gas to `40_000` gas when the original slot is zero and the resultant slot is non-zero.

Opcodes should be referenced at least the first time in the document in the form:

REVERT (0xfe)

Comment on lines +23 to +54
## Rationale

### Why not also raise the cost of non-zero to non-zero?

Rewriting storage does not affect state growth, which is the main issue this EIP is addressing. Rewriting storage may also be underpriced.
Increasing the price of state growth will, at least, incentivize developers to reuse storage instead.

### Why not also increase the gas refund from setting non-zero to zero?

More discussion is needed on this.

### Why not a better state solution?

Whereas solutions like state rent, or state expiry have been researched for a long time, they will not be ready on the short to medium term. So, it is desirable to patch pricing for the short term. Opcode repricing has been done before, so it should not impose a large development time investment for clients.

### Why was that specific amount chosen?

The current pricing was made off a naive approach of benchmarking opcodes in a laptop. Not only it did not consider the long term problem of having the same price for a resource that costs more over time, the benchmark itself was wrong. This price is closer to what the naive original benchmark should have been. It could go higher, but that may be too disruptive.

### Is this too distruptive?

This change will severely impact the gas cost of many applications. The network does not have to subsidize state growth at the expense of more expensive regular transactions, so even if it is too disruptive, it will increase the health of the network.

### Specification

| Constant | Value |
| - | - |
| `FORK_BLOCK` | TBD |
| `NEW_STORAGE_PRICE` | `40_000`

For blocks where `block.number >= FORK_BLOCK`, a new gas schedule applies. Make `SSTORE_SET_GAS`, the price when a slot is set from zero to non-zero, equal `NEW_STORAGE_PRICE`. All other costs remain the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specification should come before rationale.

Suggested change
## Rationale
### Why not also raise the cost of non-zero to non-zero?
Rewriting storage does not affect state growth, which is the main issue this EIP is addressing. Rewriting storage may also be underpriced.
Increasing the price of state growth will, at least, incentivize developers to reuse storage instead.
### Why not also increase the gas refund from setting non-zero to zero?
More discussion is needed on this.
### Why not a better state solution?
Whereas solutions like state rent, or state expiry have been researched for a long time, they will not be ready on the short to medium term. So, it is desirable to patch pricing for the short term. Opcode repricing has been done before, so it should not impose a large development time investment for clients.
### Why was that specific amount chosen?
The current pricing was made off a naive approach of benchmarking opcodes in a laptop. Not only it did not consider the long term problem of having the same price for a resource that costs more over time, the benchmark itself was wrong. This price is closer to what the naive original benchmark should have been. It could go higher, but that may be too disruptive.
### Is this too distruptive?
This change will severely impact the gas cost of many applications. The network does not have to subsidize state growth at the expense of more expensive regular transactions, so even if it is too disruptive, it will increase the health of the network.
### Specification
| Constant | Value |
| - | - |
| `FORK_BLOCK` | TBD |
| `NEW_STORAGE_PRICE` | `40_000`
For blocks where `block.number >= FORK_BLOCK`, a new gas schedule applies. Make `SSTORE_SET_GAS`, the price when a slot is set from zero to non-zero, equal `NEW_STORAGE_PRICE`. All other costs remain the same.
## Specification
| Constant | Value |
| - | - |
| `FORK_BLOCK` | TBD |
| `NEW_STORAGE_PRICE` | `40_000`
For blocks where `block.number >= FORK_BLOCK`, a new gas schedule applies. Make `SSTORE_SET_GAS`, the price when a slot is set from zero to non-zero, equal `NEW_STORAGE_PRICE`. All other costs remain the same.
## Rationale
### Why not also raise the cost of non-zero to non-zero?
Rewriting storage does not affect state growth, which is the main issue this EIP is addressing. Rewriting storage may also be underpriced.
Increasing the price of state growth will, at least, incentivize developers to reuse storage instead.
### Why not also increase the gas refund from setting non-zero to zero?
More discussion is needed on this.
### Why not a better state solution?
Whereas solutions like state rent, or state expiry have been researched for a long time, they will not be ready on the short to medium term. So, it is desirable to patch pricing for the short term. Opcode repricing has been done before, so it should not impose a large development time investment for clients.
### Why was that specific amount chosen?
The current pricing was made off a naive approach of benchmarking opcodes in a laptop. Not only it did not consider the long term problem of having the same price for a resource that costs more over time, the benchmark itself was wrong. This price is closer to what the naive original benchmark should have been. It could go higher, but that may be too disruptive.
### Is this too distruptive?
This change will severely impact the gas cost of many applications. The network does not have to subsidize state growth at the expense of more expensive regular transactions, so even if it is too disruptive, it will increase the health of the network.


For blocks where `block.number >= FORK_BLOCK`, a new gas schedule applies. Make `SSTORE_SET_GAS`, the price when a slot is set from zero to non-zero, equal `NEW_STORAGE_PRICE`. All other costs remain the same.

### Backwards compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Backwards compatibility
## Backwards Compatibility

Comment on lines +61 to +64
## Implementation

https://github.com/ethereum/go-ethereum/pull/24725

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation isn't a valid EIP section. There is a Reference Implementation section, but it should contain an inline implementation, not a link to an external one. Reference Implementation is optional, so if it doesn't make sense to include something inline, then it is best to just leave the section out.

Suggested change
## Implementation
https://github.com/ethereum/go-ethereum/pull/24725

Comment on lines +65 to +67
## Security considerations

TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright is required.

Suggested change
## Security considerations
TODO
## Security Considerations
TBD
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

Comment on lines +2 to +9
eip: 5022
title: Increase price of SSTORE from zero to non-zero to 40k gas
author: Green (@greenlucid)
status: Draft
type: Standards Track
category: Core
created: 2022-04-20
discussions-to: https://ethereum-magicians.org/t/eip-proposal-increase-cost-of-sstore-from-20k-to-x-when-creating-new-storage/7614
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a description and discussions-to must come after the author.

Suggested change
eip: 5022
title: Increase price of SSTORE from zero to non-zero to 40k gas
author: Green (@greenlucid)
status: Draft
type: Standards Track
category: Core
created: 2022-04-20
discussions-to: https://ethereum-magicians.org/t/eip-proposal-increase-cost-of-sstore-from-20k-to-x-when-creating-new-storage/7614
eip: 5022
title: Increase price of SSTORE from zero to non-zero to 40k gas
description: <required>
author: Green (@greenlucid)
discussions-to: https://ethereum-magicians.org/t/eip-proposal-increase-cost-of-sstore-from-20k-to-x-when-creating-new-storage/7614
status: Draft
type: Standards Track
category: Core
created: 2022-04-20

Copy link
Contributor

@MicahZoltu MicahZoltu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant request changes. 😖

@MicahZoltu MicahZoltu closed this May 6, 2022
@MicahZoltu MicahZoltu reopened this May 6, 2022
@eth-bot eth-bot enabled auto-merge (squash) May 6, 2022 06:30
@eth-bot eth-bot merged commit 78c3ad2 into ethereum:master May 6, 2022
PowerStream3604 pushed a commit to PowerStream3604/EIPs that referenced this pull request May 19, 2022
nachomazzara pushed a commit to nachomazzara/EIPs that referenced this pull request Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants