Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-7685: exclude empty requests data in commitment #8989

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions EIPS/eip-7685.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,30 @@ Each request type will defines its own `requests` object using with its own

#### Block Header

Extend the header with a new 32 byte value `requests_hash`.
Extend the header with a new 32 byte commitment value `requests_hash`.

The construction looks like:
A requests hash list is computed by hashing the elements of the block requests list, but
only ones where `request_data` is non-empty. Note we assume `request_type` has a size of
one byte.

```
sha256(sha256(requests_0) ++ sha256(requests_1) ++ ...)
```
The commitment is then computed as the sha256 hash of the list of element hashes.

Or in pseudocode:

```python
def compute_requests_hash(requests):
def compute_requests_hash(block_requests):
fjl marked this conversation as resolved.
Show resolved Hide resolved
m = sha256()
for r in requests:
m.update(sha256(r))
for r in block_requests:
if len(r) > 1:
lightclient marked this conversation as resolved.
Show resolved Hide resolved
m.update(sha256(r).digest())
return m.digest()

block.header.requests_hash = compute_requests_hash(requests)
```

### Consensus Layer

Each proposal may choose how to extend the beacon chain types to include new EL
request types.
Each proposal may choose how to extend the beacon chain types to include new EL request
types.

## Rationale

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

### Removing empty requests in commitment

We exclude empty requests elements from the `requests_hash` commitment in order to get a
stable 'empty' hash value that is independent of the blockchain fork. For a block with no
requests data, the `requests_hash` is simply `sha256("")`.

## Backwards Compatibility

No backward compatibility issues found.
Expand Down
Loading