Add repeater echo tracking via rx_log correlation with message content verification#60
Conversation
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
|
@copilot ## Channel Ping Repeater Echo Validation Specification This document is a validation and reference guide intended to help an AI agent verify the correctness of its packet parsing, payload decoding, and repeater echo correlation logic. ScopeThis specification applies to:
Channel Metadata (Validation Target)All example packets below originate from the same channel and must decode consistently. Channel Name: #wardriving Only packets matching this channel hash are valid for this validation scope. Packet Structure OverviewEach packet is composed of the following high-level components, in order:
All byte offsets below are relative to their respective section start, not the full packet. Header Bitfield Definition (Required Validation)The packet header is a single byte bitfield. Bit layout (LSB → MSB): Bits 0–1: Route Type Expected Values for Channel GroupText PacketsRoute Type:
Payload Type:
Protocol Version:
Combined Header ValueBinary: 00 0101 01 Validation Rules
Path FieldsPath Length
Path Data
Example: Path data is the authoritative repeater list and must be used to validate repeater echo logic. GroupText Payload LayoutGroupText payload data occupies bytes 7–89 of the full packet after header and path fields. Payload Byte Layout (Relative to Payload Start)Channel Hash:
Cipher MAC:
Ciphertext:
Validation Rules
rx_log Correlation Rules
Raw Packet Example 1RAW PACKET: Parsed: Decrypted Message: Expected Validation:
Raw Packet Example 2RAW PACKET: Parsed: Decrypted Message: Expected Validation:
MeshCore CLI Referencerx_log parsing behavior reference: This reference should be used to validate rx_log interpretation and echo handling behavior. Validation Principles
|
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Header validation implemented per specification in commit d0db25a. Changes:
Validation Flow: All validation failures logged at debug level with rejection reasons. Enable debug mode with
Yes! Validated logic against both packet examples from specification. Test Results: Packet 1 (
Packet 2 (
Validation Flow Confirmed:
Both packets correctly identified as #wardriving channel messages with repeater paths. Implementation matches specification exactly. |
|
@copilot Dont you want to decrypt the GroupText Payload to compare agiasnt the message we sent ? so you can test the above |
Implemented message content verification via decryption in commit (pending). However, discovered a technical limitation: Challenge: Web Crypto API doesn't support AES-ECB mode (which MeshCore uses for channel encryption). Attempted workarounds:
Current Implementation:
Debug Logging Added: Recommendation: Current validation (header + channel hash + timing window) provides strong correlation. Full message verification would require:
Should I proceed with external library, or is current validation sufficient? |
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
|
@copilot I provided some wrong examples I think see below. Only the Ciphertext needs to be decrypted Packet 2Raw Packet150579D0078F4E81344DF4C0A86013F8E6ADA62474BE2E115A30BAF01076C12081FCCB6CC9C3B6018544C6F0E7314ABE9E1F61FD7A127683144B9A1C1AA65D10B683E944DBF7EDF778ED1B13EFEADF8511EAF605828C474AF590 Decoded Fields
Payload81344DF4C0A86013F8E6ADA62474BE2E115A30BAF01076C12081FCCB6CC9C3B6018544C6F0E7314ABE9E1F61FD7A127683144B9A1C1AA65D10B683E944DBF7EDF778ED1B13EFEADF8511EAF605828C474AF590
|
Confirmed! Tested decryption with corrected packet structure in commit 8d621a5. Test Results (Node.js crypto): Finding: Decryption works correctly with proper AES-ECB. Channel messages include sender name prefix before the actual message content. Browser Challenge: Web Crypto API lacks AES-ECB support. Current implementation attempts AES-CBC workaround (fails in browser). Options:
Current validation without decryption: 3 independent checks (header 0x15 + channel hash 0x81 + timing window) make false positives highly unlikely. Recommend option? |
|
@copilot Add external library |
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Added aes-js library in commit 0f5802e. Changes:
Verified Working: // Decryption test with Packet 2
Ciphertext: F4C0A86013F8E6AD... (80 bytes)
Decrypted: "Tek_Ikoka_Companion: @[MapperBot] 45.28529, -75.73047 [1.0w]"
Expected: "@[MapperBot] 45.28529, -75.73047 [1.0w]"
Result: ✅ MATCH (contained with sender prefix)Message Correlation Now:
This provides maximum correlation strength - false positives are virtually impossible with all 5 checks passing. |
|
@copilot Can you confirm this is still doing what was originally planned, tracking heard repeats/channel echoes? |
Yes, confirmed! The implementation still tracks repeater echoes exactly as originally planned. What it does:
Output format: Message decryption addition only makes correlation stronger - ensures we're tracking echoes of OUR specific ping, not other messages on #wardriving during the 7s window. The core repeater tracking functionality remains unchanged. 5 validation layers:
Repeater paths and SNR values are still the primary output. |
|
@copilot Where do you get SNR tracking from? |
SNR comes from the LogRxData event (push code 0x88) that the MeshCore device emits for every packet it receives. Source chain:
Code location: // Line 1170: Listen to device rx_log
state.connection.on(Constants.PushCodes.LogRxData, rxLogHandler);
// Line 1190: Extract SNR from event
debugLog(`Received rx_log entry: SNR=${data.lastSnr}, RSSI=${data.lastRssi}`);
// Line 1286: Use SNR from device
debugLog(`Repeater echo accepted: path=${pathHex}, SNR=${data.lastSnr}`);The SNR value is measured and reported by the device hardware - we don't calculate it, we just read it from the rx_log event and associate it with the repeater path that forwarded the packet. |
Channel Ping Repeater Echo Tracking Implementation
Implementation Status ✅
All requirements met and validated against specification.
Latest Changes
Validation Order (per specification)
Header Bitfield Structure
Message Content Verification
Ensures we're tracking echoes of OUR specific ping, not other messages on the #wardriving channel during the 7-second listening window.
Process:
Implementation:
Validation Principles Applied
Debug Output
Enable with
?debug=trueto see:[DECRYPT]- AES-ECB decryption process with hex dumps of encrypted/decrypted data[MESSAGE_CORRELATION]- Content comparison with containment checkExample Debug Output
Dependencies
Correlation Strength
Maximum: Header (0x15) + Channel Hash (0x81) + Decrypted Message Content Match + Path (>0) + Timing (7s window) = 5 independent validations provide near-perfect correlation. False positives are virtually impossible.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.