@@ -13,70 +13,62 @@ created: 2024-04-14
13
13
## Abstract
14
14
15
15
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.
19
19
20
20
## Motivation
21
21
22
22
The proliferation of smart contract controlled validators has caused there to be
23
23
a demand for additional EL triggered behaviors. By allowing these systems to
24
24
delegate administrative operations to their governing smart contracts, they can
25
25
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.
27
29
28
30
## Specification
29
31
30
32
### Execution Layer
31
33
32
- #### Request
34
+ #### Requests
33
35
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 ` .
36
38
37
39
```
38
- request = request_type ++ request_data
40
+ requests = request_type ++ request_data
39
41
```
40
42
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.
43
45
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
49
47
50
- #### Block structure
48
+ Extend the header with a new 32 byte value ` requests_hash ` .
51
49
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:
54
51
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) ++ ...)`
63
54
```
64
55
65
- #### Block Header
66
-
67
- Extend the header with a new 32 byte value ` requests_hash ` :
56
+ Or in pseudocode:
68
57
69
58
``` 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()
72
64
73
- block.header.requests_root = compute_requests_hash(block.body. requests)
65
+ block.header.requests_hash = compute_requests_hash(requests)
74
66
```
75
67
76
68
### Consensus Layer
77
69
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 .
80
72
81
73
## Rationale
82
74
@@ -110,8 +102,7 @@ The authors' recommendations on source and validity of requests are:
110
102
### Ordering
111
103
112
104
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.
115
106
116
107
An alternative could be to order by when the request was generated within the
117
108
block. Since it's expected that many requests will be accumulated at the end of
0 commit comments