Skip to content

refactor(token-2022/transfer-fee): encode instruction data with kit codecs - #681

Merged
dev-jodee merged 1 commit into
solana-foundation:mainfrom
MarkFeder:tokens-token-2022-transfer-fee-kit-codecs
Aug 10, 2026
Merged

refactor(token-2022/transfer-fee): encode instruction data with kit codecs#681
dev-jodee merged 1 commit into
solana-foundation:mainfrom
MarkFeder:tokens-token-2022-transfer-fee-kit-codecs

Conversation

@MarkFeder

Copy link
Copy Markdown
Contributor

Follow-up consistency cleanup on the merged token-2022/transfer-fee/pinocchio example.

Builds the CreateToken instruction data with @solana/kit codecs (getStructEncoder + getU8Encoder) instead of the borsh npm package, and drops the borsh dependency. This matches the pattern applied in default-account-state (#675, @amilz) and pda-mint-authority, keeping the pinocchio token-2022 examples consistent.

No on-chain change — the litesvm test passes unchanged (verified on the Linux/SBF path).

…odecs

Build the CreateToken instruction data with @solana/kit codecs
(getStructEncoder + getU8Encoder) instead of the borsh package, and drop
the borsh dependency. Matches the approach used in default-account-state
(solana-foundation#675) and pda-mint-authority, keeping the pinocchio token-2022 examples
consistent. No on-chain change; the litesvm test passes unchanged.
@MarkFeder
MarkFeder requested a review from dev-jodee as a code owner August 8, 2026 09:52
@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR replaces Borsh serialization of the one-byte CreateToken argument with equivalent @solana/kit codecs and removes the now-unused Borsh dependency.

  • Defines a struct encoder containing one u8 field.
  • Uses that encoder when constructing the LiteSVM test instruction.
  • Removes Borsh from the package manifest and lockfile.
  • The code change is consistent with the program’s one-byte wire format, but the commit is unsigned.

Confidence Score: 4/5

The code change appears behaviorally safe, but the unsigned commit must be re-signed and verified before merging.

The Kit encoder emits the same single-byte decimals argument consumed by the program, and the dependency cleanup is consistent; the remaining merge blocker is that the only pull-request commit has no signature.

Important Files Changed

Filename Overview
tokens/token-2022/transfer-fee/pinocchio/tests/test.ts Replaces Borsh serialization with a Kit struct/u8 encoder that preserves the program’s one-byte instruction layout.
tokens/token-2022/transfer-fee/pinocchio/package.json Removes the Borsh runtime dependency after its sole usage is eliminated.
tokens/token-2022/transfer-fee/pinocchio/pnpm-lock.yaml Consistently removes the Borsh importer, package, and snapshot entries.

Reviews (1): Last reviewed commit: "refactor(token-2022/transfer-fee): encod..." | Re-trigger Greptile

@@ -11,7 +11,6 @@
"@solana-program/token-2022": "^0.12.0",
"@solana/kit": "^7.0.0",
"@solana/sysvars": "^6.10.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Commit signature is missing

Commit fc36eed0976c4e1d3b8c4809c34a393980b83692 has no cryptographic signature, so this pull request does not satisfy the repository requirement that every commit be signed and verified. Re-sign the commit before merging.

Context Used: Request changes if the commits are not signed (ver... (source)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a false positive — the commit is signed and GitHub reports it verified. gh api repos/solana-foundation/program-examples/pulls/681/commits returns verification.verified = true, reason = valid for fc36eed0, signed with my registered ED25519 SSH key (SHA256:UVyyOf24fM8y73sfUoms0okbKMJobxlKQjwweQs4BhU); the commit shows a Verified badge in the PR. No re-sign needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You're right, I apologize for the false positive. GitHub confirms fc36eed carries a valid ED25519 SSH signature (verification.verified = true, reason = valid), and the Verified badge on the commit reflects that. My original comment was incorrect — no action needed.

@dev-jodee
dev-jodee merged commit fdaeb88 into solana-foundation:main Aug 10, 2026
19 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.

2 participants