consensus-specs icon indicating copy to clipboard operation
consensus-specs copied to clipboard

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

Open etan-status opened this issue 2 years ago • 5 comments

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:

  • @zah at https://github.com/ethereum/consensus-specs/issues/1916

etan-status avatar Apr 20 '23 14:04 etan-status

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 avatar Apr 28 '23 09:04 hwwhww

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 avatar Apr 29 '23 17:04 etan-status

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.

etan-status avatar Jan 09 '24 14:01 etan-status

#3789 supersedes this, but as long as Verkle still depends on this PR here will leave this open.

etan-status avatar Jun 05 '24 09:06 etan-status

Superseded by EIP-7495

etan-status avatar Jul 15 '25 14:07 etan-status