From 1292bd9375db82cf1a6b73c2fab286ff64b4f959 Mon Sep 17 00:00:00 2001 From: fradamt Date: Thu, 18 Apr 2024 11:22:27 +0200 Subject: [PATCH 01/19] move to EL consolidations --- presets/mainnet/electra.yaml | 2 +- presets/minimal/electra.yaml | 2 +- specs/electra/beacon-chain.md | 91 ++++++++++++++++++----------------- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/presets/mainnet/electra.yaml b/presets/mainnet/electra.yaml index 72c626ded2..2c8d642bf7 100644 --- a/presets/mainnet/electra.yaml +++ b/presets/mainnet/electra.yaml @@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1 # `uint64(2**3)` (= 8) MAX_ATTESTATIONS_ELECTRA: 8 # `uint64(2**0)` (= 1) -MAX_CONSOLIDATIONS: 1 +MAX_CONSOLIDATIONS_PER_PAYLOAD: 1 # Execution # --------------------------------------------------------------- diff --git a/presets/minimal/electra.yaml b/presets/minimal/electra.yaml index 11aa5e1f50..beb5265746 100644 --- a/presets/minimal/electra.yaml +++ b/presets/minimal/electra.yaml @@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1 # `uint64(2**3)` (= 8) MAX_ATTESTATIONS_ELECTRA: 8 # `uint64(2**0)` (= 1) -MAX_CONSOLIDATIONS: 1 +MAX_CONSOLIDATIONS_PER_PAYLOAD: 1 # Execution # --------------------------------------------------------------- diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 62da891146..3a0deebb06 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -164,7 +164,7 @@ The following values are (non-configurable) constants used throughout the specif | Name | Value | | - | - | -| `MAX_CONSOLIDATIONS` | `uint64(1)` | +| `MAX_CONSOLIDATIONS_PER_PAYLOAD` | `uint64(1)` | ### Execution @@ -238,25 +238,15 @@ class ExecutionLayerWithdrawalRequest(Container): amount: Gwei ``` -#### `Consolidation` +#### `ExecutionLayerConsolidation` *Note*: The container is new in EIP7251. ```python -class Consolidation(Container): - source_index: ValidatorIndex - target_index: ValidatorIndex - epoch: Epoch -``` - -#### `SignedConsolidation` - -*Note*: The container is new in EIP7251. - -```python -class SignedConsolidation(Container): - message: Consolidation - signature: BLSSignature +class ExecutionLayerConsolidation(Container): + source_address: ExecutionAddress + source_pubkey: BLSPubkey + target_pubkey: BLSPubkey ``` #### `PendingConsolidation` @@ -319,7 +309,6 @@ class BeaconBlockBody(Container): execution_payload: ExecutionPayload # [Modified in Electra:EIP6110:EIP7002] bls_to_execution_changes: List[SignedBLSToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES] blob_kzg_commitments: List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK] - consolidations: List[SignedConsolidation, MAX_CONSOLIDATIONS] # [New in Electra:EIP7251] ``` #### `ExecutionPayload` @@ -348,6 +337,7 @@ class ExecutionPayload(Container): deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in Electra:EIP6110] # [New in Electra:EIP7002:EIP7251] withdrawal_requests: List[ExecutionLayerWithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD] + consolidations: List[ExecutionLayerConsolidations, MAX_CONSOLIDATIONS_PER_PAYLOAD] # [New in Electra:EIP7251] ``` #### `ExecutionPayloadHeader` @@ -375,6 +365,7 @@ class ExecutionPayloadHeader(Container): excess_blob_gas: uint64 deposit_receipts_root: Root # [New in Electra:EIP6110] withdrawal_requests_root: Root # [New in Electra:EIP7002:EIP7251] + consolidations_root: Root # [New in Electra:EIP7251] ``` #### `BeaconState` @@ -1045,7 +1036,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None: # [New in Electra:EIP7002:EIP7251] for_ops(body.execution_payload.withdrawal_requests, process_execution_layer_withdrawal_request) for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt) # [New in Electra:EIP6110] - for_ops(body.consolidations, process_consolidation) # [New in Electra:EIP7251] + for_ops(body.execution_payload.consolidations, process_execution_layer_consolidation) # [New in Electra:EIP7251] ``` ##### Attestations @@ -1297,38 +1288,48 @@ def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) ###### New `process_consolidation` ```python -def process_consolidation(state: BeaconState, signed_consolidation: SignedConsolidation) -> None: - # If the pending consolidations queue is full, no consolidations are allowed in the block - assert len(state.pending_consolidations) < PENDING_CONSOLIDATIONS_LIMIT - # If there is too little available consolidation churn limit, no consolidations are allowed in the block - assert get_consolidation_churn_limit(state) > MIN_ACTIVATION_BALANCE - consolidation = signed_consolidation.message +def process_execution_layer_consolidation(state: BeaconState, consolidation: ExecutionLayerConsolidation) -> None: + # If the pending consolidations queue is full, consolidation requests are ignored + if len(state.pending_consolidations) == PENDING_CONSOLIDATIONS_LIMIT: + return + # If there is too little available consolidation churn limit, consolidation requests are ignored + if get_consolidation_churn_limit(state) > MIN_ACTIVATION_BALANCE: + return + + validator_pubkeys = [v.pubkey for v in state.validators] + # Verify pubkeys exists + if consolidation.source_pubkey not in validator_pubkeys: + return + if consolidation.target_pubkey not in validator_pubkeys: + return + source_index = ValidatorIndex(validator_pubkeys.index(consolidation.source_pubkey)) + target_index = ValidatorIndex(validator_pubkeys.index(consolidation.target_pubkey)) + source_validator = state.validators[source_index] + target_validator = state.validators[target_validator] + # Verify that source != target, so a consolidation cannot be used as an exit. - assert consolidation.source_index != consolidation.target_index + if source_index == target_index: + return + + # Verify source withdrawal credentials + has_correct_credential = has_execution_withdrawal_credential(source_validator) + is_correct_source_address = ( + validator.withdrawal_credentials[12:] == consolidation.source_address + ) + if not (has_correct_credential and is_correct_source_address): + return - source_validator = state.validators[consolidation.source_index] - target_validator = state.validators[consolidation.target_index] # Verify the source and the target are active current_epoch = get_current_epoch(state) - assert is_active_validator(source_validator, current_epoch) - assert is_active_validator(target_validator, current_epoch) + if not is_active_validator(source_validator, current_epoch): + return + if not is_active_validator(target_validator, current_epoch): + return # Verify exits for source and target have not been initiated - assert source_validator.exit_epoch == FAR_FUTURE_EPOCH - assert target_validator.exit_epoch == FAR_FUTURE_EPOCH - # Consolidations must specify an epoch when they become valid; they are not valid before then - assert current_epoch >= consolidation.epoch - - # Verify the source and the target have Execution layer withdrawal credentials - assert has_execution_withdrawal_credential(source_validator) - assert has_execution_withdrawal_credential(target_validator) - # Verify the same withdrawal address - assert source_validator.withdrawal_credentials[12:] == target_validator.withdrawal_credentials[12:] - - # Verify consolidation is signed by the source and the target - domain = compute_domain(DOMAIN_CONSOLIDATION, genesis_validators_root=state.genesis_validators_root) - signing_root = compute_signing_root(consolidation, domain) - pubkeys = [source_validator.pubkey, target_validator.pubkey] - assert bls.FastAggregateVerify(pubkeys, signing_root, signed_consolidation.signature) + if source_validator.exit_epoch != FAR_FUTURE_EPOCH: + return + if target_validator.exit_epoch != FAR_FUTURE_EPOCH: + return # Initiate source validator exit and append pending consolidation source_validator.exit_epoch = compute_consolidation_epoch_and_update_churn( From 204b39dd74b8c430d85a01f62979fe034f7eb076 Mon Sep 17 00:00:00 2001 From: fradamt Date: Thu, 18 Apr 2024 11:30:18 +0200 Subject: [PATCH 02/19] ensure that target has execution credentials --- specs/electra/beacon-chain.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 3a0deebb06..629f33a2b4 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -1319,6 +1319,10 @@ def process_execution_layer_consolidation(state: BeaconState, consolidation: Exe if not (has_correct_credential and is_correct_source_address): return + # Verify that target has execution withdrawal credentials + if not has_execution_withdrawal_credential(target_validator): + return + # Verify the source and the target are active current_epoch = get_current_epoch(state) if not is_active_validator(source_validator, current_epoch): From 74eaf576683685b5afa8d644e9f37fd729c18332 Mon Sep 17 00:00:00 2001 From: fradamt Date: Thu, 18 Apr 2024 13:10:46 +0200 Subject: [PATCH 03/19] add consolidations_root where needed --- specs/electra/beacon-chain.md | 1 + specs/electra/fork.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 629f33a2b4..da0bc57078 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -1004,6 +1004,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi excess_blob_gas=payload.excess_blob_gas, deposit_receipts_root=hash_tree_root(payload.deposit_receipts), # [New in Electra:EIP6110] withdrawal_requests_root=hash_tree_root(payload.withdrawal_requests), # [New in Electra:EIP7002:EIP7251] + consolidations_root=hash_tree_root(payload.consolidations), # [New in Electra:EIP7251] ) ``` diff --git a/specs/electra/fork.md b/specs/electra/fork.md index ffd5f21571..2bf39029dd 100644 --- a/specs/electra/fork.md +++ b/specs/electra/fork.md @@ -91,7 +91,8 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState: blob_gas_used=pre.latest_execution_payload_header.blob_gas_used, excess_blob_gas=pre.latest_execution_payload_header.excess_blob_gas, deposit_receipts_root=Root(), # [New in Electra:EIP6110] - withdrawal_requests_root=Root(), # [New in Electra:EIP7002], + withdrawal_requests_root=Root(), # [New in Electra:EIP7002] + consolidations_root=Root(), # [New in Electra:EIP7251] ) exit_epochs = [v.exit_epoch for v in pre.validators if v.exit_epoch != FAR_FUTURE_EPOCH] From 8a6ca1c568eb214782cf8396c8e5c4b5116bf102 Mon Sep 17 00:00:00 2001 From: fradamt Date: Thu, 18 Apr 2024 13:11:36 +0200 Subject: [PATCH 04/19] fix consolidation churn limit check --- specs/electra/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index da0bc57078..18dca832ef 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -1294,7 +1294,7 @@ def process_execution_layer_consolidation(state: BeaconState, consolidation: Exe if len(state.pending_consolidations) == PENDING_CONSOLIDATIONS_LIMIT: return # If there is too little available consolidation churn limit, consolidation requests are ignored - if get_consolidation_churn_limit(state) > MIN_ACTIVATION_BALANCE: + if get_consolidation_churn_limit(state) <= MIN_ACTIVATION_BALANCE: return validator_pubkeys = [v.pubkey for v in state.validators] From e030f2cd60fa6a7fa92ed63827e6cc82d350b6de Mon Sep 17 00:00:00 2001 From: fradamt Date: Thu, 18 Apr 2024 13:45:17 +0200 Subject: [PATCH 05/19] Small fixes Co-authored-by: Mikhail Kalinin --- specs/electra/beacon-chain.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 18dca832ef..19e66d76d9 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -1315,7 +1315,7 @@ def process_execution_layer_consolidation(state: BeaconState, consolidation: Exe # Verify source withdrawal credentials has_correct_credential = has_execution_withdrawal_credential(source_validator) is_correct_source_address = ( - validator.withdrawal_credentials[12:] == consolidation.source_address + source_validator.withdrawal_credentials[12:] == consolidation.source_address ) if not (has_correct_credential and is_correct_source_address): return @@ -1344,8 +1344,8 @@ def process_execution_layer_consolidation(state: BeaconState, consolidation: Exe source_validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY ) state.pending_consolidations.append(PendingConsolidation( - source_index=consolidation.source_index, - target_index=consolidation.target_index + source_index=source_index, + target_index=target_index )) ``` From 901a2491b46d61629ac9e250d7083988887414c7 Mon Sep 17 00:00:00 2001 From: fradamt Date: Thu, 18 Apr 2024 20:33:37 +0200 Subject: [PATCH 06/19] fix typo --- specs/electra/beacon-chain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 19e66d76d9..daa28a491e 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -337,7 +337,7 @@ class ExecutionPayload(Container): deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in Electra:EIP6110] # [New in Electra:EIP7002:EIP7251] withdrawal_requests: List[ExecutionLayerWithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD] - consolidations: List[ExecutionLayerConsolidations, MAX_CONSOLIDATIONS_PER_PAYLOAD] # [New in Electra:EIP7251] + consolidations: List[ExecutionLayerConsolidation, MAX_CONSOLIDATIONS_PER_PAYLOAD] # [New in Electra:EIP7251] ``` #### `ExecutionPayloadHeader` @@ -1306,7 +1306,7 @@ def process_execution_layer_consolidation(state: BeaconState, consolidation: Exe source_index = ValidatorIndex(validator_pubkeys.index(consolidation.source_pubkey)) target_index = ValidatorIndex(validator_pubkeys.index(consolidation.target_pubkey)) source_validator = state.validators[source_index] - target_validator = state.validators[target_validator] + target_validator = state.validators[target_index] # Verify that source != target, so a consolidation cannot be used as an exit. if source_index == target_index: From c492d6198a61a06072c097f2935034a6fb8245e9 Mon Sep 17 00:00:00 2001 From: fradamt Date: Thu, 18 Apr 2024 21:18:22 +0200 Subject: [PATCH 07/19] adjust consolidations tests for EL consolidations --- ..._process_execution_layer_consolidation.py} | 713 ++++++++---------- .../eth2spec/test/helpers/consolidations.py | 61 -- tests/generators/operations/main.py | 2 +- 3 files changed, 327 insertions(+), 449 deletions(-) rename tests/core/pyspec/eth2spec/test/electra/block_processing/{test_process_consolidation.py => test_process_execution_layer_consolidation.py} (50%) delete mode 100644 tests/core/pyspec/eth2spec/test/helpers/consolidations.py diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_consolidation.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py similarity index 50% rename from tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_consolidation.py rename to tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py index a1267cb716..c6bc071b20 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_consolidation.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py @@ -2,18 +2,14 @@ from eth2spec.test.context import ( with_electra_and_later, with_presets, - always_bls, spec_test, single_phase, with_custom_state, scaled_churn_balances_exceed_activation_exit_churn_limit, default_activation_threshold, + spec_state_test, ) from eth2spec.test.helpers.keys import pubkey_to_privkey -from eth2spec.test.helpers.consolidations import ( - run_consolidation_processing, - sign_consolidation, -) from eth2spec.test.helpers.withdrawals import ( set_eth1_withdrawal_credential_with_balance, set_compounding_withdrawal_credential, @@ -37,22 +33,21 @@ def test_basic_consolidation_in_current_consolidation_epoch(spec, state): current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, source_index) - set_eth1_withdrawal_credential_with_balance(spec, state, target_index) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) + + # Set target to eth1 credentials + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) # Set earliest consolidation epoch to the expected exit epoch expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) @@ -61,7 +56,7 @@ def test_basic_consolidation_in_current_consolidation_epoch(spec, state): # Set the consolidation balance to consume equal to churn limit state.consolidation_balance_to_consume = consolidation_churn_limit - yield from run_consolidation_processing(spec, state, signed_consolidation) + yield from run_consolidation_processing(spec, state, consolidation) # Check consolidation churn is decremented correctly assert ( @@ -87,23 +82,23 @@ def test_basic_consolidation_in_new_consolidation_epoch(spec, state): current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, source_index) + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) + + # Set target to eth1 credentials set_eth1_withdrawal_credential_with_balance(spec, state, target_index) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, - ) - yield from run_consolidation_processing(spec, state, signed_consolidation) + yield from run_consolidation_processing(spec, state, consolidation) expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) # Check consolidation churn is decremented correctly @@ -130,23 +125,22 @@ def test_basic_consolidation_with_preexisting_churn(spec, state): current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, source_index) - set_eth1_withdrawal_credential_with_balance(spec, state, target_index) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) + # Set target to eth1 credentials + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + # Set earliest consolidation epoch to the expected exit epoch expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) state.earliest_consolidation_epoch = expected_exit_epoch @@ -154,7 +148,7 @@ def test_basic_consolidation_with_preexisting_churn(spec, state): preexisting_churn = 2 * spec.MIN_ACTIVATION_BALANCE state.consolidation_balance_to_consume = preexisting_churn - yield from run_consolidation_processing(spec, state, signed_consolidation) + yield from run_consolidation_processing(spec, state, consolidation) # Check consolidation churn is decremented correctly assert ( @@ -178,22 +172,21 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, source_index) - set_eth1_withdrawal_credential_with_balance(spec, state, target_index) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) + + # Set target to eth1 credentials + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) # Set earliest consolidation epoch to the first available epoch state.earliest_consolidation_epoch = spec.compute_activation_exit_epoch( @@ -203,7 +196,7 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): preexisting_churn = spec.MIN_ACTIVATION_BALANCE - spec.EFFECTIVE_BALANCE_INCREMENT state.consolidation_balance_to_consume = preexisting_churn - yield from run_consolidation_processing(spec, state, signed_consolidation) + yield from run_consolidation_processing(spec, state, consolidation) # It takes one more epoch to process the consolidation due to insufficient churn expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) + 1 @@ -227,29 +220,30 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): @single_phase def test_basic_consolidation_with_compounding_credential(spec, state): # This state has 256 validators each with 32 ETH in MINIMAL preset, 128 ETH consolidation churn - consolidation_churn_limit = spec.get_consolidation_churn_limit(state) - # Set the consolidation balance to consume equal to churn limit - state.consolidation_balance_to_consume = consolidation_churn_limit current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - - # Set source and target withdrawal credentials to the same eth1 credential - set_compounding_withdrawal_credential(spec, state, source_index) - set_compounding_withdrawal_credential(spec, state, target_index) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) - yield from run_consolidation_processing(spec, state, signed_consolidation) + + # Set target to eth1 credentials + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + + # Set the consolidation balance to consume equal to churn limit + consolidation_churn_limit = spec.get_consolidation_churn_limit(state) + state.consolidation_balance_to_consume = consolidation_churn_limit + + yield from run_consolidation_processing(spec, state, consolidation) expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) # Check consolidation churn is decremented correctly @@ -271,32 +265,32 @@ def test_basic_consolidation_with_compounding_credential(spec, state): @single_phase def test_consolidation_churn_limit_balance(spec, state): # This state has 256 validators each with 32 ETH in MINIMAL preset, 128 ETH consolidation churn - consolidation_churn_limit = spec.get_consolidation_churn_limit(state) current_epoch = spec.get_current_epoch(state) - source_index = spec.get_active_validator_indices(state, current_epoch)[0] - source_validator = state.validators[source_index] - source_validator.effective_balance = consolidation_churn_limit - # Churn limit increases due to higher total balance - updated_consolidation_churn_limit = spec.get_consolidation_churn_limit(state) target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - - # Set source and target withdrawal credentials to the same eth1 credential - set_compounding_withdrawal_credential(spec, state, source_index) - set_compounding_withdrawal_credential(spec, state, target_index) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) - yield from run_consolidation_processing(spec, state, signed_consolidation) + + # Set target to eth1 credentials + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + + # Set source effective balance to consolidation churn limit + consolidation_churn_limit = spec.get_consolidation_churn_limit(state) + state.validators[source_index].effective_balance = consolidation_churn_limit + # Churn limit increases due to higher total balance + updated_consolidation_churn_limit = spec.get_consolidation_churn_limit(state) + + yield from run_consolidation_processing(spec, state, consolidation) # validator's effective balance fits into the churn, exit as soon as possible expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) @@ -319,35 +313,35 @@ def test_consolidation_churn_limit_balance(spec, state): @single_phase def test_consolidation_balance_larger_than_churn_limit(spec, state): # This state has 256 validators each with 32 ETH in MINIMAL preset, 128 ETH consolidation churn - consolidation_churn_limit = spec.get_consolidation_churn_limit(state) current_epoch = spec.get_current_epoch(state) - source_index = spec.get_active_validator_indices(state, current_epoch)[0] - # Set source balance higher than consolidation churn limit - state.validators[source_index].effective_balance = 2 * consolidation_churn_limit target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_compounding_withdrawal_credential(spec, state, source_index) - set_compounding_withdrawal_credential(spec, state, target_index) + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) + + # Set target to eth1 credentials + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + + # Set source effective balance to 2 * consolidation churn limit + consolidation_churn_limit = spec.get_consolidation_churn_limit(state) + state.validators[source_index].effective_balance = 2 * consolidation_churn_limit # Consolidation churn limit increases due to higher total balance - new_churn_limit = spec.get_consolidation_churn_limit(state) - remainder = state.validators[source_index].effective_balance % new_churn_limit - expected_balance = new_churn_limit - remainder + updated_consolidation_churn_limit = spec.get_consolidation_churn_limit(state) + remainder = state.validators[source_index].effective_balance % updated_consolidation_churn_limit + expected_balance = updated_consolidation_churn_limit - remainder - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, - ) - yield from run_consolidation_processing(spec, state, signed_consolidation) + yield from run_consolidation_processing(spec, state, consolidation) expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) + 1 # Check consolidation churn is decremented correctly @@ -366,35 +360,34 @@ def test_consolidation_balance_larger_than_churn_limit(spec, state): @single_phase def test_consolidation_balance_through_two_churn_epochs(spec, state): # This state has 256 validators each with 32 ETH in MINIMAL preset, 128 ETH consolidation churn - consolidation_churn_limit = spec.get_consolidation_churn_limit(state) current_epoch = spec.get_current_epoch(state) - source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_compounding_withdrawal_credential(spec, state, source_index) - set_compounding_withdrawal_credential(spec, state, target_index) + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with source address + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) - # Set source balance higher than consolidation churn limit + # Set target to eth1 credentials + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + + # Set source balance higher to 3 * consolidation churn limit + consolidation_churn_limit = spec.get_consolidation_churn_limit(state) state.validators[source_index].effective_balance = 3 * consolidation_churn_limit new_churn_limit = spec.get_consolidation_churn_limit(state) remainder = state.validators[source_index].effective_balance % new_churn_limit expected_balance = new_churn_limit - remainder - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, - ) - yield from run_consolidation_processing(spec, state, signed_consolidation) + yield from run_consolidation_processing(spec, state, consolidation) # when exiting a multiple of the churn limit greater than 1, an extra exit epoch is added expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) + 2 @@ -415,25 +408,22 @@ def test_consolidation_balance_through_two_churn_epochs(spec, state): @single_phase def test_invalid_source_equals_target(spec, state): current_epoch = spec.get_current_epoch(state) - validator_index = spec.get_active_validator_indices(state, current_epoch)[0] - validator_privkey = pubkey_to_privkey[state.validators[validator_index].pubkey] - - # Set withdrawal credentials to eth1 - set_eth1_withdrawal_credential_with_balance(spec, state, validator_index) - - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, - source_index=validator_index, - target_index=validator_index, - ), - validator_privkey, - validator_privkey, + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + + # Set source to eth1 credentials + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation from source to source + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[source_index].pubkey, ) + yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @@ -449,52 +439,52 @@ def test_invalid_exceed_pending_consolidations_limit(spec, state): state.pending_consolidations = [ spec.PendingConsolidation(source_index=0, target_index=1) ] * spec.PENDING_CONSOLIDATIONS_LIMIT + + # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @with_electra_and_later -@with_presets([MINIMAL], "need sufficient consolidation churn limit") -@with_custom_state( - balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, - threshold_fn=default_activation_threshold, -) -@spec_test +@spec_state_test @single_phase def test_invalid_not_enough_consolidation_churn_available(spec, state): state.validators = state.validators[0:2] state.pending_consolidations = [ spec.PendingConsolidation(source_index=0, target_index=1) ] + + # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @@ -507,22 +497,26 @@ def test_invalid_not_enough_consolidation_churn_available(spec, state): @spec_test @single_phase def test_invalid_exited_source(spec, state): + # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + # exit source - spec.initiate_validator_exit(state, 0) + spec.initiate_validator_exit(state, source_index) + yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @@ -535,23 +529,24 @@ def test_invalid_exited_source(spec, state): @spec_test @single_phase def test_invalid_exited_target(spec, state): + # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address ) + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) # exit target spec.initiate_validator_exit(state, 1) yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @@ -564,22 +559,26 @@ def test_invalid_exited_target(spec, state): @spec_test @single_phase def test_invalid_inactive_source(spec, state): + # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + # set source validator as not yet activated - state.validators[0].activation_epoch = spec.FAR_FUTURE_EPOCH + state.validators[source_index].activation_epoch = spec.FAR_FUTURE_EPOCH + yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @@ -592,23 +591,25 @@ def test_invalid_inactive_source(spec, state): @spec_test @single_phase def test_invalid_inactive_target(spec, state): + # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + # set target validator as not yet activated state.validators[1].activation_epoch = spec.FAR_FUTURE_EPOCH yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @@ -620,49 +621,23 @@ def test_invalid_inactive_target(spec, state): ) @spec_test @single_phase -def test_invalid_no_execution_withdrawal_credential(spec, state): +def test_invalid_no_source_execution_withdrawal_credential(spec, state): + # Set up a correct consolidation, but source does not have + # an execution withdrawal credential current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, - ) - yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, ) - - -@with_electra_and_later -@with_presets([MINIMAL], "need sufficient consolidation churn limit") -@with_custom_state( - balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, - threshold_fn=default_activation_threshold, -) -@spec_test -@single_phase -def test_invalid_different_credentials(spec, state): - current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, - ) - # Set source and target withdrawal credentials to different eth1 credentials - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1, address=b"\x10" * 20) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) - @with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( @@ -671,55 +646,24 @@ def test_invalid_different_credentials(spec, state): ) @spec_test @single_phase -@always_bls -def test_invalid_source_signature(spec, state): - # This state has 256 validators each with 32 ETH in MINIMAL preset, 128 ETH consolidation churn +def test_invalid_no_target_execution_withdrawal_credential(spec, state): + # Set up a correct consolidation, but target does not have + # an execution withdrawal credential current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, source_index) - set_eth1_withdrawal_credential_with_balance(spec, state, target_index) - - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address ) - - # Set earliest consolidation epoch to the expected exit epoch - expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) - state.earliest_consolidation_epoch = expected_exit_epoch - consolidation_churn_limit = spec.get_consolidation_churn_limit(state) - # Set the consolidation balance to consume equal to churn limit - state.consolidation_balance_to_consume = consolidation_churn_limit - - current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, - ) - - # Change the pubkey of the source validator, invalidating its signature - state.validators[0].pubkey = state.validators[1].pubkey - + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False + spec, state, consolidation, success=False ) @@ -731,81 +675,76 @@ def test_invalid_source_signature(spec, state): ) @spec_test @single_phase -@always_bls -def test_invalid_target_signature(spec, state): - # This state has 256 validators each with 32 ETH in MINIMAL preset, 128 ETH consolidation churn +def test_invalid_different_credentials(spec, state): current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] - source_privkey = pubkey_to_privkey[state.validators[source_index].pubkey] - target_privkey = pubkey_to_privkey[state.validators[target_index].pubkey] - - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, source_index) + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=state.validators[target_index].pubkey, + ) set_eth1_withdrawal_credential_with_balance(spec, state, target_index) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation( - epoch=current_epoch, source_index=source_index, target_index=target_index - ), - source_privkey, - target_privkey, + + yield from run_consolidation_processing( + spec, state, consolidation, success=False ) - # Set earliest consolidation epoch to the expected exit epoch - expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) - state.earliest_consolidation_epoch = expected_exit_epoch - consolidation_churn_limit = spec.get_consolidation_churn_limit(state) - # Set the consolidation balance to consume equal to churn limit - state.consolidation_balance_to_consume = consolidation_churn_limit - current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch, source_index=0, target_index=1), - source_privkey, - target_privkey, - ) - - # Change the pubkey of the target validator, invalidating its signature - state.validators[1].pubkey = state.validators[2].pubkey - yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False - ) +def run_consolidation_processing(spec, state, consolidation, success=True): + """ + Run ``process_consolidation``, yielding: + - pre-state ('pre') + - consolidation ('consolidation') + - post-state ('post'). + If ``valid == False``, run expecting ``AssertionError`` + """ + validator_pubkeys = [v.pubkey for v in state.validators] + source_index = spec.ValidatorIndex(validator_pubkeys.index(consolidation.source_pubkey)) + target_index = spec.ValidatorIndex(validator_pubkeys.index(consolidation.target_pubkey)) + source_validator = state.validators[source_index] + target_validator = state.validators[target_index] + + yield 'pre', state + yield 'consolidation', consolidation + + pre_exit_epoch_source = source_validator.exit_epoch + pre_exit_epoch_target = target_validator.exit_epoch + pre_pending_consolidations = state.pending_consolidations.copy() + pre_state = state.copy() + + spec.process_execution_layer_consolidation(state, consolidation) + + yield 'post', state + + if success: + # Check source and target have execution credentials + assert spec.has_execution_withdrawal_credential(source_validator) + assert spec.has_execution_withdrawal_credential(target_validator) + # Check source address in the consolidation fits the withdrawal credentials + assert source_validator.withdrawal_credentials[12:] == consolidation.source_address + # Check source and target are not the same + assert source_index != target_index + # Check source and target were not exiting + assert pre_exit_epoch_source == spec.FAR_FUTURE_EPOCH + assert pre_exit_epoch_target == spec.FAR_FUTURE_EPOCH + # Check source is now exiting + assert state.validators[source_index].exit_epoch < spec.FAR_FUTURE_EPOCH + # Check that the exit epoch matches earliest_consolidation_epoch + assert state.validators[source_index].exit_epoch == state.earliest_consolidation_epoch + # Check that the correct consolidation has been appended + expected_new_pending_consolidation = spec.PendingConsolidation( + source_index=source_index, + target_index=target_index, + ) + assert state.pending_consolidations == pre_pending_consolidations + [expected_new_pending_consolidation] + if not success: + assert pre_state == state -@with_electra_and_later -@with_presets([MINIMAL], "need sufficient consolidation churn limit") -@with_custom_state( - balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, - threshold_fn=default_activation_threshold, -) -@spec_test -@single_phase -def test_invalid_before_specified_epoch(spec, state): - current_epoch = spec.get_current_epoch(state) - source_privkey = pubkey_to_privkey[state.validators[0].pubkey] - target_privkey = pubkey_to_privkey[state.validators[1].pubkey] - # Set source and target withdrawal credentials to the same eth1 credential - set_eth1_withdrawal_credential_with_balance(spec, state, 0) - set_eth1_withdrawal_credential_with_balance(spec, state, 1) - # set epoch=current_epoch + 1, so it's too early to process it - signed_consolidation = sign_consolidation( - spec, - state, - spec.Consolidation(epoch=current_epoch + 1, source_index=0, target_index=1), - source_privkey, - target_privkey, - ) - yield from run_consolidation_processing( - spec, state, signed_consolidation, valid=False - ) diff --git a/tests/core/pyspec/eth2spec/test/helpers/consolidations.py b/tests/core/pyspec/eth2spec/test/helpers/consolidations.py deleted file mode 100644 index ccdcb9e069..0000000000 --- a/tests/core/pyspec/eth2spec/test/helpers/consolidations.py +++ /dev/null @@ -1,61 +0,0 @@ -from eth2spec.utils import bls -from eth2spec.test.context import expect_assertion_error -from eth2spec.test.helpers.keys import privkeys - - -def prepare_signed_consolidations(spec, state, index_pairs, fork_version=None): - def create_signed_consolidation(source_index, target_index): - consolidation = spec.Consolidation( - epoch=spec.get_current_epoch(state), - source_index=source_index, - target_index=target_index, - ) - return sign_consolidation(spec, state, consolidation, privkeys[source_index], privkeys[target_index], - fork_version=fork_version) - - return [create_signed_consolidation(source_index, target_index) for (source_index, target_index) in index_pairs] - - -def sign_consolidation(spec, state, consolidation, source_privkey, target_privkey, fork_version=None): - domain = spec.compute_domain(spec.DOMAIN_CONSOLIDATION, genesis_validators_root=state.genesis_validators_root) - signing_root = spec.compute_signing_root(consolidation, domain) - return spec.SignedConsolidation( - message=consolidation, - signature=bls.Aggregate([bls.Sign(source_privkey, signing_root), bls.Sign(target_privkey, signing_root)]) - ) - - -def run_consolidation_processing(spec, state, signed_consolidation, valid=True): - """ - Run ``process_consolidation``, yielding: - - pre-state ('pre') - - consolidation ('consolidation') - - post-state ('post'). - If ``valid == False``, run expecting ``AssertionError`` - """ - - source_validator = state.validators[signed_consolidation.message.source_index] - target_validator = state.validators[signed_consolidation.message.target_index] - - yield 'pre', state - yield 'consolidation', signed_consolidation - - if not valid: - expect_assertion_error(lambda: spec.process_consolidation(state, signed_consolidation)) - yield 'post', None - return - - pre_exit_epoch = source_validator.exit_epoch - - spec.process_consolidation(state, signed_consolidation) - - yield 'post', state - - assert source_validator.withdrawal_credentials[1:] == target_validator.withdrawal_credentials[1:] - assert pre_exit_epoch == spec.FAR_FUTURE_EPOCH - assert state.validators[signed_consolidation.message.source_index].exit_epoch < spec.FAR_FUTURE_EPOCH - assert state.validators[signed_consolidation.message.source_index].exit_epoch == state.earliest_consolidation_epoch - assert state.pending_consolidations[len(state.pending_consolidations) - 1] == spec.PendingConsolidation( - source_index=signed_consolidation.message.source_index, - target_index=signed_consolidation.message.target_index - ) diff --git a/tests/generators/operations/main.py b/tests/generators/operations/main.py index 0d203fca6f..fed12753b2 100644 --- a/tests/generators/operations/main.py +++ b/tests/generators/operations/main.py @@ -45,7 +45,7 @@ _new_electra_mods = {key: 'eth2spec.test.electra.block_processing.test_process_' + key for key in [ 'attestation', - 'consolidation', + 'execution_layer_consolidation', 'deposit_receipt', 'execution_layer_withdrawal_request', 'voluntary_exit' From 17c51488eb86e9b3604bc389dda60fc7abf29c9d Mon Sep 17 00:00:00 2001 From: fradamt Date: Fri, 19 Apr 2024 08:58:28 +0200 Subject: [PATCH 08/19] add tests for remaining failure cases --- ...t_process_execution_layer_consolidation.py | 110 ++++++++++++++---- 1 file changed, 86 insertions(+), 24 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py index c6bc071b20..419d13ed14 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py @@ -64,7 +64,7 @@ def test_basic_consolidation_in_current_consolidation_epoch(spec, state): == consolidation_churn_limit - spec.MIN_ACTIVATION_BALANCE ) # Check exit epoch - assert state.validators[0].exit_epoch == expected_exit_epoch + assert state.validators[source_index].exit_epoch == expected_exit_epoch @with_electra_and_later @@ -109,7 +109,7 @@ def test_basic_consolidation_in_new_consolidation_epoch(spec, state): == consolidation_churn_limit - spec.MIN_ACTIVATION_BALANCE ) # Check exit epochs - assert state.validators[0].exit_epoch == expected_exit_epoch + assert state.validators[source_index].exit_epoch == expected_exit_epoch @with_electra_and_later @@ -156,7 +156,7 @@ def test_basic_consolidation_with_preexisting_churn(spec, state): == preexisting_churn - spec.MIN_ACTIVATION_BALANCE ) # Check exit epoch - assert state.validators[0].exit_epoch == expected_exit_epoch + assert state.validators[source_index].exit_epoch == expected_exit_epoch @with_electra_and_later @@ -207,7 +207,7 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): state.consolidation_balance_to_consume == consolidation_churn_limit - remainder ) # Check exit epoch - assert state.validators[0].exit_epoch == expected_exit_epoch + assert state.validators[source_index].exit_epoch == expected_exit_epoch @with_electra_and_later @@ -218,7 +218,7 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): ) @spec_test @single_phase -def test_basic_consolidation_with_compounding_credential(spec, state): +def test_basic_consolidation_with_compounding_credentials(spec, state): # This state has 256 validators each with 32 ETH in MINIMAL preset, 128 ETH consolidation churn current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -226,7 +226,7 @@ def test_basic_consolidation_with_compounding_credential(spec, state): # Set source to eth1 credentials source_address = b"\x22" * 20 - set_eth1_withdrawal_credential_with_balance( + set_compounding_withdrawal_credential( spec, state, source_index, address=source_address ) # Make consolidation with source address @@ -237,7 +237,7 @@ def test_basic_consolidation_with_compounding_credential(spec, state): ) # Set target to eth1 credentials - set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + set_compounding_withdrawal_credential(spec, state, target_index) # Set the consolidation balance to consume equal to churn limit consolidation_churn_limit = spec.get_consolidation_churn_limit(state) @@ -252,7 +252,8 @@ def test_basic_consolidation_with_compounding_credential(spec, state): == consolidation_churn_limit - spec.MIN_ACTIVATION_BALANCE ) # Check exit epoch - assert state.validators[0].exit_epoch == expected_exit_epoch + assert state.validators[source_index].exit_epoch == expected_exit_epoch + @with_electra_and_later @@ -300,7 +301,7 @@ def test_consolidation_churn_limit_balance(spec, state): == updated_consolidation_churn_limit - consolidation_churn_limit ) # Check exit epoch - assert state.validators[0].exit_epoch == expected_exit_epoch + assert state.validators[source_index].exit_epoch == expected_exit_epoch @with_electra_and_later @@ -347,7 +348,7 @@ def test_consolidation_balance_larger_than_churn_limit(spec, state): # Check consolidation churn is decremented correctly assert state.consolidation_balance_to_consume == expected_balance # Check exit epoch - assert state.validators[0].exit_epoch == expected_exit_epoch + assert state.validators[source_index].exit_epoch == expected_exit_epoch @with_electra_and_later @@ -667,7 +668,6 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): ) -@with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, @@ -675,7 +675,8 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): ) @spec_test @single_phase -def test_invalid_different_credentials(spec, state): +def test_invalid_incorrect_source_address(spec, state): + # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] @@ -683,8 +684,9 @@ def test_invalid_different_credentials(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) + # Make consolidation with different source address consolidation = spec.ExecutionLayerConsolidation( - source_address=source_address, + source_address=b"\x33" * 20, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, ) @@ -696,6 +698,64 @@ def test_invalid_different_credentials(spec, state): ) +@with_presets([MINIMAL], "need sufficient consolidation churn limit") +@with_custom_state( + balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, + threshold_fn=default_activation_threshold, +) +@spec_test +@single_phase +def test_invalid_unknown_source_pubkey(spec, state): + # Set up an otherwise correct consolidation + current_epoch = spec.get_current_epoch(state) + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with different source pubkey + consolidation = spec.ExecutionLayerConsolidation( + source_address=source_address, + source_pubkey=b"\x00" * 48, + target_pubkey=state.validators[target_index].pubkey, + ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + + yield from run_consolidation_processing( + spec, state, consolidation, success=False + ) + + +@with_presets([MINIMAL], "need sufficient consolidation churn limit") +@with_custom_state( + balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, + threshold_fn=default_activation_threshold, +) +@spec_test +@single_phase +def test_invalid_unknown_target_pubkey(spec, state): + # Set up an otherwise correct consolidation + current_epoch = spec.get_current_epoch(state) + source_index = spec.get_active_validator_indices(state, current_epoch)[0] + target_index = spec.get_active_validator_indices(state, current_epoch)[1] + source_address = b"\x22" * 20 + set_eth1_withdrawal_credential_with_balance( + spec, state, source_index, address=source_address + ) + # Make consolidation with different target pubkey + consolidation = spec.ExecutionLayerConsolidation( + source_address=b"\x33" * 20, + source_pubkey=state.validators[source_index].pubkey, + target_pubkey=b"\x00" * 48, + ) + set_eth1_withdrawal_credential_with_balance(spec, state, target_index) + + yield from run_consolidation_processing( + spec, state, consolidation, success=False + ) + + def run_consolidation_processing(spec, state, consolidation, success=True): """ @@ -706,20 +766,22 @@ def run_consolidation_processing(spec, state, consolidation, success=True): If ``valid == False``, run expecting ``AssertionError`` """ - validator_pubkeys = [v.pubkey for v in state.validators] - source_index = spec.ValidatorIndex(validator_pubkeys.index(consolidation.source_pubkey)) - target_index = spec.ValidatorIndex(validator_pubkeys.index(consolidation.target_pubkey)) - source_validator = state.validators[source_index] - target_validator = state.validators[target_index] + if success: + validator_pubkeys = [v.pubkey for v in state.validators] + source_index = spec.ValidatorIndex(validator_pubkeys.index(consolidation.source_pubkey)) + target_index = spec.ValidatorIndex(validator_pubkeys.index(consolidation.target_pubkey)) + source_validator = state.validators[source_index] + target_validator = state.validators[target_index] + pre_exit_epoch_source = source_validator.exit_epoch + pre_exit_epoch_target = target_validator.exit_epoch + pre_pending_consolidations = state.pending_consolidations.copy() + else: + pre_state = state.copy() + yield 'pre', state yield 'consolidation', consolidation - pre_exit_epoch_source = source_validator.exit_epoch - pre_exit_epoch_target = target_validator.exit_epoch - pre_pending_consolidations = state.pending_consolidations.copy() - pre_state = state.copy() - spec.process_execution_layer_consolidation(state, consolidation) yield 'post', state @@ -745,6 +807,6 @@ def run_consolidation_processing(spec, state, consolidation, success=True): target_index=target_index, ) assert state.pending_consolidations == pre_pending_consolidations + [expected_new_pending_consolidation] - if not success: + else: assert pre_state == state From 7c4b32a7177315f8b4ccda5e23d4efd0aebd654a Mon Sep 17 00:00:00 2001 From: fradamt Date: Tue, 21 May 2024 17:47:57 +0200 Subject: [PATCH 09/19] renaming consolidations to consolidation_requests --- presets/mainnet/electra.yaml | 2 +- presets/minimal/electra.yaml | 2 +- specs/electra/beacon-chain.md | 34 ++++++++++++++++------------- specs/electra/fork.md | 2 +- tests/generators/operations/main.py | 2 +- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/presets/mainnet/electra.yaml b/presets/mainnet/electra.yaml index 2c8d642bf7..8aa663cec8 100644 --- a/presets/mainnet/electra.yaml +++ b/presets/mainnet/electra.yaml @@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1 # `uint64(2**3)` (= 8) MAX_ATTESTATIONS_ELECTRA: 8 # `uint64(2**0)` (= 1) -MAX_CONSOLIDATIONS_PER_PAYLOAD: 1 +MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1 # Execution # --------------------------------------------------------------- diff --git a/presets/minimal/electra.yaml b/presets/minimal/electra.yaml index beb5265746..a5897f340a 100644 --- a/presets/minimal/electra.yaml +++ b/presets/minimal/electra.yaml @@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1 # `uint64(2**3)` (= 8) MAX_ATTESTATIONS_ELECTRA: 8 # `uint64(2**0)` (= 1) -MAX_CONSOLIDATIONS_PER_PAYLOAD: 1 +MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1 # Execution # --------------------------------------------------------------- diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index daa28a491e..4bc2cfaf06 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -164,16 +164,16 @@ The following values are (non-configurable) constants used throughout the specif | Name | Value | | - | - | -| `MAX_CONSOLIDATIONS_PER_PAYLOAD` | `uint64(1)` | +| `MAX_ATTESTER_SLASHINGS_ELECTRA` | `2**0` (= 1) | *[New in Electra:EIP7549]* | +| `MAX_ATTESTATIONS_ELECTRA` | `2**3` (= 8) | *[New in Electra:EIP7549]* | ### Execution | Name | Value | Description | | - | - | - | | `MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD` | `uint64(2**13)` (= 8,192) | *[New in Electra:EIP6110]* Maximum number of deposit receipts allowed in each payload | -| `MAX_ATTESTER_SLASHINGS_ELECTRA` | `2**0` (= 1) | *[New in Electra:EIP7549]* | -| `MAX_ATTESTATIONS_ELECTRA` | `2**3` (= 8) | *[New in Electra:EIP7549]* | | `MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD` | `uint64(2**4)` (= 16)| *[New in Electra:EIP7002]* Maximum number of execution layer withdrawal requests in each payload | +| `MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD` | `uint64(1)` (= 1) | *[New in Electra:EIP7002]* Maximum number of execution layer consolidation requests in each payload | ### Withdrawals processing @@ -238,12 +238,12 @@ class ExecutionLayerWithdrawalRequest(Container): amount: Gwei ``` -#### `ExecutionLayerConsolidation` +#### `ExecutionLayerConsolidationRequest` *Note*: The container is new in EIP7251. ```python -class ExecutionLayerConsolidation(Container): +class ExecutionLayerConsolidationRequest(Container): source_address: ExecutionAddress source_pubkey: BLSPubkey target_pubkey: BLSPubkey @@ -337,7 +337,7 @@ class ExecutionPayload(Container): deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in Electra:EIP6110] # [New in Electra:EIP7002:EIP7251] withdrawal_requests: List[ExecutionLayerWithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD] - consolidations: List[ExecutionLayerConsolidation, MAX_CONSOLIDATIONS_PER_PAYLOAD] # [New in Electra:EIP7251] + consolidations_requests: List[ExecutionLayerConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP7251] ``` #### `ExecutionPayloadHeader` @@ -365,7 +365,7 @@ class ExecutionPayloadHeader(Container): excess_blob_gas: uint64 deposit_receipts_root: Root # [New in Electra:EIP6110] withdrawal_requests_root: Root # [New in Electra:EIP7002:EIP7251] - consolidations_root: Root # [New in Electra:EIP7251] + consolidations_requests_root: Root # [New in Electra:EIP7251] ``` #### `BeaconState` @@ -1037,7 +1037,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None: # [New in Electra:EIP7002:EIP7251] for_ops(body.execution_payload.withdrawal_requests, process_execution_layer_withdrawal_request) for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt) # [New in Electra:EIP6110] - for_ops(body.execution_payload.consolidations, process_execution_layer_consolidation) # [New in Electra:EIP7251] + for_ops(body.execution_payload.consolidations_requests, process_execution_layer_consolidation_request) # [New in Electra:EIP7251] ``` ##### Attestations @@ -1284,12 +1284,14 @@ def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) ) ``` -##### Consolidations +##### Execution layer consolidation requests -###### New `process_consolidation` +###### New `process_execution_layer_consolidation_requests` ```python -def process_execution_layer_consolidation(state: BeaconState, consolidation: ExecutionLayerConsolidation) -> None: +def process_execution_layer_consolidation_requests( + state: BeaconState, + execution_layer_consolidation_request: ExecutionLayerConsolidationRequest) -> None: # If the pending consolidations queue is full, consolidation requests are ignored if len(state.pending_consolidations) == PENDING_CONSOLIDATIONS_LIMIT: return @@ -1299,12 +1301,14 @@ def process_execution_layer_consolidation(state: BeaconState, consolidation: Exe validator_pubkeys = [v.pubkey for v in state.validators] # Verify pubkeys exists - if consolidation.source_pubkey not in validator_pubkeys: + request_source_pubkey = execution_layer_consolidation_request.source_pubkey + request_target_pubkey = execution_layer_consolidation_request.target_pubkey + if request_source_pubkey not in validator_pubkeys: return - if consolidation.target_pubkey not in validator_pubkeys: + if request_target_pubkey not in validator_pubkeys: return - source_index = ValidatorIndex(validator_pubkeys.index(consolidation.source_pubkey)) - target_index = ValidatorIndex(validator_pubkeys.index(consolidation.target_pubkey)) + source_index = ValidatorIndex(validator_pubkeys.index(request_source_pubkey)) + target_index = ValidatorIndex(validator_pubkeys.index(request_target_pubkey)) source_validator = state.validators[source_index] target_validator = state.validators[target_index] diff --git a/specs/electra/fork.md b/specs/electra/fork.md index 2bf39029dd..a65bdebb53 100644 --- a/specs/electra/fork.md +++ b/specs/electra/fork.md @@ -92,7 +92,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState: excess_blob_gas=pre.latest_execution_payload_header.excess_blob_gas, deposit_receipts_root=Root(), # [New in Electra:EIP6110] withdrawal_requests_root=Root(), # [New in Electra:EIP7002] - consolidations_root=Root(), # [New in Electra:EIP7251] + consolidations_requests_root=Root(), # [New in Electra:EIP7251] ) exit_epochs = [v.exit_epoch for v in pre.validators if v.exit_epoch != FAR_FUTURE_EPOCH] diff --git a/tests/generators/operations/main.py b/tests/generators/operations/main.py index fed12753b2..85a5b64e3c 100644 --- a/tests/generators/operations/main.py +++ b/tests/generators/operations/main.py @@ -45,7 +45,7 @@ _new_electra_mods = {key: 'eth2spec.test.electra.block_processing.test_process_' + key for key in [ 'attestation', - 'execution_layer_consolidation', + 'execution_layer_consolidation_requests', 'deposit_receipt', 'execution_layer_withdrawal_request', 'voluntary_exit' From dc2a2bd85ae1e8c7c2e426faba3167069ef548a5 Mon Sep 17 00:00:00 2001 From: fradamt Date: Tue, 21 May 2024 18:10:58 +0200 Subject: [PATCH 10/19] minor fixes, doctoc --- README.md | 18 ++++++++ SECURITY.md | 10 +++++ configs/README.md | 10 +++++ docker/README.md | 8 ++++ docs/docs/templates/beacon-chain-template.md | 18 ++++++++ docs/light-client/index.md | 8 ++++ presets/README.md | 10 +++++ solidity_deposit_contract/README.md | 12 ++++++ specs/electra/beacon-chain.md | 11 +++-- tests/README.md | 17 ++++++++ tests/core/pyspec/README.md | 17 ++++++++ tests/core/pyspec/eth2spec/config/README.md | 9 ++++ .../pyspec/eth2spec/gen_helpers/README.md | 11 +++++ ...t_process_execution_layer_consolidation.py | 42 +++++++++---------- tests/formats/README.md | 29 +++++++++++++ tests/formats/bls/README.md | 8 ++++ tests/formats/bls/aggregate.md | 10 +++++ tests/formats/bls/aggregate_verify.md | 10 +++++ tests/formats/bls/eth_aggregate_pubkeys.md | 10 +++++ .../formats/bls/eth_fast_aggregate_verify.md | 10 +++++ tests/formats/bls/fast_aggregate_verify.md | 10 +++++ tests/formats/bls/sign.md | 10 +++++ tests/formats/bls/verify.md | 9 ++++ tests/formats/epoch_processing/README.md | 13 ++++++ tests/formats/finality/README.md | 14 +++++++ tests/formats/forks/README.md | 15 +++++++ tests/formats/genesis/README.md | 8 ++++ tests/formats/genesis/initialization.md | 16 +++++++ tests/formats/genesis/validity.md | 14 +++++++ tests/formats/kzg_4844/README.md | 8 ++++ .../kzg_4844/blob_to_kzg_commitment.md | 10 +++++ .../kzg_4844/compute_blob_kzg_proof.md | 10 +++++ tests/formats/kzg_4844/compute_kzg_proof.md | 10 +++++ .../formats/kzg_4844/verify_blob_kzg_proof.md | 10 +++++ .../kzg_4844/verify_blob_kzg_proof_batch.md | 10 +++++ tests/formats/kzg_4844/verify_kzg_proof.md | 10 +++++ tests/formats/light_client/README.md | 8 ++++ .../light_client/single_merkle_proof.md | 12 ++++++ tests/formats/light_client/sync.md | 17 ++++++++ tests/formats/light_client/update_ranking.md | 12 ++++++ tests/formats/merkle_proof/README.md | 8 ++++ tests/formats/operations/README.md | 14 +++++++ tests/formats/random/README.md | 9 ++++ tests/formats/rewards/README.md | 17 ++++++++ tests/formats/sanity/README.md | 8 ++++ tests/formats/sanity/blocks.md | 14 +++++++ tests/formats/sanity/slots.md | 15 +++++++ tests/formats/shuffling/README.md | 11 +++++ tests/formats/ssz_generic/README.md | 23 ++++++++++ tests/formats/ssz_static/README.md | 8 ++++ tests/formats/ssz_static/core.md | 14 +++++++ tests/formats/sync/README.md | 8 ++++ tests/formats/transition/README.md | 14 +++++++ tests/generators/README.md | 1 - tests/generators/bls/README.md | 9 ++++ tests/generators/epoch_processing/README.md | 8 ++++ tests/generators/finality/README.md | 8 ++++ tests/generators/fork_choice/README.md | 8 ++++ tests/generators/genesis/README.md | 8 ++++ tests/generators/kzg_4844/README.md | 8 ++++ tests/generators/light_client/README.md | 8 ++++ tests/generators/merkle_proof/README.md | 8 ++++ tests/generators/operations/README.md | 8 ++++ tests/generators/random/README.md | 11 +++++ tests/generators/rewards/README.md | 8 ++++ tests/generators/sanity/README.md | 8 ++++ tests/generators/shuffling/README.md | 8 ++++ tests/generators/ssz_static/README.md | 8 ++++ 68 files changed, 756 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 58bff5b9e4..e66e79b097 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Ethereum Proof-of-Stake Consensus Specifications](#ethereum-proof-of-stake-consensus-specifications) + - [Specs](#specs) + - [Stable Specifications](#stable-specifications) + - [In-development Specifications](#in-development-specifications) + - [Accompanying documents can be found in specs and include:](#accompanying-documents-can-be-found-in-specs-and-include) + - [Additional specifications for client implementers](#additional-specifications-for-client-implementers) + - [Design goals](#design-goals) + - [Useful external resources](#useful-external-resources) + - [For spec contributors](#for-spec-contributors) + - [Online viewer of the latest release (latest `master` branch)](#online-viewer-of-the-latest-release-latest-master-branch) + - [Consensus spec tests](#consensus-spec-tests) + + + # Ethereum Proof-of-Stake Consensus Specifications [![Join the chat at https://discord.gg/qGpsxSA](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://discord.gg/qGpsxSA) diff --git a/SECURITY.md b/SECURITY.md index 2101ea1554..a770f5749e 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Security Policy](#security-policy) + - [Supported Versions](#supported-versions) + - [Reporting a Vulnerability](#reporting-a-vulnerability) + + + # Security Policy ## Supported Versions diff --git a/configs/README.md b/configs/README.md index 6ef081e4c4..82b7783682 100644 --- a/configs/README.md +++ b/configs/README.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Configurations](#configurations) + - [Forking](#forking) + - [Format](#format) + + + # Configurations This directory contains a set of configurations used for testing, testnets, and mainnet. diff --git a/docker/README.md b/docker/README.md index 6d5b21e59d..29c7faa3f5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Docker related information](#docker-related-information) + + + ## Docker related information This dockerfile sets up the dependencies required to run consensus-spec tests. The docker image can be locally built with: diff --git a/docs/docs/templates/beacon-chain-template.md b/docs/docs/templates/beacon-chain-template.md index 4d22d3908e..04d61b071f 100644 --- a/docs/docs/templates/beacon-chain-template.md +++ b/docs/docs/templates/beacon-chain-template.md @@ -7,6 +7,24 @@ +- [Introduction](#introduction) +- [Notation](#notation) +- [Custom types](#custom-types) +- [Constants](#constants) + - [[CATEGORY OF CONSTANTS]](#category-of-constants) +- [Preset](#preset) + - [[CATEGORY OF PRESETS]](#category-of-presets) +- [Configuration](#configuration) + - [[CATEGORY OF CONFIGURATIONS]](#category-of-configurations) +- [Containers](#containers) + - [[CATEGORY OF CONTAINERS]](#category-of-containers) + - [`CONTAINER_NAME`](#container_name) +- [Helper functions](#helper-functions) + - [[CATEGORY OF HELPERS]](#category-of-helpers) + - [Epoch processing](#epoch-processing) + - [Block processing](#block-processing) +- [Testing](#testing) + diff --git a/docs/light-client/index.md b/docs/light-client/index.md index 32155b1852..0431126eeb 100644 --- a/docs/light-client/index.md +++ b/docs/light-client/index.md @@ -1 +1,9 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Light client specifications](#light-client-specifications) + + + # Light client specifications diff --git a/presets/README.md b/presets/README.md index 3a438cb2ca..00709d653b 100644 --- a/presets/README.md +++ b/presets/README.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Presets](#presets) + - [Forking](#forking) + - [Format](#format) + + + # Presets Presets are more extensive than runtime configurations, and generally only applicable during compile-time. diff --git a/solidity_deposit_contract/README.md b/solidity_deposit_contract/README.md index 0388d7d2f5..139adf8b11 100644 --- a/solidity_deposit_contract/README.md +++ b/solidity_deposit_contract/README.md @@ -1,3 +1,15 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Deposit Contract](#deposit-contract) + - [History](#history) + - [Compiling solidity deposit contract](#compiling-solidity-deposit-contract) + - [Running web3 tests](#running-web3-tests) + - [Running randomized `dapp` tests:](#running-randomized-dapp-tests) + + + # Deposit Contract ## History diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 4bc2cfaf06..87a282b8f5 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -28,8 +28,7 @@ - [`PendingBalanceDeposit`](#pendingbalancedeposit) - [`PendingPartialWithdrawal`](#pendingpartialwithdrawal) - [`ExecutionLayerWithdrawalRequest`](#executionlayerwithdrawalrequest) - - [`Consolidation`](#consolidation) - - [`SignedConsolidation`](#signedconsolidation) + - [`ExecutionLayerConsolidationRequest`](#executionlayerconsolidationrequest) - [`PendingConsolidation`](#pendingconsolidation) - [Modified Containers](#modified-containers) - [`AttesterSlashing`](#attesterslashing) @@ -94,8 +93,8 @@ - [New `process_execution_layer_withdrawal_request`](#new-process_execution_layer_withdrawal_request) - [Deposit receipts](#deposit-receipts) - [New `process_deposit_receipt`](#new-process_deposit_receipt) - - [Consolidations](#consolidations) - - [New `process_consolidation`](#new-process_consolidation) + - [Execution layer consolidation requests](#execution-layer-consolidation-requests) + - [New `process_execution_layer_consolidation_request`](#new-process_execution_layer_consolidation_request) - [Testing](#testing) @@ -1286,10 +1285,10 @@ def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) ##### Execution layer consolidation requests -###### New `process_execution_layer_consolidation_requests` +###### New `process_execution_layer_consolidation_request` ```python -def process_execution_layer_consolidation_requests( +def process_execution_layer_consolidation_request( state: BeaconState, execution_layer_consolidation_request: ExecutionLayerConsolidationRequest) -> None: # If the pending consolidations queue is full, consolidation requests are ignored diff --git a/tests/README.md b/tests/README.md index dbd2b31de2..46a7bf2ddf 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,3 +1,20 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Getting Started with Consensus Spec Tests](#getting-started-with-consensus-spec-tests) + - [Getting Started](#getting-started) + - [Creating the environment](#creating-the-environment) + - [Running your first test](#running-your-first-test) + - [The "Hello, World" of Consensus Spec Tests](#the-hello-world-of-consensus-spec-tests) + - [New Tests](#new-tests) + - [Tests Designed to Fail](#tests-designed-to-fail) + - [Attestation Tests](#attestation-tests) + - [Adding an Attestation Test](#adding-an-attestation-test) + - [How are These Tests Used?](#how-are-these-tests-used) + + + # Getting Started with Consensus Spec Tests ## Getting Started diff --git a/tests/core/pyspec/README.md b/tests/core/pyspec/README.md index baa1322771..ca177cf772 100644 --- a/tests/core/pyspec/README.md +++ b/tests/core/pyspec/README.md @@ -1,3 +1,20 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Executable Python Spec (PySpec)](#executable-python-spec-pyspec) + - [Dev Install](#dev-install) + - [Py-tests](#py-tests) + - [How to run tests](#how-to-run-tests) + - [Automated](#automated) + - [Manual](#manual) + - [How to view code coverage report](#how-to-view-code-coverage-report) + - [Advanced](#advanced) + - [Contributing](#contributing) + - [License](#license) + + + # Executable Python Spec (PySpec) The executable Python spec is built from the consensus specifications, diff --git a/tests/core/pyspec/eth2spec/config/README.md b/tests/core/pyspec/eth2spec/config/README.md index c03d890c20..7d6a044de3 100644 --- a/tests/core/pyspec/eth2spec/config/README.md +++ b/tests/core/pyspec/eth2spec/config/README.md @@ -1,3 +1,12 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Consensus specs config util](#consensus-specs-config-util) + - [Config usage:](#config-usage) + + + # Consensus specs config util For run-time configuration, see [Configs documentation](../../../../../configs/README.md). diff --git a/tests/core/pyspec/eth2spec/gen_helpers/README.md b/tests/core/pyspec/eth2spec/gen_helpers/README.md index bf791ccfea..88f8fcf4b7 100644 --- a/tests/core/pyspec/eth2spec/gen_helpers/README.md +++ b/tests/core/pyspec/eth2spec/gen_helpers/README.md @@ -1,3 +1,14 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Consensus test generator helpers](#consensus-test-generator-helpers) + - [`gen_base`](#gen_base) + - [`gen_from_tests`](#gen_from_tests) + - [Test-case parts](#test-case-parts) + + + # Consensus test generator helpers ## `gen_base` diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py index 419d13ed14..7f0b53ba99 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py @@ -40,7 +40,7 @@ def test_basic_consolidation_in_current_consolidation_epoch(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -89,7 +89,7 @@ def test_basic_consolidation_in_new_consolidation_epoch(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -132,7 +132,7 @@ def test_basic_consolidation_with_preexisting_churn(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -179,7 +179,7 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -230,7 +230,7 @@ def test_basic_consolidation_with_compounding_credentials(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -276,7 +276,7 @@ def test_consolidation_churn_limit_balance(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -324,7 +324,7 @@ def test_consolidation_balance_larger_than_churn_limit(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -371,7 +371,7 @@ def test_consolidation_balance_through_two_churn_epochs(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -417,7 +417,7 @@ def test_invalid_source_equals_target(spec, state): spec, state, source_index, address=source_address ) # Make consolidation from source to source - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[source_index].pubkey, @@ -449,7 +449,7 @@ def test_invalid_exceed_pending_consolidations_limit(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -478,7 +478,7 @@ def test_invalid_not_enough_consolidation_churn_available(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -506,7 +506,7 @@ def test_invalid_exited_source(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -538,7 +538,7 @@ def test_invalid_exited_target(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -568,7 +568,7 @@ def test_invalid_inactive_source(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -600,7 +600,7 @@ def test_invalid_inactive_target(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -629,7 +629,7 @@ def test_invalid_no_source_execution_withdrawal_credential(spec, state): source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] source_address = b"\x22" * 20 - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -657,7 +657,7 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -685,7 +685,7 @@ def test_invalid_incorrect_source_address(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=b"\x33" * 20, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -715,7 +715,7 @@ def test_invalid_unknown_source_pubkey(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different source pubkey - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=b"\x00" * 48, target_pubkey=state.validators[target_index].pubkey, @@ -744,7 +744,7 @@ def test_invalid_unknown_target_pubkey(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different target pubkey - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=b"\x33" * 20, source_pubkey=state.validators[source_index].pubkey, target_pubkey=b"\x00" * 48, @@ -782,7 +782,7 @@ def run_consolidation_processing(spec, state, consolidation, success=True): yield 'pre', state yield 'consolidation', consolidation - spec.process_execution_layer_consolidation(state, consolidation) + spec.process_execution_layer_consolidation_request(state, consolidation) yield 'post', state diff --git a/tests/formats/README.md b/tests/formats/README.md index ec495daa5b..0fbf3cd9ea 100644 --- a/tests/formats/README.md +++ b/tests/formats/README.md @@ -1,3 +1,32 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [General test format](#general-test-format) + - [Table of contents](#table-of-contents) + - [About](#about) + - [Test-case formats](#test-case-formats) + - [Glossary](#glossary) + - [Test format philosophy](#test-format-philosophy) + - [Config design](#config-design) + - [Test completeness](#test-completeness) + - [Test structure](#test-structure) + - [`/`](#config-name) + - [`/`](#fork-or-phase-name) + - [`/`](#test-runner-name) + - [`/`](#test-handler-name) + - [`/`](#test-suite-name) + - [`/`](#test-case) + - [``](#output-part) + - [Common output formats](#common-output-formats) + - [Special output parts](#special-output-parts) + - [`meta.yaml`](#metayaml) + - [`config.yaml`](#configyaml) + - [Config sourcing](#config-sourcing) + - [Note for implementers](#note-for-implementers) + + + # General test format This document defines the YAML format and structure used for consensus spec testing. diff --git a/tests/formats/bls/README.md b/tests/formats/bls/README.md index 77a9654a8d..d4e3ea9035 100644 --- a/tests/formats/bls/README.md +++ b/tests/formats/bls/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [BLS tests](#bls-tests) + + + # BLS tests A test type for BLS. Primarily geared towards verifying the *integration* of any BLS library. diff --git a/tests/formats/bls/aggregate.md b/tests/formats/bls/aggregate.md index 7cdebcf4d9..4f86bc0d3f 100644 --- a/tests/formats/bls/aggregate.md +++ b/tests/formats/bls/aggregate.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: BLS signature aggregation](#test-format-bls-signature-aggregation) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: BLS signature aggregation A BLS signature aggregation combines a series of signatures into a single signature. diff --git a/tests/formats/bls/aggregate_verify.md b/tests/formats/bls/aggregate_verify.md index 9b251af46e..0e8414c00b 100644 --- a/tests/formats/bls/aggregate_verify.md +++ b/tests/formats/bls/aggregate_verify.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: BLS sign message](#test-format-bls-sign-message) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: BLS sign message Verify the signature against the given pubkeys and one messages. diff --git a/tests/formats/bls/eth_aggregate_pubkeys.md b/tests/formats/bls/eth_aggregate_pubkeys.md index 2b72c1dcaf..4a61330a30 100644 --- a/tests/formats/bls/eth_aggregate_pubkeys.md +++ b/tests/formats/bls/eth_aggregate_pubkeys.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Ethereum-customized BLS pubkey aggregation](#test-format-ethereum-customized-bls-pubkey-aggregation) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Ethereum-customized BLS pubkey aggregation A BLS pubkey aggregation combines a series of pubkeys into a single pubkey. diff --git a/tests/formats/bls/eth_fast_aggregate_verify.md b/tests/formats/bls/eth_fast_aggregate_verify.md index 83b5484e05..66a3728a0d 100644 --- a/tests/formats/bls/eth_fast_aggregate_verify.md +++ b/tests/formats/bls/eth_fast_aggregate_verify.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Ethereum-customized BLS fast aggregate verify](#test-format-ethereum-customized-bls-fast-aggregate-verify) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Ethereum-customized BLS fast aggregate verify Verify the signature against the given pubkeys and one message. diff --git a/tests/formats/bls/fast_aggregate_verify.md b/tests/formats/bls/fast_aggregate_verify.md index 38ea29bb5f..b7a94b1c00 100644 --- a/tests/formats/bls/fast_aggregate_verify.md +++ b/tests/formats/bls/fast_aggregate_verify.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: BLS fast aggregate verify](#test-format-bls-fast-aggregate-verify) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: BLS fast aggregate verify Verify the signature against the given pubkeys and one message. diff --git a/tests/formats/bls/sign.md b/tests/formats/bls/sign.md index 09e9286148..96756c9e3f 100644 --- a/tests/formats/bls/sign.md +++ b/tests/formats/bls/sign.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: BLS sign message](#test-format-bls-sign-message) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: BLS sign message Message signing with BLS should produce a signature. diff --git a/tests/formats/bls/verify.md b/tests/formats/bls/verify.md index 57ec8a33a7..0fd5f43f29 100644 --- a/tests/formats/bls/verify.md +++ b/tests/formats/bls/verify.md @@ -1,3 +1,12 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: BLS sign message](#test-format-bls-sign-message) + - [Test case format](#test-case-format) + + + # Test format: BLS sign message Verify the signature against the given one pubkey and one message. diff --git a/tests/formats/epoch_processing/README.md b/tests/formats/epoch_processing/README.md index 2951767f2c..60eee01179 100644 --- a/tests/formats/epoch_processing/README.md +++ b/tests/formats/epoch_processing/README.md @@ -1,3 +1,16 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Epoch processing tests](#epoch-processing-tests) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`post.ssz_snappy`](#postssz_snappy) + - [Condition](#condition) + + + # Epoch processing tests The different epoch sub-transitions are tested individually with test handlers. diff --git a/tests/formats/finality/README.md b/tests/formats/finality/README.md index af39f5c8ca..2cdb820c79 100644 --- a/tests/formats/finality/README.md +++ b/tests/formats/finality/README.md @@ -1,3 +1,17 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Finality tests](#finality-tests) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`blocks_.yaml`](#blocks_indexyaml) + - [`post.ssz_snappy`](#postssz_snappy) + - [Condition](#condition) + + + # Finality tests The aim of the tests for the finality rules. diff --git a/tests/formats/forks/README.md b/tests/formats/forks/README.md index dfbaf2df0b..6c685e41f6 100644 --- a/tests/formats/forks/README.md +++ b/tests/formats/forks/README.md @@ -1,3 +1,18 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Forks](#forks) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [Fork strings](#fork-strings) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`post.ssz_snappy`](#postssz_snappy) + - [Processing](#processing) + - [Condition](#condition) + + + # Forks The aim of the fork tests is to ensure that a pre-fork state can be transformed diff --git a/tests/formats/genesis/README.md b/tests/formats/genesis/README.md index 25761e2f6a..110c3c9524 100644 --- a/tests/formats/genesis/README.md +++ b/tests/formats/genesis/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Genesis tests](#genesis-tests) + + + # Genesis tests The aim of the genesis tests is to provide a baseline to test genesis-state initialization and test diff --git a/tests/formats/genesis/initialization.md b/tests/formats/genesis/initialization.md index 9848e157d9..aebba624af 100644 --- a/tests/formats/genesis/initialization.md +++ b/tests/formats/genesis/initialization.md @@ -1,3 +1,19 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Genesis creation testing](#genesis-creation-testing) + - [Test case format](#test-case-format) + - [`eth1.yaml`](#eth1yaml) + - [`meta.yaml`](#metayaml) + - [`deposits_.ssz_snappy`](#deposits_indexssz_snappy) + - [`execution_payload_header.ssz_snappy`](#execution_payload_headerssz_snappy) + - [`state.ssz_snappy`](#statessz_snappy) + - [Processing](#processing) + - [Condition](#condition) + + + # Genesis creation testing Tests the initialization of a genesis state based on Eth1 data. diff --git a/tests/formats/genesis/validity.md b/tests/formats/genesis/validity.md index 15236c3ba3..2ad42feb67 100644 --- a/tests/formats/genesis/validity.md +++ b/tests/formats/genesis/validity.md @@ -1,3 +1,17 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Genesis validity testing](#genesis-validity-testing) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`genesis.ssz_snappy`](#genesisssz_snappy) + - [`is_valid.yaml`](#is_validyaml) + - [Processing](#processing) + - [Condition](#condition) + + + # Genesis validity testing Tests if a genesis state is valid, i.e. if it counts as trigger to launch. diff --git a/tests/formats/kzg_4844/README.md b/tests/formats/kzg_4844/README.md index b5bd720393..f5afa9ed12 100644 --- a/tests/formats/kzg_4844/README.md +++ b/tests/formats/kzg_4844/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [KZG tests](#kzg-tests) + + + # KZG tests A test type for KZG libraries. Tests all the public interfaces that a KZG library required to implement EIP-4844 needs to provide, as defined in `polynomial-commitments.md`. diff --git a/tests/formats/kzg_4844/blob_to_kzg_commitment.md b/tests/formats/kzg_4844/blob_to_kzg_commitment.md index dbb1556a1d..fdc710edfd 100644 --- a/tests/formats/kzg_4844/blob_to_kzg_commitment.md +++ b/tests/formats/kzg_4844/blob_to_kzg_commitment.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Blob to KZG commitment](#test-format-blob-to-kzg-commitment) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Blob to KZG commitment Compute the KZG commitment for a given `blob`. diff --git a/tests/formats/kzg_4844/compute_blob_kzg_proof.md b/tests/formats/kzg_4844/compute_blob_kzg_proof.md index 62fce37231..32a9f97104 100644 --- a/tests/formats/kzg_4844/compute_blob_kzg_proof.md +++ b/tests/formats/kzg_4844/compute_blob_kzg_proof.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Compute blob KZG proof](#test-format-compute-blob-kzg-proof) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Compute blob KZG proof Compute the blob KZG proof for a given `blob`, that helps with quickly verifying that the KZG commitment for the blob is correct. diff --git a/tests/formats/kzg_4844/compute_kzg_proof.md b/tests/formats/kzg_4844/compute_kzg_proof.md index b10105129b..e85616539d 100644 --- a/tests/formats/kzg_4844/compute_kzg_proof.md +++ b/tests/formats/kzg_4844/compute_kzg_proof.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Compute KZG proof](#test-format-compute-kzg-proof) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Compute KZG proof Compute the KZG proof for a given `blob` and an evaluation point `z`. diff --git a/tests/formats/kzg_4844/verify_blob_kzg_proof.md b/tests/formats/kzg_4844/verify_blob_kzg_proof.md index dd0bcda5a9..9a62ba92a4 100644 --- a/tests/formats/kzg_4844/verify_blob_kzg_proof.md +++ b/tests/formats/kzg_4844/verify_blob_kzg_proof.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Verify blob KZG proof](#test-format-verify-blob-kzg-proof) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Verify blob KZG proof Use the blob KZG proof to verify that the KZG commitment for a given `blob` is correct diff --git a/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md b/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md index 82e668497d..040446f69a 100644 --- a/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md +++ b/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Verify blob KZG proof batch](#test-format-verify-blob-kzg-proof-batch) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Verify blob KZG proof batch Use the blob KZG proofs to verify that the KZG commitments for given `blobs` are correct diff --git a/tests/formats/kzg_4844/verify_kzg_proof.md b/tests/formats/kzg_4844/verify_kzg_proof.md index 18e02710c5..bb4c1547f1 100644 --- a/tests/formats/kzg_4844/verify_kzg_proof.md +++ b/tests/formats/kzg_4844/verify_kzg_proof.md @@ -1,3 +1,13 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: Verify KZG proof](#test-format-verify-kzg-proof) + - [Test case format](#test-case-format) + - [Condition](#condition) + + + # Test format: Verify KZG proof Verify the KZG proof for a given `blob` and an evaluation point `z` that claims to result in a value of `y`. diff --git a/tests/formats/light_client/README.md b/tests/formats/light_client/README.md index 505b416019..84f06f58c1 100644 --- a/tests/formats/light_client/README.md +++ b/tests/formats/light_client/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Light client sync protocol tests](#light-client-sync-protocol-tests) + + + # Light client sync protocol tests This series of tests provides reference test vectors for the light client sync protocol spec. diff --git a/tests/formats/light_client/single_merkle_proof.md b/tests/formats/light_client/single_merkle_proof.md index 0cb4cd0d0c..789603af57 100644 --- a/tests/formats/light_client/single_merkle_proof.md +++ b/tests/formats/light_client/single_merkle_proof.md @@ -1,3 +1,15 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Single leaf merkle proof tests](#single-leaf-merkle-proof-tests) + - [Test case format](#test-case-format) + - [`object.ssz_snappy`](#objectssz_snappy) + - [`proof.yaml`](#proofyaml) + - [Condition](#condition) + + + # Single leaf merkle proof tests This series of tests provides reference test vectors for validating correct diff --git a/tests/formats/light_client/sync.md b/tests/formats/light_client/sync.md index 1706b4c162..f2a52f167e 100644 --- a/tests/formats/light_client/sync.md +++ b/tests/formats/light_client/sync.md @@ -1,3 +1,20 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Light client sync tests](#light-client-sync-tests) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`bootstrap.ssz_snappy`](#bootstrapssz_snappy) + - [`steps.yaml`](#stepsyaml) + - [Checks to run after each step](#checks-to-run-after-each-step) + - [`force_update` execution step](#force_update-execution-step) + - [`process_update` execution step](#process_update-execution-step) + - [`upgrade_store`](#upgrade_store) + - [Condition](#condition) + + + # Light client sync tests This series of tests provides reference test vectors for validating that a light client implementing the sync protocol can sync to the latest block header. diff --git a/tests/formats/light_client/update_ranking.md b/tests/formats/light_client/update_ranking.md index fe73fb9df7..4640f7860b 100644 --- a/tests/formats/light_client/update_ranking.md +++ b/tests/formats/light_client/update_ranking.md @@ -1,3 +1,15 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [`LightClientUpdate` ranking tests](#lightclientupdate-ranking-tests) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`updates_.ssz_snappy`](#updates_indexssz_snappy) + - [Condition](#condition) + + + # `LightClientUpdate` ranking tests This series of tests provides reference test vectors for validating that `LightClientUpdate` instances are ranked in a canonical order. diff --git a/tests/formats/merkle_proof/README.md b/tests/formats/merkle_proof/README.md index 77822daabe..5791dd5283 100644 --- a/tests/formats/merkle_proof/README.md +++ b/tests/formats/merkle_proof/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Merkle proof tests](#merkle-proof-tests) + + + # Merkle proof tests Handlers: diff --git a/tests/formats/operations/README.md b/tests/formats/operations/README.md index b020b5fd03..e3627cf30b 100644 --- a/tests/formats/operations/README.md +++ b/tests/formats/operations/README.md @@ -1,3 +1,17 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Operations tests](#operations-tests) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`.ssz_snappy`](#input-namessz_snappy) + - [`post.ssz_snappy`](#postssz_snappy) + - [Condition](#condition) + + + # Operations tests The different kinds of operations ("transactions") are tested individually with test handlers. diff --git a/tests/formats/random/README.md b/tests/formats/random/README.md index 54b2c1a23e..b6ac4429fd 100644 --- a/tests/formats/random/README.md +++ b/tests/formats/random/README.md @@ -1,3 +1,12 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Random tests](#random-tests) + - [Test case format](#test-case-format) + + + # Random tests The random tests are generated with various randomized states and blocks. diff --git a/tests/formats/rewards/README.md b/tests/formats/rewards/README.md index a6682042f7..7aa36adb1b 100644 --- a/tests/formats/rewards/README.md +++ b/tests/formats/rewards/README.md @@ -1,3 +1,20 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Rewards tests](#rewards-tests) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`source_deltas.ssz_snappy`](#source_deltasssz_snappy) + - [`target_deltas.ssz_snappy`](#target_deltasssz_snappy) + - [`head_deltas.ssz_snappy`](#head_deltasssz_snappy) + - [`inclusion_delay_deltas.ssz_snappy`](#inclusion_delay_deltasssz_snappy) + - [`inactivity_penalty_deltas.ssz_snappy`](#inactivity_penalty_deltasssz_snappy) + - [Condition](#condition) + + + # Rewards tests All rewards deltas sub-functions are tested for each test case. diff --git a/tests/formats/sanity/README.md b/tests/formats/sanity/README.md index 20b36208a4..d2b26709ee 100644 --- a/tests/formats/sanity/README.md +++ b/tests/formats/sanity/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Sanity tests](#sanity-tests) + + + # Sanity tests The aim of the sanity tests is to set a base-line on what really needs to pass, i.e. the essentials. diff --git a/tests/formats/sanity/blocks.md b/tests/formats/sanity/blocks.md index 7ea646b9e0..1c1bc3c92c 100644 --- a/tests/formats/sanity/blocks.md +++ b/tests/formats/sanity/blocks.md @@ -1,3 +1,17 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Sanity blocks testing](#sanity-blocks-testing) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`blocks_.ssz_snappy`](#blocks_indexssz_snappy) + - [`post.ssz_snappy`](#postssz_snappy) + - [Condition](#condition) + + + # Sanity blocks testing Sanity tests to cover a series of one or more blocks being processed, aiming to cover common changes. diff --git a/tests/formats/sanity/slots.md b/tests/formats/sanity/slots.md index f1b8a13219..54083f5cf0 100644 --- a/tests/formats/sanity/slots.md +++ b/tests/formats/sanity/slots.md @@ -1,3 +1,18 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Sanity slots testing](#sanity-slots-testing) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`slots.yaml`](#slotsyaml) + - [`post.ssz_snappy`](#postssz_snappy) + - [Processing](#processing) + - [Condition](#condition) + + + # Sanity slots testing Sanity tests to cover a series of one or more empty-slot transitions being processed, aiming to cover common changes. diff --git a/tests/formats/shuffling/README.md b/tests/formats/shuffling/README.md index 15bfe6996b..1334362f49 100644 --- a/tests/formats/shuffling/README.md +++ b/tests/formats/shuffling/README.md @@ -1,3 +1,14 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: shuffling](#test-format-shuffling) + - [Test case format](#test-case-format) + - [`mapping.yaml`](#mappingyaml) + - [Condition](#condition) + + + # Test format: shuffling The runner of the Shuffling test type has only one handler: `core`. diff --git a/tests/formats/ssz_generic/README.md b/tests/formats/ssz_generic/README.md index c46025847a..c95ef2aad6 100644 --- a/tests/formats/ssz_generic/README.md +++ b/tests/formats/ssz_generic/README.md @@ -1,3 +1,26 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [SSZ, generic tests](#ssz-generic-tests) + - [Format](#format) + - [`valid`](#valid) + - [`meta.yaml`](#metayaml) + - [`serialized.ssz_snappy`](#serializedssz_snappy) + - [`value.yaml`](#valueyaml) + - [Conditions](#conditions) + - [`invalid`](#invalid) + - [Condition](#condition) + - [Type declarations](#type-declarations) + - [`basic_vector`](#basic_vector) + - [`bitlist`](#bitlist) + - [`bitvector`](#bitvector) + - [`boolean`](#boolean) + - [`uints`](#uints) + - [`containers`](#containers) + + + # SSZ, generic tests This set of test-suites provides general testing for SSZ: diff --git a/tests/formats/ssz_static/README.md b/tests/formats/ssz_static/README.md index ffa7373349..3cef2de714 100644 --- a/tests/formats/ssz_static/README.md +++ b/tests/formats/ssz_static/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [SSZ, static tests](#ssz-static-tests) + + + # SSZ, static tests This set of test-suites provides static testing for SSZ: diff --git a/tests/formats/ssz_static/core.md b/tests/formats/ssz_static/core.md index 09ff04e20d..6995de9abb 100644 --- a/tests/formats/ssz_static/core.md +++ b/tests/formats/ssz_static/core.md @@ -1,3 +1,17 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Test format: SSZ static types](#test-format-ssz-static-types) + - [Test case format](#test-case-format) + - [`roots.yaml`](#rootsyaml) + - [`serialized.ssz_snappy`](#serializedssz_snappy) + - [`value.yaml`](#valueyaml) + - [Condition](#condition) + - [References](#references) + + + # Test format: SSZ static types The goal of this type is to provide clients with a solid reference for how the known SSZ objects should be encoded. diff --git a/tests/formats/sync/README.md b/tests/formats/sync/README.md index ff9f8168cb..be95ba765f 100644 --- a/tests/formats/sync/README.md +++ b/tests/formats/sync/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Sync tests](#sync-tests) + + + # Sync tests It re-uses the [fork choice test format](../fork_choice/README.md) to apply the test script. diff --git a/tests/formats/transition/README.md b/tests/formats/transition/README.md index 7f89bdd610..cd4a23f293 100644 --- a/tests/formats/transition/README.md +++ b/tests/formats/transition/README.md @@ -1,3 +1,17 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Transition testing](#transition-testing) + - [Test case format](#test-case-format) + - [`meta.yaml`](#metayaml) + - [`pre.ssz_snappy`](#pressz_snappy) + - [`blocks_.ssz_snappy`](#blocks_indexssz_snappy) + - [`post.ssz_snappy`](#postssz_snappy) + - [Condition](#condition) + + + # Transition testing Transition tests to cover processing the chain across a fork boundary. diff --git a/tests/generators/README.md b/tests/generators/README.md index 0146ca35e8..0dd1a87a65 100644 --- a/tests/generators/README.md +++ b/tests/generators/README.md @@ -14,7 +14,6 @@ An automated nightly tests release system, with a config filter applied, is bein - - [How to run generators](#how-to-run-generators) - [Cleaning](#cleaning) - [Running all test generators](#running-all-test-generators) diff --git a/tests/generators/bls/README.md b/tests/generators/bls/README.md index 24013f88e7..be19386372 100644 --- a/tests/generators/bls/README.md +++ b/tests/generators/bls/README.md @@ -1,3 +1,12 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [BLS Test Generator](#bls-test-generator) + - [Resources](#resources) + + + # BLS Test Generator The [BLS Signature APIs](../../../specs/phase0/beacon-chain.md#bls-signatures) diff --git a/tests/generators/epoch_processing/README.md b/tests/generators/epoch_processing/README.md index 662b0b516d..4e7a8119c9 100644 --- a/tests/generators/epoch_processing/README.md +++ b/tests/generators/epoch_processing/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Epoch processing](#epoch-processing) + + + # Epoch processing Epoch processing covers the sub-transitions during an epoch change. diff --git a/tests/generators/finality/README.md b/tests/generators/finality/README.md index dec5819c68..8686ffc445 100644 --- a/tests/generators/finality/README.md +++ b/tests/generators/finality/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Finality tests](#finality-tests) + + + # Finality tests Finality tests cover regular state-transitions in a common block-list format to test finality rules. diff --git a/tests/generators/fork_choice/README.md b/tests/generators/fork_choice/README.md index e67b115ba1..61f837d42d 100644 --- a/tests/generators/fork_choice/README.md +++ b/tests/generators/fork_choice/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Fork choice tests](#fork-choice-tests) + + + # Fork choice tests Fork choice tests cover the different forking cases with fork choice helper functions. diff --git a/tests/generators/genesis/README.md b/tests/generators/genesis/README.md index e270f6e35e..3f218841ae 100644 --- a/tests/generators/genesis/README.md +++ b/tests/generators/genesis/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Genesis test generator](#genesis-test-generator) + + + # Genesis test generator Genesis tests cover the initialization and validity-based launch trigger for the Beacon Chain genesis state. diff --git a/tests/generators/kzg_4844/README.md b/tests/generators/kzg_4844/README.md index ab81a85e86..61031ac1f4 100644 --- a/tests/generators/kzg_4844/README.md +++ b/tests/generators/kzg_4844/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [KZG 4844 Test Generator](#kzg-4844-test-generator) + + + # KZG 4844 Test Generator These tests are specific to the KZG API required for implementing EIP-4844 \ No newline at end of file diff --git a/tests/generators/light_client/README.md b/tests/generators/light_client/README.md index 7eabc2520c..2751c0874e 100644 --- a/tests/generators/light_client/README.md +++ b/tests/generators/light_client/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Light client tests](#light-client-tests) + + + # Light client tests The purpose of this test-generator is to provide test-vectors for validating the correct implementation of the light client sync protocol. diff --git a/tests/generators/merkle_proof/README.md b/tests/generators/merkle_proof/README.md index fb4d05fda8..b5ee6c8b6c 100644 --- a/tests/generators/merkle_proof/README.md +++ b/tests/generators/merkle_proof/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Merkle proof tests](#merkle-proof-tests) + + + # Merkle proof tests The purpose of this test-generator is to provide test-vectors for validating the correct implementation of the Merkle proof verification. diff --git a/tests/generators/operations/README.md b/tests/generators/operations/README.md index a5d48c11b4..2eac9c9f9e 100644 --- a/tests/generators/operations/README.md +++ b/tests/generators/operations/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Operations](#operations) + + + # Operations Operations (or "transactions" in previous spec iterations), diff --git a/tests/generators/random/README.md b/tests/generators/random/README.md index fd17284412..4c49226f8e 100644 --- a/tests/generators/random/README.md +++ b/tests/generators/random/README.md @@ -1,3 +1,14 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Randomized tests](#randomized-tests) +- [To generate test sources](#to-generate-test-sources) +- [To run tests](#to-run-tests) +- [To generate spec tests (from the generated files)](#to-generate-spec-tests-from-the-generated-files) + + + # Randomized tests Randomized tests in the format of `sanity` blocks tests, with randomized operations. diff --git a/tests/generators/rewards/README.md b/tests/generators/rewards/README.md index 60f106836a..4233958924 100644 --- a/tests/generators/rewards/README.md +++ b/tests/generators/rewards/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Rewards](#rewards) + + + # Rewards Rewards covers the sub-functions of `process_rewards_and_penalties` for granular testing of components of the rewards function. diff --git a/tests/generators/sanity/README.md b/tests/generators/sanity/README.md index cbc6aef06d..31c59f84d3 100644 --- a/tests/generators/sanity/README.md +++ b/tests/generators/sanity/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Sanity tests](#sanity-tests) + + + # Sanity tests Sanity tests cover regular state-transitions in a common block-list format, to ensure the basics work. diff --git a/tests/generators/shuffling/README.md b/tests/generators/shuffling/README.md index 81ddaba15f..0294c1ec6f 100644 --- a/tests/generators/shuffling/README.md +++ b/tests/generators/shuffling/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Shuffling Tests](#shuffling-tests) + + + # Shuffling Tests Tests for the swap-or-not shuffling in the beacon chain. diff --git a/tests/generators/ssz_static/README.md b/tests/generators/ssz_static/README.md index 3434fe174b..b557b726ad 100644 --- a/tests/generators/ssz_static/README.md +++ b/tests/generators/ssz_static/README.md @@ -1,3 +1,11 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [SSZ-static](#ssz-static) + + + # SSZ-static The purpose of this test-generator is to provide test-vectors for the most important applications of SSZ: From 5998e744476f6af6211688e5209cb7724d8f7240 Mon Sep 17 00:00:00 2001 From: fradamt Date: Tue, 21 May 2024 18:27:32 +0200 Subject: [PATCH 11/19] typos. electra tests passing --- specs/electra/beacon-chain.md | 10 +++++----- specs/electra/fork.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 87a282b8f5..b8d367b5aa 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -336,7 +336,7 @@ class ExecutionPayload(Container): deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in Electra:EIP6110] # [New in Electra:EIP7002:EIP7251] withdrawal_requests: List[ExecutionLayerWithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD] - consolidations_requests: List[ExecutionLayerConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP7251] + consolidation_requests: List[ExecutionLayerConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP7251] ``` #### `ExecutionPayloadHeader` @@ -364,7 +364,7 @@ class ExecutionPayloadHeader(Container): excess_blob_gas: uint64 deposit_receipts_root: Root # [New in Electra:EIP6110] withdrawal_requests_root: Root # [New in Electra:EIP7002:EIP7251] - consolidations_requests_root: Root # [New in Electra:EIP7251] + consolidation_requests_root: Root # [New in Electra:EIP7251] ``` #### `BeaconState` @@ -1003,7 +1003,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi excess_blob_gas=payload.excess_blob_gas, deposit_receipts_root=hash_tree_root(payload.deposit_receipts), # [New in Electra:EIP6110] withdrawal_requests_root=hash_tree_root(payload.withdrawal_requests), # [New in Electra:EIP7002:EIP7251] - consolidations_root=hash_tree_root(payload.consolidations), # [New in Electra:EIP7251] + consolidation_requests_root=hash_tree_root(payload.consolidation_requests), # [New in Electra:EIP7251] ) ``` @@ -1036,7 +1036,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None: # [New in Electra:EIP7002:EIP7251] for_ops(body.execution_payload.withdrawal_requests, process_execution_layer_withdrawal_request) for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt) # [New in Electra:EIP6110] - for_ops(body.execution_payload.consolidations_requests, process_execution_layer_consolidation_request) # [New in Electra:EIP7251] + for_ops(body.execution_payload.consolidation_requests, process_execution_layer_consolidation_request) # [New in Electra:EIP7251] ``` ##### Attestations @@ -1318,7 +1318,7 @@ def process_execution_layer_consolidation_request( # Verify source withdrawal credentials has_correct_credential = has_execution_withdrawal_credential(source_validator) is_correct_source_address = ( - source_validator.withdrawal_credentials[12:] == consolidation.source_address + source_validator.withdrawal_credentials[12:] == execution_layer_consolidation_request.source_address ) if not (has_correct_credential and is_correct_source_address): return diff --git a/specs/electra/fork.md b/specs/electra/fork.md index a65bdebb53..0660aaf7f7 100644 --- a/specs/electra/fork.md +++ b/specs/electra/fork.md @@ -92,7 +92,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState: excess_blob_gas=pre.latest_execution_payload_header.excess_blob_gas, deposit_receipts_root=Root(), # [New in Electra:EIP6110] withdrawal_requests_root=Root(), # [New in Electra:EIP7002] - consolidations_requests_root=Root(), # [New in Electra:EIP7251] + consolidation_requests_root=Root(), # [New in Electra:EIP7251] ) exit_epochs = [v.exit_epoch for v in pre.validators if v.exit_epoch != FAR_FUTURE_EPOCH] From c17f22fedc0efc39cd04e6c5f4442908ebe9cd90 Mon Sep 17 00:00:00 2001 From: fradamt Date: Tue, 21 May 2024 22:46:44 +0200 Subject: [PATCH 12/19] add missing decorators --- .../test_process_execution_layer_consolidation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py index 7f0b53ba99..ce31da6acd 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py @@ -662,12 +662,11 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, ) - set_eth1_withdrawal_credential_with_balance(spec, state, target_index) yield from run_consolidation_processing( spec, state, consolidation, success=False ) - +@with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, @@ -698,6 +697,7 @@ def test_invalid_incorrect_source_address(spec, state): ) +@with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, @@ -727,6 +727,7 @@ def test_invalid_unknown_source_pubkey(spec, state): ) +@with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit, From 6b6936836acc5f06f6b0cde738e2ad361f195636 Mon Sep 17 00:00:00 2001 From: fradamt Date: Tue, 21 May 2024 22:54:25 +0200 Subject: [PATCH 13/19] Revert "minor fixes, doctoc" This reverts commit dc2a2bd85ae1e8c7c2e426faba3167069ef548a5. --- README.md | 18 -------- SECURITY.md | 10 ----- configs/README.md | 10 ----- docker/README.md | 8 ---- docs/docs/templates/beacon-chain-template.md | 18 -------- docs/light-client/index.md | 8 ---- presets/README.md | 10 ----- solidity_deposit_contract/README.md | 12 ------ specs/electra/beacon-chain.md | 11 ++--- tests/README.md | 17 -------- tests/core/pyspec/README.md | 17 -------- tests/core/pyspec/eth2spec/config/README.md | 9 ---- .../pyspec/eth2spec/gen_helpers/README.md | 11 ----- ...t_process_execution_layer_consolidation.py | 42 +++++++++---------- tests/formats/README.md | 29 ------------- tests/formats/bls/README.md | 8 ---- tests/formats/bls/aggregate.md | 10 ----- tests/formats/bls/aggregate_verify.md | 10 ----- tests/formats/bls/eth_aggregate_pubkeys.md | 10 ----- .../formats/bls/eth_fast_aggregate_verify.md | 10 ----- tests/formats/bls/fast_aggregate_verify.md | 10 ----- tests/formats/bls/sign.md | 10 ----- tests/formats/bls/verify.md | 9 ---- tests/formats/epoch_processing/README.md | 13 ------ tests/formats/finality/README.md | 14 ------- tests/formats/forks/README.md | 15 ------- tests/formats/genesis/README.md | 8 ---- tests/formats/genesis/initialization.md | 16 ------- tests/formats/genesis/validity.md | 14 ------- tests/formats/kzg_4844/README.md | 8 ---- .../kzg_4844/blob_to_kzg_commitment.md | 10 ----- .../kzg_4844/compute_blob_kzg_proof.md | 10 ----- tests/formats/kzg_4844/compute_kzg_proof.md | 10 ----- .../formats/kzg_4844/verify_blob_kzg_proof.md | 10 ----- .../kzg_4844/verify_blob_kzg_proof_batch.md | 10 ----- tests/formats/kzg_4844/verify_kzg_proof.md | 10 ----- tests/formats/light_client/README.md | 8 ---- .../light_client/single_merkle_proof.md | 12 ------ tests/formats/light_client/sync.md | 17 -------- tests/formats/light_client/update_ranking.md | 12 ------ tests/formats/merkle_proof/README.md | 8 ---- tests/formats/operations/README.md | 14 ------- tests/formats/random/README.md | 9 ---- tests/formats/rewards/README.md | 17 -------- tests/formats/sanity/README.md | 8 ---- tests/formats/sanity/blocks.md | 14 ------- tests/formats/sanity/slots.md | 15 ------- tests/formats/shuffling/README.md | 11 ----- tests/formats/ssz_generic/README.md | 23 ---------- tests/formats/ssz_static/README.md | 8 ---- tests/formats/ssz_static/core.md | 14 ------- tests/formats/sync/README.md | 8 ---- tests/formats/transition/README.md | 14 ------- tests/generators/README.md | 1 + tests/generators/bls/README.md | 9 ---- tests/generators/epoch_processing/README.md | 8 ---- tests/generators/finality/README.md | 8 ---- tests/generators/fork_choice/README.md | 8 ---- tests/generators/genesis/README.md | 8 ---- tests/generators/kzg_4844/README.md | 8 ---- tests/generators/light_client/README.md | 8 ---- tests/generators/merkle_proof/README.md | 8 ---- tests/generators/operations/README.md | 8 ---- tests/generators/random/README.md | 11 ----- tests/generators/rewards/README.md | 8 ---- tests/generators/sanity/README.md | 8 ---- tests/generators/shuffling/README.md | 8 ---- tests/generators/ssz_static/README.md | 8 ---- 68 files changed, 28 insertions(+), 756 deletions(-) diff --git a/README.md b/README.md index e66e79b097..58bff5b9e4 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Ethereum Proof-of-Stake Consensus Specifications](#ethereum-proof-of-stake-consensus-specifications) - - [Specs](#specs) - - [Stable Specifications](#stable-specifications) - - [In-development Specifications](#in-development-specifications) - - [Accompanying documents can be found in specs and include:](#accompanying-documents-can-be-found-in-specs-and-include) - - [Additional specifications for client implementers](#additional-specifications-for-client-implementers) - - [Design goals](#design-goals) - - [Useful external resources](#useful-external-resources) - - [For spec contributors](#for-spec-contributors) - - [Online viewer of the latest release (latest `master` branch)](#online-viewer-of-the-latest-release-latest-master-branch) - - [Consensus spec tests](#consensus-spec-tests) - - - # Ethereum Proof-of-Stake Consensus Specifications [![Join the chat at https://discord.gg/qGpsxSA](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://discord.gg/qGpsxSA) diff --git a/SECURITY.md b/SECURITY.md index a770f5749e..2101ea1554 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Security Policy](#security-policy) - - [Supported Versions](#supported-versions) - - [Reporting a Vulnerability](#reporting-a-vulnerability) - - - # Security Policy ## Supported Versions diff --git a/configs/README.md b/configs/README.md index 82b7783682..6ef081e4c4 100644 --- a/configs/README.md +++ b/configs/README.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Configurations](#configurations) - - [Forking](#forking) - - [Format](#format) - - - # Configurations This directory contains a set of configurations used for testing, testnets, and mainnet. diff --git a/docker/README.md b/docker/README.md index 29c7faa3f5..6d5b21e59d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Docker related information](#docker-related-information) - - - ## Docker related information This dockerfile sets up the dependencies required to run consensus-spec tests. The docker image can be locally built with: diff --git a/docs/docs/templates/beacon-chain-template.md b/docs/docs/templates/beacon-chain-template.md index 04d61b071f..4d22d3908e 100644 --- a/docs/docs/templates/beacon-chain-template.md +++ b/docs/docs/templates/beacon-chain-template.md @@ -7,24 +7,6 @@ -- [Introduction](#introduction) -- [Notation](#notation) -- [Custom types](#custom-types) -- [Constants](#constants) - - [[CATEGORY OF CONSTANTS]](#category-of-constants) -- [Preset](#preset) - - [[CATEGORY OF PRESETS]](#category-of-presets) -- [Configuration](#configuration) - - [[CATEGORY OF CONFIGURATIONS]](#category-of-configurations) -- [Containers](#containers) - - [[CATEGORY OF CONTAINERS]](#category-of-containers) - - [`CONTAINER_NAME`](#container_name) -- [Helper functions](#helper-functions) - - [[CATEGORY OF HELPERS]](#category-of-helpers) - - [Epoch processing](#epoch-processing) - - [Block processing](#block-processing) -- [Testing](#testing) - diff --git a/docs/light-client/index.md b/docs/light-client/index.md index 0431126eeb..32155b1852 100644 --- a/docs/light-client/index.md +++ b/docs/light-client/index.md @@ -1,9 +1 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Light client specifications](#light-client-specifications) - - - # Light client specifications diff --git a/presets/README.md b/presets/README.md index 00709d653b..3a438cb2ca 100644 --- a/presets/README.md +++ b/presets/README.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Presets](#presets) - - [Forking](#forking) - - [Format](#format) - - - # Presets Presets are more extensive than runtime configurations, and generally only applicable during compile-time. diff --git a/solidity_deposit_contract/README.md b/solidity_deposit_contract/README.md index 139adf8b11..0388d7d2f5 100644 --- a/solidity_deposit_contract/README.md +++ b/solidity_deposit_contract/README.md @@ -1,15 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Deposit Contract](#deposit-contract) - - [History](#history) - - [Compiling solidity deposit contract](#compiling-solidity-deposit-contract) - - [Running web3 tests](#running-web3-tests) - - [Running randomized `dapp` tests:](#running-randomized-dapp-tests) - - - # Deposit Contract ## History diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index b8d367b5aa..9cfff26e9a 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -28,7 +28,8 @@ - [`PendingBalanceDeposit`](#pendingbalancedeposit) - [`PendingPartialWithdrawal`](#pendingpartialwithdrawal) - [`ExecutionLayerWithdrawalRequest`](#executionlayerwithdrawalrequest) - - [`ExecutionLayerConsolidationRequest`](#executionlayerconsolidationrequest) + - [`Consolidation`](#consolidation) + - [`SignedConsolidation`](#signedconsolidation) - [`PendingConsolidation`](#pendingconsolidation) - [Modified Containers](#modified-containers) - [`AttesterSlashing`](#attesterslashing) @@ -93,8 +94,8 @@ - [New `process_execution_layer_withdrawal_request`](#new-process_execution_layer_withdrawal_request) - [Deposit receipts](#deposit-receipts) - [New `process_deposit_receipt`](#new-process_deposit_receipt) - - [Execution layer consolidation requests](#execution-layer-consolidation-requests) - - [New `process_execution_layer_consolidation_request`](#new-process_execution_layer_consolidation_request) + - [Consolidations](#consolidations) + - [New `process_consolidation`](#new-process_consolidation) - [Testing](#testing) @@ -1285,10 +1286,10 @@ def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) ##### Execution layer consolidation requests -###### New `process_execution_layer_consolidation_request` +###### New `process_execution_layer_consolidation_requests` ```python -def process_execution_layer_consolidation_request( +def process_execution_layer_consolidation_requests( state: BeaconState, execution_layer_consolidation_request: ExecutionLayerConsolidationRequest) -> None: # If the pending consolidations queue is full, consolidation requests are ignored diff --git a/tests/README.md b/tests/README.md index 46a7bf2ddf..dbd2b31de2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,20 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Getting Started with Consensus Spec Tests](#getting-started-with-consensus-spec-tests) - - [Getting Started](#getting-started) - - [Creating the environment](#creating-the-environment) - - [Running your first test](#running-your-first-test) - - [The "Hello, World" of Consensus Spec Tests](#the-hello-world-of-consensus-spec-tests) - - [New Tests](#new-tests) - - [Tests Designed to Fail](#tests-designed-to-fail) - - [Attestation Tests](#attestation-tests) - - [Adding an Attestation Test](#adding-an-attestation-test) - - [How are These Tests Used?](#how-are-these-tests-used) - - - # Getting Started with Consensus Spec Tests ## Getting Started diff --git a/tests/core/pyspec/README.md b/tests/core/pyspec/README.md index ca177cf772..baa1322771 100644 --- a/tests/core/pyspec/README.md +++ b/tests/core/pyspec/README.md @@ -1,20 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Executable Python Spec (PySpec)](#executable-python-spec-pyspec) - - [Dev Install](#dev-install) - - [Py-tests](#py-tests) - - [How to run tests](#how-to-run-tests) - - [Automated](#automated) - - [Manual](#manual) - - [How to view code coverage report](#how-to-view-code-coverage-report) - - [Advanced](#advanced) - - [Contributing](#contributing) - - [License](#license) - - - # Executable Python Spec (PySpec) The executable Python spec is built from the consensus specifications, diff --git a/tests/core/pyspec/eth2spec/config/README.md b/tests/core/pyspec/eth2spec/config/README.md index 7d6a044de3..c03d890c20 100644 --- a/tests/core/pyspec/eth2spec/config/README.md +++ b/tests/core/pyspec/eth2spec/config/README.md @@ -1,12 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Consensus specs config util](#consensus-specs-config-util) - - [Config usage:](#config-usage) - - - # Consensus specs config util For run-time configuration, see [Configs documentation](../../../../../configs/README.md). diff --git a/tests/core/pyspec/eth2spec/gen_helpers/README.md b/tests/core/pyspec/eth2spec/gen_helpers/README.md index 88f8fcf4b7..bf791ccfea 100644 --- a/tests/core/pyspec/eth2spec/gen_helpers/README.md +++ b/tests/core/pyspec/eth2spec/gen_helpers/README.md @@ -1,14 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Consensus test generator helpers](#consensus-test-generator-helpers) - - [`gen_base`](#gen_base) - - [`gen_from_tests`](#gen_from_tests) - - [Test-case parts](#test-case-parts) - - - # Consensus test generator helpers ## `gen_base` diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py index ce31da6acd..54e88fef4f 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py @@ -40,7 +40,7 @@ def test_basic_consolidation_in_current_consolidation_epoch(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -89,7 +89,7 @@ def test_basic_consolidation_in_new_consolidation_epoch(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -132,7 +132,7 @@ def test_basic_consolidation_with_preexisting_churn(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -179,7 +179,7 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -230,7 +230,7 @@ def test_basic_consolidation_with_compounding_credentials(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -276,7 +276,7 @@ def test_consolidation_churn_limit_balance(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -324,7 +324,7 @@ def test_consolidation_balance_larger_than_churn_limit(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -371,7 +371,7 @@ def test_consolidation_balance_through_two_churn_epochs(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -417,7 +417,7 @@ def test_invalid_source_equals_target(spec, state): spec, state, source_index, address=source_address ) # Make consolidation from source to source - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[source_index].pubkey, @@ -449,7 +449,7 @@ def test_invalid_exceed_pending_consolidations_limit(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -478,7 +478,7 @@ def test_invalid_not_enough_consolidation_churn_available(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -506,7 +506,7 @@ def test_invalid_exited_source(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -538,7 +538,7 @@ def test_invalid_exited_target(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -568,7 +568,7 @@ def test_invalid_inactive_source(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -600,7 +600,7 @@ def test_invalid_inactive_target(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -629,7 +629,7 @@ def test_invalid_no_source_execution_withdrawal_credential(spec, state): source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] source_address = b"\x22" * 20 - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -657,7 +657,7 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -684,7 +684,7 @@ def test_invalid_incorrect_source_address(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different source address - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=b"\x33" * 20, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -715,7 +715,7 @@ def test_invalid_unknown_source_pubkey(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different source pubkey - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=source_address, source_pubkey=b"\x00" * 48, target_pubkey=state.validators[target_index].pubkey, @@ -745,7 +745,7 @@ def test_invalid_unknown_target_pubkey(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different target pubkey - consolidation = spec.ExecutionLayerConsolidationRequest( + consolidation = spec.ExecutionLayerConsolidation( source_address=b"\x33" * 20, source_pubkey=state.validators[source_index].pubkey, target_pubkey=b"\x00" * 48, @@ -783,7 +783,7 @@ def run_consolidation_processing(spec, state, consolidation, success=True): yield 'pre', state yield 'consolidation', consolidation - spec.process_execution_layer_consolidation_request(state, consolidation) + spec.process_execution_layer_consolidation(state, consolidation) yield 'post', state diff --git a/tests/formats/README.md b/tests/formats/README.md index 0fbf3cd9ea..ec495daa5b 100644 --- a/tests/formats/README.md +++ b/tests/formats/README.md @@ -1,32 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [General test format](#general-test-format) - - [Table of contents](#table-of-contents) - - [About](#about) - - [Test-case formats](#test-case-formats) - - [Glossary](#glossary) - - [Test format philosophy](#test-format-philosophy) - - [Config design](#config-design) - - [Test completeness](#test-completeness) - - [Test structure](#test-structure) - - [`/`](#config-name) - - [`/`](#fork-or-phase-name) - - [`/`](#test-runner-name) - - [`/`](#test-handler-name) - - [`/`](#test-suite-name) - - [`/`](#test-case) - - [``](#output-part) - - [Common output formats](#common-output-formats) - - [Special output parts](#special-output-parts) - - [`meta.yaml`](#metayaml) - - [`config.yaml`](#configyaml) - - [Config sourcing](#config-sourcing) - - [Note for implementers](#note-for-implementers) - - - # General test format This document defines the YAML format and structure used for consensus spec testing. diff --git a/tests/formats/bls/README.md b/tests/formats/bls/README.md index d4e3ea9035..77a9654a8d 100644 --- a/tests/formats/bls/README.md +++ b/tests/formats/bls/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [BLS tests](#bls-tests) - - - # BLS tests A test type for BLS. Primarily geared towards verifying the *integration* of any BLS library. diff --git a/tests/formats/bls/aggregate.md b/tests/formats/bls/aggregate.md index 4f86bc0d3f..7cdebcf4d9 100644 --- a/tests/formats/bls/aggregate.md +++ b/tests/formats/bls/aggregate.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: BLS signature aggregation](#test-format-bls-signature-aggregation) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: BLS signature aggregation A BLS signature aggregation combines a series of signatures into a single signature. diff --git a/tests/formats/bls/aggregate_verify.md b/tests/formats/bls/aggregate_verify.md index 0e8414c00b..9b251af46e 100644 --- a/tests/formats/bls/aggregate_verify.md +++ b/tests/formats/bls/aggregate_verify.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: BLS sign message](#test-format-bls-sign-message) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: BLS sign message Verify the signature against the given pubkeys and one messages. diff --git a/tests/formats/bls/eth_aggregate_pubkeys.md b/tests/formats/bls/eth_aggregate_pubkeys.md index 4a61330a30..2b72c1dcaf 100644 --- a/tests/formats/bls/eth_aggregate_pubkeys.md +++ b/tests/formats/bls/eth_aggregate_pubkeys.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Ethereum-customized BLS pubkey aggregation](#test-format-ethereum-customized-bls-pubkey-aggregation) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Ethereum-customized BLS pubkey aggregation A BLS pubkey aggregation combines a series of pubkeys into a single pubkey. diff --git a/tests/formats/bls/eth_fast_aggregate_verify.md b/tests/formats/bls/eth_fast_aggregate_verify.md index 66a3728a0d..83b5484e05 100644 --- a/tests/formats/bls/eth_fast_aggregate_verify.md +++ b/tests/formats/bls/eth_fast_aggregate_verify.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Ethereum-customized BLS fast aggregate verify](#test-format-ethereum-customized-bls-fast-aggregate-verify) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Ethereum-customized BLS fast aggregate verify Verify the signature against the given pubkeys and one message. diff --git a/tests/formats/bls/fast_aggregate_verify.md b/tests/formats/bls/fast_aggregate_verify.md index b7a94b1c00..38ea29bb5f 100644 --- a/tests/formats/bls/fast_aggregate_verify.md +++ b/tests/formats/bls/fast_aggregate_verify.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: BLS fast aggregate verify](#test-format-bls-fast-aggregate-verify) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: BLS fast aggregate verify Verify the signature against the given pubkeys and one message. diff --git a/tests/formats/bls/sign.md b/tests/formats/bls/sign.md index 96756c9e3f..09e9286148 100644 --- a/tests/formats/bls/sign.md +++ b/tests/formats/bls/sign.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: BLS sign message](#test-format-bls-sign-message) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: BLS sign message Message signing with BLS should produce a signature. diff --git a/tests/formats/bls/verify.md b/tests/formats/bls/verify.md index 0fd5f43f29..57ec8a33a7 100644 --- a/tests/formats/bls/verify.md +++ b/tests/formats/bls/verify.md @@ -1,12 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: BLS sign message](#test-format-bls-sign-message) - - [Test case format](#test-case-format) - - - # Test format: BLS sign message Verify the signature against the given one pubkey and one message. diff --git a/tests/formats/epoch_processing/README.md b/tests/formats/epoch_processing/README.md index 60eee01179..2951767f2c 100644 --- a/tests/formats/epoch_processing/README.md +++ b/tests/formats/epoch_processing/README.md @@ -1,16 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Epoch processing tests](#epoch-processing-tests) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`post.ssz_snappy`](#postssz_snappy) - - [Condition](#condition) - - - # Epoch processing tests The different epoch sub-transitions are tested individually with test handlers. diff --git a/tests/formats/finality/README.md b/tests/formats/finality/README.md index 2cdb820c79..af39f5c8ca 100644 --- a/tests/formats/finality/README.md +++ b/tests/formats/finality/README.md @@ -1,17 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Finality tests](#finality-tests) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`blocks_.yaml`](#blocks_indexyaml) - - [`post.ssz_snappy`](#postssz_snappy) - - [Condition](#condition) - - - # Finality tests The aim of the tests for the finality rules. diff --git a/tests/formats/forks/README.md b/tests/formats/forks/README.md index 6c685e41f6..dfbaf2df0b 100644 --- a/tests/formats/forks/README.md +++ b/tests/formats/forks/README.md @@ -1,18 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Forks](#forks) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [Fork strings](#fork-strings) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`post.ssz_snappy`](#postssz_snappy) - - [Processing](#processing) - - [Condition](#condition) - - - # Forks The aim of the fork tests is to ensure that a pre-fork state can be transformed diff --git a/tests/formats/genesis/README.md b/tests/formats/genesis/README.md index 110c3c9524..25761e2f6a 100644 --- a/tests/formats/genesis/README.md +++ b/tests/formats/genesis/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Genesis tests](#genesis-tests) - - - # Genesis tests The aim of the genesis tests is to provide a baseline to test genesis-state initialization and test diff --git a/tests/formats/genesis/initialization.md b/tests/formats/genesis/initialization.md index aebba624af..9848e157d9 100644 --- a/tests/formats/genesis/initialization.md +++ b/tests/formats/genesis/initialization.md @@ -1,19 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Genesis creation testing](#genesis-creation-testing) - - [Test case format](#test-case-format) - - [`eth1.yaml`](#eth1yaml) - - [`meta.yaml`](#metayaml) - - [`deposits_.ssz_snappy`](#deposits_indexssz_snappy) - - [`execution_payload_header.ssz_snappy`](#execution_payload_headerssz_snappy) - - [`state.ssz_snappy`](#statessz_snappy) - - [Processing](#processing) - - [Condition](#condition) - - - # Genesis creation testing Tests the initialization of a genesis state based on Eth1 data. diff --git a/tests/formats/genesis/validity.md b/tests/formats/genesis/validity.md index 2ad42feb67..15236c3ba3 100644 --- a/tests/formats/genesis/validity.md +++ b/tests/formats/genesis/validity.md @@ -1,17 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Genesis validity testing](#genesis-validity-testing) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`genesis.ssz_snappy`](#genesisssz_snappy) - - [`is_valid.yaml`](#is_validyaml) - - [Processing](#processing) - - [Condition](#condition) - - - # Genesis validity testing Tests if a genesis state is valid, i.e. if it counts as trigger to launch. diff --git a/tests/formats/kzg_4844/README.md b/tests/formats/kzg_4844/README.md index f5afa9ed12..b5bd720393 100644 --- a/tests/formats/kzg_4844/README.md +++ b/tests/formats/kzg_4844/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [KZG tests](#kzg-tests) - - - # KZG tests A test type for KZG libraries. Tests all the public interfaces that a KZG library required to implement EIP-4844 needs to provide, as defined in `polynomial-commitments.md`. diff --git a/tests/formats/kzg_4844/blob_to_kzg_commitment.md b/tests/formats/kzg_4844/blob_to_kzg_commitment.md index fdc710edfd..dbb1556a1d 100644 --- a/tests/formats/kzg_4844/blob_to_kzg_commitment.md +++ b/tests/formats/kzg_4844/blob_to_kzg_commitment.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Blob to KZG commitment](#test-format-blob-to-kzg-commitment) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Blob to KZG commitment Compute the KZG commitment for a given `blob`. diff --git a/tests/formats/kzg_4844/compute_blob_kzg_proof.md b/tests/formats/kzg_4844/compute_blob_kzg_proof.md index 32a9f97104..62fce37231 100644 --- a/tests/formats/kzg_4844/compute_blob_kzg_proof.md +++ b/tests/formats/kzg_4844/compute_blob_kzg_proof.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Compute blob KZG proof](#test-format-compute-blob-kzg-proof) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Compute blob KZG proof Compute the blob KZG proof for a given `blob`, that helps with quickly verifying that the KZG commitment for the blob is correct. diff --git a/tests/formats/kzg_4844/compute_kzg_proof.md b/tests/formats/kzg_4844/compute_kzg_proof.md index e85616539d..b10105129b 100644 --- a/tests/formats/kzg_4844/compute_kzg_proof.md +++ b/tests/formats/kzg_4844/compute_kzg_proof.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Compute KZG proof](#test-format-compute-kzg-proof) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Compute KZG proof Compute the KZG proof for a given `blob` and an evaluation point `z`. diff --git a/tests/formats/kzg_4844/verify_blob_kzg_proof.md b/tests/formats/kzg_4844/verify_blob_kzg_proof.md index 9a62ba92a4..dd0bcda5a9 100644 --- a/tests/formats/kzg_4844/verify_blob_kzg_proof.md +++ b/tests/formats/kzg_4844/verify_blob_kzg_proof.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Verify blob KZG proof](#test-format-verify-blob-kzg-proof) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Verify blob KZG proof Use the blob KZG proof to verify that the KZG commitment for a given `blob` is correct diff --git a/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md b/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md index 040446f69a..82e668497d 100644 --- a/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md +++ b/tests/formats/kzg_4844/verify_blob_kzg_proof_batch.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Verify blob KZG proof batch](#test-format-verify-blob-kzg-proof-batch) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Verify blob KZG proof batch Use the blob KZG proofs to verify that the KZG commitments for given `blobs` are correct diff --git a/tests/formats/kzg_4844/verify_kzg_proof.md b/tests/formats/kzg_4844/verify_kzg_proof.md index bb4c1547f1..18e02710c5 100644 --- a/tests/formats/kzg_4844/verify_kzg_proof.md +++ b/tests/formats/kzg_4844/verify_kzg_proof.md @@ -1,13 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: Verify KZG proof](#test-format-verify-kzg-proof) - - [Test case format](#test-case-format) - - [Condition](#condition) - - - # Test format: Verify KZG proof Verify the KZG proof for a given `blob` and an evaluation point `z` that claims to result in a value of `y`. diff --git a/tests/formats/light_client/README.md b/tests/formats/light_client/README.md index 84f06f58c1..505b416019 100644 --- a/tests/formats/light_client/README.md +++ b/tests/formats/light_client/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Light client sync protocol tests](#light-client-sync-protocol-tests) - - - # Light client sync protocol tests This series of tests provides reference test vectors for the light client sync protocol spec. diff --git a/tests/formats/light_client/single_merkle_proof.md b/tests/formats/light_client/single_merkle_proof.md index 789603af57..0cb4cd0d0c 100644 --- a/tests/formats/light_client/single_merkle_proof.md +++ b/tests/formats/light_client/single_merkle_proof.md @@ -1,15 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Single leaf merkle proof tests](#single-leaf-merkle-proof-tests) - - [Test case format](#test-case-format) - - [`object.ssz_snappy`](#objectssz_snappy) - - [`proof.yaml`](#proofyaml) - - [Condition](#condition) - - - # Single leaf merkle proof tests This series of tests provides reference test vectors for validating correct diff --git a/tests/formats/light_client/sync.md b/tests/formats/light_client/sync.md index f2a52f167e..1706b4c162 100644 --- a/tests/formats/light_client/sync.md +++ b/tests/formats/light_client/sync.md @@ -1,20 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Light client sync tests](#light-client-sync-tests) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`bootstrap.ssz_snappy`](#bootstrapssz_snappy) - - [`steps.yaml`](#stepsyaml) - - [Checks to run after each step](#checks-to-run-after-each-step) - - [`force_update` execution step](#force_update-execution-step) - - [`process_update` execution step](#process_update-execution-step) - - [`upgrade_store`](#upgrade_store) - - [Condition](#condition) - - - # Light client sync tests This series of tests provides reference test vectors for validating that a light client implementing the sync protocol can sync to the latest block header. diff --git a/tests/formats/light_client/update_ranking.md b/tests/formats/light_client/update_ranking.md index 4640f7860b..fe73fb9df7 100644 --- a/tests/formats/light_client/update_ranking.md +++ b/tests/formats/light_client/update_ranking.md @@ -1,15 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [`LightClientUpdate` ranking tests](#lightclientupdate-ranking-tests) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`updates_.ssz_snappy`](#updates_indexssz_snappy) - - [Condition](#condition) - - - # `LightClientUpdate` ranking tests This series of tests provides reference test vectors for validating that `LightClientUpdate` instances are ranked in a canonical order. diff --git a/tests/formats/merkle_proof/README.md b/tests/formats/merkle_proof/README.md index 5791dd5283..77822daabe 100644 --- a/tests/formats/merkle_proof/README.md +++ b/tests/formats/merkle_proof/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Merkle proof tests](#merkle-proof-tests) - - - # Merkle proof tests Handlers: diff --git a/tests/formats/operations/README.md b/tests/formats/operations/README.md index e3627cf30b..b020b5fd03 100644 --- a/tests/formats/operations/README.md +++ b/tests/formats/operations/README.md @@ -1,17 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Operations tests](#operations-tests) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`.ssz_snappy`](#input-namessz_snappy) - - [`post.ssz_snappy`](#postssz_snappy) - - [Condition](#condition) - - - # Operations tests The different kinds of operations ("transactions") are tested individually with test handlers. diff --git a/tests/formats/random/README.md b/tests/formats/random/README.md index b6ac4429fd..54b2c1a23e 100644 --- a/tests/formats/random/README.md +++ b/tests/formats/random/README.md @@ -1,12 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Random tests](#random-tests) - - [Test case format](#test-case-format) - - - # Random tests The random tests are generated with various randomized states and blocks. diff --git a/tests/formats/rewards/README.md b/tests/formats/rewards/README.md index 7aa36adb1b..a6682042f7 100644 --- a/tests/formats/rewards/README.md +++ b/tests/formats/rewards/README.md @@ -1,20 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Rewards tests](#rewards-tests) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`source_deltas.ssz_snappy`](#source_deltasssz_snappy) - - [`target_deltas.ssz_snappy`](#target_deltasssz_snappy) - - [`head_deltas.ssz_snappy`](#head_deltasssz_snappy) - - [`inclusion_delay_deltas.ssz_snappy`](#inclusion_delay_deltasssz_snappy) - - [`inactivity_penalty_deltas.ssz_snappy`](#inactivity_penalty_deltasssz_snappy) - - [Condition](#condition) - - - # Rewards tests All rewards deltas sub-functions are tested for each test case. diff --git a/tests/formats/sanity/README.md b/tests/formats/sanity/README.md index d2b26709ee..20b36208a4 100644 --- a/tests/formats/sanity/README.md +++ b/tests/formats/sanity/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Sanity tests](#sanity-tests) - - - # Sanity tests The aim of the sanity tests is to set a base-line on what really needs to pass, i.e. the essentials. diff --git a/tests/formats/sanity/blocks.md b/tests/formats/sanity/blocks.md index 1c1bc3c92c..7ea646b9e0 100644 --- a/tests/formats/sanity/blocks.md +++ b/tests/formats/sanity/blocks.md @@ -1,17 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Sanity blocks testing](#sanity-blocks-testing) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`blocks_.ssz_snappy`](#blocks_indexssz_snappy) - - [`post.ssz_snappy`](#postssz_snappy) - - [Condition](#condition) - - - # Sanity blocks testing Sanity tests to cover a series of one or more blocks being processed, aiming to cover common changes. diff --git a/tests/formats/sanity/slots.md b/tests/formats/sanity/slots.md index 54083f5cf0..f1b8a13219 100644 --- a/tests/formats/sanity/slots.md +++ b/tests/formats/sanity/slots.md @@ -1,18 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Sanity slots testing](#sanity-slots-testing) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`slots.yaml`](#slotsyaml) - - [`post.ssz_snappy`](#postssz_snappy) - - [Processing](#processing) - - [Condition](#condition) - - - # Sanity slots testing Sanity tests to cover a series of one or more empty-slot transitions being processed, aiming to cover common changes. diff --git a/tests/formats/shuffling/README.md b/tests/formats/shuffling/README.md index 1334362f49..15bfe6996b 100644 --- a/tests/formats/shuffling/README.md +++ b/tests/formats/shuffling/README.md @@ -1,14 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: shuffling](#test-format-shuffling) - - [Test case format](#test-case-format) - - [`mapping.yaml`](#mappingyaml) - - [Condition](#condition) - - - # Test format: shuffling The runner of the Shuffling test type has only one handler: `core`. diff --git a/tests/formats/ssz_generic/README.md b/tests/formats/ssz_generic/README.md index c95ef2aad6..c46025847a 100644 --- a/tests/formats/ssz_generic/README.md +++ b/tests/formats/ssz_generic/README.md @@ -1,26 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [SSZ, generic tests](#ssz-generic-tests) - - [Format](#format) - - [`valid`](#valid) - - [`meta.yaml`](#metayaml) - - [`serialized.ssz_snappy`](#serializedssz_snappy) - - [`value.yaml`](#valueyaml) - - [Conditions](#conditions) - - [`invalid`](#invalid) - - [Condition](#condition) - - [Type declarations](#type-declarations) - - [`basic_vector`](#basic_vector) - - [`bitlist`](#bitlist) - - [`bitvector`](#bitvector) - - [`boolean`](#boolean) - - [`uints`](#uints) - - [`containers`](#containers) - - - # SSZ, generic tests This set of test-suites provides general testing for SSZ: diff --git a/tests/formats/ssz_static/README.md b/tests/formats/ssz_static/README.md index 3cef2de714..ffa7373349 100644 --- a/tests/formats/ssz_static/README.md +++ b/tests/formats/ssz_static/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [SSZ, static tests](#ssz-static-tests) - - - # SSZ, static tests This set of test-suites provides static testing for SSZ: diff --git a/tests/formats/ssz_static/core.md b/tests/formats/ssz_static/core.md index 6995de9abb..09ff04e20d 100644 --- a/tests/formats/ssz_static/core.md +++ b/tests/formats/ssz_static/core.md @@ -1,17 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Test format: SSZ static types](#test-format-ssz-static-types) - - [Test case format](#test-case-format) - - [`roots.yaml`](#rootsyaml) - - [`serialized.ssz_snappy`](#serializedssz_snappy) - - [`value.yaml`](#valueyaml) - - [Condition](#condition) - - [References](#references) - - - # Test format: SSZ static types The goal of this type is to provide clients with a solid reference for how the known SSZ objects should be encoded. diff --git a/tests/formats/sync/README.md b/tests/formats/sync/README.md index be95ba765f..ff9f8168cb 100644 --- a/tests/formats/sync/README.md +++ b/tests/formats/sync/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Sync tests](#sync-tests) - - - # Sync tests It re-uses the [fork choice test format](../fork_choice/README.md) to apply the test script. diff --git a/tests/formats/transition/README.md b/tests/formats/transition/README.md index cd4a23f293..7f89bdd610 100644 --- a/tests/formats/transition/README.md +++ b/tests/formats/transition/README.md @@ -1,17 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Transition testing](#transition-testing) - - [Test case format](#test-case-format) - - [`meta.yaml`](#metayaml) - - [`pre.ssz_snappy`](#pressz_snappy) - - [`blocks_.ssz_snappy`](#blocks_indexssz_snappy) - - [`post.ssz_snappy`](#postssz_snappy) - - [Condition](#condition) - - - # Transition testing Transition tests to cover processing the chain across a fork boundary. diff --git a/tests/generators/README.md b/tests/generators/README.md index 0dd1a87a65..0146ca35e8 100644 --- a/tests/generators/README.md +++ b/tests/generators/README.md @@ -14,6 +14,7 @@ An automated nightly tests release system, with a config filter applied, is bein + - [How to run generators](#how-to-run-generators) - [Cleaning](#cleaning) - [Running all test generators](#running-all-test-generators) diff --git a/tests/generators/bls/README.md b/tests/generators/bls/README.md index be19386372..24013f88e7 100644 --- a/tests/generators/bls/README.md +++ b/tests/generators/bls/README.md @@ -1,12 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [BLS Test Generator](#bls-test-generator) - - [Resources](#resources) - - - # BLS Test Generator The [BLS Signature APIs](../../../specs/phase0/beacon-chain.md#bls-signatures) diff --git a/tests/generators/epoch_processing/README.md b/tests/generators/epoch_processing/README.md index 4e7a8119c9..662b0b516d 100644 --- a/tests/generators/epoch_processing/README.md +++ b/tests/generators/epoch_processing/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Epoch processing](#epoch-processing) - - - # Epoch processing Epoch processing covers the sub-transitions during an epoch change. diff --git a/tests/generators/finality/README.md b/tests/generators/finality/README.md index 8686ffc445..dec5819c68 100644 --- a/tests/generators/finality/README.md +++ b/tests/generators/finality/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Finality tests](#finality-tests) - - - # Finality tests Finality tests cover regular state-transitions in a common block-list format to test finality rules. diff --git a/tests/generators/fork_choice/README.md b/tests/generators/fork_choice/README.md index 61f837d42d..e67b115ba1 100644 --- a/tests/generators/fork_choice/README.md +++ b/tests/generators/fork_choice/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Fork choice tests](#fork-choice-tests) - - - # Fork choice tests Fork choice tests cover the different forking cases with fork choice helper functions. diff --git a/tests/generators/genesis/README.md b/tests/generators/genesis/README.md index 3f218841ae..e270f6e35e 100644 --- a/tests/generators/genesis/README.md +++ b/tests/generators/genesis/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Genesis test generator](#genesis-test-generator) - - - # Genesis test generator Genesis tests cover the initialization and validity-based launch trigger for the Beacon Chain genesis state. diff --git a/tests/generators/kzg_4844/README.md b/tests/generators/kzg_4844/README.md index 61031ac1f4..ab81a85e86 100644 --- a/tests/generators/kzg_4844/README.md +++ b/tests/generators/kzg_4844/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [KZG 4844 Test Generator](#kzg-4844-test-generator) - - - # KZG 4844 Test Generator These tests are specific to the KZG API required for implementing EIP-4844 \ No newline at end of file diff --git a/tests/generators/light_client/README.md b/tests/generators/light_client/README.md index 2751c0874e..7eabc2520c 100644 --- a/tests/generators/light_client/README.md +++ b/tests/generators/light_client/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Light client tests](#light-client-tests) - - - # Light client tests The purpose of this test-generator is to provide test-vectors for validating the correct implementation of the light client sync protocol. diff --git a/tests/generators/merkle_proof/README.md b/tests/generators/merkle_proof/README.md index b5ee6c8b6c..fb4d05fda8 100644 --- a/tests/generators/merkle_proof/README.md +++ b/tests/generators/merkle_proof/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Merkle proof tests](#merkle-proof-tests) - - - # Merkle proof tests The purpose of this test-generator is to provide test-vectors for validating the correct implementation of the Merkle proof verification. diff --git a/tests/generators/operations/README.md b/tests/generators/operations/README.md index 2eac9c9f9e..a5d48c11b4 100644 --- a/tests/generators/operations/README.md +++ b/tests/generators/operations/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Operations](#operations) - - - # Operations Operations (or "transactions" in previous spec iterations), diff --git a/tests/generators/random/README.md b/tests/generators/random/README.md index 4c49226f8e..fd17284412 100644 --- a/tests/generators/random/README.md +++ b/tests/generators/random/README.md @@ -1,14 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Randomized tests](#randomized-tests) -- [To generate test sources](#to-generate-test-sources) -- [To run tests](#to-run-tests) -- [To generate spec tests (from the generated files)](#to-generate-spec-tests-from-the-generated-files) - - - # Randomized tests Randomized tests in the format of `sanity` blocks tests, with randomized operations. diff --git a/tests/generators/rewards/README.md b/tests/generators/rewards/README.md index 4233958924..60f106836a 100644 --- a/tests/generators/rewards/README.md +++ b/tests/generators/rewards/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Rewards](#rewards) - - - # Rewards Rewards covers the sub-functions of `process_rewards_and_penalties` for granular testing of components of the rewards function. diff --git a/tests/generators/sanity/README.md b/tests/generators/sanity/README.md index 31c59f84d3..cbc6aef06d 100644 --- a/tests/generators/sanity/README.md +++ b/tests/generators/sanity/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Sanity tests](#sanity-tests) - - - # Sanity tests Sanity tests cover regular state-transitions in a common block-list format, to ensure the basics work. diff --git a/tests/generators/shuffling/README.md b/tests/generators/shuffling/README.md index 0294c1ec6f..81ddaba15f 100644 --- a/tests/generators/shuffling/README.md +++ b/tests/generators/shuffling/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Shuffling Tests](#shuffling-tests) - - - # Shuffling Tests Tests for the swap-or-not shuffling in the beacon chain. diff --git a/tests/generators/ssz_static/README.md b/tests/generators/ssz_static/README.md index b557b726ad..3434fe174b 100644 --- a/tests/generators/ssz_static/README.md +++ b/tests/generators/ssz_static/README.md @@ -1,11 +1,3 @@ - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [SSZ-static](#ssz-static) - - - # SSZ-static The purpose of this test-generator is to provide test-vectors for the most important applications of SSZ: From f0ef76ada1885ab0023ba4c4bfed9462bd8cd79e Mon Sep 17 00:00:00 2001 From: fradamt Date: Tue, 21 May 2024 23:03:34 +0200 Subject: [PATCH 14/19] minor fixes --- specs/electra/beacon-chain.md | 4 +- ..._execution_layer_consolidation_request.py} | 42 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) rename tests/core/pyspec/eth2spec/test/electra/block_processing/{test_process_execution_layer_consolidation.py => test_process_execution_layer_consolidation_request.py} (96%) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 9cfff26e9a..9b1b88f33d 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -1286,10 +1286,10 @@ def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) ##### Execution layer consolidation requests -###### New `process_execution_layer_consolidation_requests` +###### New `process_execution_layer_consolidation_request` ```python -def process_execution_layer_consolidation_requests( +def process_execution_layer_consolidation_request( state: BeaconState, execution_layer_consolidation_request: ExecutionLayerConsolidationRequest) -> None: # If the pending consolidations queue is full, consolidation requests are ignored diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py similarity index 96% rename from tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py rename to tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py index 54e88fef4f..ce31da6acd 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py @@ -40,7 +40,7 @@ def test_basic_consolidation_in_current_consolidation_epoch(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -89,7 +89,7 @@ def test_basic_consolidation_in_new_consolidation_epoch(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -132,7 +132,7 @@ def test_basic_consolidation_with_preexisting_churn(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -179,7 +179,7 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -230,7 +230,7 @@ def test_basic_consolidation_with_compounding_credentials(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -276,7 +276,7 @@ def test_consolidation_churn_limit_balance(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -324,7 +324,7 @@ def test_consolidation_balance_larger_than_churn_limit(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -371,7 +371,7 @@ def test_consolidation_balance_through_two_churn_epochs(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -417,7 +417,7 @@ def test_invalid_source_equals_target(spec, state): spec, state, source_index, address=source_address ) # Make consolidation from source to source - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[source_index].pubkey, @@ -449,7 +449,7 @@ def test_invalid_exceed_pending_consolidations_limit(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -478,7 +478,7 @@ def test_invalid_not_enough_consolidation_churn_available(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -506,7 +506,7 @@ def test_invalid_exited_source(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -538,7 +538,7 @@ def test_invalid_exited_target(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -568,7 +568,7 @@ def test_invalid_inactive_source(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -600,7 +600,7 @@ def test_invalid_inactive_target(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -629,7 +629,7 @@ def test_invalid_no_source_execution_withdrawal_credential(spec, state): source_index = spec.get_active_validator_indices(state, current_epoch)[0] target_index = spec.get_active_validator_indices(state, current_epoch)[1] source_address = b"\x22" * 20 - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -657,7 +657,7 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): set_eth1_withdrawal_credential_with_balance( spec, state, source_index, address=source_address ) - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -684,7 +684,7 @@ def test_invalid_incorrect_source_address(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different source address - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=b"\x33" * 20, source_pubkey=state.validators[source_index].pubkey, target_pubkey=state.validators[target_index].pubkey, @@ -715,7 +715,7 @@ def test_invalid_unknown_source_pubkey(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different source pubkey - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=source_address, source_pubkey=b"\x00" * 48, target_pubkey=state.validators[target_index].pubkey, @@ -745,7 +745,7 @@ def test_invalid_unknown_target_pubkey(spec, state): spec, state, source_index, address=source_address ) # Make consolidation with different target pubkey - consolidation = spec.ExecutionLayerConsolidation( + consolidation = spec.ExecutionLayerConsolidationRequest( source_address=b"\x33" * 20, source_pubkey=state.validators[source_index].pubkey, target_pubkey=b"\x00" * 48, @@ -783,7 +783,7 @@ def run_consolidation_processing(spec, state, consolidation, success=True): yield 'pre', state yield 'consolidation', consolidation - spec.process_execution_layer_consolidation(state, consolidation) + spec.process_execution_layer_consolidation_request(state, consolidation) yield 'post', state From 1970b56f8fe0ab5dbc9de6e9bf26646d94c0ad98 Mon Sep 17 00:00:00 2001 From: fradamt Date: Wed, 22 May 2024 09:37:16 +0200 Subject: [PATCH 15/19] add consolidation_requests_root to get_execution_payload_header test helper --- .../core/pyspec/eth2spec/test/helpers/execution_payload.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py b/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py index ef6e2f6442..78bd28e35a 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py +++ b/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py @@ -37,6 +37,7 @@ def get_execution_payload_header(spec, execution_payload): if is_post_electra(spec): payload_header.deposit_receipts_root = spec.hash_tree_root(execution_payload.deposit_receipts) payload_header.withdrawal_requests_root = spec.hash_tree_root(execution_payload.withdrawal_requests) + payload_header.consolidation_requests_root = spec.hash_tree_root(execution_payload.consolidation_requests) return payload_header @@ -59,7 +60,8 @@ def compute_el_header_block_hash(spec, transactions_trie_root, withdrawals_trie_root=None, deposit_receipts_trie_root=None, - withdrawal_requests_root=None): + withdrawal_requests_root=None, + consolidation_requests_root=None): """ Computes the RLP execution block hash described by an `ExecutionPayloadHeader`. """ @@ -110,6 +112,8 @@ def compute_el_header_block_hash(spec, execution_payload_header_rlp.append((Binary(32, 32), deposit_receipts_trie_root)) # withdrawal requests root execution_payload_header_rlp.append((Binary(32, 32), withdrawal_requests_root)) + # consolidation requests root + execution_payload_header_rlp.append((Binary(32, 32), consolidation_requests_root)) sedes = List([schema for schema, _ in execution_payload_header_rlp]) values = [value for _, value in execution_payload_header_rlp] From 6a731e9115760fb3894e31eb754e8605c9a87745 Mon Sep 17 00:00:00 2001 From: fradamt Date: Wed, 22 May 2024 10:03:03 +0200 Subject: [PATCH 16/19] fix lint --- specs/electra/beacon-chain.md | 11 +++++++---- ...rocess_execution_layer_consolidation_request.py | 14 +++++--------- .../eth2spec/test/helpers/execution_payload.py | 2 -- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 9b1b88f33d..101be40f60 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -337,7 +337,8 @@ class ExecutionPayload(Container): deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in Electra:EIP6110] # [New in Electra:EIP7002:EIP7251] withdrawal_requests: List[ExecutionLayerWithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD] - consolidation_requests: List[ExecutionLayerConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP7251] + # [New in Electra:EIP7251] + consolidation_requests: List[ExecutionLayerConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] ``` #### `ExecutionPayloadHeader` @@ -365,7 +366,7 @@ class ExecutionPayloadHeader(Container): excess_blob_gas: uint64 deposit_receipts_root: Root # [New in Electra:EIP6110] withdrawal_requests_root: Root # [New in Electra:EIP7002:EIP7251] - consolidation_requests_root: Root # [New in Electra:EIP7251] + consolidation_requests_root: Root # [New in Electra:EIP7251] ``` #### `BeaconState` @@ -1037,7 +1038,8 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None: # [New in Electra:EIP7002:EIP7251] for_ops(body.execution_payload.withdrawal_requests, process_execution_layer_withdrawal_request) for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt) # [New in Electra:EIP6110] - for_ops(body.execution_payload.consolidation_requests, process_execution_layer_consolidation_request) # [New in Electra:EIP7251] + # [New in Electra:EIP7251] + for_ops(body.execution_payload.consolidation_requests, process_execution_layer_consolidation_request) ``` ##### Attestations @@ -1291,7 +1293,8 @@ def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) ```python def process_execution_layer_consolidation_request( state: BeaconState, - execution_layer_consolidation_request: ExecutionLayerConsolidationRequest) -> None: + execution_layer_consolidation_request: ExecutionLayerConsolidationRequest +) -> None: # If the pending consolidations queue is full, consolidation requests are ignored if len(state.pending_consolidations) == PENDING_CONSOLIDATIONS_LIMIT: return diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py index ce31da6acd..95386f4282 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py @@ -9,7 +9,6 @@ default_activation_threshold, spec_state_test, ) -from eth2spec.test.helpers.keys import pubkey_to_privkey from eth2spec.test.helpers.withdrawals import ( set_eth1_withdrawal_credential_with_balance, set_compounding_withdrawal_credential, @@ -255,7 +254,6 @@ def test_basic_consolidation_with_compounding_credentials(spec, state): assert state.validators[source_index].exit_epoch == expected_exit_epoch - @with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( @@ -623,7 +621,7 @@ def test_invalid_inactive_target(spec, state): @spec_test @single_phase def test_invalid_no_source_execution_withdrawal_credential(spec, state): - # Set up a correct consolidation, but source does not have + # Set up a correct consolidation, but source does not have # an execution withdrawal credential current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -639,6 +637,7 @@ def test_invalid_no_source_execution_withdrawal_credential(spec, state): spec, state, consolidation, success=False ) + @with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( @@ -648,7 +647,7 @@ def test_invalid_no_source_execution_withdrawal_credential(spec, state): @spec_test @single_phase def test_invalid_no_target_execution_withdrawal_credential(spec, state): - # Set up a correct consolidation, but target does not have + # Set up a correct consolidation, but target does not have # an execution withdrawal credential current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -666,6 +665,7 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): spec, state, consolidation, success=False ) + @with_electra_and_later @with_presets([MINIMAL], "need sufficient consolidation churn limit") @with_custom_state( @@ -691,7 +691,6 @@ def test_invalid_incorrect_source_address(spec, state): ) set_eth1_withdrawal_credential_with_balance(spec, state, target_index) - yield from run_consolidation_processing( spec, state, consolidation, success=False ) @@ -757,7 +756,6 @@ def test_invalid_unknown_target_pubkey(spec, state): ) - def run_consolidation_processing(spec, state, consolidation, success=True): """ Run ``process_consolidation``, yielding: @@ -779,7 +777,6 @@ def run_consolidation_processing(spec, state, consolidation, success=True): else: pre_state = state.copy() - yield 'pre', state yield 'consolidation', consolidation @@ -802,7 +799,7 @@ def run_consolidation_processing(spec, state, consolidation, success=True): assert state.validators[source_index].exit_epoch < spec.FAR_FUTURE_EPOCH # Check that the exit epoch matches earliest_consolidation_epoch assert state.validators[source_index].exit_epoch == state.earliest_consolidation_epoch - # Check that the correct consolidation has been appended + # Check that the correct consolidation has been appended expected_new_pending_consolidation = spec.PendingConsolidation( source_index=source_index, target_index=target_index, @@ -810,4 +807,3 @@ def run_consolidation_processing(spec, state, consolidation, success=True): assert state.pending_consolidations == pre_pending_consolidations + [expected_new_pending_consolidation] else: assert pre_state == state - diff --git a/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py b/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py index 78bd28e35a..08c430b621 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py +++ b/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py @@ -112,8 +112,6 @@ def compute_el_header_block_hash(spec, execution_payload_header_rlp.append((Binary(32, 32), deposit_receipts_trie_root)) # withdrawal requests root execution_payload_header_rlp.append((Binary(32, 32), withdrawal_requests_root)) - # consolidation requests root - execution_payload_header_rlp.append((Binary(32, 32), consolidation_requests_root)) sedes = List([schema for schema, _ in execution_payload_header_rlp]) values = [value for _, value in execution_payload_header_rlp] From 96db63ea29505e763feb40b8289e716c6c522978 Mon Sep 17 00:00:00 2001 From: fradamt Date: Wed, 22 May 2024 10:11:39 +0200 Subject: [PATCH 17/19] doctoc --- specs/electra/beacon-chain.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 101be40f60..414cc90a52 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -28,8 +28,7 @@ - [`PendingBalanceDeposit`](#pendingbalancedeposit) - [`PendingPartialWithdrawal`](#pendingpartialwithdrawal) - [`ExecutionLayerWithdrawalRequest`](#executionlayerwithdrawalrequest) - - [`Consolidation`](#consolidation) - - [`SignedConsolidation`](#signedconsolidation) + - [`ExecutionLayerConsolidationRequest`](#executionlayerconsolidationrequest) - [`PendingConsolidation`](#pendingconsolidation) - [Modified Containers](#modified-containers) - [`AttesterSlashing`](#attesterslashing) @@ -94,8 +93,8 @@ - [New `process_execution_layer_withdrawal_request`](#new-process_execution_layer_withdrawal_request) - [Deposit receipts](#deposit-receipts) - [New `process_deposit_receipt`](#new-process_deposit_receipt) - - [Consolidations](#consolidations) - - [New `process_consolidation`](#new-process_consolidation) + - [Execution layer consolidation requests](#execution-layer-consolidation-requests) + - [New `process_execution_layer_consolidation_request`](#new-process_execution_layer_consolidation_request) - [Testing](#testing) From ffebf88de533a8ee0b5274cb7b7825a642d8f550 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 31 May 2024 19:50:59 +0800 Subject: [PATCH 18/19] Fix testgen and test format --- ...s_execution_layer_consolidation_request.py | 28 +++++++++---------- tests/formats/operations/README.md | 3 +- tests/generators/operations/main.py | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py index 95386f4282..5e3f7877cf 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py @@ -405,7 +405,7 @@ def test_consolidation_balance_through_two_churn_epochs(spec, state): ) @spec_test @single_phase -def test_invalid_source_equals_target(spec, state): +def test_incorrect_source_equals_target(spec, state): current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -434,7 +434,7 @@ def test_invalid_source_equals_target(spec, state): ) @spec_test @single_phase -def test_invalid_exceed_pending_consolidations_limit(spec, state): +def test_incorrect_exceed_pending_consolidations_limit(spec, state): state.pending_consolidations = [ spec.PendingConsolidation(source_index=0, target_index=1) ] * spec.PENDING_CONSOLIDATIONS_LIMIT @@ -462,7 +462,7 @@ def test_invalid_exceed_pending_consolidations_limit(spec, state): @with_electra_and_later @spec_state_test @single_phase -def test_invalid_not_enough_consolidation_churn_available(spec, state): +def test_incorrect_not_enough_consolidation_churn_available(spec, state): state.validators = state.validators[0:2] state.pending_consolidations = [ spec.PendingConsolidation(source_index=0, target_index=1) @@ -495,7 +495,7 @@ def test_invalid_not_enough_consolidation_churn_available(spec, state): ) @spec_test @single_phase -def test_invalid_exited_source(spec, state): +def test_incorrect_exited_source(spec, state): # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -527,7 +527,7 @@ def test_invalid_exited_source(spec, state): ) @spec_test @single_phase -def test_invalid_exited_target(spec, state): +def test_incorrect_exited_target(spec, state): # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -557,7 +557,7 @@ def test_invalid_exited_target(spec, state): ) @spec_test @single_phase -def test_invalid_inactive_source(spec, state): +def test_incorrect_inactive_source(spec, state): # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -589,7 +589,7 @@ def test_invalid_inactive_source(spec, state): ) @spec_test @single_phase -def test_invalid_inactive_target(spec, state): +def test_incorrect_inactive_target(spec, state): # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -620,7 +620,7 @@ def test_invalid_inactive_target(spec, state): ) @spec_test @single_phase -def test_invalid_no_source_execution_withdrawal_credential(spec, state): +def test_incorrect_no_source_execution_withdrawal_credential(spec, state): # Set up a correct consolidation, but source does not have # an execution withdrawal credential current_epoch = spec.get_current_epoch(state) @@ -646,7 +646,7 @@ def test_invalid_no_source_execution_withdrawal_credential(spec, state): ) @spec_test @single_phase -def test_invalid_no_target_execution_withdrawal_credential(spec, state): +def test_incorrect_no_target_execution_withdrawal_credential(spec, state): # Set up a correct consolidation, but target does not have # an execution withdrawal credential current_epoch = spec.get_current_epoch(state) @@ -674,7 +674,7 @@ def test_invalid_no_target_execution_withdrawal_credential(spec, state): ) @spec_test @single_phase -def test_invalid_incorrect_source_address(spec, state): +def test_incorrect_incorrect_source_address(spec, state): # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -704,7 +704,7 @@ def test_invalid_incorrect_source_address(spec, state): ) @spec_test @single_phase -def test_invalid_unknown_source_pubkey(spec, state): +def test_incorrect_unknown_source_pubkey(spec, state): # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -734,7 +734,7 @@ def test_invalid_unknown_source_pubkey(spec, state): ) @spec_test @single_phase -def test_invalid_unknown_target_pubkey(spec, state): +def test_incorrect_unknown_target_pubkey(spec, state): # Set up an otherwise correct consolidation current_epoch = spec.get_current_epoch(state) source_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -760,7 +760,7 @@ def run_consolidation_processing(spec, state, consolidation, success=True): """ Run ``process_consolidation``, yielding: - pre-state ('pre') - - consolidation ('consolidation') + - execution_layer_consolidation_request ('execution_layer_consolidation_request') - post-state ('post'). If ``valid == False``, run expecting ``AssertionError`` """ @@ -778,7 +778,7 @@ def run_consolidation_processing(spec, state, consolidation, success=True): pre_state = state.copy() yield 'pre', state - yield 'consolidation', consolidation + yield 'execution_layer_consolidation_request', consolidation spec.process_execution_layer_consolidation_request(state, consolidation) diff --git a/tests/formats/operations/README.md b/tests/formats/operations/README.md index b020b5fd03..d69a704866 100644 --- a/tests/formats/operations/README.md +++ b/tests/formats/operations/README.md @@ -46,7 +46,8 @@ Operations: | `withdrawals` | `ExecutionPayload` | `execution_payload` | `process_withdrawals(state, execution_payload)` (new in Capella) | | `bls_to_execution_change` | `SignedBLSToExecutionChange` | `address_change` | `process_bls_to_execution_change(state, address_change)` (new in Capella) | | `deposit_receipt` | `DepositReceipt` | `deposit_receipt` | `process_deposit_receipt(state, deposit_receipt)` (new in Electra) | -| `exits` | `ExecutionLayerExit` | `execution_layer_exit` | `process_execution_layer_exit(state, execution_layer_exit)` (new in Electra) | +| `execution_layer_withdrawal_request` | `ExecutionLayerWithdrawalRequest` | `execution_layer_withdrawal_request` | `process_execution_layer_withdrawal_request(state, execution_layer_withdrawal_request)` (new in Electra) | +| `execution_layer_consolidation_request` | `ExecutionLayerConsolidationRequest` | `execution_layer_consolidation_request` | `process_execution_layer_consolidation_request(state, execution_layer_consolidation_request)` (new in Electra) | Note that `block_header` is not strictly an operation (and is a full `Block`), but processed in the same manner, and hence included here. diff --git a/tests/generators/operations/main.py b/tests/generators/operations/main.py index 85a5b64e3c..d4ca895570 100644 --- a/tests/generators/operations/main.py +++ b/tests/generators/operations/main.py @@ -45,7 +45,7 @@ _new_electra_mods = {key: 'eth2spec.test.electra.block_processing.test_process_' + key for key in [ 'attestation', - 'execution_layer_consolidation_requests', + 'execution_layer_consolidation_request', 'deposit_receipt', 'execution_layer_withdrawal_request', 'voluntary_exit' From 143b9e623dce1f134b33ec70c892ac2f8eae87c8 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 4 Jun 2024 01:40:41 +0800 Subject: [PATCH 19/19] Switch the order of `process_deposit_receipt` and `process_execution_layer_withdrawal_request` --- specs/electra/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 414cc90a52..3220fea1bf 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -1034,9 +1034,9 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None: for_ops(body.deposits, process_deposit) # [Modified in Electra:EIP7251] for_ops(body.voluntary_exits, process_voluntary_exit) # [Modified in Electra:EIP7251] for_ops(body.bls_to_execution_changes, process_bls_to_execution_change) + for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt) # [New in Electra:EIP6110] # [New in Electra:EIP7002:EIP7251] for_ops(body.execution_payload.withdrawal_requests, process_execution_layer_withdrawal_request) - for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt) # [New in Electra:EIP6110] # [New in Electra:EIP7251] for_ops(body.execution_payload.consolidation_requests, process_execution_layer_consolidation_request) ```