DEVREL-1012 fix squads vault detection #1871
Open
+104
−27
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.
Problem
https://4fnetmviidiqkjzenwxe66vgoa0soerr.lambda-url.us-east-1.on.aws/isSquad/${address}) by Squads only works for mainnet.Changes
Updated
isSquadsV4Vaultto takeeid: EndpointIdas first parameter and returnnullfor Solana testnet (40168), since the Squads API only works on mainnet (30168). Throws for unsupported EIDs.Refactored
assertValidSolanaAdminto use flattened early-return structure for better readabilityAllow for PDAs owned by Squads V3 program (
SMPLecH534NA9acpos4G6x7uf3LWbCAwZQE9e8ZekMu) - allows with warning instead of throwingAddressed missing case of when address is off curve by not owned by System Program or a Squads program (we should throw)
Removed
isPossibleSquadsVaultfunction (unused, logic consolidated intoassertValidSolanaAdmin)Added debug logging throughout address validation helpers using lazy logger factory pattern (fixes issue where logs weren't respecting
--log-levelflag)Testing
deploy and wire as usual, then refer to Proof of Test section
(update the delegate address in the LZ config)
Proof of Test
Tip: when looking through the logs, search for 'Solana addresses'.
When new delegate is regular (onCurve) address (EKXXXF8kzh4Bnq1HBHVwZgA5egJJWLDYqXmJTQtbbd5D)
When new delegate is a Squads v4 vault on devnet (DokBLkqgnws2GsfBcbowX1bYqk4noYEhcDDdTZDV8Yh)
When new delegate is a Squads v4 Multisig (invalid) on devnet (59jdDuB6khhBf9nwwyJfwGXPeEF2mxTMbQusNXGAXjff)