Skip to content

feat(sdk-coin-sol): confidential transfer token enablement (CHALO-1883) - #10019

Merged
bhavidhingra merged 1 commit into
masterfrom
bhavi/chalo-1883-sol-ct-enable-token
Oct 21, 2026
Merged

bhavidhingra merged 1 commit into
masterfrom
bhavi/chalo-1883-sol-ct-enable-token

Conversation

@bhavidhingra

Copy link
Copy Markdown
Contributor

feat(sdk-coin-sol): CT-aware token enablement

Refs: CHALO-1883

Summary

Makes enableToken CT-aware end-to-end in the SDK:

  • sdk-core: configureAccount opt-out flag (default true) flows through
    BuildTokenEnablementOptions, PrebuildTransactionWithIntentOptions, the
    intent payloads (both EVM and non-EVM paths), and the BuildParams codec.
  • sdk-coin-sol — CT enablement assembly: ConfidentialTransferBuilder.createAta
    accepts a CreateAssociatedTokenAccount (idempotent) instruction so one v1 tx
    carries CreateATA + ConfigureAccount + VerifyPubkeyValidity.
  • sdk-coin-sol — ConfigureAccount layout fix: the instruction data now includes
    the required 32-byte new_account_elgamal_pubkey (span 47 → 79, matching the
    on-chain ConfigureAccountInstructionData). The PR feat(sdk-coin-sol): durable-nonce support in ConfidentialTransferBuilder v1 #9968 layout omitted it and
    would have been rejected on-chain.
  • sdk-coin-sol — v1 wire parsing: Transaction.fromRawTransaction recognizes
    the 0x81 v1 wire, decodes the message into a metadata SolTransaction, and sets
    v1TransactionBytes/v1MessageBytes — verify/explain no longer assume legacy
    serialization.
  • sdk-coin-sol — verification: verifyTransaction accepts CT enable txs
    (explained type ConfidentialTransfer) under type: enabletoken, keeping the
    token-name/token-address spoof checks.
  • sdk-coin-sol — CT builder buildV1 parity with the v1 payment builder:
    injects AdvanceNonceAccount for durable nonce and fills signatures in
    compiled-signer order with zero-filled placeholders for unsigned builds.
  • instructionParamsFactory: preserves CreateAssociatedTokenAccount metadata
    on ConfidentialTransfer-typed parses (enablement round-trips keep the ATA entry).

Why

ConfigureAccount is not idempotent on-chain and registers a per-address ElGamal
key; server-side enablement (wallet-platform) needs an unsigned v1 wire it can
persist and sign via MPC. Both the layout fix and the unsigned-wire support were
required before any e2e could pass.

Testing

  • New: test/unit/transactionBuilder/confidentialEnablementV1.ts (3) —
    CreateATA + ConfigureAccount + VerifyPubkeyValidity v1 wire (0x81), instruction
    order, minimum-instruction guard.
  • New: test/unit/ctEnablementVerify.ts (2) — CT-enable tx accepted under
    type: enabletoken; token-name tamper still rejected.
  • Updated: confidentialTransferBuilder.ts tests for the 79-byte layout and the
    +32 offsets; confidentialTransferV1.ts / confidentialTransferV1Ops.ts
    call sites gain elgamalPubkey.
  • Regression: 62 CT-related tests passing locally.

Breaking changes

None for existing consumers: elgamalPubkey is only required by the CT
ConfigureAccount builder (no external callers), and enabletoken verification
only widens the accepted explained type.

@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

CHALO-1883

@bhavidhingra bhavidhingra changed the title feat(sdk-coin-sol): CT-aware token enablement (CHALO-1883) feat(sdk-coin-sol): confidential transfer token enablement (CHALO-1883) Oct 21, 2026
@bhavidhingra
bhavidhingra force-pushed the bhavi/chalo-1883-sol-ct-enable-token branch 2 times, most recently from a79c7a0 to e08228d Compare October 21, 2026 10:03
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

@bhavidhingra
bhavidhingra force-pushed the bhavi/chalo-1883-sol-ct-enable-token branch 2 times, most recently from 7fffea6 to 62c982e Compare October 21, 2026 13:13
…LO-1883)

- sdk-core: configureAccount opt-out flag flows through BuildTokenEnablementOptions,
  PrebuildTransactionWithIntentOptions, intent payloads, the BuildParams codec and
  the PopulatedIntent type
- sdk-coin-sol: ConfidentialTransferBuilder.createAta emits the idempotent CreateATA
  plus the Token-2022 Reallocate that adds the ConfidentialTransferAccount extension
  (ConfigureAccount fails on-chain without it)
- sdk-coin-sol: fix the ConfigureAccount data layout - add the required 32-byte
  new_account_elgamal_pubkey (span 47 -> 79, matching ConfigureAccountInstructionData);
  the PR #9968 layout omitted it and would have been rejected on-chain
- sdk-coin-sol: Transaction.fromRawTransaction parses v1 (0x81) wires, derives the
  transaction type from the parsed instructions (shared with the legacy path) and
  classifies CreateATA + ConfigureAccount txs as ConfidentialTransfer, not ATA-init
- sdk-coin-sol: verifyTransaction accepts CT enable txs (ConfidentialTransfer) under
  type enabletoken, keeping the token name/address spoof checks
- instructionParamsFactory: preserve CreateATA and CT metadata on CT-typed parses
- sdk-coin-sol: CT buildV1 parity with the v1 payment builder - AdvanceNonceAccount
  injection and compiled-order signature zero-fill for unsigned server builds
- tests: v1 enablement wire (4 instructions incl. Reallocate), CT verify acceptance
  and token-name tamper rejection
@bhavidhingra
bhavidhingra force-pushed the bhavi/chalo-1883-sol-ct-enable-token branch from 62c982e to f5a7ef5 Compare October 21, 2026 13:17
@bhavidhingra
bhavidhingra merged commit 78f56b2 into master Oct 21, 2026
26 checks passed
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