mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-20 14:28:22 +00:00
Update some missing type hinting of phase 1
This commit is contained in:
parent
ff96eea3ac
commit
733653f169
@ -15,7 +15,7 @@
|
||||
- [Time parameters](#time-parameters)
|
||||
- [Max operations per block](#max-operations-per-block)
|
||||
- [Reward and penalty quotients](#reward-and-penalty-quotients)
|
||||
- [Signature domains](#signature-domains)
|
||||
- [Signature domain types](#signature-domain-types)
|
||||
- [TODO PLACEHOLDER](#todo-placeholder)
|
||||
- [Data structures](#data-structures)
|
||||
- [Custody objects](#custody-objects)
|
||||
@ -156,7 +156,7 @@ class CustodyChunkChallengeRecord(Container):
|
||||
challenger_index: ValidatorIndex
|
||||
responder_index: ValidatorIndex
|
||||
inclusion_epoch: Epoch
|
||||
data_root: Bytes32
|
||||
data_root: Hash
|
||||
depth: uint64
|
||||
chunk_index: uint64
|
||||
```
|
||||
@ -169,9 +169,9 @@ class CustodyBitChallengeRecord(Container):
|
||||
challenger_index: ValidatorIndex
|
||||
responder_index: ValidatorIndex
|
||||
inclusion_epoch: Epoch
|
||||
data_root: Bytes32
|
||||
data_root: Hash
|
||||
chunk_count: uint64
|
||||
chunk_bits_merkle_root: Bytes32
|
||||
chunk_bits_merkle_root: Hash
|
||||
responder_key: BLSSignature
|
||||
```
|
||||
|
||||
@ -182,9 +182,9 @@ class CustodyResponse(Container):
|
||||
challenge_index: uint64
|
||||
chunk_index: uint64
|
||||
chunk: Vector[Bytes[PLACEHOLDER], BYTES_PER_CUSTODY_CHUNK]
|
||||
data_branch: List[Bytes32, PLACEHOLDER]
|
||||
chunk_bits_branch: List[Bytes32, PLACEHOLDER]
|
||||
chunk_bits_leaf: Bytes32
|
||||
data_branch: List[Hash, PLACEHOLDER]
|
||||
chunk_bits_branch: List[Hash, PLACEHOLDER]
|
||||
chunk_bits_leaf: Hash
|
||||
```
|
||||
|
||||
### New beacon operations
|
||||
@ -296,7 +296,7 @@ def get_custody_chunk_bit(key: BLSSignature, chunk: bytes) -> bool:
|
||||
### `get_chunk_bits_root`
|
||||
|
||||
```python
|
||||
def get_chunk_bits_root(chunk_bits: bytes) -> Bytes32:
|
||||
def get_chunk_bits_root(chunk_bits: bytes) -> Hash:
|
||||
aggregated_bits = bytearray([0] * 32)
|
||||
for i in range(0, len(chunk_bits), 32):
|
||||
for j in range(32):
|
||||
|
@ -93,7 +93,7 @@ class ShardAttestation(Container):
|
||||
class data(Container):
|
||||
slot: Slot
|
||||
shard: Shard
|
||||
shard_block_root: Bytes32
|
||||
shard_block_root: Hash
|
||||
aggregation_bits: Bitlist[PLACEHOLDER]
|
||||
aggregate_signature: BLSSignature
|
||||
```
|
||||
@ -104,10 +104,10 @@ class ShardAttestation(Container):
|
||||
class ShardBlock(Container):
|
||||
slot: Slot
|
||||
shard: Shard
|
||||
beacon_chain_root: Bytes32
|
||||
parent_root: Bytes32
|
||||
beacon_chain_root: Hash
|
||||
parent_root: Hash
|
||||
data: ShardBlockBody
|
||||
state_root: Bytes32
|
||||
state_root: Hash
|
||||
attestations: List[ShardAttestation, PLACEHOLDER]
|
||||
signature: BLSSignature
|
||||
```
|
||||
@ -118,10 +118,10 @@ class ShardBlock(Container):
|
||||
class ShardBlockHeader(Container):
|
||||
slot: Slot
|
||||
shard: Shard
|
||||
beacon_chain_root: Bytes32
|
||||
parent_root: Bytes32
|
||||
body_root: Bytes32
|
||||
state_root: Bytes32
|
||||
beacon_chain_root: Hash
|
||||
parent_root: Hash
|
||||
body_root: Hash
|
||||
state_root: Hash
|
||||
attestations: List[ShardAttestation, PLACEHOLDER]
|
||||
signature: BLSSignature
|
||||
```
|
||||
@ -249,7 +249,7 @@ def verify_shard_attestation_signature(state: BeaconState,
|
||||
### `compute_crosslink_data_root`
|
||||
|
||||
```python
|
||||
def compute_crosslink_data_root(blocks: Sequence[ShardBlock]) -> Bytes32:
|
||||
def compute_crosslink_data_root(blocks: Sequence[ShardBlock]) -> Hash:
|
||||
def is_power_of_two(value: uint64) -> bool:
|
||||
return (value > 0) and (value & (value - 1) == 0)
|
||||
|
||||
@ -258,7 +258,7 @@ def compute_crosslink_data_root(blocks: Sequence[ShardBlock]) -> Bytes32:
|
||||
values.append(b'\x00' * BYTES_PER_SHARD_BLOCK_BODY)
|
||||
return values
|
||||
|
||||
def hash_tree_root_of_bytes(data: bytes) -> bytes:
|
||||
def hash_tree_root_of_bytes(data: bytes) -> Hash:
|
||||
return hash_tree_root([data[i:i + 32] for i in range(0, len(data), 32)])
|
||||
|
||||
def zpad(data: bytes, length: uint64) -> bytes:
|
||||
|
Loading…
x
Reference in New Issue
Block a user