Rollup Gas Estimation: A Problem in Need of Solutions

Table of Contents
Layer 2 (L2) Gas plays a crucial role in scaling the capabilities of the underlying blockchain networks. These solutions aggregate multiple transactions into a single batch, reducing the load on Layer 1 (L1) networks and making transactions faster and more cost-effective. However, the calculation and management of gas fees in L2 environments present unique challenges. In this article, we will delve into the intricacies of L2 gas estimation, the role of bundlers in charging users, and proposed solutions to address these challenges.

I: Calculating L2 Gas

Gas costs on Layer 2 are the lifeblood of any decentralized network. Understanding how L2 gas fees are calculated is fundamental to effective blockchain management. L2 gas estimation involves several key components:
- Gas Cost Formula on L2s: L2 networks determine the gas fees based on complex formulas, often factoring in the size of the data in bytes after compression. For example, Arbitrum uses a formula that takes into account data size after Brotli compression.
- L1 Calldata Fees on L2s: L2s must interact with the Layer 1 blockchain, incurring calldata fees. These fees are paid by the L2 networks and subsequently charged to users.
- L2 Gas Estimation Methods: Different L2 solutions, such as Arbitrum and Optimism, employ various methods to estimate gas costs for transactions. Optimism, for instance, deducts ETH directly from the sender's account.

II: Charging Users on L2s

Role of Bundlers in Charging Users
In the Layer 2 (L2) ecosystem, bundlers play a pivotal role in streamlining transactions and optimizing gas usage. These entities serve as intermediaries that aggregate multiple UserOperations (UOs) into batches, making the entire process more efficient. To better understand the role of bundlers in charging users on L2s, let's explore their responsibilities and the dynamics involved:
1. Bundling UserOperations (UOs):
Bundlers act as transaction aggregators, taking individual UOs and packaging them into a single batch. This bundling process is crucial for two main reasons:
- Efficient Gas Utilization: Bundlers optimize gas usage by combining multiple UOs into a single transaction. By doing so, they reduce the overall gas cost, making transactions more economical for users.
- Streamlined L1 Interaction: Bundlers bundle transactions and interact with the Layer 1 (L1) blockchain on behalf of users. This interaction incurs L1 calldata fees, which the bundlers handle. Users are thus shielded from the complexities of L1 fee management.
2. L1 Calldata Fees for Bundlers:
While bundlers take on the responsibility of interacting with the L1 blockchain, they, too, must pay L1 calldata fees for their transactions. These fees are associated with the data transmitted to L1 during the interaction. Understanding and managing L1 calldata fees are essential for bundlers, as they impact the cost structure of the transactions they bundle.
In essence, bundlers act as a bridge between L2 and L1, simplifying the user experience. Users can submit their UOs to bundlers, who then handle the intricacies of gas estimation, L1 fee management, and transaction bundling. This offloading of responsibilities to bundlers is a key feature of L2 solutions, making blockchain technology more accessible and user-friendly.
As bundlers continue to evolve and adapt to the changing landscape of L2 solutions, their role in charging users and optimizing gas costs will remain instrumental. Users can rely on bundlers to handle the technical complexities, ensuring that their transactions are cost-effective and efficient.
In conclusion, bundlers are essential components of L2 ecosystems, streamlining gas estimation and fee management. Their role in aggregating transactions and dealing with L1 calldata fees is central to the usability and scalability of Layer 2 solutions, making blockchain technology more accessible to a wider audience.

III: Challenges in L2 Gas Estimation

The Signature Aggregator Problem
One of the prominent challenges in L2 gas estimation is the "Signature Aggregator Problem." Signature aggregation reduces calldata costs on L2s through signature compression, but the gas cost calculation for this operation is not metered by the entry point.
Entry Point Changes to Address Challenges
To overcome these challenges, there's a need for potential entry point changes that can improve the overall L2 gas estimation process. However, such changes might introduce potential user experience (UX) issues.

IV: Proposed Solutions

Attempt 1: Increase maxPriorityFeePerGas
One solution is to increase the `maxPriorityFeePerGas`, which could help in optimizing the gas estimation process. However, this approach can lead to overpayments by users, as the buffer priority fee component is multiplied by the call gas used.
Attempt 2: Manipulate preVerificationGas
Another approach involves manipulating the `preVerificationGas` value. While it can be effective, there are significant UX issues, particularly when the L1_fee differs from the L2_fee ratio between estimation and bundling.
Optimism Edge Case and its Solution
The Optimism edge case requires exceptionally high preVerificationGas, posing a challenge for users. A solution is to set the priority fee as a static percentage of the base fee to mitigate this issue.

V: Addressing PreVerificationGas Challenges

Proposed Solutions for preVerificationGas
The challenges arising from the manipulation of `preVerificationGas` call for a comprehensive strategy to enhance gas estimation on Layer 2 networks. Here, we explore potential solutions to mitigate the issues associated with this vital component of gas calculation:
Increasing PreVerificationGas: One possible remedy is to increase the `preVerificationGas` value. By setting it at a higher threshold, we can provide more leeway in gas estimation. This approach can help ensure that gas fees are more accurately estimated, reducing the likelihood of unexpected overpayments or transaction failures. 
  However, it's important to note that increasing `preVerificationGas` comes with its own set of considerations. While it can improve gas estimation accuracy, it may introduce certain limitations:
  1. Restricting Bundle Size: A higher `preVerificationGas` value can constrain the size of transaction bundles. This restriction might affect the efficiency and scalability of L2 networks, as bundlers would need to manage their operations within these constraints.
  2. Restricting Users from Bidding Up or Down: Users' flexibility in adjusting their transaction fees may be limited, as the increased `preVerificationGas` would affect their ability to fine-tune their transactions to suit their preferences.
  3. Peer-to-Peer Network Considerations: In decentralized peer-to-peer networks, bundlers may have varying bundle sizes. A standardized `preVerificationGas` may not accommodate these differences efficiently.
  Potential Entry Point Solutions
Addressing the `preVerificationGas` challenges goes beyond simple adjustments. It involves considering potential entry point solutions that can provide a systematic and effective approach to gas estimation. Here are two notable entry point solutions:
1. L2-L1 Calldata Gas Metering:
This solution involves introducing a new limit-based gas field in L2+ entry point versions. This field would facilitate the on-chain metering of L1 calldata gas costs. The primary advantage of this approach is that it ensures the exact cost of L1 calldata gas can be accurately measured. It minimizes overhead and ensures that UserOperations (UOs) are charged precisely for the gas they consume.
2. Signature Aggregator Gas Metering:
To address the issues surrounding the unmetered gas consumption of signature aggregation, the solution is to meter the gas usage during the `aggregator.validateSignatures` process. This involves measuring the gas consumption of aggregated user operations and deducting it evenly from the `verificationGasLimit`. By implementing this approach, the gas estimation process becomes more transparent and responsive to the actual gas consumption.
These entry point solutions aim to enhance the accuracy of gas estimation on Layer 2 networks, providing a solid foundation for seamless and efficient blockchain operations.

Conclusion

The realm of L2 gas estimation is complex and dynamic, evolving alongside the growing blockchain ecosystem. As L2 solutions continue to mature and adapt, addressing the challenges in gas estimation will be crucial to ensuring a seamless and user-friendly experience for all participants. Implementing potential entry point changes and innovative solutions will play a pivotal role in this ongoing journey of optimization and efficiency.

About Orochi Network

Orochi Network is a cutting-edge zkOS (An operating system based on zero-knowledge proof) designed to tackle the challenges of computation limitation, data correctness, and data availability in the Web3 industry. With the well-rounded solutions for Web3 Applications, Orochi Network omits the current performance-related barriers and makes ways for more comprehensive dApps hence, becoming the backbone of Web3's infrastructure landscape.
Categories
Event Recap
3
Misc
56
Monthly Report
1
Oracles
4
Orand
3
Orosign
19
Partnership
20
Verifiable Random Function
9
Web3
86
Zero-Knowledge Proofs
36
Top Posts
Tag
Orand
NFT
Misc
Web3
Partnership Announcement
Layer 2
Event Recap
Immutable Ledger
Oracles
Verifiable Random Function
Zero-Knowledge Proofs
Multisignature Wallet

Orosign Wallet

Manage all digital assets safely and securely from your mobile devices

zkDatabaseDownload Orosign Wallet
Coming soon
Orochi

zkOS for Web3

© 2021 Orochi