✨ (context-module) [DSDK-1142]: Add solana clear sign loaders#1511
✨ (context-module) [DSDK-1142]: Add solana clear sign loaders#1511fAnselmi-Ledger wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Pull request overview
Adds a set of Solana context-module loaders and supporting utilities to power the Solana generic clear-signing pipeline (static CAL descriptors + challenge-bound dynamic descriptors), and wires them into the context-module DI/export surface.
Changes:
- Added shared input-validation codecs (
deviceModelIdCodec,u8Codec) and stricter hex decoding (HexStringUtils.hexToBytes) with tests. - Implemented new Solana loaders + HTTP datasources for instruction-info (CAL), enum-variant (second-pass CAL), token-info (CAL), and dynamic descriptors (token-account-state, ALT resolution, trusted name), with tests.
- Extended context types/payload typings and registered new modules/loaders in DI + default loader set + package exports.
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/signer/context-module/src/shared/utils/u8Codec.ts | Adds a purify-ts codec for validating u8 (0..255) inputs. |
| packages/signer/context-module/src/shared/utils/u8Codec.test.ts | Unit tests for u8Codec decode/encode behavior. |
| packages/signer/context-module/src/shared/utils/HexStringUtils.ts | Adds hexToBytes with strict validation (non-empty, even-length, hex-only). |
| packages/signer/context-module/src/shared/utils/HexStringUtils.test.ts | Adds tests for hexToBytes success and failure cases. |
| packages/signer/context-module/src/shared/utils/deviceModelIdCodec.ts | Introduces a shared codec for supported clear-sign/tx-check device models. |
| packages/signer/context-module/src/shared/utils/deviceModelIdCodec.test.ts | Tests supported/unsupported device models for deviceModelIdCodec. |
| packages/signer/context-module/src/shared/model/ClearSignContext.ts | Extends ClearSignContextType with new Solana clear-signing context types. |
| packages/signer/context-module/src/modules/solana/trusted-name/domain/TrustedNameContextLoader.ts | New loader for challenge-bound Solana trusted-name descriptors + cert dedup. |
| packages/signer/context-module/src/modules/solana/trusted-name/domain/TrustedNameContextLoader.test.ts | Tests canHandle/load behavior for trusted-name loader. |
| packages/signer/context-module/src/modules/solana/trusted-name/di/trustedNameTypes.ts | DI symbols for Solana trusted-name module. |
| packages/signer/context-module/src/modules/solana/trusted-name/di/trustedNameModuleFactory.ts | DI container module binding trusted-name datasource + loader. |
| packages/signer/context-module/src/modules/solana/trusted-name/data/TrustedNameDataSource.ts | Defines trusted-name datasource interface and result types. |
| packages/signer/context-module/src/modules/solana/trusted-name/data/HttpTrustedNameDataSource.ts | HTTP implementation for Solana trusted-name reverse lookup + hex decode. |
| packages/signer/context-module/src/modules/solana/trusted-name/data/HttpTrustedNameDataSource.test.ts | Tests Solana trusted-name HTTP datasource request/response handling. |
| packages/signer/context-module/src/modules/solana/token-info/domain/TokenInfoContextLoader.ts | New CAL-backed token-info loader (mint pubkey keyed) with cert + signature selection. |
| packages/signer/context-module/src/modules/solana/token-info/domain/TokenInfoContextLoader.test.ts | Tests token-info loader dedup, error cases, mode selection, default network. |
| packages/signer/context-module/src/modules/solana/token-info/di/tokenInfoTypes.ts | DI symbols for token-info module. |
| packages/signer/context-module/src/modules/solana/token-info/di/tokenInfoModuleFactory.ts | DI bindings for token-info datasource + loader. |
| packages/signer/context-module/src/modules/solana/token-info/data/TokenInfoDataSource.ts | Defines token-info datasource contract and result types. |
| packages/signer/context-module/src/modules/solana/token-info/data/HttpTokenInfoDataSource.ts | HTTP datasource for CAL token-info descriptor lookup by mint. |
| packages/signer/context-module/src/modules/solana/token-info/data/HttpTokenInfoDataSource.test.ts | Tests token-info HTTP datasource behavior and errors. |
| packages/signer/context-module/src/modules/solana/token-account-state/domain/TokenAccountStateContextLoader.ts | Loader for challenge-bound token-account-state descriptors + per-batch cert dedup. |
| packages/signer/context-module/src/modules/solana/token-account-state/domain/TokenAccountStateContextLoader.test.ts | Tests token-account-state loader canHandle/load error handling. |
| packages/signer/context-module/src/modules/solana/token-account-state/di/tokenAccountStateTypes.ts | DI symbols for token-account-state module. |
| packages/signer/context-module/src/modules/solana/token-account-state/di/tokenAccountStateModuleFactory.ts | DI bindings for token-account-state datasource + loader. |
| packages/signer/context-module/src/modules/solana/token-account-state/data/TokenAccountStateDataSource.ts | Defines token-account-state datasource contract. |
| packages/signer/context-module/src/modules/solana/token-account-state/data/HttpTokenAccountStateDataSource.ts | HTTP datasource for token-account-state backend endpoint + hex decode. |
| packages/signer/context-module/src/modules/solana/token-account-state/data/HttpTokenAccountStateDataSource.test.ts | Tests token-account-state HTTP datasource request/hex validation/errors. |
| packages/signer/context-module/src/modules/solana/model/SolanaPayloads.ts | Adds new typed payloads (instruction-info, enum-variant, token-info, dynamic descriptors). |
| packages/signer/context-module/src/modules/solana/model/SolanaContextTypes.ts | Adds note about intentionally not widening Solana success union yet. |
| packages/signer/context-module/src/modules/solana/model/SolanaClearSignContext.ts | Extends Solana payload overrides + exports for new context payload types. |
| packages/signer/context-module/src/modules/solana/instruction-info/domain/InstructionInfoContextLoader.ts | CAL instruction-info loader (one call per programId, filters discriminators, bundles substructures). |
| packages/signer/context-module/src/modules/solana/instruction-info/domain/InstructionInfoContextLoader.test.ts | Extensive tests for instruction-info loader behavior, filtering, signature/mode, errors. |
| packages/signer/context-module/src/modules/solana/instruction-info/di/instructionInfoTypes.ts | DI symbols for instruction-info module. |
| packages/signer/context-module/src/modules/solana/instruction-info/di/instructionInfoModuleFactory.ts | DI bindings for instruction-info datasource + loader. |
| packages/signer/context-module/src/modules/solana/instruction-info/data/InstructionInfoDto.ts | DTO typings for CAL /solana?output=descriptors_instruction response. |
| packages/signer/context-module/src/modules/solana/instruction-info/data/InstructionInfoDataSource.ts | Datasource interface for fetching instruction descriptors per program. |
| packages/signer/context-module/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.ts | HTTP datasource for CAL instruction-info, unwraps envelope and validates presence. |
| packages/signer/context-module/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.test.ts | Tests instruction-info HTTP datasource success and error cases. |
| packages/signer/context-module/src/modules/solana/enum-variant/domain/EnumVariantContextLoader.ts | Second-pass enum-variant loader (fetches CAL per programId, emits only selected variants). |
| packages/signer/context-module/src/modules/solana/enum-variant/domain/EnumVariantContextLoader.test.ts | Tests enum-variant loader selection, deduped fetches, errors, cert failures. |
| packages/signer/context-module/src/modules/solana/enum-variant/di/enumVariantTypes.ts | DI symbols for enum-variant loader. |
| packages/signer/context-module/src/modules/solana/enum-variant/di/enumVariantModuleFactory.ts | DI module for enum-variant loader (reuses instruction-info datasource binding). |
| packages/signer/context-module/src/modules/solana/alt-resolution/domain/AltResolutionContextLoader.ts | Loader for challenge-bound ALT resolution descriptors + per-batch cert dedup. |
| packages/signer/context-module/src/modules/solana/alt-resolution/domain/AltResolutionContextLoader.test.ts | Tests alt-resolution loader canHandle/load and certificate dedup behavior. |
| packages/signer/context-module/src/modules/solana/alt-resolution/di/altResolutionTypes.ts | DI symbols for alt-resolution module. |
| packages/signer/context-module/src/modules/solana/alt-resolution/di/altResolutionModuleFactory.ts | DI bindings for alt-resolution datasource + loader. |
| packages/signer/context-module/src/modules/solana/alt-resolution/data/HttpAltResolutionDataSource.ts | HTTP datasource for ALT resolution endpoint + entryIndex validation + hex decode. |
| packages/signer/context-module/src/modules/solana/alt-resolution/data/HttpAltResolutionDataSource.test.ts | Tests ALT resolution HTTP datasource validation and error paths. |
| packages/signer/context-module/src/modules/solana/alt-resolution/data/AltResolutionDataSource.ts | Defines ALT resolution datasource contract and result types. |
| packages/signer/context-module/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.ts | Reuses shared deviceModelIdCodec for device validation in tx-check loader. |
| packages/signer/context-module/src/index.ts | Exports newly added Solana loaders/datasources from the package entrypoint. |
| packages/signer/context-module/src/di.ts | Registers new Solana module factories in the Solana DI branch. |
| packages/signer/context-module/src/DefaultContextModule.ts | Adds new Solana loaders to the default loader list for the Solana chain. |
| .changeset/plain-houses-itch.md | Declares a minor bump with a brief release-note entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
69975aa to
4e8bd56
Compare
4e8bd56 to
c340207
Compare
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
|



📝 Description
Ticket 1 of the Solana generic clear-signing: six new context-module loaders that fetch the static (CAL) and dynamic (challenge-bound) descriptors the merge engine needs.
What's in:
Loaders (
under modules/solana/):InstructionInfoContextLoader, CAL, one HTTP call perprogramIdfanned out in parallelEnumVariantContextLoader, second-pass API: caller supplies selected (programId, enumId, variantIndex) after running the host-sideIDL_TYPE_POOLwalkerTokenInfoContextLoader, CAL by mintpubkey, emitsSOLANA_TOKEN_INFOTokenAccountStateContextLoader,AltResolutionContextLoader,SolanaTrustedNameContextLoader, challenge-bound dynamic backendShared infra in shared/utils/:
deviceModelIdCodec, supported clear-sign device set (also adopted bySolanaTransactionCheckLoader)u8Codec, for byte-wide TLV fields (used by both loadercanHandlecodecs andHttpAltResolutionDataSource)signedDescriptorDtoCodec, purify-ts codec for the {signedDescriptor,keyId,keyUsage} envelope returned by every dynamic backend endpointmakeCertificateCache(loader, device), per-batch (keyId,keyUsage) cert-load memoiser, shared by the 3 challenge-bound loadersloadCertificateResult(loader, params), tagged-Result wrapper so cert+data canPromise.allwithout one path's rejection tanking the otherHexStringUtils.hexToBytes, rejects empty / 0x-only / odd-length / non-hexTypes:
ClearSignContextTypevalues + typed payload overrides +SolanaInstructionSubstructureKindenum mapping the 4 substructure type bytes.DI:
di.tsSolana branch +DefaultContextModule._getDefaultLoaders+ barrel exports.Notes:
canHandleinputs (per-loader codecs), dynamic backend envelopes (signedDescriptorDtoCodec), CAL responses (inline per-datasource codecs), u8 invariants (u8Codec)loadCertificateResult+Promise.all) the 3 challenge-bound loaders dedup per-batch cert loads viamakeCertificateCacheso N requests sharing the same PKI key issue 1loadCertificate, not NsignedDescriptorrejected at the codec, missing signature => ERROR context (not silent empty),loadCertificatewrapped intry/catch=> per-request ERROR, || (not ??) on network so "" also falls backSolanaContextSuccessTypedeliberately NOT widened to avoid breaking the signer's mapped registry, widening + handlers will land together in the device-action wiring PR❓ Context
✅ Checklist
Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.
🧐 Checklist for the PR Reviewers