Client: eth_chainID and eth_syncing RPC implementations#1314
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Really nice. 😄 |
…js/ethereumjs-monorepo into client/chainId_sync_RPC
|
Ready for review! A couple things I'm not 100% confident on:
Thanks! |
ryanio
left a comment
There was a problem hiding this comment.
PR and all the code looks great!
I added a commit to help fix the hanging client issue by using the createClient() mock, and adding some properties to the synchronizer property to help achieve the intended results.
The implementation of startingBlock and synchronized are a bit naïve, and would likely not behave as expected in the event of synchronization errors, synchronization lagging behind, or synchronization restarts.
I think this can be a topic for a future PR, perhaps you can open an issue to summarize it, since we are still working on staying on the tip of the chain (#1132)
I implemented the latest method on the LightSynchronizer in the same way as on the FullSynchronizer to make the API surface more consistent. Was there a reason is was missing?
Sounds good to me, I don't see any reason why it couldn't also be implemented there.
Great! Thanks a lot for the review and the help with fixing the client mocking! Will merge now! |
This PR implements the following JSON-RPC methods (required to synchronize the ETH2 teku client and the ETH1 client):
eth_chainIDeth_syncingThese methods now allow us to further connect the ETH2 and the ETH1 clients for the merge, getting rid of the
Eth1 service down for xxx s, retryingerror messageTo implement the eth_syncing method, I added a
synchronizedboolean property to theClientclass. This property is initialized asfalseand gets set totruewhen thesynchronizedevent is emitted.I also added a
startingBlockproperty to theSynchronizerclass. It is initialized as0and gets set to the current local head block number once theopenmethod is called.One thing worth mentioning is that we don't, at the moment, handle the case where the client would go from the
synchronizedstate to thenot synchronizedstate (e.g. when falling behind other peers).