Skip to content

protocol: add PAYLOAD_VER_3 and PAYLOAD_VER_4 constants for upstream parity#67

Merged
rightup merged 1 commit into
pyMC-dev:devfrom
dmduran12:fix/payload-ver-upstream-parity
May 11, 2026
Merged

protocol: add PAYLOAD_VER_3 and PAYLOAD_VER_4 constants for upstream parity#67
rightup merged 1 commit into
pyMC-dev:devfrom
dmduran12:fix/payload-ver-upstream-parity

Conversation

@dmduran12
Copy link
Copy Markdown
Contributor

Summary

Upstream meshcore-dev/MeshCore src/Packet.h defines four payload-version constants:

#define PAYLOAD_VER_1       0x00   // 1-byte src/dest hashes, 2-byte MAC
#define PAYLOAD_VER_2       0x01   // FUTURE (eg. 2-byte hashes, 4-byte MAC ??)
#define PAYLOAD_VER_3       0x02   // FUTURE
#define PAYLOAD_VER_4       0x03   // FUTURE

src/pymc_core/protocol/constants.py currently only exposes the first two. Downstream tooling that diffs the PH_* / PAYLOAD_VER_* sets against a pinned Packet.h flags the missing entries as upstream-only:

info: pymc_core PH_* / PAYLOAD_VER_* set differs from upstream (informational, not a blocker).
  upstream-only: PAYLOAD_VER_3=0x02
  upstream-only: PAYLOAD_VER_4=0x03

Change

Add PAYLOAD_VER_3 = 0x02 and PAYLOAD_VER_4 = 0x03 directly after PAYLOAD_VER_2, with the same # Reserved for future use comment style already used for PAYLOAD_VER_2. They are treated exactly like PAYLOAD_VER_2: defined as named constants, not exported in protocol/__init__.py (which already omits PAYLOAD_VER_2), and not added to MAX_SUPPORTED_PAYLOAD_VERSION.

 PAYLOAD_VER_1 = 0x00  # Currently supported
 PAYLOAD_VER_2 = 0x01  # Reserved for future use
+PAYLOAD_VER_3 = 0x02  # Reserved for future use
+PAYLOAD_VER_4 = 0x03  # Reserved for future use
 MAX_SUPPORTED_PAYLOAD_VERSION = PAYLOAD_VER_2  # Accept versions 0-1

Behavior

No runtime change. MAX_SUPPORTED_PAYLOAD_VERSION is unchanged, so Packet.read_from() continues to reject versions > 1 (raise ValueError("Unsupported packet version: ...") in src/pymc_core/protocol/packet.py). The new constants only provide stable names for the version values that upstream already reserves.

Scope

Single file, two lines added, additive only. No test changes required (these constants have no behavior of their own and existing tests cover the unchanged MAX_SUPPORTED_PAYLOAD_VERSION boundary).


Co-Authored-By: Oz oz-agent@warp.dev
Generated with Warp

…parity

Upstream meshcore-dev/MeshCore Packet.h defines four payload-version
constants (PAYLOAD_VER_1..PAYLOAD_VER_4); pyMC_core currently exposes
only the first two. Downstream tooling that diffs the PH_* / PAYLOAD_VER_*
sets against pinned upstream Packet.h flags PAYLOAD_VER_3 (0x02) and
PAYLOAD_VER_4 (0x03) as upstream-only.

Add both as named constants alongside PAYLOAD_VER_2, marked as 'Reserved
for future use' to match how PAYLOAD_VER_2 is already treated. No
behavioral change: MAX_SUPPORTED_PAYLOAD_VERSION is unchanged, so
Packet.read_from() continues to accept only versions 0-1; the new
constants only provide stable names for the reserved version values.

Co-Authored-By: Oz <oz-agent@warp.dev>
@dmduran12
Copy link
Copy Markdown
Contributor Author

housekeeping @rightup

@rightup rightup merged commit 0585f7a into pyMC-dev:dev May 11, 2026
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.

2 participants