Skip to content

Commit 2225100

Browse files
committed
PR feedback
1 parent a8cd25e commit 2225100

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

eth/beacon/state_machines/base.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from abc import (
22
ABC,
3+
abstractmethod,
34
)
45
from typing import (
56
Tuple,
@@ -35,6 +36,33 @@ class BaseBeaconStateMachine(Configurable, ABC):
3536
state_class = None # type: Type[BeaconState]
3637
state_transition_class = None # type: Type[BaseStateTransition]
3738

39+
@classmethod
40+
@abstractmethod
41+
def get_block_class(cls) -> Type[BaseBeaconBlock]:
42+
pass
43+
44+
@classmethod
45+
@abstractmethod
46+
def get_state_class(cls) -> Type[BeaconState]:
47+
pass
48+
49+
@classmethod
50+
@abstractmethod
51+
def get_state_transiton_class(cls) -> Type[BaseStateTransition]:
52+
pass
53+
54+
@property
55+
@abstractmethod
56+
def state_transition(self) -> BaseStateTransition:
57+
pass
58+
59+
#
60+
# Import block API
61+
#
62+
@abstractmethod
63+
def import_block(self, block: BaseBeaconBlock) -> Tuple[BeaconState, BaseBeaconBlock]:
64+
pass
65+
3866

3967
class BeaconStateMachine(BaseBeaconStateMachine):
4068
def __init__(self,
@@ -69,8 +97,8 @@ def get_state_class(cls) -> Type[BeaconState]:
6997
@classmethod
7098
def get_state_transiton_class(cls) -> Type[BaseStateTransition]:
7199
"""
72-
Return the :class:`~eth.beacon.state_machines.state_transition.state_transition_class`
73-
class that this StateTransition uses for BeaconState.
100+
Return the :class:`~eth.beacon.state_machines.state_transitions.BaseStateTransition`
101+
class that this StateTransition uses for StateTransition.
74102
"""
75103
if cls.state_transition_class is None:
76104
raise AttributeError("No `state_transition_class` has been set for this StateMachine")

eth/beacon/state_machines/forks/serenity/state_transitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ def apply_state_transition(self, state: BeaconState, block: BaseBeaconBlock) ->
2323
return state
2424

2525
def per_slot_transition(self, state: BeaconState, block: BaseBeaconBlock) -> BeaconState:
26-
state = process_attestations(state, block, self.config)
2726
# TODO
2827
return state
2928

3029
def per_block_transition(self, state: BeaconState, block: BaseBeaconBlock) -> BeaconState:
3130
# TODO
31+
state = process_attestations(state, block, self.config)
3232
return state
3333

3434
def per_epoch_transition(self, state: BeaconState, block: BaseBeaconBlock) -> BeaconState:

0 commit comments

Comments
 (0)