Skip to content

Commit 5910aee

Browse files
Rename ExecutionLayerConsolidationRequest->ConsolidationRequest
1 parent 2e6c593 commit 5910aee

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

specs/electra/beacon-chain.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- [`PendingBalanceDeposit`](#pendingbalancedeposit)
2929
- [`PendingPartialWithdrawal`](#pendingpartialwithdrawal)
3030
- [`WithdrawalRequest`](#executionlayerwithdrawalrequest)
31-
- [`ExecutionLayerConsolidationRequest`](#executionlayerconsolidationrequest)
31+
- [`ConsolidationRequest`](#executionlayerconsolidationrequest)
3232
- [`PendingConsolidation`](#pendingconsolidation)
3333
- [Modified Containers](#modified-containers)
3434
- [`AttesterSlashing`](#attesterslashing)
@@ -95,7 +95,7 @@
9595
- [Deposit requests](#deposit-requests)
9696
- [New `process_deposit_request`](#new-process_deposit_request)
9797
- [Execution layer consolidation requests](#execution-layer-consolidation-requests)
98-
- [New `process_execution_layer_consolidation_request`](#new-process_execution_layer_consolidation_request)
98+
- [New `process_consolidation_request`](#new-process_consolidation_request)
9999
- [Testing](#testing)
100100

101101
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -238,12 +238,12 @@ class WithdrawalRequest(Container):
238238
amount: Gwei
239239
```
240240

241-
#### `ExecutionLayerConsolidationRequest`
241+
#### `ConsolidationRequest`
242242

243243
*Note*: The container is new in EIP7251.
244244

245245
```python
246-
class ExecutionLayerConsolidationRequest(Container):
246+
class ConsolidationRequest(Container):
247247
source_address: ExecutionAddress
248248
source_pubkey: BLSPubkey
249249
target_pubkey: BLSPubkey
@@ -338,7 +338,7 @@ class ExecutionPayload(Container):
338338
# [New in Electra:EIP7002:EIP7251]
339339
withdrawal_requests: List[WithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD]
340340
# [New in Electra:EIP7251]
341-
consolidation_requests: List[ExecutionLayerConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD]
341+
consolidation_requests: List[ConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD]
342342
```
343343

344344
#### `ExecutionPayloadHeader`
@@ -1077,7 +1077,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
10771077
# [New in Electra:EIP7002:EIP7251]
10781078
for_ops(body.execution_payload.withdrawal_requests, process_withdrawal_request)
10791079
# [New in Electra:EIP7251]
1080-
for_ops(body.execution_payload.consolidation_requests, process_execution_layer_consolidation_request)
1080+
for_ops(body.execution_payload.consolidation_requests, process_consolidation_request)
10811081
```
10821082

10831083
##### Attestations
@@ -1326,12 +1326,12 @@ def process_deposit_request(state: BeaconState, deposit_request: DepositRequest)
13261326

13271327
##### Execution layer consolidation requests
13281328

1329-
###### New `process_execution_layer_consolidation_request`
1329+
###### New `process_consolidation_request`
13301330

13311331
```python
1332-
def process_execution_layer_consolidation_request(
1332+
def process_consolidation_request(
13331333
state: BeaconState,
1334-
execution_layer_consolidation_request: ExecutionLayerConsolidationRequest
1334+
consolidation_request: ConsolidationRequest
13351335
) -> None:
13361336
# If the pending consolidations queue is full, consolidation requests are ignored
13371337
if len(state.pending_consolidations) == PENDING_CONSOLIDATIONS_LIMIT:
@@ -1342,8 +1342,8 @@ def process_execution_layer_consolidation_request(
13421342

13431343
validator_pubkeys = [v.pubkey for v in state.validators]
13441344
# Verify pubkeys exists
1345-
request_source_pubkey = execution_layer_consolidation_request.source_pubkey
1346-
request_target_pubkey = execution_layer_consolidation_request.target_pubkey
1345+
request_source_pubkey = consolidation_request.source_pubkey
1346+
request_target_pubkey = consolidation_request.target_pubkey
13471347
if request_source_pubkey not in validator_pubkeys:
13481348
return
13491349
if request_target_pubkey not in validator_pubkeys:
@@ -1360,7 +1360,7 @@ def process_execution_layer_consolidation_request(
13601360
# Verify source withdrawal credentials
13611361
has_correct_credential = has_execution_withdrawal_credential(source_validator)
13621362
is_correct_source_address = (
1363-
source_validator.withdrawal_credentials[12:] == execution_layer_consolidation_request.source_address
1363+
source_validator.withdrawal_credentials[12:] == consolidation_request.source_address
13641364
)
13651365
if not (has_correct_credential and is_correct_source_address):
13661366
return

tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_execution_layer_consolidation_request.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_basic_consolidation_in_current_consolidation_epoch(spec, state):
3939
spec, state, source_index, address=source_address
4040
)
4141
# Make consolidation with source address
42-
consolidation = spec.ExecutionLayerConsolidationRequest(
42+
consolidation = spec.ConsolidationRequest(
4343
source_address=source_address,
4444
source_pubkey=state.validators[source_index].pubkey,
4545
target_pubkey=state.validators[target_index].pubkey,
@@ -88,7 +88,7 @@ def test_basic_consolidation_in_new_consolidation_epoch(spec, state):
8888
spec, state, source_index, address=source_address
8989
)
9090
# Make consolidation with source address
91-
consolidation = spec.ExecutionLayerConsolidationRequest(
91+
consolidation = spec.ConsolidationRequest(
9292
source_address=source_address,
9393
source_pubkey=state.validators[source_index].pubkey,
9494
target_pubkey=state.validators[target_index].pubkey,
@@ -131,7 +131,7 @@ def test_basic_consolidation_with_preexisting_churn(spec, state):
131131
spec, state, source_index, address=source_address
132132
)
133133
# Make consolidation with source address
134-
consolidation = spec.ExecutionLayerConsolidationRequest(
134+
consolidation = spec.ConsolidationRequest(
135135
source_address=source_address,
136136
source_pubkey=state.validators[source_index].pubkey,
137137
target_pubkey=state.validators[target_index].pubkey,
@@ -178,7 +178,7 @@ def test_basic_consolidation_with_insufficient_preexisting_churn(spec, state):
178178
spec, state, source_index, address=source_address
179179
)
180180
# Make consolidation with source address
181-
consolidation = spec.ExecutionLayerConsolidationRequest(
181+
consolidation = spec.ConsolidationRequest(
182182
source_address=source_address,
183183
source_pubkey=state.validators[source_index].pubkey,
184184
target_pubkey=state.validators[target_index].pubkey,
@@ -229,7 +229,7 @@ def test_basic_consolidation_with_compounding_credentials(spec, state):
229229
spec, state, source_index, address=source_address
230230
)
231231
# Make consolidation with source address
232-
consolidation = spec.ExecutionLayerConsolidationRequest(
232+
consolidation = spec.ConsolidationRequest(
233233
source_address=source_address,
234234
source_pubkey=state.validators[source_index].pubkey,
235235
target_pubkey=state.validators[target_index].pubkey,
@@ -274,7 +274,7 @@ def test_consolidation_churn_limit_balance(spec, state):
274274
spec, state, source_index, address=source_address
275275
)
276276
# Make consolidation with source address
277-
consolidation = spec.ExecutionLayerConsolidationRequest(
277+
consolidation = spec.ConsolidationRequest(
278278
source_address=source_address,
279279
source_pubkey=state.validators[source_index].pubkey,
280280
target_pubkey=state.validators[target_index].pubkey,
@@ -322,7 +322,7 @@ def test_consolidation_balance_larger_than_churn_limit(spec, state):
322322
spec, state, source_index, address=source_address
323323
)
324324
# Make consolidation with source address
325-
consolidation = spec.ExecutionLayerConsolidationRequest(
325+
consolidation = spec.ConsolidationRequest(
326326
source_address=source_address,
327327
source_pubkey=state.validators[source_index].pubkey,
328328
target_pubkey=state.validators[target_index].pubkey,
@@ -369,7 +369,7 @@ def test_consolidation_balance_through_two_churn_epochs(spec, state):
369369
spec, state, source_index, address=source_address
370370
)
371371
# Make consolidation with source address
372-
consolidation = spec.ExecutionLayerConsolidationRequest(
372+
consolidation = spec.ConsolidationRequest(
373373
source_address=source_address,
374374
source_pubkey=state.validators[source_index].pubkey,
375375
target_pubkey=state.validators[target_index].pubkey,
@@ -415,7 +415,7 @@ def test_incorrect_source_equals_target(spec, state):
415415
spec, state, source_index, address=source_address
416416
)
417417
# Make consolidation from source to source
418-
consolidation = spec.ExecutionLayerConsolidationRequest(
418+
consolidation = spec.ConsolidationRequest(
419419
source_address=source_address,
420420
source_pubkey=state.validators[source_index].pubkey,
421421
target_pubkey=state.validators[source_index].pubkey,
@@ -447,7 +447,7 @@ def test_incorrect_exceed_pending_consolidations_limit(spec, state):
447447
set_eth1_withdrawal_credential_with_balance(
448448
spec, state, source_index, address=source_address
449449
)
450-
consolidation = spec.ExecutionLayerConsolidationRequest(
450+
consolidation = spec.ConsolidationRequest(
451451
source_address=source_address,
452452
source_pubkey=state.validators[source_index].pubkey,
453453
target_pubkey=state.validators[target_index].pubkey,
@@ -476,7 +476,7 @@ def test_incorrect_not_enough_consolidation_churn_available(spec, state):
476476
set_eth1_withdrawal_credential_with_balance(
477477
spec, state, source_index, address=source_address
478478
)
479-
consolidation = spec.ExecutionLayerConsolidationRequest(
479+
consolidation = spec.ConsolidationRequest(
480480
source_address=source_address,
481481
source_pubkey=state.validators[source_index].pubkey,
482482
target_pubkey=state.validators[target_index].pubkey,
@@ -504,7 +504,7 @@ def test_incorrect_exited_source(spec, state):
504504
set_eth1_withdrawal_credential_with_balance(
505505
spec, state, source_index, address=source_address
506506
)
507-
consolidation = spec.ExecutionLayerConsolidationRequest(
507+
consolidation = spec.ConsolidationRequest(
508508
source_address=source_address,
509509
source_pubkey=state.validators[source_index].pubkey,
510510
target_pubkey=state.validators[target_index].pubkey,
@@ -536,7 +536,7 @@ def test_incorrect_exited_target(spec, state):
536536
set_eth1_withdrawal_credential_with_balance(
537537
spec, state, source_index, address=source_address
538538
)
539-
consolidation = spec.ExecutionLayerConsolidationRequest(
539+
consolidation = spec.ConsolidationRequest(
540540
source_address=source_address,
541541
source_pubkey=state.validators[source_index].pubkey,
542542
target_pubkey=state.validators[target_index].pubkey,
@@ -566,7 +566,7 @@ def test_incorrect_inactive_source(spec, state):
566566
set_eth1_withdrawal_credential_with_balance(
567567
spec, state, source_index, address=source_address
568568
)
569-
consolidation = spec.ExecutionLayerConsolidationRequest(
569+
consolidation = spec.ConsolidationRequest(
570570
source_address=source_address,
571571
source_pubkey=state.validators[source_index].pubkey,
572572
target_pubkey=state.validators[target_index].pubkey,
@@ -598,7 +598,7 @@ def test_incorrect_inactive_target(spec, state):
598598
set_eth1_withdrawal_credential_with_balance(
599599
spec, state, source_index, address=source_address
600600
)
601-
consolidation = spec.ExecutionLayerConsolidationRequest(
601+
consolidation = spec.ConsolidationRequest(
602602
source_address=source_address,
603603
source_pubkey=state.validators[source_index].pubkey,
604604
target_pubkey=state.validators[target_index].pubkey,
@@ -627,7 +627,7 @@ def test_incorrect_no_source_execution_withdrawal_credential(spec, state):
627627
source_index = spec.get_active_validator_indices(state, current_epoch)[0]
628628
target_index = spec.get_active_validator_indices(state, current_epoch)[1]
629629
source_address = b"\x22" * 20
630-
consolidation = spec.ExecutionLayerConsolidationRequest(
630+
consolidation = spec.ConsolidationRequest(
631631
source_address=source_address,
632632
source_pubkey=state.validators[source_index].pubkey,
633633
target_pubkey=state.validators[target_index].pubkey,
@@ -656,7 +656,7 @@ def test_incorrect_no_target_execution_withdrawal_credential(spec, state):
656656
set_eth1_withdrawal_credential_with_balance(
657657
spec, state, source_index, address=source_address
658658
)
659-
consolidation = spec.ExecutionLayerConsolidationRequest(
659+
consolidation = spec.ConsolidationRequest(
660660
source_address=source_address,
661661
source_pubkey=state.validators[source_index].pubkey,
662662
target_pubkey=state.validators[target_index].pubkey,
@@ -684,7 +684,7 @@ def test_incorrect_incorrect_source_address(spec, state):
684684
spec, state, source_index, address=source_address
685685
)
686686
# Make consolidation with different source address
687-
consolidation = spec.ExecutionLayerConsolidationRequest(
687+
consolidation = spec.ConsolidationRequest(
688688
source_address=b"\x33" * 20,
689689
source_pubkey=state.validators[source_index].pubkey,
690690
target_pubkey=state.validators[target_index].pubkey,
@@ -714,7 +714,7 @@ def test_incorrect_unknown_source_pubkey(spec, state):
714714
spec, state, source_index, address=source_address
715715
)
716716
# Make consolidation with different source pubkey
717-
consolidation = spec.ExecutionLayerConsolidationRequest(
717+
consolidation = spec.ConsolidationRequest(
718718
source_address=source_address,
719719
source_pubkey=b"\x00" * 48,
720720
target_pubkey=state.validators[target_index].pubkey,
@@ -744,7 +744,7 @@ def test_incorrect_unknown_target_pubkey(spec, state):
744744
spec, state, source_index, address=source_address
745745
)
746746
# Make consolidation with different target pubkey
747-
consolidation = spec.ExecutionLayerConsolidationRequest(
747+
consolidation = spec.ConsolidationRequest(
748748
source_address=b"\x33" * 20,
749749
source_pubkey=state.validators[source_index].pubkey,
750750
target_pubkey=b"\x00" * 48,
@@ -760,7 +760,7 @@ def run_consolidation_processing(spec, state, consolidation, success=True):
760760
"""
761761
Run ``process_consolidation``, yielding:
762762
- pre-state ('pre')
763-
- execution_layer_consolidation_request ('execution_layer_consolidation_request')
763+
- consolidation_request ('consolidation_request')
764764
- post-state ('post').
765765
If ``valid == False``, run expecting ``AssertionError``
766766
"""
@@ -778,9 +778,9 @@ def run_consolidation_processing(spec, state, consolidation, success=True):
778778
pre_state = state.copy()
779779

780780
yield 'pre', state
781-
yield 'execution_layer_consolidation_request', consolidation
781+
yield 'consolidation_request', consolidation
782782

783-
spec.process_execution_layer_consolidation_request(state, consolidation)
783+
spec.process_consolidation_request(state, consolidation)
784784

785785
yield 'post', state
786786

tests/formats/operations/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Operations:
4747
| `bls_to_execution_change` | `SignedBLSToExecutionChange` | `address_change` | `process_bls_to_execution_change(state, address_change)` (new in Capella) |
4848
| `deposit_request` | `DepositRequest` | `deposit_request` | `process_deposit_request(state, deposit_request)` (new in Electra) |
4949
| `withdrawal_request` | `WithdrawalRequest` | `withdrawal_request` | `process_withdrawal_request(state, withdrawal_request)` (new in Electra) |
50-
| `execution_layer_consolidation_request` | `ExecutionLayerConsolidationRequest` | `execution_layer_consolidation_request` | `process_execution_layer_consolidation_request(state, execution_layer_consolidation_request)` (new in Electra) |
50+
| `consolidation_request` | `ConsolidationRequest` | `consolidation_request` | `process_consolidation_request(state, consolidation_request)` (new in Electra) |
5151

5252
Note that `block_header` is not strictly an operation (and is a full `Block`), but processed in the same manner, and hence included here.
5353

tests/generators/operations/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
_new_electra_mods = {key: 'eth2spec.test.electra.block_processing.test_process_' + key for key in [
4747
'attestation',
48-
'execution_layer_consolidation_request',
48+
'consolidation_request',
4949
'deposit_request',
5050
'withdrawal_request',
5151
'voluntary_exit'

0 commit comments

Comments
 (0)