From d0cf4e7bad4cbfc0a0aefa17b5e9085daa59909a Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Wed, 7 Oct 2020 16:52:51 -0700 Subject: [PATCH 1/2] Simplify fork choice spec This change should be non-substantive as any blocks in `blocks` should be descendants (inclusive) of the `store.justified_checkpoint` (refer `get_filtered_block_tree`) so that in `get_head` all blocks considered as potential heads will have `slot > justified_slot`. Considering this condition universally applies, adding the `and ...` arm to the conditional is unnecessary overhead. --- specs/phase0/fork-choice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/phase0/fork-choice.md b/specs/phase0/fork-choice.md index 018cbec4b..9e7cb4848 100644 --- a/specs/phase0/fork-choice.md +++ b/specs/phase0/fork-choice.md @@ -230,7 +230,7 @@ def get_head(store: Store) -> Root: while True: children = [ root for root in blocks.keys() - if blocks[root].parent_root == head and blocks[root].slot > justified_slot + if blocks[root].parent_root == head ] if len(children) == 0: return head From 663af777376c4a60deaa14bcd18e4a3ba581da63 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Wed, 7 Oct 2020 17:11:13 -0700 Subject: [PATCH 2/2] Clean up unused variable for linter --- specs/phase0/fork-choice.md | 1 - 1 file changed, 1 deletion(-) diff --git a/specs/phase0/fork-choice.md b/specs/phase0/fork-choice.md index 9e7cb4848..e15ecd1ca 100644 --- a/specs/phase0/fork-choice.md +++ b/specs/phase0/fork-choice.md @@ -226,7 +226,6 @@ def get_head(store: Store) -> Root: blocks = get_filtered_block_tree(store) # Execute the LMD-GHOST fork choice head = store.justified_checkpoint.root - justified_slot = compute_start_slot_at_epoch(store.justified_checkpoint.epoch) while True: children = [ root for root in blocks.keys()