Skip to content

Add CPI depth 2 MPC test with contract.sign#3

Merged
Pessina merged 3 commits intomainfrom
feat/mpc-cpi-depth-tests
Mar 15, 2026
Merged

Add CPI depth 2 MPC test with contract.sign#3
Pessina merged 3 commits intomainfrom
feat/mpc-cpi-depth-tests

Conversation

@Pessina
Copy link
Copy Markdown
Collaborator

@Pessina Pessina commented Mar 15, 2026

Summary

  • Adds signMessageMpcSimple helper using signet.js contract.sign (high-level API) instead of manual createSignatureRequest + pollForRequestId
  • Adds MPC e2e test: ATA creation + token transfer in a single execute — exercises CPI depth 2 (proxy → ATA program → System + Token programs) and payer signer propagation from outer tx
  • Refactors shared setup (PDA init, mint creation) into before() hook
  • Removes unnecessary abstractions (MpcSigner, deriveWalletPDA, ethAddressFromAccount, deriveMpcEthAddress) — inlines their logic at call sites
  • Sign functions (signMessageMpc, signMessageMpcSimple) now take explicit params (contract, evmAdapter, publicClient) instead of a bundled signer object
  • Exports PDA seed constants (WALLET_SEED, WALLET_PREFIX) for reuse across test files
  • Uses viem's Hex type and hexToBytes directly without Buffer.from wrapping

Test plan

  • anchor test — 11 local tests pass
  • npm run test:mpc — 2 MPC e2e tests pass (devnet + Sepolia)
  • npm run check — rustfmt, clippy, typecheck, eslint, prettier, knip all pass

Pessina added 3 commits March 15, 2026 22:07
- Add signMessageMpcSimple using signet.js contract.sign (high-level API)
- Replace single inline test with shared before() setup
- Add ATA creation + transfer test exercising CPI depth 2
  (proxy → ATA program → System/Token programs)
- Existing test keeps Sepolia txHash logging via low-level flow
Remove MpcSigner interface, deriveWalletPDA, ethAddressFromAccount
and deriveMpcEthAddress wrappers — inline their logic at call sites.
Sign functions now take explicit params (contract, evmAdapter,
publicClient) instead of a bundled signer object. Export PDA seed
constants (WALLET_SEED, WALLET_PREFIX) for reuse across test files.
Use viem's Hex type and hexToBytes directly without Buffer.from.
@Pessina Pessina merged commit 4eb95a0 into main Mar 15, 2026
1 check 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