@@ -9,6 +9,7 @@ The block package is the core of ev-node's block management system. It handles b
9
9
## Core Components
10
10
11
11
### Manager (` manager.go ` )
12
+
12
13
- ** Purpose** : Central orchestrator for all block operations
13
14
- ** Key Responsibilities** :
14
15
- Transaction aggregation into blocks
@@ -18,6 +19,7 @@ The block package is the core of ev-node's block management system. It handles b
18
19
- P2P block/header gossiping
19
20
20
21
### Aggregation (` aggregation.go ` , ` lazy_aggregation_test.go ` )
22
+
21
23
- ** Purpose** : Collects transactions from mempool and creates blocks
22
24
- ** Modes** :
23
25
- ** Normal Mode** : Produces blocks at regular intervals (BlockTime)
@@ -28,6 +30,7 @@ The block package is the core of ev-node's block management system. It handles b
28
30
- ` normalAggregationLoop ` : Regular block production
29
31
30
32
### Synchronization (` sync.go ` , ` sync_test.go ` )
33
+
31
34
- ** Purpose** : Keeps the node synchronized with the network
32
35
- ** Key Functions** :
33
36
- ` SyncLoop ` : Main synchronization loop
@@ -36,6 +39,7 @@ The block package is the core of ev-node's block management system. It handles b
36
39
- Handles header and data caching
37
40
38
41
### Data Availability (` da_includer.go ` , ` submitter.go ` , ` retriever.go ` )
42
+
39
43
- ** DA Includer** : Manages DA blob inclusion proofs and validation
40
44
- ** Submitter** : Handles block submission to the DA layer with retry logic
41
45
- ** Retriever** : Fetches blocks from the DA layer
@@ -45,6 +49,7 @@ The block package is the core of ev-node's block management system. It handles b
45
49
- Batch submission optimization
46
50
47
51
### Storage (` store.go ` , ` store_test.go ` )
52
+
48
53
- ** Purpose** : Persistent storage for blocks and state
49
54
- ** Key Features** :
50
55
- Block height tracking
@@ -53,6 +58,7 @@ The block package is the core of ev-node's block management system. It handles b
53
58
- Migration support for namespace changes
54
59
55
60
### Pending Blocks (` pending_base.go ` , ` pending_headers.go ` , ` pending_data.go ` )
61
+
56
62
- ** Purpose** : Manages blocks awaiting DA inclusion or validation
57
63
- ** Components** :
58
64
- ** PendingBase** : Base structure for pending blocks
@@ -64,6 +70,7 @@ The block package is the core of ev-node's block management system. It handles b
64
70
- Memory-efficient caching
65
71
66
72
### Metrics (` metrics.go ` , ` metrics_helpers.go ` )
73
+
67
74
- ** Purpose** : Performance monitoring and observability
68
75
- ** Key Metrics** :
69
76
- Block production times
@@ -74,20 +81,23 @@ The block package is the core of ev-node's block management system. It handles b
74
81
## Key Workflows
75
82
76
83
### Block Production Flow
84
+
77
85
1 . Transactions collected from mempool
78
86
2 . Block created with proper header and data
79
87
3 . Block executed through executor
80
88
4 . Block submitted to DA layer
81
89
5 . Block gossiped to P2P network
82
90
83
91
### Synchronization Flow
92
+
84
93
1 . Headers received from P2P network
85
94
2 . Headers validated and cached
86
95
3 . Block data retrieved from DA layer
87
96
4 . Blocks applied to state
88
97
5 . Sync progress updated
89
98
90
99
### DA Submission Flow
100
+
91
101
1 . Block prepared for submission
92
102
2 . Blob created with block data
93
103
3 . Submission attempted with retries
@@ -97,47 +107,55 @@ The block package is the core of ev-node's block management system. It handles b
97
107
## Configuration
98
108
99
109
### Time Parameters
110
+
100
111
- ` BlockTime ` : Target time between blocks (default: 1s)
101
112
- ` DABlockTime ` : DA layer block time (default: 6s)
102
113
- ` LazyBlockTime ` : Max time between blocks in lazy mode (default: 60s)
103
114
104
115
### Limits
116
+
105
117
- ` maxSubmitAttempts ` : Max DA submission retries (30)
106
118
- ` defaultMempoolTTL ` : Blocks until tx dropped (25)
107
119
108
120
## Testing Strategy
109
121
110
122
### Unit Tests
123
+
111
124
- Test individual components in isolation
112
125
- Mock external dependencies (DA, executor, sequencer)
113
126
- Focus on edge cases and error conditions
114
127
115
128
### Integration Tests
129
+
116
130
- Test component interactions
117
131
- Verify block flow from creation to storage
118
132
- Test synchronization scenarios
119
133
120
134
### Performance Tests (` da_speed_test.go ` )
135
+
121
136
- Measure DA submission performance
122
137
- Test batch processing efficiency
123
138
- Validate metrics accuracy
124
139
125
140
## Common Development Tasks
126
141
127
142
### Adding a New DA Feature
143
+
128
144
1 . Update DA interfaces in ` core/da `
129
145
2 . Modify ` da_includer.go ` for inclusion logic
130
146
3 . Update ` submitter.go ` for submission flow
131
147
4 . Add retrieval logic in ` retriever.go `
132
148
5 . Update tests and metrics
133
149
134
150
### Modifying Block Production
151
+
135
152
1 . Update aggregation logic in ` aggregation.go `
136
153
2 . Adjust timing in Manager configuration
137
154
3 . Update metrics collection
138
155
4 . Test both normal and lazy modes
139
156
140
157
### Implementing New Sync Strategy
158
+
141
159
1 . Modify ` SyncLoop ` in ` sync.go `
142
160
2 . Update pending block handling
143
161
3 . Adjust cache strategies
@@ -182,4 +200,4 @@ The block package is the core of ev-node's block management system. It handles b
182
200
- Log with structured fields
183
201
- Return errors with context
184
202
- Use metrics for observability
185
- - Test error conditions thoroughly
203
+ - Test error conditions thoroughly
0 commit comments