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
Fix mixup with chain_id and network_id #1343
Fix mixup with chain_id and network_id #1343
Conversation
4e7da20
to
e25e388
Compare
e25e388
to
f1b06d3
Compare
self.run_task(self._periodically_report_stats()) | ||
if self.event_bus is not None: | ||
self.run_daemon_task(self.handle_peer_count_requests()) | ||
self.run_daemon_task(self._periodically_report_stats()) |
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.
This is potentially not a good idea. It'll cause the node to crash if peer stats reporting crashes.
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.
Agreed, but good enough for now. Fail hard during alpha/beta, then we can soften it in production.
@@ -856,7 +854,9 @@ def _add_peer(self, | |||
async def _run(self) -> None: | |||
# FIXME: PeerPool should probably no longer be a BaseService, but for now we're keeping it | |||
# so in order to ensure we cancel all peers when we terminate. | |||
self.run_task(self._periodically_report_stats()) | |||
if self.event_bus is not None: | |||
self.run_daemon_task(self.handle_peer_count_requests()) |
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.
@cburgdorf can you 👍 / 👎 this change. It moves the task into the _run
method so that it only starts when the peer pool has started as well as making it a deamon task which will crash the whole trinity process if it fails.
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, that makes sense. 👍 That said, I think this will move soon into its own child service or something similar.
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.
Yup, change makes sense to me 👍 We had a similar confusion in web3.py originally.
I don't know enough on the event bus to comment on any of that part.
self.run_task(self._periodically_report_stats()) | ||
if self.event_bus is not None: | ||
self.run_daemon_task(self.handle_peer_count_requests()) | ||
self.run_daemon_task(self._periodically_report_stats()) |
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.
Agreed, but good enough for now. Fail hard during alpha/beta, then we can soften it in production.
|
||
async def handle_network_id_requests(self) -> None: | ||
async def f() -> None: | ||
# FIXME: There must be a way to cancel event_bus.stream() when our token is triggered, |
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.
nitpick: The comment could be redirected to mention that this hack will go away as soon as ethereum/lahja#14 is included in the next release
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.
Will cleanup independently
What was wrong?
The
eth.chains.base.Chain
class had anetwork_id
property. This is wrong sincenetwork_id
is above the EVM level. This should have beenchain_id
How was it fixed?
MAINNET_NEWORK_ID
andROPSTEN_...
to live undertrinity.constants
DEFAULT_PREFERRED_NODES
to also live undertrinity
to prevent some weird imports.MAINNET_CHAIN_ID
andROPSTEN_CHAIN_ID
toeth
module.net
JSON-RPC module to return thechain_id
(currently served over the event bus by theNode
class)Node
class into something stand-alone which serves up the various config values like this. still mentally fleshing this out.Cute Animal Picture