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
22 changes: 22 additions & 0 deletions .github/workflows/solana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"
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
2 changes: 1 addition & 1 deletion solana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down