Add WiFi-Direct survival test for BLE MAC rotation - #146
Open
BigNathan1 wants to merge 2 commits into
Open
Conversation
Issue StellarConduit#117 requires a test asserting that notify_mac_rotated() drops BLE connections while preserving WiFi-Direct connections, since WiFi-Direct links do not reference the BLE MAC address. The merged implementation only covered the BLE-drop path (test_notify_mac_rotated_drops_ble_connections) and never asserted that WiFi-Direct connections are retained. Add test_notify_mac_rotated_drops_ble_keeps_wifi, which injects one BLE connection and one WiFi-Direct connection, invokes notify_mac_rotated(), and asserts the BLE connection is removed, the WiFi-Direct connection remains, and peer_count is decremented only for the dropped BLE link.
The base branch does not currently compile, which blocks every CI job
(fmt, clippy, tests) before it can evaluate this PR. Two unrelated
breakages were introduced by an earlier merge:
- Cargo.toml declared the `reqwest` dependency twice (0.12 and 0.11),
causing `cargo metadata` to abort with "duplicate key" and failing
fmt/clippy/test invocations immediately.
- src/relay/rpc_client.rs contained an orphaned `impl RpcClient { ... }`
block referencing types that do not exist in the file
(SorobanRpcRequest, SendTxParams, RpcClient), leaving an unclosed
delimiter and a parse error. The real implementation in this file is
`impl StellarRpcClient for HorizonRpcClient`.
Remove the duplicate `reqwest` entry (keeping the 0.12 rustls-tls
declaration) and delete the orphaned `impl RpcClient` block. No compiled
code references the removed symbols; the crate now builds, formats, and
passes clippy --all-targets --all-features -- -D warnings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #117
Summary
Issue #117 (BLE MAC Address Randomization) defines a set of required tests. The core feature landed in PR #144, but that PR linked
closes #38(the parent privacy issue) rather than #117, and it did not include one of the required tests. This PR adds the missing test so the final acceptance criterion is actually verified, and links the issue.It also repairs two unrelated breakages on the base branch that currently prevent CI from compiling the crate at all (see "Build fix" below).
Gap addressed (#117)
Issue #117 requires the following test under "Required Tests":
and the matching acceptance criterion:
The merged implementation only added
test_notify_mac_rotated_drops_ble_connections, which inserts two BLE connections and asserts both are dropped. No test exercised a WiFi-Direct connection, so the "WiFi-Direct connections survive a MAC rotation" guarantee was never verified. A regression that accidentally widenednotify_mac_rotated()to drop non-BLE connections would not have been caught.Change
Adds
test_notify_mac_rotated_drops_ble_keeps_wifito thetransport::unifiedtest module:BleCentralconnection (TransportType::Ble) and one self-contained mock connection reportingTransportType::WifiDirect.notify_mac_rotated().peer_countis decremented only for the dropped BLE link.The mock WiFi connection is defined locally inside the test, so no shared test helpers are modified.
Build fix
The base branch does not currently compile, which blocks every CI job (fmt, clippy, tests) before it can evaluate the test above. Two unrelated breakages were introduced by an earlier merge:
Cargo.tomldeclared thereqwestdependency twice (0.12 and 0.11), socargo metadataaborted with "duplicate key" and fmt/clippy/test failed immediately. Removed the stale 0.11 entry, keeping the 0.12rustls-tlsdeclaration.src/relay/rpc_client.rscontained an orphanedimpl RpcClient { ... }block referencing types that do not exist in the file (SorobanRpcRequest,SendTxParams,RpcClient), leaving an unclosed delimiter and a parse error. The real implementation in this file isimpl StellarRpcClient for HorizonRpcClient. Removed the orphaned block; no compiled code references the deleted symbols.Testing
All pass. The new test passes specifically: