Dr. DODO is Researching

Posted on Jan 17, 2024Read on Mirror.xyz

Deciphering L2 MEV: Sequencer Workflow & MEV Data Analysis

Author: Burce & Hildobby

Thanks to Hildobby, the data analyst from Dragonfly Capital, for his support of L2 MEV data.

Crucial Role of L2 MEV: Sequencer

As a vital component of Ethereum's Layer 2 solutions, the L2 Sequencer plays a crucial role. Its primary task involves processing transactions, namely packaging them and submitting them to either the Ethereum mainnet or off-chain networks, thereby enhancing the throughput and efficiency of the entire blockchain ecosystem. Specifically, the Sequencer functions similarly to the transaction pool on the Ethereum mainnet but operates in a more specialized manner and scope. Moreover, the L2 Sequencer offers greater operational freedom for applications and smart contracts, enabling more complex logic and contracts at the L2 level without concern for high gas fees.

Workflow of the Sequencer

  1. Collection The Sequencer receives transaction requests from users, typically in the format of Ethereum transactions. The transactions are sent to the Layer 2 network instead of the main chain.

  2. Verification The Sequencer verifies the transactions, ensuring the sender has sufficient funds to execute the transaction and that it complies with Layer 2 network rules. It also ensures the validity of the transactions to prevent fraud and double-spending.

  3. Ordering Transactions are ordered according to certain rules by the Sequencer to ensure they are executed in the correct order, preventing potential transaction conflicts.

  4. Submission Once verified and ordered, the Sequencer submits the transactions to the Layer 2 network for execution. This typically involves interacting with Layer 2 smart contracts, updating states, and ensuring that the ledger on Layer 2 remains synchronized with the Ethereum mainnet ledger.

Different L2 Sequencers

Arbitrum

To minimize MEV issues, Arbitrum doesn't have a public mempool and employs a first-come-first-served (FCFS) ordering model, ensuring that transactions submitted earlier are processed sooner.

Optimism

Optimism uses an auction-based ordering system, known as the MEV Auction (MEVA), to equitably allocate the advantages and disadvantages of transaction processing. After the Bedrock upgrade, Optimism introduced the Bedrock Sequencer, which operates in conjunction with MEVA for transaction ordering. Similar to Arbitrum, the Bedrock sequencer maintains a private mempool. Although MEVA is not fully implemented yet, according to the current plans, the winner of the MEVA will have the authority to reorder the submitted transactions and insert their own, but cannot delay any specific transaction beyond N blocks, thus limiting the MEV profits for the MEVA winner.

Ordering Rules of Other L2 Solutions

In addition to Arbitrum and Optimism, various other L2 solutions like zkSync, Loopring, Starknet, and others have developed their unique ordering rules, tailored to suit the requirements of diverse users and applications.

MEV Extraction in L2

The emergence of MEV (Maximum Extractable Value) is rooted in the delay between the dissemination of transaction information by users across the network and the actual generating of blocks. This time gap provides nodes an opportunity to take strategic actions. Due to the decentralized nature of these systems, the sequence and timing in which different nodes receive transactions can vary, leading to a situation where the system cannot ensure a uniform state across all nodes at the same moment. This inconsistency paves the way for the emergence of MEV.

On chains like Ethereum, extracting MEV has evolved into a significant profit-making enterprise. MEV attackers typically monitor the mempool for transaction activities, securing priority processing for their transactions either through participation in Gas Auctions (bidding higher fees for transaction priority) or by off-chain bribes. This allows them to benefit from predetermined transaction sequences.

Extracting MEV profits involves two critical steps. First, attackers identify potential profitable transactions and construct a block optimized for extracting MEV. Second, they ensure these specially tailored transactions are accepted by the network and included into the blockchain.

However, the advent of Layer 2 (L2) solutions has notably altered MEV extraction methods and strategies. With many L2 solutions having centralized sequencers, the extraction of MEV in L2 environments presents unique challenges and opportunities, contrasting with traditional Layer 1 (L1) solutions.

In L2 solutions without a mempool, monitoring transactions is more challenging. Here, the sequencer wields greater power, directly determining the transaction order. Without a mempool, attackers cannot manipulate the transaction order as they could in L1 solutions, significantly increasing the difficulty of MEV attacks.

Yet, even in L2 solutions with centralized sequencers, the influence of Gas Auctions on transaction ordering is lessened. Some L2s lack Gas Auctions entirely, changing the dynamics of the game. Attackers, though unable to decide the exact transaction order, can still try to influence their transaction's positioning by adjusting Gas Fees. This strategy, however, is much less predictable and successful compared to Ethereum Mainnet.

Furthermore, some independent DAPPs on L2 may maintain their local transaction mempools like Jito on Solana. These become potential targets for attackers, who may exploit these DAPP-specific mempools for MEV extraction.

For L2 chains like Polygon that run Gas Auctions, becoming a validator is not completely open and permissionless. In such scenarios, when attackers identify MEV opportunities, they might resort to submitting numerous transactions to increase the chances of their transaction being included in the chain. This approach relies more on luck and lower transaction costs, making it a less reliable attack method.

Finally, attackers might leverage the interactions between L1 and L2 or among different L2 solutions to extract MEV. This requires a sophisticated understanding and analysis of cross-chain states and dynamics.

Variations in MEV Extraction Spaces Across Different L2s

The landscape for MEV extraction significantly differs across various L2 solutions. These differences primarily stem from factors like the ordering rules of L2 sequencers, mempool designs, and the volume and scale of transactions. Typically, the higher the centralization of the sequencer in an L2 solution, the more concentrated the MEV extraction space becomes, thus offering relatively fewer opportunities for extraction. Conversely, more open mempool designs provide greater scope for attackers to monitor transactions and manipulate order, expanding the MEV extraction space.

Additionally, the transaction volume and scale within an L2 solution greatly influence the MEV extraction landscape. L2s with large transaction volumes and scales present more MEV extraction opportunities, as more profitable transactions exist in high-traffic scenarios, offering attackers a broader spectrum for profit extraction. In contrast, L2s with smaller transaction volumes and scales present a narrower MEV extraction space, as opportunities are inherently fewer.

Future Solutions to L2 MEV

One of the fundamental issues in blockchain technology is achieving true decentralization. In the context of L2, this centers around the implementation of decentralized sequencers, which are crucial for determining the order of transactions. This directly impacts the fairness, security, and other key performances of the blockchain system. The MEV issue in L2 is essentially a derivative of the transaction ordering problem. Most L2 solutions currently utilize centralized sequencers, leading to opaque MEV extractions. Potential directions for solutions include mechanisms for decentralizing sequencers and outsourcing the ordering right to third parties.

Decentralized Sequencers

  1. Blockspace Auctions: These involve allocating sorting rights through bidding. Participants publicly bid for a specific time slot's block space, then gain sorting rights for that block. This approach's transparency and competitiveness can encourage more reasonable pricing. However, it may lead to the "winner's curse," where the successful bidder overbids and incurs a loss.

  2. Random Leader Election: This method randomly selects a leader from a pool of qualified participants, such as users who have staked 32 ETH, similar to Starknet's random selection method. Its advantage lies in its randomness, reducing potential unfair competition, but it may overlook participants' capabilities and contributions, potentially leading to lower efficiency.

  3. Proof-of-Work: This approach involves numerous potential sequencers competing to construct a block, with the most efficient or fastest contender winning. It encourages technological innovation and efficient operation but may result in significant resource wastage.

  4. Economic Competition: Different participants compete to achieve optimal economic outcomes. For example, block inclusion order might be determined based on block fees. This flexible approach allows for various designs, such as MEV redistribution and MEV auctions, encouraging economic mechanisms for block construction. While it promotes market vitality, it could also allow a few entities to monopolize sorting rights through competitive advantages.

  5. Fair Sequencing: An algorithmic method for directly ordering transactions, essentially a language and network. Chainlink has already implemented this solution. Its advantage is in limiting the space for extracting MEV value through transaction order manipulation, but the downside is that DAPPs might perform poorly under fair sequencing, and its applicability rules are not widely suitable.

The implementation of decentralized sequencers could promote fairness and transparency and enhance overall system security. However, it also poses challenges like resource wastage and market barriers. From a future perspective, L2s are likely to evolve towards decentralized sequencers, but for efficiency and cost considerations, most will probably maintain centralized sequencers for now.

Outsourcing Sequencing Rights to Third Parties

  1. Shared Sequencers, such as Espresso and Astria: They focus on providing ordering services and organize ordering in specific ways. Chains integrating their services don't need to handle ordering. This standardizes and professionalizes ordering work but might introduce external dependencies, affecting decentralization.

    From a personal perspective, shared sequencers embody a modular approach. However, it's also worth considering that developing feasible decentralized solutions and mechanisms for block construction and transaction ordering is an integral part of building a public chain. With the rise of modularization, shared sequencers might become widely used.

  2. Organizing cross-chain MEV auctions, indirectly providing ordering services, like SUAVE: SUAVE is essentially a chain, and using its solution means outsourcing block construction and mempool services to SUAVE.

    Characteristics of SUAVE include: SUAVE itself does not capture MEV (except for gas fees); searchers (expressing their preferences on SUAVE) extract MEV by requiring executors to accept their transaction bundles (including cross-chain MEV); executors also capture part of the searcher's MEV (paying back as much as possible to the searchers). This method's advantage is optimizing resource allocation through open markets, but it increases system complexity and may reduce decentralization to some extent.

  3. Outsourcing block construction to L1, like Based Rollup (e.g., Taiko):

    L1 has built a sufficiently decentralized system capable of decentralized ordering services. MEV extraction in Based Rollup works as follows: a natural portion of MEV flows to Ethereum, strengthening L1's economic security; L2 searchers (creating L2 transaction bundles) and L2 builders (running mev-boost) also get a share of MEV; if L2 searchers monitor the Ethereum mempool, the Rollup mempool, and the state of both chains, they can also capture cross-chain MEV value. This approach is feasible but has a ceiling not exceeding current solutions. With Ethereum's current architecture allowing significant MEV extraction, entrusting ordering rights to L1 does not improve the MEV ecosystem.

    Outsourcing block proposals to third parties offers advantages in resource optimization and risk diversification but also poses potential threats to decentralization.

L2 MEV Data

The Dune dashboard created by the researcher of Dragonfly @hildobby shows the current MEV data of various L2s.

Polygon

There are relatively fewer sandwich attacks on Polygon, with the majority of the time being below 1%. In September of this year, it reached a peak of around 2.3%. Based on the trading volume, the volume of transactions affected by sandwich attacks is very low.

Sandwich trades ratio

Sandwich trading volume

Arbitrage trading on the Polygon network has a higher proportion and significantly greater transaction volume compared to sandwich attacks.

Atomic arbitrage trades ratio

Atomic arbitrage trading volume

Arbitrum

Since 2023, the proportion of sandwich attacks in block transactions on Arbitrum has dropped to a sufficiently low level. In terms of trading volume, the total volume is several billion dollars, and the volume of transactions involved in sandwich attacks is only several hundred thousand dollars, which is also very small.

Sandwich trades ratio

Sandwich trading volume

Compared to other chains, the proportion of arbitrage trading on Arbitrum is relatively small. However, compared to sandwich trades on Arbitrum, the transaction volume of arbitrage trades is still considerably larger.

Atomic arbitrage trades ratio

Atomic arbitrage trading volume

Optimism

On Optimism, things are different. The proportion of sandwich attacks in block transactions once reached as high as 62.7% but has gradually decreased over time. Recently, the proportion of sandwich attacks has dropped to a sufficiently low level due to the bedrock upgrade that brings new gas mechanism like EIP-1559. In terms of trading volume, the scale of sandwich attacks has decreased to a few thousand dollars.

Sandwich trades ratio

Sandwich trading volume

On Optimism, the proportion of arbitrage trades ranges between 2% and 4%, showing a decline compared to last year. The volume of arbitrage trades is relatively low.

Atomic arbitrage trades ratio

Atomic arbitrage trading volume

Conclusion

In summary, the relationship between L2 Sequencers and MEV is of significant importance for the development of the ETH ecosystem. Currently, L2 faces the challenge of ensuring fair and transparent sorting mechanisms to prevent MEV extraction. However, the complexity and diversity of L2 solutions bring numerous challenges, including resistance to MEV and ensuring fair and transparent sorting mechanisms. At this stage, some viable solutions exist, such as Shared Sequencers and cryptographic methods to protect the privacy of transaction ordering.

In the future, practical solutions may focus more on the decentralization of Sequencers to reduce the potential space for MEV extraction. Meanwhile, outsourcing block generation to third parties could be considered to enhance the overall fairness and efficiency of the network system. On the other hand, the emergence of cross-chain MEV requires a reevaluation of MEV's definition and significance, exploring new approaches like Slot Auctions and Interchain Schedulers.

Lastly, research topics include quantifying MEV on L2 chains and the impact of PGAs on L2 remain to be discussed. Solving these issues will help further refine MEV resistance strategies in the L2 domain.

Reference

https://taiko.mirror.xyz/VjNjFws6OOVez5YCDMwjy4BUiDqZBHYDvcW4-JZGDkc

https://timroughgarden.github.io/fob21/reports/r11.pdf

https://explore.marlin.org/#/

https://arxiv.org/pdf/2112.01472.pdf

https://www.panewslab.com/en/articledetails/2nlmo28j.html

https://ethresear.ch/t/mev-for-based-rollup/15636

https://public.bnbstatic.com/static/files/research/ethereums-rollups-are-centralized-a-look-into-decentralized-sequencers.pdf

Dune Dashboard:

https://dune.com/hildobby/sandwiches?Blockchain=optimism

https://dune.com/hildobby/atomic-mev