mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-20 06:18:15 +00:00
Fix phase0 types
This commit is contained in:
parent
4a94200c0b
commit
6fdee75475
10
setup.py
10
setup.py
@ -108,7 +108,7 @@ SSZObject = TypeVar('SSZObject', bound=View)
|
||||
PHASE1_IMPORTS = '''from eth2spec.phase0 import spec as phase0
|
||||
from eth2spec.config.config_util import apply_constants_config
|
||||
from typing import (
|
||||
Any, Dict, Set, Sequence, NewType, Tuple, TypeVar, Callable
|
||||
Any, Dict, Set, Sequence, NewType, Tuple, TypeVar, Callable, Optional
|
||||
)
|
||||
|
||||
from dataclasses import (
|
||||
@ -146,8 +146,11 @@ _hash = hash
|
||||
hash_cache: Dict[bytes, Bytes32] = {}
|
||||
|
||||
|
||||
def get_eth1_data(distance: uint64) -> Bytes32:
|
||||
return hash(distance)
|
||||
def get_eth1_data(block: Eth1Block) -> Eth1Data:
|
||||
"""
|
||||
A stub function return mocking Eth1Data.
|
||||
"""
|
||||
return Eth1Data(block_hash=hash_tree_root(block))
|
||||
|
||||
|
||||
def hash(x: bytes) -> Bytes32: # type: ignore
|
||||
@ -373,6 +376,7 @@ class PySpecCommand(Command):
|
||||
self.md_doc_paths = """
|
||||
specs/phase0/beacon-chain.md
|
||||
specs/phase0/fork-choice.md
|
||||
specs/phase0/validator.md
|
||||
specs/phase1/custody-game.md
|
||||
specs/phase1/beacon-chain.md
|
||||
specs/phase1/fraud-proofs.md
|
||||
|
@ -1125,7 +1125,7 @@ def slash_validator(state: BeaconState,
|
||||
whistleblower_reward = Gwei(validator.effective_balance // WHISTLEBLOWER_REWARD_QUOTIENT)
|
||||
proposer_reward = Gwei(whistleblower_reward // PROPOSER_REWARD_QUOTIENT)
|
||||
increase_balance(state, proposer_index, proposer_reward)
|
||||
increase_balance(state, whistleblower_index, whistleblower_reward - proposer_reward)
|
||||
increase_balance(state, whistleblower_index, Gwei(whistleblower_reward - proposer_reward))
|
||||
```
|
||||
|
||||
## Genesis
|
||||
@ -1229,7 +1229,7 @@ def process_slots(state: BeaconState, slot: Slot) -> None:
|
||||
# Process epoch on the start slot of the next epoch
|
||||
if (state.slot + 1) % SLOTS_PER_EPOCH == 0:
|
||||
process_epoch(state)
|
||||
state.slot += Slot(1)
|
||||
state.slot = Slot(state.slot + 1)
|
||||
```
|
||||
|
||||
```python
|
||||
|
Loading…
x
Reference in New Issue
Block a user