-
Notifications
You must be signed in to change notification settings - Fork 7
Init Solana Contract Whitelist Policy #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| 'The RPC URL to use for the Solana cluster the transaction is intended for (used to verify blockhash). Only available for precheck, execute will use the Lit provided RPC URL.', | ||
| ) | ||
| .optional() | ||
| .nullable(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added .nullable due to a quirk of the Ability to Policy param mapping where even if the Policy schema defines a param as optional, it's actually always required if the Ability want to map a param to it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new Solana contract whitelist policy package that restricts which Solana programs can be invoked per cluster, integrates it with the Solana transaction signer ability, and refactors shared Solana helper functions into the ability-sdk package.
- Implements
policy-sol-contract-whitelistto validate Solana transactions against whitelisted program IDs per cluster - Integrates the new policy with
ability-sol-transaction-signerwith comprehensive E2E tests - Extracts
deserializeTransactionandverifyBlockhashForClusterhelper functions toability-sdkfor reuse
Reviewed changes
Copilot reviewed 34 out of 41 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/apps/policy-sol-contract-whitelist/* | New policy package implementation with schema validation, whitelist checking, and bundling configuration |
| packages/libs/ability-sdk/src/lib/abilityHelpers/solana/* | New shared Solana helpers for transaction deserialization and blockhash verification |
| packages/apps/ability-sol-transaction-signer/src/lib/vincent-ability.ts | Integration of whitelist policy with transaction signer ability |
| packages/apps/ability-sol-transaction-signer/test/e2e/policy-contract-whitelist.spec.ts | E2E tests validating policy enforcement on devnet (allowed) and mainnet-beta (denied) |
| packages/apps/ability-sol-transaction-signer/src/lib/schemas.ts | Updated schema to support nullable rpcUrl |
| tsconfig.json, nx.json, project.json files | Build configuration updates to include new package |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/apps/policy-sol-contract-whitelist/scripts/deploy-lit-action.js
Outdated
Show resolved
Hide resolved
…-action.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 34 out of 41 changed files in this pull request and generated 7 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
policy-sol-contract-whitelistdevnet, 'testnet', 'mainnet-beta')policy-sol-contract-whitelistas supported policy toability-sol-transaction-signerpackages/apps/ability-sol-transaction-signer/test/e2e/policy-contract-whitelist.spec.tsability-sol-transaction-signerandpolicy-sol-contract-whitelistto theability-sdkpackage:packages/libs/ability-sdk/src/lib/abilityHelpers/solana/deserializeTransaction.tspackages/libs/ability-sdk/src/lib/abilityHelpers/solana/verifyBlockhashForClusters.tsType of change
How Has This Been Tested?
Init test file:
packages/apps/ability-sol-transaction-signer/test/e2e/policy-contract-whitelist.spec.tswhich tests registering the Ability with a Policy where the program ID11111111111111111111111111111111is permitted ondevnet, but notmainnet-beta. Then the test uses the Ability to sign a transfer transaction (which uses the system program11111111111111111111111111111111) using bothdevnet(where it's expected to succeed) andmainnet-beta(where it's expected the Policy will reject Ability executino)To run the test:
git checkout -b feat/policy-sol-contract-whitelistpnpm i && pnpm buildcp packages/apps/ability-sol-transaction-signer/.env.example packages/apps/ability-sol-transaction-signer/.envpnpx nx run ability-sol-transaction-signer:test-e2e packages/apps/ability-sol-transaction-signer/test/e2e/generate-key.spec.tsto generate a Wrapped Key for your dev Agent PKPpnpx nx run ability-sol-transaction-signer:test-e2e packages/apps/ability-sol-transaction-signer/test/e2e/policy-contract-whitelist.spec.tsChecklist:
nx release plan) describing my changes and the version bump