Skip to content

fix(network): honor disable_pow in native header sync#289

Merged
ValarDragon merged 4 commits into
mainfrom
agent/honor-disable-pow-header-sync
Jul 20, 2026
Merged

fix(network): honor disable_pow in native header sync#289
ValarDragon merged 4 commits into
mainfrom
agent/honor-disable-pow-header-sync

Conversation

@ValarDragon

@ValarDragon ValarDragon commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Correct Ironwood history-leaf upgrade terminology in documentation.
  • Make native header sync honor disable_pow = true for 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 -- --check
  • cargo test -p zakura-network header_sync

Note

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 with disable_pow = true are 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.

ebfull added 2 commits July 20, 2026 00:48
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.
@v12-auditor

v12-auditor Bot commented Jul 19, 2026

Copy link
Copy Markdown

Note

Complete: Audit complete. V12 did not find any issues that need review.

Open the full results here.

Analyzed five files, diff 4002462...f58cc2c.

@ValarDragon
ValarDragon marked this pull request as ready for review July 20, 2026 22:24
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@ValarDragon
ValarDragon merged commit c5281f1 into main Jul 20, 2026
46 checks passed
@ValarDragon
ValarDragon deleted the agent/honor-disable-pow-header-sync branch July 20, 2026 22:42
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.

3 participants