Skip to content

Commit f691ab9

Browse files
author
tac0turtle
committed
fix
1 parent ac0e25d commit f691ab9

File tree

7 files changed

+61
-15
lines changed

7 files changed

+61
-15
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Ev-node is the basis of the Evolve Stack. For more in-depth information about Ev
1111
## Using Evolve
1212

1313
Evolve supports multiple sync modes:
14+
1415
- **Hybrid sync**: Sync from both DA layer and P2P network (default when peers are configured)
1516
- **DA-only sync**: Sync exclusively from DA layer by leaving P2P peers empty (see [Configuration Guide](docs/learn/config.md#da-only-sync-mode))
1617
- **P2P-priority sync**: Prioritize P2P with DA as fallback

block/CLAUDE.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The block package is the core of ev-node's block management system. It handles b
99
## Core Components
1010

1111
### Manager (`manager.go`)
12+
1213
- **Purpose**: Central orchestrator for all block operations
1314
- **Key Responsibilities**:
1415
- Transaction aggregation into blocks
@@ -18,6 +19,7 @@ The block package is the core of ev-node's block management system. It handles b
1819
- P2P block/header gossiping
1920

2021
### Aggregation (`aggregation.go`, `lazy_aggregation_test.go`)
22+
2123
- **Purpose**: Collects transactions from mempool and creates blocks
2224
- **Modes**:
2325
- **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
2830
- `normalAggregationLoop`: Regular block production
2931

3032
### Synchronization (`sync.go`, `sync_test.go`)
33+
3134
- **Purpose**: Keeps the node synchronized with the network
3235
- **Key Functions**:
3336
- `SyncLoop`: Main synchronization loop
@@ -36,6 +39,7 @@ The block package is the core of ev-node's block management system. It handles b
3639
- Handles header and data caching
3740

3841
### Data Availability (`da_includer.go`, `submitter.go`, `retriever.go`)
42+
3943
- **DA Includer**: Manages DA blob inclusion proofs and validation
4044
- **Submitter**: Handles block submission to the DA layer with retry logic
4145
- **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
4549
- Batch submission optimization
4650

4751
### Storage (`store.go`, `store_test.go`)
52+
4853
- **Purpose**: Persistent storage for blocks and state
4954
- **Key Features**:
5055
- Block height tracking
@@ -53,6 +58,7 @@ The block package is the core of ev-node's block management system. It handles b
5358
- Migration support for namespace changes
5459

5560
### Pending Blocks (`pending_base.go`, `pending_headers.go`, `pending_data.go`)
61+
5662
- **Purpose**: Manages blocks awaiting DA inclusion or validation
5763
- **Components**:
5864
- **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
6470
- Memory-efficient caching
6571

6672
### Metrics (`metrics.go`, `metrics_helpers.go`)
73+
6774
- **Purpose**: Performance monitoring and observability
6875
- **Key Metrics**:
6976
- Block production times
@@ -74,20 +81,23 @@ The block package is the core of ev-node's block management system. It handles b
7481
## Key Workflows
7582

7683
### Block Production Flow
84+
7785
1. Transactions collected from mempool
7886
2. Block created with proper header and data
7987
3. Block executed through executor
8088
4. Block submitted to DA layer
8189
5. Block gossiped to P2P network
8290

8391
### Synchronization Flow
92+
8493
1. Headers received from P2P network
8594
2. Headers validated and cached
8695
3. Block data retrieved from DA layer
8796
4. Blocks applied to state
8897
5. Sync progress updated
8998

9099
### DA Submission Flow
100+
91101
1. Block prepared for submission
92102
2. Blob created with block data
93103
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
97107
## Configuration
98108

99109
### Time Parameters
110+
100111
- `BlockTime`: Target time between blocks (default: 1s)
101112
- `DABlockTime`: DA layer block time (default: 6s)
102113
- `LazyBlockTime`: Max time between blocks in lazy mode (default: 60s)
103114

104115
### Limits
116+
105117
- `maxSubmitAttempts`: Max DA submission retries (30)
106118
- `defaultMempoolTTL`: Blocks until tx dropped (25)
107119

108120
## Testing Strategy
109121

110122
### Unit Tests
123+
111124
- Test individual components in isolation
112125
- Mock external dependencies (DA, executor, sequencer)
113126
- Focus on edge cases and error conditions
114127

115128
### Integration Tests
129+
116130
- Test component interactions
117131
- Verify block flow from creation to storage
118132
- Test synchronization scenarios
119133

120134
### Performance Tests (`da_speed_test.go`)
135+
121136
- Measure DA submission performance
122137
- Test batch processing efficiency
123138
- Validate metrics accuracy
124139

125140
## Common Development Tasks
126141

127142
### Adding a New DA Feature
143+
128144
1. Update DA interfaces in `core/da`
129145
2. Modify `da_includer.go` for inclusion logic
130146
3. Update `submitter.go` for submission flow
131147
4. Add retrieval logic in `retriever.go`
132148
5. Update tests and metrics
133149

134150
### Modifying Block Production
151+
135152
1. Update aggregation logic in `aggregation.go`
136153
2. Adjust timing in Manager configuration
137154
3. Update metrics collection
138155
4. Test both normal and lazy modes
139156

140157
### Implementing New Sync Strategy
158+
141159
1. Modify `SyncLoop` in `sync.go`
142160
2. Update pending block handling
143161
3. Adjust cache strategies
@@ -182,4 +200,4 @@ The block package is the core of ev-node's block management system. It handles b
182200
- Log with structured fields
183201
- Return errors with context
184202
- Use metrics for observability
185-
- Test error conditions thoroughly
203+
- Test error conditions thoroughly

block/submitter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,10 @@ func handleSuccessfulSubmission[T any](
329329
remLen := len(remaining)
330330
allSubmitted := res.SubmittedCount == uint64(remLen)
331331

332-
// Record submission in DA visualization server
333-
if daVisualizationServer := server.GetDAVisualizationServer(); daVisualizationServer != nil {
334-
daVisualizationServer.RecordSubmission(&res, gasPrice, len(currMarshaled))
335-
}
332+
// Record submission in DA visualization server
333+
if daVisualizationServer := server.GetDAVisualizationServer(); daVisualizationServer != nil {
334+
daVisualizationServer.RecordSubmission(res, retryStrategy.gasPrice, res.SubmittedCount)
335+
}
336336

337337
m.logger.Info().Str("itemType", itemType).Float64("gasPrice", retryStrategy.gasPrice).Uint64("count", res.SubmittedCount).Msg("successfully submitted items to DA layer")
338338

docs/learn/config.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ Evolve supports running nodes that sync exclusively from the Data Availability (
6363
**To enable DA-only sync mode:**
6464

6565
1. **Leave P2P peers empty** (default behavior):
66+
6667
```yaml
6768
p2p:
6869
peers: "" # Empty or omit this field entirely
6970
```
70-
71+
7172
2. **Configure DA connection** (required):
73+
7274
```yaml
7375
da:
7476
address: "your-da-service:port"
@@ -79,6 +81,7 @@ Evolve supports running nodes that sync exclusively from the Data Availability (
7981
3. **Optional**: You can still configure P2P listen address for potential future connections, but without peers, no P2P networking will occur.
8082

8183
When running in DA-only mode, the node will:
84+
8285
- ✅ Sync blocks and headers from the DA layer
8386
- ✅ Validate transactions and maintain state
8487
- ✅ Serve RPC requests

docs/learn/specs/block-manager.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,23 +267,23 @@ flowchart TD
267267
B -->|Mempool/Not Included| E[Mempool Backoff Strategy]
268268
B -->|Context Canceled| F[Stop Submission]
269269
B -->|Other Error| G[Exponential Backoff]
270-
270+
271271
D -->|Yes| H[Recursive Batch Splitting]
272272
D -->|No| I[Skip Single Item - Cannot Split]
273-
273+
274274
E --> J[Set Backoff = MempoolTTL * BlockTime]
275275
E --> K[Multiply Gas Price by GasMultiplier]
276-
276+
277277
G --> L[Double Backoff Time]
278278
G --> M[Cap at MaxBackoff - BlockTime]
279-
279+
280280
H --> N[Split into Two Halves]
281281
N --> O[Submit First Half]
282282
O --> P[Submit Second Half]
283283
P --> Q{Both Halves Processed?}
284284
Q -->|Yes| R[Combine Results]
285285
Q -->|No| S[Handle Partial Success]
286-
286+
287287
C --> T[Update Pending Queues]
288288
T --> U[Post-Submit Actions]
289289
```
@@ -295,7 +295,7 @@ flowchart TD
295295
* Exponential backoff for general failures (doubles each attempt, capped at `BlockTime`)
296296
* Mempool-specific backoff (waits `MempoolTTL * BlockTime` for stuck transactions)
297297
* Success-based backoff reset with gas price reduction
298-
* **Gas Price Management**:
298+
* **Gas Price Management**:
299299
* Increases gas price by `GasMultiplier` on mempool failures
300300
* Decreases gas price after successful submissions (bounded by initial price)
301301
* Supports automatic gas price detection (`-1` value)

pkg/rpc/server/da_visualization.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type DASubmissionInfo struct {
2323
GasPrice float64 `json:"gas_price"`
2424
StatusCode string `json:"status_code"`
2525
Message string `json:"message,omitempty"`
26-
NumBlobs int `json:"num_blobs"`
26+
NumBlobs uint64 `json:"num_blobs"`
2727
BlobIDs []string `json:"blob_ids,omitempty"`
2828
}
2929

@@ -48,7 +48,7 @@ func NewDAVisualizationServer(da coreda.DA, logger zerolog.Logger, isAggregator
4848

4949
// RecordSubmission records a DA submission for visualization
5050
// Only keeps the last 100 submissions in memory for the dashboard display
51-
func (s *DAVisualizationServer) RecordSubmission(result *coreda.ResultSubmit, gasPrice float64, numBlobs int) {
51+
func (s *DAVisualizationServer) RecordSubmission(result *coreda.ResultSubmit, gasPrice float64, numBlobs uint64) {
5252
s.mutex.Lock()
5353
defer s.mutex.Unlock()
5454

0 commit comments

Comments
 (0)