bridge: the seed is parsed whole, and is 64 bits wide - #21
Merged
Merged
Conversation
strtoul saturates at ULONG_MAX where a long is 32 bits, which is every Windows target, so a seed above 2^32 came in as 0xFFFFFFFF and every node of a run but the first booted with one identity, private key included. strtoull, into a uint64_t, so the number the simulator sends means the same thing on every platform. The simulator sends a value that fits in 32 bits either way, so no identity changes where the mesh already worked. MeshBench/meshbench#712 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q9HbD44EKWWTRYgxbFGxf6
A13xB0
added a commit
to MeshBench/meshbench
that referenced
this pull request
Sep 8, 2026
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 Claude-Session: https://claude.ai/code/session_01Q9HbD44EKWWTRYgxbFGxf6 Co-authored-by: R0ck <random@email.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.
--seedwas parsed withstrtoulinto auint32_t. Where a long is 64 bits the cast keeps the low word and every node differs. Where a long is 32 bits, every Windows target,strtoulsaturates atULONG_MAXon overflow, so every node whose seed was above 2^32 was seeded0xFFFFFFFFand booted with one identity, private key included. That is MeshBench/meshbench#712: 57 of 58 nodes byte-identical, node 0 (whose seed is the bare run seed, which fits) the one apart.strtoullinto auint64_t, whichHostRNGalready takes. MeshBench masks what it sends to 32 bits on its side (so the published binaries are right without a rebuild, and no identity changes on Linux or macOS); this makes the parser honest for anyone running the binary by hand with a wide seed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9HbD44EKWWTRYgxbFGxf6