Skip to content

Commit 921957d

Browse files
author
tac0turtle
committed
fix assumptions
1 parent b6c736e commit 921957d

File tree

6 files changed

+296
-15
lines changed

6 files changed

+296
-15
lines changed

block/manager.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,15 @@ func NewManager(
429429
return nil, fmt.Errorf("failed to load cache: %w", err)
430430
}
431431

432-
// Initialize DA visualization server
433-
daVisualizationServer := server.NewDAVisualizationServer(da, logger.With().Str("module", "da_visualization").Logger())
434-
server.SetDAVisualizationServer(daVisualizationServer)
432+
// Initialize DA visualization server if enabled
433+
if config.RPC.EnableDAVisualization {
434+
daVisualizationServer := server.NewDAVisualizationServer(da, logger.With().Str("module", "da_visualization").Logger())
435+
server.SetDAVisualizationServer(daVisualizationServer)
436+
logger.Info().Msg("DA visualization server enabled")
437+
} else {
438+
// Ensure the global server is nil when disabled
439+
server.SetDAVisualizationServer(nil)
440+
}
435441

436442
return m, nil
437443
}

docs/guides/da-visualizer.md

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# DA Visualizer
2+
3+
The Data Availability (DA) Visualizer is a built-in monitoring tool in Evolve that provides real-time insights into blob submissions to the DA layer. It offers a web-based interface for tracking submission statistics, monitoring DA layer health, and analyzing blob details.
4+
5+
**Note**: Only aggregator nodes submit data to the DA layer. Non-aggregator nodes will not display submission data.
6+
7+
## Overview
8+
9+
The DA Visualizer provides:
10+
- Real-time monitoring of blob submissions (last 100 submissions)
11+
- Success/failure statistics and trends
12+
- Gas price tracking and cost analysis
13+
- DA layer health monitoring
14+
- Detailed blob inspection capabilities
15+
- Recent submission history
16+
17+
## Enabling the DA Visualizer
18+
19+
The DA Visualizer is disabled by default. To enable it, use the following configuration:
20+
21+
### Via Command-line Flag
22+
23+
```bash
24+
testapp start --rollkit.rpc.enable_da_visualization
25+
```
26+
27+
### Via Configuration File
28+
29+
Add the following to your `evolve.yaml` configuration file:
30+
31+
```yaml
32+
rpc:
33+
enable_da_visualization: true
34+
```
35+
36+
## Accessing the DA Visualizer
37+
38+
Once enabled, the DA Visualizer is accessible through your node's RPC server. By default, this is:
39+
40+
```
41+
http://localhost:7331/da
42+
```
43+
44+
The visualizer provides several API endpoints and a web interface:
45+
46+
### Web Interface
47+
48+
Navigate to `http://localhost:7331/da` in your web browser to access the interactive dashboard.
49+
50+
### API Endpoints
51+
52+
The following REST API endpoints are available for programmatic access:
53+
54+
#### Get Recent Submissions
55+
56+
```bash
57+
GET /da/submissions
58+
```
59+
60+
Returns the most recent blob submissions (up to 100 kept in memory).
61+
62+
#### Get Blob Details
63+
64+
```bash
65+
GET /da/blob?id={blob_id}
66+
```
67+
68+
Returns detailed information about a specific blob submission.
69+
70+
#### Get DA Statistics
71+
72+
```bash
73+
GET /da/stats
74+
```
75+
76+
Returns aggregated statistics including:
77+
- Total submissions count
78+
- Success/failure rates
79+
- Average gas price
80+
- Total gas spent
81+
- Average blob size
82+
- Submission trends
83+
84+
#### Get DA Health Status
85+
86+
```bash
87+
GET /da/health
88+
```
89+
90+
Returns the current health status of the DA layer including:
91+
- Connection status
92+
- Recent error rates
93+
- Performance metrics
94+
- Last successful submission timestamp
95+
96+
## Features
97+
98+
### Real-time Monitoring
99+
100+
The dashboard automatically updates every 30 seconds, displaying:
101+
- Recent submission feed with status indicators (last 100 submissions)
102+
- Success rate percentage
103+
- Current gas price trends
104+
- Submission history
105+
106+
### Submission Details
107+
108+
Each submission entry shows:
109+
- Timestamp
110+
- Blob ID with link to detailed view
111+
- Number of blobs in the batch
112+
- Submission status (success/failure)
113+
- Gas price used
114+
- Error messages (if any)
115+
116+
### Statistics Dashboard
117+
118+
The statistics section provides:
119+
- **Performance Metrics**: Success rate, average submission time
120+
- **Cost Analysis**: Total gas spent, average gas price over time
121+
- **Volume Metrics**: Total blobs submitted, average blob size
122+
- **Trend Analysis**: Hourly and daily submission patterns
123+
124+
### Health Monitoring
125+
126+
The health status indicator shows:
127+
- 🟢 **Healthy**: DA layer responding normally
128+
- 🟡 **Warning**: Some failures but overall functional
129+
- 🔴 **Critical**: High failure rate or connection issues
130+
131+
## Use Cases
132+
133+
### For Node Operators
134+
135+
- Monitor the reliability of DA submissions
136+
- Track gas costs and optimize gas price settings
137+
- Identify patterns in submission failures
138+
- Ensure DA layer connectivity
139+
140+
### For Developers
141+
142+
- Debug DA submission issues
143+
- Analyze blob data structure
144+
- Monitor application-specific submission patterns
145+
- Test DA layer integration
146+
147+
### For Network Monitoring
148+
149+
- Track overall network DA usage
150+
- Identify congestion periods
151+
- Monitor gas price fluctuations
152+
- Analyze submission patterns across the network
153+
154+
## Configuration Options
155+
156+
When enabling the DA Visualizer, you may want to adjust related RPC settings:
157+
158+
```yaml
159+
rpc:
160+
address: "0.0.0.0:7331" # Bind to all interfaces for remote access
161+
enable_da_visualization: true
162+
```
163+
164+
**Security Note**: If binding to all interfaces (`0.0.0.0`), ensure proper firewall rules are in place to restrict access to trusted sources only.
165+
166+
## Troubleshooting
167+
168+
### Visualizer Not Accessible
169+
170+
1. Verify the DA Visualizer is enabled:
171+
- Check your configuration file or ensure the flag is set
172+
- Look for log entries confirming "DA visualization endpoints registered"
173+
174+
2. Check the RPC server is running:
175+
- Verify the RPC address in logs
176+
- Ensure no port conflicts
177+
178+
3. For remote access:
179+
- Ensure the RPC server is bound to an accessible interface
180+
- Check firewall settings
181+
182+
### No Data Displayed
183+
184+
1. Verify your node is in aggregator mode (only aggregators submit to DA)
185+
2. Check DA layer connectivity in the node logs
186+
3. Ensure transactions are being processed
187+
4. Note that the visualizer only keeps the last 100 submissions in memory
188+
189+
### API Errors
190+
191+
- **404 Not Found**: DA Visualizer not enabled
192+
- **500 Internal Server Error**: Check node logs for DA connection issues
193+
- **Empty responses**: No submissions have been made yet
194+
195+
## Example Usage
196+
197+
### Using curl to access the API
198+
199+
```bash
200+
# Get recent submissions (returns up to 100)
201+
curl http://localhost:7331/da/submissions
202+
203+
# Get specific blob details
204+
curl http://localhost:7331/da/blob?id=abc123...
205+
206+
# Get statistics
207+
curl http://localhost:7331/da/stats
208+
209+
# Check DA health
210+
curl http://localhost:7331/da/health
211+
```
212+
213+
### Monitoring with scripts
214+
215+
```bash
216+
#!/bin/bash
217+
# Simple monitoring script
218+
219+
while true; do
220+
health=$(curl -s http://localhost:7331/da/health | jq -r '.status')
221+
if [ "$health" != "healthy" ]; then
222+
echo "DA layer issue detected: $health"
223+
# Send alert...
224+
fi
225+
sleep 30
226+
done
227+
```
228+
229+
## Related Configuration
230+
231+
For complete DA layer configuration options, see the [Config Reference](../learn/config.md#data-availability-configuration-da).
232+
233+
For metrics and monitoring setup, see the [Metrics Guide](./metrics.md).

docs/learn/config.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ This document provides a comprehensive reference for all configuration options a
3434
- [P2P Allowed Peers](#p2p-allowed-peers)
3535
- [RPC Configuration (`rpc`)](#rpc-configuration-rpc)
3636
- [RPC Server Address](#rpc-server-address)
37+
- [Enable DA Visualization](#enable-da-visualization)
3738
- [Instrumentation Configuration (`instrumentation`)](#instrumentation-configuration-instrumentation)
3839
- [Enable Prometheus Metrics](#enable-prometheus-metrics)
3940
- [Prometheus Listen Address](#prometheus-listen-address)
@@ -539,6 +540,26 @@ rpc:
539540
*Default:* `"127.0.0.1:7331"`
540541
*Constant:* `FlagRPCAddress`
541542

543+
### Enable DA Visualization
544+
545+
**Description:**
546+
If true, enables the Data Availability (DA) visualization endpoints that provide real-time monitoring of blob submissions to the DA layer. This includes a web-based dashboard and REST API endpoints for tracking submission statistics, monitoring DA health, and analyzing blob details. Only aggregator nodes submit data to the DA layer, so this feature is most useful when running in aggregator mode.
547+
548+
**YAML:**
549+
550+
```yaml
551+
rpc:
552+
enable_da_visualization: true
553+
```
554+
555+
**Command-line Flag:**
556+
`--rollkit.rpc.enable_da_visualization` (boolean, presence enables it)
557+
*Example:* `--rollkit.rpc.enable_da_visualization`
558+
*Default:* `false`
559+
*Constant:* `FlagRPCEnableDAVisualization`
560+
561+
See the [DA Visualizer Guide](/guides/da-visualizer.md) for detailed information on using this feature.
562+
542563
## Instrumentation Configuration (`instrumentation`)
543564

544565
Settings for enabling and configuring metrics and profiling endpoints, useful for monitoring node performance and debugging.

pkg/config/config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const (
114114

115115
// FlagRPCAddress is a flag for specifying the RPC server address
116116
FlagRPCAddress = "rollkit.rpc.address"
117+
// FlagRPCEnableDAVisualization is a flag for enabling DA visualization endpoints
118+
FlagRPCEnableDAVisualization = "rollkit.rpc.enable_da_visualization"
117119
)
118120

119121
// Config stores Rollkit configuration.
@@ -219,7 +221,8 @@ type SignerConfig struct {
219221

220222
// RPCConfig contains all RPC server configuration parameters
221223
type RPCConfig struct {
222-
Address string `mapstructure:"address" yaml:"address" comment:"Address to bind the RPC server to (host:port). Default: 127.0.0.1:7331"`
224+
Address string `mapstructure:"address" yaml:"address" comment:"Address to bind the RPC server to (host:port). Default: 127.0.0.1:7331"`
225+
EnableDAVisualization bool `mapstructure:"enable_da_visualization" yaml:"enable_da_visualization" comment:"Enable DA visualization endpoints for monitoring blob submissions. Default: false"`
223226
}
224227

225228
// Validate ensures that the root directory exists.
@@ -289,6 +292,7 @@ func AddFlags(cmd *cobra.Command) {
289292

290293
// RPC configuration flags
291294
cmd.Flags().String(FlagRPCAddress, def.RPC.Address, "RPC server address (host:port)")
295+
cmd.Flags().Bool(FlagRPCEnableDAVisualization, def.RPC.EnableDAVisualization, "enable DA visualization endpoints for monitoring blob submissions")
292296

293297
// Instrumentation configuration flags
294298
instrDef := DefaultInstrumentationConfig()

pkg/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestAddFlags(t *testing.T) {
100100
assertFlagValue(t, flags, FlagRPCAddress, DefaultConfig.RPC.Address)
101101

102102
// Count the number of flags we're explicitly checking
103-
expectedFlagCount := 36 // Update this number if you add more flag checks above
103+
expectedFlagCount := 37 // Update this number if you add more flag checks above
104104

105105
// Get the actual number of flags (both regular and persistent)
106106
actualFlagCount := 0

0 commit comments

Comments
 (0)