-
Notifications
You must be signed in to change notification settings - Fork 996
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
Rewrite SSZ spec #696
Rewrite SSZ spec #696
Conversation
* Implement tuples and a chunk-size reduction to 32 bytes (see #665 and #679) * Simplify presentation where appropriate. For example, deserialisation is implicit from serialisation (similar to `bls_sign` being implicit from `bls_verify`) and is left as an implementation exercise. * Dramatically reduce spec size and hopefully improve readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 it's much easier to read now.
I wasn't sure if Python conventions are relevant here, but if so we might want to
- replace
reduce(lambda x, y: x + y, serialized_elements)
etc. with''.join(serialized_elements)
. - renamce
object
to something else likevalue
asobject
is a built-in.
Co-Authored-By: JustinDrake <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I like the brevity but might argue for a little more verbosity in a couple of places.
Co-Authored-By: JustinDrake <[email protected]>
I've updated the description with the changes: Spec changes:
|
I'm trying to implement
|
| `uintN` | Type of `N` bits unsigned integer, where ``N % 8 == 0``. | | ||
* **container**: ordered heterogenous collection of values | ||
* key-pair curly bracket notation `{}`, e.g. `{'foo': "uint64", 'bar': "bool"}` | ||
* **tuple**: ordered fixed-length homogeneous collection of values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't these better called array
:s? tuples
tend to allow heterogeneous types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care either way. Implementations can use whatever terminology works best. For example, the natural terminology for Go is "array" (instead of tuple) and "slice" (instead of list). Notice that in Python lists also allow heterogeneous types 🤷♂️
This originated as a new codebase, following the currently unreleased ssz rewrite ethereum/consensus-specs#696
This originated as a new codebase, following the currently unreleased ssz rewrite ethereum/consensus-specs#696
|
@mjkeating "We now define Merkleization hash_tree_root(value)" |
bls_sign
being implicit frombls_verify
) and is left as an implementation exercise.Spec changes:
uintN
type (N
must be in[8, 16, 32, 64, 128, 256]
).signed_root
to take single ssz object, returning thehash_tree_root
of the object less the last field