Skip to content

chore: rename pblock-list directory to block-list#20

Merged
mikemaccana merged 1 commit into
mainfrom
chore/rename-pblock-list-to-block-list
May 13, 2026
Merged

chore: rename pblock-list directory to block-list#20
mikemaccana merged 1 commit into
mainfrom
chore/rename-pblock-list-to-block-list

Conversation

@mikemaccana
Copy link
Copy Markdown
Collaborator

@mikemaccana mikemaccana commented May 13, 2026

What

Renames tokens/token-extensions/transfer-hook/pblock-list/tokens/token-extensions/transfer-hook/block-list/.

Why

After #19 moved the Pinocchio implementation into a pinocchio/ subdirectory, the p prefix on the outer directory became misleading — it no longer denotes a framework-specific implementation, since the framework distinction now lives at the inner subdir level (matching the rest of the repo, e.g. transfer-cost/{pinocchio,anchor,native}/).

Renaming to plain block-list also aligns with the on-chain identity declared inside the example:

  • pinocchio/program/src/lib.rsdeclare_id!("BLoCKLSG2qMQ9YxEyrrKKAQzthvW4Lu8Eyv74axF6mf") with crate name block_list
  • pinocchio/sdk/ts/src/programs/blockList.ts — TS SDK program module already named blockList

So the directory now matches the program name everyone actually uses.

Diff shape

Pure directory rename. 53 files renamed, 0 insertions, 0 deletions. No content changes — verified with git grep -nE "pblock-list|pblock_list" against origin/main returning zero hits before the rename, confirming the p prefix lived only in the directory name.

Independent of #16

This is independent of #16 (docs style pass) and branches off current main. They can land in either order.


Note

Low Risk
Low risk mechanical rename; primary risk is broken relative paths/imports or build scripts that referenced the old directory name.

Overview
Renames the Token-2022 transfer-hook example directory from tokens/token-extensions/transfer-hook/pblock-list/ to tokens/token-extensions/transfer-hook/block-list/, aligning the folder name with the program/SDK naming.

No logic changes are introduced; this is a path-only reorganization that may require downstream references to update to the new directory name.

Reviewed by Cursor Bugbot for commit 3b41640. Bugbot is set up for automated code reviews on this repo. Configure here.

After PR #19 moved the Pinocchio implementation into a `pinocchio/` subdirectory, the `p` prefix on the outer directory became misleading — it no longer denotes a framework-specific implementation, since the framework distinction now lives at the inner subdir level (matching the rest of the repo, e.g. `transfer-cost/{pinocchio,anchor,native}/`).

Renaming to plain `block-list` also aligns with the on-chain identity: `pinocchio/program/src/lib.rs` declares the program with crate name `block_list` and devnet program id `BLoCKLSG2qMQ9YxEyrrKKAQzthvW4Lu8Eyv74axF6mf`.

Pure directory rename. No content changes.
@mikemaccana mikemaccana merged commit 869926e into main May 13, 2026
17 of 18 checks passed
mikemaccana pushed a commit that referenced this pull request May 14, 2026
Read every README against the underlying code and fixed claims that no
longer hold. Also applied the agreed token-terminology rules across
prose: no 'SPL Token(s)', no 'Token-2022' / 'Token 2022'. Use 'tokens',
'Classic Token Program', 'Token Extensions' / 'Token Extensions
Program'. 'instruction handler' (not 'instruction') when referring to
the Rust pub fn under #[program].

Behaviour changes:

- Delete orphan dir tokens/token-extensions/transfer-hook/pblock-list/.
  PR #20 renamed pblock-list → block-list but left the parent shell
  behind with a stale README that referenced a non-existent
  pinocchio/ subdir.

Real claim drift fixed (README claimed X, code does Y):

- tokens/token-fundraiser/anchor: duration field is u16 (not u8);
  Contributor struct has a bump field; handlers are free
  pub fn handle_*(accounts: &mut X, ...) (not impl<'info>);
  amount >= MIN_AMOUNT_TO_RAISE (not >); 1_u64.pow (not 1_u8.pow);
  FundraiserError::FundraiserEnded (not FundraisingEnded); added
  missing check_contributions handler description; documented the
  duration-check semantics (see WARNING below).
- tokens/nft-operations/anchor: code pattern shifted from
  impl<'info> X<'info> { pub fn ... } to free pub fn handler(accounts:
  &mut X, bumps: &XBumps). Rewrote all three handler code blocks.
  Also fixed INSTRUCTIONS_ID → INSTRUCTIONS_SYSVAR_ID with a note
  about the Anchor 1.0 sysvar-id move.
- basics/close-account/anchor: README described a 'destroy-an-account'
  program with TypeScript tests using fetchNullable. Actual program is
  'close-account', files are create_user.rs and close_user.rs, tests
  are Rust litesvm (cargo test). Rewrote the README to match.
- basics/cross-program-invocation: dependency uses features = ["cpi"]
  (which enables no-entrypoint), not features = ["no-entrypoint"]
  directly. Documented the cpi feature.
- tokens/token-extensions/nft-meta-data-pointer/anchor-example:
  MAX_ENERGY = 100 (not 10); programs/extension_nft (underscore, not
  hyphen); there is no update_energy.rs instruction handler (the
  refill is computed in PlayerData::update_energy in state/player_data.rs);
  file tree updated to match actual layout.
- compression/cnft-burn, cnft-vault, cutils anchor READMEs: stripped
  references to non-existent tests/ directories and stale devnet
  program IDs (the lib.rs declare_id! values are different and the
  README values can't be verified). cutils also claimed 'pins Anchor
  0.26.0' but Cargo.toml uses anchor-lang = "1.0.0".
- tokens/token-extensions/transfer-hook/whitelist/anchor: fixed broken
  link to ../../pblock-list/ → ../../block-list/.
- tokens/token-extensions/transfer-hook/block-list/readme.md: this
  lowercase readme.md was not updated in the May 12 style pass.
  Rewrote to match the styled tone and the actual handler names
  (Init, BlockWallet, UnblockWallet, SetupExtraMetas, TxHook) and
  dispatcher in pinocchio/program/src/lib.rs. Removed the unverifiable
  devnet links and dead transaction URLs; left only the declare_id!
  with a note on how to check deployment.

Terminology sweep (prose only; directory paths and Rust identifiers
like Program<'info, Token2022> / TOKEN_2022_PROGRAM_ID unchanged):

- 'SPL Token', 'SPL Tokens', 'the SPL Token Program' → 'tokens',
  'Classic Token Program' depending on context.
- 'Token-2022', 'Token 2022' → 'Token Extensions' /
  'Token Extensions Program'.
- 'the transfer() instruction provided by the SPL Token Program' →
  'the Classic Token Program's transfer instruction handler'.

WARNING — code bugs noticed but not fixed in this PR:

token-fundraiser/anchor has comparison operators that look inverted
relative to their error names:
  contribute.rs:72 — require!(duration <= elapsed_days, FundraiserEnded)
  refund.rs:60     — require!(duration >= elapsed_days, FundraiserNotEnded)
One of these is wrong. The README now describes what the code
actually does and flags this for any future reader. Did not change
program logic in a docs PR.

Out of scope (deliberately not touched):
- spl-token-minter directory rename (would break links).
- Whether the block-list/pinocchio Pinocchio program is currently
  shippable / CI-green (separate ongoing investigation).
- block-list/readme.md → README.md rename (file rename, not content).
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