Skip to content

Commit e53c10e

Browse files
authored
Merge pull request #3791 from prestonvanloon/rename-executionlayer-objs
Electra: Rename objects with prefix ExecutionLayerXXX
2 parents 76e2d52 + 99dfc9a commit e53c10e

File tree

7 files changed

+143
-182
lines changed

7 files changed

+143
-182
lines changed

specs/electra/beacon-chain.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
- [`DepositRequest`](#depositrequest)
2828
- [`PendingBalanceDeposit`](#pendingbalancedeposit)
2929
- [`PendingPartialWithdrawal`](#pendingpartialwithdrawal)
30-
- [`ExecutionLayerWithdrawalRequest`](#executionlayerwithdrawalrequest)
31-
- [`ExecutionLayerConsolidationRequest`](#executionlayerconsolidationrequest)
30+
- [`WithdrawalRequest`](#withdrawalrequest)
31+
- [`ConsolidationRequest`](#consolidationrequest)
3232
- [`PendingConsolidation`](#pendingconsolidation)
3333
- [Modified Containers](#modified-containers)
3434
- [`AttesterSlashing`](#attesterslashing)
@@ -91,11 +91,11 @@
9191
- [Voluntary exits](#voluntary-exits)
9292
- [Updated `process_voluntary_exit`](#updated-process_voluntary_exit)
9393
- [Execution layer withdrawal requests](#execution-layer-withdrawal-requests)
94-
- [New `process_execution_layer_withdrawal_request`](#new-process_execution_layer_withdrawal_request)
94+
- [New `process_withdrawal_request`](#new-process_withdrawal_request)
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 -->
@@ -227,23 +227,23 @@ class PendingPartialWithdrawal(Container):
227227
amount: Gwei
228228
withdrawable_epoch: Epoch
229229
```
230-
#### `ExecutionLayerWithdrawalRequest`
230+
#### `WithdrawalRequest`
231231

232232
*Note*: The container is new in EIP7251:EIP7002.
233233

234234
```python
235-
class ExecutionLayerWithdrawalRequest(Container):
235+
class WithdrawalRequest(Container):
236236
source_address: ExecutionAddress
237237
validator_pubkey: BLSPubkey
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
@@ -336,9 +336,9 @@ class ExecutionPayload(Container):
336336
excess_blob_gas: uint64
337337
deposit_requests: List[DepositRequest, MAX_DEPOSIT_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP6110]
338338
# [New in Electra:EIP7002:EIP7251]
339-
withdrawal_requests: List[ExecutionLayerWithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD]
339+
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`
@@ -1075,9 +1075,9 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
10751075
for_ops(body.bls_to_execution_changes, process_bls_to_execution_change)
10761076
for_ops(body.execution_payload.deposit_requests, process_deposit_request) # [New in Electra:EIP6110]
10771077
# [New in Electra:EIP7002:EIP7251]
1078-
for_ops(body.execution_payload.withdrawal_requests, process_execution_layer_withdrawal_request)
1078+
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
@@ -1236,16 +1236,16 @@ def process_voluntary_exit(state: BeaconState, signed_voluntary_exit: SignedVolu
12361236

12371237
##### Execution layer withdrawal requests
12381238

1239-
###### New `process_execution_layer_withdrawal_request`
1239+
###### New `process_withdrawal_request`
12401240

12411241
*Note*: This function is new in Electra following EIP-7002 and EIP-7251.
12421242

12431243
```python
1244-
def process_execution_layer_withdrawal_request(
1244+
def process_withdrawal_request(
12451245
state: BeaconState,
1246-
execution_layer_withdrawal_request: ExecutionLayerWithdrawalRequest
1246+
withdrawal_request: WithdrawalRequest
12471247
) -> None:
1248-
amount = execution_layer_withdrawal_request.amount
1248+
amount = withdrawal_request.amount
12491249
is_full_exit_request = amount == FULL_EXIT_REQUEST_AMOUNT
12501250

12511251
# If partial withdrawal queue is full, only full exits are processed
@@ -1254,7 +1254,7 @@ def process_execution_layer_withdrawal_request(
12541254

12551255
validator_pubkeys = [v.pubkey for v in state.validators]
12561256
# Verify pubkey exists
1257-
request_pubkey = execution_layer_withdrawal_request.validator_pubkey
1257+
request_pubkey = withdrawal_request.validator_pubkey
12581258
if request_pubkey not in validator_pubkeys:
12591259
return
12601260
index = ValidatorIndex(validator_pubkeys.index(request_pubkey))
@@ -1263,7 +1263,7 @@ def process_execution_layer_withdrawal_request(
12631263
# Verify withdrawal credentials
12641264
has_correct_credential = has_execution_withdrawal_credential(validator)
12651265
is_correct_source_address = (
1266-
validator.withdrawal_credentials[12:] == execution_layer_withdrawal_request.source_address
1266+
validator.withdrawal_credentials[12:] == withdrawal_request.source_address
12671267
)
12681268
if not (has_correct_credential and is_correct_source_address):
12691269
return
@@ -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 renamed to tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_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

0 commit comments

Comments
 (0)