-
Notifications
You must be signed in to change notification settings - Fork 145
Validator service based on beacon plugin #525
Validator service based on beacon plugin #525
Conversation
f10dbad
to
49b719b
Compare
Considering moving |
Pass handshake Add `GetNewBlock` Basic tests are done Still need to confirm we are using the right `slot` when proposing Remove repeated call to calculate pubkey Update BeaconChainConfig Update validator propose block test flake8 flake8 again Makes mypy happy, except for config.py:632 Extend `BeaconGenesisData`. Use `initialize_chain` Put `genesis_state` and `genesis_block` to global `initialize_chain` calls `create_mock_genesis`, which consumes a lot of time Skip the test for beacon plugin for now To make plugin run, `genesis_data` is required in `BeaconChainConfig`. We need to parse the genesis json to get the data. Add `test_validator_propose_block_fails`
2656109
to
a66ba12
Compare
This PR should be ready for review. Items which will be included other PRs.
|
Normal import fails to import modules with paths containing hyphens. Avoid this with `importlib.import_module`.
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.
Looks good! I leave some questions
|
||
NUM_VALIDATORS = 8 | ||
|
||
privkeys = tuple(int.from_bytes( |
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.
Have a crazy idea that we should move the plugin test from tests/plugins/eth2/
to tests/eth2/beacon/plugins/
, so that we can reuse all the fixtures defined in the conftest.py
there. Not sure what do you think. cc @pipermerriam @hwwhww @mhchia
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.
+1. IMO it will help for writing tests.
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.
Most of it looks good!
|
||
|
||
def get_chain(db): | ||
return chain_class.from_genesis( |
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.
Do we assume that we always get_chain
from genesis state/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.
Ah I think it might be better to rename it to get_chain_from_genesis
.
with pytest.raises(BlockNotFound): | ||
alice.chain.get_canonical_block_by_slot(slot) | ||
# test: the state root should change after skipping the block | ||
assert state.root != root_post_state |
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.
assert state.root != root_post_state | |
assert state.root != root_post_state.root |
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.
root_post_state
is already the root of the post state.
event_new_slot_called.wait(), | ||
timeout=2, | ||
loop=event_loop, | ||
) |
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.
How do we determine if this test failed? Does it throw exception like TimeoutError
?
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.
Yes, after 2 seconds TimeoutError
is raised and makes the test fail.
- Renaming, reordering, fixing typo, adding TODO
What was wrong?
Add validator service for #488
How was it fixed?
Validator
from Not a plugin Validator #465peer_pool
sTODO
slot
should be used when proposing and skipping. (Thanks for @NIC619 's help)Add receive server from Not a plugin Validator #465(In favor of opening other PRs for "receive server" and "plugin config")Refactor tests: add clean-ups andfixture
sCute Animal Picture