原文标题: 《 OB30 讲第 4 讲,从 ETH2.0 入门不读不行,聊到上海升级技术细节与深远影响 》
The original source:OpenBlock Operation
Why the Shanghai upgrade matters. As a matter of fact, the four stages in the roadmap of ETH published in 2015: frontier, homestead, Metropolis and tranquility have been upgraded for 15 times. In the last upgrade of Paris, all of them have been completed. Unfortunately, but overall, they have greatly exceeded expectations.


One of the features of the ETH2.0 new era roadmap is that it was updated frequently during the eth1.0 phase. Each major update is only implemented after 1-2 years of testing. In the case of ETH2.0, major upgrades now seem to happen every six months.
The Shanghai upgrade is the first of six stages of the new road map, and its burden is self-evident. Just like four years ago, when we looked at the eth road map, we felt that a thief was drawing a pie. Now, when we look at the new road map, we also have this kind of dreamy feeling. How many years will it take to realize the dream?
To put it crudely, in the foreseeable future, the market will soon start to jump on the tokens of this Shanghai upgrade concept.
Well, to answer that vulgar question. Our article will be divided into three parts.
1. The new pattern of ETH2.0
2. Specific contents of Shanghai Upgrade
3. Shanghai upgrade, potential follow-up impact
In ETH2.0, "verifier" replaces the former role of "miner". MEV revenue takes over the role of GAS fees. Liquid pool, staking pool, and cex staking are staking, staking, and staking.
After the ETH2.0 mainnet merger, all transactions on the Ethereum network will no longer be verified by energy-intensive "miners", but by individual and organisational "validators" who have deposited or pledged large amounts of ETH. Anyone needs to pledge more than 32ETH to meet the minimum requirements and the verification node becomes a "verifier".
web3.0 practitioners must quickly popularize the concept of MEV. We can say that ETH1.0 is a gas distribution game centered on pow, while ETH2.0 is an arbitrage gas consumption game centered on MEV.
MEV (Miner Extractable Value), miner Extractable Value, also translated as Max Extractable Value, was first developed by Phil Daian in Flash Boys 2.0 In this paper.
As we all know, all actions on the chain exist in the form of "transaction", and all transactions initiated by users will enter the "mempool" to be packaged by miners. In order to maximize profits, miners will determine the packaging order according to the gas cost, which is the basic condition of MEV generation. It has also given rise to on-chain robots that arbitrage trades in the pool by prestarting them with a high gas setting (PGA).
Specifically, there are three types of MEV arbitrage that have been developed so far:
1. Triangle Arbitrage
2. Clip (sandwich attack.)
3. Loan settlement.
And the actual arbitrage capture, at present can only achieve about 20% of the theoretical arbitrage. This arbitrage strategy development and arbitrage scale, will be with eth code improvement, performance enhancement, market changes gradually increased.

This kind of profit on the ground is naturally targeted by many people. According to statistics, since 2020, the total amount of MEV captured by the whole network has reached 680 million dollars. This has also led to the emergence of a new generation of tools called Flashbot, which helps nodes capture MEVs. And a variety of fancy competitors for the MEV capture track, including but not limited to:KeeperDAO, ArcherDAO, Automata, mistX, BackRunMe.

MEV 所产生的巨额利润,一直都被圈在矿工和链上机器人的圈子里,最早作为矿池的一种灰色收入被民间戏称「贿赂节点收入」,「最小的 51% 攻击 」。
Arbitrageurs find arbitrage opportunities, bribe "verifiers" and manipulate the order of trade packaging for arbitrage. The process of sharing spoils between arbitrageurs and verifiers "is not only a cooperative relationship, but also a game relationship. This paper will not expand more here.
That didn't change until the London upgrade and Ethereum merger in 2022.
The passage of EIP1559 in the London upgrade greatly changed the income structure of miners
Instead of charging the full gas fee, the model of burning and tipping is changed.And the Ethereum merger marks a radical change to POS consensus,"The verifier replaces the original "miner" of the Buddhist comparison system to participate in the MEV value allocationETH2.0's node network becomes a more competitive and ecologically rich MEV paradise. This also significantly increases the number of Flashbot customers, with nearly 90% of Ethereum verifiers running its MEV-boost client as of now.
Since then, MEV has completely replaced gas fee as the main income of Ethereum "verifier". gas fee is used to burn, resulting in the long-term deflation expectation of ETH. In current figures, revenues for Ethereum "verifiers" have increased from around 3% annualized to close to 10% due to the introduction of MEV-boost. Under the premise of ETH deflation, the "node" revenue does not even lose to half before, which lays the foundation for ETH network stability and forms the barrier between ETH and other pos chains.
Although, as mentioned above, it only takes more than 30 eth to become a verifier in eth2.0, it is very difficult for individual verifiers to successfully receive awards once every two months on average. Especially now when it comes to technology such as mev-boost, which requires frequent maintenance, individual validators are always short of money. So with the exception of a few whales and others, mining pools are staking. There are three staking pools: Liquid pool, staking, and cex staking.
The market share is as follows:

1. Liquid ore pool:
The degree of centralization is moderate. The business model takes Lido, which has a market share of 88.67%, as an example. The mining proceeds pledged in Lido are given in the form of steth. All mining rewards are divided into three parts: 90% will be given to users pledging ETH, and 5% will be allocated to node operators and Lido Treasury. Meanwhile, the mining pool will also reward users and the Treasury with $Lido mining rewards. The user deposit certificate is stETH, which is called liquid mining pool because stETH has liquidity. Maintaining the liquidity of stETH-ETH trading pairs and the incentive of $LDO tokens are the main competitive barriers for such pools.

2. Exchange Mine Pool
The degree of centralization is relatively high, and the specific income distribution scheme of the mining pool, management costs and even the source of the pledged ETH are not transparent. The advantage is the exchange's strong business endorsement and commercial team.

3. Mining pool
It's very decentralized, it's basically decentralized, and the pattern is there's no pattern. Free mortgage, fair distribution, relatively transparent management fees.
The disadvantage is that before the Shanghai upgrade, due to the phased limitations of ETH2.0, the ETH in the locked warehouse is in jail and cannot be redeemed. It can be predicted that this type of mining pool will become the main beneficiary after the upgrade of Shanghai.

Based on the new economic model above, verifiers pledge ETH to generate and collect new ETH (MEV). These so-called "new ETH" are their rewards for verifying transactions and protecting the network.
But currently Ethereum, which can be stored but not withdrawn from ETH and has a total pledged value of nearly $23.5 billion, is "trapped" on the Ethereum network.
If the pledge function is not opened as soon as possible, the appeal of pledge ETH will be greatly reducedIn the future, there will not be so many people entering the Ethereum network, which will undoubtedly have a huge impact on the future development of Ethereum and network security. In the pos world, the amount of collateral is justice, and maintaining the amount of collateral is the first consensus to maintain block security.
The Shanghai upgrade will provide unlocking capabilities for the $23.5 billion POS pledged ETH locked on the chain, along with a number of EIP integration for GAS optimization.
Unfortunately, the scheduled Shanghai upgrade of the very important IP-4844 was finally confirmed to be delayed. It is the first step of ETH fragmentation, which greatly reduces the gas cost of eth. Some operations save 100 times as much gas.
Only nine of the 12 proposals were confirmed for renewal. Among them, the specific solution of ETH unlocking in Article 8 is the most important.
EOF optimization
This EIP introduces a reservation format for extensible and versioned containers for EVM. This reservation format allows for the separation of code and data, making it easy to introduce variations in the future. This change depends on the reservation format introduced by IP-3541.
Currently, on-chain EVM code does not include a reservation format. The code is typically validated by JUMPDEST analysis before each run on the client, resulting in additional overhead and not helping the code update iteration. The innovations described in this EIP introduce a simple, extensible reservation format with relatively low client and coding requirements. This reservation format provides the ability to identify and separate the separation of code and data. This separation capability is especially beneficial for on-chain code validators, such as those used by second-level extension tools such as Optimism.
Saving ERC20-related meaningless gas consumption
Ip-3651 was launched on 12 July 2021 by William Morriss (wjmelements) put forward. The proposal has been approved and will be included in the Shanghai upgrade. This is a transaction type proposal that affects incentives. The COINBASE in question is not the big exchange Coinbase, but the name of the software that miners use to get new tokens online. The concept originated with Bitcoin, where the first transaction in a block is called a creation or COINBASE transaction, a special transaction used by miners to pack and collect gas tips for mining. Whether or not a transaction is pre-loaded before execution is defined as "warm" or "cold." In EIP-2929, cold account access cost (COLD_ACCOUNT_ACCESS_COST) will be charged when the target is not accessed_addresses. In this case, the first transaction is not pre-loaded (cold) and the gas fee will be high. For pre-loaded (warm) transactions, gas charges are reduced.
William Morris proposed in the proposal that each new transaction on the platform at this stage must have multiple interactions with COINBASE software. As the software needs to be "warmed up", the first gas cost will be higher, and as the number of interactions increases, the gas cost will gradually decrease. Williams Morriss proposed in EIP-3651 that COINBASE software could be kept "warm" from the start (pre-loaded) with addresses returned by COINBASE (0x41) in accessed_addresses, This would change the gas fee for the first transaction a miner inserts and encourage payment in ERC20 tokens. The advantage of this proposal is that after the introduction of IP-3651, the miners' package transaction can be used for more purposes and the cost of gas fees will be reduced. At the same time, before the launch of IP-3651, we prefer to use ETH payment, and after the launch, we will encourage the use of ERC 20 payment. The other proposal approved in the Shanghai upgrade, IP-3855, is also a proposal to reduce meaningless gas consumption, and the implementation of both proposals will significantly reduce the cost of Ethereum gas charges.
EOF optimization
Introduce code validation when creating the IP-3540 contract. Reject contracts with undefined directives. This allows code validation to be introduced at contract creation time. Reject contracts that contain truncated push-data or undefined instructions.
Is a proposal to reduce meaningless GAS consumption
For the EVM, the Ethereum virtual machine (the system that executes the contract code), there are several instructions designed, but the previous design of push0 is not designed for the value of 0, and this EIP adds the new instruction of PUSH0(0x5f), which pushes the constant value of 0 onto the stack. The directive requires 2 gas.
The result of the absence of push0 is that some operations that rely on the offset of 0, such as remote call and return, have many arguments that are 0. To operate 0, the only alternative is to use the instruction PUSH1 0, which costs 3 gas. Second, push1 and 0 each take up a byte of initialization code storage, resulting in a 2*200gas higher cost to deploy this contract.
The EIP also calculates the resulting gas losses: 340,557,331 bytes were wasted on the PUSH1 00 instruction in an existing account, representing a deployment loss of 68,111,466,200 gas.
Increase the smart contract system cap and reduce gas
Extended IP-170 by introducing the maximum size limit of initcode (MAX_INITCODE_SIZE = 2 * MAX_CODE_SIZE = 49152). Double the maximum size limit of initcode from 24576 to 49152. Also introduce 2 gas charges per 32 bytes of initcode chunk to represent the cost of jumpdest-analysis.
Purpose: During contract creation, the client must perform jumpdest-analysis on the initialization code before executing initcode. The work performed scales linearly with the size of initcode. Based on EIP170, the initcode size was limited to 24576, and now the maximum size limit of initcode is raised to 49152. The original interim solutions were deployed in multiple contracts and then called on each other, but it is clear that cross-contract referencing is a high gas cost. Obviously, greater code capacity means that the contract size can be doubled and contract developers can deploy richer functionality. In short, IP-3860 is intended to support larger DApps.
Optimize EOF to save gas.
Three new EVM jump instructions (RJUMP, RJUMPI, and RJUMPV) have been introduced, which encode the target as a signed immediate value. These are useful in most, but not all, use cases and can reduce costs.
Optimize EOF to save gas.
Two new opcodes CALLF and RETF are introduced to call such functions and return from them. In addition, the JUMPF instruction was introduced to perform jumps to functions. Dynamic jump instructions are not allowed.
Ip-4200 introduces static jump instructions, which eliminate the need for most dynamic jump use cases, but not everything can be solved with them.
This EIP is designed to eliminate the need for and prohibit dynamic jumps because it provides the most important functionality: calling and returning from functions.
In addition, it aims to improve analysis opportunities by encoding the number of inputs and outputs for each given function and isolating the stack of each function (that is, the function cannot read the caller/called stack).
At the heart of this Shanghai upgrade: support for verifiers to draw from beacon chain to EVM via new "system-level" operation types.
This EIP will introduce a system-level "action" to support a "push" from the beacon chain to the EVM withdrawal. About 14 million ETH are currently held in the beacon chain. The operation of this withdrawal operation will mean that the Ethereum beacon chain pledge withdrawal feature will be activated.
Purpose: This EIP provides a means of access to the EVM for the verifier withdrawal on the beacon chain to enable the withdrawal operation of the pledged ETH. Based on the beacon chain consensus information, the system controls the ETH balance of the specified address unconditionally. In this method, no gas is consumed, and gas is no longer needed to prevent dos attacks. In a word, the purpose of IP-4895 is to realize the pledge withdrawal function.
EOF optimization
Introduce extended validation of code segments to ensure that stack underflow does not occur during the execution of validation contracts.
Existing EVM implementations perform a number of validity checks on each executed instruction, such as checking for stack overflows/underflows, whether there is enough GAS, and so on. This change is intended to minimize the amount of such checks required at runtime by validating at deployment-time -- the time when nothing unusual happens, and to prevent deploying code where it might.
In particular, this extended code validation eliminates the need for EVM stack underflow checks for each executed instruction. It also prevents the deployment of code that can statically prove that it needs more than 1024 stack items, but it is still possible to exceed this limit in some cases, so overflow checking cannot be completely eliminated.
According to the community's latest proposal, verifiers can make partial and full withdrawals, and for security reasons, the amount of withdrawals and the exit rate of verifiers will be limited. The maximum number of withdrawals per Epoch is set to 512. Based on the number of existing validators, they can withdraw one reward in 4 days (total number of validators/(512*225). Based on the average balance of the current validator of nearly 33.9 ETH, the maximum average daily selling pressure on the Ethereum market is 230,000 ETH, for a 4-day cumulative amount of 921,000 ETH.
The exit rate in all withdrawals is limited. A "Churn Limit Quotient" is introduced in the exit mechanism. The limit of ETH withdrawals is X/ETH per day, where X is the total number of validators /65536. Currently only 7 validators can be activated per Epoch and are allowed to quit, which is 1575 validators per day (225 epoches). If each verifier holds 32 ETH, more than 50,000 ETH is flowing out every day. Of course, the withdrawal rate is also adjusted according to the total amount of ETH pledged to prevent large outflows of funds and confiscation attacks by the attacker. For partial withdrawals, there is no specific limit on the number of withdrawals.
It should be noted that the verifier's effective pledge balance should be more than 32 ETH. If it is less than this amount, the verifier will not get the full pledge reward, or if the balance is less than 16 ETH, it will be expelled from the verifier. At present, the withdrawal plan to be determined by the verifier can be divided into partial withdrawal and full withdrawal of pledge money. Partial withdrawal allows the verifier to withdraw more than 32 ETH, and full withdrawal will withdraw all pledge money and withdraw from the pledge line.
However, developer Potuz has come up with a new solution that eliminates the processing of withdrawal queues
That is, cancel all and part of the withdrawal queue logic in the block. It is recommended to use the validator index for this problem. The reason is that each verifier on Ethereum is assigned a number when it is activated on the beacon chain. Without the queued exit mentioned above, the beacon chain can scan the verifier based on the maximum number of withdrawals that a block can handle, and then process each verifier's withdrawal request in ascending order of the verifier's index number. Currently, the developers are studying this as an alternative.
We can see that the main purpose of this upgrade is to optimize the details of EOF, reduce gas, and release the ETH of the beacon chain lock bin. Ip-4844,1153,2537, which is not on this main line, although also very important, has been delayed.
• The long-term direct benefits will come from complex contract racetracks that are stuck in gas jams. ETH's pos mortgage volume will eventually grow significantly.
• Medium term gains are around some of the entire ecological chains associated with mev centered around the verifier scale, particularly traditional pools.
• Short-term gains I wonder if some memes that get a ride on the concept of "Shanghai" will have a chance to steal chicken. With the release of ETH mortgage, some ETH in prison for several years may produce some potential short-term selling pressure on the market.
Link to original article
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia