refactor(token-2022/default-account-state): use kit codecs for instruction data - #675
refactor(token-2022/default-account-state): use kit codecs for instruction data#675amilz wants to merge 1 commit into
Conversation
…ith kit codecs Replace the borsh serializer in the Pinocchio example's test with a @solana/kit struct encoder and drop the borsh dependency.
Greptile SummaryThe PR replaces Borsh serialization of a one-byte instruction argument with an equivalent
Confidence Score: 3/5The code change appears behaviorally sound, but the PR must not merge until its commit is signed and verified. The new encoder preserves the program's one-byte instruction layout, but the sole commit lacks the repository-required verified signature. Files Needing Attention: Commit aceb167
|
| Filename | Overview |
|---|---|
| tokens/token-2022/default-account-state/pinocchio/tests/test.ts | Replaces Borsh serialization with an equivalent fixed-width Kit encoder for the program's single-byte decimals argument. |
| tokens/token-2022/default-account-state/pinocchio/package.json | Removes the unused Borsh dependency; the change is carried by an unsigned commit that violates the repository requirement. |
| tokens/token-2022/default-account-state/pinocchio/pnpm-lock.yaml | Removes Borsh lock entries and records LiteSVM platform libc metadata without changing resolved LiteSVM versions. |
Reviews (1): Last reviewed commit: "refactor(token-2022/default-account-stat..." | Re-trigger Greptile
|
@greptileai The unsigned-commit finding is incorrect. Commit `aceb167e8eaaad29b4ee11ac58a8e8c15392c516` is SSH-signed and verified by GitHub: ``` The `N` status comes from running `git log --format=%G?` in a checkout with no `gpg.ssh.allowedSignersFile` configured — git errors out on SSH signature verification and falls back to `N`. That reproduces on every commit in this repo, including `main` at `6fe04fee`, which GitHub likewise reports as verified. It's a property of the verifying environment, not of the commit. On the lockfile: the `libc: [glibc]/[musl]` lines are not incidental noise. They're what pnpm 10.33.0 (this repo's pinned `packageManager`) emits, and they match every other lockfile in the repo — the version added in #652 was generated by an older pnpm and had drifted. Regenerating with `pnpm@10.33.0 install --lockfile-only` produces exactly the committed file. |
|
Both corrections are valid — acknowledged on both counts. On the commit signature: you're right that On the lockfile: the Both findings were false positives. The PR looks good. Tip: You can customize Greptile's behavior for this repo with |
- create/mint: derive the mint-authority PDA directly with create_program_address (the canonical bump is already known and stored) instead of searching with find_program_address - test: build instruction data with @solana/kit codecs instead of the borsh package, and derive the ATA with findAssociatedTokenPda instead of hand-rolling the seeds (follows solana-foundation#675) - test stack: switch to mocha + tsx and @solana/kit ^7 per AGENTS.md / solana-foundation#656
What
The Pinocchio
default-account-statetest added in #652 serialized its instruction data with theborshpackage. This repo's TS examples standardize on@solana/kitcodecs, so swap it out and drop the extra dependency.Changes
tests/test.ts:borsh.serialize(CreateTokenArgsSchema, ...)→getStructEncoder([['tokenDecimals', getU8Encoder()]])package.json/pnpm-lock.yaml: removeborshMint account decoding was already using the official
@solana-program/token-2022codecs and is unchanged.Test
pnpm build-and-test→ 1 passing.tsc --noEmitclean.Note
tokens/token-2022/non-transferable/pinocchio(from #630) has the same borsh usage — left out of this PR, tracked separately.