Skip to content

fix(deps): follow trac-msb and trac-peer to hyperdht 6.29.6 - #30

Merged
TracSystems merged 1 commit into
mainfrom
fix/trac-msb-hyperdht-6.29.6
Sep 16, 2026
Merged

TracSystems merged 1 commit into
mainfrom
fix/trac-msb-hyperdht-6.29.6

Conversation

@TracSystems

Copy link
Copy Markdown
Contributor

Last link of a three-repo chain. Re-pins both framework dependencies:

dep from to PR
trac-msb 7220c257 ea72a9c8 Trac-Systems/main_settlement_bus#802
trac-peer 370e81cf e4b52ad1 Trac-Systems/trac-peer#37

Both carry exactly one change: hyperdht 6.27.0 → 6.29.6.

Why

A long-running peer aborts roughly every few days:

TypeError: Cannot read properties of null (reading 'buffer')
    at crypto_generichash_update (sodium-native/index.js:445)
    at crypto_generichash_batch (sodium-native/index.js:405)
    at annSignable (hyperdht/lib/persistent.js:275)
    at Persistent.onunannounce (hyperdht/lib/persistent.js:62)

hyperdht installs its persistent request handlers on a once('persistent') listener and never tears them down, while dht.id returns null for as long as the node is ephemeral — and an adaptive node returns to ephemeral on every wakeup or network change. In 6.27.0 the dispatcher only checked that the handlers existed, so an inbound UNANNOUNCE reached onunannounce, which passes that null id into sodium.crypto_generichash_batch, where it is dereferenced in C. onannounce has always carried its own || !this.dht.id guard and never crashed — that asymmetry is the tell.

Fixed upstream in hyperdht 6.29.4 — holepunchto/hyperdht#242, 8f66a11:

- if (this._persistent === null) return false
+ if (this._persistent === null || this.id === null) return false

Why both pins move together

This is the part that makes the chain three repos instead of two. trac-peer depends on trac-msb at its own exact sha. Bumping only this repo's trac-msb pin adds 12 lockfile entries, including node_modules/trac-peer/node_modules/hyperdht@6.27.0 — a second, nested trac-msb still carrying the broken version. The lockfile reads as fixed while the peer keeps crashing on the nested copy.

Measured on the lockfile:

trac-msb pin only both pins
entries added 12 0
entries removed 1 0
node_modules/hyperdht 6.29.6 6.29.6
node_modules/trac-peer/node_modules/hyperdht 6.27.0 absent

After this PR the tree holds a single hyperdht (6.29.6), one trac-msb and one trac-peer.

Notes

  • 6.29.6 is the last release of the 6.29 line: the guard plus two small fixes, no new dependencies. Deliberately not 6.30.0+, which adds the "closest nodes in key" feature, a new hyperdht-address dependency, and parallel pre-connect on FIND_PEER — behaviour changes that do not belong in a crash fix.
  • Both upstream PRs leave their version untouched, since consumers pin by sha.
  • Merge order: main_settlement_bus#802 → trac-peer#37 → this. The shas pinned here are those PR heads, so this can be validated before either merges.

🤖 Generated with Claude Code

Re-pins both framework dependencies:

  trac-msb  7220c257 -> ea72a9c8  (Trac-Systems/main_settlement_bus#802)
  trac-peer 370e81cf -> e4b52ad1  (Trac-Systems/trac-peer#37)

Both carry one change: hyperdht 6.27.0 -> 6.29.6, for the null node-id guard
released upstream in hyperdht 6.29.4 (holepunchto/hyperdht#242).

Without it a long-running peer aborts roughly every few days. hyperdht keeps its
persistent request handlers installed for the life of the node, while `dht.id`
returns null for as long as the node is ephemeral — and an adaptive node returns
to ephemeral on every wakeup or network change. In 6.27.0 the dispatcher checked
only that the handlers existed, so an inbound UNANNOUNCE reached
`Persistent.onunannounce`, which passes that null into
`sodium.crypto_generichash_batch`, where it is dereferenced in C:

    TypeError: Cannot read properties of null (reading 'buffer')
      at annSignable (hyperdht/lib/persistent.js:275)
      at Persistent.onunannounce (hyperdht/lib/persistent.js:62)

BOTH PINS MOVE TOGETHER, and that is the point. trac-peer depends on trac-msb at
its own exact sha, so bumping only this repo's trac-msb pin installs a SECOND,
nested trac-msb under node_modules/trac-peer — still carrying hyperdht 6.27.0.
The lockfile then reads as fixed while the peer keeps crashing on the nested
copy. Measured: bumping trac-msb alone added 12 lockfile entries including
node_modules/trac-peer/node_modules/hyperdht@6.27.0. With both pins moved the
tree stays flat — added 0, removed 0, a single hyperdht at 6.29.6, one trac-msb
and one trac-peer.

tests/startup-source.test.mjs follows the two shas, which is what it is for, and
gains a case that pins hyperdht itself: version 6.29.6, exactly one hyperdht and
exactly one trac-msb in the lockfile. That last part is the regression guard —
it fails on the nested-duplicate tree that a half-finished pin bump produces.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@TracSystems
TracSystems force-pushed the fix/trac-msb-hyperdht-6.29.6 branch from b57a0fc to 87ef4d2 Compare September 16, 2026 02:10
@TracSystems
TracSystems merged commit 4ab5299 into main Sep 16, 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.

1 participant