# Week 12 We are finally sending the confirmed block by FCR to EL as safe head. First of all the commands I used : ``` ./target/release/lighthouse beacon_node \ --network sepolia \ --execution-endpoint http://127.0.0.1:8551 \ --execution-jwt ~/.lighthouse-sepolia/jwt.hex \ --datadir ~/.lighthouse-sepolia \ --fast-confirmation \ --fcr-byzantine-threshold 25 \ --http --http-address 127.0.0.1 --http-port 5052 \ --metrics --metrics-address 127.0.0.1 --metrics-port 5054 \ --debug-level info \ --checkpoint-sync-url https://checkpoint-sync.sepolia.ethpandaops.io ``` ``` lcli mock-el \ --jwt-output-path ~/.lighthouse-sepolia/jwt.hex \ --network sepolia \ --listen-address 127.0.0.1 \ --listen-port 8551 ``` ``` cd consensus/fork_choice/src/monitoring make start ``` > Safe Sync was disabled and we are using Mock EL with artificial network conditions, not a real execution layer The FCR log snippets : * FCR correctly falls back to finalized checkpoints during sync, ensuring safety ``` Sep 06 08:04:10.934 INFO FCR: pruned side-table metadata finalized: 0xc89555a7ae6768070e8a747cd76aad098dc13d614583f17354ed8578c0589cde, pruned: 1, remaining: 0 Sep 06 08:04:10.935 WARN FCR: confirmed root missing, using finalized confirmed_missing: 0xa97700dddd36edc29fb75f9e52caa4de790cf60955d3b5b19b679cad4005f401, finalized: 0xc89555a7ae6768070e8a747cd76aad098dc13d614583f17354ed8578c0589cde ``` * FCR begins working immediately after sync completion. ``` Sep 06 08:12:42.653 INFO Synced peers: "62", exec_hash: "0x0ef53eeec51b298540df28c27f22259fab5d7ba9846b8192f32566902637c042 (unverified)", finalized_root: 0xcd05bbce0fa5af5a7b1eefa8a691d018059c461675f79f05f34236c4b032a684, finalized_epoch: 264093, epoch: 264095, block: "0x7b1a7ac8ee0b0335c9ed75415cdb980f18929e404556ae529bf9ad3f32c95183", slot: 8451063 Sep 06 08:12:43.711 INFO FCR: advanced latest confirmed descendant old: 0xcd05bbce0fa5af5a7b1eefa8a691d018059c461675f79f05f34236c4b032a684, new: 0xbcec88991370152ac18dc5b8fa6ec33387eeaff2d9b479b678f4765ab246f5cd, head: 0x7b1a7ac8ee0b0335c9ed75415cdb980f18929e404556ae529bf9ad3f32c95183 Sep 06 08:12:43.711 INFO FCR get_latest_confirmed: result confirmed: 0xbcec88991370152ac18dc5b8fa6ec33387eeaff2d9b479b678f4765ab246f5cd, confirmed_slot: 8451061, head: 0x7b1a7ac8ee0b0335c9ed75415cdb980f18929e404556ae529bf9ad3f32c95183, head_slot: 8451063 ``` * Initially, FCR starts with confirmed block `0x5b14e489669cf6ca35b4365f29f6e4c8365e3044a19b6fa94be375d35ad915d2` at slot `8451071` * FCR successfully advances the confirmed descendant from the finalized checkpoint to a newer block, demonstrating the core confirmation logic is working ``` Sep 06 08:12:43.711 INFO FCR: advanced latest confirmed descendant old: 0xcd05bbce0fa5af5a7b1eefa8a691d018059c461675f79f05f34236c4b032a684, new: 0xbcec88991370152ac18dc5b8fa6ec33387eeaff2d9b479b678f4765ab246f5cd, head: 0x7b1a7ac8ee0b0335c9ed75415cdb980f18929e404556ae529bf9ad3f32c95183 Sep 06 08:12:43.711 INFO FCR get_latest_confirmed: result confirmed: 0xbcec88991370152ac18dc5b8fa6ec33387eeaff2d9b479b678f4765ab246f5cd, confirmed_slot: 8451061, head: 0x7b1a7ac8ee0b0335c9ed75415cdb980f18929e404556ae529bf9ad3f32c95183, head_slot: 8451063 ``` * FCR is properly updating the confirmed root on each slot - `Sep 06 08:19:00.288 INFO FCR: per-slot confirmed root updated old: 0x5b14e489669cf6ca35b4365f29f6e4c8365e3044a19b6fa94be375d35ad915d2, new: 0x23791ef42187c5a6cf50e558ee347bc55eab2af1b8cdbdf3739d494ca477233c, slot: 8451095` * FCR is correctly handling epoch boundaries and checking for epoch-start uplift conditions as specified - `Sep 06 08:20:47.500 INFO FCR: checking epoch-start uplift conditions current_slot: 8451104, prev_uj_epoch: 264096, current_epoch: 264097, epoch_boundary: true Sep 06 08:20:47.500 INFO FCR: no epoch-start uplift needed (confirmed already ahead) prev_uj_slot: 8451072, confirmed_slot: 8451101` * FCR continuously advances confirmation along the canonical chain ``` Sep 06 08:13:12.619 INFO FCR: advanced latest confirmed descendant old: 0xbcec88991370152ac18dc5b8fa6ec33387eeaff2d9b479b678f4765ab246f5cd, new: 0x9cad3c734f00be7f4a1fda96e83bb3719df8295327a209f5d8f60c9612fb94a8, head: 0x9cad3c734f00be7f4a1fda96e83bb3719df8295327a209f5d8f60c9612fb94a8 Sep 06 08:13:35.714 INFO FCR: advanced latest confirmed descendant old: 0xbcec88991370152ac18dc5b8fa6ec33387eeaff2d9b479b678f4765ab246f5cd, new: 0xfd3dea36886eda460cf8737cc58995e177ec5b736018c5439079b3f55c8ac6f1, head: 0xfd3dea36886eda460cf8737cc58995e177ec5b736018c5439079b3f55c8ac6f1 Sep 06 08:13:47.534 INFO FCR: advanced latest confirmed descendant old: 0xfd3dea36886eda460cf8737cc58995e177ec5b736018c5439079b3f55c8ac6f1, new: 0x8505a4d03f62b7527ffc84e27ca93f47c9ef55c8204b299735b6bea54c0bb445, head: 0x8505a4d03f62b7527ffc84e27ca93f47c9ef55c8204b299735b6bea54c0bb445 ``` * The safe head is being updated in real-time, which means FCR is providing fast confirmation as intended - `Sep 06 08:19:00.288 INFO FCR: safe head updated (O(1)) old_safe_head: 0x5b14e489669cf6ca35b4365f29f6e4c8365e3044a19b6fa94be375d35ad915d2, new_safe_head: 0x23791ef42187c5a6cf50e558ee347bc55eab2af1b8cdbdf3739d494ca477233c` It's time to see the benchmarks and compare with [Prysm's implementation](https://ethresear.ch/t/fast-confirmation-rule-on-safe-head-in-prysm/22167). ### Core Algorithm Performance | Benchmark | Time (ns) | Significance | |-----------|-----------|--------------| | **Committee Weight Adjustment** | | | | `adjust_committee_weight/1000000` | 20.8 | Core safety adjustment factor calculation | | `adjust_committee_weight/1000000000` | 22.4 | Large balance adjustment performance | | `adjust_committee_weight/10000000000` | 22.0 | Maximum balance adjustment performance | | **Cross-Epoch Weight Estimation** | | | | `cross_epoch_weight_estimate/0-3` | 30.4 | Early epoch boundary weight calculation | | `cross_epoch_weight_estimate/31-32` | 31.8 | Epoch boundary transition calculation | | `cross_epoch_weight_estimate/28-40` | 37.1 | Complex cross-epoch weight estimation | | **FFG Weight Calculation** | | | | `ffg_weight_till_slot/0` | 23.5 | Start of epoch FFG weight | | `ffg_weight_till_slot/1` | 20.1 | Early slot FFG weight | | `ffg_weight_till_slot/15` | 20.3 | Mid-epoch FFG weight | | `ffg_weight_till_slot/31` | 22.9 | End of epoch FFG weight | | `ffg_weight_till_slot/32` | 21.0 | Next epoch FFG weight | | `ffg_weight_till_slot/40` | 24.3 | Late epoch FFG weight | | **Validator Set Coverage** | | | | `full_validator_set_covered/0-31` | 25.9 | Single epoch coverage check | | `full_validator_set_covered/0-32` | 30.4 | Cross-epoch coverage check | | `full_validator_set_covered/1-40` | 24.1 | Partial epoch coverage check | ### Confirmation Logic Performance | Benchmark | Time (ns) | Significance | |-----------|-----------|--------------| | **Core Confirmation Math** | | | | `is_one_confirmed_math/S10000000000_W15000000000_pb0_b25` | 4.2 | Basic confirmation inequality (25% Byzantine) | | `is_one_confirmed_math/S18000000000_W20000000000_pb100000_b25` | 3.8 | Confirmation with proposer boost | | `is_one_confirmed_math/S30000000000_W32000000000_pb500000_b33` | 4.1 | High Byzantine threshold (33%) | | `is_one_confirmed_math/S6000000000_W10000000000_pb0_b10` | 3.8 | Low Byzantine threshold (10%) | | **Confirmation with Weight Estimation** | | | | `is_one_confirmed_w_estimate/0-3_S8000000000_b10` | 31.7 | Early epoch confirmation (10% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S8000000000_b25` | 26.6 | Early epoch confirmation (25% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S8000000000_b33` | 27.7 | Early epoch confirmation (33% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S16000000000_b10` | 32.1 | Higher support confirmation (10% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S16000000000_b25` | 28.0 | Higher support confirmation (25% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S16000000000_b33` | 28.3 | Higher support confirmation (33% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S24000000000_b10` | 25.6 | Maximum support confirmation (10% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S24000000000_b25` | 23.1 | Maximum support confirmation (25% Byzantine) | | `is_one_confirmed_w_estimate/0-3_S24000000000_b33` | 30.4 | Maximum support confirmation (33% Byzantine) | ### Fork Choice Integration | Benchmark | Time (ps) | Significance | |-----------|-----------|--------------| | `fork_choice_overhead/get_head_with_fcr` | 83.9 | FCR overhead on fork choice head selection | | `fork_choice_overhead/get_head_without_fcr` | 80.3 | Baseline fork choice head selection | ### Validator Scaling Performance | Benchmark | Time | Significance | |-----------|------|--------------| | **Committee Weight Scaling** | | | | `validator_scaling/committee_weight/100000` | 2.0 ns | 100K validators committee weight | | `validator_scaling/committee_weight/500000` | 2.0 ns | 500K validators committee weight | | `validator_scaling/committee_weight/1000000` | 2.3 ns | 1M validators committee weight | | **FFG Support Scaling** | | | | `validator_scaling/ffg_support/100000` | 288 ps | 100K validators FFG support | | `validator_scaling/ffg_support/500000` | 402 ps | 500K validators FFG support | | `validator_scaling/ffg_support/1000000` | 291 ps | 1M validators FFG support | ### Memory Usage Performance | Benchmark | Time (µs) | Significance | |-----------|-----------|--------------| | `memory_usage/metadata_growth` | 146.0 | FCR metadata cache growth performance | | `memory_usage/pruning_effectiveness` | 164.3 | FCR metadata pruning performance | | `memory_usage/memory_vs_validators/100000` | 11.0 | Memory usage with 100K validators | | `memory_usage/memory_vs_validators/500000` | 75.7 | Memory usage with 500K validators | | `memory_usage/memory_vs_validators/1000000` | 151.2 | Memory usage with 1M validators | ### Production Scenarios | Benchmark | Time (ns) | Significance | |-----------|-----------|--------------| | `production_scenarios/epoch_boundary_transition` | 8.6 | Epoch boundary handling performance | | `production_scenarios/reorg_detection` | 2.1 | Reorganization detection performance | | `production_scenarios/late_attestation_handling` | 77.0 ps | Late attestation processing performance | ### Safe Head Performance | Benchmark | Time (ns) | Significance | |-----------|-----------|--------------| | `safe_head_performance/safe_head_calculation` | 8.6 | Safe head calculation performance | | `safe_head_performance/safe_head_reorg` | 2.3 | Safe head reorganization handling | | `safe_head_performance/safe_head_advancement` | 8.1 | Safe head advancement along canonical chain | ### Cross-Epoch Performance | Benchmark | Time | Significance | |-----------|------|--------------| | `cross_epoch_performance/cross_epoch_confirmation` | 71.3 ps | Cross-epoch confirmation advancement | | `cross_epoch_performance/epoch_boundary_weights` | 2.2 ns | Epoch boundary weight calculations | Current Safe Head Slot : ![Screenshot 2025-09-06 at 4.10.32 PM](https://hackmd.io/_uploads/BygTkqYqxl.png) Safe head advancement rate (should be ~5 slots/minute) : ![Screenshot 2025-09-06 at 4.26.12 PM](https://hackmd.io/_uploads/HyFUXqtclg.png) Average confirmation time per operation : ![Screenshot 2025-09-06 at 4.26.54 PM](https://hackmd.io/_uploads/ByQFmct9el.png) 95th percentile confirmation time : ![Screenshot 2025-09-06 at 4.27.22 PM](https://hackmd.io/_uploads/Bk0qm5Y9xg.png) Confirmation rate per slot (should be ~1 per 12 seconds) : ![Screenshot 2025-09-06 at 4.37.15 PM](https://hackmd.io/_uploads/Byex8qFqxl.png) Total confirmations processed : ![Screenshot 2025-09-06 at 4.28.16 PM](https://hackmd.io/_uploads/SkrCXqKcge.png) Average validator support over time : ![Screenshot 2025-09-06 at 4.28.51 PM](https://hackmd.io/_uploads/Bk9gN5Fqgl.png) 95th percentile validator support : ![Screenshot 2025-09-06 at 4.29.33 PM](https://hackmd.io/_uploads/r1NXVqK9xg.png) Late attestation rate per minute : ![Screenshot 2025-09-06 at 4.30.23 PM](https://hackmd.io/_uploads/HkV8E9Yqxx.png) Total late attestations detected : ![Screenshot 2025-09-06 at 4.30.57 PM](https://hackmd.io/_uploads/HkK_4qK9lx.png) Late attestation percentage of total : ![Screenshot 2025-09-06 at 4.31.26 PM](https://hackmd.io/_uploads/HkNqNqt9ex.png) Epoch boundary transitions : ![Screenshot 2025-09-06 at 4.32.37 PM](https://hackmd.io/_uploads/ByoREcF5xe.png) Confirmation success rate (confirmations per slot) : ![Screenshot 2025-09-06 at 4.33.04 PM](https://hackmd.io/_uploads/Hy8xr5tcxg.png) Average time between confirmations : ![Screenshot 2025-09-06 at 4.33.34 PM](https://hackmd.io/_uploads/By4fS5Kcxg.png) Confirmation throughput : ![Screenshot 2025-09-06 at 4.34.02 PM](https://hackmd.io/_uploads/rykEH9F9ge.png) Safe head advancement vs epoch boundaries : ![Screenshot 2025-09-06 at 4.34.25 PM](https://hackmd.io/_uploads/rkPSr9K9xg.png) Epoch transition frequency : ![Screenshot 2025-09-06 at 4.34.51 PM](https://hackmd.io/_uploads/B1xvB9tcxl.png) Confirmation rate correlation with late attestations : ![Screenshot 2025-09-06 at 4.35.56 PM](https://hackmd.io/_uploads/B1ZoBqF5ee.png) I have to improve the benchmarking setup even more. Havent added per slot benchmark yet, will do it after my exam tomorrow!