fix(network): honor disable_pow in native header sync#289
Conversation
The ZIP-221 V3 history leaf and the Ironwood note-commitment tree root start at NU6.3, not NU7, and the combined chain-history/auth-data block commitment format starts at NU5, not NU6.3. Comment-only changes.
Native header sync's wire-level PoW gating keyed on Regtest parameters instead of the effective PoW mode: validate_solution_sizes required the common 1344-byte solution shape and validate_pow_blocking enforced the difficulty filter on every non-Regtest network. A configured Testnet with disable_pow = true therefore had its headers rejected during native header sync and could never sync, even though semantic and checkpoint block verification intentionally skip Equihash and difficulty checks in that mode. Both helpers now return early when disable_pow is set, matching block verification. Canonical Regtest always sets disable_pow, so it keeps its previous skip behavior; PoW-enabled Mainnet and Testnet still require the common solution shape and the full difficulty filter. New regressions pin that PoW-disabled networks accept both parseable solution shapes and that a custom non-Regtest disable_pow Testnet passes the header-sync PoW filter.
|
Note Complete: Audit complete. V12 did not find any issues that need review. Open the full results here. Analyzed five files, diff |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_4fb26a3c-81e7-4ec0-94e8-58af1dae48d5) |
…ow-header-sync # Conflicts: # CHANGELOG.md # zakura-network/CHANGELOG.md
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_29cb4f37-cfaf-4a4f-9a17-565e117d018a) |
…ow-header-sync # Conflicts: # CHANGELOG.md
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_dd98d6a9-a2f9-41d9-a9b6-c332b8789413) |
Summary
disable_pow = truefor configured Testnets.Root cause
Native header sync used Regtest-parameter detection to bypass Equihash and difficulty checks, while semantic and checkpoint verification use
Network::disable_pow(). Custom Testnets with proof of work disabled could therefore have valid headers rejected by native header sync.Solution
Use the existing
Network::disable_pow()predicate for native header-sync solution-size and proof-of-work validation, and retain focused regression coverage.Testing
cargo fmt --all -- --checkcargo test -p zakura-network header_syncNote
Medium Risk
Touches consensus-adjacent header-sync validation; behavior change is scoped to PoW-disabled test networks and matches existing block verification.
Overview
Native header sync now skips Equihash solution-size checks and PoW/difficulty validation whenever
Network::disable_pow()is true, instead of only when Regtest parameters are used. That aligns header sync with semantic and checkpoint verification so custom Testnets withdisable_pow = trueare not rejected for invalid-looking PoW while blocks would still verify.Tests cover PoW-disabled custom testnets (solution sizes and stateless validation). Docs only: Ironwood/ZIP-221 comments are retagged from Nu7 to NU6.3, and the NU5+ header commitment comment in commitment aux verification is corrected.
Reviewed by Cursor Bugbot for commit c9317ea. Bugbot is set up for automated code reviews on this repo. Configure here.