Commit 9b3a109
committed
fix(metrics): keep pots gauges live at tip (treasury/reserves froze one epoch stale)
dugite_treasury_lovelace / dugite_reserves_lovelace are refreshed from
ls.epochs only on the bulk-sync catch-up branch of apply_fetched_block
and on the forge path. At tip, received blocks take the `at_tip` branch
which calls publish_ledger_view (which does NOT touch the pots atomics),
so once the node reaches tip the gauges freeze at the last catch-up value
and never reflect the reserves->treasury reward-update transfer applied at
an epoch boundary the node did not forge itself.
Observed on preview epoch 1332->1333: the gauges read the exact epoch-1332
pots while the node was correctly in epoch 1333 — nearly triggering a false
reward-divergence investigation. The ledger itself is byte-exact: the
epoch-1333 snapshot has treasury=6820324388335672 reserves=7916699786696095,
matching Koios epoch 1333 to the lovelace. This is purely a metric-staleness
bug, but a dangerous one because it misleads epoch-boundary cross-checks.
Fix: add NodeMetrics::set_pots() (two O(1) atomic stores) and call it from
post_block_apply_updates — the per-block refresh that already reads live
ls.epoch under a fresh read-lock. This runs on every apply path (tip,
catch-up, forge, replay), so the pots gauge is now as live as the epoch
gauge. TDD: metrics::tests::test_set_pots_updates_gauges (red->green).
Also adds a DUGITE_DUMP_LEDGER_PROBE diagnostic to apply_bench that prints
pots + reward-update inputs (bprev_blocks_by_pool, go snapshot, ss_fee,
prev_d) straight from a snapshot — the instrument that distinguished this
metric-lag from a real ledger divergence.1 parent a774ac8 commit 9b3a109
3 files changed
Lines changed: 103 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
384 | 429 | | |
385 | 430 | | |
386 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1452 | 1452 | | |
1453 | 1453 | | |
1454 | 1454 | | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
1455 | 1471 | | |
1456 | 1472 | | |
1457 | 1473 | | |
| |||
3375 | 3391 | | |
3376 | 3392 | | |
3377 | 3393 | | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
3378 | 3427 | | |
3379 | 3428 | | |
3380 | 3429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6998 | 6998 | | |
6999 | 6999 | | |
7000 | 7000 | | |
7001 | | - | |
| 7001 | + | |
7002 | 7002 | | |
7003 | 7003 | | |
7004 | 7004 | | |
7005 | 7005 | | |
7006 | 7006 | | |
| 7007 | + | |
| 7008 | + | |
7007 | 7009 | | |
7008 | 7010 | | |
7009 | 7011 | | |
7010 | 7012 | | |
| 7013 | + | |
| 7014 | + | |
| 7015 | + | |
| 7016 | + | |
| 7017 | + | |
| 7018 | + | |
7011 | 7019 | | |
7012 | 7020 | | |
7013 | 7021 | | |
| |||
0 commit comments