Fix typing
This commit is contained in:
parent
1db49f4c98
commit
4ad92a0989
|
@ -39,7 +39,7 @@ def get_spec(file_name: str, phase:int = 0) -> List[str]:
|
|||
else:
|
||||
if pulling_from == linenum and line == '{':
|
||||
if is_update_section:
|
||||
code_lines.append('%s = SSZTypeExtension({' % current_name)
|
||||
code_lines.append('%s = SSZTypeExtension(%s, {' % (current_name, current_name))
|
||||
else:
|
||||
code_lines.append('%s = SSZType({' % current_name)
|
||||
current_typedef = ['global_vars["%s"] = SSZType({' % current_name]
|
||||
|
|
|
@ -134,7 +134,7 @@ This document details the beacon chain additions and changes in Phase 1 of Ether
|
|||
'attestation': Attestation,
|
||||
'challenger_index': ValidatorIndex,
|
||||
'responder_key': BLSSignature,
|
||||
'chunk_bits': Bitfield,
|
||||
'chunk_bits': "bytes",
|
||||
'signature': BLSSignature,
|
||||
}
|
||||
```
|
||||
|
@ -147,7 +147,7 @@ This document details the beacon chain additions and changes in Phase 1 of Ether
|
|||
'challenger_index': ValidatorIndex,
|
||||
'responder_index': ValidatorIndex,
|
||||
'deadline': Epoch,
|
||||
'crosslink_data_root': Hash,
|
||||
'crosslink_data_root': 'bytes32',
|
||||
'depth': 'uint64',
|
||||
'chunk_index': 'uint64',
|
||||
}
|
||||
|
@ -161,9 +161,9 @@ This document details the beacon chain additions and changes in Phase 1 of Ether
|
|||
'challenger_index': ValidatorIndex,
|
||||
'responder_index': ValidatorIndex,
|
||||
'deadline': Epoch,
|
||||
'crosslink_data_root': Hash,
|
||||
'crosslink_data_root': 'bytes32',
|
||||
'chunk_count': 'uint64',
|
||||
'chunk_bits_merkle_root': Hash,
|
||||
'chunk_bits_merkle_root': 'bytes32',
|
||||
'responder_key': BLSSignature,
|
||||
}
|
||||
```
|
||||
|
@ -175,9 +175,9 @@ This document details the beacon chain additions and changes in Phase 1 of Ether
|
|||
'challenge_index': 'uint64',
|
||||
'chunk_index': 'uint64',
|
||||
'chunk': ['byte', BYTES_PER_CUSTODY_CHUNK],
|
||||
'data_branch': [Hash],
|
||||
'chunk_bits_branch': [Hash],
|
||||
'chunk_bits_leaf': Hash,
|
||||
'data_branch': ['bytes32'],
|
||||
'chunk_bits_branch': ['bytes32'],
|
||||
'chunk_bits_leaf': 'bytes32',
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -287,7 +287,7 @@ def get_custody_chunk_bit(key: BLSSignature, chunk: bytes) -> bool:
|
|||
### `get_chunk_bits_root`
|
||||
|
||||
```python
|
||||
def get_chunk_bits_root(chunk_bitfield: Bitfield) -> Bytes32:
|
||||
def get_chunk_bits_root(chunk_bitfield: bytes) -> Bytes32:
|
||||
aggregated_bits = bytearray([0] * 32)
|
||||
for i in range(0, len(chunk_bitfield), 32):
|
||||
for j in range(32):
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
- [Signature domains](#signature-domains)
|
||||
- [Data structures](#data-structures)
|
||||
- [`ShardBlockBody`](#shardblockbody)
|
||||
- [`ShardAttestation`](#shardattestation)
|
||||
- [`ShardBlock`](#shardblock)
|
||||
- [`ShardBlockHeader`](#shardblockheader)
|
||||
- [`ShardAttestation`](#shardattestation)
|
||||
- [Helper functions](#helper-functions)
|
||||
- [`get_period_committee`](#get_period_committee)
|
||||
- [`get_switchover_epoch`](#get_switchover_epoch)
|
||||
|
@ -68,7 +68,23 @@ This document describes the shard data layer and the shard fork choice rule in P
|
|||
### `ShardBlockBody`
|
||||
|
||||
```python
|
||||
['byte', BYTES_PER_SHARD_BLOCK_BODY]
|
||||
{
|
||||
'data': ['byte', BYTES_PER_SHARD_BLOCK_BODY],
|
||||
}
|
||||
```
|
||||
|
||||
### `ShardAttestation`
|
||||
|
||||
```python
|
||||
{
|
||||
'data': {
|
||||
'slot': Slot,
|
||||
'shard': Shard,
|
||||
'shard_block_root': 'bytes32',
|
||||
},
|
||||
'aggregation_bitfield': 'bytes',
|
||||
'aggregate_signature': BLSSignature,
|
||||
}
|
||||
```
|
||||
|
||||
### `ShardBlock`
|
||||
|
@ -77,10 +93,10 @@ This document describes the shard data layer and the shard fork choice rule in P
|
|||
{
|
||||
'slot': Slot,
|
||||
'shard': Shard,
|
||||
'beacon_chain_root': Hash,
|
||||
'previous_block_root': Hash,
|
||||
'beacon_chain_root': 'bytes32',
|
||||
'previous_block_root': 'bytes32',
|
||||
'data': ShardBlockBody,
|
||||
'state_root': Hash,
|
||||
'state_root': 'bytes32',
|
||||
'attestations': [ShardAttestation],
|
||||
'signature': BLSSignature,
|
||||
}
|
||||
|
@ -92,29 +108,15 @@ This document describes the shard data layer and the shard fork choice rule in P
|
|||
{
|
||||
'slot': Slot,
|
||||
'shard': Shard,
|
||||
'beacon_chain_root': Hash,
|
||||
'previous_block_root': Hash,
|
||||
'body_root': Hash,
|
||||
'state_root': Hash,
|
||||
'beacon_chain_root': 'bytes32',
|
||||
'previous_block_root': 'bytes32',
|
||||
'body_root': 'bytes32',
|
||||
'state_root': 'bytes32',
|
||||
'attestations': [ShardAttestation],
|
||||
'signature': BLSSignature,
|
||||
}
|
||||
```
|
||||
|
||||
### `ShardAttestation`
|
||||
|
||||
```python
|
||||
{
|
||||
'data': {
|
||||
'slot': Slot,
|
||||
'shard': Shard,
|
||||
'shard_block_root': Hash,
|
||||
},
|
||||
'aggregation_bitfield': Bitfield,
|
||||
'aggregate_signature': BLSSignature,
|
||||
}
|
||||
```
|
||||
|
||||
## Helper functions
|
||||
|
||||
### `get_period_committee`
|
||||
|
@ -234,7 +236,7 @@ def verify_shard_attestation_signature(state: BeaconState,
|
|||
### `compute_crosslink_data_root`
|
||||
|
||||
```python
|
||||
def compute_crosslink_data_root(blocks: List[ShardBlock]) -> Hash:
|
||||
def compute_crosslink_data_root(blocks: List[ShardBlock]) -> 'bytes32':
|
||||
def is_power_of_two(value: int) -> bool:
|
||||
return (value > 0) and (value & (value - 1) == 0)
|
||||
|
||||
|
@ -272,7 +274,7 @@ Let:
|
|||
def is_valid_shard_block(beacon_blocks: List[BeaconBlock],
|
||||
beacon_state: BeaconState,
|
||||
valid_shard_blocks: List[ShardBlock],
|
||||
unix_time: uint64,
|
||||
unix_time: int,
|
||||
candidate: ShardBlock) -> bool:
|
||||
# Check if block is already determined valid
|
||||
for _, block in enumerate(valid_shard_blocks):
|
||||
|
|
Loading…
Reference in New Issue