Skip to content

refactor(ENG-276): Extract vault PDA derivation into INIT-VAULT function#47

Merged
alnoki merged 10 commits intomainfrom
eng-276
Apr 1, 2026
Merged

refactor(ENG-276): Extract vault PDA derivation into INIT-VAULT function#47
alnoki merged 10 commits intomainfrom
eng-276

Conversation

@alnoki
Copy link
Copy Markdown
Contributor

@alnoki alnoki commented Mar 31, 2026

Changes

  1. Extract vault PDA derivation and address verification from
    register.s into a new init_vault function, eliminating
    duplicated logic between base and quote vault paths
  2. Add token_program_id and token_program_is_2022 fields
    to RegisterMarketFrame so INIT-VAULT receives the owning
    token program via the frame instead of a pre-loaded syscall
    register
  3. Add acct field to RegisterMarketFrame for persisting the
    account pointer across the INIT-VAULT syscall
  4. Track whether each token program is Token 2022 in both the
    base and non-duplicate quote token program paths
  5. Add RETURN_SUCCESS constant to entrypoint for checking
    INIT-VAULT call results
  6. Add BOOL_FALSE and BOOL_TRUE constants to memory
  7. Remove e_invalid_quote_vault_pubkey error label from
    error.s (INIT-VAULT inlines the error return, branching
    on vault_index to select the correct error code)
  8. Add INIT-VAULT pseudocode algorithm and "Vault initialization"
    section in markets.md
  9. Rename .pubkey to .address in REGISTER-MARKET pseudocode
    for consistency with assembly field names
  10. Add CreateAccountHappyPathToken2022QuoteDup and
    CreateAccountHappyPathToken2022QuoteNonDup integration tests
  11. Update layout.md file tree with init_vault.s

@linear
Copy link
Copy Markdown

linear bot commented Mar 31, 2026

ENG-276

@alnoki alnoki changed the title ENG-276 refactor(ENG-276): Extract vault PDA derivation into INIT-VAULT function Apr 1, 2026
@alnoki alnoki marked this pull request as ready for review April 1, 2026 00:32
@alnoki alnoki merged commit 62c7ae5 into main Apr 1, 2026
5 checks passed
@alnoki alnoki deleted the eng-276 branch April 1, 2026 00:33
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