diff --git a/.github/workflows/solana.yml b/.github/workflows/solana.yml index 2aa6261d..8d714037 100644 --- a/.github/workflows/solana.yml +++ b/.github/workflows/solana.yml @@ -144,3 +144,25 @@ jobs: - name: make anchor-test-upgrade run: make anchor-test-upgrade working-directory: ./solana + + make-test-sbf: + name: make test-sbf + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: metadaoproject/setup-anchor@v2 + with: + node-version: "20.11.0" + solana-cli-version: "1.18.15" + anchor-version: "0.30.1" + - name: Git Submodule Update + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git submodule update --init --recursive + working-directory: ./solana + - name: make test-sbf + run: make test-sbf + working-directory: ./solana diff --git a/solana/Makefile b/solana/Makefile index e2f70e70..ca2ff462 100644 --- a/solana/Makefile +++ b/solana/Makefile @@ -75,7 +75,7 @@ test-sbf: cargo build-sbf --features mainnet ### Unfortunately we cannot saturate all CPUs to perform tests due to nondeterministic `RpcError` ### reverts. We constrain the number of threads when we run these tests. - cd modules/matching-engine-testing && cargo test-sbf --features mainnet -- --test-threads 4 + cd modules/matching-engine-testing && cargo test-sbf --features mainnet -- --test-threads 1 .PHONY: anchor-test anchor-test: anchor-test-setup diff --git a/solana/modules/matching-engine-testing/tests/test_scenarios/settle_auction.rs b/solana/modules/matching-engine-testing/tests/test_scenarios/settle_auction.rs index 1f2a7d47..d723b013 100644 --- a/solana/modules/matching-engine-testing/tests/test_scenarios/settle_auction.rs +++ b/solana/modules/matching-engine-testing/tests/test_scenarios/settle_auction.rs @@ -317,6 +317,25 @@ pub async fn test_settle_auction_none_balance_changes_comparable() { helpers::compare_balance_changes(&balance_changes_shimful, &balance_changes_shimless); } +/// Test that settle auction none closes the prepared order account and the custody token account +#[tokio::test] +pub async fn test_settle_auction_none_closes_prepared_order_account_and_custody_token_account() { + let (mut test_context, prepared_order_state, testing_engine, _initial_balances) = + Box::pin(helpers::prepare_settle_auction_none_shimful()).await; + let instruction_triggers = vec![InstructionTrigger::SettleAuctionNoneShim( + SettleAuctionNoneInstructionConfig::default(), + )]; + let settle_auction_none_state = testing_engine + .execute( + &mut test_context, + instruction_triggers, + Some(prepared_order_state), + ) + .await; + helpers::verify_prepared_order_accounts_closed(&settle_auction_none_state, &mut test_context) + .await; +} + /* Sad path tests section @@ -435,6 +454,25 @@ mod helpers { use super::*; + pub async fn verify_prepared_order_accounts_closed( + testing_state: &TestingEngineState, + test_context: &mut ProgramTestContext, + ) { + let prepared_order_accounts = testing_state.order_prepared().unwrap(); + let prepared_order_account = test_context + .banks_client + .get_account(prepared_order_accounts.prepared_custody_token) + .await + .unwrap(); + assert!(prepared_order_account.is_none()); + let prepared_custody_token_account = test_context + .banks_client + .get_account(prepared_order_accounts.prepared_custody_token) + .await + .unwrap(); + assert!(prepared_custody_token_account.is_none()); + } + pub async fn balance_changes_shim() -> BalanceChanges { let transfer_direction = TransferDirection::FromEthereumToArbitrum; let vaa_args = vec![VaaArgs {