Solana CT: SDK Phase 1a — confidential transfer instruction builders - #9620
Open
bhavidhingra wants to merge 2 commits into
Open
Solana CT: SDK Phase 1a — confidential transfer instruction builders#9620bhavidhingra wants to merge 2 commits into
bhavidhingra wants to merge 2 commits into
Conversation
Contributor
Contributor
|
|
bhavidhingra
force-pushed
the
bhavi/chalo-1090-solana-ct-sdk-phase1
branch
3 times, most recently
from
September 2, 2026 11:06
d74028c to
46370e0
Compare
bhavidhingra
added a commit
that referenced
this pull request
Sep 2, 2026
…lidation Fixes from PR #9620 review: 1. Use s8() for signed proof instruction offsets (was u8 — negative offsets would wrap without guarantee) 2. Single-pass parser preserving instruction order (was concatenating CT + custom arrays, breaking round-trip fidelity) 3. VerifyPubkeyValidity context state mode support (was always requiring proofData, throwing for context state callers) 4. Assert context state addresses provided when offset == 0 (was silently omitting accounts, causing on-chain failures) 5. Validate numeric strings before BigInt() (was throwing raw SyntaxError) 6. Fix ZK proof program ID to canonical on-chain constant ZkE1Gama1Proof111... (was using devnet sandbox deployment). Add .zkProofProgramId() builder setter for custom deployments. 7. Remove Omit<X['params'], never> no-op type 8. from() routing: detect CT transactions by programId + discriminators and route to ConfidentialTransferBuilder (was always routing to CustomInstructionBuilder) 35 CT unit tests, 701 total — all passing. CHALO-1090
…builders (Phase 1a) Add SDK instruction builders for Solana Token-2022 confidential transfers: - ConfigureAccount (47B): one-time ATA setup for CT extension - ApplyPendingBalance (46B): credits pending → available (idempotent) - Deposit (11B): public → confidential conversion - Withdraw (49B): confidential → public conversion (eq + range proofs) - Transfer (169B): confidential → confidential (eq + validity + range proofs) - VerifyPubkeyValidity, VerifyEquality, VerifyValidity, VerifyRange proof builders All instruction layouts verified against canonical Rust source (solana-program/token-2022). Builders are v0/v1-agnostic — produce instruction data + account metas only; caller assembles v1 transactions. Review fixes applied: - s8() for signed proof instruction offsets (was u8) - Single-pass parser preserving instruction order - VerifyPubkeyValidity context state mode support - Assert context state addresses when offset == 0 - Validate numeric strings before BigInt() - Canonical ZK proof program ID (ZkE1Gama1Proof111...) + .zkProofProgramId() setter - from() routing: detect CT txs by programId + discriminators - Remove Omit<X['params'], never> no-op type New ConfidentialTransferBuilder class with fluent setters for all CT instruction types. Factory wiring via getConfidentialTransferBuilder(). Parser round-trip preserves CT instruction metadata. 35 unit tests covering all instruction layouts, account metas, context state vs inline proof modes, signed offsets, validation, and from() routing. 701 total tests passing. CHALO-1090
bhavidhingra
force-pushed
the
bhavi/chalo-1090-solana-ct-sdk-phase1
branch
from
September 2, 2026 12:49
3a04636 to
3242781
Compare
… value Replace CustomTx piggyback + runtime discriminator sniffing with a first-class TransactionType.ConfidentialTransfer enum value, matching the pattern used by ERC-7984 confidential token types. CT detection now happens once at the classification layer (getTransactionType / deriveTransactionType) instead of being scattered across builder factory sniffing. The CustomTx path is restored to handle only actual custom transactions. CHALO-1090
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.
Description
Adds Token-2022 confidential transfer (CT) transaction construction in `sdk-coin-sol` for Phase 1a (deposits + transfers + conversions, without TransferFee).
This PR replaces the earlier PR #9384 which was scoped to ConfidentialMint + proof-account tx group (Phase 2 / v0 obsolete). The new PR is Phase 1a-only, with all instruction layouts verified against the canonical Rust source (`solana-program/token-2022`).
New instruction builders
Key design decisions
Issue Number
CHALO-1090
Type of change
How Has This Been Tested?
18 new unit tests covering:
All 680 existing sdk-coin-sol unit tests continue to pass.
```bash
cd modules/sdk-coin-sol
yarn mocha --grep "Confidential Transfer Builder" --timeout 30000 # 18 passing
yarn mocha --timeout 60000 # 680 passing
```
Checklist: