Generic request/response infrastructure for Polkadot (#2352)
* Move NetworkBridgeEvent to subsystem::messages. It is not protocol related at all, it is in fact only part of the subsystem communication as it gets wrapped into messages of each subsystem. * Request/response infrastructure is taking shape. WIP: Does not compile. * Multiplexer variant not supported by Rusts type system. * request_response::request type checks. * Cleanup. * Minor fixes for request_response. * Implement request sending + move multiplexer. Request multiplexer is moved to bridge, as there the implementation is more straight forward as we can specialize on `AllMessages` for the multiplexing target. Sending of requests is mostly complete, apart from a few `From` instances. Receiving is also almost done, initializtion needs to be fixed and the multiplexer needs to be invoked. * Remove obsolete multiplexer. * Initialize bridge with multiplexer. * Finish generic request sending/receiving. Subsystems are now able to receive and send requests and responses via the overseer. * Doc update. * Fixes. * Link issue for not yet implemented code. * Fixes suggested by @ordian - thanks! - start encoding at 0 - don't crash on zero protocols - don't panic on not yet implemented request handling * Update node/network/protocol/src/request_response/v1.rs Use index 0 instead of 1. Co-authored-by:Andronik Ordian <write@reusable.software> * Update node/network/protocol/src/request_response.rs Co-authored-by:
Andronik Ordian <write@reusable.software> * Fix existing tests. * Better avoidance of division by zoro errors. * Doc fixes. * send_request -> start_request. * Fix missing renamings. * Update substrate. * Pass TryConnect instead of true. * Actually import `IfDisconnected`. * Fix wrong import. * Update node/network/bridge/src/lib.rs typo Co-authored-by:
Pierre Krieger <pierre.krieger1708@gmail.com> * Update node/network/bridge/src/multiplexer.rs Remove redundant import. Co-authored-by:
Pierre Krieger <pierre.krieger1708@gmail.com> * Stop doing tracing from within `From` instance. Thanks for the catch @tomaka ! * Get rid of redundant import. * Formatting cleanup. * Fix tests. * Add link to issue. * Clarify comments some more. * Fix tests. * Formatting fix. * tabs * Fix link Co-authored-by:
Bernhard Schuster <bernhard@ahoi.io> * Use map_err. Co-authored-by:
Bernhard Schuster <bernhard@ahoi.io> * Improvements inspired by suggestions by @drahnr. - Channel size is now determined by function. - Explicitely scope NetworkService::start_request. Co-authored-by:
Andronik Ordian <write@reusable.software> Co-authored-by:
Pierre Krieger <pierre.krieger1708@gmail.com> Co-authored-by:
Bernhard Schuster <bernhard@ahoi.io>
Showing
- polkadot/Cargo.lock 141 additions, 139 deletionspolkadot/Cargo.lock
- polkadot/node/network/approval-distribution/src/lib.rs 2 additions, 2 deletionspolkadot/node/network/approval-distribution/src/lib.rs
- polkadot/node/network/availability-distribution/src/lib.rs 11 additions, 2 deletionspolkadot/node/network/availability-distribution/src/lib.rs
- polkadot/node/network/availability-recovery/src/lib.rs 2 additions, 1 deletionpolkadot/node/network/availability-recovery/src/lib.rs
- polkadot/node/network/availability-recovery/src/tests.rs 1 addition, 1 deletionpolkadot/node/network/availability-recovery/src/tests.rs
- polkadot/node/network/bitfield-distribution/src/lib.rs 3 additions, 3 deletionspolkadot/node/network/bitfield-distribution/src/lib.rs
- polkadot/node/network/bridge/Cargo.toml 1 addition, 0 deletionspolkadot/node/network/bridge/Cargo.toml
- polkadot/node/network/bridge/src/action.rs 51 additions, 21 deletionspolkadot/node/network/bridge/src/action.rs
- polkadot/node/network/bridge/src/lib.rs 90 additions, 31 deletionspolkadot/node/network/bridge/src/lib.rs
- polkadot/node/network/bridge/src/multiplexer.rs 132 additions, 0 deletionspolkadot/node/network/bridge/src/multiplexer.rs
- polkadot/node/network/bridge/src/network.rs 33 additions, 6 deletionspolkadot/node/network/bridge/src/network.rs
- polkadot/node/network/collator-protocol/src/collator_side.rs 2 additions, 2 deletionspolkadot/node/network/collator-protocol/src/collator_side.rs
- polkadot/node/network/collator-protocol/src/validator_side.rs 2 additions, 1 deletion...adot/node/network/collator-protocol/src/validator_side.rs
- polkadot/node/network/pov-distribution/src/lib.rs 2 additions, 2 deletionspolkadot/node/network/pov-distribution/src/lib.rs
- polkadot/node/network/protocol/Cargo.toml 1 addition, 0 deletionspolkadot/node/network/protocol/Cargo.toml
- polkadot/node/network/protocol/src/lib.rs 4 additions, 43 deletionspolkadot/node/network/protocol/src/lib.rs
- polkadot/node/network/protocol/src/peer_set.rs 2 additions, 1 deletionpolkadot/node/network/protocol/src/peer_set.rs
- polkadot/node/network/protocol/src/request_response.rs 119 additions, 0 deletionspolkadot/node/network/protocol/src/request_response.rs
- polkadot/node/network/protocol/src/request_response/request.rs 209 additions, 0 deletions...dot/node/network/protocol/src/request_response/request.rs
- polkadot/node/network/protocol/src/request_response/v1.rs 44 additions, 0 deletionspolkadot/node/network/protocol/src/request_response/v1.rs
Please register or sign in to comment