Skip to content

cli: verify MulticastPublisherBlock in resource verify#3554

Merged
elitegreg merged 1 commit intomainfrom
gm/resource-verify-mcast-pub
Apr 21, 2026
Merged

cli: verify MulticastPublisherBlock in resource verify#3554
elitegreg merged 1 commit intomainfrom
gm/resource-verify-mcast-pub

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

Summary of Changes

  • Extend doublezero resource verify to cover the MulticastPublisherBlock resource extension, the global IP block from which multicast publisher users allocate their dz_ip. Previously only 7 of 10 ResourceType variants were verified; publishers' dz_ip allocations were invisible to the tool.
  • Check in both directions: every publisher user's in-range dz_ip must be allocated in the extension, and every allocation must have a matching user. Discrepancies flow through the existing insert_usage / check_discrepancies helpers and are auto-fixable via --fix.
  • Ignore legacy publishers whose dz_ip was allocated before this extension existed and falls outside the block's range (e.g. prior to MulticastPublisherBlock). Without this guard, those would be reported as UsedButNotAllocated and --fix would then fail because allocate_specific rejects out-of-range IPs.
  • Add MulticastPublisherBlock to the "Resources checked" summary output.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 1 +67 / -2 +65
Tests 1 +238 / -2 +236
Docs 1 +2 / -0 +2
Total 2 +307 / -4 +303

Mostly tests and a small, pattern-following addition to the verify CLI. Core logic is the new verify_multicast_publisher_block function plus imports/wiring.

Key files (click to expand)
  • smartcontract/cli/src/resource/verify.rs — new verify_multicast_publisher_block function, output + counter wiring, plus 2 new tests (happy path, out-of-range ignore) and updates to 4 existing tests to register the new extension.

Testing Verification

  • New unit test test_verify_multicast_publisher_block_happy_path — extension has 148.51.120.5 allocated, one publisher user holds it, expect no discrepancies.
  • New unit test test_verify_multicast_publisher_ignores_out_of_range_dz_ip — covers two edge cases: a publisher with a legacy dz_ip outside the block's range, and a non-publisher UserType::Multicast user with an in-range dz_ip; both must be ignored.
  • All 7 resource::verify tests pass; full doublezero_cli suite (296 tests) passes.

Extend `doublezero resource verify` to cover `MulticastPublisherBlock`,
the global IP block from which multicast publisher users allocate their
dz_ip. The command now checks that every publisher user's in-range dz_ip
is allocated in the extension and that every allocation has a matching
user, with the existing `--fix` flow handling both directions.

Legacy publishers whose dz_ip was allocated before the
MulticastPublisherBlock extension existed may have an IP outside the
block's range; those are ignored rather than reported as discrepancies.
@elitegreg elitegreg enabled auto-merge (squash) April 21, 2026 02:16
@elitegreg elitegreg disabled auto-merge April 21, 2026 02:19
Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean implementation, follows the existing verifier pattern well. Two small comments inline.

Comment thread smartcontract/cli/src/resource/verify.rs
Comment thread smartcontract/cli/src/resource/verify.rs
@elitegreg elitegreg merged commit 251cd90 into main Apr 21, 2026
36 checks passed
@elitegreg elitegreg deleted the gm/resource-verify-mcast-pub branch April 21, 2026 16:54
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.

2 participants