Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIER1 implementation #8141

Merged
merged 11 commits into from Dec 5, 2022
Merged

TIER1 implementation #8141

merged 11 commits into from Dec 5, 2022

Conversation

pompon0
Copy link
Contributor

@pompon0 pompon0 commented Nov 30, 2022

Implemented TIER1 connections:

  • added TIER1 support to PeerActor
  • added logic connecting a TIER1 node to its proxies before broadcasting its AccountData.
  • added logic making TIER1 nodes connect to other TIER1 nodes (or proxies) based on the collected AccountData.
  • made TIER1 nodes send some specific message types over TIER1 connections (with a fallback to TIER2).
  • made TIER1 proxies route the TIER1 messages.
  • added e2e tests of the TIER1 functionality

Monitoring of the TIER1 performance will come in the next PR.

@pompon0 pompon0 marked this pull request as ready for review December 1, 2022 10:48
@pompon0 pompon0 requested a review from a team as a code owner December 1, 2022 10:48
chain/network/src/config.rs Outdated Show resolved Hide resolved
@@ -67,9 +68,23 @@ impl ValidatorConfig {

#[derive(Clone)]
pub struct Tier1 {
/// Interval between attempts to connect to proxies of other TIER1 nodes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW - if we fail to connect to a given validator - do we keep retrying forever or do we give up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we keep retrying forever.

chain/network/src/config_json.rs Show resolved Hide resolved
chain/network/src/peer/peer_actor.rs Outdated Show resolved Hide resolved

// Override force_encoding for outbound Tier1 connections,
// since Tier1Handshake is supported only with proto encoding.
let force_encoding = match &stream.type_ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still use forced encoding anywhere?

(as I don't like the fact that we're overwriting it silently here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in tests.

chain/network/src/peer_manager/network_state/tier1.rs Outdated Show resolved Hide resolved
chain/network/src/peer_manager/network_state/tier1.rs Outdated Show resolved Hide resolved
@@ -77,4 +179,147 @@ impl super::NetworkState {
self.config.event_sink.push(Event::Tier1AdvertiseProxies(new_data.clone()));
new_data
}

/// Closes TIER1 connections from nodes which are not TIER1 any more.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: this part is not reviewed yet.

chain/network/src/peer_manager/tests/tier1.rs Show resolved Hide resolved
@pompon0 pompon0 requested a review from mm-near December 2, 2022 14:34
// Direct TIER1 connections have priority.
for key in &accounts_data.keys {
if let Some(conn) = tier1.ready_by_account_key.get(&key) {
safe.insert(key, &conn.peer_info.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what should happen if validator_cfg is None?

should we still add these connections to the safe set?

I see that you do multiple times 'if Some(vc) = validator_cfg -- shouldn't we do this verification at the beginning of the method (and AFAIK - if validator_cfg is None- simply close all the connections and be done?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, TIER1 proxies are not TIER1 nodes, but they also accept TIER1 connections.

chain/network/src/peer_manager/network_state/tier1.rs Outdated Show resolved Hide resolved
chain/network/src/peer_manager/tests/tier1.rs Outdated Show resolved Hide resolved
chain/network/src/peer_manager/tests/tier1.rs Show resolved Hide resolved
chain/network/src/config.rs Outdated Show resolved Hide resolved
@pompon0 pompon0 added S-automerge T-SRE Team: issues relevant to the SRE team labels Dec 5, 2022
@near-bulldozer near-bulldozer bot merged commit 03eb0d6 into master Dec 5, 2022
@near-bulldozer near-bulldozer bot deleted the gprusak-tier1-core branch December 5, 2022 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-SRE Team: issues relevant to the SRE team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants