Skip to content

test, ci: foundations: qbit release tooling, Python ML-KEM-1024, v1.0.0 interop, PQ CI workflow, canary tools (#184 part 2) #186

Closed

Description

@djh58

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 on 1.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.py knows only bitcoincore.org; asking it for qbit v1.0.0 gives HTTP 404.
  • test/functional/test_framework/test_framework.py:543-563 maps client version 10000 to v0.1.0, and :114-116 expects bitcoind/bitcoin-cli binary names. qbit ships bin/qbitd and bin/qbit-cli.
  • TestNode passes -v2transport and some logging options only when version_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.py on 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.gz for x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf, riscv64-linux-gnu and powerpc64-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's SHA256SUMS.

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-cli names. Register each archive's actual SHA256 from SHA256SUMS; never derive or substitute hashes. Bitcoin Core downloads are unchanged.
  • version_is_at_least() compares core_compat_version (qbit 1.0.x is based on Core v30.2, so 300200), which gives v1.0.0 nodes -v2transport and the logging options. Add qbit_version_is_at_least() for qbit-only options.
  • qbit-only options, such as -v2pqtransport from 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.py downloads and verifies qbit v1.0.0 for the host.
  • A functional test can start a v1.0.0 node with -v2transport=1 through versions=[...].
  • 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.
    • KeyGen from a 64-byte seed d ‖ z, Encaps from a 32-byte m, Decaps with implicit rejection, and the FIPS 203 §7.2 encapsulation-key modulus check.
    • Hashing through Python's built-in hashlib SHA3 and SHAKE.
  • Self-tests (TestMLKEM1024) registered in test/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.py passes, 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 VERSION message 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 of ci-nightly-heavy.yml still checks out 0.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 to 1.x.x in resolve-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:53 points every job at the internal registry (CI_ENFORCE_INTERNAL_REGISTRY), and ci/test/00_setup_env_base_image.sh:41 builds image names from that prefix. The CentOS override at ci.yml:753 covers only that job.
  • ci/test/03_test_script.sh:222-229 selects ctest tests only through CTEST_INCLUDE_RANGE, and always builds target all.
  • ctest has one test per Boost suite (add_boost_test, src/test/CMakeLists.txt:210). The unit-test target is test_bitcoin; its executable is test_qbit.

Scope

  • ci-pq.yml, triggered by workflow_call and workflow_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-level if can't see matrix values.
  • First job, aarch64-unit, on GitHub's ubuntu-24.04-arm runner (free for public repositories), with a public-runner environment: image prefix docker.io/library, CI_ENFORCE_INTERNAL_REGISTRY=0, public DNS and search settings. It builds target test_bitcoin and runs bip324_tests and net_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) adds mlkem_tests.
  • ci/test/03_test_script.sh:
    • CI_BUILD_TARGET (default all), applied to both the normal and the verbose-retry build commands;
    • CTEST_REGEX, rejected when combined with CTEST_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: add workflow_call (inputs mirroring workflow_dispatch) and a jobs input that selects named jobs, such as previous-releases. When main calls it on a schedule, resolve-source must still resolve to 1.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-unit through ci.yml (C3's gate) on a clean hosted runner; its summary shows the source SHA and both suites as executed and passed. GitHub only allows workflow_dispatch for workflows on the default branch, so on-demand runs of ci-pq.yml go through C4's caller on main once this part merges.
  • gh workflow run ci-nightly-heavy.yml --ref <branch> -f run_test_matrix=true -f run_scanners=false -f jobs=previous-releases runs 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-direction handshakes counts, load_shedding.active, and each ring's last_sequence and dropped;
    • connections_in and connections_pq from getnetworkinfo;
    • on the pool node, the getpeerinfo entry for the pinned archive node: connection_type, transport_pq, transport_pq_status;
    • sample_ok: 1 when uptime, getnetworkinfo and (on the pool node) getpeerinfo answered.

    A missing field or a failed call is written as NA, never 0; v1.0.0 has neither connections_pq nor getpqtransportinfo. The raw recent_failures and fallback_set go to a local JSON-lines file per sample for the evaluator. Addresses stay on the node.

  • contrib/pq-canary/pq-canary-eval.py prints each figure with its sample count and pass, fail or unknown:

    • the pinned link is manual and hybrid in at least 99% of samples, excluding restarts;
    • no malformed_record or first_packet_failed entry, and no fallback entry, between known-good endpoints (a list file kept on the node);
    • closed_after_switch entries between known-good endpoints, listed for triage;
    • the canary archive node's connections_in stays within ±20% of the control's, relative to their baseline ratio, excluding the 48 hours after a restart.

    Rules: a drop in uptime is a restart gap. A sequence gap, a changed instance_id or a rise in dropped makes that interval unknown for that ring. Missing evidence is unknown, never clean. When an automatic connection holds the pinned address, GetAddedNodeInfo skips it (src/net.cpp:2906-2960); print the remedy: disconnectnode that peer once, and the -addnode thread reconnects it as manual within about 60 s.

  • 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 dropped increase or a sequence gap gives unknown.
  • A README: install, the cron line, and how to read the output.

Acceptance criteria

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

Scope

  • Two caller workflows on main:
    • .github/workflows/ci-maintained-pq.yml: on schedule (for example 15 4 * * *), calls [email protected] with source_ref: 1.x.x and secrets: inherit. It also has workflow_dispatch with source_ref and jobs inputs 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: on schedule (for example 45 4 * * *), calls [email protected] the same way.
  • Distinct run names and concurrency groups. main's existing 0.1.x nightly 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

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

  1. added
    enhancement
    pq-transport
    on Oct 5, 2026
  2. changed the title [-]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)[/+] on Oct 5, 2026
  3. djh58 commented on Oct 23, 2026

    @djh58
    MemberAuthor

    Done in #224, merged into feature/pq-transport as ad1d694. It reaches 1.1.0 with #233 and ships in 1.1.0.

  4. added a commit that references this issue on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpq-transport

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions