Talking about the function and benefits of Ethereum Shanghai upgrade
W3.Hitchhiker
2022-11-08 07:34
本文约1642字,阅读全文需要约7分钟
Briefly sort out the functions and benefits of EIP related to this upgrade

Original Author: Xiang, W3.Hitchhiker

Regarding the upgrade of Ethereum Shanghai, let’s briefly sort out what benefits it can bring.

Refer to the latest Ethereumpublic information, and the related EIPs for Shanghai upgrade are as follows:

  • Determine the included EIPs: EIP-3651, EIP-3855, EIP-3860, EIP-4895

  • EIPs that may be included: EIP-3540, EIP-3670

  • first level title

EIP-3651: WARM COINBASE

Speaking of EIP-3651, we must first introduce a change in EIP-2929:

When the target is not in accessed_addresses, charge COLD_ACCOUNT_ACCESS_COST (cold account access cost) gas and add the address to accessed_addresses. Otherwise, WARM_STORAGE_READ_COST (warm storage read cost) gas is charged, and the gas consumed by warm read is relatively low.

Nowadays, COINBASE direct payment is becoming more and more popular, but the price of accessing COINBASE is currently higher; this is because under the access list framework introduced by EIP-2929, COINBASE calculates gas according to the cost of cold account access, in EIP- After 3651, accessed_addresses will include addresses returned by COINBASE (0x41).

benefit:

first level title

EIP-3855: PUSH0 Instruction

EIP-3855, introduces a new instruction (0x5f), pushes the constant value 0 onto the stack, the instruction set of PUSH in the Yellow Book, currently only PUSH1-PUSH32, the function is to push 1 byte onto the stack, and push 32 bytes onto the stack

The implementation of the existing instruction to push the value of 0 onto the stack needs to execute PUSH1 0, which consumes 3 gas in runtime, and additionally consumes 200 gas (2 bytes of storage cost)

image

With the PUSH0 instruction, there is no need to consume the extra 200 gas.

benefit:

first level title

EIP-3860: Limit and compute initialization code

Currently, the maximum initcode is MAX_CODE_SIZE: 24576 (EIP-170), and the maximum new initcode is (MAX_INITCODE_SIZE = 2 * MAX_CODE_SIZE = 49152), which means that the contract size can be doubled, and contract developers can deploy richer functions. (The contract code is too large and the deployment is unsuccessful. PS: The L2 project has also been partially modified to support a higher upper limit of the contract size)

In addition, 2 gas fees are introduced for each 32-byte initcode chunk to represent the cost of jumpdest-analysis. Because during contract creation, the client must perform jumpdest analysis on the initcode before execution. Execution works linearly with the size of the initcode.

This means that each byte of initcode will cost 0.0625 gas, and the gas cost of contract deployment will increase slightly.

benefit:

first level title

EIP-4895: Beacon Chain Withdrawals

The main content is to determine the main process of withdrawing funds from the beacon chain to EVM. After the deployment is completed, the pledged withdrawal function of the Ethereum beacon chain will be activated.

benefit:

first level title

EIP-3540: EVM Object Format (EOF) v1

This EIP involves major changes and is not necessarily included in the Shanghai upgrade.

The format described in this EIP introduces a simple and extensible format, and introduces validation. Realized the separation of contract code and data.

The new EVM object format is: magic, version, (section_kind, section_size)+, 0,

benefit:

Version control is conducive to the introduction or deprecation of new functions in the future (such as the introduction of account abstraction);

The separation of contract code and data is beneficial to L2 verification (op), reducing the gas cost of L2 validators;

first level title

EIP-3670: EOF — Code Verification

This EIP is not necessarily included in the Shanghai upgrade, and code verification is introduced when the EIP-3540 contract is created. Contracts that reject undefined instructions.

benefit:

Original link

Original link

W3.Hitchhiker
作者文库