The role and benefits of the Ethereum Shanghai upgrade

22-11-08 19:00
Read this article in 14 Minutes
总结 AI summary
View the summary 收起
Original title: "Ethereum Shanghai Upgrade Function and Benefits"
Original author: Xiang, W3.Hitchhiker


About Ethereum Shanghai upgrade, Let's briefly sort out the benefits that each can bring.


Refer to the latest public news of Ethereum: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/ shanghai.md#eips-considered-for-inclusion, and related EIPs for Shanghai upgrade are as follows:


- EIPs to be included: EIP-3651, EIP-3855 , EIP-3860, EIP-4895

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

- and EIP-4488, EIP-4844 related to L2 expansion Not within the scope of this upgrade


EIP-3651: Warm COINBASE


Speaking of EIP- 3651, I have to introduce a change of EIP-2929 first:


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.


COINBASE direct payments are becoming more popular these days, but access to COINBASE is currently expensive; this is due to the access list introduced in EIP-2929 Under the framework, COINBASE calculates the gas according to the cold account access cost. After EIP-3651, accessed_addresses will include the address returned by COINBASE (0x41).


Benefits:


After modification, COINBASE will reduce gas consumption when paying ERC20 tokens.


EIP-3855: PUSH0 command


EIP-3855, introduce a new instruction (0x5f), push the constant value 0 onto the stack, the yellow paper about PUSH instruction set, currently only PUSH1-PUSH32, the function is to push 1 byte into the stack, and push 32 bytes into the stack


The existing instruction implementation will Pushing the value of 0 into the stack needs to execute PUSH1 0, which consumes 3 gas in runtime, and an additional 200 gas (2 byte storage cost)



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


Benefits:


At present, about 11% of PUSH operations just push 0, so this EIP can save a certain amount of gas after execution , can also slightly improve the existing TPS of Ethereum.


EIP-3860: Limits and calculations initialization code


Currently the maximum initcode is MAX_CODE_SIZE: 24576 (EIP-170), new The maximum 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 contract size limit)


In addition, every 32 bytes The initcode chunk introduces 2 gas fees to represent the cost of jumpdest-analysis. Because during contract creation, the client must perform a jumpdest analysis on the initcode before execution. Execution work scales 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.


Benefits:


The contract deployment gas fee is slightly increased, but the contract size can be doubled, and the contract developer can write more functional code .


EIP-4895: Beacon Chain Withdrawal


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


Benefits:


Activate the Ethereum beacon chain pledge withdrawal function.


EIP-3540: EVM Object Format (EOF) v1


This EIP involves large changes, 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, <section contents>

< br>

Benefits:


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;


Separation of contract code and data It is also more convenient for the work of on-chain data analysis tools.


EIP-3670: EOF - Code Validation


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


Benefits:


When the contract is created, code verification can be introduced


< blockquote>Original link


欢迎加入律动 BlockBeats 官方社群:

Telegram 订阅群:https://t.me/theblockbeats

Telegram 交流群:https://t.me/BlockBeats_App

Twitter 官方账号:https://twitter.com/BlockBeatsAsia

举报 Correction/Report
Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit