mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 12:25:51 +00:00
gossip-support: add unittests for update authorities (#3258)
~The previous fix was actually incomplete because we update the authorties only on the situation where we decided to reconnect because we had a low connectivity issue. Now the problem is that update_authority_ids use the list of connected peers, so on restart that does contain anything, so calling immediately after issue_connection_request won't detect all authorities, so we need to also check every block as the comment said, but that did not match the code.~ Actually the fix was correct the flow is follow if more than 1/3 of the authorities can not be resolved we set last_failure and call `ConnectToResolvedValidators`. We will call UpdateAuthorities for all the authorities already connected and for which we already know the address and for the ones that will connect later on `PeerConnected` will have the AuthorityId field set, because it is already known, so approval-distribution will update its cache topology. --------- Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io> Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b78c72cf9c
commit
197c6cf9e0
@@ -63,8 +63,12 @@ use metrics::Metrics;
|
||||
const LOG_TARGET: &str = "parachain::gossip-support";
|
||||
// How much time should we wait to reissue a connection request
|
||||
// since the last authority discovery resolution failure.
|
||||
#[cfg(not(test))]
|
||||
const BACKOFF_DURATION: Duration = Duration::from_secs(5);
|
||||
|
||||
#[cfg(test)]
|
||||
const BACKOFF_DURATION: Duration = Duration::from_millis(500);
|
||||
|
||||
/// Duration after which we consider low connectivity a problem.
|
||||
///
|
||||
/// Especially at startup low connectivity is expected (authority discovery cache needs to be
|
||||
@@ -271,8 +275,8 @@ where
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
// authority_discovery is just a cache so let's try every leaf to detect if there
|
||||
// are new authorities there.
|
||||
// authority_discovery is just a cache so let's try every time we try to re-connect
|
||||
// if new authorities are present.
|
||||
self.update_authority_ids(sender, session_info.discovery_keys).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user