In the Berlin upgrade, what is the significance of EIP-2929 increasing gas costs?

In the Berlin upgrade, what is the significance of EIP-2929 increasing gas costs?

Written by: Vitalik Buterin
Translation: ETH Chinese website

summary

  • Yes, some opcode calls will require more gas overhead, but this must be done to improve safety.

  • But on the other hand, an operation that should have been cheaper all along (a store followed by a load of the same slot) ends up being cheaper.

  • Another important benefit is that it is now safer to increase the gas limit moderately. The main reason to limit the increase in the gas limit is now more about state size.

The EIPs that caused changes in gas costs in the Berlin hard fork are: EIP 2565 (reducing the gas cost of ModExp modular exponentiation operations), EIP 2929 (increasing the gas cost of SLOAD and CALL), and EIP 2718 and 2930, to support the compatibility of contracts affected by the increase in gas costs and pave the way for future upgrades.

Currently, the most important of these EIPs is EIP-2929. Its core content is: the gas cost of SLOAD increases from 800 to 2100, the gas cost of CALL (including STATICCALL, DELEGATECALL and other opcodes) and external contract queries (BALANCE, EXTCODESIZE, etc.) increases from 700 to 2600, but this only happens when the address and storage slot are accessed for the first time in a transaction.

The purpose of this is to further improve the ability to resist DoS attacks: early research showed that the biggest DoS vulnerability in the Ethereum protocol is in storage access, and it is possible to create some blocks that simply access a large number of accounts repeatedly, and the processing time may be as long as 80 seconds. The solution is a simple quick fix: make these operations last longer (storage access requires disk access) to consume more gas, and eventually the DoS problem will be weakened by about 3 times. In the meantime, the client team has done some excellent work - implementing disk storage caching, reducing the number of database queries required for storage loading, and plugging this vulnerability in the long run.

The gas cost repricing combined with these client improvements makes the existing blockchain more secure and makes it safer to provide a gas limit than it is now. After EIP-2929, the main reason to avoid a large gas limit increase is actually no longer the DoS attack problem, but the increase in state size (these two aspects affect each other: storage loading consumes more gas when the storage load becomes larger). Therefore, state expiration and statelessness will become very important, and can even be said to be the top priority after the "merge".

The second biggest long-term benefit of this repricing is that the witness size for stateless verification can theoretically be reduced by up to a factor of 3. For code reading, we will also need a repricing (something like: 500 gas per 31 bytes of code access), but this can be implemented in the future.

Please note: this EIP only increases the gas cost for the first access of each transaction. Subsequent accesses are actually cheaper (100 gas in all cases). In addition, calls to the precompile always cost only 100 gas, including the first call. This has the following positive effects:

  • Any SSTORE after a SLOAD (or SLOAD after an SSTORE) in the same slot will become cheaper. This is because the first storage read or write and the gas fee paid to access the storage slot have already been "warmed up", and the first read and write will be cheaper; so, instead of 800 + 5000 gas, we need to pay 2100 + 2900 (approximately), a reduction of about 800 gas. This may make forwarding of ERC20 protocol standard tokens cheaper.

  • Self-calling becomes cheaper

  • Calls to precompiles become cheaper (this is especially valuable for low gas precompiles that need to be called a lot of times, like ECADD)

The first access rule is added because when an account or storage slot is accessed for the second time, it should already be cached in the content, so no expensive disk access is needed. Of course, two accesses to the same value only require one witness entry.


<<:  Behind the 40 billion yuan "biggest case in the cryptocurrency circle", virtual currency has become a "new channel" for cross-border money laundering

>>:  South Korea’s digital currency regulation sparked public outrage, and the media made official reports into NFTs to “ridicule” them

Recommend

What are the facial features of people with a good relationship?

After marriage, what people worry about most is n...

Judging a person’s character by the way they eat

Eating is an art. Some people eat voraciously wit...

HaoBTC will remove the "trading platform" app from the shelves on the 15th

According to the news from Mincoin on February 13...

How to read your partner's face through the Tianzhai Palace

In fact, how can we directly see the face of our ...

Bitcoin usage by businesses in 2017

Rage Review : In 2017, the price of Bitcoin incre...

U.S. states' attitudes toward Bitcoin

AUSTIN — Michael Cargill was doing his usual busi...

Why is Chia suddenly so popular?

1. Project Origin The origin of Bitcoin is the fi...

The Ten Heavenly Luo Observation Method in Physiognomy

The Ten Heavenly Luo Observation Method in Physio...

7 palm lines that indicate you will become rich and wealthy

Since ancient times, people have firmly believed ...

[Fishpond] Graphics card savior - XMR algorithm upgraded to cryptonightV8

Monero, the full name of Monero, is referred to a...

Is it good to have a cross on the lifeline?

There are three basic lines on a person's pal...

Comic Chat | What is the attitude of various governments towards blockchain?

We are here again to talk about blockchain in com...

What does a mole behind the right ear mean?

Because of its location, few people may notice th...

How to find the best partner by looking at face

Although finding a partner is only the first step...

A woman with a mole on her palm

It is said that hands are a woman’s second face. ...