Author: Beosin
Author: Beosin
In March 2023, Ethereum will launch the expected Shanghai upgrade. As of press time, this upgrade mainly includes EIP-3540, EIP-3651, EIP-3670, EIP-3855, EIP-3860, EIP-4895, EIP-4200 , EIP-4750 and EIP-5450. The much-anticipated EIP-4844 will be delayed until May-June for an update.
image description
Image: Shutterstock
First of all, in the Ethereum ecosystem, we often hear the word EIP. What does this word mean?
The full name of EIP is Ethereum Improvement Proposal. It is a collective term for a series of standards and protocols recommended for use on the Ethereum platform. The specific standards and protocols it contains involve Ethereums core protocol, client API, smart contract standards, etc. Each EIP contains the definition of a standard or protocol.
EIP-3540
Lets first understand the several standards that will be involved in the upgrade of Ethereum Shanghai.
EIP-3651
This EIP is primarily an update to the EVM Object Format (EOF) contract bytecode, introducing an extensible and version-controlled container format to the EVM. Code and data tags are added to the contract bytecode to realize the separation of code and data. This separation is particularly beneficial for on-chain code verifiers because verifiers can distinguish code and data. (Detailed reference: https://eips.ethereum.org/EIPS/eip-3540 )
EIP-3670
The main purpose of this EIP is to change the COINBASE address from a cold address to a hot address. Currently, COINBASE direct transactions are becoming more and more popular because they allow conditional payments, which provide benefits such as implicit cancellation of transactions. However, the price of accessing COINBASE is too high, because COINBASE is calculated according to the cost of cold address access under the access list framework originally introduced in EIP-2929, and the cost of cold address access is relatively higher than that of hot address access . (Detailed reference: https://eips.ethereum.org/EIPS/eip-3651 )
EIP-3855
This EIP is mainly to introduce code verification when creating the above-mentioned EIP-3540 contract. Reject contract bytecode that contains truncated PUSH data or undefined instructions. (Detailed reference: https://eips.ethereum.org/EIPS/eip-3670 )
EIP-3860
The EIP mainly adds the PUSH 0 instruction, which pushes the constant 0 into the stack. At present, there are only PUSH 1-PUSH 32 instructions that push 1 byte to 32 bytes onto the stack, but to push the constant 0 onto the stack, you need to use the PUSH 1 0 instruction to operate, and this instruction consumes 3 gas in the runtime, and Additional 2 bytes of storage costs 2* 200 gas. At present, about 11.5% of the PUSH instructions push a constant 0 to the stack, and after adding the PUSH 0 instruction, a certain amount of gas costs can be saved. (Detailed reference: https://eips.ethereum.org/EIPS/eip-3855 )
EIP-4895
This EIP mainly modifies the maximum value of initcode. The current maximum value of initcode is set to MAX_CODE_SIZE: 24576 in the previous EIP-170. In EIP-3860, the maximum value of the new initcode is MAX_INITCODE_SIZE = 2 * MAX_CODE_SIZE = 49152. This doubles the maximum contract size, allowing contracts to have richer functions. But each byte of initcode will add 0.0625 gas cost, and the contract deployment gas cost will increase slightly. (Detailed reference: https://eips.ethereum.org/EIPS/eip-3860 )
EIP-4200
This EIP is mainly to activate the pledge withdrawal function of the Ethereum beacon chain. (Detailed reference: https://eips.ethereum.org/EIPS/eip-4895 )
EIP-4750
This EIP introduces three new EVM static jump instructions, RJUMP, RJUMPI and RJUMPV, to optimize the network and reduce costs. At present, EVM only has a dynamic jump mechanism, which makes the bytecode very flexible, but also increases the complexity of code analysis. The main benefits of these static instructions are reduced gas costs (both at deployment and execution time) and better analytical properties. (Detailed reference: https://eips.ethereum.org/EIPS/eip-4200 )
EIP-5450
The EIP mainly changes the code verification process and optimizes the network. At present, the EVM performs a large number of validity checks on each executed instruction, such as overflow, whether the gas is sufficient, etc., and the EIP will allow the contract to be verified when it is deployed, thereby reducing the number of such verifications when the code is running . (Detailed reference: https://eips.ethereum.org/EIPS/eip-5450 )
secondary title
This Shanghai upgrade is mainly divided into the following major types
1. EVM detail optimization
There are mainly two EIPs with improved details, namely: EIP-3651 and EIP-3860.
It is mainly aimed at the existing details and the details of the optimization experience. Among them, EIP-3860 can alleviate the limitation of the bytecode length of the current smart contract, which causes some complex contracts to be split into multiple contracts before they can be deployed to the main network. Problem, the introduction of this EIP will significantly increase the richness and diversity of smart contract functions.
2. Beacon chain withdrawal
Mainly implemented through EIP-4895.
At present, the number of ETH pledges on the beacon chain exceeds 15 million, accounting for nearly 13% of the total circulation of Ethereum. After this upgrade, the extraction function of these over 15 million Ethereum will be opened.
This extraction function will use the push method to push the funds from the consensus layer (beacon connection) to the execution layer (main network), and will define a fork timestamp FORK_TIMESTAMP. From this timestamp, the execution layer will have to Withdrawals are processed. The consensus layer will define a load-level object withdrawal, which will provide key information including: index (counter, record number of withdrawals), validator_index (validator data), address (withdrawal target address) and amount (amount of Ethereum) , will be actively pushed to the execution layer. A new field withdrawals will also be defined in the execution layer, which stores a list of withdrawal objects. After the execution load obtains a withdrawal object, it is added to the withdrawals list. After verification, the amount of Ethereum will be added to the address address to realize the extraction of Ethereum.
3. Bytecode improvement
There are six bytecode-related improved EIPs, namely: EIP-3540, EIP-3670, EIP-3855, EIP-4200, EIP-4750 and EIP-5450.
This part of the upgrade is the main content of this Shanghai upgrade, and will have a relatively large impact on the Ethereum virtual machine system. Beosin will synchronously incorporate all instructions in this Shanghai upgrade into the Beosin-VaaS smart contract code detection tool.
secondary title
What is the Ethereum scalability solution?
On the other hand, the high-profile EIP-4844 was postponed until May-June this year for an update, its function is to introduce a new transaction format of transaction with blob, which is specially designed for L2 data transmission output data type.
Rollups are a scaling solution that is the only trustless scaling solution for Ethereum in the short, medium and possibly long term. In recent months, the cost of transferring data from L2 to L1 has remained high, and Rollups has significantly reduced the transaction costs of many Ethereum users. Among them, Optimism and Arbitrum have 3-8 times lower fees than the Ethereum base layer itself. features, and ZK rollups even feature 40-100x lower fees than the Ethereum base layer itself.
However, even that fee is too expensive for many users. In the long run, data sharding is a good solution to the shortcomings of rollups, which can add 16 MB of dedicated data space to each block of the chain using rollups. However, the implementation and deployment of the data sharding function takes a long time to achieve.