Skip to content

Commit a360757

Browse files
authored
Update EIP-7685: group requests into request-data
Merged by EIP-Bot.
1 parent 630457d commit a360757

File tree

1 file changed

+27
-36
lines changed

1 file changed

+27
-36
lines changed

EIPS/eip-7685.md

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,62 @@ created: 2024-04-14
1313
## Abstract
1414

1515
This proposal defines a general purpose framework for storing contract-triggered
16-
requests. It extends the execution header and body with a single field each to
17-
store the request information. This inherently exposes the requests to the
18-
consensus layer, which can then process each one.
16+
requests. It extends the execution header with a single field to store the
17+
request information. Requests are later on exposed to the consensus layer, which
18+
then processes each one.
1919

2020
## Motivation
2121

2222
The proliferation of smart contract controlled validators has caused there to be
2323
a demand for additional EL triggered behaviors. By allowing these systems to
2424
delegate administrative operations to their governing smart contracts, they can
2525
avoid intermediaries needing to step in and ensure certain operations occur.
26-
This creates a safer system for end users.
26+
This creates a safer system for end users. By abstracting each individual request
27+
details from the EL, adding new request types is simpler and does not require an
28+
update on the execution block structure.
2729

2830
## Specification
2931

3032
### Execution Layer
3133

32-
#### Request
34+
#### Requests
3335

34-
A `request` consists of a `request_type` prepended to an opaque byte array
35-
`request_data`:
36+
A `requests` object consists of a `request_type` prepended to an opaque byte
37+
array `request_data`.
3638

3739
```
38-
request = request_type ++ request_data
40+
requests = request_type ++ request_data
3941
```
4042

41-
Let `requests` be the list of all `request` objects in the block in ascending
42-
order by type. For example:
43+
Each request type will defines its own `requests` object using with its own
44+
`request_data` format.
4345

44-
```
45-
[0x00_request_0, 0x01_request_0, 0x01_request_1, 0x02_request_0, ...]
46-
```
47-
48-
The ordering of requests within a type is to be defined by each request type.
46+
#### Block Header
4947

50-
#### Block structure
48+
Extend the header with a new 32 byte value `requests_hash`.
5149

52-
The block body is appended with a list of requests. RLP encoding of the extended
53-
block body structure is computed as follows:
50+
The construction looks like:
5451

55-
```python
56-
block_body_rlp = rlp([
57-
field_0,
58-
...,
59-
# Latest block body field before `requests`
60-
field_n,
61-
[request_0, ..., request_k],
62-
])
52+
```
53+
sha256(sha256(requests_0) ++ sha256(requests_1) ++ ...)`
6354
```
6455

65-
#### Block Header
66-
67-
Extend the header with a new 32 byte value `requests_hash`:
56+
Or in pseudocode:
6857

6958
```python
70-
def compute_requests_hash(list):
71-
return keccak256(rlp.encode([rlp.encode(req) for req in list]))
59+
def compute_requests_hash(requests):
60+
m = sha256()
61+
for r in requests:
62+
m.update(sha256(r))
63+
return m.digest()
7264

73-
block.header.requests_root = compute_requests_hash(block.body.requests)
65+
block.header.requests_hash = compute_requests_hash(requests)
7466
```
7567

7668
### Consensus Layer
7769

78-
Each proposal may choose how to extend the beacon chain types to include the new
79-
EL request.
70+
Each proposal may choose how to extend the beacon chain types to include new EL
71+
request types.
8072

8173
## Rationale
8274

@@ -110,8 +102,7 @@ The authors' recommendations on source and validity of requests are:
110102
### Ordering
111103

112104
The ordering across types is ascending by type. This is to simplify the process
113-
of verifying that all requests which were committed to in `requests_root` were
114-
found in the block.
105+
of verifying that all requests which were committed to in `requests_hash` match.
115106

116107
An alternative could be to order by when the request was generated within the
117108
block. Since it's expected that many requests will be accumulated at the end of

0 commit comments

Comments
 (0)