This commit is contained in:
Justin Drake 2019-06-27 11:30:23 +01:00
parent 494984f7d3
commit d641e94151
1 changed files with 5 additions and 6 deletions

View File

@ -43,7 +43,7 @@
### Composite types ### Composite types
* **container**: ordered heterogeneous collection of values * **container**: ordered heterogeneous collection of values
* python dataclass notation with key-type pairs, e.g. * python dataclass notation with key-type pairs, e.g.
```python ```python
class ContainerExample(Container): class ContainerExample(Container):
foo: uint64 foo: uint64
@ -53,12 +53,12 @@ class ContainerExample(Container):
* notation `Vector[type, N]`, e.g. `Vector[uint64, N]` * notation `Vector[type, N]`, e.g. `Vector[uint64, N]`
* **list**: ordered variable-length homogeneous collection of values, with maximum length `N` * **list**: ordered variable-length homogeneous collection of values, with maximum length `N`
* notation `List[type, N]`, e.g. `List[uint64, N]` * notation `List[type, N]`, e.g. `List[uint64, N]`
* **bitvector**: ordered fixed-length collection of `boolean` values
* notation `Bitvector[N]`
* **bitlist**: ordered variable-length collection of `boolean` values, with maximum length `N`
* notation `Bitlist[N]`
* **union**: union type containing one of the given subtypes * **union**: union type containing one of the given subtypes
* notation `Union[type_1, type_2, ...]`, e.g. `union[null, uint64]` * notation `Union[type_1, type_2, ...]`, e.g. `union[null, uint64]`
* **Bitvector**: a fixed-length list of `boolean` values
* notation `Bitvector[N]`
* **Bitlist**: a variable-length list of `boolean` values with maximum length `N`
* notation `Bitlist[N]`
### Variable-size and fixed-size ### Variable-size and fixed-size
@ -193,7 +193,6 @@ as_integer = sum([value[i] << i for i in range(len(value))])
return mix_in_length(merkleize(as_integer.to_bytes((N + 7) // 8, "little")), len(value)) return mix_in_length(merkleize(as_integer.to_bytes((N + 7) // 8, "little")), len(value))
``` ```
## Self-signed containers ## Self-signed containers
Let `value` be a self-signed container object. The convention is that the signature (e.g. a `"bytes96"` BLS12-381 signature) be the last field of `value`. Further, the signed message for `value` is `signing_root(value) = hash_tree_root(truncate_last(value))` where `truncate_last` truncates the last element of `value`. Let `value` be a self-signed container object. The convention is that the signature (e.g. a `"bytes96"` BLS12-381 signature) be the last field of `value`. Further, the signed message for `value` is `signing_root(value) = hash_tree_root(truncate_last(value))` where `truncate_last` truncates the last element of `value`.