Skip to content

smartcontract: fix multicast allowlist for allow_multiple_ip access passes#3552

Open
juan-malbeclabs wants to merge 4 commits intomainfrom
jo/3551
Open

smartcontract: fix multicast allowlist for allow_multiple_ip access passes#3552
juan-malbeclabs wants to merge 4 commits intomainfrom
jo/3551

Conversation

@juan-malbeclabs
Copy link
Copy Markdown
Contributor

Resolves: #3551

Summary of Changes

  • Fix AddMulticastGroupSubAllowlist, RemoveMulticastGroupSubAllowlist, AddMulticastGroupPubAllowlist, and RemoveMulticastGroupPubAllowlist to correctly handle AccessPasses created with allow_multiple_ip=true. These passes store client_ip=0.0.0.0 and live at the dynamic PDA (0.0.0.0, user_payer). The processors were doing a strict client_ip equality check that always failed when a real IP was passed in the instruction args.
  • Add resolve_accesspass_pda to the SDK allowlist module. It tries the static PDA first and falls back to the dynamic PDA when an allow_multiple_ip pass is found there. Both AddMulticastGroupSubAllowlistCommand and AddMulticastGroupPubAllowlistCommand now use it.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 7 +254 / -18 +236
Tests 3 +868 / -0 +868

Mostly tests; the core fix is a small but targeted change to 4 processor files and the SDK PDA resolution logic.

Key files (click to expand)
  • smartcontract/programs/doublezero-serviceability/tests/multicastgroup_allowlist_subcriber_test.rs — 3 new integration tests for subscriber allowlist: allow_multiple_ip with zero IP in args, with real IP in args, and wrong PDA rejected
  • smartcontract/programs/doublezero-serviceability/tests/multicastgroup_allowlist_publisher_test.rs — same 3 scenarios for publisher allowlist
  • smartcontract/sdk/rs/src/commands/multicastgroup/allowlist/mod.rs — new resolve_accesspass_pda helper + 4 unit tests covering all PDA resolution branches
  • smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/subscriber/add.rs — PDA validation extended to accept dynamic PDA; client_ip check made conditional on !allow_multiple_ip()
  • smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/publisher/add.rs — same fix as subscriber add
  • smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/subscriber/remove.rs — same fix applied to remove path
  • smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/publisher/remove.rs — same fix applied to remove path

Testing Verification

  • 6 new program integration tests covering allow_multiple_ip add/remove (pub and sub) and wrong-PDA rejection
  • 4 new SDK unit tests covering all branches of resolve_accesspass_pda
  • All existing allowlist integration tests continue to pass

…asses

AccessPasses created with allow_multiple_ip=true store client_ip=0.0.0.0
and live at the dynamic PDA(0.0.0.0, user_payer). The allowlist processors
were doing a strict client_ip equality check that always failed when a real
IP was passed in the instruction args.

Fix the add/remove processors for both publisher and subscriber to:
- Accept the dynamic PDA when accesspass.allow_multiple_ip() is true
- Skip the client_ip equality check for allow_multiple_ip passes

Fix the SDK to auto-detect which PDA to use (static vs dynamic) via
resolve_accesspass_pda, falling back to the dynamic PDA when an
allow_multiple_ip pass is found there.
Program integration tests for pub/sub allowlist add/remove:
- allow_multiple_ip AccessPass at dynamic PDA (0.0.0.0) — add/remove succeed
- real IP in instruction args with dynamic PDA account — add/remove succeed
- wrong AccessPass PDA passed — rejected

SDK unit tests for resolve_accesspass_pda:
- returns static PDA when AccessPass exists there
- returns dynamic PDA for allow_multiple_ip pass at 0.0.0.0
- falls back to static PDA when neither account is found
- ignores dynamic PDA when allow_multiple_ip flag is not set
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.

smartcontract: multicast allowlist fails for allow_multiple_ip access passes

1 participant