Skip to content

Tooling: 2.25× faster mixed-point scalar digests with identical receipts - #1984

Merged
Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
VictorLiwentao:cursor/mixed-point-scalar-digest-60b9
Oct 14, 2026
Merged

Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
VictorLiwentao:cursor/mixed-point-scalar-digest-60b9

Conversation

@VictorLiwentao

Copy link
Copy Markdown
Contributor

Change and scope

At base 0b1cccf86e2f5132ed286a26ef0a681a495740ea, the historical mixed-point audit (scripts/audit_mixed_point.py) and the early-sharing screen both call scalar_check on large cancellation-free circuits. Profiling shows a large share of that helper’s time in per-node json.dumps((node, args), …) and per-output json.dumps((i, node), …) while building circuit_sha256.

This PR writes the same UTF-8 digest lines with an equivalent hand-rolled formatter ([node,null], [node,[a,b]], [i,node]), keeps every support and topology require, and leaves circuit_sha256 unchanged. No certificate source_sha256 pin lists audit_mixed_point.py; the mixed-point and early-sharing mathematical payloads stay fieldwise identical to the committed files.

Tooling improvement; no new kappa. Selected frontier untouched.

Result

On Linux / CPython 3.12.3 (Linux-6.12.94+-x86_64-with-glibc2.39), five alternating fresh-process pairs timing only scalar_check on the fixed mixed-point circuit set gave median wall time 10.004 → 4.444 seconds (2.25×). Timing is host-descriptive and is not a correctness gate. Every scalar receipt matches the baseline checker fieldwise (roles, circuit_sha256, flags).

Package: research/mixed-point-scalar-digest/.

Validation

python3.12 -I -B research/mixed-point-scalar-digest/verify.py
python3.12 -I -O -B research/mixed-point-scalar-digest/verify.py
python3.12 -B scripts/research_package.py --package research/mixed-point-scalar-digest
python3.12 -I -B research/mixed-point-scalar-digest/benchmark.py --rounds 5

Expected:

PASS_MIXED_POINT_SCALAR_DIGEST scalar_cases=7 encoding_cases=5 certs=0 no_new_kappa
PASS_REGISTERED_RESEARCH_PACKAGE research/mixed-point-scalar-digest outcome=completed
PASS_IDENTICAL_MIXED_POINT_SCALAR_RECEIPTS

Default verify is read-only. Full make verify, selected cold replay, Lean, and multiplication-theorem obligations were not rerun for this isolated historical-checker change.

Overlap and credit

Closest priors (different objects): CrocSwap/integer-mult-bounds#756, CrocSwap/integer-mult-bounds#1793, CrocSwap/integer-mult-bounds#1861, CrocSwap/integer-mult-bounds#1922, CrocSwap/integer-mult-bounds#1217, and research/rational-containment-performance/ (mixed-point contained adapter). Open CrocSwap/integer-mult-bounds#1874 optimizes a different hosted-audit digest path and does not touch scalar_check. No competing open PR on the scalar_check digest object at refresh.

Douglas R. Colkitt authored the mixed-point and early-sharing screens and original checkers. Prepared by Wentao Li (VictorLiwentao, @Is__Victor) with substantial AI assistance, under Apache-2.0.

Replace per-node json.dumps in audit_mixed_point.scalar_check with a
byte-identical hand-rolled line writer. Preserve circuit_sha256, support
checks and mixed-point/early-sharing mathematical payloads.
Five alternating fresh-process pairs on CPython 3.12.3 / Linux give median
10.004 → 4.444 seconds with fieldwise-identical scalar receipts. Cap package
command timeouts under the 1200s generic replay budget.
@Mister-Meeseeks

Copy link
Copy Markdown
Contributor

Batch review at 3221e1066aacf2f96d18d9989fcd02b93ff337f2.

Merged to main, preserving the original contributor commits and package attribution.

Reviewed scope: Shared-point scalar digest optimization preserves canonical bytes for the complete declared scalar and encoding fixtures against the pinned prior implementation. Assertion-enabled replay, optimized replay and regression tests pass. Author timing ratios are not independently benchmarked; no mathematical claim.

The pinned scoped command passed; the batch ledger contains its command, input hashes, environment and log. This incorporates the research/tooling contribution and does not change the selected κ or discharge the inherited multiplication-theorem assumptions.

Batch review, attribution and evidence. Thank you for the contribution.

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.

2 participants