Repository navigation
Conversation
[Low impact] The PR appears safe to merge based on the code reviewed. SummaryAdds a Pinocchio example that creates a Token-2022 account requiring memos on incoming transfers.
Both earlier findings are addressed: deployment names the correct build file, and the comments point readers to Reviews (5) · Last reviewed commit: "build(block-list): hold the Agave CLI cr..." · Reviewed by Greptile |
|
@dev-jodee #792 and #793 only fail |
|
@dev-jodee all three are updated for #800 and ready to merge: #792, #793 and #794 are mergeable, each closes its accepted issue (#785/#786/#787), and review comments are addressed. #794 is fully green. #792 and #793 only fail |
Ports the memo-transfer Token-2022 example to Pinocchio (the anchor example has no native sibling), matching the token-2022 pinocchio account-extension template (kit + litesvm, official @solana-program packages, real Rent::get()). The program hand-rolls three Token-2022 CPIs to create a token account with the MemoTransfer extension enabled: it creates the account, runs InitializeAccount3, then (unlike ImmutableOwner, which is pre-init) enables required memo transfers via EnableRequiredMemoTransfers after initialization, which the account owner signs. The owner is the payer. Account size is 171 bytes (a 1-byte MemoTransfer TLV value). The litesvm test decodes the account with the official Token-2022 codec and asserts the requirement is enabled.
Adds a behavior test alongside the extension-state assertion: it funds a source account, then verifies a TransferChecked into the memo-required account is rejected without a preceding memo and succeeds when preceded by one (SPL Memo program, bundled by LiteSVM). Addresses review feedback that the example's advertised transfer behavior was untested.
Matches the versions solana-foundation#765 set for the other non-anchor examples (kit 8.5, mocha 12, typescript 7) and adds the same pnpm-workspace.yaml overrides, which clears pnpm-audit. The signer roles in the hand-built instruction take 'as const' so kit 8 keeps them as signer roles, as the sibling tests on main do.
cargo build-sbf names the artifact after the crate, so deploy the *.so in the output dir instead of program.so, and stop cicd.sh if the build fails. pinocchio-token-2022 now exists in the workspace, so the comment says the instructions are hand-built to show their layout rather than claiming there is no crate.
pnpm runs package.json scripts through cmd.exe on Windows, which does not expand the *.so glob. Name the file cargo build-sbf writes instead, matching solana-foundation#794.
…n#800 solana-foundation#800 removed every example's cicd.sh and replaced em dashes in comments; drop this example's cicd.sh and do the same.
block-list/pinocchio is its own workspace and its Cargo.lock is gitignored, so CI resolves fresh. The CLI's "4.3.2" requirements now pick Agave 4.4.1, which needs rustc 1.98.1 while rust-toolchain.toml pins 1.97, so 'cargo build -p block-list-cli' fails on main and on every PR that reruns all Pinocchio projects. Use ~4.3.2, the line solana-foundation#773 merged with.
e97f745 to
f95351a
Compare
|
@dev-jodee update: #792 and #793 are now fully green too. They carry one small commit pinning |
Linked issue
Fixes #785
Replaces #700, which the PR-hygiene bot closed before the issue was accepted; GitHub doesn't let the author reopen it.
What and why
Adds a Pinocchio version of
tokens/token-2022/memo-transfer, which only had an Anchor one. It follows the same kit + LiteSVM +@solana-programtemplate as the merged Token-2022 Pinocchio examples and builds on the account-extension shape fromimmutable-owner(#696).The single instruction creates a Token-2022 token account with the
MemoTransferextension enabled, so every transfer into it must be preceded by a memo. The program hand-builds three CPIs:CreateAccount, with space for the extension.InitializeAccount3(variant 18):[18] + owner(32).EnableRequiredMemoTransfers:MemoTransferExtension(30), sub-instructionEnable(0) →[30, 0].Unlike
ImmutableOwner, this extension is enabled after the account is initialized, and the enable must be signed by the account owner (the payer here). The account is 171 bytes: 165 base + 1 account-type byte + a 5-byteMemoTransferTLV.The JS dependencies match the versions #765 set for the other non-anchor examples.
Also: unblocks CI for
block-listAdding a workspace member changes the root
Cargo.lock, which makes CI rebuild every Pinocchio project, includingtransfer-hook/block-list/pinocchio, which is currently red onmaintoo. That example is its own workspace with a gitignoredCargo.lock, so its CLI'ssolana-* = "4.3.2"requirements now resolve to Agave 4.4.1, which needs rustc 1.98.1 whilerust-toolchain.tomlpins 1.97. One commit holds those four crates at~4.3.2(what #773 merged with); with it the example passestsc, the SBF and CLI builds, its Rust tests andpnpm auditon rustc 1.97.1. The same commit is in #792 and #793, so whichever merges second has nothing left to apply.Testing
pnpm install --frozen-lockfile,tsc --noEmit,pnpm build,pnpm build-and-testandpnpm auditin a Linux container, pluscargo fmt --check,cargo clippy -D warningsandprettier --check:The first test decodes the account with the official Token-2022 codec and checks the program owner, size, mint, token owner and
requireIncomingTransferMemos. The second checks that a transfer without a memo is rejected and the same transfer with a memo moves the balance.pnpm run deploynamestoken_2022_memo_transfer_pinocchio_program.so, the filecargo build-sbfwrites; checked in Linux with a real build (same check as #794). The name is explicit rather than a*.soglob because pnpm runs scripts throughcmd.exeon Windows, which doesn't expand globs.AI disclosure
Check exactly one. See CONTRIBUTING.md.