Add check for byte serialization
This commit is contained in:
parent
b1c873c8f6
commit
0b0f618c61
|
@ -110,6 +110,10 @@ For general `byte` type:
|
||||||
2. Append the value to the length and return: ``[ length_bytes ] + [
|
2. Append the value to the length and return: ``[ length_bytes ] + [
|
||||||
value_bytes ]``
|
value_bytes ]``
|
||||||
|
|
||||||
|
| Check to perform | Code |
|
||||||
|
|:-------------------------------------|:-----------------------|
|
||||||
|
| Length of bytes can fit into 4 bytes | ``len(value) < 2**32`` |
|
||||||
|
|
||||||
```python
|
```python
|
||||||
byte_length = (len(value)).to_bytes(4, 'big')
|
byte_length = (len(value)).to_bytes(4, 'big')
|
||||||
return byte_length + value
|
return byte_length + value
|
||||||
|
@ -218,9 +222,9 @@ return deserialized_list, new_index
|
||||||
|
|
||||||
## Implementations
|
## Implementations
|
||||||
|
|
||||||
| Language | Implementation | Description |
|
| Language | Implementation | Description |
|
||||||
|:--------:|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
|
|:--------:|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
|
||||||
| Python | [ https://github.com/ethereum/beacon_chain/blob/master/ssz/ssz.py ](https://github.com/ethereum/beacon_chain/blob/master/ssz/ssz.py) | Beacon chain reference implementation written in Python. |
|
| Python | [ https://github.com/ethereum/beacon_chain/blob/master/ssz/ssz.py ](https://github.com/ethereum/beacon_chain/blob/master/ssz/ssz.py) | Beacon chain reference implementation written in Python. |
|
||||||
| Rust | [ https://github.com/sigp/lighthouse/tree/master/ssz ](https://github.com/sigp/lighthouse/tree/master/ssz) | Lighthouse (Rust Ethereum 2.0 Node) maintained SimpleSerialize. |
|
| Rust | [ https://github.com/sigp/lighthouse/tree/master/ssz ](https://github.com/sigp/lighthouse/tree/master/ssz) | Lighthouse (Rust Ethereum 2.0 Node) maintained SSZ. |
|
||||||
| Nim | [ https://github.com/status-im/nim-beacon-chain/blob/master/beacon_chain/ssz.nim ](https://github.com/status-im/nim-beacon-chain/blob/master/beacon_chain/ssz.nim) | Nim Implemetnation maintained SimpleSerialize. |
|
| Nim | [ https://github.com/status-im/nim-beacon-chain/blob/master/beacon_chain/ssz.nim ](https://github.com/status-im/nim-beacon-chain/blob/master/beacon_chain/ssz.nim) | Nim Implementation maintained SSZ. |
|
||||||
| Rust | [ https://github.com/paritytech/shasper/tree/master/util/ssz ](https://github.com/paritytech/shasper/tree/master/util/ssz) | Shasper implementation of SSZ maintained by ParityTech. |
|
| Rust | [ https://github.com/paritytech/shasper/tree/master/util/ssz ](https://github.com/paritytech/shasper/tree/master/util/ssz) | Shasper implementation of SSZ maintained by ParityTech. |
|
||||||
|
|
Loading…
Reference in New Issue