From 98dd1884aea37fae2fc7e3e5462a4abde34c7ced Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Fri, 16 Aug 2024 18:34:22 +1200 Subject: [PATCH] Rename requests to execution_requests --- specs/electra/beacon-chain.md | 8 ++++---- .../eth2spec/test/electra/sanity/blocks/test_blocks.py | 8 ++++---- .../electra/sanity/blocks/test_deposit_transition.py | 10 +++++----- tests/core/pyspec/eth2spec/test/helpers/block.py | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index 1f5246814..92be2ce25 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -296,7 +296,7 @@ class BeaconBlockBody(Container): execution_payload: ExecutionPayload bls_to_execution_changes: List[SignedBLSToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES] blob_kzg_commitments: List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK] - requests: ExecutionLayerRequests # [New in Electra] + execution_requests: ExecutionLayerRequests # [New in Electra] ``` ### Extended Containers @@ -1026,9 +1026,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.requests.deposits, process_deposit_request) # [New in Electra:EIP6110] - for_ops(body.requests.withdrawals, process_withdrawal_request) # [New in Electra:EIP7002:EIP7251] - for_ops(body.requests.consolidations, process_consolidation_request) # [New in Electra:EIP7251] + for_ops(body.execution_requests.deposits, process_deposit_request) # [New in Electra:EIP6110] + for_ops(body.execution_requests.withdrawals, process_withdrawal_request) # [New in Electra:EIP7002:EIP7251] + for_ops(body.execution_requests.consolidations, process_consolidation_request) # [New in Electra:EIP7251] ``` ##### Attestations diff --git a/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py b/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py index 8371e71f6..0bb8f32d4 100644 --- a/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py @@ -41,7 +41,7 @@ def test_basic_el_withdrawal_request(spec, state): validator_pubkey=validator_pubkey, ) block = build_empty_block_for_next_slot(spec, state) - block.body.requests.withdrawals = [withdrawal_request] + block.body.execution_requests.withdrawals = [withdrawal_request] block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload, state) signed_block = state_transition_and_sign_block(spec, state, block) @@ -77,7 +77,7 @@ def test_basic_btec_and_el_withdrawal_request_in_same_block(spec, state): source_address=address, validator_pubkey=validator_pubkey, ) - block.body.requests.withdrawals = [withdrawal_request] + block.body.execution_requests.withdrawals = [withdrawal_request] block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload, state) signed_block = state_transition_and_sign_block(spec, state, block) @@ -130,7 +130,7 @@ def test_basic_btec_before_el_withdrawal_request(spec, state): validator_pubkey=validator_pubkey, ) block_2 = build_empty_block_for_next_slot(spec, state) - block_2.body.requests.withdrawals = [withdrawal_request] + block_2.body.execution_requests.withdrawals = [withdrawal_request] block_2.body.execution_payload.block_hash = compute_el_block_hash(spec, block_2.body.execution_payload, state) signed_block_2 = state_transition_and_sign_block(spec, state, block_2) @@ -163,7 +163,7 @@ def test_cl_exit_and_el_withdrawal_request_in_same_block(spec, state): ) block = build_empty_block_for_next_slot(spec, state) block.body.voluntary_exits = signed_voluntary_exits - block.body.requests.withdrawals = [withdrawal_request] + block.body.execution_requests.withdrawals = [withdrawal_request] block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload, state) signed_block = state_transition_and_sign_block(spec, state, block) diff --git a/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_deposit_transition.py b/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_deposit_transition.py index 98fc707d4..e846543f2 100644 --- a/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_deposit_transition.py +++ b/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_deposit_transition.py @@ -38,7 +38,7 @@ def run_deposit_transition_block(spec, state, block, top_up_keys=[], valid=True) # Check that deposits are applied if valid: expected_pubkeys = [d.data.pubkey for d in block.body.deposits] - deposit_requests = block.body.requests.deposits + deposit_requests = block.body.execution_requests.deposits expected_pubkeys = expected_pubkeys + [d.pubkey for d in deposit_requests if (d.pubkey not in top_up_keys)] actual_pubkeys = [v.pubkey for v in state.validators[len(state.validators) - len(expected_pubkeys):]] @@ -102,7 +102,7 @@ def prepare_state_and_block(spec, # Assign deposits and deposit requests block.body.deposits = deposits - block.body.requests.deposits = deposit_requests + block.body.execution_requests.deposits = deposit_requests block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload, state) return state, block @@ -120,7 +120,7 @@ def test_deposit_transition__start_index_is_set(spec, state): yield from run_deposit_transition_block(spec, state, block) # deposit_requests_start_index must be set to the index of the first request - assert state.deposit_requests_start_index == block.body.requests.deposits[0].index + assert state.deposit_requests_start_index == block.body.execution_requests.deposits[0].index @with_phases([ELECTRA]) @@ -219,7 +219,7 @@ def test_deposit_transition__deposit_and_top_up_same_block(spec, state): # Artificially assign deposit's pubkey to a deposit request of the same block top_up_keys = [block.body.deposits[0].data.pubkey] - block.body.requests.deposits[0].pubkey = top_up_keys[0] + block.body.execution_requests.deposits[0].pubkey = top_up_keys[0] block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload, state) pre_pending_deposits = len(state.pending_balance_deposits) @@ -229,5 +229,5 @@ def test_deposit_transition__deposit_and_top_up_same_block(spec, state): # Check the top up assert len(state.pending_balance_deposits) == pre_pending_deposits + 2 assert state.pending_balance_deposits[pre_pending_deposits].amount == block.body.deposits[0].data.amount - amount_from_deposit = block.body.requests.deposits[0].amount + amount_from_deposit = block.body.execution_requests.deposits[0].amount assert state.pending_balance_deposits[pre_pending_deposits + 1].amount == amount_from_deposit diff --git a/tests/core/pyspec/eth2spec/test/helpers/block.py b/tests/core/pyspec/eth2spec/test/helpers/block.py index c62d70005..f862488c1 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/block.py +++ b/tests/core/pyspec/eth2spec/test/helpers/block.py @@ -128,9 +128,9 @@ def build_empty_block(spec, state, slot=None, proposer_index=None): empty_block.body.execution_payload = build_empty_execution_payload(spec, state) if is_post_electra(spec): - empty_block.body.requests.deposits = [] - empty_block.body.requests.withdrawals = [] - empty_block.body.requests.consolidations = [] + empty_block.body.execution_requests.deposits = [] + empty_block.body.execution_requests.withdrawals = [] + empty_block.body.execution_requests.consolidations = [] if is_post_whisk(spec): # Whisk opening proof