From 7335a2733dc12e033b10040114ed2ee37073b76c Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 15 May 2025 07:09:35 -0500 Subject: [PATCH 1/6] Fix some nits in the Makefile --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1ccd646aab..7fc4b35bd5 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ALL_EXECUTABLE_SPEC_NAMES = \ eip6800 \ eip7441 \ eip7732 \ - eip7805 + eip7805 # A list of fake targets. .PHONY: \ @@ -36,14 +36,14 @@ NORM = $(shell tput sgr0) # Print target descriptions. help: - @echo "make $(BOLD)clean$(NORM) -- delete all untracked files" - @echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage" - @echo "make $(BOLD)kzg_setups$(NORM) -- generate trusted setups" - @echo "make $(BOLD)lint$(NORM) -- run the linters" - @echo "make $(BOLD)pyspec$(NORM) -- build python specifications" - @echo "make $(BOLD)reftests$(NORM) -- generate reference tests" - @echo "make $(BOLD)serve_docs$(NORM) -- start a local docs web server" - @echo "make $(BOLD)test$(NORM) -- run pyspec tests" + @echo "make $(BOLD)clean$(NORM) -- delete all untracked files" + @echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage" + @echo "make $(BOLD)kzg_setups$(NORM) -- generate trusted setups" + @echo "make $(BOLD)lint$(NORM) -- run the linters" + @echo "make $(BOLD)pyspec$(NORM) -- build python specifications" + @echo "make $(BOLD)reftests$(NORM) -- generate reference tests" + @echo "make $(BOLD)serve_docs$(NORM) -- start a local docs web server" + @echo "make $(BOLD)test$(NORM) -- run pyspec tests" ############################################################################### # Virtual Environment From 6a506e6cd6c2174acb72e9f8ea09a59fa59d77a4 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 15 May 2025 07:10:31 -0500 Subject: [PATCH 2/6] Fix typo in SSZ spec --- ssz/simple-serialize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssz/simple-serialize.md b/ssz/simple-serialize.md index 5569eecb9d..20110935c5 100644 --- a/ssz/simple-serialize.md +++ b/ssz/simple-serialize.md @@ -219,7 +219,7 @@ Efficient algorithms for computing this object can be found in [the implementati We first define helper functions: - `size_of(B)`, where `B` is a basic type: the length, in bytes, of the serialized form of the basic type. -- `chunk_count(type)`: calculate the amount of leafs for merkleization of the type. +- `chunk_count(type)`: calculate the amount of leaves for merkleization of the type. - all basic types: `1` - `Bitlist[N]` and `Bitvector[N]`: `(N + 255) // 256` (dividing by chunk size, rounding up) - `List[B, N]` and `Vector[B, N]`, where `B` is a basic type: `(N * size_of(B) + 31) // 32` (dividing by chunk size, rounding up) From 97c7bfc455c7d8e39b31954770dccbfc496b3aea Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 15 May 2025 07:31:06 -0500 Subject: [PATCH 3/6] Generate reference tests for EIP7732 & EIP7805 --- tests/core/pyspec/eth2spec/test/helpers/constants.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/helpers/constants.py b/tests/core/pyspec/eth2spec/test/helpers/constants.py index be065b06cd..a63bba7a2b 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/constants.py +++ b/tests/core/pyspec/eth2spec/test/helpers/constants.py @@ -35,11 +35,12 @@ FULU, # Experimental patches EIP7732, + EIP7805, ) # The forks that have light client specs LIGHT_CLIENT_TESTING_FORKS = [item for item in MAINNET_FORKS if item != PHASE0] # The forks that output to the test vectors. -TESTGEN_FORKS = (*MAINNET_FORKS, FULU) +TESTGEN_FORKS = (*MAINNET_FORKS, FULU, EIP7732, EIP7805) # Forks allowed in the test runner `--fork` flag, to fail fast in case of typos ALLOWED_TEST_RUNNER_FORKS = (*ALL_PHASES, EIP7441) From e9d021ce24ce230ee234d612877899dd00088fea Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 15 May 2025 07:46:14 -0500 Subject: [PATCH 4/6] Add updated get_forkchoice_store for EIP7805 --- specs/_features/eip7805/fork-choice.md | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/specs/_features/eip7805/fork-choice.md b/specs/_features/eip7805/fork-choice.md index 09f1870b12..fc094fdeb7 100644 --- a/specs/_features/eip7805/fork-choice.md +++ b/specs/_features/eip7805/fork-choice.md @@ -8,6 +8,7 @@ - [Fork choice](#fork-choice) - [Helpers](#helpers) - [Modified `Store`](#modified-store) + - [Modified `get_forkchoice_store`](#modified-get_forkchoice_store) - [New `validate_inclusion_lists`](#new-validate_inclusion_lists) - [New `get_attester_head`](#new-get_attester_head) - [Modified `get_proposer_head`](#modified-get_proposer_head) @@ -58,6 +59,36 @@ class Store(object): unsatisfied_inclusion_list_blocks: Set[Root] = field(default_factory=Set) ``` +### Modified `get_forkchoice_store` + +```python +def get_forkchoice_store(anchor_state: BeaconState, anchor_block: BeaconBlock) -> Store: + assert anchor_block.state_root == hash_tree_root(anchor_state) + anchor_root = hash_tree_root(anchor_block) + anchor_epoch = get_current_epoch(anchor_state) + justified_checkpoint = Checkpoint(epoch=anchor_epoch, root=anchor_root) + finalized_checkpoint = Checkpoint(epoch=anchor_epoch, root=anchor_root) + proposer_boost_root = Root() + return Store( + time=uint64(anchor_state.genesis_time + SECONDS_PER_SLOT * anchor_state.slot), + genesis_time=anchor_state.genesis_time, + justified_checkpoint=justified_checkpoint, + finalized_checkpoint=finalized_checkpoint, + unrealized_justified_checkpoint=justified_checkpoint, + unrealized_finalized_checkpoint=finalized_checkpoint, + proposer_boost_root=proposer_boost_root, + equivocating_indices=set(), + blocks={anchor_root: copy(anchor_block)}, + block_states={anchor_root: copy(anchor_state)}, + checkpoint_states={justified_checkpoint: copy(anchor_state)}, + unrealized_justifications={anchor_root: justified_checkpoint}, + # [New in EIP-7805] + inclusion_lists={}, + inclusion_list_equivocators={}, + unsatisfied_inclusion_list_blocks=set(), + ) +``` + #### New `validate_inclusion_lists` ```python From f100285e13d4e9b406f6d1cd65b79a9d16b80320 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 15 May 2025 09:27:58 -0500 Subject: [PATCH 5/6] Update CI tests; remove EIP7441, add EIP7805 --- .github/workflows/nightly-tests.yml | 2 +- .github/workflows/run-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml index 6c458a886b..4fa36fe033 100644 --- a/.github/workflows/nightly-tests.yml +++ b/.github/workflows/nightly-tests.yml @@ -30,8 +30,8 @@ jobs: - deneb - electra - fulu - - eip7441 - eip7732 + - eip7805 steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 86e1600a48..a8c2946f1d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -50,8 +50,8 @@ jobs: - deneb - electra - fulu - - eip7441 - eip7732 + - eip7805 steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 From aece1e7d51ac47cf97759fcdef765fcf8826e5ba Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 15 May 2025 09:32:05 -0500 Subject: [PATCH 6/6] Remove two field initializations --- specs/_features/eip7805/fork-choice.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/specs/_features/eip7805/fork-choice.md b/specs/_features/eip7805/fork-choice.md index fc094fdeb7..f9c71d5c4c 100644 --- a/specs/_features/eip7805/fork-choice.md +++ b/specs/_features/eip7805/fork-choice.md @@ -83,8 +83,6 @@ def get_forkchoice_store(anchor_state: BeaconState, anchor_block: BeaconBlock) - checkpoint_states={justified_checkpoint: copy(anchor_state)}, unrealized_justifications={anchor_root: justified_checkpoint}, # [New in EIP-7805] - inclusion_lists={}, - inclusion_list_equivocators={}, unsatisfied_inclusion_list_blocks=set(), ) ```