V God's new article: Multi-dimensional Gas pricing, improving Ethereum scalability

CN
1 year ago

Original:Multidimensional gas pricing

Compiled by: Odaily Planet Daily Asher

V God's New Article: Multidimensional Gas Pricing to Improve Ethereum Scalability

In the Ethereum network, resources are limited and priced through a single resource called "Gas." Gas measures the "computational effort" required to process specific transactions or blocks. Gas integrates various types of "efforts," the most important of which are:

  • Original calculations (such as ADD, MULTIPLY)

  • Reading and writing Ethereum storage (such as SSTORE, SLOAD, ETH transfers)

  • Data bandwidth

  • Cost of generating ZK-SNARK proofs

For example, this transaction cost a total of 47085 Gas. This includes: (i) a "base fee" of 21000 Gas; (ii) 1556 Gas used for calldata bytes as part of the transaction; (iii) 16500 Gas used for reading and writing storage; (iv) 2149 Gas used for creating logs; the rest is used for executing EVM. The transaction fee that users must pay is proportional to the Gas consumed by the transaction. A block can contain a maximum of 30 million Gas, and the Gas price is continuously adjusted through the EIP-1559 target mechanism to ensure that the average block contains 15 million Gas.

V God's New Article: Multidimensional Gas Pricing to Improve Ethereum Scalability

Demonstration case

This approach has a major advantage: because all transactions are merged into a virtual resource, the market design is very simple. It is easy to optimize transactions to minimize costs, and it is relatively easy to optimize blocks to collect as high fees as possible (excluding MEV), and there are no strange incentive mechanisms that encourage certain transactions to be bundled with others to save costs.

However, this approach also has a major inefficiency issue: it treats different resources as interchangeable, while the actual fundamental limitations that the network can handle are not. One way to understand this problem is to look at the figure below:

V God's New Article: Multidimensional Gas Pricing to Improve Ethereum Scalability

If 𝑛 resources have significant security limitations, then one-dimensional Gas may reduce throughput by up to 𝑛 times. Therefore, people have long been interested in the concept of multidimensional Gas, and through EIP-4844, we can actually use multidimensional Gas on Ethereum today. This article discusses the benefits of this approach and the prospects for further improving this approach.

Blobs: Multidimensional Gas after the Cancun Upgrade

At the beginning of this year, the average block size was 150 kB. A large part of this is convolution data: for security reasons, data is stored on-chain in L2 protocols. The cost of this data is high: although transaction costs on the convolution are 5-10 times lower than the corresponding transaction costs on Ethereum L1, it is still too high for many use cases.

This problem was ultimately solved by introducing a separate data space (called "Blobs") in each block that is convenient for convolution.

After the Cancun upgrade, an Ethereum block can contain a maximum of (i) 30 million Gas and (ii) 6 Blobs, each Blob can contain about 125 kB of calldata. Both of these resources have independent prices, adjusted by a mechanism similar to EIP-1559's independent pricing mechanism, with the goal of averaging 15 million Gas and 3 Blobs per block.

As a result, the cost of convolution has been reduced by 100 times, the volume of convolution transactions has increased by more than 3 times, and the theoretical maximum block size has only slightly increased: from 1.9 MB to 2.6 MB.

V God's New Article: Multidimensional Gas Pricing to Improve Ethereum Scalability

Transaction fees for rollups, provided by growthepie.xyz. The Dencun fork occurred on March 13, 2024, introducing multidimensional pricing for Blobs.

Multidimensional Gas and Stateless Clients

In the future, stateless clients will face the problem of storing proofs. A stateless client is a new type of client that can verify the blockchain with little or no local storage of data. It accepts proofs to verify the Ethereum state of specific parts of a block without storing any data itself.

An average block performs about 1000 storage read and write operations, but the theoretical maximum could be in the tens of millions. The current plan is to support stateless clients by migrating Ethereum's state tree design from Merkle Patricia trees to Verkle trees. However, Verkle trees are not quantum-resistant and are not suitable for newer STARK proof systems.

Therefore, many people hope to support stateless clients through binary Merkle trees and STARKs, completely bypassing Verkle, or upgrading a few years after the Verkle migration. Although STARK proofs of binary hash tree branches have many advantages, the speed of generating proofs is slow and cannot meet high-speed demands.

Expectedly, there will be a period in the future where it is possible to prove 1000 values in less than a second, but the speed of proving 14,285 values cannot be achieved. To address this issue, the concept of multidimensional Gas is proposed. This approach can separately limit and charge storage access, ensuring an average of 1000 storage accesses per block, while setting the limit for each block to 2000 times to improve network security and efficiency.

Wider Application of Multidimensional Gas

The growth of state size is another resource that needs to be considered. As Ethereum's state size increases, full nodes need to hold more data. Unlike other resources, the limitation of state size growth mainly comes from long-term continuous usage rather than short-term peaks. Therefore, to handle state size growth operations, it may be considered to add a separate dimension of Gas. The goal of this approach is to set a floating price with a specific average usage as the target, rather than setting a limit for each block.

This demonstrates the powerful characteristics of multidimensional Gas, which can address different issues for each type of resource: (i) what is the ideal average usage for each resource; (ii) what is the maximum safe usage for each resource per block. By setting these parameters, Gas prices can be adjusted based on the network's security situation, rather than adjusting based on the maximum usage of each block. In handling more complex situations, multiple types of Gas can be used, for example, a zero to non-zero SSTORE operation may require different types of Gas, such as stateless client proof Gas and storage extension Gas.

Maximum Value per Transaction: A Weaker but Simpler Strategy for Obtaining Multidimensional Gas

In a single-dimensional Gas system, the cost of a transaction's Gas is determined by the Gas consumed by both data and computation. However, in a multidimensional Gas system, the Gas cost can be determined based on the primary resources consumed by the transaction. This method improves throughput while maintaining security.

EIP-7623 proposes a similar approach, reducing the space occupied by transactions in a block by increasing the minimum price per byte, but this also leads to some issues, such as transactions that consume a large amount of a single resource still needing to pay high fees, and it also creates the motivation to bundle data-intensive and computation-intensive transactions together to save costs. Although this method has its limitations, the benefits it brings are worthwhile, but there are more ideal solutions if more development work is willing to be invested.

Multidimensional EIP-1559: A More Challenging but More Ideal Strategy

The core of multidimensional EIP-1559 is to adjust the base fee of Blobs by tracking the excess_blobs parameter to ensure that the average usage of blocks remains at the target level.

When the number of Blobs in a block exceeds the target value, the base fee increases to reduce usage; conversely, it decreases. This pricing mechanism dynamically adjusts transaction prices within blocks to maintain the state of blocks being half-filled. Additionally, a sudden surge in usage triggers a restriction mechanism in the short term, ensuring reasonable competition for transactions.

In Ethereum, this type of pricing for Gas has existed for many years: as early as 2020, EIP-1559 introduced a very similar mechanism. With the introduction of EIP-4844, Gas and Blobs are now using two floating prices separately.

For users and block builders, the experience is similar to before, but they need to adapt to two separate fees. However, for developers, it requires a redesign of EVM functionality to adapt to an environment with multiple prices and limits, which may pose some challenges.

Multidimensional Pricing, EVM, and Subcalls

In the EVM, there are two Gas limits: each transaction sets a total Gas limit, and there is a separate Gas limit when a contract calls another contract. This allows contracts to call untrusted contracts while ensuring that there is still remaining Gas for other computations after the call. However, implementing multidimensional Gas pricing between different types of executions presents challenges. This multidimensional approach requires subcalls to provide multiple limits for each type of Gas, which would deeply change the EVM and may not be compatible with existing applications.

Multidimensional Gas proposals typically only stay on two dimensions: data and execution. Data allocation is outside the EVM, so it can be priced separately without internal changes. For developers, this means a need to redesign the EVM and its surrounding infrastructure to adapt to multiple prices and limits. In some cases, optimization may become more difficult because it is not clear which method is more effective, which may affect the development process.

Although there are some challenges, these issues can be addressed by implementing a solution similar to EIP-7623. This solution can charge additional fees for storage operations and provide refunds at the end of transactions to ensure that the main call still has enough Gas to perform subsequent operations.

Conclusion

Regardless of the situation, it is worth emphasizing that once multidimensional Gas execution is introduced, the complexity of the system will significantly increase, which seems to be unavoidable.

Therefore, we are faced with a complex choice: whether to accept more complexity at the EVM level in exchange for significant gains in releasing L1 scalability, and if so, which specific proposal is more suitable for protocol economics and application developers? It is very likely that the best solution is neither the ones mentioned earlier nor the ones mentioned above, and there is still room for more elegant and effective solutions to be proposed.

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

Share To
APP

X

Telegram

Facebook

Reddit

CopyLink