Skip to content

chore(pblock-list): move program into pinocchio/ subdirectory#19

Merged
mikemaccana merged 1 commit into
mainfrom
chore/pblock-list-move-to-pinocchio-subdir
May 13, 2026
Merged

chore(pblock-list): move program into pinocchio/ subdirectory#19
mikemaccana merged 1 commit into
mainfrom
chore/pblock-list-move-to-pinocchio-subdir

Conversation

@mikemaccana
Copy link
Copy Markdown
Collaborator

@mikemaccana mikemaccana commented May 13, 2026

The Block List example is a Pinocchio implementation, but it lives directly under pblock-list/ rather than under a pinocchio/ subdirectory. This is inconsistent with the rest of the repo — every other Pinocchio-only example in the codebase is named pinocchio/ (13 sibling directories follow this pattern, including basics/counter/pinocchio/, basics/hello-solana/pinocchio/, etc.).

What this PR does

git mvs the implementation files into a new pinocchio/ subdirectory:

pblock-list/
├── readme.md              # unchanged location, links + commands updated
└── pinocchio/             # NEW
    ├── .gitignore
    ├── Cargo.toml
    ├── codama.ts
    ├── package.json
    ├── tsconfig.json
    ├── cli/
    ├── program/
    └── sdk/

All 52 program/sdk/cli/config files are tracked as renames (R100) — no content changed. The parent readme.md is updated to point at the new paths and to instruct users to cd into pinocchio/ before running pnpm 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.toml workspace members are program, cli, sdk/rust (relative to the workspace root, which moved with them).
  • codama.ts renderer paths (sdk/ts/src, sdk/rust/...) are CWD-relative, so they resolve correctly when running pnpm run generate-sdks from pinocchio/.

Side effect: CI is now enabled

The .github/workflows/pinocchio.yml workflow 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 standard pinocchio/ 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-list Pinocchio example implementation into a new pinocchio/ subdirectory (program, CLI, and generated SDKs), aligning it with the repo’s standard layout.

Updates pblock-list/readme.md to point to the new locations and to run build/generate commands from within pinocchio/ (e.g., cd pinocchio before pnpm 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.

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/.
@mikemaccana mikemaccana merged commit e09938a into main May 13, 2026
18 of 19 checks passed
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.
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