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

Add LightClientHeader wrapper #3190

Merged
merged 5 commits into from
Jan 12, 2023
Merged

Conversation

etan-status
Copy link
Contributor

In Altair, light client sync protocol exchanges BeaconBlockHeader structures for tracking current progress. Wrapping BeaconBlockHeader inside a LightClientHeader allows future extensions of this header, e.g., to also track ExecutionPayloadHeader.

Note: This changes the JSON REST format by adding a beacon nesting. For SSZ, the serialization format stays same (but overall root changes).

In Altair, light client sync protocol exchanges `BeaconBlockHeader`
structures for tracking current progress. Wrapping `BeaconBlockHeader`
inside a `LightClientHeader` allows future extensions of this header,
e.g., to also track `ExecutionPayloadHeader`.

Note: This changes the JSON REST format by adding a `beacon` nesting.
For SSZ, the serialization format stays same (but overall root changes).
Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

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

Although the fact that it modifying the Altair spec is kinda cheating, I think it is cleaner for consensus specs. So I personally prefer this PR over #3151 solution.

/cc @dapplion, @wemeetagain for third opinions. The discussion was here: #3151 (review)

Comment on lines +77 to +83
### `LightClientHeader`

```python
class LightClientHeader(Container):
# Beacon block header
beacon: BeaconBlockHeader
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add some notes about why we have this wrapper for future compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments, and also the stub for is_valid_light_client_header

@etan-status
Copy link
Contributor Author

The SSZ format stays the same, which is key, as otherwise we would break compatibility of gossip, potentially disconnecting nodes. As for JSON, clients will have to learn how to deal with the extra beacon nesting from Capella onwards anyway, so their work to update would be necessary eventually (or they could just use SSZ to begin with).

Note that no release for beacon-APIs was cut yet that formally locks in the JSON endpoints.

@etan-status
Copy link
Contributor Author

Actually, this one would kill the entirety of #3150 until BeaconBlockHeader extends (in which case, get_lc_beacon_root would have to be introduced once more). So, another reason to take this one for simplicity.

etan-status added a commit to etan-status/beacon-APIs that referenced this pull request Jan 9, 2023
The light client data structures were changed to accommodate additional
fields in future forks (e.g., to also hold execution data).

There is a minor change to the JSON serialization, where the `header`
properties are now nested inside a `LightClientHeader`.
The SSZ serialization remains compatible.

See ethereum/consensus-specs#3190
etan-status added a commit to status-im/nimbus-eth2 that referenced this pull request Jan 9, 2023
The light client data structures were changed to accommodate additional
fields in future forks (e.g., to also hold execution data).

There is a minor change to the JSON serialization, where the `header`
properties are now nested inside a `LightClientHeader`.
The SSZ serialization remains compatible.

See ethereum/consensus-specs#3190
and ethereum/beacon-APIs#287
Copy link
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

I think it's worth it to make a breaking change on altair spec now that adoption is low to prevent more complexity via legacy code. I'm in favor of #3151 (see my comment for rationale) so we should commit in that direction now

@hwwhww
Copy link
Contributor

hwwhww commented Jan 11, 2023

@dapplion
just to confirm: you want "Add ExecutionPayloadHeader to LC data" feature, and per the compatibility approaches, you like this PR's (add LightClientHeader wrapper)'s approach rather than the #3150 approach, correct?

@hwwhww hwwhww merged commit 2b2ffb5 into ethereum:dev Jan 12, 2023
@etan-status etan-status deleted the lc-headerwrapper branch January 12, 2023 16:41
etan-status added a commit to status-im/nimbus-eth2 that referenced this pull request Jan 12, 2023
The light client data structures were changed to accommodate additional
fields in future forks (e.g., to also hold execution data).

There is a minor change to the JSON serialization, where the `header`
properties are now nested inside a `LightClientHeader`.
The SSZ serialization remains compatible.

See ethereum/consensus-specs#3190
and ethereum/beacon-APIs#287
etan-status added a commit to status-im/nimbus-eth2 that referenced this pull request Jan 12, 2023
The light client data structures were changed to accommodate additional
fields in future forks (e.g., to also hold execution data).

There is a minor change to the JSON serialization, where the `header`
properties are now nested inside a `LightClientHeader`.
The SSZ serialization remains compatible.

See ethereum/consensus-specs#3190
and ethereum/beacon-APIs#287
etan-status added a commit to status-im/nimbus-eth2 that referenced this pull request Jan 13, 2023
The light client data structures were changed to accommodate additional
fields in future forks (e.g., to also hold execution data).

There is a minor change to the JSON serialization, where the `header`
properties are now nested inside a `LightClientHeader`.
The SSZ serialization remains compatible.

See ethereum/consensus-specs#3190
and ethereum/beacon-APIs#287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants