fix lint
This commit is contained in:
parent
6067c511c5
commit
d61b2991a0
4
setup.py
4
setup.py
|
@ -108,7 +108,7 @@ SSZObject = TypeVar('SSZObject', bound=View)
|
||||||
PHASE1_IMPORTS = '''from eth2spec.phase0 import spec as phase0
|
PHASE1_IMPORTS = '''from eth2spec.phase0 import spec as phase0
|
||||||
from eth2spec.config.config_util import apply_constants_config
|
from eth2spec.config.config_util import apply_constants_config
|
||||||
from typing import (
|
from typing import (
|
||||||
Any, Dict, Set, Sequence, NewType, Tuple, TypeVar, Callable
|
Any, Dict, Set, Sequence, NewType, Tuple, Optional, TypeVar, Callable
|
||||||
)
|
)
|
||||||
|
|
||||||
from dataclasses import (
|
from dataclasses import (
|
||||||
|
@ -373,11 +373,13 @@ class PySpecCommand(Command):
|
||||||
self.md_doc_paths = """
|
self.md_doc_paths = """
|
||||||
specs/phase0/beacon-chain.md
|
specs/phase0/beacon-chain.md
|
||||||
specs/phase0/fork-choice.md
|
specs/phase0/fork-choice.md
|
||||||
|
specs/phase0/validator.md
|
||||||
specs/phase1/custody-game.md
|
specs/phase1/custody-game.md
|
||||||
specs/phase1/beacon-chain.md
|
specs/phase1/beacon-chain.md
|
||||||
specs/phase1/fraud-proofs.md
|
specs/phase1/fraud-proofs.md
|
||||||
specs/phase1/fork-choice.md
|
specs/phase1/fork-choice.md
|
||||||
specs/phase1/phase1-fork.md
|
specs/phase1/phase1-fork.md
|
||||||
|
specs/phase1/validator.md
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork)
|
raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork)
|
||||||
|
|
|
@ -132,6 +132,7 @@ def get_successful_shard_transitions(state: BeaconState,
|
||||||
attestations: Attestation) -> Tuple[Sequence[Shard], Sequence[Root]]:
|
attestations: Attestation) -> Tuple[Sequence[Shard], Sequence[Root]]:
|
||||||
shards = []
|
shards = []
|
||||||
winning_roots = []
|
winning_roots = []
|
||||||
|
online_indices = get_online_validator_indices(state)
|
||||||
committee_count = get_committee_count_at_slot(state, slot)
|
committee_count = get_committee_count_at_slot(state, slot)
|
||||||
for committee_index in map(CommitteeIndex, range(committee_count)):
|
for committee_index in map(CommitteeIndex, range(committee_count)):
|
||||||
shard = compute_shard_from_committee_index(state, committee_index, slot)
|
shard = compute_shard_from_committee_index(state, committee_index, slot)
|
||||||
|
@ -160,7 +161,7 @@ def get_successful_shard_transitions(state: BeaconState,
|
||||||
)
|
)
|
||||||
if enough_online_stake:
|
if enough_online_stake:
|
||||||
shards.append(shard)
|
shards.append(shard)
|
||||||
transitions.append(shard_transition_root)
|
winning_roots.append(shard_transition_root)
|
||||||
break
|
break
|
||||||
|
|
||||||
return shards, winning_roots
|
return shards, winning_roots
|
||||||
|
@ -184,7 +185,7 @@ def get_best_light_client_aggregate(block: BeaconBlock,
|
||||||
|
|
||||||
return max(
|
return max(
|
||||||
viable_aggregates,
|
viable_aggregates,
|
||||||
key=lambda a: len([_ for i in a.aggregation_bits if i == 1]),
|
key=lambda a: len([i for i in a.aggregation_bits if i == 1]),
|
||||||
default=LightClientVote(),
|
default=LightClientVote(),
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
@ -251,9 +252,13 @@ Set `attestation_data.head_shard_root = hash_tree_root(head_shard_block)`.
|
||||||
Set `shard_transition` to the value returned by `get_shard_transition()`.
|
Set `shard_transition` to the value returned by `get_shard_transition()`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_shard_transition(state: BeaconState, shard: Shard, shard_blocks: Sequence[ShardBlock]) -> ShardTransition:
|
def get_shard_transition(state: BeaconState,
|
||||||
|
shard: Shard,
|
||||||
|
shard_blocks: Sequence[ShardBlockWrapper]) -> ShardTransition:
|
||||||
|
"""
|
||||||
latest_shard_slot = get_latest_slot_for_shard(state, shard)
|
latest_shard_slot = get_latest_slot_for_shard(state, shard)
|
||||||
offset_slots = [Slot(latest_shard_slot + x) for x in SHARD_BLOCK_OFFSETS if latest_shard_slot + x <= state.slot]
|
offset_slots = [Slot(latest_shard_slot + x) for x in SHARD_BLOCK_OFFSETS if latest_shard_slot + x <= state.slot]
|
||||||
|
"""
|
||||||
return ShardTransition()
|
return ShardTransition()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -279,9 +284,8 @@ Set `attestation.signature = attestation_signature` where `attestation_signature
|
||||||
```python
|
```python
|
||||||
def get_attestation_signature(state: BeaconState,
|
def get_attestation_signature(state: BeaconState,
|
||||||
attestation_data: AttestationData,
|
attestation_data: AttestationData,
|
||||||
custody_bits_blocks,
|
cb_blocks: List[Bitlist[MAX_VALIDATORS_PER_COMMITTEE], MAX_SHARD_BLOCKS_PER_ATTESTATION],
|
||||||
privkey: int
|
privkey: int) -> BLSSignature:
|
||||||
) -> List[Bitlist[MAX_VALIDATORS_PER_COMMITTEE], MAX_SHARD_BLOCKS_PER_ATTESTATION]:
|
|
||||||
pass
|
pass
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -425,7 +429,7 @@ def get_light_aggregate_and_proof_signature(state: BeaconState,
|
||||||
aggregate_and_proof: LightAggregateAndProof,
|
aggregate_and_proof: LightAggregateAndProof,
|
||||||
privkey: int) -> BLSSignature:
|
privkey: int) -> BLSSignature:
|
||||||
aggregate = aggregate_and_proof.aggregate
|
aggregate = aggregate_and_proof.aggregate
|
||||||
domain = get_domain(state, DOMAIN_CLIENT_AGGREGATE_AND_PROOF, compute_epoch_at_slot(aggregate.data.slot))
|
domain = get_domain(state, DOMAIN_LIGHT_AGGREGATE_AND_PROOF, compute_epoch_at_slot(aggregate.data.slot))
|
||||||
signing_root = compute_signing_root(aggregate_and_proof, domain)
|
signing_root = compute_signing_root(aggregate_and_proof, domain)
|
||||||
return bls.Sign(privkey, signing_root)
|
return bls.Sign(privkey, signing_root)
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue