Skip to content

feat(ENG-282): Add InitializeAccount2 CPI to INIT-VAULT#51

Merged
alnoki merged 9 commits intomainfrom
eng-282
Apr 3, 2026
Merged

feat(ENG-282): Add InitializeAccount2 CPI to INIT-VAULT#51
alnoki merged 9 commits intomainfrom
eng-282

Conversation

@alnoki
Copy link
Copy Markdown
Contributor

@alnoki alnoki commented Apr 2, 2026

Changes

  1. Add InitializeAccount2 struct to interface/src/token.rs
    with discriminant (u8) and proprietor (Address) fields,
    and inject its discriminant, account count, and seed count
    constants into common/token.s
  2. Add rent pointer and initialize_account_2_data fields to
    RegisterMarketFrame, with corresponding RENT,
    INIT_ACCT_2_DATA, INIT_ACCT_2_DISC, and
    INIT_ACCT_2_PROPRIETOR constant group entries
  3. Store the Rent sysvar account pointer on the frame during
    REGISTER-MARKET parsing (after address validation)
  4. Extend INIT-VAULT to invoke InitializeAccount2 CPI after
    CreateAccount, setting up vault (writable), mint (readonly),
    and Rent sysvar (readonly) as CPI accounts, with the market
    PDA address as the token account proprietor
  5. Add cpi[2] is_signer/is_writable preconditions to
    INIT-VAULT (zero-initialized, never modified)
  6. Add InitializeAccount2 to size_of_group! in
    interface/src/memory.rs
  7. Update check_vault! test macro to unpack and verify token
    account fields (mint, proprietor, amount, state) using
    spl_token_interface::state::Account
  8. Add Token 2022 extension mints (TransferFeeConfig,
    TransferHook) to happy path tests so the two vaults in
    the all-2022 case have different GetAccountDataSize results
  9. Add spl-token-2022-interface and solana-program-pack
    workspace dependencies for extension types and Pack trait
  10. Rename discriminator to discriminant across interface,
    assembly, and docs for consistency

@linear
Copy link
Copy Markdown

linear bot commented Apr 2, 2026

ENG-282

@alnoki alnoki changed the title ENG-282 feat(ENG-282): Add InitializeAccount2 CPI to INIT-VAULT Apr 3, 2026
@alnoki alnoki marked this pull request as ready for review April 3, 2026 00:17
@alnoki alnoki merged commit bcaade0 into main Apr 3, 2026
6 checks passed
@alnoki alnoki deleted the eng-282 branch April 3, 2026 00:18
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