Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.5.0-alpha.10 #4036

Merged
merged 142 commits into from
Dec 14, 2024
Merged
Changes from 1 commit
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
d46d275
`p2p-interface.md`: Add `quic` ENR entry.
nalepae Apr 2, 2024
093f5f3
EIP-7742: uncouple blob counts across CL and EL
ralexstokes Jun 12, 2024
95ddd15
Document `ForkDigest`-context for EIP-4844 `BlobSidecar` in Electra
etan-status Jul 22, 2024
dec28c1
Rename to `ForkDigestValue` for Gossipsub topics
etan-status Jul 24, 2024
8c2a864
Merge branch 'dev' into cl-drives-blob-limit
ralexstokes Aug 21, 2024
87b5f1a
updates to send maximum blob count
ralexstokes Aug 22, 2024
c37a28d
Merge branch 'dev' into ef-blobp2p
etan-status Sep 19, 2024
cbc4b55
EIP-7594: Decouple network subnets from das-core
ppopth Jun 29, 2024
68d32ac
Delete trailing whitespace for markdown files
jtraglia Oct 11, 2024
f30d7be
Delete trailing whitespace for yaml files
jtraglia Oct 11, 2024
6f72489
Delete trailing whitespace from presets
jtraglia Oct 11, 2024
959d592
Add CI check for trailing whitespace
jtraglia Oct 11, 2024
2445bf5
Move p2p-interface intros to introduction section
jtraglia Oct 18, 2024
2962c11
Merge branch 'dev' into cl-drives-blob-limit
jtraglia Oct 21, 2024
6c635ee
Merge changes into existing engine API spec
jtraglia Oct 21, 2024
c57a90a
Rename *_blob_count to *_blobs_per_block
jtraglia Oct 22, 2024
9d762fe
Update PayloadAttributes note
jtraglia Oct 22, 2024
04225d5
Pass new args to is_valid_block_hash too
jtraglia Oct 22, 2024
6209809
Fix table of contents
jtraglia Oct 22, 2024
4da2cea
Fix mistake (missing type hint)
jtraglia Oct 29, 2024
e3eb09b
Rename maximum_blobs_per_block to max_blobs_per_block
jtraglia Oct 31, 2024
ec01912
Fix some nits in the constants/presets sections
jtraglia Nov 6, 2024
7930bb6
Add descriptions for new prefix & gwei values
jtraglia Nov 6, 2024
f024665
Clarify that it's the effective balance
jtraglia Nov 6, 2024
c662452
Move SingleAttestation after ExecutionRequests
jtraglia Nov 7, 2024
266a64c
remove `initialize_beacon_state_from_eth1` from post-altair forks
KatyaRyazantseva Nov 22, 2024
f9e4243
Merge branch 'dev' into ef-blobp2p
etan-status Nov 22, 2024
db8f852
Trim whitespace
etan-status Nov 22, 2024
d029ed3
remove `initialize_beacon_state_from_eth1` from bellatrix
KatyaRyazantseva Nov 25, 2024
8299014
Do no creds change on consolidation
mkalinin Nov 25, 2024
c6090cc
Merge branch 'dev' into cl-drives-blob-limit
ralexstokes Nov 26, 2024
3096a16
Fix block hash computation for fork transition tests
etan-status Nov 26, 2024
654333e
Add EIP-7691
hwwhww Nov 26, 2024
78c6922
bump minimal preset `MAX_BLOB_COMMITMENTS_PER_BLOCK` and `KZG_COMMITM…
hwwhww Nov 26, 2024
99f82e7
Add pending deposit and consolidation tests
mkalinin Nov 27, 2024
518cb51
delete .idea files
KatyaRyazantseva Nov 27, 2024
cb14356
Merge branch 'dev' into custody-group
ppopth Nov 27, 2024
3beca17
EIP-7594: Remove BLOB_SIDECAR_SUBNET_COUNT_EIP7594
ppopth Nov 27, 2024
493d97e
Merge pull request #4022 from etan-status/ef-blockhashfix
hwwhww Nov 28, 2024
d05c6e3
Merge pull request #4027 from ppopth/remove-blob-subnet
hwwhww Nov 28, 2024
d2072df
minor suggestions
hwwhww Nov 28, 2024
53e8d66
Add the missing `deneb.BlobSidecar`
hwwhww Nov 28, 2024
efb554f
Merge pull request #4024 from mkalinin/process-epoch-tests
hwwhww Nov 28, 2024
e762058
delete bellatrix test_initialization.py, update with_phases
KatyaRyazantseva Nov 28, 2024
29d9e8d
Fix test cases source path
hwwhww Nov 28, 2024
ea2e07e
Correct with_phases in test_validity.py
KatyaRyazantseva Nov 29, 2024
ac4e713
Update tests
mkalinin Nov 29, 2024
86a7aec
Fix `test_incorrect_inactive_validator` by using correct `source_addr…
hwwhww Nov 29, 2024
4fc6dde
Add random execution requests
KatyaRyazantseva Nov 29, 2024
bc7f927
Merge pull request #3644 from nalepae/patch-2
jtraglia Dec 2, 2024
966d59f
Fix table of contents
jtraglia Dec 2, 2024
30aed6c
Merge pull request #4029 from ethereum/fix-test-case
jtraglia Dec 2, 2024
8ff2f4c
Add random deposits requests
KatyaRyazantseva Dec 2, 2024
8a45549
Merge pull request #4004 from jtraglia/nits-in-presets-constants
jtraglia Dec 2, 2024
62a5c5f
Merge pull request #4028 from ethereum/fix-sanity-testgen
jtraglia Dec 2, 2024
e519845
Merge branch 'dev' into delete-trailing-whitespace
jtraglia Dec 2, 2024
1c979e6
Merge remote-tracking branch 'origin/dev' into delete-trailing-whites…
jtraglia Dec 2, 2024
333df69
Fix lint errors
jtraglia Dec 2, 2024
120d7a4
Add another blank line
jtraglia Dec 2, 2024
6fedfc6
Merge pull request #3977 from jtraglia/delete-trailing-whitespace
jtraglia Dec 2, 2024
36bea27
Merge remote-tracking branch 'origin/dev' into p2p-introductiion
jtraglia Dec 2, 2024
ab7cdb9
Delete last line with trailing whitespace
jtraglia Dec 2, 2024
8925022
Merge pull request #3985 from jtraglia/p2p-introductiion
jtraglia Dec 2, 2024
a7ff865
Merge branch 'dev' into issue-3663
jtraglia Dec 2, 2024
85b4d00
Merge pull request #4017 from KatyaRyazantseva/issue-3663
jtraglia Dec 2, 2024
cd42481
Apply suggestions from @jtraglia
mkalinin Dec 3, 2024
35bbe4f
Bring back comp consolidation test
mkalinin Dec 3, 2024
166d5f3
Apply suggestions from code review
KatyaRyazantseva Dec 3, 2024
d66ef16
Limit consolidating balance by validator.effective_balance
mkalinin Dec 3, 2024
414987c
Check for errors after running modcheck
jtraglia Dec 3, 2024
65b5273
Fix genesis mods; remove test_initialization
jtraglia Dec 3, 2024
e29bfb1
Remove combine_mods import
jtraglia Dec 3, 2024
baf9c36
Fix linter
jtraglia Dec 3, 2024
0d5ad32
Merge pull request #4034 from jtraglia/fix-modcheck
jtraglia Dec 3, 2024
2ec6a1c
Fix configuration table formatting
jtraglia Dec 3, 2024
3b8b799
Introduce TARGET_BLOBS_PER_BLOCK_ELECTRA
jtraglia Dec 3, 2024
dcab13d
Merge pull request #3850 from etan-status/ef-blobp2p
jtraglia Dec 3, 2024
488c8aa
Give target compounding creds in failure cases
jtraglia Dec 3, 2024
7c3ba69
Merge pull request #4020 from mkalinin/no-creds-change-on-consolidation
jtraglia Dec 3, 2024
3c212bc
Fix mistake
jtraglia Dec 3, 2024
d332e19
Bump version to 1.5.0-alpha.10
jtraglia Dec 3, 2024
c790879
Merge pull request #4035 from ethereum/bump-version-1
jtraglia Dec 3, 2024
eb7518a
Merge remote-tracking branch 'upstream/dev' into custody-group
jtraglia Dec 3, 2024
91bf029
Fix networking generator modules
jtraglia Dec 3, 2024
42588ce
Remove unused neg_polynomialcoeff function
jtraglia Dec 3, 2024
a8b509d
Merge pull request #3832 from ppopth/custody-group
jtraglia Dec 3, 2024
4dfd346
Merge pull request #4037 from jtraglia/delete-unused-neg_polynomialcoeff
jtraglia Dec 3, 2024
bdb1757
fix randrange
KatyaRyazantseva Dec 4, 2024
db25c9d
Use 16-bit random value in validator filter
jtraglia Dec 4, 2024
72061bb
Merge pull request #4032 from KatyaRyazantseva/random-block-electra
jtraglia Dec 4, 2024
408fb52
Merge remote-tracking branch 'upstream/dev' into cl-drives-blob-limit
jtraglia Dec 4, 2024
9e085e4
Move target_blobs_per_block to NewPayloadRequest
jtraglia Dec 4, 2024
d3a1c74
Fix lint
mkalinin Dec 5, 2024
5205a87
Add more extensive balance computation tests
mkalinin Dec 5, 2024
41313fe
Refactor balance computation tests
mkalinin Dec 5, 2024
6c5b60f
Fix lint
mkalinin Dec 5, 2024
554189d
Merge pull request #3800 from ralexstokes/cl-drives-blob-limit
jtraglia Dec 5, 2024
e08882e
Merge remote-tracking branch 'origin/dev' into electra-blob-count
jtraglia Dec 5, 2024
349febe
Use TARGET_BLOBS_PER_BLOCK in NewPayloadRequest
jtraglia Dec 5, 2024
2439a4c
Use Electra config variables
jtraglia Dec 5, 2024
9df5d98
Set target_blobs_per_block for Electra
jtraglia Dec 5, 2024
f44f1e7
Put TARGET_BLOBS_PER_BLOCK before MAX_BLOBS_PER_BLOCK
jtraglia Dec 5, 2024
e44bcfa
Make necessary changes for EIP7594 spec
jtraglia Dec 5, 2024
bfc49d8
Change EIP-7691 to EIP7691 in spec comments
jtraglia Dec 5, 2024
f63f6e4
Bump BlobSidecarsBy* for EIP7594 to v4
jtraglia Dec 5, 2024
c544029
Revert "Bump BlobSidecarsBy* for EIP7594 to v4"
jtraglia Dec 5, 2024
455bb98
Fix "updated in ..." notes in p2p specs
jtraglia Dec 5, 2024
373e111
Change "updated" to "modified"
jtraglia Dec 5, 2024
77cacaa
Update new in Electra comment
jtraglia Dec 6, 2024
31cd9cb
Merge pull request #4023 from ethereum/electra-blob-count
jtraglia Dec 6, 2024
ee135b1
Renaming PendingPartialWithdrawal.index to validator_index
lucassaldanha Dec 8, 2024
757a73b
Renaming PendingPartialWithdrawal.index to validator_index
lucassaldanha Dec 8, 2024
2cd9c68
Fix lint
lucassaldanha Dec 8, 2024
f498947
PR comments by jtraglia
lucassaldanha Dec 8, 2024
ca0801d
Remove trailing whitespace
lucassaldanha Dec 9, 2024
83a8042
Merge pull request #4043 from lucassaldanha/rename-pending-withdrawal…
jtraglia Dec 9, 2024
1c659a9
Fix some issues in new random execution requests
jtraglia Dec 10, 2024
d8276ac
Merge pull request #4044 from jtraglia/fix-random-exec-requests
jtraglia Dec 10, 2024
d216321
Move eip7594 directory to new fulu directory
jtraglia Oct 22, 2024
761eabb
Rename some EIP7594 names to Fulu
jtraglia Oct 22, 2024
14bfa78
Rename & fixup spec builder
jtraglia Oct 22, 2024
28719cd
Rename eip7594 to fulu, p1
jtraglia Oct 22, 2024
6a306f7
Rename eip7594 to fulu, p2
jtraglia Oct 22, 2024
0302dbf
Fix order & capitalization
jtraglia Oct 22, 2024
2106e72
Rename files
jtraglia Oct 22, 2024
f9c1ce5
Update core readme
jtraglia Oct 22, 2024
607547e
Update comments for FULU_FORK_*
jtraglia Nov 4, 2024
f15d116
Fix mistake
jtraglia Nov 4, 2024
b504270
Make changes after rebasing
jtraglia Dec 11, 2024
2b75f5f
Fix table formatting
jtraglia Dec 11, 2024
cb84461
Delete unnecessary comments
jtraglia Dec 11, 2024
deb5241
Update table entry for Fulu in README
jtraglia Dec 11, 2024
fef87e7
Merge pull request #3994 from jtraglia/fulu
jtraglia Dec 12, 2024
c752833
Remove EIP-7742 from Electra/Fulu
jtraglia Dec 12, 2024
3d18078
Merge pull request #4040 from mkalinin/limit-consolidating-balance-by-eb
jtraglia Dec 12, 2024
8f54f87
Remove unnecessary Electra fork-choice file
jtraglia Dec 12, 2024
18af2af
Merge pull request #4046 from jtraglia/remove-eip-7742
jtraglia Dec 13, 2024
98cf01d
Refactor the main Makefile (#3988)
jtraglia Dec 13, 2024
01a92dc
Merge branch 'dev' into 16-bit-filter
jtraglia Dec 13, 2024
7242a27
Merge pull request #4039 from jtraglia/16-bit-filter
jtraglia Dec 13, 2024
702dfc9
Use incorrect signature in pending deposit top up test
jtraglia Dec 13, 2024
001caab
Merge pull request #4048 from jtraglia/fix-pending-deposit-invalid-si…
jtraglia Dec 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove initialize_beacon_state_from_eth1 from post-altair forks
KatyaRyazantseva committed Nov 22, 2024
commit 266a64c3934b5ef8582e4b1cdcc2570b64dd1240
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/consensus-specs.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions docs/docs/templates/beacon-chain-template.md
Original file line number Diff line number Diff line change
@@ -66,19 +66,3 @@ class CONTAINER_NAME(Container):


### Block processing




## Testing

*Note*: The function `initialize_beacon_state_from_eth1` is modified for pure <FORK_NAME> testing only.

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit],
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
) -> BeaconState:
...
```
61 changes: 0 additions & 61 deletions specs/_features/eip7594/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -77,64 +77,3 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi
excess_blob_gas=payload.excess_blob_gas,
)
```

## Testing

*Note*: The function `initialize_beacon_state_from_eth1` is modified for pure EIP7594 testing only.

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit],
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
) -> BeaconState:
fork = Fork(
previous_version=EIP7594_FORK_VERSION, # [Modified in EIP7594] for testing only
current_version=EIP7594_FORK_VERSION, # [Modified in EIP7594]
epoch=GENESIS_EPOCH,
)
state = BeaconState(
genesis_time=eth1_timestamp + GENESIS_DELAY,
fork=fork,
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=uint64(len(deposits))),
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy
deposit_requests_start_index=UNSET_DEPOSIT_REQUESTS_START_INDEX,
)

# Process deposits
leaves = list(map(lambda deposit: deposit.data, deposits))
for index, deposit in enumerate(deposits):
deposit_data_list = List[DepositData, 2**DEPOSIT_CONTRACT_TREE_DEPTH](*leaves[:index + 1])
state.eth1_data.deposit_root = hash_tree_root(deposit_data_list)
process_deposit(state, deposit)

# Process deposit balance updates
validator_pubkeys = [v.pubkey for v in state.validators]
for deposit in state.pending_deposits:
validator_index = ValidatorIndex(validator_pubkeys.index(deposit.pubkey))
increase_balance(state, validator_index, deposit.amount)
state.pending_deposits = []

# Process activations
for index, validator in enumerate(state.validators):
balance = state.balances[index]
validator.effective_balance = min(
balance - balance % EFFECTIVE_BALANCE_INCREMENT, get_max_effective_balance(validator))
if validator.effective_balance >= MIN_ACTIVATION_BALANCE:
validator.activation_eligibility_epoch = GENESIS_EPOCH
validator.activation_epoch = GENESIS_EPOCH

# Set genesis validators root for domain separation and chain versioning
state.genesis_validators_root = hash_tree_root(state.validators)

# Fill in sync committees
# Note: A duplicate committee is assigned for the current and next committee at genesis
state.current_sync_committee = get_next_sync_committee(state)
state.next_sync_committee = get_next_sync_committee(state)

# Initialize the execution payload header
state.latest_execution_payload_header = execution_payload_header

return state
```
22 changes: 0 additions & 22 deletions specs/_features/whisk/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -436,25 +436,3 @@ def get_beacon_proposer_index(state: BeaconState) -> ValidatorIndex:
assert state.latest_block_header.slot == state.slot # sanity check `process_block_header` has been called
return state.latest_block_header.proposer_index
```

## Testing

*Note*: The function `initialize_beacon_state_from_eth1` is modified purely for Whisk testing.

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit],
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
) -> BeaconState:
state_capella = capella.initialize_beacon_state_from_eth1(
eth1_block_hash,
eth1_timestamp,
deposits,
execution_payload_header,
)
state = upgrade_to_whisk(state_capella)
state.fork.previous_version = WHISK_FORK_VERSION
state.fork.current_version = WHISK_FORK_VERSION
return state
```
49 changes: 0 additions & 49 deletions specs/altair/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -672,52 +672,3 @@ def process_sync_committee_updates(state: BeaconState) -> None:
state.current_sync_committee = state.next_sync_committee
state.next_sync_committee = get_next_sync_committee(state)
```

## Initialize state for pure Altair testnets and test vectors

This helper function is only for initializing the state for pure Altair testnets and tests.

*Note*: The function `initialize_beacon_state_from_eth1` is modified: (1) using `ALTAIR_FORK_VERSION` as the previous and current fork version, (2) utilizing the Altair `BeaconBlockBody` when constructing the initial `latest_block_header`, and (3) adding initial sync committees.

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit]) -> BeaconState:
fork = Fork(
previous_version=ALTAIR_FORK_VERSION, # [Modified in Altair] for testing only
current_version=ALTAIR_FORK_VERSION, # [Modified in Altair]
epoch=GENESIS_EPOCH,
)
state = BeaconState(
genesis_time=eth1_timestamp + GENESIS_DELAY,
fork=fork,
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=uint64(len(deposits))),
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy
)

# Process deposits
leaves = list(map(lambda deposit: deposit.data, deposits))
for index, deposit in enumerate(deposits):
deposit_data_list = List[DepositData, 2**DEPOSIT_CONTRACT_TREE_DEPTH](*leaves[:index + 1])
state.eth1_data.deposit_root = hash_tree_root(deposit_data_list)
process_deposit(state, deposit)

# Process activations
for index, validator in enumerate(state.validators):
balance = state.balances[index]
validator.effective_balance = min(balance - balance % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
if validator.effective_balance == MAX_EFFECTIVE_BALANCE:
validator.activation_eligibility_epoch = GENESIS_EPOCH
validator.activation_epoch = GENESIS_EPOCH

# Set genesis validators root for domain separation and chain versioning
state.genesis_validators_root = hash_tree_root(state.validators)

# [New in Altair] Fill in sync committees
# Note: A duplicate committee is assigned for the current and next committee at genesis
state.current_sync_committee = get_next_sync_committee(state)
state.next_sync_committee = get_next_sync_committee(state)

return state
```
55 changes: 0 additions & 55 deletions specs/capella/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -484,58 +484,3 @@ def process_bls_to_execution_change(state: BeaconState,
+ address_change.to_execution_address
)
```

## Testing

*Note*: The function `initialize_beacon_state_from_eth1` is modified for pure Capella testing only.
Modifications include:
1. Use `CAPELLA_FORK_VERSION` as the previous and current fork version.
2. Utilize the Capella `BeaconBlockBody` when constructing the initial `latest_block_header`.

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit],
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
) -> BeaconState:
fork = Fork(
previous_version=CAPELLA_FORK_VERSION, # [Modified in Capella] for testing only
current_version=CAPELLA_FORK_VERSION, # [Modified in Capella]
epoch=GENESIS_EPOCH,
)
state = BeaconState(
genesis_time=eth1_timestamp + GENESIS_DELAY,
fork=fork,
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=uint64(len(deposits))),
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy
)

# Process deposits
leaves = list(map(lambda deposit: deposit.data, deposits))
for index, deposit in enumerate(deposits):
deposit_data_list = List[DepositData, 2**DEPOSIT_CONTRACT_TREE_DEPTH](*leaves[:index + 1])
state.eth1_data.deposit_root = hash_tree_root(deposit_data_list)
process_deposit(state, deposit)

# Process activations
for index, validator in enumerate(state.validators):
balance = state.balances[index]
validator.effective_balance = min(balance - balance % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
if validator.effective_balance == MAX_EFFECTIVE_BALANCE:
validator.activation_eligibility_epoch = GENESIS_EPOCH
validator.activation_epoch = GENESIS_EPOCH

# Set genesis validators root for domain separation and chain versioning
state.genesis_validators_root = hash_tree_root(state.validators)

# Fill in sync committees
# Note: A duplicate committee is assigned for the current and next committee at genesis
state.current_sync_committee = get_next_sync_committee(state)
state.next_sync_committee = get_next_sync_committee(state)

# Initialize the execution payload header
state.latest_execution_payload_header = execution_payload_header

return state
```
56 changes: 0 additions & 56 deletions specs/deneb/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -466,59 +466,3 @@ def process_registry_updates(state: BeaconState) -> None:
validator = state.validators[index]
validator.activation_epoch = compute_activation_exit_epoch(get_current_epoch(state))
```

## Testing

*Note*: The function `initialize_beacon_state_from_eth1` is modified for pure Deneb testing only.

The `BeaconState` initialization is unchanged, except for the use of the updated `deneb.BeaconBlockBody` type
when initializing the first body-root.

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit],
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
) -> BeaconState:
fork = Fork(
previous_version=DENEB_FORK_VERSION, # [Modified in Deneb] for testing only
current_version=DENEB_FORK_VERSION, # [Modified in Deneb]
epoch=GENESIS_EPOCH,
)
state = BeaconState(
genesis_time=eth1_timestamp + GENESIS_DELAY,
fork=fork,
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=uint64(len(deposits))),
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy
)

# Process deposits
leaves = list(map(lambda deposit: deposit.data, deposits))
for index, deposit in enumerate(deposits):
deposit_data_list = List[DepositData, 2**DEPOSIT_CONTRACT_TREE_DEPTH](*leaves[:index + 1])
state.eth1_data.deposit_root = hash_tree_root(deposit_data_list)
process_deposit(state, deposit)

# Process activations
for index, validator in enumerate(state.validators):
balance = state.balances[index]
validator.effective_balance = min(balance - balance % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
if validator.effective_balance == MAX_EFFECTIVE_BALANCE:
validator.activation_eligibility_epoch = GENESIS_EPOCH
validator.activation_epoch = GENESIS_EPOCH

# Set genesis validators root for domain separation and chain versioning
state.genesis_validators_root = hash_tree_root(state.validators)

# Fill in sync committees
# Note: A duplicate committee is assigned for the current and next committee at genesis
state.current_sync_committee = get_next_sync_committee(state)
state.next_sync_committee = get_next_sync_committee(state)

# Initialize the execution payload header
# If empty, will initialize a chain that has not yet gone through the Merge transition
state.latest_execution_payload_header = execution_payload_header

return state
```
67 changes: 0 additions & 67 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -1666,70 +1666,3 @@ def process_consolidation_request(
if has_eth1_withdrawal_credential(target_validator):
switch_to_compounding_validator(state, target_index)
```

## Testing

*Note*: The function `initialize_beacon_state_from_eth1` is modified for pure Electra testing only.
Modifications include:
1. Use `ELECTRA_FORK_VERSION` as the previous and current fork version.
2. Utilize the Electra `BeaconBlockBody` when constructing the initial `latest_block_header`.
3. *[New in Electra:EIP6110]* Add `deposit_requests_start_index` variable to the genesis state initialization.
4. *[New in Electra:EIP7251]* Initialize new fields to support increasing the maximum effective balance.

```python
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
eth1_timestamp: uint64,
deposits: Sequence[Deposit],
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
) -> BeaconState:
fork = Fork(
previous_version=ELECTRA_FORK_VERSION, # [Modified in Electra:EIP6110] for testing only
current_version=ELECTRA_FORK_VERSION, # [Modified in Electra:EIP6110]
epoch=GENESIS_EPOCH,
)
state = BeaconState(
genesis_time=eth1_timestamp + GENESIS_DELAY,
fork=fork,
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=uint64(len(deposits))),
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy
deposit_requests_start_index=UNSET_DEPOSIT_REQUESTS_START_INDEX, # [New in Electra:EIP6110]
)

# Process deposits
leaves = list(map(lambda deposit: deposit.data, deposits))
for index, deposit in enumerate(deposits):
deposit_data_list = List[DepositData, 2**DEPOSIT_CONTRACT_TREE_DEPTH](*leaves[:index + 1])
state.eth1_data.deposit_root = hash_tree_root(deposit_data_list)
process_deposit(state, deposit)

# Process deposit balance updates
validator_pubkeys = [v.pubkey for v in state.validators]
for deposit in state.pending_deposits:
validator_index = ValidatorIndex(validator_pubkeys.index(deposit.pubkey))
increase_balance(state, validator_index, deposit.amount)
state.pending_deposits = []

# Process activations
for index, validator in enumerate(state.validators):
balance = state.balances[index]
# [Modified in Electra:EIP7251]
validator.effective_balance = min(
balance - balance % EFFECTIVE_BALANCE_INCREMENT, get_max_effective_balance(validator))
if validator.effective_balance >= MIN_ACTIVATION_BALANCE:
validator.activation_eligibility_epoch = GENESIS_EPOCH
validator.activation_epoch = GENESIS_EPOCH

# Set genesis validators root for domain separation and chain versioning
state.genesis_validators_root = hash_tree_root(state.validators)

# Fill in sync committees
# Note: A duplicate committee is assigned for the current and next committee at genesis
state.current_sync_committee = get_next_sync_committee(state)
state.next_sync_committee = get_next_sync_committee(state)

# Initialize the execution payload header
state.latest_execution_payload_header = execution_payload_header

return state
```