-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BeaconChain #1413
BeaconChain #1413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from_genesis
looks like it might be missing some validation. Once the genesis_crystallized_state
and genesis_active_state
have been persisted, are there cross checks that should be done against the genesis_block
to verify that they all match up (the same way that eth.chains.Chain.from_genesis
checks that the state_root
that resulted from persisting the genesis_state
matches whatever state_root
is on the genesis parameters (or header)
pass | ||
|
||
@classmethod | ||
def get_sm_configuration(cls) -> Tuple[Tuple[int, Type['BaseBeaconStateMachine']], ...]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can drop this method, likely getting dropped from the main Chain
implementation (it was only added to be able to fetch this stuff over a multiprocessing pipe but that is no longer a viable API, see #1299 )
|
||
@abstractmethod | ||
def get_sm(self, block: BaseBeaconBlock) -> 'BaseBeaconStateMachine': | ||
raise NotImplementedError("Chain classes must implement this method") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be pass
class BeaconChain(BaseBeaconChain): | ||
""" | ||
A Chain is a combination of one or more StateMachine classes. Each StateMachine is associated | ||
with a range of blocks. The Chain class acts as a wrapper around these other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/blocks/slots/
StateMachine classes, delegating operations to the appropriate StateMachine depending on the | ||
current block slot number. | ||
""" | ||
logger = logging.getLogger("eth.beacon.chains.chain.BeaconChain") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra chain
in the path, suggest just eth.beacon.chains.BeaconChain
assert chain.get_sm_class_for_block_slot(num) is SM_B | ||
|
||
|
||
def test_vm_not_found_if_no_matching_block_number(genesis_block): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_vm_not_found_if_no_matching_block_number(genesis_block): | |
def test_sm_not_found_if_no_matching_block_slot(genesis_block): |
Replace with ethereum/trinity#156 |
What was wrong?
#1381 -
BeaconChain
How was it fixed?
Chain
, but changedheader
toblock
.BeaconChainDB.persist_block
return Blocks instead of Hashescreate_serenity_block_from_parent
as PoW chain does, but at this moment I'm not sure if we will need it.BaseBeaconBlock
have some@overload
initialization functions like: https://github.com/ethereum/py-evm/blob/master/eth/rlp/headers.py.__init__
. But also don't know how to add type hint in this case.__init__
, mypy shows:Overloaded function implementation does not accept all possible arguments of signature 1
. Should I use this workaround? @cburgdorf any chance you can take a look? 🙏TODO
More tests.
Cute Animal Picture