native: the seed goes down as the word the firmware reads - #723
Merged
Merged
Conversation
57 of 58 native nodes on Windows booted with one identity, private key included. The bridge parses --seed with strtoul into a uint32_t; where a long is 64 bits the cast keeps the low word, and where it is 32 bits, every Windows target, strtoul saturates at ULONG_MAX, so every node whose seed was above 2^32 was seeded 0xFFFFFFFF. Node 0's seed is the run seed, which fits, and was the one node apart. The seed now goes down as its low 32 bits, which is all the firmware ever read: no identity changes on Linux or macOS, and the published binaries are right without a rebuild. MeshBench/meshcore-native#21 widens the parser for anyone running the binary by hand. Closes #712 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q9HbD44EKWWTRYgxbFGxf6
This was referenced Sep 8, 2026
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.
Not the radio. On the native build
radio_new_identity()is the host variant's ownHostRNG(g_identity_seed), and the identity is a pure function of--seed; RadioLib'srandomByte()never enters it (that path is the board variants', which #556 handled). Run by hand with four seeds, the same binary gives four keys, as the issue found.What destroys the seed is the parser.
bridge/main.cppreads--seedwithstrtoulinto auint32_t. Where alongis 64 bits (Linux, macOS) the cast keeps the low word and every node differs. Where it is 32 bits, every Windows target,strtoulsaturates atULONG_MAXon overflow. The engine strides seeds by0x9E3779B97F4A7C15, so every node past the first carries a seed above 2^32, and all of them arrived as0xFFFFFFFF. Node 0's seed is the bare run seed, which fits: the one node apart. It reproduces across releases because both shipped tags carry the line, and across fixtures because it does not depend on the scenario.The fix is on our side of the command line: the seed goes down as its low 32 bits, which is all the firmware ever read. No identity changes on Linux or macOS, and the published binaries are right without a rebuild. A test pins that every seed the engine can produce goes down as a number a 32-bit parser cannot saturate on, and that two nodes of one run still get two. MeshBench/meshcore-native#21 widens the parser to 64 bits for anyone running the binary by hand.
Not verified on Windows from here: this is a code-reading conclusion with the exact arithmetic signature the issue measured (index 0 survives, every other node collapses to one value). The Linux nodefs on this machine holds 375 distinct identities for a 375-node run, which is what the low-word behaviour predicts.
Found on the way, filed as #720 (every native node draws the same radio noise, so every
fast_rngis seeded identically) and #721 (identities keyed on node index, so node 0 of every fixture is the same node).Closes #712
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9HbD44EKWWTRYgxbFGxf6