Skip to content

doc(alpen-ee): add alpen-ee readme#1212

Open
sapinb wants to merge 3 commits into
mainfrom
ee-arch
Open

doc(alpen-ee): add alpen-ee readme#1212
sapinb wants to merge 3 commits into
mainfrom
ee-arch

Conversation

@sapinb
Copy link
Copy Markdown
Contributor

@sapinb sapinb commented Dec 16, 2025

Description

This covers the components currently implemented in alpen-ee.

AI disclosure: With help from claude, especially for the diagrams.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency Update

Notes to Reviewers

I'm not sure exactly where this should go. Or if it even belongs in this repo. Please suggest if this needs to go elsewhere.
My plan is to update this doc as more pieces of alpen-ee get integrated.

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added (where necessary) tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.
  • I have disclosed my use of AI in the body of this PR.

Related Issues

This covers the components currently implemented in alpen-ee.
@sapinb sapinb requested review from a team as code owners December 16, 2025 11:38
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 16, 2025

Commit: 2049cd1

SP1 Execution Results

program cycles success
EVM EE STF 1,328,617
CL STF 217,204
Checkpoint 2,247

@sapinb sapinb changed the title doc(alpen-ee): add alpen-ee architecture docs doc(alpen-ee): add alpen-ee readme Dec 16, 2025
Copy link
Copy Markdown
Member

@storopoli storopoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing piece of documentation.
Thank you!
I have some suggestions.
Also one question: should we mention ASM or just treat "L1" as a blackbox like we already do?


## System Context

The EE exists within a layered architecture anchored to Bitcoin:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple EEs

Suggested change
The EE exists within a layered architecture anchored to Bitcoin:
EEs exist within a layered architecture anchored to Bitcoin:

Comment on lines +71 to +74
┌──────────┐ ┌──────────┐ ┌──────────┐
│ EE 1 │ │ EE 2 │ │ EE N │
│ (This) │ │ │ │ │
└──────────┘ └──────────┘ └──────────┘
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
┌──────────┐ ┌──────────┐ ┌──────────┐
│ EE 1 │ │ EE 2 │ │ EE N │
(This) │ │ │ │ │
└──────────┘ └──────────┘ └──────────┘
┌──────────┐ ┌──────────┐ ┌──────────┐
│ EE 1 │ │ EE 2 │ │ EE N │
(Alpen) │ │ │ │ │
└──────────┘ └──────────┘ └──────────┘

Better than "this".

Comment on lines +85 to +86
| **OL** | OL blocks grouped into epochs | OL client (not covered here) |
| **EE** | EVM blocks | `alpen-client` (this binary) |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could point to strata.

Suggested change
| **OL** | OL blocks grouped into epochs | OL client (not covered here) |
| **EE** | EVM blocks | `alpen-client` (this binary) |
| **OL** | OL blocks grouped into epochs | `bin/strata` |
| **EE** | EVM blocks | `bin/alpen-client` |


### Communication Pattern: Watch Channels

Components communicate via `tokio::sync::watch` channels for efficient state broadcasting:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could get outdated.

Suggested change
Components communicate via `tokio::sync::watch` channels for efficient state broadcasting:
Components communicate via `tokio` channels for efficient state broadcasting:

└── finalized: EeAccountStateAtEpoch // State at finalized epoch
```

**Outputs** (via watch channels):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Outputs** (via watch channels):
**Outputs** (via `tokio` channels):

**Responsibilities**:
- Broadcast new block headers from sequencer
- Receive and validate block headers from peers
- Verify sequencer signatures (Schnorr over EIP-191 hash)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh god we created a monstrosity 😂 Schnorr over EIP-191 hash.
Are we the only ones using that?

I do have to agree that is BEAUTIFUL.
PKs are always 32 bytes and sigs are always 64 bytes.
EIP-191 hashes gives us ample support from most of the Rust ethereum ecosystem...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cc @AaronFeickert and/or @sampkaALP for sanity checking.

**Key Points**:
- Only messages from finalized OL blocks are processed (to avoid reorg issues)
- Deposits are rate-limited per block (`max_deposits_per_block`)
- Subject ID (32 bytes) is truncated to EVM address (20 bytes)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Truncated how? We add zero padding? If yes, to the left or to the right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add? something needs to be removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also related with the work in #1229.

- Only messages from finalized OL blocks are processed (to avoid reorg issues)
- Deposits are rate-limited per block (`max_deposits_per_block`)
- Subject ID (32 bytes) is truncated to EVM address (20 bytes)
- Bitcoin amounts (sats) are converted to wei
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point towards the sats_to_wei function in ee-common?

│ │ │ │
```

**Status**: Withdrawal extraction is implemented. Batch submission to OL with SNARK proofs is not yet implemented.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the status, since we are working on batch assembly already.

Suggested change
**Status**: Withdrawal extraction is implemented. Batch submission to OL with SNARK proofs is not yet implemented.

Comment on lines +624 to +628
- **Batch Assembly**: Grouping multiple EE blocks into batches for OL submission
- **SNARK Proof Generation**: Proving EE state transitions
- **OL Update Submission**: Posting proofs and state updates to OL
- **Cross-EE Messaging**: Messages between different EEs via OL
- **Independent Block Sync**: EE fullnodes currently rely on sequencer P2P
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has the risk of getting outdated soon.
We should just removed. It does not add anything from what we already know from our tickets and sprint planning.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least let's add a date

Copy link
Copy Markdown
Contributor

@bewakes bewakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very comprehensive! I like this.
Agree with @storopoli 's comments.


Fullnodes learn about new blocks through two mechanisms:

1. **Consensus (Confirmed/Finalized)**: From OL via OL Tracker
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add that in this case they actually learn about a sequence of blocks


**Important**: EE fullnodes do not have independent block sync. They rely on:
- Reth's P2P for block data (triggered by gossip)
- OL for consensus (confirmed/finalized status)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not quite block sync, right? (not only that technically this does not sync blocks, but) we are not syncing data from OL, it is needed to be fetched from bitcoin. This is not implemented right now, correct?

├─────────────►│ │ │
│ │ │ │
│ finalized │ │ │
│◄─────────────┤ │ │
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a better way to pass the message that this should be a finalized block? The way I currently read it is that OL sends some finalized object to L1, but in fact it is not finalized when sent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be good to explain what this (finalized) object is. I am not sure.

**Key Points**:
- Only messages from finalized OL blocks are processed (to avoid reorg issues)
- Deposits are rate-limited per block (`max_deposits_per_block`)
- Subject ID (32 bytes) is truncated to EVM address (20 bytes)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add? something needs to be removed.

```

**Key Points**:
- Only messages from finalized OL blocks are processed (to avoid reorg issues)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fail to follow something here: what happens between DT and the inbox msg? Do we literally just wait for an OL batch that covers the L1 range where the DT is to be posted to and buried in L1? If so, I don't really see a reason for it.

Comment on lines +624 to +628
- **Batch Assembly**: Grouping multiple EE blocks into batches for OL submission
- **SNARK Proof Generation**: Proving EE state transitions
- **OL Update Submission**: Posting proofs and state updates to OL
- **Cross-EE Messaging**: Messages between different EEs via OL
- **Independent Block Sync**: EE fullnodes currently rely on sequencer P2P
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least let's add a date

Copy link
Copy Markdown
Contributor

@prajwolrg prajwolrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice. Thank you so much.

I just have added a few nits.

┌─────────────────────────────────────────────────────────────────────┐
│ Bitcoin (L1) │
│ - Source of truth for finality │
│ - Data Availability (DA) for OL state │
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to talk about OL DA here. Maybe we should mention about EE DA instead.

Comment on lines +460 to +470
```
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ L1 │ │ OL │ │ EE │ │ EVM │
│(Bitcoin)│ │ │ │ Client │ │ State │
└────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘
│ │ │ │
│ deposit tx │ │ │
├─────────────►│ │ │
│ │ │ │
│ finalized │ │ │
│◄─────────────┤ │ │
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't mermaid support this?

**Key Points**:
- Only messages from finalized OL blocks are processed (to avoid reorg issues)
- Deposits are rate-limited per block (`max_deposits_per_block`)
- Subject ID (32 bytes) is truncated to EVM address (20 bytes)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also related with the work in #1229.

Comment on lines +492 to +509
```
┌─────────┐ ┌─────────────┐ ┌─────────┐ ┌─────────┐
│ EVM │ │ Payload │ │ OL │ │ L1 │
│ State │ │ Builder │ │ │ │(Bitcoin)│
└────┬────┘ └──────┬──────┘ └────┬────┘ └────┬────┘
│ │ │ │
│ withdrawal │ │ │
│ intent │ │ │
├───────────────►│ │ │
│ │ │ │
│ │ BlockOutputs │ │
│ │ (SentMessage) │ │
│ ├───────────────►│ │
│ │ │ │
│ │ │ bridge │
│ │ ├─────────────►│
│ │ │ │
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if we can use mermaid here.

@barakshani
Copy link
Copy Markdown
Contributor

@sapinb let's push to merge this? It's stale for a month now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants