Skip to content

feat: dynamically populate nodeinfo#663

Closed
jking-aus wants to merge 9 commits intosigp:release-v1.0.0from
jking-aus:handshake-subnet
Closed

feat: dynamically populate nodeinfo#663
jking-aus wants to merge 9 commits intosigp:release-v1.0.0from
jking-aus:handshake-subnet

Conversation

@jking-aus
Copy link
Member

@jking-aus jking-aus commented Oct 8, 2025

Issue Addressed

Addresses #645

Proposed Changes

Gets required subnets from peermanager and updates the handshake
Gets node versions on startup and errors if not present

Additional Info

Will add preferences for own subets in peer selection

@jking-aus jking-aus added network metrics v1.0.0 First Mainnet-release labels Oct 8, 2025
@jking-aus jking-aus requested a review from AgeManning October 8, 2025 04:41
@jking-aus jking-aus changed the title Handshake subnet Feat: calculate handshake subnet Oct 8, 2025
@jking-aus jking-aus changed the title Feat: calculate handshake subnet feat: calculate handshake subnet Oct 8, 2025
@jking-aus jking-aus changed the title feat: calculate handshake subnet feat: dynamically populate nodeinfo Oct 8, 2025
@jking-aus jking-aus marked this pull request as draft October 8, 2025 07:19
Copy link
Member

@dknopik dknopik left a comment

Choose a reason for hiding this comment

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

I don't see how this mechanism of updating the subnets in our metadata (generating it anytime ti is needed) is superior to our current approach (updating it as we subscribe/unsubscribe to subnets)

Comment on lines +797 to +802
/// Fetches node version information from beacon and execution nodes
async fn fetch_node_versions<T: SlotClock>(
beacon_nodes: &BeaconNodeFallback<T>,
execution_http_urls: &[SensitiveUrl],
execution_ws_url: &SensitiveUrl,
) -> Result<(String, String), String> {
Copy link
Member

Choose a reason for hiding this comment

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

IMO it is unclear if we actually want to do this. e.g. Go-SSV just leaves the node version in the handshake empty

Comment on lines +9 to +29
pub static HANDSHAKE_SUCCESSFUL: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
try_create_int_counter(
"libp2p_handshake_successful_total",
"Total count of successful handshakes",
)
});

pub static HANDSHAKE_FAILED: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
try_create_int_counter(
"libp2p_handshake_failed_total",
"Total count of failed handshakes",
)
});

pub static HANDSHAKE_SUBNET_MATCHES: LazyLock<Result<IntGaugeVec>> = LazyLock::new(|| {
try_create_int_gauge_vec(
"libp2p_handshake_subnet_matches",
"Count of successful handshakes by number of matching subnets",
&["match_count"],
)
});
Copy link
Member

Choose a reason for hiding this comment

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

Metrics for the handshake is not really what this PR advertises to do, please open a separate PR

Comment on lines +146 to +148
// Get initial subnets from peer_manager and populate metadata
let mut node_metadata = node_metadata;
node_metadata.subnets = subnets_to_hex(behaviour.peer_manager.needed_subnets());
Copy link
Member

Choose a reason for hiding this comment

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

this will effectively set the same, all empty subnet string as before, as the peer_manager will have no needed subnets until the subnet tracker sends join events.

@jking-aus
Copy link
Member Author

I don't see how this mechanism of updating the subnets in our metadata (generating it anytime ti is needed) is superior to our current approach (updating it as we subscribe/unsubscribe to subnets)

It’s not - close this if that’s happening already.

@dknopik dknopik closed this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metrics network v1.0.0 First Mainnet-release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants