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

SSZ support for light client updates #14505

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

SSZ support for light client updates #14505

wants to merge 2 commits into from

Conversation

rkapka
Copy link
Contributor

@rkapka rkapka commented Oct 4, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

Adds SSZ support to light client updates.

attested_header and finalized_header fields of updates are defined as a LightClientHeaderContainer, which itself is defined using oneof. This results in a non-exported interface type being generated and our SSZ generation library cannot handle this.

This PR resolves the above issue in the following way:

  • We define an XXXInternal type for each XXX update type. It has the same fields as the original type, but the type of attested_header and finalized_header is replaced by bytes.
  • We generate SSZ code for internal types.
  • We manually write SSZ code for original types. This is done by converting the original type into the internal type and calling the appropriate method on the internal type. We convert attested_header and finalized_header into their "SSZ-bytes" representation by calling MarshalSSZ on these headers.

Which issues(s) does this PR fix?

Part of #12991

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have made an appropriate entry to CHANGELOG.md.
  • I have added a description to this PR with sufficient context for reviewers to understand this PR.

@rkapka rkapka requested a review from a team as a code owner October 4, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant