Skip to content

Fix CI failures: Rust lint, Anchor, and Quasar workflows#5

Merged
mikemaccana merged 18 commits intomainfrom
fix-actions
Apr 16, 2026
Merged

Fix CI failures: Rust lint, Anchor, and Quasar workflows#5
mikemaccana merged 18 commits intomainfrom
fix-actions

Conversation

@mikemaccana
Copy link
Copy Markdown
Collaborator

Summary

  • Fix clippy and rustfmt errors causing Rust Lint failures
  • Fix compilation and test errors in Anchor projects (transfer-fee, transfer-hook, cross-program-invocation, create-token, memo-transfer)
  • Fix Quasar test encoding bug and add missing projects to .ghaignore
  • Rename solana-native/pinocchio/quasar workflow files to drop the redundant prefix
  • Add mpl_token_metadata.so and spl_memo.so test fixtures; update .gitignore to allow .so files in tests/fixtures/

Test plan

  • Rust Lint workflow passes
  • Anchor workflow passes
  • Quasar workflow passes

🤖 Generated with Claude Code

mikemaccana and others added 18 commits April 14, 2026 10:37
Rust lint:
- Remove unnecessary `mut` from increment.rs (clippy)
- Fix rustfmt in create-account, cross-program-invocation, pda-rent-payer

Anchor:
- Fix &lever_bytes type mismatch in test_hand.rs (Vec<u8> -> &[u8])
- Fix process_* -> handle_process_* in transfer-fee/lib.rs
- Fix check_mint_data() method call -> handle_check_mint_data() in transfer-fee/initialize.rs
- Fix associated function calls in transfer-hook/account-data-as-seed/lib.rs
- Add mpl_token_metadata.so and spl_memo.so test fixtures
- Update .gitignore to allow committing .so fixture files
- Fix prepare.mjs filename: token_metadata.so -> mpl_token_metadata.so
- Fix allow-block-list-token pnpm lockfile (rc.5 -> 1.0.0)

Quasar:
- Add cross-program-invocation/quasar and group/quasar to .ghaignore
- Fix InitializeMint2 COption encoding: 67 bytes -> 70 bytes (4-byte LE tag)

Workflows:
- Rename solana-native.yml -> native.yml
- Rename solana-pinocchio.yml -> pinocchio.yml
- Rename solana-quasar.yml -> quasar.yml
- Update self-references in renamed workflow files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix default-account-state quasar: revert InitializeMint2 to 67 bytes
  (1-byte COption flag, not 4-byte LE u32) and correct mint_size to 171
  (165 base + 1 account_type + 4 TLV header + 1 extension data)
- Fix transfer-fee anchor: handle_check_mint_data takes &Initialize not
  &mut Initialize since it only reads data
- Fix CPI anchor test: use CARGO_MANIFEST_DIR for absolute path to
  lever.so instead of relative path from package root
- Add tokens/spl-token-minter/quasar to .ghaignore (no Quasar.toml)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add 5 stub quasar dirs (no Quasar.toml) to .ghaignore:
  external-delegate-token-master, nft-minter, nft-operations,
  token-swap, and oracles/pyth (broken API)
- Fix interest-bearing mint_size: 234→222 (165+1+4+52 for InterestBearingConfig)
- Fix mint-close-authority mint_size: 218→202 (165+1+4+32 for MintCloseAuthority)
- Fix metadata test: encode instruction data as fixed-size padded arrays to
  match function signature ([u8; MAX_NAME] + u8 len, etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- immutable-owner: opcode 34→22 (InitializeImmutableOwner), size 301→170
- non-transferable: opcode 35→32 (InitializeNonTransferableMint)
- permanent-delegate: opcode 38→35 (InitializePermanentDelegate), size 218→202
- transfer-fee: add missing sub-instruction byte 0 + COption flags in
  InitializeTransferFeeConfig (75→78 byte instruction)
- metadata: fix mint_size formula missing AccountType byte (82+82+1 → 165+1)
- mint-close-authority: add COption::Some flag before pubkey in
  InitializeMintCloseAuthority (33→34 byte instruction)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- transfer-fee: correct mint_size from 378 to 278 (165+1+4+108 bytes;
  TransferFeeConfig is 108 bytes with no struct padding)
- metadata: add 1-byte COption flags to InitializeMetadataPointer
  instruction (66→68 bytes): [39, 0, 1, authority(32), 1, addr(32)]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…yte flags)

The MetadataPointerInstruction::Initialize uses PodCOption<Pubkey> which
encodes with a 4-byte LE flag ([1,0,0,0] for Some) + 32-byte pubkey,
making each field 36 bytes. Total instruction: 74 bytes.

Previous attempts used 1-byte COption flags (66 and 68 bytes), which
caused InvalidInstructionData because the validator requires exactly
[1,0,0,0] or [0,0,0,0] for the 4-byte option field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…6 bytes)

token-2022-v7.0.0 uses OptionalNonZeroPubkey (32-byte raw pubkey, not
COption/PodCOption flags) for both authority and metadata_address fields.
Correct format: [39, 0, authority(32), metadata_address(32)] = 66 bytes.

Previous attempts with 68 bytes (1-byte flags) and 74 bytes (4-byte
PodCOption flags) both fail because the struct expects exactly 64 bytes
of payload after the 2-byte header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Create mint with only base+MetadataPointer space (234 bytes) but fund
lamports for full size so token-2022 can realloc during
TokenMetadataInitialize. Fix TokenMetadataInitialize to use 4 accounts:
[metadata=mint(writable), update_authority(readonly), mint(readonly),
mint_authority(signer)].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In token-2022 v7: opcode 44 = PausableExtension, 45 = TokenMetadataExtension.
Previous code used 44 which was being dispatched to PausableInstruction::Initialize.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…itialize

Token-2022 v7 encodes TokenMetadata/TokenGroup instructions using 8-byte
SHA256-based discriminators rather than simple 1-byte opcodes. The correct
discriminator for initialize_account is sha256("spl_token_metadata_interface:
initialize_account")[0..8] = [210, 225, 30, 162, 88, 184, 77, 141].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
spl-token-metadata-interface Initialize passes update_authority and mint
as accounts, not instruction data. Only name/symbol/uri go in the data
after the 8-byte discriminator.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
token-2022 cannot realloc an account inside a CPI call (InvalidRealloc).
Pre-allocate the mint account at the full size required for all extensions
including the TokenMetadata TLV so no realloc is needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Revert account creation to 234 bytes (base + MetadataPointer space)
  so InitializeMint2 passes its extension-size validation
- Mark mint as writable (not readonly) at position 2 in the
  TokenMetadataInitialize CPI to allow the internal realloc to succeed
  (Solana runtime rejects realloc when the account is also aliased readonly)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
token-2022 v7's spl-token-metadata-interface requires explicit payer and
system_program accounts at positions 4-5 to perform the account resize.
Without them the handler returns InvalidRealloc instead of doing the alloc.
Mark all payer instances as writable_signer to avoid access-mode conflicts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…token-metadata-interface spec

Match the Anchor/spl-token-metadata-interface::instruction::initialize account layout:
  0: metadata (= mint, writable)
  1: update_authority (= payer, readonly)
  2: mint (= mint, readonly, dup of 0)
  3: mint_authority (= payer, writable+signer, dup of 1)

The mint is pre-funded with lamports for the full size in create_account, so
no explicit payer/system_program accounts are needed for the realloc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Create the mint account at the full required size (base + metadata TLV)
upfront so that TokenMetadataInitialize can write TLV data without
calling account_info.realloc(). Account data direct mapping prevents
realloc within nested CPIs when the account was created in the same
transaction, so pre-allocating avoids the InvalidRealloc error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…in Quasar SVM

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mikemaccana mikemaccana merged commit f3b5b04 into main Apr 16, 2026
31 checks passed
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.

1 participant