Commit 634e1c8
fix(forkchoice): redesign viz node weight display (#328)
## Motivation
Closes #150 .
In the original fork choice viz, node size scaled with `weight`, so a
high-weight block could grow large enough to obscure neighboring block
roots. This PR replaces it with fixed-size nodes whose inner circle
fills from the bottom proportional to `weight / validator_count`.
## Description
Every node renders at the same size; the visible inner fill is the
weight ratio. The fill animates first, then the role color (head,
safe-target, justified, finalized) flips after the fill settles. The
tooltip's `weight` line now reads `count/total (pct%)`.
## How to Use
### 1. Start a local devnet
```
make run-devnet
```
Or start a node manually:
```
cargo run --release -- \
--custom-network-config-dir ./config \
--node-key ./keys/node.key \
--node-id 0 \
--metrics-port 5054
```
### 2. Open the visualization
Navigate to `http://localhost:5054/lean/v0/fork_choice/ui` in your
browser.
The page will start polling automatically and render the fork tree as
blocks are produced.
### What to look for
- **Block at the head**: empty orange ring (no attestations yet).
- **Recent canonical blocks**: partially filled rings, getting fuller as
attestations arrive.
- **Justified / finalized blocks**: full discs in blue / green.
- **Forks (when they happen)**: competing branches show visibly lower
fill than the canonical chain.
## Screenshots
### Live local devnet
<img width="667" height="798" alt="Screenshot 2026-04-29 at 22 41 18"
src="https://github.com/user-attachments/assets/52e578bd-8ef1-4d8e-b01b-934fe6a7a4f4"
/>
### Forked tree (mocked data)
<img width="733" height="1120" alt="Screenshot 2026-04-29 at 19 59 14"
src="https://github.com/user-attachments/assets/977e9f28-a3cd-42c5-8050-a28313b343f0"
/>
## Test plan
- [x] Verified locally with a single run — 4 validators, watching head →
safe-target → justified → finalized transitions.
- [x] `make fmt`, `make lint`, `make test` — no regressions.
---------
Co-authored-by: Pablo Deymonnaz <pdeymon@fi.uba.ar>1 parent f855f53 commit 634e1c8
1 file changed
Lines changed: 96 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
80 | 98 | | |
81 | 99 | | |
82 | 100 | | |
| |||
149 | 167 | | |
150 | 168 | | |
151 | 169 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
156 | 175 | | |
157 | 176 | | |
158 | 177 | | |
| |||
193 | 212 | | |
194 | 213 | | |
195 | 214 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
205 | 218 | | |
206 | 219 | | |
207 | 220 | | |
| |||
269 | 282 | | |
270 | 283 | | |
271 | 284 | | |
272 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
273 | 291 | | |
274 | 292 | | |
275 | 293 | | |
| |||
291 | 309 | | |
292 | 310 | | |
293 | 311 | | |
294 | | - | |
295 | | - | |
| 312 | + | |
296 | 313 | | |
297 | 314 | | |
298 | 315 | | |
| |||
317 | 334 | | |
318 | 335 | | |
319 | 336 | | |
320 | | - | |
321 | | - | |
322 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
323 | 344 | | |
324 | 345 | | |
325 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
326 | 352 | | |
327 | 353 | | |
328 | 354 | | |
329 | 355 | | |
330 | 356 | | |
331 | 357 | | |
| 358 | + | |
332 | 359 | | |
333 | 360 | | |
334 | 361 | | |
| |||
391 | 418 | | |
392 | 419 | | |
393 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
394 | 425 | | |
395 | 426 | | |
396 | 427 | | |
397 | 428 | | |
398 | 429 | | |
399 | 430 | | |
400 | | - | |
| 431 | + | |
401 | 432 | | |
402 | | - | |
| 433 | + | |
403 | 434 | | |
404 | 435 | | |
405 | 436 | | |
| |||
419 | 450 | | |
420 | 451 | | |
421 | 452 | | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
426 | 473 | | |
427 | 474 | | |
428 | 475 | | |
429 | | - | |
| 476 | + | |
430 | 477 | | |
431 | 478 | | |
432 | 479 | | |
| |||
442 | 489 | | |
443 | 490 | | |
444 | 491 | | |
445 | | - | |
| 492 | + | |
| 493 | + | |
446 | 494 | | |
447 | 495 | | |
448 | | - | |
449 | | - | |
450 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
451 | 509 | | |
452 | 510 | | |
453 | | - | |
454 | 511 | | |
455 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
456 | 519 | | |
457 | 520 | | |
458 | 521 | | |
| |||
0 commit comments