Skip to content

chore: align tooling with foundation repos, consolidate and rehab examples - #656

Merged
dev-jodee merged 29 commits into
mainfrom
chore/repo-audit-cleanup
Jul 30, 2026
Merged

chore: align tooling with foundation repos, consolidate and rehab examples#656
dev-jodee merged 29 commits into
mainfrom
chore/repo-audit-cleanup

Conversation

@dev-jodee

@dev-jodee dev-jodee commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Full modernization of the examples repo, in reviewable phases (one commit each):

Tooling alignment with other foundation repos

  • biome → prettier (@solana/prettier-config-solana); husky/lint-staged dropped (CI enforces); .vscode removed; .nvmrc, rust-toolchain.toml, shared rustfmt.toml added; stale migration notes and unused root deps removed; intentional no-workspace layout documented; AGENTS.md added

Example consolidation (duplicates verified by diff before removal)

  • basics/rent merged into basics/create-account (now teaches size-based rent)
  • deleted: spl-token-minter (byte-identical subset of transfer-tokens), nft-minter (subset of nft-operations), transfer-hook/whitelist (subset of allow-block-list-token), tools/clockwork (project defunct), tools/shank-and-solita + counter/mpl-stack (Solita deprecated; Codama shown by block-list)

Rehabilitated examples (all were broken and CI-skipped)

  • block-list (ex-pblock-list): deduplicated a byte-identical 45-file copy, restructured to repo layout, pinocchio migration, fixed a program/client state-layout mismatch, generated SDKs no longer committed, litesvm tests added, first-ever CI wiring
  • token-2022/metadata, nft-meta-data-pointer, pyth (new test harness reading a mainnet-dumped price account), token-2022/group (extension is live now), cross-program-invocation/native, and the three Metaplex natives (manifests had been broken invisibly while CI-skipped)
  • .ghaignore: ~15 entries (several wrong/stale) → 4 accurate ones (DAS-dependent compression trio + justfile-managed world-cup)

Test integrity

  • solana-bankrun fully removed → LiteSVM everywhere (40 projects)
  • fixed a CI blind spot: 26 suites imported node:test under ts-mocha and exited 0 on failure; 8 more were stubs with zero assertions — all now real suites verified to fail loudly
  • two latent test bugs fixed (finalized-commitment hangs; stale fixture paths)

One harness, current stacks

  • mocha 11 + tsx everywhere; ts-mocha/ts-node/jest eliminated (source of recurring ESM loader failures)
  • pinocchio 0.10 → 0.11 across all 20 programs (world-cup parity; pinocchio-pubkey dropped — it pulled a second old pinocchio into every build)
  • non-anchor tests migrated web3.js → @solana/kit ^7 + litesvm 1.x (43 projects); anchor tests stay on web3.js deliberately — anchor's JS client depends on it
  • anchor_version pinned in all 45 Anchor.tomls; anchor-lang uniform at 1.0.2; legacy solana-program pins eliminated (mpl CPIs rewritten, then the mpl crate dropped entirely — the metadata natives hand-roll the two instructions in mpl_util.rs, validated against the mainnet-dumped program)

Test plan

  • Every project with tests verified locally: install (frozen lockfile), fixture/anchor build, test run at baseline-matched pass counts, tsc --noEmit; anchor projects against real validators
  • Wire-format-sensitive rewrites (mpl natives, escrow, pinocchio 0.11) kept instruction formats byte-identical — unchanged test suites passing is the regression proof
  • Failure propagation spot-verified per batch by breaking an assertion and confirming non-zero exit

Breaking changes

  • Deleted example paths will 404 for external deep links: basics/rent, tokens/spl-token-minter, tokens/nft-minter, transfer-hook/whitelist, tools/*, basics/counter/mpl-stack; content covered by surviving examples named above
  • tokens/token-2022/transfer-hook/pblock-listtokens/token-2022/transfer-hook/block-list/pinocchio
  • Test-authoring conventions changed (see CONTRIBUTING/AGENTS.md): mocha+tsx, LiteSVM, kit for non-anchor

dev-jodee added 15 commits July 28, 2026 13:35
- remove pino/, a byte-identical duplicate tree
- move pblock-list to block-list/pinocchio per repo layout convention
- migrate program pinocchio 0.8.4 -> 0.10.2
- fix Config layout: repr(C, packed) so on-chain bytes match LEN and Codama client
- align generated Rust client and CLI on the solana 2.x crate family
- fix codama.ts extraMetas PDA default (missing mint seed mapping)
- stop committing generated SDKs; regenerate via pnpm generate-sdks
- add litesvm tests (init, block, unblock, authority gating) and CI scripts
- delete whitelist example, subset of allow-block-list-token
- metadata: use anchor-spl re-exported spl-token-metadata-interface, drop
  outdated direct spl deps, compute metadata rent via Rent sysvar
- nft-meta-data-pointer: flatten anchor-example/ nesting, bump session-keys
  to 3.1.1, use anchor-spl re-exports, merge duplicate error enums
- both pass anchor test against a local validator; removed from .ghaignore
- tools/clockwork: README-only pointer to a project shut down in 2023
- basics/counter/mpl-stack and tools/shank-and-solita: Solita is deprecated,
  Codama workflow now demonstrated by the block-list example
- purge .ghaignore entries for long-deleted steel directories
- fix counter README description (plain account, not a PDA)
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Too many files changed for review. (1461 files found, 100 file limit)

dev-jodee added 14 commits July 28, 2026 16:27
…ointer, and token-swap

- block-list: scope test script to the program package; the CLI pulls
  solana-remote-wallet -> hidapi which needs libudev, absent on CI runners
- metadata + nft-meta-data-pointer: bump @solana/spl-token-metadata off the
  broken codecs-data-structures preview, align tsconfig and mocha stack with
  the escrow example (skipLibCheck)
- token-swap: add skipLibCheck and missing @solana/web3.js dep, switch tests
  to accountsPartial for PDA-resolvable accounts
- 40 projects across native, pinocchio, asm, and anchor variants: bankrun
  start()/BanksClient replaced with LiteSVM, anchor-bankrun BankrunProvider
  replaced with anchor-litesvm LiteSVMProvider
- pin litesvm ^0.8.0 (last web3.js-based line) with a pnpm override in
  anchor projects: anchor-litesvm pins litesvm 0.3.3 and a duplicate copy
  makes FailedTransactionMetadata instanceof checks silently pass failures
- re-enable six previously skipped projects that now pass: favorites/native,
  realloc/native, mint-close-authority/native, non-transferable/native,
  transfer-fee/native, external-delegate-token-master/anchor
- external-delegate-token-master: rewrite broken jest suite (devnet
  connection, undefined context.program, nonexistent instruction) as
  ts-mocha litesvm tests against the real program API
- fix async-describe suites that never registered under mocha, remove
  unused bankrun deps from ten untouched projects, update CONTRIBUTING
- 26 test files imported describe/test from node:test while running under
  ts-mocha: mocha saw zero tests and exited 0 even on assertion failures,
  so CI could not detect breakage; converted to mocha globals and verified
  each project reports real counts and propagates failures
- 7 pinocchio projects had stub TS tests (console.log, zero assertions);
  replaced with litesvm tests asserting real post-state, with instruction
  encodings mirrored from each program's Rust tests
- account-data/pinocchio: replace broken ts-node 7 harness with tsx runner
- cross-program-invocation/native: already passing, entry was stale; fix tsconfig
- pyth/anchor: bump pyth-solana-receiver-sdk to 2.0, add litesvm test harness
  reading a dumped mainnet SOL/USD PriceUpdateV2 account
- token-2022/group/anchor: remove unused spl-token-group-interface dep causing
  a version conflict; group extension is live, test passes on a validator
- create-token/transfer-tokens/pda-mint-authority native: repair program
  manifests broken by an unverified bump while CI-skipped (solana-program
  pinned =1.16.25 to stay compatible with the mpl-token-metadata 1.x API the
  programs use; committed Cargo.locks pin resolutions), rewrite devnet-era
  tests as litesvm suites with a dumped token_metadata fixture

.ghaignore is down to the DAS-dependent compression trio and the
justfile-driven world-cup exclusion
- workspace pinocchio family bumped: pinocchio 0.11 (cpi/copy/account-resize),
  pinocchio-system 0.6, pinocchio-token 0.6, pinocchio-token-2022 0.3, ata 0.4
- drop pinocchio-pubkey: it pulled a second pinocchio 0.9 into every build;
  declare_id/derive_address replaced with pinocchio::address and
  Address::create_program_address (solana-address decode/curve25519 features)
- migrate 0.11 API across 20 programs: mutable account slices, Copy-based
  account mutation, Resize trait, multisig_signers on token CPIs,
  close() instead of manual lamport-zeroing
- account-data test: litesvm 0.3 -> 0.8 (old default rent sysvar disagreed
  with pinocchio 0.11's single-rate Rent model)
- favorites/pinocchio: replace stub TS test with a real litesvm suite
- all 20 projects verified: build-sbf, TS tests, rust tests, typecheck
…ples

- one blessed stack everywhere: mocha ^11.7.5 run via tsx (--import=tsx),
  typescript ^5.9.3, chai ^6.2.2, @types/node ^26; ts-mocha and ts-node
  removed from every project — they were the source of all recurring
  ESM/loader failures (mocha 9 + require(esm) on Node 20.19+)
- one tsconfig template (esnext, bundler resolution, skipLibCheck,
  allowImportingTsExtensions) across ~65 projects
- allow-block-list-token: convert jest harness to mocha+tsx
- chai 4->6: only 3 files needed changes (chai-as-promised v8 import style)
- litesvm unified at ^0.8.0 (the three kit-based pinocchio projects
  correctly stay on 1.x)
- .nvmrc 20 -> 22, CONTRIBUTING script examples updated
- every project verified: install, build, tests (anchor test with real
  validators for anchor projects), tsc --noEmit
- two pre-existing failures documented, unrelated to harness: transfer-hook
  counter and account-data-as-seed each have one finalized-commitment test
  exceeding its own timeout (fails identically at HEAD)
finalized never lands on the local test validator, so the first test in
counter and account-data-as-seed hung past its own timeout; the follow-up
read already used confirmed
matches the avm-installed CLI in CI; program crates keep floating within
anchor-lang 1.x by design
- create-token, transfer-tokens, pda-mint-authority: mpl-token-metadata 1.x
  helper CPIs rewritten as 5.x CpiBuilders; solana-program =1.16.25 pins gone
- escrow: spl-token 4 / ata 3 replaced with the spl interface crates;
  =1.18.17 pin gone
- all four join the root workspace (fmt/clippy coverage); per-project shim
  workspaces, committed Cargo.locks, and gitignore exceptions deleted
- instruction wire formats byte-identical; the existing litesvm suites pass
  unchanged (2/6/3/3) as the regression proof
- mpl-token-metadata workspace pin -> 5.1.2-alpha.2 (only published version
  on the solana 3.x type line); dead spl-token 8 / ata 7 workspace pins
  removed (unusable with solana-program 4, nothing referenced them)
- 43 native/pinocchio/asm projects rewritten to kit idioms with litesvm 1.x:
  generateKeyPairSigner, transaction-message pipes, getProgramDerivedAddress,
  @solana-program/system and @solana-program/token instruction builders and
  decoders; @solana/web3.js and @solana/spl-token removed from all of them
- every scenario and assertion preserved; suites verified against captured
  baselines with per-batch failure-propagation checks
- create-account/asm documents why its program id needs a zero prefix (the
  assembly reads the CPI owner from a fixed input-buffer offset)
- unused deps swept (fs, buffer, buffer-layout, bn.js typings, leftover mpl v2)
- anchor projects stay on web3.js until @anchor-lang/core drops it;
  CONTRIBUTING documents the split
- pinocchio crates calling Address::create_program_address declare
  solana-address themselves: resolver-2 builds one member at a time in CI,
  so features unified by sibling crates locally are absent there
- realloc/native rust test loads its fixture from tests/fixtures instead of
  a workspace target/deploy path CI never builds
- workflows gate rust unit tests on program/Cargo.toml existing, not the
  program/ directory: cross-program-invocation's build script creates
  program/target/so, tricking the old directory check
aligns with @solana-program/* peer ranges; all 46 kit projects re-verified
(tests + typecheck). world-cup untouched: its own justfile flow pins its
stack
…a crate

each of the three metadata natives carries an mpl_util.rs building
CreateMetadataAccountV3 and CreateMasterEditionV3 from the wire format
(discriminators and account orders taken from the on-chain program's
interface), following the create-token/pinocchio util_metaplex.rs pattern;
removes the repo's only alpha dependency. litesvm suites verify the
encodings against the mainnet-dumped program
@dev-jodee
dev-jodee requested a review from amilz July 29, 2026 20:06
@dev-jodee
dev-jodee merged commit b0d0c18 into main Jul 30, 2026
37 checks passed
This was referenced Jul 30, 2026
dev-jodee added a commit to solana-foundation/solana-com that referenced this pull request Jul 30, 2026
Repo consolidation (solana-foundation/program-examples#656) removed
basics/rent (merged into create-account), tokens/spl-token-minter
(subset of transfer-tokens) and tokens/nft-minter (subset of
nft-operations), leaving 404 links on /docs/programs/examples.

Drop the rent and spl-token-minter rows, repoint nft-minter to
nft-operations, and update the GitHub org from solana-developers to
solana-foundation across all locales.

Co-authored-by: Jo D <dev-jodee@users.noreply.github.com>
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.

3 participants