@@ -33,42 +33,46 @@ update on the execution block structure.
3333
3434#### Requests
3535
36- A ` requests ` object consists of a ` request_type ` prepended to an opaque byte
37- array ` request_data ` .
36+ A ` requests ` object consists of a ` request_type ` prepended to an opaque byte array
37+ ` request_data ` . The ` request_data ` contains zero or more encoded request objects .
3838
3939```
4040requests = request_type ++ request_data
4141```
4242
43- Each request type will defines its own ` requests ` object using with its own
44- ` request_data ` format.
43+ Each request type will defines its own ` requests ` object with its own ` request_data ` format.
4544
4645#### Block Header
4746
48- Extend the header with a new 32 byte value ` requests_hash ` .
47+ Extend the header with a new 32 byte commitment value ` requests_hash ` .
4948
50- The construction looks like:
49+ While processing a block, multiple ` requests ` objects with different ` request_type ` s will
50+ be produced by the system, and accumulated in the block requests list.
5151
52- ```
53- sha256(sha256(requests_0) ++ sha256(requests_1) ++ ...)
54- ```
52+ In order to compute the commitment, an intermediate hash list is first built by hashing
53+ all non-empty requests elements of the block requests list. Items with empty
54+ ` request_data ` are excluded, i.e. the intermediate list skips ` requests ` items which
55+ contain only the ` request_type ` (1 byte) and nothing else.
56+
57+ Within the intermediate list, ` requests ` items must be ordered by ` request_type ` ascending.
5558
56- Or in pseudocode:
59+ The final commitment is computed as the sha256 hash of the intermediate element hashes.
5760
5861``` python
59- def compute_requests_hash (requests ):
62+ def compute_requests_hash (block_requests : Sequence[ bytes ] ):
6063 m = sha256()
61- for r in requests:
62- m.update(sha256(r))
64+ for r in block_requests:
65+ if len (r) > 1 :
66+ m.update(sha256(r).digest())
6367 return m.digest()
6468
6569block.header.requests_hash = compute_requests_hash(requests)
6670```
6771
6872### Consensus Layer
6973
70- Each proposal may choose how to extend the beacon chain types to include new EL
71- request types.
74+ Each proposal may choose how to extend the beacon chain types to include new EL request
75+ types.
7276
7377## Rationale
7478
@@ -115,6 +119,12 @@ Within the same type, order is not defined. This is because the data of the
115119request is opaque as far as this EIP is concerned. Therefore, it is to be
116120determined by each request type individually.
117121
122+ ### Removing empty requests in commitment
123+
124+ We exclude empty requests elements from the ` requests_hash ` commitment in order to get a
125+ stable 'empty' hash value that is independent of the blockchain fork. For a block with no
126+ requests data, the ` requests_hash ` is simply ` sha256("") ` .
127+
118128## Backwards Compatibility
119129
120130No backward compatibility issues found.
0 commit comments