Skip to content

sentinel: improve multicast publisher find/create commands#3507

Merged
snormore merged 12 commits intomainfrom
snor/sentinel-multicast-publisher-improvements
Apr 15, 2026
Merged

sentinel: improve multicast publisher find/create commands#3507
snormore merged 12 commits intomainfrom
snor/sentinel-multicast-publisher-improvements

Conversation

@snormore
Copy link
Copy Markdown
Contributor

@snormore snormore commented Apr 9, 2026

Summary of Changes

  • Fix owner bug: multicast publisher users were being created with the sentinel payer as owner instead of the validator's IBRL user owner, causing incorrect PDA derivation for access passes and user accounts
  • Add multi-value `--client` filter to both `find` and `create` commands (OR semantics, repeatable flag)
  • Add `--ip` filter to `create` command for targeting specific validator IPs; when no candidates match, show per-IP diagnosis explaining the exact skip reason (no IBRL user, already a publisher, not in validator metadata, client/stake filter mismatch)
  • Add "NEAREST DEVICE" column to both `find` and `create` plan output showing the closest DZ device with available multicast publisher capacity (geographic Haversine distance from the validator's current device)
  • Re-evaluate target device per-candidate during `create` execution so slots filled earlier in the run are reflected in subsequent device selection; warn-and-skip if no device has capacity
  • Consistent table formatting: `create` plan now uses `print_table` (same markdown-style table as `find`)
  • Strengthen e2e test by using a dedicated sentinel keypair (distinct from manager) and asserting the created multicast publisher owner matches the IBRL user's owner

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 5 +364 / -28 +336
Scaffolding 3 +106 / -43 +63
Tests 1 +37 / -2 +35

Primarily new logic: nearest-device selection, device info fetching, and the owner bug fix account for the bulk of additions.

Key files (click to expand)
  • crates/sentinel/src/nearest_device.rs — new module: Haversine distance, device capacity check, find_nearest_device_for_multicast
  • crates/sentinel/src/dz_ledger_reader.rsDzDeviceInfo struct and fetch_device_infos (batch fetches Device + Location accounts)
  • controlplane/doublezero-admin/src/cli/sentinel.rs — CLI wiring for all new flags, NEAREST DEVICE column, dynamic device re-evaluation loop, consistent table formatting
  • crates/sentinel/src/multicast_create.rsCandidateFilters gets clients: Vec<String> and ips: Vec<Ipv4Addr>; find_candidates accepts device_infos
  • crates/sentinel/src/dz_ledger_writer.rs — owner bug fix: explicit owner param used for PDA derivation, user_payer, and owner field (was using payer)
  • crates/sentinel/src/multicast_find.rsFindFilters.clients: Vec<String> replaces client: Option<String>
  • e2e/sentinel_multicast_publisher_test.go — dedicated sentinel keypair setup; asserts u.Owner == dn.Manager.Pubkey

Testing Verification

  • Unit tests in multicast_create.rs, multicast_find.rs, nearest_device.rs, and dz_ledger_writer.rs cover filter logic, capacity checks, Haversine distance, and instruction building with correct owner
  • E2E test TestE2E_SentinelMulticastPublisherCreatesPublishers updated to use a separate sentinel keypair so the owner assertion would have caught the bug before this fix

@snormore snormore force-pushed the snor/sentinel-multicast-publisher-improvements branch from 0e3e3ea to f8b2d9a Compare April 9, 2026 18:33
- Multi-value --client filter (OR semantics) for find and create commands
- --ip filter on create command to target specific validator IPs
- Nearest device column in find output (geographic Haversine distance)
- Dynamic device re-evaluation during create loop with local capacity tracking
- Fix owner bug: multicast publisher users now created with validator's owner, not the sentinel payer
- E2E test: separate sentinel keypair to catch owner assignment bugs
@snormore snormore force-pushed the snor/sentinel-multicast-publisher-improvements branch from 5c45baa to 914d31c Compare April 11, 2026 13:27
@snormore snormore marked this pull request as ready for review April 13, 2026 14:03
@martinsander00
Copy link
Copy Markdown
Contributor

Will approve. Just curious on why we use haversine distance instead of lowest latency device?

@snormore snormore merged commit 9583416 into main Apr 15, 2026
33 checks passed
@snormore snormore deleted the snor/sentinel-multicast-publisher-improvements branch April 15, 2026 19:09
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