Skip to content

fix(cct-sdk): Refactor solana token-admin-registry ops - #309

Merged
mervin-link merged 54 commits into
cct-sdkfrom
fix/refactor-solana-ops
Jul 31, 2026
Merged

fix(cct-sdk): Refactor solana token-admin-registry ops#309
mervin-link merged 54 commits into
cct-sdkfrom
fix/refactor-solana-ops

Conversation

@mervin-link

@mervin-link mervin-link commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

What

  • Refactor Solana TokenAdminRegistry lookup-table operations to support canonical poolType or custom poolProgramAddress
  • Centralize pool-program reference types and resolution
  • Improve lookup-table and set-pool test organization and validation coverage (generate, validation, execute)
  • Refresh the root lockfile for npm ci compatibility

Why

  • Make Solana CCT pool operations easier to use with canonical pool types while preserving custom-program support
  • Ensure to keep test coverage aligned with the operation lifecycle

Note

  • I'll follow up to refactor the remaining test files.

@mervin-link
mervin-link requested a review from apedrob July 24, 2026 11:41
@mervin-link
mervin-link requested review from a team, PabloMansanet and aelmanaa as code owners July 24, 2026 11:41
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

You must have Developer access to commit code to Chainlink Labs on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes.

Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles

Base automatically changed from feat/DAPP-10574-get-state to cct-sdk July 27, 2026 16:12
Comment thread ccip-sdk/src/cct/solana/token-admin-registry/operations/append-to-lookup-table.ts Outdated
Comment thread ccip-sdk/src/cct/solana/token-admin-registry/operations/append-to-lookup-table.ts Outdated
Comment thread ccip-sdk/src/cct/solana/validate.ts
Comment thread ccip-sdk/scripts/pack-cct.mjs Outdated
@mervin-link
mervin-link requested a review from apedrob July 28, 2026 12:07
Comment thread ccip-sdk/src/cct/solana/token-admin-registry/operations/append-to-lookup-table.ts Outdated
Comment thread ccip-sdk/src/cct/solana/validate.test.ts
Comment thread ccip-sdk/src/cct/solana/validate.ts Outdated
@aelmanaa

Copy link
Copy Markdown
Collaborator

Ran this branch live on Solana devnet before reviewing, and the refactored ops work exactly as advertised end-to-end: deployTokendeployTokenPool(poolType: 'burn-mint')getTokenPoolState returns the real config (mint BWUrSHFZfzjvdSbWyKFUjHNYdwtUrNHAPMnubuMT2o2w, pool state 5cjjtbSdiEJhLuMvaD3a1VtiHM7wFfg14wdry1tfTK8m); the wrong-poolType path surfaces the typed TOKEN_POOL_STATE_NOT_FOUND error correctly; and both createLookupTable(poolType) (ALT 3Q4JFBN3Mpr3ShJTrrzYhJ4tdZ2k8Fy6r5Hybhfyw8Wm) and the new appendToLookupTable(poolType) shape (ALT YzhNLSwvRvZGxjgme3vdsCeTuNFcGkpCcEHzpttKVjW) write the identical, correct 10-address canonical block on-chain. The test reorganization is a real step up too — the generate/validation/execute grouping and the named param unions read very well.

Two non-blocking notes:

  1. files vs exports — +1 to @mervin-link's point: with ./cct/evm / ./cct/solana now public exports, ccip-sdk/package.json#files still carries !dist/cct/** and !src/cct/**, so the published tarball would exclude the very files the exports resolve to (and CI build fails for the same reason — publint reports ./dist/cct/evm/index.js and ./dist/cct/solana/index.js do not exist in the pack). If the intent is that CCT ships publicly now, dropping those two negations is the whole fix:
   "files": [
     ...
-    "!dist/cct/**",
-    "!src/cct/**"
   ]
  1. Follow-up polish batch (all outside this PR's diff, so not anchoring them here):
    • An actionable recovery hint for TOKEN_POOL_STATE_NOT_FOUND (currently restates the error; suggest "verify poolType matches the deployed pool / pass poolProgramAddress for custom / confirm the pool is initialized for this mint on this cluster").
    • Typed decode<{ version: number; config: TokenPoolConfig }> plus wrapped non-Error causes and an accountOwner field in the decode-error context in programs/token-pool.ts (cheapest wrong-program diagnostic).
    • A structured CCTDataDecodeError(account, …) signature matching its sibling CCT errors.
    • Two getTokenPoolState TSDoc touches: missing const cct = SolanaTokenManager.fromChain(chain) line in the example, and a caveat that poolProgramAddress results omit lock-release-specific fields; plus a doc line on GetTokenPoolStateResult.programId being the resolved input reference.

@mervin-link

mervin-link commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author
  • Two getTokenPoolState TSDoc touches: missing const cct = SolanaTokenManager.fromChain(chain) line in the example, and a caveat that poolProgramAddress results omit lock-release-specific fields; plus a doc line on GetTokenPoolStateResult.programId being the resolved input reference.

Fixed this. Will do a follow up for the others.

@mervin-link
mervin-link requested a review from aelmanaa July 28, 2026 15:03

@aelmanaa aelmanaa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approve — M1 fixed and live-proven at cbdb519.

Re-reviewed at cbdb519 (was d0b2786). All 4 inline comments are resolved:

  • M1 (Object.hasOwn → value semantics) ✅validate.ts:101-102 and append-to-lookup-table.ts:77-78 both changed from Object.hasOwn to !== undefined. The appendToLookupTable.validate() now delegates to resolvePoolProgram (single source of truth). Live-proven on devnet: { poolProgramAddress, poolType: undefined } passes validate() and buildUnsigned() cleanly, and executes on-chain (ALT filled to 10 canonical addresses).
  • N-clt (createLookupTable pool ref validation) ✅create-lookup-table.ts:76: resolvePoolProgram(this.name, params) added to validate(), matching the sibling append op.
  • M1-t (regression test) ✅validate.test.ts: new test 'resolves pool references with the other key explicitly undefined' (both directions). Also append-to-lookup-table.test.ts: new test 'ignores an undefined unused pool reference'.
  • TSDoc polish ✅programId doc added ("resolved pool program address"), lock-release-fields caveat added, const cct = SolanaTokenManager.fromChain(chain) added to examples.

One non-blocking nit stands: files vs exports in package.json!dist/cct/** and !src/cct/** still exclude the files the public exports resolve to. Already raised by mervin-link; the fix is dropping the two negations.

Gates: npm ci works clean, npm run check green (prettier + eslint + tsc), 26/26 touched tests pass.

@mervin-link
mervin-link merged commit 21d698d into cct-sdk Jul 31, 2026
2 of 4 checks passed
@mervin-link
mervin-link deleted the fix/refactor-solana-ops branch July 31, 2026 16:02
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.

3 participants