Add node authority status metric (#4699)

* Check authority status on active leaves update

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* cargo changes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Fix tests

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Add metric for authority status

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Revert "Fix tests"

This reverts commit 5bd56bb367ec0b01ecca04498b3974ab67bf3189.

* Revert "cargo changes"

This reverts commit ffea18fe3ca12b27e6471ad9f44592799ec90956.

* Revert "Check authority status on active leaves update"

This reverts commit 55a30ac81bf32a72e0b79ca2e7bb612344a5c43d.

* Test fixups

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fix

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* update

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* undo damage

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* dont update status on runtime errors

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Fix tests

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fix inconsistency

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Review feedback

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Dont derive primitive Default

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* add dummy_session_info helper

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* unset parachain validator status if no longer authority

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* update

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* damn

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* 🤦

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
sandreim
2022-01-13 19:41:10 +02:00
committed by GitHub
parent 99dda4014c
commit 6e268a48f6
4 changed files with 196 additions and 3 deletions
@@ -126,7 +126,11 @@ async fn get_other_authorities_addrs_map() -> HashMap<AuthorityDiscoveryId, Hash
}
fn make_subsystem() -> GossipSupport<MockAuthorityDiscovery> {
GossipSupport::new(make_ferdie_keystore(), MOCK_AUTHORITY_DISCOVERY.clone())
GossipSupport::new(
make_ferdie_keystore(),
MOCK_AUTHORITY_DISCOVERY.clone(),
Metrics::new_dummy(),
)
}
fn test_harness<T: Future<Output = VirtualOverseer>, AD: AuthorityDiscovery>(
@@ -230,6 +234,7 @@ fn issues_a_connection_request_on_new_session() {
tx.send(Ok(1)).unwrap();
}
);
assert_matches!(
overseer_recv(overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
@@ -254,6 +259,17 @@ fn issues_a_connection_request_on_new_session() {
test_neighbors(overseer).await;
assert_matches!(
overseer_recv(overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
relay_parent,
RuntimeApiRequest::SessionInfo(1, sender),
)) => {
assert_eq!(relay_parent, hash);
sender.send(Ok(None)).unwrap();
}
);
virtual_overseer
});
@@ -296,6 +312,7 @@ fn issues_a_connection_request_on_new_session() {
tx.send(Ok(2)).unwrap();
}
);
assert_matches!(
overseer_recv(overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
@@ -320,6 +337,17 @@ fn issues_a_connection_request_on_new_session() {
test_neighbors(overseer).await;
assert_matches!(
overseer_recv(overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
relay_parent,
RuntimeApiRequest::SessionInfo(2, sender),
)) => {
assert_eq!(relay_parent, hash);
sender.send(Ok(None)).unwrap();
}
);
virtual_overseer
});
assert_eq!(state.last_session_index, Some(2));
@@ -378,6 +406,7 @@ fn issues_a_connection_request_when_last_request_was_mostly_unresolved() {
tx.send(Ok(1)).unwrap();
}
);
assert_matches!(
overseer_recv(overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
@@ -406,6 +435,17 @@ fn issues_a_connection_request_when_last_request_was_mostly_unresolved() {
test_neighbors(overseer).await;
assert_matches!(
overseer_recv(overseer).await,
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
relay_parent,
RuntimeApiRequest::SessionInfo(1, sender),
)) => {
assert_eq!(relay_parent, hash);
sender.send(Ok(None)).unwrap();
}
);
virtual_overseer
})
};