Skip to content

Conversation

@Aldorax
Copy link

@Aldorax Aldorax commented Jun 9, 2025


What Was Wrong?

The security tests (tests/core/security/test_security_multistream.py) were failing due to an AssertionError. This error arose because of a critical mismatch between what the perform_simple_test function was passing to its assertion_func, and what that assertion_func was designed to verify.

Specifically, the perform_simple_test function had been modified to pass the entire IMuxedConn object (e.g., a Yamux instance) to the assertion_func. However, the assertion_func itself was still structured to expect and perform type checks directly on an ISecureConn object (like InsecureSession or SecureSession). This meant isinstance(muxed_conn_object, InsecureSession) would always evaluate to False, triggering the assertion failure.


How Was It Fixed?

The resolution involved a precise, two-step reconciliation within the test file to ensure the assertions correctly target the secure connection type:

  1. Adjusted perform_simple_test (Existing Change):
    The perform_simple_test function now consistently passes the complete muxed_conn object (e.g., conn_0.muxed_conn and conn_1.muxed_conn) to the assertion_func. This provides the assertion logic with the full context of the multiplexed connection, allowing for more comprehensive testing if needed in the future.

  2. Updated assertion_func Logic (New Change):
    To correctly handle the muxed_conn object it now receives, the assertion_func within each test case (test_single_insecure_security_transport_succeeds and test_default_insecure_security) was modified. It now explicitly accesses the secured_conn attribute from the muxed_conn object before performing the type check. For instance, the assertion changed from assert isinstance(conn, transport_type) to assert isinstance(muxed_conn.secured_conn, transport_type). This ensures the isinstance check is performed precisely on the underlying secure session, which is the actual component whose type the test aims to verify.

By implementing these two changes, the AssertionError is resolved. The tests now accurately confirm the type of the established secure transport, maintaining the original intent of the test suite.


To-Do

Cute Animal Picture

image

arcinston and others added 30 commits May 19, 2025 16:54
fix:corrected argument-errors in peerId and Multiaddr in peer tests
…n, fix type hints, and comment out ClosedStream assertions
Signed-off-by: sukhman <sukhmansinghsaluja@gmail.com>
Signed-off-by: sukhman <sukhmansinghsaluja@gmail.com>
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
fix: add null checks for noise protocol initialization and key handling
@github-actions
Copy link

github-actions bot commented Jun 9, 2025

Typecheck Report (Comparison with main Branch Baseline)

  • Total errors in this PR: 0
  • Total errors in main branch baseline: 0

✅ No type errors in this PR and main baseline is also clean (or matches)!

Full list of errors in this PR
(No errors found in this PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants