@@ -32,27 +32,17 @@ The monitor command streams EVM block headers and verifies DA submission on Cele
3232
3333``` bash
3434./da-monitor monitor \
35- --header-namespace " 0x0000000000000000000000000000000000000086c8d75ed85ef620ef51 " \
36- --data-namespace " 0x00000000000000000000000000000000000000893f79d6e2c81a4d08c4 "
35+ --header-namespace collect_testnet_header \
36+ --data-namespace collect_testnet_data
3737```
3838
39- ### Verify a Specific Block
40-
41- To verify a single block height instead of streaming:
42-
43- ``` bash
44- ./da-monitor monitor \
45- --header-namespace " 0x0000000000000000000000000000000000000086c8d75ed85ef620ef51" \
46- --data-namespace " 0x00000000000000000000000000000000000000893f79d6e2c81a4d08c4" \
47- --block-height 100
48- ```
4939
5040### Enable Prometheus Metrics
5141
5242``` bash
5343./da-monitor monitor \
54- --header-namespace " 0x0000000000000000000000000000000000000086c8d75ed85ef620ef51 " \
55- --data-namespace " 0x00000000000000000000000000000000000000893f79d6e2c81a4d08c4 " \
44+ --header-namespace collect_testnet_header \
45+ --data-namespace collect_testnet_data \
5646 --enable-metrics \
5747 --port 2112
5848```
@@ -64,8 +54,8 @@ Metrics will be available at `http://localhost:2112/metrics`
6454### Command-Line Flags
6555
6656** Required:**
67- - ` --header-namespace ` : Header namespace (29-byte hex string )
68- - ` --data-namespace ` : Data namespace (29-byte hex string )
57+ - ` --header-namespace ` : Header namespace (e.g. collect_testnet_header )
58+ - ` --data-namespace ` : Data namespace (e.g. collect_testnet_data )
6959
7060** Optional:**
7161- ` --evnode-addr ` : ev-node Connect RPC address (default: ` http://localhost:7331 ` )
@@ -74,7 +64,7 @@ Metrics will be available at `http://localhost:2112/metrics`
7464- ` --celestia-token ` : Celestia authentication token (optional)
7565- ` --block-height ` : Specific block height to verify (0 = stream mode, default: 0)
7666- ` --duration ` : Duration in seconds to stream (0 = infinite, default: 30)
77- - ` --chainID ` : Chain identifier for metrics labels (default: "testnet")
67+ - ` --chain-id ` : Chain identifier for metrics labels (default: "testnet")
7868- ` --enable-metrics ` : Enable Prometheus metrics HTTP server (default: false)
7969- ` --port ` : HTTP server port for metrics (default: 2112)
8070- ` --verbose ` : Enable verbose logging (default: false)
@@ -83,164 +73,23 @@ Metrics will be available at `http://localhost:2112/metrics`
8373
8474``` bash
8575./da-monitor monitor \
86- --header-namespace " 0x0000000000000000000000000000000000000086c8d75ed85ef620ef51 " \
87- --data-namespace " 0x00000000000000000000000000000000000000893f79d6e2c81a4d08c4 " \
76+ --header-namespace collect_testnet_header \
77+ --data-namespace collect_testnet_data \
8878 --evnode-addr " http://my-evnode:7331" \
89- --evm-ws-url " ws://my-evm:8546" \
90- --celestia-url " http://my-celestia:26658" \
91- --duration 0 \
92- --verbose
79+ --evm-ws-url " ws://my-evnode:8546" \
80+ --celestia-url " http://my-celestia:26658"
9381```
9482
95- ## How It Works
96-
97- ### Block Verification Flow
98-
99- For each new block header:
100-
101- 1 . ** Header Reception** : Subscribes to EVM block headers via WebSocket
102- 2 . ** DA Query** : Queries ev-node Store API for DA heights where block was published
103- 3 . ** Verification** : Verifies header and data blobs on Celestia at those DA heights
104- 4 . ** Retry Logic** : Automatically retries with exponential backoff if DA submission is pending
105- 5 . ** Metrics** : Updates Prometheus metrics tracking verification status
106-
107- ### Retry Strategy
108-
109- The monitor uses intelligent retry logic for pending DA submissions:
110- - ** Immediate** : First attempt right away
111- - ** 20s** : Second attempt after 20 seconds
112- - ** 40s** : Third attempt after 40 seconds
113- - ** 60s** : Fourth attempt after 60 seconds
114- - ** 90s** : Fifth attempt after 90 seconds
115- - ** 120s** : Sixth and final attempt after 120 seconds
116-
117- After max retries, unverified blocks are recorded in Prometheus metrics.
118-
11983## Prometheus Metrics
12084
12185When metrics are enabled, the following metrics are exposed:
12286
12387### ` da_monitor_unsubmitted_block_range_start `
12488- ** Type** : Gauge
125- - ** Labels** : ` chain ` , ` blob_type ` , ` range_id `
89+ - ** Labels** : ` chain_id ` , ` blob_type ` , ` range_id `
12690- ** Description** : Start block height of unverified block ranges
12791
12892### ` da_monitor_unsubmitted_block_range_end `
12993- ** Type** : Gauge
130- - ** Labels** : ` chain ` , ` blob_type ` , ` range_id `
94+ - ** Labels** : ` chain_id ` , ` blob_type ` , ` range_id `
13195- ** Description** : End block height of unverified block ranges
132-
133- ### Example Metrics
134-
135- ```
136- # HELP da_monitor_unsubmitted_block_range_start start of unsubmitted block range
137- # TYPE da_monitor_unsubmitted_block_range_start gauge
138- da_monitor_unsubmitted_block_range_start{blob_type="header",chain="testnet",range_id="100-105"} 100
139-
140- # HELP da_monitor_unsubmitted_block_range_end end of unsubmitted block range
141- # TYPE da_monitor_unsubmitted_block_range_end gauge
142- da_monitor_unsubmitted_block_range_end{blob_type="header",chain="testnet",range_id="100-105"} 105
143- ```
144-
145- ## Example Output
146-
147- ### Streaming Mode
148-
149- ```
150- 2024-01-15T10:30:45Z INF processing block block_height=150 hash=0x1234... has_transactions=true gas_used=21000
151- 2024-01-15T10:30:45Z INF header blob verified on Celestia block_height=150 namespace=header da_height=8423260 duration=45ms
152- 2024-01-15T10:30:45Z INF data blob verified on Celestia block_height=150 namespace=data da_height=8423260 duration=67ms
153- ```
154-
155- ### One-Shot Mode
156-
157- ```
158- 2024-01-15T10:30:45Z INF using header namespace header_namespace=0000000000000000000000000000000000000086c8d75ed85ef620ef51
159- 2024-01-15T10:30:45Z INF using data namespace data_namespace=00000000000000000000000000000000000000893f79d6e2c81a4d08c4
160- 2024-01-15T10:30:45Z INF processing block block_height=100 hash=0x5678... has_transactions=true gas_used=42000
161- 2024-01-15T10:30:45Z INF retrieved block data from ev-node header_da_height=8423100 data_da_height=8423100
162- 2024-01-15T10:30:45Z INF ✓ header blob VERIFIED on Celestia - commitment matches da_height=8423100
163- 2024-01-15T10:30:45Z INF data blob VERIFIED on Celestia da_height=8423100
164- ```
165-
166- ## Development
167-
168- ### Running Tests
169-
170- ``` bash
171- # Run all tests
172- go test ./...
173-
174- # Run tests with verbose output
175- go test -v ./...
176-
177- # Run tests with coverage
178- go test -cover ./...
179- ```
180-
181- ### Building Docker Image
182-
183- ``` bash
184- docker build -t da-monitor .
185- ```
186-
187- ## Architecture
188-
189- ### Components
190-
191- - ** cmd/monitor.go** : CLI entry point and orchestration
192- - ** cmd/verifier.go** : Block verification and retry logic
193- - ** internal/celestia** : Celestia DA client
194- - ** internal/evm** : EVM client for header streaming
195- - ** internal/evnode** : ev-node Store API client
196- - ** internal/metrics** : Prometheus metrics tracking
197-
198- ### Key Types
199-
200- ``` go
201- // BlockVerifier handles verification of blocks against Celestia DA
202- type BlockVerifier struct {
203- evnodeClient *evnode.Client
204- celestiaClient *celestia.Client
205- evmClient *evm.Client
206- headerNS []byte
207- dataNS []byte
208- metrics *metrics.Metrics
209- chainID string
210- }
211- ```
212-
213- ## Troubleshooting
214-
215- ### Connection Issues
216-
217- If you see connection errors, verify your endpoints are correct:
218-
219- ``` bash
220- # Test ev-node connectivity
221- curl http://localhost:7331
222-
223- # Test Celestia connectivity
224- curl http://localhost:26658
225- ```
226-
227- ### Missing Blobs
228-
229- If blobs are not found on Celestia:
230- - Check that the namespaces are correct
231- - Verify DA submission is enabled on your ev-node
232- - Check ev-node logs for DA submission errors
233- - Wait for retry logic to complete (up to 5 minutes)
234-
235- ### Prometheus Metrics Not Available
236-
237- Ensure you've enabled metrics:
238- ``` bash
239- ./da-monitor monitor ... --enable-metrics --port 2112
240- ```
241-
242- Then check: ` http://localhost:2112/metrics `
243-
244- ## License
245-
246- See LICENSE file for details.
0 commit comments