Skip to content

test(network): prototype GetBlocks regulation properties - #860

Draft
evan-forbes wants to merge 2 commits into
docs/peer-message-regulationfrom
test/get-blocks-property-infrastructure
Draft

test(network): prototype GetBlocks regulation properties#860
evan-forbes wants to merge 2 commits into
docs/peer-message-regulationfrom
test/get-blocks-property-infrastructure

Conversation

@evan-forbes

@evan-forbes evan-forbes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Motivation

Exercise the peer-message addition contract on one concrete request. GetBlocks needs property checks for its wire bounds, invalid ranges, canonical encoding, and specification-defined Work charge.

Solution

  • Add one production GetBlocks declaration for payload, allocation, range, and Work bounds.
  • Enforce the message-specific payload cap from the fixed frame header before payload allocation.
  • Reject GetBlocks ranges that extend above Height::MAX.
  • Add reusable legal-value, deterministic-boundary, bounded-payload, frame, and canonical-encoding checks.
  • Define a closed inventory of single-rule violations and execute every violation deterministically.
  • Compare the declared Work calculation with an independent transcription of the specification equation.

This draft does not claim full regulation conformance. The production Work bucket, Delay, concurrency slots, and terminal refunds remain follow-up work.

Testing

  • cargo test -p zakura-network block_sync::property_tests -- --nocapture
  • cargo test -p zakura-network zakura::transport::registry::tests -- --nocapture
  • cargo test -p zakura-network codec_ -- --nocapture
  • cargo test -p zakura-network inbound_frame_cap_rejects_over_message_frame_before_reading_payload -- --nocapture
  • cargo clippy -p zakura-network --lib --tests --no-deps -- -D warnings
  • cargo fmt --all -- --check
  • codespell on the changed design and specification documents

Changelog

Added the explicit internal-only fragment at docs/changelog/unreleased/860.md.

Specifications & References

Built on the peer message regulation design and specification in #747.

Follow-up Work

Implement the production serving Work bucket, Delay, concurrency-slot ownership, terminal refunds, and the stateful two-peer comparison.

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.

1 participant