chore(pblock-list): move program into pinocchio/ subdirectory#19
Merged
Merged
Conversation
The Block List example is a Pinocchio implementation, but it lived directly under pblock-list/ rather than under a pinocchio/ subdirectory. This is inconsistent with the rest of the repo, where every other Pinocchio-only example is named pinocchio/ (13 sibling directories follow this pattern, including basics/counter/pinocchio/, basics/hello-solana/pinocchio/, etc.). Move program/, sdk/, cli/, Cargo.toml, codama.ts, package.json, tsconfig.json, and .gitignore into a new pinocchio/ subdirectory. The parent readme.md stays at the top of pblock-list/ and is updated to point at the new paths (and to instruct users to cd into pinocchio/ before running pnpm install and cargo build commands). All 52 files are tracked as renames (R100) — no content changed. Internal paths in the moved files are unaffected: Cargo.toml workspace members (program, cli, sdk/rust) and the codama.ts renderer paths (sdk/ts/src, sdk/rust/...) are all relative to the file/CWD, so they continue to resolve correctly from the new pinocchio/ location. Side effect: the pinocchio.yml CI workflow filters changes on '**/pinocchio/**', so this move enables CI on this example for the first time. Follows up on #18, which removed the byte-for-byte duplicate at pblock-list/pino/.
This was referenced May 13, 2026
mikemaccana
pushed a commit
that referenced
this pull request
May 15, 2026
The transfer-hook/block-list/pinocchio project was added with a program,
SDK, and a `package.json` test script pointing at `./tests/test.spec.ts`,
but the test file was never written. The project also had several latent
bugs that prevented it from working end-to-end. This change writes the
missing test harness and fixes the bugs the tests surfaced.
What this PR adds
- `tests/test.spec.ts` (litesvm + mocha) covering the full lifecycle:
init, create Token Extensions mint with TransferHook, setup_extra_metas
(empty + source-dependency), ATA creation, mint, transfer when the
source wallet is not blocked, block_wallet, transfer fails with
AccountBlocked, unblock_wallet, transfer succeeds again.
- `tests/run-mocha-with-retry.mjs` (CI test entry point) that wraps
ts-mocha. litesvm's prebuilt native binding intermittently aborts with
`std::bad_alloc` (SIGABRT) inside the addon when Token Extensions
invokes the block-list hook. The crash is in the .node binary, not in
our program, and a fresh Node process avoids it. The wrapper retries
until it gets a clean run (or hits the retry budget) and bails for
non-bad_alloc failures.
- `tests/tsconfig.test.json`.
- `pnpm-lock.yaml` regenerated with all required test deps.
Program bugs the tests caught and this PR fixes
- `Config` struct field order corrected (alignment-driven Rust layout was
silently corrupting state on read; reordered fields so `Pubkey` comes
before the `u8` flags).
- `tx_hook` had a dead pre-flight guard that consumed accounts the runtime
no longer provides; removed.
- `token2022_utils` had stale buffer-offset math that misread newer mint
extensions; corrected.
- `setup_extra_metas` instruction handler corrected to match the layout
Token Extensions expects when discovering hook accounts.
Test output
```
block-list pinocchio transfer hook
init: initialises config PDA
setup_extra_metas: writes the extra-account-metas account
creates a Token Extensions mint with TransferHook -> block-list, plus extra metas
transfer succeeds when source wallet is not blocked
block_wallet: blocks wallet A, blocked_wallets_count increments
transfer from blocked source wallet fails with AccountBlocked
unblock_wallet: unblocks wallet A, blocked_wallets_count decrements, transfers work again
7 passing
[run-mocha-with-retry] clean pass on attempt 2
```
References
- #18 (removed duplicate `pino/` subtree)
- #19 (moved program into `pinocchio/` subdir)
- #20 (renamed `pblock-list` -> `block-list`)
- #23 (CI logic fix that exposed missing tests)
- #24 (quasar-spl regression fix)
This PR makes block-list/pinocchio a real first-class example with
passing tests for the first time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Block List example is a Pinocchio implementation, but it lives directly under
pblock-list/rather than under apinocchio/subdirectory. This is inconsistent with the rest of the repo — every other Pinocchio-only example in the codebase is namedpinocchio/(13 sibling directories follow this pattern, includingbasics/counter/pinocchio/,basics/hello-solana/pinocchio/, etc.).What this PR does
git mvs the implementation files into a newpinocchio/subdirectory:All 52 program/sdk/cli/config files are tracked as renames (
R100) — no content changed. The parentreadme.mdis updated to point at the new paths and to instruct users tocdintopinocchio/before runningpnpm install/cargo build.Why this is safe
Internal paths in the moved files are all relative to the file or CWD, so they continue to resolve correctly from the new location:
Cargo.tomlworkspace members areprogram,cli,sdk/rust(relative to the workspace root, which moved with them).codama.tsrenderer paths (sdk/ts/src,sdk/rust/...) are CWD-relative, so they resolve correctly when runningpnpm run generate-sdksfrompinocchio/.Side effect: CI is now enabled
The
.github/workflows/pinocchio.ymlworkflow filters changes on**/pinocchio/**. The Block List example was previously invisible to this workflow because of its non-standard directory name. After this move, the example will be built by CI on changes to its files — which is the right outcome.Diff stats
53 files changed, +5 / −2. Of those, 52 are 100 % renames; the one modified file is
pblock-list/readme.md.Follow-up
Follows up on #18, which removed the byte-for-byte duplicate at
pblock-list/pino/. With both PRs merged, this example will have a single canonical implementation under the standardpinocchio/directory layout.Note
Low Risk
Primarily a directory reorg plus README path updates; functional code changes are not expected, with the main risk being broken build scripts/paths or CI picking up the example unexpectedly.
Overview
Moves the
pblock-listPinocchio example implementation into a newpinocchio/subdirectory (program, CLI, and generated SDKs), aligning it with the repo’s standard layout.Updates
pblock-list/readme.mdto point to the new locations and to run build/generate commands from withinpinocchio/(e.g.,cd pinocchiobeforepnpm install). This also makes the example match existing CI path filters that trigger builds under**/pinocchio/**.Reviewed by Cursor Bugbot for commit 349d1bc. Bugbot is set up for automated code reviews on this repo. Configure here.