mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 15:27:57 +00:00
Rework priority groups, take 2 (#7700)
* Rework priority groups * Broken tests fix * Fix warning causing CI to fail * [Hack] Try restore backwards-compatibility * Fix peerset bug * Doc fixes and clean up * Error on state mismatch * Try debug CI * CI debugging * [CI debug] Can I please see this line * Revert "[CI debug] Can I please see this line" This reverts commit 4b7cf7c1511f579cd818b21d46bd11642dfac5cb. * Revert "CI debugging" This reverts commit 9011f1f564b860386dc7dd6ffa9fc34ea7107623. * Fix error! which isn't actually an error * Fix Ok() returned when actually Err() * Tweaks and fixes * Fix build * Peerset bugfix * [Debug] Try outbound GrandPa slots * Another bugfix * Revert "[Debug] Try outbound GrandPa slots" This reverts commit d175b9208c088faad77d9f0ce36ff6f48bd92dd3. * [Debug] Try outbound GrandPa slots * Apply suggestions from code review Co-authored-by: Max Inden <mail@max-inden.de> * Use consts for hardcoded peersets * Revert "Try debug CI" This reverts commit 62c4ad5e79c03d561c714a008022ecac463a597e. * Renames * Line widths * Add doc Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@@ -227,6 +227,16 @@ impl Metrics {
|
||||
.with_label_values(&["dht", "sent", name])
|
||||
.inc_by(num);
|
||||
}
|
||||
Event::SyncConnected { .. } => {
|
||||
self.events_total
|
||||
.with_label_values(&["sync-connected", "sent", name])
|
||||
.inc_by(num);
|
||||
}
|
||||
Event::SyncDisconnected { .. } => {
|
||||
self.events_total
|
||||
.with_label_values(&["sync-disconnected", "sent", name])
|
||||
.inc_by(num);
|
||||
}
|
||||
Event::NotificationStreamOpened { protocol, .. } => {
|
||||
self.events_total
|
||||
.with_label_values(&[&format!("notif-open-{:?}", protocol), "sent", name])
|
||||
@@ -257,6 +267,16 @@ impl Metrics {
|
||||
.with_label_values(&["dht", "received", name])
|
||||
.inc();
|
||||
}
|
||||
Event::SyncConnected { .. } => {
|
||||
self.events_total
|
||||
.with_label_values(&["sync-connected", "received", name])
|
||||
.inc();
|
||||
}
|
||||
Event::SyncDisconnected { .. } => {
|
||||
self.events_total
|
||||
.with_label_values(&["sync-disconnected", "received", name])
|
||||
.inc();
|
||||
}
|
||||
Event::NotificationStreamOpened { protocol, .. } => {
|
||||
self.events_total
|
||||
.with_label_values(&[&format!("notif-open-{:?}", protocol), "received", name])
|
||||
|
||||
@@ -141,19 +141,31 @@ fn build_nodes_one_proto()
|
||||
let listen_addr = config::build_multiaddr![Memory(rand::random::<u64>())];
|
||||
|
||||
let (node1, events_stream1) = build_test_full_node(config::NetworkConfiguration {
|
||||
notifications_protocols: vec![PROTOCOL_NAME],
|
||||
extra_sets: vec![
|
||||
config::NonDefaultSetConfig {
|
||||
notifications_protocol: PROTOCOL_NAME,
|
||||
set_config: Default::default()
|
||||
}
|
||||
],
|
||||
listen_addresses: vec![listen_addr.clone()],
|
||||
transport: config::TransportConfig::MemoryOnly,
|
||||
.. config::NetworkConfiguration::new_local()
|
||||
});
|
||||
|
||||
let (node2, events_stream2) = build_test_full_node(config::NetworkConfiguration {
|
||||
notifications_protocols: vec![PROTOCOL_NAME],
|
||||
extra_sets: vec![
|
||||
config::NonDefaultSetConfig {
|
||||
notifications_protocol: PROTOCOL_NAME,
|
||||
set_config: config::SetConfig {
|
||||
reserved_nodes: vec![config::MultiaddrWithPeerId {
|
||||
multiaddr: listen_addr,
|
||||
peer_id: node1.local_peer_id().clone(),
|
||||
}],
|
||||
.. Default::default()
|
||||
}
|
||||
}
|
||||
],
|
||||
listen_addresses: vec![],
|
||||
reserved_nodes: vec![config::MultiaddrWithPeerId {
|
||||
multiaddr: listen_addr,
|
||||
peer_id: node1.local_peer_id().clone(),
|
||||
}],
|
||||
transport: config::TransportConfig::MemoryOnly,
|
||||
.. config::NetworkConfiguration::new_local()
|
||||
});
|
||||
@@ -205,10 +217,10 @@ fn notifications_state_consistent() {
|
||||
|
||||
// Also randomly disconnect the two nodes from time to time.
|
||||
if rand::random::<u8>() % 20 == 0 {
|
||||
node1.disconnect_peer(node2.local_peer_id().clone());
|
||||
node1.disconnect_peer(node2.local_peer_id().clone(), PROTOCOL_NAME);
|
||||
}
|
||||
if rand::random::<u8>() % 20 == 0 {
|
||||
node2.disconnect_peer(node1.local_peer_id().clone());
|
||||
node2.disconnect_peer(node1.local_peer_id().clone(), PROTOCOL_NAME);
|
||||
}
|
||||
|
||||
// Grab next event from either `events_stream1` or `events_stream2`.
|
||||
@@ -279,6 +291,10 @@ fn notifications_state_consistent() {
|
||||
}
|
||||
|
||||
// Add new events here.
|
||||
future::Either::Left(Event::SyncConnected { .. }) => {}
|
||||
future::Either::Right(Event::SyncConnected { .. }) => {}
|
||||
future::Either::Left(Event::SyncDisconnected { .. }) => {}
|
||||
future::Either::Right(Event::SyncDisconnected { .. }) => {}
|
||||
future::Either::Left(Event::Dht(_)) => {}
|
||||
future::Either::Right(Event::Dht(_)) => {}
|
||||
};
|
||||
@@ -291,9 +307,16 @@ fn lots_of_incoming_peers_works() {
|
||||
let listen_addr = config::build_multiaddr![Memory(rand::random::<u64>())];
|
||||
|
||||
let (main_node, _) = build_test_full_node(config::NetworkConfiguration {
|
||||
notifications_protocols: vec![PROTOCOL_NAME],
|
||||
listen_addresses: vec![listen_addr.clone()],
|
||||
in_peers: u32::max_value(),
|
||||
extra_sets: vec![
|
||||
config::NonDefaultSetConfig {
|
||||
notifications_protocol: PROTOCOL_NAME,
|
||||
set_config: config::SetConfig {
|
||||
in_peers: u32::max_value(),
|
||||
.. Default::default()
|
||||
},
|
||||
}
|
||||
],
|
||||
transport: config::TransportConfig::MemoryOnly,
|
||||
.. config::NetworkConfiguration::new_local()
|
||||
});
|
||||
@@ -308,12 +331,19 @@ fn lots_of_incoming_peers_works() {
|
||||
let main_node_peer_id = main_node_peer_id.clone();
|
||||
|
||||
let (_dialing_node, event_stream) = build_test_full_node(config::NetworkConfiguration {
|
||||
notifications_protocols: vec![PROTOCOL_NAME],
|
||||
listen_addresses: vec![],
|
||||
reserved_nodes: vec![config::MultiaddrWithPeerId {
|
||||
multiaddr: listen_addr.clone(),
|
||||
peer_id: main_node_peer_id.clone(),
|
||||
}],
|
||||
extra_sets: vec![
|
||||
config::NonDefaultSetConfig {
|
||||
notifications_protocol: PROTOCOL_NAME,
|
||||
set_config: config::SetConfig {
|
||||
reserved_nodes: vec![config::MultiaddrWithPeerId {
|
||||
multiaddr: listen_addr.clone(),
|
||||
peer_id: main_node_peer_id.clone(),
|
||||
}],
|
||||
.. Default::default()
|
||||
},
|
||||
}
|
||||
],
|
||||
transport: config::TransportConfig::MemoryOnly,
|
||||
.. config::NetworkConfiguration::new_local()
|
||||
});
|
||||
@@ -475,7 +505,10 @@ fn ensure_reserved_node_addresses_consistent_with_transport_memory() {
|
||||
let _ = build_test_full_node(config::NetworkConfiguration {
|
||||
listen_addresses: vec![listen_addr.clone()],
|
||||
transport: config::TransportConfig::MemoryOnly,
|
||||
reserved_nodes: vec![reserved_node],
|
||||
default_peers_set: config::SetConfig {
|
||||
reserved_nodes: vec![reserved_node],
|
||||
.. Default::default()
|
||||
},
|
||||
.. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None)
|
||||
});
|
||||
}
|
||||
@@ -491,7 +524,10 @@ fn ensure_reserved_node_addresses_consistent_with_transport_not_memory() {
|
||||
|
||||
let _ = build_test_full_node(config::NetworkConfiguration {
|
||||
listen_addresses: vec![listen_addr.clone()],
|
||||
reserved_nodes: vec![reserved_node],
|
||||
default_peers_set: config::SetConfig {
|
||||
reserved_nodes: vec![reserved_node],
|
||||
.. Default::default()
|
||||
},
|
||||
.. config::NetworkConfiguration::new("test-node", "test-client", Default::default(), None)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user