Skip to content

Conversation

@nazreen
Copy link
Contributor

@nazreen nazreen commented Jan 14, 2026

Changes

  • LayerZero programs are now cloned from mainnet-beta
  • Replaced test:generate-features script with resolve-oft-id.js for dynamic OFT program ID resolution.
  • Rewrote index.test.ts to start Surfpool, clone LayerZero programs, and reset infrastructure accounts.
  • Extended got-shim.cjs with local program keypair generation for offline/local testing.
  • Updated layerzero-infrastructure.test.ts to use Surfpool RPC calls for program cloning.
  • Added README documentation for pnpm test:anchor with Surfpool environment variables.
  • Removed generate-features.ts (92 lines) and test:generate-features npm script.

Example Run

Setting up test environment...
Starting surfpool (upstream: https://api.mainnet-beta.solana.com)...
Waiting for surfnet to start...
Surfnet started.
Priming LayerZero programs from https://api.mainnet-beta.solana.com...
Cloning endpoint...
Cloning uln...
Cloning executor...
Cloning pricefeed...
Cloning dvn...
Program oft (27cGdR9zfM4G1TVXxZQqCv6ebHbhczBFp9rpdr9g9wRR) not found upstream; deploying locally.
Skipping program authority update for OFT: Surfnet RPC surfnet_setProgramAuthority failed: Invalid program account 27cGdR9zfM4G1TVXxZQqCv6ebHbhczBFp9rpdr9g9wRR
Deploying OFT program to Surfnet...
Program Id: 27cGdR9zfM4G1TVXxZQqCv6ebHbhczBFp9rpdr9g9wRR

Signature: 2qqG4GJVTupgkwNP5wVsJF1BnhAZL3jGk1EHuQHjGtZXEQvpkp2seMHN99t2J6tSbEAKmE34WXMDLYkJR5X4sSbH

Test environment ready.
LayerZero Infrastructure
LayerZero Infrastructure Setup
✔ Init Endpoint (1640ms)
✔ Init Executor (370ms)
✔ Init PriceFeed (392ms)
✔ Init DVN (400ms)
✔ Init UltraLightNode (1221ms)
✔ Init address lookup table (1185ms)
Instruction Tests
init_oft
✔ rejects init_oft when shared decimals exceed mint decimals (1316ms)
✔ initializes native and adapter OFTs (712ms)
✔ sets OApp libraries and nonces (784ms)
set_oft_config
native config
✔ rejects unauthorized config updates (461ms)
✔ rejects invalid default fee bps (40ms)
✔ sets minimum default fee bps (309ms)
✔ sets maximum default fee bps (410ms)
✔ updates admin, delegate, and fee (2017ms)
adapter config
✔ rejects unauthorized config updates (458ms)
✔ rejects invalid default fee bps (49ms)
✔ sets minimum default fee bps (304ms)
✔ sets maximum default fee bps (409ms)
✔ updates admin, delegate, and fee (1993ms)
set_peer_config
native peer config
✔ rejects unauthorized peer updates (521ms)
✔ rejects invalid fee bps (109ms)
✔ rejects invalid enforced options (80ms)
✔ sets peer addresses and enforced options (907ms)
✔ sets outbound rate limit values (790ms)
adapter peer config
✔ rejects unauthorized peer updates (511ms)
✔ rejects invalid fee bps (150ms)
✔ rejects invalid enforced options (89ms)
✔ sets peer addresses and enforced options (904ms)
✔ sets outbound rate limit values (793ms)
quote instructions
native quotes
✔ rejects slippage when min amount exceeds computed amount (337ms)
✔ returns quoteSend and quoteOft results (338ms)
adapter quotes
✔ rejects slippage when min amount exceeds computed amount (332ms)
✔ returns quoteSend and quoteOft results (345ms)
send instruction
native send failures
✔ rejects slippage when min amount exceeds computed amount (255ms)
✔ rejects invalid sender when remaining accounts are tampered (245ms)
adapter send failures
✔ rejects slippage when min amount exceeds computed amount (258ms)
✔ rejects invalid sender when remaining accounts are tampered (242ms)
LayerZero Simulation
✔ simulates send and receive for native (12990ms)
✔ simulates send and receive for adapter (3226ms)
withdraw_fee
native fee withdrawal
✔ rejects unauthorized fee withdrawal (449ms)
✔ rejects withdrawal above available fees (800ms)
✔ withdraws available fees (1191ms)
adapter fee withdrawal
✔ rejects unauthorized fee withdrawal (395ms)
✔ rejects withdrawal above available fees (860ms)
✔ withdraws available fees (1133ms)
Cleaning up test environment...
Cleanup completed.

45 passing (1m)

How to test

  • Run pnpm test:anchor from examples/oft-solana.
    • Verify Surfpool starts and clones LayerZero programs from mainnet.
    • Verify all 45 tests pass in ~1 minute.

@github-actions
Copy link
Contributor

🚨 E2E Tests Failed

The E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:

This is non-blocking and does not prevent merging. Check the action logs above for detailed failure information.

@github-actions
Copy link
Contributor

🚨 E2E Tests Failed

The E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:

This is non-blocking and does not prevent merging. Check the action logs above for detailed failure information.

@nazreen nazreen marked this pull request as ready for review January 15, 2026 23:40
@cursor
Copy link

cursor bot commented Jan 15, 2026

PR Summary

Migrates Solana Anchor tests to run against Surfpool instead of solana-test-validator, with upstream program cloning and optional local/offline deployment.

  • Rewrites test/anchor/index.test.ts to start Surfpool, clone LayerZero programs via surfnet_* RPC, optionally deploy local binaries, and clear/reset forked PDAs to avoid init conflicts
  • Updates infra tests (layerzero-infrastructure.test.ts, utils.ts) to conditionally init or patch on-chain state using Surfpool RPC, remove SimpleMessageLib, reduce DVN confirmations, and ensure confirmations accounts are ready
  • Introduces env-driven program IDs and DVN list in test/anchor/constants.ts; got-shim.cjs now generates local keypairs and sets env vars when SURFPOOL_USE_LOCAL_PROGRAMS=1
  • Adds scripts/resolve-oft-id.js and updates test:anchor to resolve OFT_ID dynamically; removes scripts/generate-features.ts and its npm script
  • Docs: README adds Surfpool requirement and instructions (pnpm test:anchor, SURFPOOL_RPC_URL, SURFPOOL_USE_LOCAL_PROGRAMS)
  • Minor package.json overrides/cleanup

Written by Cursor Bugbot for commit dc65c7b. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

🚨 E2E Tests Failed

The E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:

This is non-blocking and does not prevent merging. Check the action logs above for detailed failure information.

@github-actions
Copy link
Contributor

🚨 E2E Tests Failed

The E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:

This is non-blocking and does not prevent merging. Check the action logs above for detailed failure information.

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