Skip to content

Conversation

@RolandSherwin
Copy link
Member

Ontop of #3268. This PR is just the implementation of the reachability module. The actual integration with antctl, antnode and launchpad will be done as separate PRs.

This workflow checks if a node can receive direct inbound connections from other peers on the network. If a node can't receive connections, it won't be able to participate in the network properly, so we prevent it from starting.

The workflow tries one network listener at a time, with up to 3 attempts per listener:

  1. Bind to a listener.
  2. Dial out to 7 bootstrap peers concurrently
  3. Each peer that connects dials us back after 180 seconds
  4. If we get 4+ matching dial-backs, we're reachable
  5. If it fails, retry up to 2 more times on the same listener
  6. If all 3 attempts fail, move to the next listener and start over

@RolandSherwin RolandSherwin force-pushed the reach/3_reachabiliyt_module branch from 7c3836c to 12fa5fb Compare October 24, 2025 08:51
use futures::channel::oneshot;
use igd_next::SearchOptions;
use std::error::Error;
use std::net::IpAddr;

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
fn test_reachability_status_not_reachable_without_upnp() {
let mut reason_map = std::collections::HashMap::new();
let _ = reason_map.insert(
("127.0.0.1:8080".parse().unwrap(), false),

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
fn test_reachability_status_not_reachable_with_upnp() {
let mut reason_map = std::collections::HashMap::new();
let _ = reason_map.insert(
("127.0.0.1:8080".parse().unwrap(), true),

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production

let mut reason_map1 = std::collections::HashMap::new();
let _ = reason_map1.insert(
("127.0.0.1:8080".parse().unwrap(), true),

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
);
let mut reason_map2 = std::collections::HashMap::new();
let _ = reason_map2.insert(
("127.0.0.1:8080".parse().unwrap(), false),

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
integration
- Split the `async fn Bootstrap::new` method into two methods, where the `new`
  is made a "sync" method and `async fn new_with_preloaded_addrs` retains the
  same functionality as the old new method.
- The `new_with_preloaded_addrs` method is only required inside clients which
  tries to pre-populate its RT before starting the libp2p driver.
- Introduces `is_addr_queue_empty`, as it will be used by the reachability
  check implementation
- Deprecate `try_next_dial_addr` as it is just a copy of `next_addr`
@RolandSherwin RolandSherwin force-pushed the reach/3_reachabiliyt_module branch from 12fa5fb to 9032fca Compare October 28, 2025 03:32
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

devskim found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@RolandSherwin RolandSherwin changed the base branch from main to reachability October 31, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant