mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-28 04:23:22 +02:00
test(engine): stop building reserved-version packets in fixtures
Firmware's Dispatcher::tryParsePacket drops any payload version above 0 at parse, and core's Packet.read_from now enforces the same rule, so a version-1 routed ACK can never reach the relay; the wire vector exercising that unreachable input is removed (header regeneration is still covered by the remaining vectors, including transport-direct). The advert fixture also OR'd the version-1 bit into its header; it now builds the version-0 header that PacketBuilder.create_advert emits.
This commit is contained in:
@@ -692,8 +692,10 @@ class TestForwardRoutedAck:
|
||||
|
||||
# Literal MeshCore-format routed-ACK frames (Packet::writeTo layout). MeshCore's
|
||||
# routeDirectRecvAcks re-emits through createAck: the header is rebuilt from
|
||||
# scratch (payload type ACK, route DIRECT, version bits cleared, transport codes
|
||||
# dropped) and this node is removed from the path. Independent wire fixtures —
|
||||
# scratch (payload type ACK, route DIRECT, transport codes dropped) and this
|
||||
# node is removed from the path. Non-zero-version inputs are not represented
|
||||
# here: firmware's Dispatcher::tryParsePacket (and our Packet.read_from) drops
|
||||
# them at parse, so they can never reach the relay. Independent wire fixtures —
|
||||
# do NOT rebuild them through Packet.write_to()/PathUtils.
|
||||
FIRMWARE_ROUTED_ACK_VECTORS = (
|
||||
# header 0x0E = ACK<<2 | ROUTE_DIRECT; path_len 0x02 = 1-byte/2-hop;
|
||||
@@ -719,13 +721,6 @@ FIRMWARE_ROUTED_ACK_VECTORS = (
|
||||
bytes.fromhex("0E01CC4DABAF95"),
|
||||
id="transport-direct-1-byte-2-hop",
|
||||
),
|
||||
# header 0x4E = version bit set on a direct ACK; createAck clears it.
|
||||
pytest.param(
|
||||
bytes([0xAB]),
|
||||
bytes.fromhex("4E02ABCC4DABAF95"),
|
||||
bytes.fromhex("0E01CC4DABAF95"),
|
||||
id="direct-version-bits-cleared",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ class MockRadio:
|
||||
def _make_advert_packet():
|
||||
"""Build a 0-hop flood ADVERT packet (same shape as PacketBuilder.create_advert)."""
|
||||
pkt = Packet()
|
||||
# Version 1, ROUTE_TYPE_FLOOD, PAYLOAD_TYPE_ADVERT
|
||||
pkt.header = (1 << 6) | (PAYLOAD_TYPE_ADVERT << PH_TYPE_SHIFT) | ROUTE_TYPE_FLOOD
|
||||
# Version 0 (the only version firmware accepts), ROUTE_TYPE_FLOOD, PAYLOAD_TYPE_ADVERT
|
||||
pkt.header = (PAYLOAD_TYPE_ADVERT << PH_TYPE_SHIFT) | ROUTE_TYPE_FLOOD
|
||||
pkt.path_len = 0
|
||||
pkt.path = bytearray()
|
||||
pkt.payload = bytearray(b"minimal_advert_payload")
|
||||
|
||||
Reference in New Issue
Block a user