Skip to content

Commit 1536db7

Browse files
authored
Update EIP-7002: convert to use 7685 requests (#8469)
1 parent 967e58e commit 1536db7

File tree

1 file changed

+8
-34
lines changed

1 file changed

+8
-34
lines changed

EIPS/eip-7002.md

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ status: Draft
88
type: Standards Track
99
category: Core
1010
created: 2023-05-09
11+
requires: 7685
1112
---
1213

1314
## Abstract
@@ -39,6 +40,7 @@ Note, 0x00 withdrawal credentials can be changed into 0x01 withdrawal credential
3940
| Name | Value | Comment |
4041
| - | - | - |
4142
| `WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS` | `0xEd8EA01d70Cb49726175BCf2778B9C982912e017` | Where to call and store relevant details about exit / partial withdrawal mechanism |
43+
| `WITHDRAWAL_REQUEST_TYPE` | `0x01` | The [EIP-7685](./eip-7685.md) type prefix for withdrawal request |
4244
| `SYSTEM_ADDRESS` | `0xfffffffffffffffffffffffffffffffffffffffe` | Address used to invoke system operation on contract
4345
| `EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT` | 0 | |
4446
| `WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT` | 1 | |
@@ -58,20 +60,17 @@ Note, 0x00 withdrawal credentials can be changed into 0x01 withdrawal credential
5860

5961
#### Withdrawal request operation
6062

61-
The new withdrawal request operation consists of the following fields:
63+
The new withdrawal request operation is an [EIP-7685](./eip-7685.md) request
64+
with type `0x01` and consists of the following fields:
6265

6366
1. `source_address`: `Bytes20`
6467
2. `validator_pubkey`: `Bytes48`
6568
3. `amount:` `uint64`
6669

67-
RLP encoding of a withdrawal request **MUST** be computed as the following:
70+
The [EIP-7685](./eip-7685) encoding of a withdrawal request **MUST** be computed as the follows:
6871

6972
```python
70-
rlp_encoded_withdrawal_request = RLP([
71-
source_address,
72-
validator_pubkey,
73-
amount
74-
])
73+
encoded = WITHDRAWAL_REQUEST_TYPE ++ rlp([source_address, validator_pubkey, amount])
7574
```
7675

7776
#### Withdrawal Request Contract
@@ -225,7 +224,7 @@ def reset_withdrawal_requests_count():
225224
sstore(WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS, WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT, 0)
226225
```
227226

228-
#### Bytecode
227+
##### Bytecode
229228

230229
```asm
231230
caller
@@ -469,7 +468,7 @@ push0
469468
revert
470469
```
471470

472-
#### Deployment
471+
##### Deployment
473472

474473
The withdrawal requests contract is deployed like any other smart contract. A special synthetic address is generated by working backwards from the desired deployment transaction:
475474

@@ -496,31 +495,6 @@ Sender: 0x3da359dC1d98B53f32848dFfDC421410a47bbBD5
496495
Address: 0xEd8EA01d70Cb49726175BCf2778B9C982912e017
497496
```
498497

499-
#### Block structure
500-
501-
Beginning with the `FORK_BLOCK`, the block body **MUST** be appended with the list of withdrawal requests returned by `read_withdrawal_requests()`. RLP encoding of the extended block body structure **MUST** be computed as follows:
502-
503-
```python
504-
block_body_rlp = RLP([
505-
field_0,
506-
...,
507-
# Latest block body field before `withdrawal_requests`
508-
field_n,
509-
510-
[req_0, ..., req_k],
511-
])
512-
```
513-
514-
Beginning with the `FORK_BLOCK`, the block header **MUST** be appended with the new **`withdrawal_requests_root`** field. The value of this field is the trie root committing to the list of requests in the block body. **`withdrawal_requests_root`** field value **MUST** be computed as follows:
515-
516-
```python
517-
def compute_trie_root_from_indexed_data(data):
518-
trie = Trie.from([(i, obj) for i, obj in enumerate(data)])
519-
return trie.root
520-
521-
block.header.withdrawal_requests_root = compute_trie_root_from_indexed_data(block.body.withdrawa_requests)
522-
```
523-
524498
### Consensus layer
525499

526500
[Full specification](https://github.com/ethereum/consensus-specs/blob/7bf43d1bc4fdb91059f0e6f4f7f0f3349b144950/specs/electra/beacon-chain.md)

0 commit comments

Comments
 (0)