Version: Bytes4

This commit is contained in:
Hsiao-Wei Wang 2019-06-15 17:32:52 -04:00
parent b772b03847
commit 9b77ec11f8
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
2 changed files with 3 additions and 9 deletions

View File

@ -67,13 +67,6 @@ from eth2spec.utils.bls import (
from eth2spec.utils.hash_function import hash from eth2spec.utils.hash_function import hash
''' '''
NEW_TYPES = {
'Slot': 'uint64',
'Epoch': 'uint64',
'Shard': 'uint64',
'ValidatorIndex': 'uint64',
'Gwei': 'uint64',
}
BYTE_TYPES = [4, 32, 48, 96] BYTE_TYPES = [4, 32, 48, 96]
SUNDRY_FUNCTIONS = ''' SUNDRY_FUNCTIONS = '''
def get_ssz_type_by_name(name: str) -> Container: def get_ssz_type_by_name(name: str) -> Container:

View File

@ -161,6 +161,7 @@ We define the following Python custom types for type hinting and readability:
| `Shard` | `uint64` | a shard number | | `Shard` | `uint64` | a shard number |
| `ValidatorIndex` | `uint64` | a validator registry index | | `ValidatorIndex` | `uint64` | a validator registry index |
| `Gwei` | `uint64` | an amount in Gwei | | `Gwei` | `uint64` | an amount in Gwei |
| `Version` | `Bytes4` | a fork version number |
| `BLSPubkey` | `Bytes48` | a BLS12-381 public key | | `BLSPubkey` | `Bytes48` | a BLS12-381 public key |
| `BLSSignature` | `Bytes96` | a BLS12-381 signature | | `BLSSignature` | `Bytes96` | a BLS12-381 signature |
@ -282,9 +283,9 @@ The types are defined topologically to aid in facilitating an executable version
```python ```python
class Fork(Container): class Fork(Container):
# Previous fork version # Previous fork version
previous_version: Bytes4 previous_version: Version
# Current fork version # Current fork version
current_version: Bytes4 current_version: Version
# Fork epoch number # Fork epoch number
epoch: Epoch epoch: Epoch
``` ```