Skip to content

feat(ENG-263): CreateAccount CPI with pointer walk and relative offset macro#43

Merged
alnoki merged 15 commits intomainfrom
eng-263
Mar 28, 2026
Merged

feat(ENG-263): CreateAccount CPI with pointer walk and relative offset macro#43
alnoki merged 15 commits intomainfrom
eng-263

Conversation

@alnoki
Copy link
Copy Markdown
Contributor

@alnoki alnoki commented Mar 28, 2026

Changes

  1. Implement CreateAccount CPI in register.s, populating
    CreateAccountData (space, lamports, owner), SolAccountInfo
    and SolAccountMeta fields, SolSignerSeeds, SolInstruction,
    and invoking sol_invoke_signed_c
  2. Add relative_offset! constant form to constant_group! that
    computes the difference between two field offsets within the same
    struct, emitted as an i32 immediate with _REL_OFF_IMM suffix
    (works in both frame and non-frame contexts)
  3. Add CPI pointer walk in assembly that chains add64 through
    input buffer account fields (address, owner, lamports, data) and
    across accounts using relative_offset! constants, eliminating
    redundant mov64 r10 loads
  4. Simplify signer_seeds! and cpi_accounts! macro syntax by
    removing the pub struct requirement (always emitted implicitly)
  5. Add primitive type support to size_of_group! (e.g. u8) by
    skipping the super:: prefix for prelude types
  6. Add CPI constant group with WRITABLE_SIGNER mask (0x0101)
    for half-word stores that set both is_signer and is_writable
  7. Add ACCT_DATA_OFF, ACCT_STORAGE_OVERHEAD, IB_USER_PUBKEY,
    and SIZE_OF_* constants for u8, MarketHeader, and
    CreateAccountData
  8. Add SolSignerSeeds field to Frame, rename struct from
    RegisterMarketFrame to Frame and module from
    register_market_frame to frame
  9. Add CreateAccountHappyPath integration test verifying account
    owner, data length, and rent exemption after CPI execution
  10. Set Mollusk exemption_threshold = 1.0 (SIMD-0194) in test
    setup (pending fix: remove rent exemption threshold multiplier anza-xyz/mollusk#219)
  11. Update REGISTER-MARKET pseudocode with full CPI flow and
    remove math-mode wrapping from variable references in both
    .tex algorithm files
  12. Document relative_offset! in build-scaffolding docs

@linear
Copy link
Copy Markdown

linear bot commented Mar 28, 2026

ENG-263

@alnoki alnoki changed the title ENG-263 feat(ENG-263): CreateAccount CPI with pointer walk and relative offset macro Mar 28, 2026
@alnoki alnoki marked this pull request as ready for review March 28, 2026 01:56
@alnoki alnoki merged commit 67046e4 into main Mar 28, 2026
6 of 7 checks passed
@alnoki alnoki deleted the eng-263 branch March 28, 2026 01:57
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