Skip to content

Conversation

@nazreen
Copy link
Contributor

@nazreen nazreen commented Jan 7, 2026

Problem

  • Solana OFT had no tests

Solution

  • Port in test harness from an existing implementation

Changes

  • Tests and helpers:
    • Add examples/oft-solana/test/anchor with suites, helpers, constants, and harness setup.
  • Tooling and scripts:
    • Add examples/oft-solana/scripts/generate-features.ts and the test:generate-features script.
  • Config and deps:
    • Update examples/oft-solana/Anchor.toml, examples/oft-solana/package.json, .gitignore, and examples/oft-solana/pnpm-lock.yaml.
  • Bonus: Also fixed existing lint warnings

How to test

  • pnpm test:anchor
    • Runs feature cache generation, Anchor build, and ts-mocha suite.
  • anchor test
    • Uses the Anchor.toml script to invoke pnpm test:anchor.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

🧪 E2E Test Status

E2E tests are non-blocking and validate real blockchain interactions. Failures may occur due to network issues, RPC rate limits, or external service downtime.

Test Runs (Newest First):

  • Run #6553 - Passed - 2026-01-09 22:51 (UTC)
  • Run #6549 - Passed - 2026-01-08 08:00 (UTC)
  • Run #6548 - Passed - 2026-01-08 07:10 (UTC)
  • Run #6546 - Passed - 2026-01-08 06:58 (UTC)
  • Run #6545 - Passed - 2026-01-08 01:56 (UTC)
  • Run #6544 - Failed - 2026-01-08 01:30 (UTC)
  • Run #6543 - Failed - 2026-01-07 18:15 (UTC)
  • Run #6542 - Failed - 2026-01-07 17:50 (UTC)

@nazreen nazreen changed the title Init solana tests DEVREL-1132 Init solana tests Jan 7, 2026
@nazreen nazreen changed the title DEVREL-1132 Init solana tests DEVREL-1132 test(oft-solana): add solana tests Jan 7, 2026
@nazreen
Copy link
Contributor Author

nazreen commented Jan 8, 2026

Proof of Test

Ran anchor test successfully locally

  OFT Solana Tests
Setting up test environment...
Downloading LayerZero programs...
Loading mainnet feature flags...
Loaded 26 inactive features from cache.
Starting solana-test-validator...
Waiting for solana to start...
Solana test validator started.
Test environment ready.
    LayerZero Infrastructure
      LayerZero Infrastructure Setup
        ✔ Init Endpoint (17309ms)
        ✔ Init Executor (469ms)
        ✔ Init PriceFeed (459ms)
        ✔ Init DVN (472ms)
        ✔ Init SimpleMessageLib (470ms)
        ✔ Init UltraLightNode (948ms)
        ✔ Init address lookup table (1406ms)
    Instruction Tests
      init_oft
        ✔ rejects init_oft when shared decimals exceed mint decimals (1410ms)
        ✔ initializes native and adapter OFTs (936ms)
        ✔ sets OApp libraries and nonces (928ms)
      set_oft_config
        native config
          ✔ rejects unauthorized config updates (472ms)
          ✔ rejects invalid default fee bps
          ✔ sets minimum default fee bps (465ms)
          ✔ sets maximum default fee bps (465ms)
          ✔ updates admin, delegate, and fee (2350ms)
        adapter config
          ✔ rejects unauthorized config updates (463ms)
          ✔ rejects invalid default fee bps
          ✔ sets minimum default fee bps (467ms)
          ✔ sets maximum default fee bps (465ms)
          ✔ updates admin, delegate, and fee (2332ms)
      set_peer_config
        native peer config
          ✔ rejects unauthorized peer updates (471ms)
          ✔ rejects invalid fee bps
          ✔ rejects invalid enforced options
          ✔ sets peer addresses and enforced options (1407ms)
          ✔ sets outbound rate limit values (928ms)
        adapter peer config
          ✔ rejects unauthorized peer updates (466ms)
          ✔ rejects invalid fee bps
          ✔ rejects invalid enforced options
          ✔ sets peer addresses and enforced options (1403ms)
          ✔ sets outbound rate limit values (937ms)
      quote instructions
        native quotes
          ✔ rejects slippage when min amount exceeds computed amount
          ✔ returns quoteSend and quoteOft results
        adapter quotes
          ✔ rejects slippage when min amount exceeds computed amount
          ✔ returns quoteSend and quoteOft results
      send instruction
        native send failures
          ✔ rejects slippage when min amount exceeds computed amount
          ✔ rejects invalid sender when remaining accounts are tampered
        adapter send failures
          ✔ rejects slippage when min amount exceeds computed amount
          ✔ rejects invalid sender when remaining accounts are tampered
      LayerZero Simulation
        ✔ simulates send and receive for native (3144ms)
        ✔ simulates send and receive for adapter (3257ms)
      withdraw_fee
        native fee withdrawal
          ✔ rejects unauthorized fee withdrawal (472ms)
          ✔ rejects withdrawal above available fees (477ms)
          ✔ withdraws available fees (921ms)
        adapter fee withdrawal
          ✔ rejects unauthorized fee withdrawal (466ms)
          ✔ rejects withdrawal above available fees (471ms)
          ✔ withdraws available fees (928ms)
Cleaning up test environment...
Cleanup completed.


  46 passing (54s)

@nazreen nazreen marked this pull request as ready for review January 8, 2026 08:38
@cursor
Copy link

cursor bot commented Jan 8, 2026

PR Summary

Introduces end-to-end Solana OFT test coverage and supporting tooling.

  • Adds examples/oft-solana/test/anchor suites for init_oft, set_oft_config, set_peer_config, quote/send flows, LayerZero simulation, and withdraw_fee, including error-assertion helpers and a got shim
  • New local validator harness that downloads LZ programs, loads mainnet-inactive feature flags from a cached features.json, and boots solana-test-validator
  • Adds scripts/generate-features.ts and test:generate-features to cache Solana feature flags for faster/consistent test runs
  • Updates Anchor.toml and package.json to run pnpm test:anchor (feature cache → anchor build --no-idlts-mocha), with new dev deps (@noble/secp256k1, axios, ts-mocha, zx) and minor .gitignore additions
  • Changeset: patch release for @layerzerolabs/oft-solana-example

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

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