Skip to content

Commit e9a7377

Browse files
committed
EIP-7685: exclude empty requests data in commitment
Here I am proposing to change the `requests_hash` commitment so that empty items are excluded. The point of this is to ensure a stable empty requests hash which is independent of fork. Having such a hash makes testing a lot easier, and it mirrors how other execution-layer commitments behave.
1 parent 279a7fa commit e9a7377

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

EIPS/eip-7685.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,28 @@ Each request type will defines its own `requests` object using with its own
4545

4646
#### Block Header
4747

48-
Extend the header with a new 32 byte value `requests_hash`.
48+
Extend the header with a new 32 byte commitment value `requests_hash`.
4949

50-
The construction looks like:
50+
A requests hash list is computed by hashing the elements of the block requests list, but
51+
only ones where `request_data` is non-empty. The commitment is then computed as the sha256
52+
hash of the list of requests element hashes.
5153

52-
```
53-
sha256(sha256(requests_0) ++ sha256(requests_1) ++ ...)
54-
```
55-
56-
Or in pseudocode:
5754

5855
```python
59-
def compute_requests_hash(requests):
56+
def compute_requests_hash(block_requests):
6057
m = sha256()
61-
for r in requests:
62-
m.update(sha256(r))
58+
for r in block_requests:
59+
if len(r) > 1:
60+
m.update(sha256(r))
6361
return m.digest()
6462

6563
block.header.requests_hash = compute_requests_hash(requests)
6664
```
6765

6866
### Consensus Layer
6967

70-
Each proposal may choose how to extend the beacon chain types to include new EL
71-
request types.
68+
Each proposal may choose how to extend the beacon chain types to include new EL request
69+
types.
7270

7371
## Rationale
7472

@@ -115,6 +113,12 @@ Within the same type, order is not defined. This is because the data of the
115113
request is opaque as far as this EIP is concerned. Therefore, it is to be
116114
determined by each request type individually.
117115

116+
### Removing empty requests in commitment
117+
118+
We exclude empty requests elements from the `requests_hash` commitment in order to get a
119+
stable 'empty' hash value that is independent of the blockchain fork. For a block with no
120+
requests data, the `requests_hash` is simply `sha256("")`.
121+
118122
## Backwards Compatibility
119123

120124
No backward compatibility issues found.

0 commit comments

Comments
 (0)