Skip to content

FluxOS carries the signed code hash list to peers and to fluxbench - #1925

Open
MorningLightMountain713 wants to merge 4 commits into
developmentfrom
feat/hashlist-peer-exchange
Open

MorningLightMountain713 wants to merge 4 commits into
developmentfrom
feat/hashlist-peer-exchange

Conversation

@MorningLightMountain713

@MorningLightMountain713 MorningLightMountain713 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

FluxOS now carries the signed list of FluxOS code hashes that fluxbench checks a node against. Each node holds the list, verifies it, takes newer versions from its peers, and serves it to fluxbench and to the release pipeline on GET /flux/hashlist. It travels on the same peer exchange as the network policy bundle, which this PR first moves into a module of its own so both documents share one implementation.

What changes

1. The signed document exchange is its own module (refactor(policy)). utils/signedDocumentExchange.js holds what keeping a signed document current with peers takes: the held document and its restore, adoption by verified sequence, the one-peer ask with its correlation id and three answers (ahead, level, nothing), the claim chase, peer confirmation, the backstop fetch and its tick phased by collateral. It takes everything it touches (log, event bus, signature check, storage, source) from the document's module. policyStore is the policy bundle's instance: its exports, log lines, policy:* events, stored row and acquisition gate are unchanged. The envelope check (verifySignedDocument), the stored row (readSignedDocument / writeSignedDocument), the responder, the ask, the announcement and the capable-peer lookup (getCapablePeers(capability)) each take the document they serve. The policy wire names (fluxpolicyseq, fluxpolicyrequest, fluxpolicy) and the policyBundle capability are unchanged.

2. The code hash list (feat(hashlist)). hashListStore is the second instance. It verifies a list against the keys fluxbench pins (the CI key and the cold key) before it stores or passes it on, and checks the payload is a list of tree hashes. It stores the signed bytes in their own row (fluxHashList) and exchanges them with peers as fluxhashlistseq, fluxhashlistrequest and fluxhashlist under the hashList capability. It fetches from hashes.runonflux.io/hashlist only as the backstop: a node restores its stored list at start, asks each capable peer as it connects, adopts and announces anything newer, and reaches the source only when its peers cannot settle what it holds, or on its daily tick. FluxOS carries the list and does not judge by it; fluxbench hashes the code and decides.

GET /flux/hashlist serves the bytes the node holds, uncached, and 404 when it holds none. The network profile gains hashList (sourceUrl, publicKeys, minConfirmingPeers). A network whose profile names no source or keys keeps no list and answers a peer that asks that it holds nothing. A non-mainnet profile must carry the same keys as mainnet's, so a lab profile gains hashList with an empty source and keys alongside this change.

3. Harness suite 1507 (test(hashlist)). The external stub signs and serves a hash list under a test key of its own, with fetch counters by client and a control to refuse chosen addresses, re-sign and publish. Suite 1507 turns the hash list on for three nodes and has the source refuse the middle one: the others take the list from the source and announce it, the refused node takes it from a peer, and it serves the publisher's envelope on /flux/hashlist. A suite fleet keeps no hash list unless the suite configures one, and the three hashList:* events are on the harness subscription list.

Testing

  • Unit (tests/images/run-unit.sh, chud): full suite 13,444 passing, 0 failing. The policy store's tests pass unchanged on the first commit alone (848 passing across the policy-related files). New tests cover the hash list's verification (including the list fluxhashes published as seq 508 verifying under the pinned keys), its store, /flux/hashlist, the generic responder with the hash list's message names, and getCapablePeers.
  • Suite 1507, solo on chud: 3 passing. Before-state (development with only the harness files): every test red at its own assertion. Mutations, one at a time: the fluxhashlist handler not offering the list, and the hashList capability not advertised, each turn "a node the source refuses takes the list from a peer" red; /flux/hashlist holding nothing turns "the refused node serves on /flux/hashlist the list the publisher signed" red, alone.
  • Suites 1501–1507 in parallel on chud: 1501, 1503, 1504, 1505, 1506 and 1507 green. 1502 is red in two before all hooks only (bootAndPeer's peer floors in its fleets with a stub peer and a deferred node), the harness ring following the fixture's txhash order, which fix(apps): a failed restore holds what it broke until it heals or its owner accepts it #1921 fixes; all 15 of its policy tests that ran passed.

Notes for reviewers

  • A node without this release loses nothing: the list stays available from its published sources. /flux/hashlist adds a copy on every node, and lets the release pipeline sample live nodes.
  • The list grows with every FluxOS commit until the signer's expiry of untagged entries is in place: 43 KB at 921 hashes today, against the peer socket's 100 MiB payload limit.

🤖 Generated with Claude Code

SignedDocumentExchange holds what keeping a signed document current with
peers takes: the held document and its restore, adoption by verified
sequence, the one-peer ask with its correlation id and three answers, the
claim chase, peer confirmation, the backstop fetch and its phased tick. It
takes everything it touches - log, event bus, signature check, storage,
source - from the document's module, so a test replacing one of those
replaces it for the exchange.

policyStore is the policy bundle's instance: its exports, log lines, events,
stored row and acquisition gate are unchanged. The envelope check,
the stored row, the responder, the ask, the announcement and the capable
peer lookup each take the document they serve; the policy wire names and
capability are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… to fluxbench

hashListStore is the second SignedDocumentExchange: the list fluxhashes
publishes, verified against the two keys fluxbench pins, stored in its own
row, exchanged with peers as fluxhashlistseq, fluxhashlistrequest and
fluxhashlist under the hashList capability, and fetched from
hashes.runonflux.io only as the backstop. FluxOS verifies a list before it
stores or passes it on, and does not judge by it.

GET /flux/hashlist serves the bytes this node holds, uncached, and 404 when
it holds none. A network whose profile names no hash list source or keys
keeps none; a suite fleet keeps none unless the suite configures one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The external stub signs and serves a hash list under a key of its own,
with fetch counters by client and a control to refuse chosen addresses,
re-sign and publish. Suite 1507 turns the hash list on for three nodes
and has the source refuse the middle one: the others take the list from
the source and announce it, the refused node takes it from a peer, and
it serves the publisher's envelope on /flux/hashlist.

Solo on chud: 3 passing. Before-state (development with this commit's
harness files, no hash list in FluxOS): every test red at its own
assertion - node 2 never stores a list, the refused node adopts nothing,
/flux/hashlist answers 404. Mutations, one at a time:
- the fluxhashlist handler not offering the list: "a node the source
  refuses takes the list from a peer" red
- the hashList capability not advertised: the same test red
- /flux/hashlist holding nothing: "the refused node serves on
  /flux/hashlist the list the publisher signed" red, alone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…igner's document

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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