mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Prepare for network protocol version upgrades (#5084)
* explicitly tag network requests with version * fmt * make PeerSet more aware of versioning * some generalization of the network bridge to support upgrades * walk back some renaming * walk back some version stuff * extract version from fallback * remove V1 from NetworkBridgeUpdate * add accidentally-removed timer * implement focusing for versioned messages * fmt * fix up network bridge & tests * remove inaccurate version check in bridge * remove some TODO [now]s * fix fallout in statement distribution * fmt * fallout in gossip-support * fix fallout in collator-protocol * fix fallout in bitfield-distribution * fix fallout in approval-distribution * fmt * use never! * fmt
This commit is contained in:
@@ -29,7 +29,7 @@ use sc_network::{
|
||||
use polkadot_node_network_protocol::{
|
||||
peer_set::PeerSet,
|
||||
request_response::{OutgoingRequest, Recipient, Requests},
|
||||
PeerId, UnifiedReputationChange as Rep,
|
||||
PeerId, ProtocolVersion, UnifiedReputationChange as Rep,
|
||||
};
|
||||
use polkadot_primitives::v2::{AuthorityDiscoveryId, Block, Hash};
|
||||
|
||||
@@ -46,6 +46,7 @@ pub(crate) fn send_message<M>(
|
||||
net: &mut impl Network,
|
||||
mut peers: Vec<PeerId>,
|
||||
peer_set: PeerSet,
|
||||
version: ProtocolVersion,
|
||||
message: M,
|
||||
metrics: &super::Metrics,
|
||||
) where
|
||||
@@ -53,7 +54,7 @@ pub(crate) fn send_message<M>(
|
||||
{
|
||||
let message = {
|
||||
let encoded = message.encode();
|
||||
metrics.on_notification_sent(peer_set, encoded.len(), peers.len());
|
||||
metrics.on_notification_sent(peer_set, version, encoded.len(), peers.len());
|
||||
encoded
|
||||
};
|
||||
|
||||
@@ -131,14 +132,18 @@ impl Network for Arc<NetworkService<Block, Hash>> {
|
||||
}
|
||||
|
||||
fn disconnect_peer(&self, who: PeerId, peer_set: PeerSet) {
|
||||
sc_network::NetworkService::disconnect_peer(&**self, who, peer_set.into_protocol_name());
|
||||
sc_network::NetworkService::disconnect_peer(
|
||||
&**self,
|
||||
who,
|
||||
peer_set.into_default_protocol_name(),
|
||||
);
|
||||
}
|
||||
|
||||
fn write_notification(&self, who: PeerId, peer_set: PeerSet, message: Vec<u8>) {
|
||||
sc_network::NetworkService::write_notification(
|
||||
&**self,
|
||||
who,
|
||||
peer_set.into_protocol_name(),
|
||||
peer_set.into_default_protocol_name(),
|
||||
message,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user