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

EIP-6475: Add SSZ Optional[T] type (and drop selector byte in Union None case) #3336

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

etan-status
Copy link
Contributor

@etan-status etan-status commented Apr 20, 2023

Add specification for EIP-6475 support for SSZ.
Remerkleable impl: https://eips.ethereum.org/assets/eip-6475/optional.py
Tests: https://eips.ethereum.org/assets/eip-6475/tests.py

We could possibly change all planned usage of Union with Optional, and introduce the conceptually more complex Union once needed. Optional serialization can be more optimized than Union.

Discussion: https://ethereum-magicians.org/t/eip-6475-ssz-optional/12891

This PR builds on prior work from:

Add specification for EIP-6475 support for SSZ.
Remerkleable impl: https://eips.ethereum.org/assets/eip-6475/tests.py

We could possibly change all planned usage of `Union` with `Optional`,
and introduce the conceptually more complex `Union` once needed.
`Optional` serialization can be more optimized than `Union`.

Discussion: https://ethereum-magicians.org/t/eip-6475-ssz-optional/12891

This PR builds on prior work from:
- @zah at ethereum#1916
@hwwhww
Copy link
Contributor

hwwhww commented Apr 28, 2023

I would like to update all Python Optional to PyOptional in this PR to avoid confusions.

@etan-status Thanks for adding remerkleable implmentation. Do you want to open a PR in remerkleable too?

@hwwhww hwwhww added the scope:SSZ Simple Serialize label Apr 28, 2023
@etan-status
Copy link
Contributor Author

Sure, I can open a PR against Remerkleable as well, once the specs are accepted.

With the Union also dropping the selector byte for the None case, it actually becomes a superset of Optional, so the implementation is a bit easier than in the EIP (which targets the current Remerkleable).

@etan-status etan-status changed the title EIP-6475: Add SSZ Optional[T] type EIP-6475: Add SSZ Optional[T] type (and drop selector byte in Union None case) Apr 29, 2023
@etan-status
Copy link
Contributor Author

StableContainer (EIP-7495) supports Optional in an even more compact format, and is also forward-compatible; if containers are extended later, proofs for known fields can still be processed even if the verifier code is not updated to support later added fields.

@draghtnight

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:SSZ Simple Serialize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants