Skip to content

Commit 3644f36

Browse files
authored
Merge pull request #3757 from mkalinin/receipt-to-request
Rename DepositReceipt to DepositRequest
2 parents 5efd6e1 + 12d95da commit 3644f36

File tree

12 files changed

+162
-162
lines changed

12 files changed

+162
-162
lines changed

presets/mainnet/electra.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
3434

3535
# Execution
3636
# ---------------------------------------------------------------
37-
# 2**13 (= 8192) receipts
38-
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 8192
37+
# 2**13 (= 8192) deposit requests
38+
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: 8192
3939
# 2**4 (= 16) withdrawal requests
4040
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
4141

presets/minimal/electra.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
3535
# Execution
3636
# ---------------------------------------------------------------
3737
# [customized]
38-
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 4
38+
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: 4
3939
# [customized] 2**1 (= 2) withdrawal requests
4040
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2
4141

specs/electra/beacon-chain.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
- [Validator cycle](#validator-cycle)
2525
- [Containers](#containers)
2626
- [New containers](#new-containers)
27-
- [`DepositReceipt`](#depositreceipt)
27+
- [`DepositRequest`](#depositrequest)
2828
- [`PendingBalanceDeposit`](#pendingbalancedeposit)
2929
- [`PendingPartialWithdrawal`](#pendingpartialwithdrawal)
3030
- [`ExecutionLayerWithdrawalRequest`](#executionlayerwithdrawalrequest)
@@ -92,8 +92,8 @@
9292
- [Updated `process_voluntary_exit`](#updated-process_voluntary_exit)
9393
- [Execution layer withdrawal requests](#execution-layer-withdrawal-requests)
9494
- [New `process_execution_layer_withdrawal_request`](#new-process_execution_layer_withdrawal_request)
95-
- [Deposit receipts](#deposit-receipts)
96-
- [New `process_deposit_receipt`](#new-process_deposit_receipt)
95+
- [Deposit requests](#deposit-requests)
96+
- [New `process_deposit_request`](#new-process_deposit_request)
9797
- [Execution layer consolidation requests](#execution-layer-consolidation-requests)
9898
- [New `process_execution_layer_consolidation_request`](#new-process_execution_layer_consolidation_request)
9999
- [Testing](#testing)
@@ -119,7 +119,7 @@ The following values are (non-configurable) constants used throughout the specif
119119

120120
| Name | Value | Description |
121121
| - | - | - |
122-
| `UNSET_DEPOSIT_RECEIPTS_START_INDEX` | `uint64(2**64 - 1)` | *[New in Electra:EIP6110]* |
122+
| `UNSET_DEPOSIT_REQUESTS_START_INDEX` | `uint64(2**64 - 1)` | *[New in Electra:EIP6110]* |
123123
| `FULL_EXIT_REQUEST_AMOUNT` | `uint64(0)` | *[New in Electra:EIP7002]* |
124124

125125
### Withdrawal prefixes
@@ -171,7 +171,7 @@ The following values are (non-configurable) constants used throughout the specif
171171

172172
| Name | Value | Description |
173173
| - | - | - |
174-
| `MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD` | `uint64(2**13)` (= 8,192) | *[New in Electra:EIP6110]* Maximum number of deposit receipts allowed in each payload |
174+
| `MAX_DEPOSIT_REQUESTS_PER_PAYLOAD` | `uint64(2**13)` (= 8,192) | *[New in Electra:EIP6110]* Maximum number of deposit receipts allowed in each payload |
175175
| `MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD` | `uint64(2**4)` (= 16)| *[New in Electra:EIP7002]* Maximum number of execution layer withdrawal requests in each payload |
176176
| `MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD` | `uint64(1)` (= 1) | *[New in Electra:EIP7002]* Maximum number of execution layer consolidation requests in each payload |
177177

@@ -194,12 +194,12 @@ The following values are (non-configurable) constants used throughout the specif
194194

195195
### New containers
196196

197-
#### `DepositReceipt`
197+
#### `DepositRequest`
198198

199199
*Note*: The container is new in EIP6110.
200200

201201
```python
202-
class DepositReceipt(Container):
202+
class DepositRequest(Container):
203203
pubkey: BLSPubkey
204204
withdrawal_credentials: Bytes32
205205
amount: Gwei
@@ -334,7 +334,7 @@ class ExecutionPayload(Container):
334334
withdrawals: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
335335
blob_gas_used: uint64
336336
excess_blob_gas: uint64
337-
deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in Electra:EIP6110]
337+
deposit_requests: List[DepositRequest, MAX_DEPOSIT_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP6110]
338338
# [New in Electra:EIP7002:EIP7251]
339339
withdrawal_requests: List[ExecutionLayerWithdrawalRequest, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD]
340340
# [New in Electra:EIP7251]
@@ -364,7 +364,7 @@ class ExecutionPayloadHeader(Container):
364364
withdrawals_root: Root
365365
blob_gas_used: uint64
366366
excess_blob_gas: uint64
367-
deposit_receipts_root: Root # [New in Electra:EIP6110]
367+
deposit_requests_root: Root # [New in Electra:EIP6110]
368368
withdrawal_requests_root: Root # [New in Electra:EIP7002:EIP7251]
369369
consolidation_requests_root: Root # [New in Electra:EIP7251]
370370
```
@@ -414,7 +414,7 @@ class BeaconState(Container):
414414
next_withdrawal_validator_index: ValidatorIndex
415415
# Deep history valid from Capella onwards
416416
historical_summaries: List[HistoricalSummary, HISTORICAL_ROOTS_LIMIT]
417-
deposit_receipts_start_index: uint64 # [New in Electra:EIP6110]
417+
deposit_requests_start_index: uint64 # [New in Electra:EIP6110]
418418
deposit_balance_to_consume: Gwei # [New in Electra:EIP7251]
419419
exit_balance_to_consume: Gwei # [New in Electra:EIP7251]
420420
earliest_exit_epoch: Epoch # [New in Electra:EIP7251]
@@ -1041,7 +1041,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi
10411041
withdrawals_root=hash_tree_root(payload.withdrawals),
10421042
blob_gas_used=payload.blob_gas_used,
10431043
excess_blob_gas=payload.excess_blob_gas,
1044-
deposit_receipts_root=hash_tree_root(payload.deposit_receipts), # [New in Electra:EIP6110]
1044+
deposit_requests_root=hash_tree_root(payload.deposit_requests), # [New in Electra:EIP6110]
10451045
withdrawal_requests_root=hash_tree_root(payload.withdrawal_requests), # [New in Electra:EIP7002:EIP7251]
10461046
consolidation_requests_root=hash_tree_root(payload.consolidation_requests), # [New in Electra:EIP7251]
10471047
)
@@ -1057,7 +1057,7 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi
10571057
def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
10581058
# [Modified in Electra:EIP6110]
10591059
# Disable former deposit mechanism once all prior deposits are processed
1060-
eth1_deposit_index_limit = min(state.eth1_data.deposit_count, state.deposit_receipts_start_index)
1060+
eth1_deposit_index_limit = min(state.eth1_data.deposit_count, state.deposit_requests_start_index)
10611061
if state.eth1_deposit_index < eth1_deposit_index_limit:
10621062
assert len(body.deposits) == min(MAX_DEPOSITS, eth1_deposit_index_limit - state.eth1_deposit_index)
10631063
else:
@@ -1073,7 +1073,7 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
10731073
for_ops(body.deposits, process_deposit) # [Modified in Electra:EIP7251]
10741074
for_ops(body.voluntary_exits, process_voluntary_exit) # [Modified in Electra:EIP7251]
10751075
for_ops(body.bls_to_execution_changes, process_bls_to_execution_change)
1076-
for_ops(body.execution_payload.deposit_receipts, process_deposit_receipt) # [New in Electra:EIP6110]
1076+
for_ops(body.execution_payload.deposit_requests, process_deposit_request) # [New in Electra:EIP6110]
10771077
# [New in Electra:EIP7002:EIP7251]
10781078
for_ops(body.execution_payload.withdrawal_requests, process_execution_layer_withdrawal_request)
10791079
# [New in Electra:EIP7251]
@@ -1303,24 +1303,24 @@ def process_execution_layer_withdrawal_request(
13031303
))
13041304
```
13051305

1306-
##### Deposit receipts
1306+
##### Deposit requests
13071307

1308-
###### New `process_deposit_receipt`
1308+
###### New `process_deposit_request`
13091309

13101310
*Note*: This function is new in Electra:EIP6110.
13111311

13121312
```python
1313-
def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) -> None:
1314-
# Set deposit receipt start index
1315-
if state.deposit_receipts_start_index == UNSET_DEPOSIT_RECEIPTS_START_INDEX:
1316-
state.deposit_receipts_start_index = deposit_receipt.index
1313+
def process_deposit_request(state: BeaconState, deposit_request: DepositRequest) -> None:
1314+
# Set deposit request start index
1315+
if state.deposit_requests_start_index == UNSET_DEPOSIT_REQUESTS_START_INDEX:
1316+
state.deposit_requests_start_index = deposit_request.index
13171317

13181318
apply_deposit(
13191319
state=state,
1320-
pubkey=deposit_receipt.pubkey,
1321-
withdrawal_credentials=deposit_receipt.withdrawal_credentials,
1322-
amount=deposit_receipt.amount,
1323-
signature=deposit_receipt.signature,
1320+
pubkey=deposit_request.pubkey,
1321+
withdrawal_credentials=deposit_request.withdrawal_credentials,
1322+
amount=deposit_request.amount,
1323+
signature=deposit_request.signature,
13241324
)
13251325
```
13261326

@@ -1400,7 +1400,7 @@ def process_execution_layer_consolidation_request(
14001400
Modifications include:
14011401
1. Use `ELECTRA_FORK_VERSION` as the previous and current fork version.
14021402
2. Utilize the Electra `BeaconBlockBody` when constructing the initial `latest_block_header`.
1403-
3. *[New in Electra:EIP6110]* Add `deposit_receipts_start_index` variable to the genesis state initialization.
1403+
3. *[New in Electra:EIP6110]* Add `deposit_requests_start_index` variable to the genesis state initialization.
14041404
4. *[New in Electra:EIP7251]* Initialize new fields to support increasing the maximum effective balance.
14051405

14061406
```python
@@ -1420,7 +1420,7 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
14201420
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=uint64(len(deposits))),
14211421
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
14221422
randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy
1423-
deposit_receipts_start_index=UNSET_DEPOSIT_RECEIPTS_START_INDEX, # [New in Electra:EIP6110]
1423+
deposit_requests_start_index=UNSET_DEPOSIT_REQUESTS_START_INDEX, # [New in Electra:EIP6110]
14241424
)
14251425

14261426
# Process deposits

specs/electra/fork.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
9090
withdrawals_root=pre.latest_execution_payload_header.withdrawals_root,
9191
blob_gas_used=pre.latest_execution_payload_header.blob_gas_used,
9292
excess_blob_gas=pre.latest_execution_payload_header.excess_blob_gas,
93-
deposit_receipts_root=Root(), # [New in Electra:EIP6110]
93+
deposit_requests_root=Root(), # [New in Electra:EIP6110]
9494
withdrawal_requests_root=Root(), # [New in Electra:EIP7002]
9595
consolidation_requests_root=Root(), # [New in Electra:EIP7251]
9696
)
@@ -147,7 +147,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
147147
# Deep history valid from Capella onwards
148148
historical_summaries=pre.historical_summaries,
149149
# [New in Electra:EIP6110]
150-
deposit_receipts_start_index=UNSET_DEPOSIT_RECEIPTS_START_INDEX,
150+
deposit_requests_start_index=UNSET_DEPOSIT_REQUESTS_START_INDEX,
151151
# [New in Electra:EIP7251]
152152
deposit_balance_to_consume=0,
153153
exit_balance_to_consume=0,

specs/electra/validator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def compute_on_chain_aggregate(network_aggregates: Sequence[Attestation]) -> Att
105105

106106
```python
107107
def get_eth1_pending_deposit_count(state: BeaconState) -> uint64:
108-
eth1_deposit_index_limit = min(state.eth1_data.deposit_count, state.deposit_receipts_start_index)
108+
eth1_deposit_index_limit = min(state.eth1_data.deposit_count, state.deposit_requests_start_index)
109109
if state.eth1_deposit_index < eth1_deposit_index_limit:
110110
return min(MAX_DEPOSITS, eth1_deposit_index_limit - state.eth1_deposit_index)
111111
else:

0 commit comments

Comments
 (0)