remove all unnecessary newline

This commit is contained in:
Chih Cheng Liang 2019-01-24 16:24:05 +08:00
parent 5dfa4e005b
commit 45c064a2d6
No known key found for this signature in database
GPG Key ID: C86B5E6612B1487A
1 changed files with 0 additions and 6 deletions

View File

@ -57,7 +57,6 @@ overhead.
| `deserialized_object` | The deserialized data in the data structure of your programming language. | | `deserialized_object` | The deserialized data in the data structure of your programming language. |
| `new_index` | An index to keep track the latest position where the `rawbytes` have been deserialized. | | `new_index` | An index to keep track the latest position where the `rawbytes` have been deserialized. |
## Constants ## Constants
| Constant | Value | Definition | | Constant | Value | Definition |
@ -75,7 +74,6 @@ overhead.
|:---------:|:-----------------------------------------------------------| |:---------:|:-----------------------------------------------------------|
| `uintN` | Type of `N` bits unsigned integer, where ``N % 8 == 0``. | | `uintN` | Type of `N` bits unsigned integer, where ``N % 8 == 0``. |
Convert directly to bytes the size of the int. (e.g. ``uint16 = 2 bytes``) Convert directly to bytes the size of the int. (e.g. ``uint16 = 2 bytes``)
All integers are serialized as **little endian**. All integers are serialized as **little endian**.
@ -145,7 +143,6 @@ Lists are a collection of elements of the same homogeneous type.
|:--------------------------------------------|:----------------------------| |:--------------------------------------------|:----------------------------|
| Length of serialized list fits into 4 bytes | ``len(serialized) < 2**32`` | | Length of serialized list fits into 4 bytes | ``len(serialized) < 2**32`` |
1. Get the number of raw bytes to serialize: it is ``len(list) * sizeof(element)``. 1. Get the number of raw bytes to serialize: it is ``len(list) * sizeof(element)``.
* Encode that as a `4-byte` **little endian** `uint32`. * Encode that as a `4-byte` **little endian** `uint32`.
2. Append the elements in a packed manner. 2. Append the elements in a packed manner.
@ -174,7 +171,6 @@ A container represents a heterogenous, associative collection of key-value pairs
To serialize a container, obtain the list of its field's names in the specified order. For each field name in this list, obtain the corresponding value and serialize it. Tightly pack the complete set of serialized values in the same order as the field names into a buffer. Calculate the size of this buffer of serialized bytes and encode as a `4-byte` **little endian** `uint32`. Prepend the encoded length to the buffer. The result of this concatenation is the final serialized value of the container. To serialize a container, obtain the list of its field's names in the specified order. For each field name in this list, obtain the corresponding value and serialize it. Tightly pack the complete set of serialized values in the same order as the field names into a buffer. Calculate the size of this buffer of serialized bytes and encode as a `4-byte` **little endian** `uint32`. Prepend the encoded length to the buffer. The result of this concatenation is the final serialized value of the container.
| Check to perform | Code | | Check to perform | Code |
|:--------------------------------------------|:----------------------------| |:--------------------------------------------|:----------------------------|
| Length of serialized fields fits into 4 bytes | ``len(serialized) < 2**32`` | | Length of serialized fields fits into 4 bytes | ``len(serialized) < 2**32`` |
@ -238,7 +234,6 @@ At the final step, the following checks should be made:
|:-------------------------|:-------------------------------------| |:-------------------------|:-------------------------------------|
| Ensure no extra length | `new_index == len(rawbytes)` | | Ensure no extra length | `new_index == len(rawbytes)` |
#### uint #### uint
Convert directly from bytes into integer utilising the number of bytes the same Convert directly from bytes into integer utilising the number of bytes the same
@ -453,6 +448,5 @@ return hash(b''.join([hash_tree_root(getattr(x, field)) for field in value.field
| Go | [ https://github.com/prysmaticlabs/prysm/tree/master/shared/ssz ](https://github.com/prysmaticlabs/prysm/tree/master/shared/ssz) | Go implementation of SSZ mantained by Prysmatic Labs | | Go | [ https://github.com/prysmaticlabs/prysm/tree/master/shared/ssz ](https://github.com/prysmaticlabs/prysm/tree/master/shared/ssz) | Go implementation of SSZ mantained by Prysmatic Labs |
| Swift | [ https://github.com/yeeth/SimpleSerialize.swift ](https://github.com/yeeth/SimpleSerialize.swift) | Swift implementation maintained SSZ | | Swift | [ https://github.com/yeeth/SimpleSerialize.swift ](https://github.com/yeeth/SimpleSerialize.swift) | Swift implementation maintained SSZ |
## Copyright ## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).