Skill站外收录 @skilllib/skill-2117939930272412709
ev-node-explainer
提供对 ev-node 模块化架构的完整解析能力,涵盖区块生成、同步、数据可用性提交、强制包含机制及抗审查设计,支持单 sequencer 与 based sequencer 两种模式,可深入说明各组件职责、数据流与故障恢复逻辑。
区块链 AI 技能
Skills.MD
# ev-node Architecture Explainer
ev-node is a sovereign rollup framework that allows building rollups on any Data Availability (DA) layer. It follows a modular architecture where components can be swapped.
**Reference files:**
- [block-architecture.md](block-architecture.md) - Block package deep dive
- [da-sequencing.md](da-sequencing.md) - DA and sequencing deep dive
## Core Principles
1. **Zero-dependency core** - `core/` contains only interfaces, no external deps
2. **Modular components** - Executor, Sequencer, DA are pluggable
3. **Two operating modes** - Aggregator (produces blocks) and Sync-only (follows chain)
4. **Separation of concerns** - Block production, syncing, and DA submission are independent
## Package Overview
| Package | Responsibility |
|---------|---------------|
| `core/` | Interfaces only (Executor, Sequencer) |
| `types/` | Data structures (Header, Data, State, SignedHeader) |
| `block/` | Block lifecycle management |
| `execution/` | Execution layer implementations (EVM, ABCI) |
| `node/` | Node initialization and orchestration |
| `pkg/p2p/` | libp2p-based networking |
| `pkg/store/` | Persistent storage |
| `pkg/da/` | DA layer abstraction |
## Block Package Deep Dive
The block package is the most complex part of ev-node. See [block-architecture.md](block-architecture.md) for the complete breakdown.
### Component Summary
```
Components struct:
├── Executor - Block production (Aggregator only)
├── Reaper - Transaction scraping (Aggregator only)
├── Syncer - Block synchronization
├── Submitter - DA submission and inclusion
└── Cache - Unified state caching
```
### Entry Points
- `NewAggregatorComponents()` - Full node that produces and syncs blocks
- `NewSyncComponents()` - Non-aggregator that only syncs
### Key Data Types
**Header** - Block metadata (height, time, hashes, proposer)
**Data** - Transaction list with metadata
**SignedHeader** - Header with proposer signature
**State** - Chain state (last block, app hash, DA height)
## Block Production Flow (Aggregator)
```
Sequencer.GetNextBatch()
│
▼
Executor.ExecuteTxs()
│
├──► SignedHeader + Data
│
├──► P2P Broadcast
│
└──► Submitter Queue
│
▼
DA Layer
```
## Block Sync Flow (Non-Aggregator)
```
┌─────────────────────────────────────┐
│ Syncer │
├─────────────┬─────────────┬─────────┤
│ DA Worker │ P2P Worker │ Forced │
│ │ │ Incl. │
└──────┬──────┴──────┬──────┴────┬────┘
│ │ │
└─────────────┴───────────┘
│
▼
processHeightEvent()
│
▼
ExecuteTxs → Update State
```
## Data Availability Layer
The DA layer abstracts blob storage. ev-node uses Celestia but the interface is pluggable. See [da-sequencing.md](da-sequencing.md) for full details.
### Namespaces
DA uses 29-byte namespaces (1 byte version + 28 byte ID). Three namespaces are used:
| Namespace | Purpose |
|-----------|---------|
| Header | Block headers |
| Data | Transaction data (optional, can share with header) |
| Forced Inclusion | User-submitted txs for censorship resistance |
### DA Client Interface
```go
type Client interface {
Submit(ctx, data [][]byte, gasPrice, namespace, options) ResultSubmit
Retrieve(ctx, height uint64, namespace) ResultRetrieve
Get(ctx, ids []ID, namespace) ([]Blob, error)
}
```
### Key Files
| File | Purpose |
|------|---------|
| `pkg/da/types/types.go` | Core types (Blob, ID, Commitment) |
| `pkg/da/types/namespace.go` | Namespace handling |
| `block/internal/da/client.go` | DA client wrapper |
| `block/internal/da/forced_inclusion_retriever.go` | Forced tx retrieval |
---
## Sequencing
Sequencers order transactions for block production. See [da-sequencing.md](da-sequencing.md) for full details.
### Two Modes
| Mode | Mempool | Forced Inclusion | Use Case |
|------|---------|------------------|----------|
| **Single** | Yes | Yes | Traditional rollup |
| **Based** | No | Only source | High liveness guarantee |
### Sequencer Interface
```go
type Sequencer interface {
SubmitBatchTxs(ctx, req) (*SubmitBatchTxsResponse, error)
GetNextBatch(ctx, req) (*GetNextBatchResponse, error)
VerifyBatch(ctx, req) (*VerifyBatchResponse, error)
SetDAHeight(height uint64)
GetDAHeight() uint64
}
```
### ForceIncludedMask
Batches include a mask distinguishing tx sources:
```go
type Batch struct {
Transactions [][]byte
ForceIncludedMask []bool // true = from DA (must validate)
}
```
This allows the execution layer to skip validation for already-validated mempool txs.
### Key Files
| File | Purpose |
|------|---------|
| `core/sequencer/sequencing.go` | Core interface |
| `pkg/sequencers/single/sequencer.go` | Hybrid sequencer |
| `pkg/sequencers/based/sequencer.go` | Pure DA sequencer |
| `pkg/sequencers/common/checkpoint.go` | Shared checkpoint logic |
---
## Forced Inclusion
Forced inclusion prevents sequencer censorship:
1. User submits tx directly to DA layer
2. Syncer detects tx in forced-inclusion namespace
3. Grace period starts (adjusts based on block fullness)
4. If not included by sequencer within grace period → sequencer marked malicious
5. Tx gets included regardless
## Key Files
| File | Purpose |
|------|---------|
| `block/public.go` | Exported types and factories |
| `block/components.go` | Component creation |
| `block/internal/executing/executor.go` | Block production |
| `block/internal/syncing/syncer.go` | Sync orchestration |
| `block/internal/submitting/submitter.go` | DA submission |
| `block/internal/cache/manager.go` | Unified cache |
## Common Questions
### How does block production work?
The Executor runs `executionLoop()`:
1. Wait for block time or new transactions
2. Get batch from sequencer
3. Execute via execution layer
4. Create SignedHeader + Data
5. Broadcast to P2P
6. Queue for DA submission
### How does syncing work?
The Syncer coordinates three workers:
- **DA Worker** - Fetches confirmed blocks from DA
- **P2P Worker** - Receives gossiped blocks
- **Forced Inclusion** - Monitors for censored txs
All feed into `processHeightEvent()` which validates and executes.
### What happens if DA submission fails?
Submitter has retry logic with exponential backoff. Status codes:
- `TooBig` - Splits blob into chunks
- `AlreadyInMempool` - Skips (duplicate)
- `NotIncludedInBlock` - Retries with backoff
- `ContextCanceled` - Request canceled
### How is state recovered after crash?
The Replayer syncs execution layer from disk:
1. Load last committed height from store
2. Check execution layer height
3. Replay any missing blocks
4. Ensure consistency before starting
## Architecture Diagrams
For detailed component diagrams and state machines, see [block-architecture.md](block-architecture.md).
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「ev-node-explainer」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次