# Overview As described in the RFC post, Aztec's sequencer selection design leaves block building entirely up to the sequencing nodes. This allows for the outsourcing of block production, potentially creating a market structure similar to the status quo between MEV-Boost and Ethereum validators. We propose a method of integrating [Astria's decentralized shared sequencer](https://forum.aztec.network/t/request-for-comments-aztec-sequencer-selection-and-prover-coordination-protocols/3038#exiting-14) into Aztec's sequencer nodes to provide this off-chain block building infrastructure. Leveraging Astria's decentralized MEV marketplace and much quicker finality, Aztec sequencer nodes can provide MEV searching infrastructure and fast preconfirmations for bundle inclusion without sacrificing security or introducing centralized points of failure. ## Background: Astria ![image](https://hackmd.io/_uploads/r1YPfdCnT.png) ### Write Path: Transaction Submission 1. Users sign a transaction via a wallet, submitting it to the rollup node (e.g. Astria's modified Geth), which is then gossiped to the rollup’s mempool. 2. The `Composer` is a developer tool we have created to act as a gas station. It retrieves pending transactions from the rollup node’s mempool, then wrapping them in an Astria transaction and submitting them to Astria’s mempool. 3. Astria's shared sequencer constructs a cross-rollup "meta-block", finalizing an ordering over the data posted to multiple rollups' namespaces at once. 4. The finalized shared sequencer blocks are posted to Celestia, allowing rollups to leverage strong guarantees over data availability for cheaper. ### Read Path: Block Retrieval and Execution 5. Each rollup runs its own instance of the `Conductor`. The `Conductor` reads and validates rollup data from finalized Astria blocks. 6. Filtered blocks are passed to the rollup node (e.g. Geth) using Astria’s Execution API, and are then executed by it, resulting in an updated rollup state and state root. This is how a rollup derives its state from the sequenced data posted to and made available by the data availability layer. ## `Conductor` ![image](https://hackmd.io/_uploads/SkRtGu0hT.png) The [Astria `Conductor`](https://hackmd.io/@astriaorg/HJ6cCpp9T#22-The-Astria-Conductor) is a sidecar process that a rollup node operator runs alongside the rollup node. It acts as a light client of the shared sequencer and data availability networks, pulling in Astria and Celestia blocks, validating them and feeding them into the rollup node using the Execution API. ## The Astria Execution API Astria integrates block production infrastructure into rollup architectures by running a `Conductor` instance as a sidecar to the rollup node. The sidecar reads and validates finalized Astria blocks for the rollup's data and communicates with the rollup-specific software using Astria's [Execution API](https://github.com/astriaorg/astria/blob/main/specs/execution-api.md). While an in-depth explanation of the API and the specific request semantics can be found in the [specification document](https://github.com/astriaorg/astria/blob/main/specs/execution-api.md) and the [protobuf definitions](https://github.com/astriaorg/astria/blob/main/proto/executionapis/astria/execution/v1alpha2/execution.proto), the main request of interest in this situation is `ExecuteBlock`. ![image](https://hackmd.io/_uploads/SyB28xT26.png) # Astria-Driven Aztec Sequencer Node ![image](https://hackmd.io/_uploads/Bk-h1bpjT.png) As described in the [RFC](https://forum.aztec.network/t/request-for-comments-aztec-sequencer-selection-and-prover-coordination-protocols/3038), Aztec sequencer nodes are chosen apriori according to a ranking generated by RANDAO. This allows traders and arbitrageurs to know who the sequencer will be for a given slot ahead of time. If the sequencer for a given slot is known to support using Astria for orderflow, users can choose to route their transactions via Astria's MEV markets during that slot. This proposal will have an Aztec sequencer node run both a p2p mempool and take in transactions from Astria's `Conductor` via the Execution API. As described in the diagram above, the top of the proposal will be deterministically derived from the `ExecuteBlockRequest`s. ## Block Timing ![image](https://hackmd.io/_uploads/HJwZPv0ha.png) As Aztec requires validity proofs to be generated for blocks to be finalized, it will operate on much longer block times than Astria's lazy sequencing model. This allows the Aztec sequencer to use Astria for fast preconfirmations on high-value transactions, providing an interim solution that balances the need for security with the demand for speed. Fast preconfirmations are especially valuable in a long block time environment. Slow confirmation time typically causes financial applications to suffer, as DEX prices become stale and slow oracle updates lead to larger liquidation cycles. This results in large amounts of value leakage from users available for extraction in each block, and provides the Aztec sequencer a monopoly over extraction. Providing fast preconfirmations using a decentralized shared sequencer network allows the Aztec sequencer nodes to reduce uncertainty for traders and arbitrageurs by reducing the delay for confirmation they receive on ordering. Less uncertainty directly translates to reduced operational risk and thus lowering costs inherent to activities such as inventory management. At the end of the slot, the Aztec sequencer node will construct a proposal from both avenues of orderflow: the Astria shared sequencer and the Aztec p2p mempool. However, transactions sequenced via Astria will have their preconfirmations as soon as an Astria block is constructed, allowing for financial applications to operate more smoothly. ![image](https://hackmd.io/_uploads/SkH5SP02T.png) ## Private and Public Transaction Flow ![image](https://hackmd.io/_uploads/HyYT1bpj6.png) The above diagram is based on Aztec's [private transation lifecycle](https://docs.aztec.network/learn/concepts/transactions#simple-example-of-the-private-transaction-lifecycle), and visualizes the data flows for both public and private transactions. With regards to preconfirmations/MEV infrastructure and private versus public transactions, there a few "user experiences" that are enabled by the construction described in this document: 1. Private transaction that is not impacted by ordering - A user that wishes to make a private transfer, for example, where ordering has no impact on its execution, is able to send the transaction directly to the Aztec node via the p2p network. This is no different than the default behavior. Specifically, this proposal is purely additive, allowing users who don't wish to pay for ordering and preconfirmations to simply not do so. 2. Private transaction that is impacted by ordering - As Astria operates a lazy sequencer model, it simply sequences sets of bytes. This allows traders and arbitrageurs who wish to conceal their trade (e.g. in order to avoid bundle stealing attacks) to still leverage Astria's transaction ordering market. Private transactions can follow the same flow as public transactions, submitting the private data to Astria as bytes to be sequenced and receive a preconfirmation. They will then arive at the Aztec node just the same via Astria's Execution API. 3. Public transaction that is not impacted by ordering - Similarly to private transactions, public transactions can be submitted through Aztec's p2p network directly to the sequencer node. These will only depend on Aztec's block finality, determined by validity proof production, and will not have any preconfirmation guarantees. 5. Public transaction that is impacted by ordering - Similarly to private transactions, public transactions are also able to leverage Astria's transaction ordering markets and the resulting preconfirmations. While this enables traders and arbitrageurs to act against faster confirmations, it also allows regular users to subidize their inclusion and ordering fees by allowing bundles to be constructed around their transactions. For example, if a retail user wants a fast preconfirmation on their swap, they can submit it to a searcher source of orderflow. The searcher can then bundle their transaction with their own, for example with a backrun, extracting some value in exchange for the retail user's transaction being confirmed much faster. # Long-Term Considerations ## Decentralizing Trust in the Aztec Sequencer Node This proposal assumes an implicit agreement between users and certain Aztec sequencers that are known to use Astria for orderflow. While this is the status quo in Ethereum L1 and MEV-Boost, in the longer term it would be preferable to provide a trustless mechanism for Aztec sequencer nodes to commit to using an external order flow source like Astria. One possible solution is to create a system of Aztec smart contracts that enable trustless participation by validating that an Aztec sequencer who committed to using Astria as an order flow has indeed used it to construct their proposal. Specifically, the smart contracts would need to provide a mechanism for proving that an Aztec proposer has equivocated on preconfirmations provided by Astria to users. Aztec sequencer node operators could then bond some collateral that would be slashed when provided with an equivocation proof. Such a system would provide decentralized mechanism for an Aztec node to commit to sequencing via Astria and not require users to trust specific Aztec node operators, up to the security provided by the slashing condition. This would likely add additional steps for registration and exiting as an Aztec sequencer, but could be done in a smart contract, likely not requiring protocol-level changes. It should be noted that designing such a system is out of scope for this document, and the above design should be thought of simply as a rough sketch. ## Network Effects For instance, [Astria's support for using SUAVE as a Trusted Execution Environment](https://collective.flashbots.net/t/integrating-suave-with-astria-rollups/3118/1) (TEE) coprocessor for bundle construction allows Aztec sequencer nodes to include bundles signed by a TEE operator belonging to the SUAVE network. Leveraging Astria's order flow market integrations, Aztec users and applications can leverage innovative designs such as the [private batch swaps mechanism](https://collective.flashbots.net/t/private-batch-swaps-using-aztec-and-suave/3217) described by Rahul Kothari, enhancing privacy and efficiency. This broadens the utility Aztec apps are able to provide users, fostering a more interconnected ecosystem where different rollups can share and benefit from advancements, driving adoption and scalability across the board. # Relevant references ## Astria - [Data flow and verification spec](https://github.com/astriaorg/astria/blob/main/specs/data-flow-and-verification.md) - [Sequencer inclusion proofs spec](https://github.com/astriaorg/astria/blob/main/specs/sequencer-inclusion-proofs.md) - [SUAVE-driven top-of-block for Astria-based rollups](https://collective.flashbots.net/t/integrating-suave-with-astria-rollups/3118/1) ## Aztec - [Public-private execution](https://docs.aztec.network/learn/concepts/communication/public_private_calls/main) - [L1-L2 architecture](https://docs.aztec.network/learn/concepts/communication/cross_chain_calls#combined-architecture) - [Aztec transaction internals](https://docs.aztec.network/learn/concepts/transactions#going-deeper) - [Private transation lifecycle](https://docs.aztec.network/learn/concepts/transactions#simple-example-of-the-private-transaction-lifecycle) - [Proposal confirmation rules](https://forum.aztec.network/t/request-for-comments-aztec-sequencer-selection-and-prover-coordination-protocols/3038) - [Sequencer registration](https://forum.aztec.network/t/request-for-comments-aztec-sequencer-selection-and-prover-coordination-protocols/3038#registration-12) - [Exiting as a sequencer](https://forum.aztec.network/t/request-for-comments-aztec-sequencer-selection-and-prover-coordination-protocols/3038#exiting-14) - [Private Batch Swaps using Aztec and SUAVE](https://collective.flashbots.net/t/private-batch-swaps-using-aztec-and-suave/3217)