The role and benefits of the Ethereum Shanghai upgrade

W3.Hitchhiker
2022-11-08 14:34:54
Collection
Summarize the role and benefits of the Ethereum Shanghai upgrade.

Author: Xiang, W3.Hitchhiker

Regarding the Ethereum Shanghai upgrade, let's briefly outline the benefits it can bring.

Referencing the latest public information from Ethereum, the relevant EIPs for the Shanghai upgrade are as follows:

  • Confirmed EIPs: EIP-3651, EIP-3855, EIP-3860, EIP-4895

  • Possible EIPs: EIP-3540, EIP-3670

  • EIPs related to L2 scaling, such as EIP-4488 and EIP-4844, are not included in this upgrade.

EIP-3651: Warm COINBASE

When discussing EIP-3651, we must first introduce a change from EIP-2929:

When the target is not in accessedaddresses, the gas cost of COLDACCOUNTACCESSCOST is charged, and the address is added to accessedaddresses. Otherwise, the gas cost of WARMSTORAGEREADCOST is charged, which is relatively lower for warm reads.

Currently, direct payments to COINBASE are becoming increasingly popular, but the cost of accessing COINBASE is relatively high; this is due to the cold account access cost calculation for gas under the access list framework introduced in EIP-2929. After EIP-3651, accessed_addresses will include the address returned by COINBASE (0x41).

Benefits:

After the modification, the gas consumption for COINBASE when paying ERC20 tokens will be reduced.

EIP-3855: PUSH0 Instruction

EIP-3855 introduces a new instruction (0x5f) that pushes the constant value 0 onto the stack. The yellow paper's instruction set for PUSH currently only includes PUSH1-PUSH32, which pushes from 1 byte to 32 bytes onto the stack.

The existing implementation requires executing PUSH1 0 to push a value of 0 onto the stack, consuming 3 gas in runtime, plus an additional 200 gas (for 2 bytes of storage cost).
image

With the PUSH0 instruction, this additional 200 gas cost is no longer necessary.

Benefits:

Currently, about 11% of PUSH operations simply push 0, so this EIP can save a certain amount of gas and slightly improve Ethereum's existing TPS.

EIP-3860: Limitations and Calculation of Initialization Code

Currently, the maximum initcode size is MAXCODESIZE: 24576 (EIP-170), and the new maximum for initcode is (MAXINITCODESIZE = 2 * MAXCODESIZE = 49152), which means the contract size can be doubled, allowing contract developers to deploy richer functionalities. (A contract that is too large may fail to deploy; note: some L2 projects have also modified to support a higher contract size limit.)

Additionally, a gas fee of 2 is introduced for every 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. The execution work is linearly related to the size of the initcode.

This means that a cost of 0.0625 gas will be added per byte of initcode, slightly increasing the gas cost of contract deployment.

Benefits:

The gas fee for contract deployment is slightly increased, but the contract size can be doubled, allowing contract developers to write more complex functionality code.

EIP-4895: Beacon Chain Withdrawals

The main content is to determine the primary process for withdrawing from the Beacon Chain to the EVM. Once deployed, the Ethereum Beacon Chain staking withdrawal feature will be activated.

Benefits:

Activates the Ethereum Beacon Chain staking withdrawal feature.

EIP-3540: EVM Object Format (EOF) v1

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

The format described in this EIP introduces a simple and extensible format and incorporates validation. It separates contract code and data.

The new EVM object format is: magic, version, (sectionkind, sectionsize)+, 0, \

Benefits:

Version control facilitates the future introduction or deprecation of new features (e.g., introducing account abstraction);

The separation of contract code and data is beneficial for L2 validation (op), reducing gas costs for L2 validators;

The separation of contract code and data also makes it easier for on-chain data analysis tools to work.

EIP-3670: EOF --- Code Validation

This EIP is not necessarily included in the Shanghai upgrade and introduces code validation during contract creation in conjunction with EIP-3540. It rejects contracts with undefined instructions.

Benefits:

Code validation can be introduced at the time of contract creation.

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators