Skip to content

Add Token-2022 group Pinocchio example - #704

Open
MarkFeder wants to merge 1 commit into
solana-foundation:mainfrom
MarkFeder:tokens-token-2022-group-pinocchio
Open

Add Token-2022 group Pinocchio example#704
MarkFeder wants to merge 1 commit into
solana-foundation:mainfrom
MarkFeder:tokens-token-2022-group-pinocchio

Conversation

@MarkFeder

Copy link
Copy Markdown
Contributor

Pinocchio port of tokens/token-2022/group, mirroring the anchor example.

  • Creates a Token-2022 mint (the [b"group"] PDA) carrying the GroupPointer extension, pointing at itself as both pointer authority and group address.
  • The GroupPointer (discriminator 40 / sub 0) is initialized before InitializeMint2; the mint is created via a PDA-signed CreateAccount (invoke_signed).
  • Follows the anchor example in leaving the actual TokenGroupInitialize out — the group/member data instructions aren't live on Token-2022 yet.
  • LiteSVM test asserts the mint is 234 bytes and decodes the GroupPointer extension (authority + group address both the mint PDA).

All CPIs are hand-built (no pinocchio Token-2022 crate).

@MarkFeder
MarkFeder requested a review from dev-jodee as a code owner August 27, 2026 15:42
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a Pinocchio implementation of the Token-2022 group example, creating a PDA-owned mint with a self-referential GroupPointer extension.

  • Adds the new Rust program to the workspace and provides build/deployment scripts.
  • Hand-builds the System Program and Token-2022 CPIs for account creation, extension initialization, and mint initialization.
  • Adds a LiteSVM test that verifies ownership, allocation size, and decoded GroupPointer fields.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified.

The PDA derivation and signing scheme are aligned, the extended mint is allocated and initialized in the required order, the hand-built instruction layouts match established sibling implementations, and the test covers the resulting on-chain account shape.

Important Files Changed

Filename Overview
tokens/token-2022/group/pinocchio/program/src/instructions/initialize_group.rs Implements canonical PDA validation, rent-funded mint creation, GroupPointer initialization, and base mint initialization in the required order; no actionable defect was established.
tokens/token-2022/group/pinocchio/program/src/processor.rs Routes the program's single data-free operation directly to the initialization handler.
tokens/token-2022/group/pinocchio/tests/test.ts Exercises the complete LiteSVM flow and validates the mint owner, 234-byte layout, and both pointer fields.
tokens/token-2022/group/pinocchio/package.json Adds build and test commands with dependencies consistent with nearby Token-2022 Pinocchio examples.
Cargo.toml Registers the new program as a workspace member.

Reviews (1): Last reviewed commit: "token-2022 group: add pinocchio example" | Re-trigger Greptile

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.

1 participant