Skip to content

Commit

Permalink
EIP-7685: update
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Nov 25, 2024
1 parent e9a7377 commit d0631d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions EIPS/eip-7685.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,18 @@ Each request type will defines its own `requests` object using with its own
Extend the header with a new 32 byte commitment value `requests_hash`.

A requests hash list is computed by hashing the elements of the block requests list, but
only ones where `request_data` is non-empty. The commitment is then computed as the sha256
hash of the list of requests element hashes.
only ones where `request_data` is non-empty. Note we assume `request_type` has a size of
one byte.

The commitment is then computed as the sha256 hash of the list of element hashes.


```python
def compute_requests_hash(block_requests):
m = sha256()
for r in block_requests:
if len(r) > 1:
m.update(sha256(r))
m.update(sha256(r).digest())
return m.digest()

block.header.requests_hash = compute_requests_hash(requests)
Expand Down

0 comments on commit d0631d7

Please sign in to comment.