Skip to content

v0.8.0 — real Core pow.cpp retarget + all consensus constants from chainparams.cpp

Latest

Choose a tag to compare

@defenwycke defenwycke released this 26 Jul 09:49
a186243

Hazync v0.8.0 — the difficulty retarget and every consensus constant now come from real Core

METHOD_ID: 7a8b29e0d644eecd6c46d125d6646909f017c80a2de679301228d428cdccae3d
(supersedes ffdc6095… / cb114426…)

This release moves the last algorithmic piece of block-connection glue — the difficulty retarget — from
a hand-written transcription to Bitcoin Core's own compiled pow.cpp, and sources every remaining
consensus constant
straight from Core's chainparams.cpp. It is a re-baseline: the guest image id
changes, so proofs are re-verified against the new id (the live board is re-proven to match). Valid-block
behaviour is byte-identical — only the id moves.

What changed

  • Real CalculateNextWorkRequired in the guest. The guest compiles Core's actual pow.cpp +
    chain.cpp; calc_next_bits drives Core's own retarget through the real CBlockIndex. Proven
    byte-identical to the prior (validated) transcription over all 476 mainnet retargets + a fuzz sweep.
  • Every consensus constant sourced from Core. The guest also compiles kernel/chainparams.cpp:
    calc_next_bits and block_subsidy read powLimit, the 2-week timespan, the target spacing, and the
    halving interval straight from Core's real CChainParams::Main(). Every remaining Rust-side literal
    (retarget interval, block weight/sigop limits, the buried soft-fork heights, the SCRIPT_VERIFY_* bit
    positions) is runtime-pinned to Core's compiled value on every proving path — a mismatch aborts.
    Nothing consensus-relevant is a hand-typed magic number anymore.
  • Platform shims (coreshim/): no-op single-threaded locking + logging so Core's chain.h/
    chainparams.cpp compile on the freestanding zkVM target. Non-consensus glue only.

New continuously-enforced tests (CI)

  • Retarget differential — carved Core reproduces the actual on-chain nBits at all 476 mainnet
    retargets; clamp/powLimit/monotonicity invariants hold.
  • Script-flag differential — the guest's flag schedule is a proven sound superset of Core's
    GetBlockScriptFlags; buried forks flip at Core's exact heights; both exception blocks behave.
  • Chainparams anchor — Core's compiled constants equal the canonical mainnet values.

Compatibility / verification

  • Binaries: hazync-host-x86_64-linux-gnu (CPU) and …-cuda (CUDA, multi-arch sm_80/86/89/90 + PTX 90),
    both glibc 2.34+ (ubuntu:22.04), both embedding the new guest id. Verify with ./hazync-host-… method-id.
  • Reproduce the canonical id: docker build -f reproduce/Dockerfile -t hazync-repro . && docker run --rm hazync-repro.
  • Proofs under earlier ids don't verify against this id (expected — new guest); the coordinator
    re-verifies every submission and the board is re-proven at the new id.