Replace `Multiaddr` & related types with substrate-specific types (#4198)
This PR introduces custom types / substrate wrappers for `Multiaddr`, `multiaddr::Protocol`, `Multihash`, `ed25519::*` and supplementary types like errors and iterators. This is needed to unblock `libp2p` upgrade PR https://github.com/paritytech/polkadot-sdk/pull/1631 after https://github.com/paritytech/polkadot-sdk/pull/2944 was merged. `libp2p` and `litep2p` currently depend on different versions of `multiaddr` crate, and introduction of this "common ground" types is needed to support independent version upgrades of `multiaddr` and dependent crates in `libp2p` & `litep2p`. While being just convenient to not tie versions of `libp2p` & `litep2p` dependencies together, it's currently not even possible to keep `libp2p` & `litep2p` dependencies updated to the same versions as `multiaddr` in `libp2p` depends on `libp2p-identity` that we can't include as a dependency of `litep2p`, which has it's own `PeerId` type. In the future, to keep things updated on `litep2p` side, we will likely need to fork `multiaddr` and make it use `litep2p` `PeerId` as a payload of `/p2p/...` protocol. With these changes, common code in substrate uses these custom types, and `litep2p` & `libp2p` backends use corresponding libraries types.
Showing
- Cargo.lock 9 additions, 6 deletionsCargo.lock
- prdoc/pr_4198.prdoc 31 additions, 0 deletionsprdoc/pr_4198.prdoc
- substrate/client/authority-discovery/src/error.rs 2 additions, 2 deletionssubstrate/client/authority-discovery/src/error.rs
- substrate/client/authority-discovery/src/worker.rs 4 additions, 2 deletionssubstrate/client/authority-discovery/src/worker.rs
- substrate/client/authority-discovery/src/worker/addr_cache.rs 1 addition, 1 deletion...trate/client/authority-discovery/src/worker/addr_cache.rs
- substrate/client/authority-discovery/src/worker/tests.rs 7 additions, 3 deletionssubstrate/client/authority-discovery/src/worker/tests.rs
- substrate/client/cli/src/params/node_key_params.rs 3 additions, 7 deletionssubstrate/client/cli/src/params/node_key_params.rs
- substrate/client/mixnet/src/sync_with_runtime.rs 4 additions, 3 deletionssubstrate/client/mixnet/src/sync_with_runtime.rs
- substrate/client/network/src/config.rs 15 additions, 23 deletionssubstrate/client/network/src/config.rs
- substrate/client/network/src/error.rs 1 addition, 1 deletionsubstrate/client/network/src/error.rs
- substrate/client/network/src/lib.rs 5 additions, 1 deletionsubstrate/client/network/src/lib.rs
- substrate/client/network/src/litep2p/discovery.rs 3 additions, 4 deletionssubstrate/client/network/src/litep2p/discovery.rs
- substrate/client/network/src/litep2p/mod.rs 25 additions, 24 deletionssubstrate/client/network/src/litep2p/mod.rs
- substrate/client/network/src/litep2p/service.rs 13 additions, 11 deletionssubstrate/client/network/src/litep2p/service.rs
- substrate/client/network/src/peer_store.rs 2 additions, 1 deletionsubstrate/client/network/src/peer_store.rs
- substrate/client/network/src/protocol/notifications/service/mod.rs 1 addition, 1 deletion.../client/network/src/protocol/notifications/service/mod.rs
- substrate/client/network/src/protocol/notifications/service/tests.rs 1 addition, 1 deletion...lient/network/src/protocol/notifications/service/tests.rs
- substrate/client/network/src/protocol_controller.rs 4 additions, 5 deletionssubstrate/client/network/src/protocol_controller.rs
- substrate/client/network/src/service.rs 49 additions, 34 deletionssubstrate/client/network/src/service.rs
- substrate/client/network/src/service/traits.rs 2 additions, 2 deletionssubstrate/client/network/src/service/traits.rs
Please register or sign in to comment