Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/breezy-symbols-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
---

Migrate integration tests from Anchor test validator to LiteSVM for improved test performance and reliability. This change includes:

- Updated test infrastructure to support versioned transactions in LiteSVM
- Added polling mechanisms for state synchronization in LiteSVM environment
- Fixed type safety issues in test setup and helpers
- Simplified Anchor.toml configuration now that tests use LiteSVM

This is an internal infrastructure change that does not affect public APIs or functionality.
105 changes: 66 additions & 39 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,75 @@ concurrency:
cancel-in-progress: true

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Anchor
uses: ./.github/actions/anchor
- name: Install dependencies
run: yarn install
- name: Build packages
run: yarn build --output-style static
- name: Checkout repository
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert ws changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yea I thought they had been altered by the yarn format command, but it was just my code editor - will do!

uses: actions/checkout@v5
- name: Setup Anchor
uses: ./.github/actions/anchor
- name: Install dependencies
run: yarn install
- name: Build packages
run: yarn build --output-style static

test:
if: false # temporarily disable test script
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Remove Unnecessary Files
uses: ./.github/actions/cleanup
- name: Setup Anchor
uses: ./.github/actions/anchor
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test --exclude legacy-sdk/integration --exclude rust-sdk/integration --output-style static
- name: Checkout repository
uses: actions/checkout@v5
- name: Add swap to increase memory
run: |
sudo fallocate -l 16G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
free -h
- name: Remove Unnecessary Files
uses: ./.github/actions/cleanup
- name: Setup Anchor
uses: ./.github/actions/anchor
- name: Install dependencies
run: yarn install
- name: Build common SDK
run: yarn workspace @orca-so/common-sdk build
- name: Build Whirlpool program (IDL)
run: yarn workspace @orca-so/whirlpools-program build
- name: Build legacy SDK only
env:
NODE_OPTIONS: --max-old-space-size=8192
run: yarn workspace @orca-so/whirlpools-sdk build
- name: Run LiteSVM-safe tests
env:
NODE_OPTIONS: --max-old-space-size=8192
VITEST_SEGFAULT_RETRY: "2"
run: |
yarn vitest run legacy-sdk/whirlpool \
--config legacy-sdk/whirlpool/vitest.config.mts \
--reporter verbose
- name: Run remaining Nx tests
run: |
yarn nx run-many \
--target=test \
--all \
--exclude=whirlpools-sdk \
--exclude=legacy-sdk/integration \
--exclude=rust-sdk/integration

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Remove Unnecessary Files
uses: ./.github/actions/cleanup
- name: Setup Anchor
uses: ./.github/actions/anchor
- name: Install dependencies
run: yarn install
- name: Run Lint
run: yarn lint --output-style static
- name: Checkout repository
uses: actions/checkout@v5
- name: Remove Unnecessary Files
uses: ./.github/actions/cleanup
- name: Setup Anchor
uses: ./.github/actions/anchor
- name: Install dependencies
run: yarn install
- name: Run Lint
run: yarn lint --output-style static

verify-generated:
runs-on: ubuntu-latest
Expand All @@ -71,13 +100,11 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install dependencies
run: yarn install
- name: Check changesets
run: yarn changeset status --since origin/main


- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install dependencies
run: yarn install
- name: Check changesets
run: yarn changeset status --since origin/main
105 changes: 4 additions & 101 deletions Anchor.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Anchor configuration for Whirlpool program
# Note: Tests now use LiteSVM instead of Anchor's test validator.
# External programs and preloaded accounts are configured in litesvm.ts.

[programs.localnet]
whirlpool = "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"

Expand All @@ -7,104 +11,3 @@ url = "https://anchor.projectserum.com"
[provider]
cluster = "localnet"
wallet = "~/.config/solana/id.json"

[scripts]
# When you run "anchor test" command, it searches for Test.toml files under the anchor_tests directory and executes them in order.
# These tests are large and require several hours to complete.
#
# If you want to run only specific test cases, specify the directory where Test.toml resides using --run option.
#
# Example 1) Run all tests
#
# anchor test
#
# Example 2) Run only the tests for integration/token-badge
#
# anchor test --run anchor_tests/int/token-badge
#
# Example 3) Run only the tests for integration/token-badge and sdk/whirlpools/utils
#
# anchor test --run anchor_tests/int/token-badge --run anchor_tests/sdk/utils

[test.validator]
# If we use slot_per_epoch = "33", rent for Position account (216 byte) was not 0.00239424 but 0.002394239
slots_per_epoch = "32"
ticks_per_slot = 7
url = "https://api.mainnet-beta.solana.com"

# In v0.29.0, this doesn't work because ProgramData account is cloned with executable = false (anchor bug ?)
# So we need to use test.genesis config.
# [[test.validator.clone]]
# address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"

[[test.genesis]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "legacy-sdk/whirlpool/tests/external_program/mpl_token_metadata.20240214.so"

[[test.genesis]]
address = "EBZDYx7599krFc4m2govwBdZcicr4GgepqC78m71nsHS"
program = "legacy-sdk/whirlpool/tests/external_program/transfer_hook_counter.so"

# Newer Token-2022
[[test.genesis]]
address = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
program = "legacy-sdk/whirlpool/tests/external_program/token_2022.20250510.so"

# For reset_position_range test
# Now, it is impossible to initialize position account without additional rent for ticks.
# So we need to load test old position account without the additional rent.
[[test.validator.account]]
address = "4GQ4VQZKPt4fLxGCusfdBZia2ge5hUZpfwwr3pqxUrmf"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/owner_wallet.json"
[[test.validator.account]]
address = "Jd4M8bfJG3sAkd82RsGWyEXoaBXQP7njFzBwEaCTuDa"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_a.json"
[[test.validator.account]]
address = "BRjpCHtyQLNCo8gqRUr8jtdAj5AjPYQaoqbvcZiHok1k"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_b.json"
[[test.validator.account]]
address = "EgxU92G34jw6QDG9RuTX9StFg1PmHuDqkRKAE5kVEiZ4"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/whirlpool.json"
[[test.validator.account]]
address = "GedZgiHw8dJpR6Fyt1PNgSwYznEyh18qgZvobuxYxMQ3"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/vault_a.json"
[[test.validator.account]]
address = "4KDudC7XagDiZZbd9Xzabcy5yZMC8bvz7c8q7Bb9vXTa"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/vault_b.json"
[[test.validator.account]]
address = "AihMywzP74pU2riq1ihFW2YSVcc1itT3yiP7minvkxDs"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/fixed_tick_array_lower.json"
[[test.validator.account]]
address = "F4h3qr6uBgdLDJyTms4YiebiaiuCEvC5C9LJE8scA1LV"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/fixed_tick_array_upper.json"
[[test.validator.account]]
address = "CzKujYEJWNCvFHhjCBcv5gKnnTdvXrQ3b9ecxyZQV6sg"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/position_mint.json"
[[test.validator.account]]
address = "J6DFYFKUsoMYgxkbeAqVnpSb8fniA9tHR44ZQu8KBgMS"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/position.json"
[[test.validator.account]]
address = "6wGj2VeDPPP1ni6TJA1KuwExFXCWKsvXLyJZvfBsfgWY"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/position_ata.json"
[[test.validator.account]]
address = "oH6UWXaG2uvePMcqR9bih8E2Gt9eS4jhYx5VyAEC4k1"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_a_ata.json"
[[test.validator.account]]
address = "7kshCxjaA7uY2C77X733ZZjM1EE31FhceM9dm4QXrxqZ"
filename = "legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_b_ata.json"

# For migrate_repurpose_reward_authority_space test
# Now, it is impossible to initialize whirlpool with 3 reward authorities (not migrated layout)
# So we need to load test old Whirlpool account.
[[test.validator.account]]
address = "7vWRTPPBq3aNaJZsrfterTz1BSjht4YSHBXJwnbuV6SC"
filename = "legacy-sdk/whirlpool/tests/preload_account/migrate_repurpose_reward_authority_space/whirlpool.json"

# For open_position_with_token_extensions test
# Now, it is impossible to initialize whirlpool with 3 reward authorities (not migrated layout)
# So we need to load test old Whirlpool account.
# This account has not been migrated, and unless that is recognized, the bit array may be misinterpreted as control_flags,
# potentially resulting in the creation of a non-transferable position.
[[test.validator.account]]
address = "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE"
filename = "legacy-sdk/whirlpool/tests/preload_account/open_position_with_token_extensions/whirlpool.json"
4 changes: 0 additions & 4 deletions anchor_tests/int/adaptive-fee/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/migration/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/multi-ix/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/token-badge/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/token-extensions/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/v1-ix/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/v2-ix/collect/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/v2-ix/initialize/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/v2-ix/liquidity/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/v2-ix/swap/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/int/v2-ix/two-hop-swap/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/sdk/client-impl/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/sdk/quote/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/sdk/swap/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/sdk/types/Test.toml

This file was deleted.

4 changes: 0 additions & 4 deletions anchor_tests/sdk/utils/Test.toml

This file was deleted.

Loading