smartcontract: fix multicast allowlist for allow_multiple_ip access passes#3552
Open
juan-malbeclabs wants to merge 4 commits intomainfrom
Open
smartcontract: fix multicast allowlist for allow_multiple_ip access passes#3552juan-malbeclabs wants to merge 4 commits intomainfrom
juan-malbeclabs wants to merge 4 commits intomainfrom
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #3551
Summary of Changes
AddMulticastGroupSubAllowlist,RemoveMulticastGroupSubAllowlist,AddMulticastGroupPubAllowlist, andRemoveMulticastGroupPubAllowlistto correctly handle AccessPasses created withallow_multiple_ip=true. These passes storeclient_ip=0.0.0.0and live at the dynamic PDA(0.0.0.0, user_payer). The processors were doing a strictclient_ipequality check that always failed when a real IP was passed in the instruction args.resolve_accesspass_pdato the SDK allowlist module. It tries the static PDA first and falls back to the dynamic PDA when anallow_multiple_ippass is found there. BothAddMulticastGroupSubAllowlistCommandandAddMulticastGroupPubAllowlistCommandnow use it.Diff Breakdown
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_ipwith zero IP in args, with real IP in args, and wrong PDA rejectedsmartcontract/programs/doublezero-serviceability/tests/multicastgroup_allowlist_publisher_test.rs— same 3 scenarios for publisher allowlistsmartcontract/sdk/rs/src/commands/multicastgroup/allowlist/mod.rs— newresolve_accesspass_pdahelper + 4 unit tests covering all PDA resolution branchessmartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/subscriber/add.rs— PDA validation extended to accept dynamic PDA;client_ipcheck made conditional on!allow_multiple_ip()smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/publisher/add.rs— same fix as subscriber addsmartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/subscriber/remove.rs— same fix applied to remove pathsmartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/allowlist/publisher/remove.rs— same fix applied to remove pathTesting Verification
allow_multiple_ipadd/remove (pub and sub) and wrong-PDA rejectionresolve_accesspass_pda