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: group requests into request-data #8924

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all 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
63 changes: 27 additions & 36 deletions EIPS/eip-7685.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,70 +13,62 @@ created: 2024-04-14
## Abstract

This proposal defines a general purpose framework for storing contract-triggered
requests. It extends the execution header and body with a single field each to
store the request information. This inherently exposes the requests to the
consensus layer, which can then process each one.
requests. It extends the execution header with a single field to store the
request information. Requests are later on exposed to the consensus layer, which
then processes each one.

## Motivation

The proliferation of smart contract controlled validators has caused there to be
a demand for additional EL triggered behaviors. By allowing these systems to
delegate administrative operations to their governing smart contracts, they can
avoid intermediaries needing to step in and ensure certain operations occur.
This creates a safer system for end users.
This creates a safer system for end users. By abstracting each individual request
details from the EL, adding new request types is simpler and does not require an
update on the execution block structure.

## Specification

### Execution Layer

#### Request
#### Requests

A `request` consists of a `request_type` prepended to an opaque byte array
`request_data`:
A `requests` object consists of a `request_type` prepended to an opaque byte
array `request_data`.

```
request = request_type ++ request_data
requests = request_type ++ request_data
```

Let `requests` be the list of all `request` objects in the block in ascending
order by type. For example:
Each request type will defines its own `requests` object using with its own
`request_data` format.

```
[0x00_request_0, 0x01_request_0, 0x01_request_1, 0x02_request_0, ...]
```

The ordering of requests within a type is to be defined by each request type.
#### Block Header

#### Block structure
Extend the header with a new 32 byte value `requests_hash`.

The block body is appended with a list of requests. RLP encoding of the extended
block body structure is computed as follows:
The construction looks like:

```python
block_body_rlp = rlp([
field_0,
...,
# Latest block body field before `requests`
field_n,
[request_0, ..., request_k],
])
```
sha256(sha256(requests_0) ++ sha256(requests_1) ++ ...)`
```

#### Block Header

Extend the header with a new 32 byte value `requests_hash`:
Or in pseudocode:

```python
def compute_requests_hash(list):
return keccak256(rlp.encode([rlp.encode(req) for req in list]))
def compute_requests_hash(requests):
m = sha256()
for r in requests:
m.update(sha256(r))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the PR’s description, there is a type byte hashed in front of every list. In this particular case not having a “domain” byte is fine because the order already does this implicitly. Just want to confirm this algo in the spec is the one that it was intended to be

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe not the clearest, but each r in requests is the prefixed data already

return m.digest()

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

### Consensus Layer

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

## Rationale

Expand Down Expand Up @@ -110,8 +102,7 @@ The authors' recommendations on source and validity of requests are:
### Ordering

The ordering across types is ascending by type. This is to simplify the process
of verifying that all requests which were committed to in `requests_root` were
found in the block.
of verifying that all requests which were committed to in `requests_hash` match.

An alternative could be to order by when the request was generated within the
block. Since it's expected that many requests will be accumulated at the end of
Expand Down
Loading