Commit dd98534
authored
Hierarchical state diffs in hot DB (#6750)
This PR implements #5978 (tree-states) but on the hot DB. It allows Lighthouse to massively reduce its disk footprint during non-finality and overall I/O in all cases.
Closes #6580
Conga into #6744
### TODOs
- [x] Fix OOM in CI #7176
- [x] optimise store_hot_state to avoid storing a duplicate state if the summary already exists (should be safe from races now that pruning is cleaner)
- [x] mispelled: get_ancenstor_state_root
- [x] get_ancestor_state_root should use state summaries
- [x] Prevent split from changing during ancestor calc
- [x] Use same hierarchy for hot and cold
### TODO Good optimization for future PRs
- [ ] On the migration, if the latest hot snapshot is aligned with the cold snapshot migrate the diffs instead of the full states.
```
align slot time
10485760 Nov-26-2024
12582912 Sep-14-2025
14680064 Jul-02-2026
```
### TODO Maybe things good to have
- [ ] Rename anchor_slot https://github.com/sigp/lighthouse/compare/tree-states-hot-rebase-oom...dapplion:lighthouse:tree-states-hot-anchor-slot-rename?expand=1
- [ ] Make anchor fields not public such that they must be mutated through a method. To prevent un-wanted changes of the anchor_slot
### NOTTODO
- [ ] Use fork-choice and a new method [`descendants_of_checkpoint`](ca2388e#diff-046fbdb517ca16b80e4464c2c824cf001a74a0a94ac0065e635768ac391062a8) to filter only the state summaries that descend of finalized checkpoint]1 parent 6786b9d commit dd98534
File tree
33 files changed
+2690
-807
lines changed- account_manager/src/validator
- beacon_node
- beacon_chain
- src
- schema_change
- tests
- src
- store/src
- database
- impls
- book/src
- common/malloc_utils/src
- lighthouse/tests
33 files changed
+2690
-807
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
4043 | 4043 | | |
4044 | 4044 | | |
4045 | 4045 | | |
4046 | | - | |
4047 | | - | |
4048 | 4046 | | |
4049 | 4047 | | |
4050 | 4048 | | |
| |||
4056 | 4054 | | |
4057 | 4055 | | |
4058 | 4056 | | |
4059 | | - | |
4060 | 4057 | | |
4061 | 4058 | | |
4062 | 4059 | | |
| |||
6851 | 6848 | | |
6852 | 6849 | | |
6853 | 6850 | | |
| 6851 | + | |
| 6852 | + | |
| 6853 | + | |
| 6854 | + | |
| 6855 | + | |
| 6856 | + | |
| 6857 | + | |
| 6858 | + | |
| 6859 | + | |
6854 | 6860 | | |
6855 | 6861 | | |
6856 | 6862 | | |
6857 | 6863 | | |
6858 | 6864 | | |
6859 | 6865 | | |
6860 | | - | |
| 6866 | + | |
6861 | 6867 | | |
6862 | 6868 | | |
6863 | 6869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
1467 | 1467 | | |
1468 | 1468 | | |
1469 | 1469 | | |
1470 | | - | |
1471 | | - | |
| 1470 | + | |
| 1471 | + | |
1472 | 1472 | | |
1473 | 1473 | | |
1474 | 1474 | | |
1475 | | - | |
| 1475 | + | |
1476 | 1476 | | |
1477 | | - | |
1478 | 1477 | | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
1485 | | - | |
1486 | | - | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
1487 | 1482 | | |
1488 | | - | |
1489 | | - | |
1490 | | - | |
1491 | | - | |
1492 | 1483 | | |
1493 | 1484 | | |
1494 | 1485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
| 385 | + | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
| 388 | + | |
392 | 389 | | |
393 | 390 | | |
394 | 391 | | |
| 392 | + | |
395 | 393 | | |
396 | 394 | | |
397 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
398 | 401 | | |
399 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
400 | 408 | | |
401 | 409 | | |
402 | 410 | | |
| |||
521 | 529 | | |
522 | 530 | | |
523 | 531 | | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
524 | 539 | | |
525 | 540 | | |
526 | 541 | | |
| |||
541 | 556 | | |
542 | 557 | | |
543 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
544 | 579 | | |
545 | 580 | | |
546 | 581 | | |
| |||
551 | 586 | | |
552 | 587 | | |
553 | 588 | | |
| 589 | + | |
| 590 | + | |
554 | 591 | | |
555 | 592 | | |
556 | 593 | | |
| |||
580 | 617 | | |
581 | 618 | | |
582 | 619 | | |
583 | | - | |
584 | 620 | | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | 621 | | |
591 | 622 | | |
592 | 623 | | |
| |||
598 | 629 | | |
599 | 630 | | |
600 | 631 | | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | 632 | | |
609 | 633 | | |
610 | 634 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
0 commit comments