Make specification of protocol in SyncRequester::send_request explicit#10295
Conversation
explicit when calling "SyncRequester::send_packet". * Remove "SyncIO::send" and leave only "SyncIO::send_protocol"
|
It looks like @elferdo hasn't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement at the following URL: https://cla.parity.io Once you've signed, please reply to this thread with Many thanks, Parity Technologies CLA Bot |
1 similar comment
|
It looks like @elferdo hasn't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement at the following URL: https://cla.parity.io Once you've signed, please reply to this thread with Many thanks, Parity Technologies CLA Bot |
|
[clabot:check] |
|
It looks like @elferdo signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
1 similar comment
|
It looks like @elferdo signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
tomusdrw
left a comment
There was a problem hiding this comment.
Looks good, just one worrisome place.
| use rand::Rng; | ||
| use snapshot::{Snapshot}; | ||
| use api::{EthProtocolInfo as PeerInfoDigest, WARP_SYNC_PROTOCOL_ID, PriorityTask}; | ||
| use api::{EthProtocolInfo as PeerInfoDigest, ETH_PROTOCOL, WARP_SYNC_PROTOCOL_ID, PriorityTask}; |
There was a problem hiding this comment.
I think we should rename WARP_SYNC_PROTOCOL_ID to WARP_SYNC_PROTOCOL (as there are already ETH_PROTOCOL and LIGHT_PROTOCOL)
|
Any thoughts how to proceed on this? How can I test that the changes work? I have tried running a node and connecting to just one reserved peer, a parity node, and synchronization seems to proceed fine both with and without warp. |
tomusdrw
left a comment
There was a problem hiding this comment.
@elferdo I'm pretty sure we won't break anything in this PR. As @grbIzl noticed, the protocol of the network is often overwritten using with_context function - IMHO this seems super confusing, I'd prefer to be explicit and use send_protocol always, alternatively as we spoke in DM we could tangle packet and protocol together (using an enum and trait Packet{ fn id() -> u8, fn protocol() -> T } for instance) to prevent any amibguity.
If the sync works and we pass all the tests I'm ok with this PR (modulo the panic). Maybe @grbIzl can suggest how to test private transaction stuff.
|
@elferdo I just noticed those new commits here, I think it would be better to merge this PR asap and then do any follow up work in susbsequent prs. This one is already reviewed and marked as good. |
I implemented something like what you propose with |
Oh, ok, sorry. Should I revert these commits and open a new PR then? |
Yes, if you don't mind. I think that will be better, cause otherwise we may end up with never ending story of commit-review cycle and never get anything merged. And it's going to be harder and harder to keep that PR mergeable to master. |
|
Sure, that makes sense. I'll revert the last changes. |
|
Ok. Let's try to close this one and go further |
* master: no volumes are needed, just run -v volume:/path/in/the/container (#10345) Fixed misstype (#10351) snap: prefix version and populate candidate channel (#10343) Bundle protocol and packet_id together in chain sync (#10315) role back docker build image and docker deploy image to ubuntu:xenial based (#10338) change docker image based on debian instead of ubuntu due to the chan… (#10336) Don't add discovery initiators to the node table (#10305) fix(docker): fix not receives SIGINT (#10059) snap: official image / test (#10168) fix(add helper for timestamp overflows) (#10330) Additional error for invalid gas (#10327) Revive parity_setMinGasPrice RPC call (#10294) Add Statetest support for Constantinople Fix (#10323) fix(parity-clib): grumbles that were not addressed in #9920 (#10154) fix(light-rpc): Make `light_sync` generic (#10238) fix publish job (#10317) Secure WS-RPC: grant access to all apis (#10246) Make specification of protocol in SyncRequester::send_request explicit (#10295)
The function
SyncRequester::send_requesthas a simple logic to match a givenpacket_idto its corresponding protocol. The logic does not seem to be robust, though, and expecting clients to provide the protocol themselves is not too much burden. If needed, we can still reimplement the matching logic separately.As a consequence,
SyncIOneeds no longer providesendandsend_protocol.Fixes #8605