Repository navigation
Add canonical Adler-32 state with deferred reduction - #252
Conversation
|
Review of The combined review tree passes the Adler arithmetic, malformed-witness, caller-stack, and regression tests, but Separate immutable historical-source verification from current measurement reproduction. Continue checking the pinned commit's blobs against the historical hashes, and compare current policy-produced bytecode, witnesses, outputs, stack peaks, options and dependency pins against the recorded measurements. Current shared-file hashes should not be required to equal a historical standalone tree, and the test file's self-hash needs the same treatment. Do not simply refresh historical measurements to hide the difference. Please demonstrate that the artifact check still catches a real arithmetic/bytecode mutation but permits adding an unrelated module or metric test. I am excluding this PR from integration #263 until that is addressed. |
…ibility fixes Exclude Adler-32 PR #252 pending reproducible artifact validation fixes.
Preserve CRC and Adler modules, all existing catalog records and metric tests. Assign Adler negative result NR-087 and open question OP-043 to avoid IDs already used on main. Historical Adler metrics and source bindings remain unchanged.
|
Thanks for the careful review, @RobinLinus! 🙂 This is addressed in ddeccda, and I merged the current Historical provenance and current reproduction now have separate checks. The historical audit still verifies all 17 pinned blobs, including the original test and measurement code. Current reproduction compares every report field except The regression test permits unrelated shared-file hash changes and rejects a genuinely compiled/executed arithmetic mutation. I also temporarily changed the actual source's initial accumulator from 1 to 2: the full artifact check failed as expected, then passed with the original implementation restored. All nine Adler contract tests pass on the combined tree. The merge preserves both CRC and Adler modules, all existing catalog entries and metric tests. Adler's documentation IDs are now NR-087 / OP-043 to avoid collisions on Thanks again for catching the integration issue! |
|
Hi @RobinLinus, a quick follow-up on the fix in ddeccda / 8190f67. I re-checked it end to end against the real artifact test, not only the synthetic regression test 🙂 On the PR head
Only I think this is ready for another look whenever you have time. Thanks again for the thorough review! |
|
The earlier shared-source hash blocker is resolved. All nine Adler-32 contract tests passed locally, including historical source verification, malformed inputs, exact stack frontiers, and a compiled arithmetic mutation. The focused metric also passes on the combined branch. Approved for integration via #289; its Adler research identifiers become NR-109/OP-065 to avoid the sorting collision, without changing the historical artifact. |
The new
arithmetic::checksums::adler32::adler32_state(n)fragment consumes 0..=997 canonical byte-valued ScriptNums and returns both Adler residues while preserving caller main/alt stacks. It validates inputs before allocating accumulators, then delays modular reduction using proven four-byte ScriptNum bounds. The original schedule rejects 996/997 inputs at the first 1,001-item state; the new schedule accepts 997 at exactly 1,000 without increasing script bytes.At the same 32-input/two-output boundary, it costs 636 fragment / 645 complete test-leaf bytes versus 740/749 for prefix-bounded streaming, with 97 serialized data-witness bytes, 32 ordinary data items, zero hints, and peak 35. The 997-input fragment is 19,122 bytes versus the streaming baseline's explicitly unoptimized 41,253 bytes. Raw/final fragment and leaf hashes, independent compiler-policy flags, witness hashes, pins, source-file bindings and boundaries are recorded for all 31 comparison rows.
The shared contracts cover three checksum schedules plus canonical/numeric u32 bit adapters: hostile inputs at every position, permitted aliases, asymmetric ordering, short inputs, both caller stacks, exact resource boundaries, original/repaired scheduling controls, deliberate mutations of compiled validation guards and both terminal predicates. Independent zlib supplies 555 deterministic result vectors. Current reproduction compares every measurement and all seven catalog configurations, excluding only whole-file
source_sha256metadata. A separate full-clone audit checks all 17 historical blobs, including the original measurement code and test, against immutable source commit250f23861a87ee10b2a7e1ea3de07dcf8569e820. The historical report and measurements are unchanged. Regression coverage permits unrelated source changes while detecting an actually compiled arithmetic/bytecode mutation.RFC 1950 already specifies delayed Adler reduction; this contribution is its ScriptNum/stack specialization. Adler is a non-cryptographic corruption checksum, with a documented three-byte collision. It does not authenticate data or return packed network-order bytes. Evidence is
locally-reproduced, deploymentunclassified; no Bitcoin Core or relay-policy acceptance is claimed. NR-087 records the rejected schedule and dominated baseline, OP-043 defines the remaining complete-spend criterion. All 135 current main catalog records and envelope fields are preserved; the combined tree contains 136 records and 435 configurations.The branch includes current
main(adda14fe4895b4d783e6c41197f3e59553945bac) with both checksum modules, every existing catalog record and every metric test preserved.Validation on delivered head
8190f6762df355a50e887f859b8cbbd99516e041:CARGO_PROFILE_TEST_OPT_LEVEL=1 cargo test --offline --locked -- --skip fields::: 1,247 passed, 25 ignored across 19 suites; no metric refresh.Rust tests use
CARGO_PROFILE_TEST_OPT_LEVEL=1with debug assertions and overflow checks retained. Script compilation uses the centralized bounded policy. No field-arithmetic tests were run.