Repository navigation
Description
Part 2 of 9 · #184 · Size L · Base 1.x.x (C4 targets main) · Needs nothing: can start now · Unblocks part 3 (#190), part 4 (#199), part 6 (#209), part 7 (#212), part 9 (#222)
Consolidates work items B1 (#186), B2 (#187), B3 (#193), C1 (#188), C5 (#189) and C4 (#196), each formerly its own sub-issue. Their full text is below as sections; the closed issues point here.
Goal
Everything the later parts build on, with no change to node behavior: qbit-aware previous-release tooling, an independent Python ML-KEM-1024, a v1.0.0 interoperability baseline, the reusable PQ CI workflow and its nightly callers on main, and the canary tools, so the 14-day baseline can start early.
Work items
In suggested commit order. Each item is a section below.
- B1 · test: resolve qbit releases in the previous-release tooling
- B2 · test: add an independent ML-KEM-1024 Python reference
- B3 · test: baseline v2 transport interoperability with qbit v1.0.0
- C1 · ci: add the reusable PQ workflow with job selection and a recorded source SHA
- C5 · contrib: add the PQ canary sampler and evaluator
- C4 · ci (main): schedule maintained-branch PQ and heavy validation separately
Starting early
- Every item can start now.
- C4 is a separate small pull request against
main. Open it once C1 is on1.x.x, because GitHub checks that a called workflow exists.
B1 · test: resolve qbit releases in the previous-release tooling
Needs nothing within #184.
Goal
Let functional tests download and run qbit release binaries, starting with v1.0.0, the way they already run Bitcoin Core releases. B3's interop tests and the mixed-version CLI check in F6 (#209) need this.
Context
test/get_previous_releases.pyknows only bitcoincore.org; asking it for qbit v1.0.0 gives HTTP 404.test/functional/test_framework/test_framework.py:543-563maps client version 10000 tov0.1.0, and:114-116expectsbitcoind/bitcoin-clibinary names. qbit shipsbin/qbitdandbin/qbit-cli.TestNodepasses-v2transportand some logging options only whenversion_is_at_least(...)holds for Core versions 190000 to 290100 (test_node.py:177-195; the comparison is at:568). v1.0.0 reports 10000, so today it gets none of them.- The Windows cross-built test job runs
get_previous_releases.pyon every pull request (.github/workflows/ci.yml:709), so this must keep working there. - v1.0.0 release assets:
qbit-1.0.0-<host>.tar.gzforx86_64-linux-gnu,aarch64-linux-gnu,arm-linux-gnueabihf,riscv64-linux-gnuandpowerpc64-linux-gnu;qbit-1.0.0-{x86_64,arm64}-apple-darwin-unsigned.{tar.gz,zip};qbit-1.0.0-win64-unsigned.zip. Hashes are in the release'sSHA256SUMS.
Scope
- Explicit release metadata, not arithmetic on version numbers:
@dataclass(frozen=True) class ReleaseInfo: family: str # "qbit" or "bitcoin" client_version: int tag: str core_compat_version: int binary_prefix: str # "qbit" or "bitcoin" supports_v2_pq: bool # qbit v1.0.0: client_version=10000, tag="v1.0.0", # core_compat_version=300200, binary_prefix="qbit", supports_v2_pq=False
- qbit descriptors choose the GitHub release URL, archive name and format, archive root, and the
qbitd/qbit-clinames. Register each archive's actual SHA256 fromSHA256SUMS; never derive or substitute hashes. Bitcoin Core downloads are unchanged. version_is_at_least()comparescore_compat_version(qbit 1.0.x is based on Core v30.2, so 300200), which gives v1.0.0 nodes-v2transportand the logging options. Addqbit_version_is_at_least()for qbit-only options.- qbit-only options, such as
-v2pqtransportfrom F5 (rpc, init: -v2pqtransport, startup line, getpqtransportinfo, peer fields, -netinfo and GUI (#184 part 6) #209), go only to the build under test or to a release whose descriptor advertises support (supports_v2_pq).
Tests
- Release-metadata unit tests (
qbit_release_resolution): version 10000 on every supported host triple including win64 resolves the right tag, URL, archive root, binary names and hash; the Bitcoin Core mappings are unchanged. Run on Linux and Windows.
Acceptance criteria
-
test/get_previous_releases.pydownloads and verifies qbit v1.0.0 for the host. - A functional test can start a v1.0.0 node with
-v2transport=1throughversions=[...]. - The Windows cross-built test job stays green.
- No node behavior changes.
Suggested commit: test: identify qbit releases independently of Core versions.
B2 · test: add an independent ML-KEM-1024 Python reference
Needs nothing within #184.
Goal
A pure-Python FIPS 203 ML-KEM-1024 in the functional test framework, written independently of the C library. E1's vector generator and G1's Python hybrid peer use it, so the C++ implementation is checked against a second implementation rather than against itself.
Scope
test/functional/test_framework/crypto/mlkem.py:- ML-KEM-1024 parameters: k = 4, η1 = η2 = 2, du = 11, dv = 5. Sizes: encapsulation key 1,568 bytes, decapsulation key 3,168, ciphertext 1,568, shared secret 32.
KeyGenfrom a 64-byte seedd ‖ z,Encapsfrom a 32-bytem,Decapswith implicit rejection, and the FIPS 203 §7.2 encapsulation-key modulus check.- Hashing through Python's built-in
hashlibSHA3 and SHAKE.
- Self-tests (
TestMLKEM1024) registered intest/functional/feature_framework_unit_tests.py:- NIST ACVP ML-KEM-1024 keyGen and encapDecap vectors (usnistgov/ACVP-Server);
- C2SP CCTV modulus vectors, including coefficients at the 3328/3329 boundary (C2SP/CCTV);
- an implicit-rejection vector (a corrupted ciphertext yields the reference rejection secret).
- Keep the fixtures small (a subset is enough) and record their source and pinned commit in a header comment.
- Imports nothing from the C++ build.
Pure Python is slow. That is acceptable: in the whole-suite PQ mode (G3), framework peers stay legacy and only the dedicated tests pay the cost.
Acceptance criteria
- Exact EK, DK, CT and SS on the ACVP vectors; correct modulus rejections; the implicit-rejection secret matches the reference.
-
feature_framework_unit_tests.pypasses, and the PR states how long the new tests take.
Suggested commit: test: add an independent ML-KEM-1024 Python reference.
B3 · test: baseline v2 transport interoperability with qbit v1.0.0
Needs B1.
Goal
Pin v1.0.0's behavior toward large version-packet contents, in both roles, before any node change lands. Later PRs then prove they stay compatible with every v1.0.0 node.
Context
- The design puts the ML-KEM key and ciphertext into BIP324's version-packet contents, which are empty today (
VERSION_CONTENTS,src/net.h:460) and ignored on receipt (src/net.cpp:1251-1254). - Checked by hand against the hash-verified v1.0.0 release binary:
- it accepts 1,089, 1,185 and 65,000-byte version packets, with decoys first and after a 10 s delay, in both roles;
- it disconnects only above 4,000,013 bytes (
MAX_CONTENTS_LEN) or at-peertimeout(60 s); - as initiator it sends its version packet and its
VERSIONmessage before receiving ours.
- Interop tests run in the previous-releases job (
ci/test/00_setup_env_native_previous_releases.sh).
Scope
New test/functional/p2p_v2_previous_release.py, registered for the previous-releases job:
| Test | Setup | Expect |
|---|---|---|
test_version_contents |
v1.0.0 in each role; contents of 0, 1,572 (the exact ML-KEM-1024 record size) and 65,000 bytes; decoys before the version packet; a 10 s delay | Handshake and application messages succeed; v1.0.0's session id is unchanged |
test_limits |
Contents above the transport limit; a stalled handshake | v1.0.0 disconnects as expected, within the bounded timeout |
F6 (#209) adds a mixed-version -netinfo case to this file.
Acceptance criteria
- Passes in the previous-releases job. Once C1 lands, the named dispatch is
gh workflow run ci-nightly-heavy.yml --ref <branch> -f run_test_matrix=true -f run_scanners=false -f jobs=previous-releases; before that, run the job's env locally. - No node behavior changes.
Suggested commit: test: baseline v1.0.0 v2 transport interoperability.
C1 · ci: add the reusable PQ workflow with job selection and a recorded source SHA
Needs nothing within #184.
Goal
One reusable workflow, .github/workflows/ci-pq.yml, that runs the PQ-relevant unit suites on selected jobs and records the exact commit it tested. Also make ci-nightly-heavy.yml callable and job-selectable, so main's scheduler (C4) and named dispatches on PR branches can use both.
Context (1.x.x at 45e9e72c2d)
- Scheduled workflows run only from the default branch.
main's copy ofci-nightly-heavy.ymlstill checks out0.1.x(Run scheduled validation against the maintained release line and report the tested commit #152);1.x.x's copy resolves a scheduled run to1.x.xinresolve-source(MAINTAINED_BRANCH, from ci: validate maintained source in scheduled heavy workflows #165), but that copy never runs on a schedule. - No CI job runs AArch64 code today: there is no aarch64 Linux job, the native macOS arm64 job is disabled (
ci.yml:220,vars.QBIT_ENABLE_MACOS_NATIVE_ARM64), and x86_64 macOS is cross-built without tests. ci.yml:53points every job at the internal registry (CI_ENFORCE_INTERNAL_REGISTRY), andci/test/00_setup_env_base_image.sh:41builds image names from that prefix. The CentOS override atci.yml:753covers only that job.ci/test/03_test_script.sh:222-229selects ctest tests only throughCTEST_INCLUDE_RANGE, and always builds targetall.- ctest has one test per Boost suite (
add_boost_test,src/test/CMakeLists.txt:210). The unit-test target istest_bitcoin; its executable istest_qbit.
Scope
ci-pq.yml, triggered byworkflow_callandworkflow_dispatch, with inputs:source_ref: resolved once to a commit SHA by a setup job. Every job checks out that SHA, and the run summary records it.jobs: a comma-separated allowlist; empty means all jobs; unknown or duplicate names fail the run. The setup job emits the matrix, because a job-levelifcan't see matrix values.
- First job,
aarch64-unit, on GitHub'subuntu-24.04-armrunner (free for public repositories), with a public-runner environment: image prefixdocker.io/library,CI_ENFORCE_INTERNAL_REGISTRY=0, public DNS and search settings. It builds targettest_bitcoinand runsbip324_testsandnet_tests. The summary labels this the pre-library phase; D3 (crypto: vendor mlkem-native and build ML-KEM-1024 with runtime backend selection, tests and cross-platform CI (#184 part 3) #190) addsmlkem_tests. ci/test/03_test_script.sh:CI_BUILD_TARGET(defaultall), applied to both the normal and the verbose-retry build commands;CTEST_REGEX, rejected when combined withCTEST_INCLUDE_RANGE;- ctest with
--no-tests=error. The job lists the selected tests before running and checks the JUnit results afterwards: every expected suite present, executed and passed, never skipped.
ci-nightly-heavy.yml: addworkflow_call(inputs mirroringworkflow_dispatch) and ajobsinput that selects named jobs, such asprevious-releases. Whenmaincalls it on a schedule,resolve-sourcemust still resolve to1.x.x.- Contract tests under
ci/checks/: named-dispatch selection, rejection of an unknown job, an immutable source SHA, and suites that really ran.
Acceptance criteria
- The PR's own CI runs
aarch64-unitthroughci.yml(C3's gate) on a clean hosted runner; its summary shows the source SHA and both suites as executed and passed. GitHub only allowsworkflow_dispatchfor workflows on the default branch, so on-demand runs ofci-pq.ymlgo through C4's caller onmainonce this part merges. -
gh workflow run ci-nightly-heavy.yml --ref <branch> -f run_test_matrix=true -f run_scanners=false -f jobs=previous-releasesruns only that job. - The contract tests run in required CI; actionlint is clean.
GitHub validates reusable-workflow references when they are called, so C4 can merge on main only after this is on 1.x.x.
Suggested commit: ci: add reusable maintained-branch validation entry points.
C5 · contrib: add the PQ canary sampler and evaluator
Needs nothing within #184.
Goal
Scripted evidence for the mainnet canary (R5): a sampler that records each node's transport state every 5 minutes, and an evaluator that turns the samples into the canary figures, each with its sample count. It ships before the 14-day baseline (R0) starts on v1.0.0 nodes, so it must work against nodes that don't have the new RPCs yet.
Scope
-
contrib/pq-canary/pq-canary-sample.sh, run every 5 minutes (cron or a systemd timer) on each canary node and on the control node. Each run appends one CSV row:- time, host label,
uptime, version; - from
getpqtransportinfo(contract in p2p: add hybrid post-quantum key exchange (ML-KEM-1024) to BIP324 v2 transport #184):enabled,instance_id, the backends,since, the per-directionhandshakescounts,load_shedding.active, and each ring'slast_sequenceanddropped; connections_inandconnections_pqfromgetnetworkinfo;- on the pool node, the
getpeerinfoentry for the pinned archive node:connection_type,transport_pq,transport_pq_status; sample_ok: 1 whenuptime,getnetworkinfoand (on the pool node)getpeerinfoanswered.
A missing field or a failed call is written as
NA, never 0; v1.0.0 has neitherconnections_pqnorgetpqtransportinfo. The rawrecent_failuresandfallback_setgo to a local JSON-lines file per sample for the evaluator. Addresses stay on the node. - time, host label,
-
contrib/pq-canary/pq-canary-eval.pyprints each figure with its sample count andpass,failorunknown:- the pinned link is
manualand hybrid in at least 99% of samples, excluding restarts; - no
malformed_recordorfirst_packet_failedentry, and no fallback entry, between known-good endpoints (a list file kept on the node); closed_after_switchentries between known-good endpoints, listed for triage;- the canary archive node's
connections_instays within ±20% of the control's, relative to their baseline ratio, excluding the 48 hours after a restart.
Rules: a drop in
uptimeis a restart gap. A sequence gap, a changedinstance_idor a rise indroppedmakes that intervalunknownfor that ring. Missing evidence isunknown, never clean. When an automatic connection holds the pinned address,GetAddedNodeInfoskips it (src/net.cpp:2906-2960); print the remedy:disconnectnodethat peer once, and the-addnodethread reconnects it as manual within about 60 s. - the pinned link is
-
Tests with fixtures under
contrib/pq-canary/test/, run in CI:- a monitored outbound failure followed by 300 unrelated inbound failures is still reported;
- unrelated noise doesn't fail the canary;
- a restart is a gap;
- an RPC outage gives
unknown; - a
droppedincrease or a sequence gap givesunknown.
-
A README: install, the cron line, and how to read the output.
Acceptance criteria
- The tests pass in CI.
- Against a v1.0.0 regtest node, the sampler writes rows with
NAfor the new fields andsample_ok=1. - Against fixture output in the p2p: add hybrid post-quantum key exchange (ML-KEM-1024) to BIP324 v2 transport #184 schema, the evaluator prints every figure.
Suggested commit: tools: add PQ canary sampling and evidence evaluation.
C4 · ci (main): schedule maintained-branch PQ and heavy validation separately
Needs C1. Related: #152.
Goal
Nightly runs of the PQ jobs and of the heavy validation against 1.x.x, each with its own run status, so a PQ failure raises its own alarm. It is a separate small pull request against main, opened after C1 is on 1.x.x, and the only #184 pull request against main.
Context
- Scheduled workflows run only from the default branch,
main.main'sci-nightly-heavy.ymlchecks out0.1.xon its schedule (Run scheduled validation against the maintained release line and report the tested commit #152).1.x.x's copy already resolves1.x.x(ci: validate maintained source in scheduled heavy workflows #165), and C1 makes it callable. - Every scheduled Nightly CI run has failed since at least 2026-09-18 (the 32-bit ARM unit-test shards and Scanner), so a job added inside it would raise no alarm.
Scope
- Two caller workflows on
main:.github/workflows/ci-maintained-pq.yml: onschedule(for example15 4 * * *), calls[email protected]withsource_ref: 1.x.xandsecrets: inherit. It also hasworkflow_dispatchwithsource_refandjobsinputs passed through, which is the on-demand path for any branch or SHA (GitHub requires dispatchable workflows to live on the default branch);.github/workflows/ci-maintained-heavy.yml: onschedule(for example45 4 * * *), calls[email protected]the same way.
- Distinct run names and concurrency groups.
main's existing0.1.xnightly is unchanged. - The caller's workflow ref (
main) and the tested source are different things: the callee resolves the source once, and every job checks out that SHA.
Acceptance criteria
- actionlint is clean, and both callees exist on
1.x.x. - The first scheduled run of each records
1.x.x's head as its source SHA, and the PQ run lists its suites as executed. - A comment on Run scheduled validation against the maintained release line and report the tested commit #152 says which part of it this covers: the nightly heavy workflow. The IBD and RPC performance workflows stay with Run scheduled validation against the maintained release line and report the tested commit #152.
Suggested commit: ci: schedule maintained-branch PQ and heavy validation separately.
Two pull requests close this issue: the main one against 1.x.x, and C4's small one against main. The shared contract is the Design section of #184; change it there first if needed.
Activity
[-]test: resolve qbit releases in the previous-release tooling (#184 B1)[/-][+]test, ci: foundations: qbit release tooling, Python ML-KEM-1024, v1.0.0 interop, PQ CI workflow, canary tools (#184 part 2)[/+]ci: add reusable maintained-branch validation entry points
tools: add PQ canary sampling and evidence evaluation
test, ci: foundations for hybrid v2 transport (Python ML-KEM, qbit re…
djh58 commentedon Oct 23, 2026
Done in #224, merged into
feature/pq-transportas ad1d694. It reaches1.1.0with #233 and ships in 1.1.0.Hybrid post-quantum v2 transport (#184) — integration (#233)