Skip to content

Comments

fix: Re-add node version to Handshake completed#697

Merged
mergify[bot] merged 1 commit intosigp:release-v1.0.0from
dknopik:fix-readd-node-version
Oct 19, 2025
Merged

fix: Re-add node version to Handshake completed#697
mergify[bot] merged 1 commit intosigp:release-v1.0.0from
dknopik:fix-readd-node-version

Conversation

@dknopik
Copy link
Member

@dknopik dknopik commented Oct 17, 2025

Issue Addressed

In rc.1, we (accidentally?) removed logging the node version after a completed handshake.

Proposed Changes

This info is very useful for debugging, e.g. if we see repeated invalid messages from a certain peer and we want to know what software sent those messages. This PR readds the field.

@dknopik dknopik requested a review from petarjuki7 October 17, 2025 14:39
@dknopik dknopik added logging v1.0.0 First Mainnet-release labels Oct 17, 2025
@claude-code-actions-sigp
Copy link

claude-code-actions-sigp bot commented Oct 17, 2025

Claude finished @dknopik's task —— View job


Code Review Complete

Todo List

  • Read the modified file to understand the context
  • Review the changes against base branch
  • Analyze code quality, security, performance, testing, and documentation
  • Provide comprehensive feedback

Summary

This PR re-adds the node_version field to the debug log statement after a successful handshake. The change is simple, focused, and addresses the stated issue effectively.

Review Findings

Code Quality ✅

  • Clean and minimal: The change adds exactly one field to an existing structured logging statement
  • Consistent with existing code: Follows the same pattern as other fields (our_subnets, their_subnets, matching_subnets)
  • Proper formatting: Uses the % format specifier for structured logging, consistent with tracing/slog patterns

Security ✅

  • No security concerns: Logging node version information is safe and commonly used for debugging
  • No sensitive data exposure: Node version is public metadata already exchanged during handshake

Performance ✅

  • Negligible impact: Adding one field to an existing debug log has no measurable performance impact
  • Debug-level logging: This only executes when debug logging is enabled and after successful handshake (not in hot path)

Context and Design

The change is in the record_handshake_subnet_match_metrics() method at anchor/network/src/network.rs:583. This method is called after a successful handshake to:

  1. Count matching subnets between local and remote peers
  2. Log handshake completion details for debugging
  3. Record metrics about subnet matches

The node_version field is already available in their_metadata.node_version (from NodeMetadata struct) and was previously logged before rc.1. This PR correctly restores that field.

Testing Considerations ⚠️

While the change itself is correct, there are no tests for this logging behavior. Consider:

  • The logging occurs in production code path (record_handshake_subnet_match_metrics)
  • There are no unit tests verifying the log output format
  • This is typical for logging code, but structured log assertions could be valuable

Recommendation: Not blocking for this PR, but consider adding integration tests that verify handshake logging behavior in the future, especially for critical debugging information.

Documentation ✅

  • Clear PR description: The rationale (useful for debugging invalid messages) is well explained
  • Self-documenting code: The field name node_version is clear and matches the struct field name

Recommendation

Approve - This is a straightforward fix that restores useful debugging information. The change is:

  • Minimal and focused
  • Low risk
  • Valuable for operational debugging
  • Consistent with existing patterns

No changes needed before merge.


Copy link
Member

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

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

yep

@mergify mergify bot merged commit 48c4ac8 into sigp:release-v1.0.0 Oct 19, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants