# Purpose and High-Level Flow

## Purpose and High-Level Flow

When the **Eclipse L2** generates a new block (or “batch”), it posts a commitment to the Gateway. This references the previous commit to maintain continuity. The Gateway enforces the correct parent-child relationship and logs each commit to an internal registry to prevent duplicates.

* **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 blocks, 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).
* **Access Control**: OpenZeppelin’s `AccessControlEnumerable` checks every critical function (e.g., only `PAUSER_ROLE` can pause).
* **Pausible**: While paused, no commits or forks can happen, protecting the contract from malicious or unintended updates.

Below, we dive into each concept, show test code to illustrate usage, and then present the **detailed sequence diagrams** and **state transition diagrams** that map out the system’s execution in a visual format.


---

# 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/eclipse-l1-gateway/purpose-and-high-level-flow.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.
