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-6110: put deposits into request struct #8440

Closed
wants to merge 1 commit into from
Closed
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
54 changes: 12 additions & 42 deletions EIPS/eip-6110.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
type: Standards Track
category: Core
created: 2022-12-09
requires: 7685

Check failure on line 11 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[preamble-requires-status]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md:11:10 | 11 | requires: 7685 | ^^^^^ required from here | = help: see https://ethereum.github.io/eipw/preamble-requires-status/

Check failure on line 11 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[preamble-requires-status]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md:11:10 | 11 | requires: 7685 | ^^^^^ required from here | = help: see https://ethereum.github.io/eipw/preamble-requires-status/
---

## Abstract
Expand Down Expand Up @@ -60,58 +61,25 @@
4. `signature: Bytes96`
5. `index: uint64`

RLP encoding of deposit structure **MUST** be computed in the following way:
Deposits are a type of [EIP-7685](./eip-7685.md) request, therefore the encoding of the structure must be computed using the type byte `0x00`:

Check failure on line 64 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-link-status]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 64 | Deposits are a type of [EIP-7685](./eip-7685.md) request, therefore the encoding of the structure must be computed using the type byte `0x00`: | = help: see https://ethereum.github.io/eipw/markdown-link-status/

Check failure on line 64 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-refs]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 64 | Deposits are a type of [EIP-7685](./eip-7685.md) request, therefore the encoding of the structure must be computed using the type byte `0x00`: | = help: see https://ethereum.github.io/eipw/markdown-refs/

Check failure on line 64 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-link-status]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 64 | Deposits are a type of [EIP-7685](./eip-7685.md) request, therefore the encoding of the structure must be computed using the type byte `0x00`: | = help: see https://ethereum.github.io/eipw/markdown-link-status/

Check failure on line 64 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-refs]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 64 | Deposits are a type of [EIP-7685](./eip-7685.md) request, therefore the encoding of the structure must be computed using the type byte `0x00`: | = help: see https://ethereum.github.io/eipw/markdown-refs/

```python
rlp_encoded_deposit = RLP([
RLP(pubkey),
RLP(withdrawal_credentials),
RLP(amount),
RLP(signature),
RLP(index)
encoded_deposit = 0x00 ++ rlp([
Copy link
Contributor

Choose a reason for hiding this comment

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

The problem with applying general request format to deposits is that CL and EL need to parse deposit data from their block structures, and each layer use own encoding for the same data (SSZ vs RLP).

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 it's unclear, but this is only the encoding for the EL.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarification! Now it makes more sense

rlp(pubkey),
rlp(withdrawal_credentials),
rlp(amount),
rlp(signature),
rlp(index)
])
```

#### Block structure

Beginning with the `FORK_BLOCK`, the block body **MUST** be appended with a list of deposit operations. RLP encoding of an extended block body structure **MUST** be computed as follows:

```python
block_body_rlp = RLP([
rlp_encoded_field_0,
...,
# Latest block body field before `deposits`
rlp_encoded_field_n,

RLP([rlp_encoded_deposit_0, ..., rlp_encoded_deposit_k])
])
```

Beginning with the `FORK_BLOCK`, the block header **MUST** be appended with the new **`deposits_root`** field. The value of this field is the trie root committing to the list of deposits in the block body. **`deposits_root`** field value **MUST** be computed as follows:

```python
def compute_trie_root_from_indexed_data(data):
trie = Trie.from([(i, obj) for i, obj in enumerate(data)])
return trie.root

block.header.deposits_root = compute_trie_root_from_indexed_data(block.body.deposits)
```
The encoded deposits will be included in the header and body as generic requests following the format defined by EIP-7685.

Check failure on line 76 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-refs]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 76 | The encoded deposits will be included in the header and body as generic requests following the format defined by EIP-7685. |

Check failure on line 76 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-refs]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 76 | The encoded deposits will be included in the header and body as generic requests following the format defined by EIP-7685. |

#### Block validity

Beginning with the `FORK_BLOCK`, client software **MUST** extend block validity rule set with the following conditions:

1. Value of **`deposits_root`** block header field equals to the trie root committing to the list of deposit operations contained in the block. To illustrate:

```python
def compute_trie_root_from_indexed_data(data):
trie = Trie.from([(i, obj) for i, obj in enumerate(data)])
return trie.root

assert block.header.deposits_root == compute_trie_root_from_indexed_data(block.body.deposits)
```

2. The list of deposit operations contained in the block **MUST** be equivalent to the list of log events emitted by each deposit transaction of the given block, respecting the order of transaction inclusion. To illustrate:
1. The list of deposit operations contained in the block **MUST** be equivalent to the list of log events emitted by each deposit transaction of the given block, respecting the order of transaction inclusion. To illustrate:

```python
def parse_deposit_data(deposit_event_data): bytes[]
Expand Down Expand Up @@ -155,6 +123,8 @@
assert block.body.deposits == expected_deposits
```

2. Each deposit accumulated in the block must appear in the EIP-7685 requests list in the order they appear in the logs.

Check failure on line 126 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-refs]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 126 | 2. Each deposit accumulated in the block must appear in the EIP-7685 requests list in the order they appear in the logs. |

Check failure on line 126 in EIPS/eip-6110.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md')

error[markdown-refs]: unable to read file `eip-7685.md`: Io: JsValue(Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md' Error: ENOENT: no such file or directory, open 'EIPS/eip-7685.md') --> EIPS/eip-6110.md | 126 | 2. Each deposit accumulated in the block must appear in the EIP-7685 requests list in the order they appear in the logs. |

A block that does not satisfy the above conditions **MUST** be deemed invalid.

### Consensus layer
Expand Down
Loading