# Eclipse L1 Gateway

The **Eclipse L1 Gateway** is a smart contract system that anchors the state of the Eclipse Layer 2 (L2) blockchain onto an Ethereum-based Layer 1. By storing sequential commitments (hashes of L2 blocks), along with an ability to **fork** when necessary, the Gateway ensures an auditable, on-chain record of L2 state progression. Fork management, role-based access control, and pausable safety mechanisms all come together to form a robust design for real-world rollup usage.

In particular, the Gateway addresses these key challenges:

1. **Immutable Commitment Chain**: Recording L2 blocks so that anyone can verify their sequential integrity.&#x20;
2. **Fork Support**: Allowing the L2 system to reorganize or branch off from a previous commit.
3. **Access Control**: Ensuring only designated roles can submit batches or create forks.
4. **Emergency Pausing**: A failsafe to halt state changes in case of high-severity incidents.

### Purpose and High-Level Flow

When the **Eclipse L2** generates an L2 block batch, it posts a commitment to the Gateway. This references the previous commitment to maintain continuity. The Gateway ensures the correct parent-child relationship and records each commitment in an internal registry to prevent duplication.

* **Initialization**: The contract starts uninitialized. The first `submitBatch` with a zero parent hash becomes the **genesis batch**.
* **Normal Operation**: As the aggregator or sequencer produces new L2 batches, they call `submitBatch`, extending the chain tip.
* **Forking**: If a dispute or bug arises, an authorized user (an entity with `FORKER_ROLE`) can create a new fork from a specific commit (by calling `forkChain`) , potentially replacing the current chain.
* **Canonicality**: By default, the chain with the highest fork ID is considered the tip. However, older forks remain in storage (and can be restored if needed).
* **Pausable**: While paused, no commits or forks can happen, protecting the contract from malicious or unintended updates; pause functionality is gated by access control.

The mechanism of the L1 Gateway ultimately enables chain derivation by storing pointers to the data required to reconstruct the latest state of the chain.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eclipse.xyz/architecture/eclipse-architecture/architectural-overview/core-infrastructure/eclipse-l1-gateway.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
