diff --git a/CHANGELOG.md b/CHANGELOG.md index d6a730d49..d745c4404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,47 @@ All notable changes to this repository are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [2026-10-08] - Anchor v1 tests send v1 transactions + +Solana's v1 transaction format (SIMD-0385) activated on mainnet beta at epoch 1035 +(15 September 2026). It raises the transaction size limit from 1,232 to 4,096 bytes +and moves the compute budget out of ComputeBudget instructions and into the message. +Programs need no change for it; the client that builds the transaction does. + +### Changed + +- Every Anchor v1 example's tests send v1 transactions, through `solana-kite` 0.6.0, + whose senders and token, Token Extensions and transfer hook helpers all build v1. + The manifests move from kite 0.5.0 to 0.6.0. +- A v1 transaction's unset limits are zero, not the legacy defaults, so kite 0.6 + sets the compute unit and loaded-accounts data size limits in every transaction it + builds. Its senders and helpers take a new last argument, + `compute_unit_limit: Option`, and every call here passes `None`: kite + simulates the transaction and sends it with the compute units the simulation used. +- The six tests that build a transaction themselves (to read logs, measure compute + units or read a program error code) build it with kite's + `build_transaction_from_instructions` and `get_transaction_config`, with + `MAX_COMPUTE_UNIT_LIMIT` from `solana-compute-budget`, and send it through LiteSVM. + The three compression examples add kite for this, and turn on `no-entrypoint` for + kite's `spl-token` and `spl-associated-token-account`, whose program entrypoints + otherwise clash with the example program's when the test binary links. They, + `hello-solana`, `options` + and `order-book` no longer use `solana-message` or `solana-transaction` directly, + and drop them from their manifests. + +### Added + +- `basics/transaction-v1/anchor-v1`: a program that stores a 3,000 byte document in + one instruction, which only fits in a v1 transaction. Its tests measure the + transaction against both size limits, set each config field themselves, and show + that an unset field means zero rather than the default. + +### Note + +- Anchor v2 and Quasar tests still send legacy transactions: `anchor-v2-testing` + pins LiteSVM 0.13.1 and `quasar-svm` is on a `solana-message` without the `v1` + module. Both predate v1. + ## [2026-10-04] - Escrow: the taker signs the terms ### Fixed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c9568d257..4e8a601e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,6 +35,12 @@ Run an example's tests with the command for its framework, from the framework di - **Anchor v2** (in `anchor/`): `anchor test` (runs `cargo test`, per the `[scripts]` table in `Anchor.toml`), with the v2 CLI: `cargo install anchor-cli --version 2.0.0-rc.1 --locked`. - **Anchor v1** (in `anchor-v1/`): the same `anchor test`, with the v1 CLI: `avm install 1.2.0 && avm use 1.2.0`. Selecting the wrong CLI is the usual cause of a confusing build failure in these directories. + Anchor v1 tests send v1 transactions (4,096 bytes, resource limits in the message) through + `solana-kite` 0.6. Its senders take a last `compute_unit_limit: Option`: pass `None` and kite + simulates the transaction and sends it with the compute units the simulation used. A test that needs the + transaction's metadata (logs, compute units, a program error code) builds it with kite's + `build_transaction_from_instructions` and sends it through LiteSVM itself. Kite rejects ComputeBudget + instructions, which do nothing in a v1 transaction. - **Quasar:** `quasar test`. - **Native / Pinocchio:** `cargo test --manifest-path=./program/Cargo.toml` (build first with `cargo build-sbf --manifest-path=./program/Cargo.toml`). diff --git a/README.md b/README.md index 95bf831b9..2b100a9ac 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,12 @@ Send SOL between two accounts. [⚓ Anchor v1](./basics/transfer-sol/anchor-v1) [⚓ Anchor v2](./basics/transfer-sol/anchor) [💫 Quasar](./basics/transfer-sol/quasar) [🤥 Pinocchio](./basics/transfer-sol/pinocchio) [🦀 Native](./basics/transfer-sol/native) [🧬 ASM](./basics/transfer-sol/asm) +### Transaction v1 + +Store a 3,000 byte document in one instruction using Solana's v1 transaction format, live on mainnet since September 2026: 4,096 bytes instead of 1,232, and a transaction config in the message in place of ComputeBudget instructions. The program needs no change for v1; the LiteSVM tests are what build the v1 transactions, and they show the config fields one by one. + +[⚓ Anchor v1](./basics/transaction-v1/anchor-v1) + ### Pyth Price Feeds An **oracle** brings real-world market prices - a dollar, a stock, a token - [onchain](https://solana.com/docs/terminology#onchain), like a Bloomberg terminal feeding live quotes. [Pyth](https://pyth.network/) publishes low-latency prices from institutional sources, each in its own price feed account. This example reads a feed and logs its price, confidence interval, and exponent - the building block an AMM, lending market, or vault uses to value assets. @@ -413,6 +419,10 @@ Yes. "Program" is Solana's term for what other chains call a smart contract: cod Start with the [escrow example](./finance/escrow/anchor/), the best first finance program to learn: one state PDA, one vault, and three instruction handlers that swap two tokens atomically. There is also a [30-minute video walkthrough](https://www.youtube.com/watch?v=B5eBWWQfQuM) building it from scratch. +### Do these examples work with Solana transaction v1? + +Yes. The v1 format (4,096 byte transactions, live on mainnet since epoch 1035 on 15 September 2026) changes how a client builds a transaction, not what a program sees, so every program here can be called through v1 as is. Every Anchor v1 example's tests send their transactions as v1, through [solana-kite](https://crates.io/crates/solana-kite) 0.6, and the [transaction v1 example](./basics/transaction-v1/anchor-v1/) shows the config fields that replace ComputeBudget instructions. The Anchor v2 and Quasar tests still send legacy transactions, because their test harnesses run on virtual machines that predate v1. + ### How do I test a Solana program without running a validator? Use [LiteSVM](https://www.anchor-lang.com/docs/testing/litesvm): Rust integration tests that run the program in-process, orders of magnitude faster than `solana-test-validator`. Every example in this repository tests this way, and `anchor init` scaffolds it by default since Anchor 1.0. diff --git a/basics/account-data/anchor-v1/programs/anchor-program-example/Cargo.toml b/basics/account-data/anchor-v1/programs/anchor-program-example/Cargo.toml index 41b2eb10f..c115b257c 100644 --- a/basics/account-data/anchor-v1/programs/anchor-program-example/Cargo.toml +++ b/basics/account-data/anchor-v1/programs/anchor-program-example/Cargo.toml @@ -27,7 +27,7 @@ litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/account-data/anchor-v1/programs/anchor-program-example/tests/test_account_data.rs b/basics/account-data/anchor-v1/programs/anchor-program-example/tests/test_account_data.rs index 567a816a5..26ba480ef 100644 --- a/basics/account-data/anchor-v1/programs/anchor-program-example/tests/test_account_data.rs +++ b/basics/account-data/anchor-v1/programs/anchor-program-example/tests/test_account_data.rs @@ -52,6 +52,7 @@ fn test_create_address_info() { vec![instruction], &[&payer, &address_info_keypair], &payer.pubkey(), + None, ) .unwrap(); diff --git a/basics/checking-accounts/anchor-v1/programs/anchor-program-example/Cargo.toml b/basics/checking-accounts/anchor-v1/programs/anchor-program-example/Cargo.toml index 6e89a52ef..76c29e5dc 100644 --- a/basics/checking-accounts/anchor-v1/programs/anchor-program-example/Cargo.toml +++ b/basics/checking-accounts/anchor-v1/programs/anchor-program-example/Cargo.toml @@ -27,7 +27,7 @@ litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/checking-accounts/anchor-v1/programs/anchor-program-example/tests/test_checking_accounts.rs b/basics/checking-accounts/anchor-v1/programs/anchor-program-example/tests/test_checking_accounts.rs index 15cb44851..1663d0194 100644 --- a/basics/checking-accounts/anchor-v1/programs/anchor-program-example/tests/test_checking_accounts.rs +++ b/basics/checking-accounts/anchor-v1/programs/anchor-program-example/tests/test_checking_accounts.rs @@ -34,6 +34,7 @@ fn test_check_accounts() { vec![create_account_ix], &[&payer, &account_to_change], &payer.pubkey(), + None, ) .unwrap(); @@ -56,6 +57,7 @@ fn test_check_accounts() { vec![check_accounts_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); } diff --git a/basics/close-account/anchor-v1/programs/close-account/Cargo.toml b/basics/close-account/anchor-v1/programs/close-account/Cargo.toml index 803b58939..36342f742 100644 --- a/basics/close-account/anchor-v1/programs/close-account/Cargo.toml +++ b/basics/close-account/anchor-v1/programs/close-account/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/close-account/anchor-v1/programs/close-account/tests/test_close_account.rs b/basics/close-account/anchor-v1/programs/close-account/tests/test_close_account.rs index f7189df61..5e8b11969 100644 --- a/basics/close-account/anchor-v1/programs/close-account/tests/test_close_account.rs +++ b/basics/close-account/anchor-v1/programs/close-account/tests/test_close_account.rs @@ -41,7 +41,7 @@ fn test_create_and_close_user() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![create_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![create_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify account exists and has correct data @@ -62,7 +62,7 @@ fn test_create_and_close_user() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![close_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![close_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify account is closed diff --git a/basics/counter/anchor-v1/programs/counter_anchor/Cargo.toml b/basics/counter/anchor-v1/programs/counter_anchor/Cargo.toml index ae0feab63..ab720090f 100644 --- a/basics/counter/anchor-v1/programs/counter_anchor/Cargo.toml +++ b/basics/counter/anchor-v1/programs/counter_anchor/Cargo.toml @@ -27,7 +27,7 @@ litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/counter/anchor-v1/programs/counter_anchor/tests/test_counter.rs b/basics/counter/anchor-v1/programs/counter_anchor/tests/test_counter.rs index 97a3d3c03..011eb972f 100644 --- a/basics/counter/anchor-v1/programs/counter_anchor/tests/test_counter.rs +++ b/basics/counter/anchor-v1/programs/counter_anchor/tests/test_counter.rs @@ -53,6 +53,7 @@ fn test_initialize_counter() { vec![instruction], &[&payer, &counter_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -81,6 +82,7 @@ fn test_increment_counter() { vec![init_ix], &[&payer, &counter_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -93,7 +95,8 @@ fn test_increment_counter() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![inc_ix], &[&payer], &payer.pubkey()).unwrap(); + send_transaction_from_instructions(&mut svm, vec![inc_ix], &[&payer], &payer.pubkey(), None) + .unwrap(); let count = fetch_counter(&svm, &counter_keypair.pubkey()); assert_eq!(count, 1, "Expected count to be 1"); @@ -120,6 +123,7 @@ fn test_increment_counter_again() { vec![init_ix], &[&payer, &counter_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -133,8 +137,14 @@ fn test_increment_counter_again() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![inc_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![inc_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); } diff --git a/basics/create-account/anchor-v1/programs/create-system-account/Cargo.toml b/basics/create-account/anchor-v1/programs/create-system-account/Cargo.toml index 999f785bd..ef3bf0d7a 100644 --- a/basics/create-account/anchor-v1/programs/create-system-account/Cargo.toml +++ b/basics/create-account/anchor-v1/programs/create-system-account/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/create-account/anchor-v1/programs/create-system-account/tests/test_create_account.rs b/basics/create-account/anchor-v1/programs/create-system-account/tests/test_create_account.rs index 70fe47ec5..02e7b518b 100644 --- a/basics/create-account/anchor-v1/programs/create-system-account/tests/test_create_account.rs +++ b/basics/create-account/anchor-v1/programs/create-system-account/tests/test_create_account.rs @@ -35,6 +35,7 @@ fn test_create_the_account() { vec![instruction], &[&payer, &new_account], &payer.pubkey(), + None, ) .unwrap(); diff --git a/basics/cross-program-invocation/anchor-v1/programs/hand/Cargo.toml b/basics/cross-program-invocation/anchor-v1/programs/hand/Cargo.toml index d772bd85b..e4b0cd5f6 100644 --- a/basics/cross-program-invocation/anchor-v1/programs/hand/Cargo.toml +++ b/basics/cross-program-invocation/anchor-v1/programs/hand/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/cross-program-invocation/anchor-v1/programs/hand/tests/test_hand.rs b/basics/cross-program-invocation/anchor-v1/programs/hand/tests/test_hand.rs index e9c7c64ac..8a4a641c5 100644 --- a/basics/cross-program-invocation/anchor-v1/programs/hand/tests/test_hand.rs +++ b/basics/cross-program-invocation/anchor-v1/programs/hand/tests/test_hand.rs @@ -73,6 +73,7 @@ fn test_pull_lever_cpi() { vec![init_ix], &[&payer, &power_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -96,7 +97,7 @@ fn test_pull_lever_cpi() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![pull_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![pull_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify power is now on @@ -119,7 +120,7 @@ fn test_pull_lever_cpi() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![pull_ix2], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![pull_ix2], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify power is now off again diff --git a/basics/cross-program-invocation/anchor-v1/programs/lever/Cargo.toml b/basics/cross-program-invocation/anchor-v1/programs/lever/Cargo.toml index 6e93e57d1..61defba95 100644 --- a/basics/cross-program-invocation/anchor-v1/programs/lever/Cargo.toml +++ b/basics/cross-program-invocation/anchor-v1/programs/lever/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/cross-program-invocation/anchor-v1/programs/lever/tests/test_lever.rs b/basics/cross-program-invocation/anchor-v1/programs/lever/tests/test_lever.rs index 47d32a638..a3147824b 100644 --- a/basics/cross-program-invocation/anchor-v1/programs/lever/tests/test_lever.rs +++ b/basics/cross-program-invocation/anchor-v1/programs/lever/tests/test_lever.rs @@ -42,6 +42,7 @@ fn test_initialize_lever() { vec![instruction], &[&payer, &power_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -77,6 +78,7 @@ fn test_switch_power() { vec![init_ix], &[&payer, &power_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -93,7 +95,7 @@ fn test_switch_power() { .to_account_metas(None), ); svm.expire_blockhash(); - send_transaction_from_instructions(&mut svm, vec![switch_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![switch_ix], &[&payer], &payer.pubkey(), None) .unwrap(); assert!( @@ -114,8 +116,14 @@ fn test_switch_power() { .to_account_metas(None), ); svm.expire_blockhash(); - send_transaction_from_instructions(&mut svm, vec![switch_ix2], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![switch_ix2], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); assert!( !read_power_is_on(&svm, &power_keypair.pubkey()), diff --git a/basics/favorites/anchor-v1/programs/favorites/Cargo.toml b/basics/favorites/anchor-v1/programs/favorites/Cargo.toml index 764ffc2c5..03dbb7be5 100644 --- a/basics/favorites/anchor-v1/programs/favorites/Cargo.toml +++ b/basics/favorites/anchor-v1/programs/favorites/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = {version = "1.2.0", features = ["init-if-needed"]} litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/favorites/anchor-v1/programs/favorites/tests/test_favorites.rs b/basics/favorites/anchor-v1/programs/favorites/tests/test_favorites.rs index 9f7a8b37d..229ed2f9a 100644 --- a/basics/favorites/anchor-v1/programs/favorites/tests/test_favorites.rs +++ b/basics/favorites/anchor-v1/programs/favorites/tests/test_favorites.rs @@ -89,8 +89,14 @@ fn test_set_favorites() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); let data = read_favorites(&svm, &pda); assert_eq!(data.number, 23); @@ -123,8 +129,14 @@ fn test_update_favorites() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Update favorites with new hobbies svm.expire_blockhash(); @@ -148,7 +160,7 @@ fn test_update_favorites() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey(), None) .unwrap(); let data = read_favorites(&svm, &pda); diff --git a/basics/hello-solana/anchor-v1/programs/hello-solana/Cargo.toml b/basics/hello-solana/anchor-v1/programs/hello-solana/Cargo.toml index affdf2d25..1aa2e8e1f 100644 --- a/basics/hello-solana/anchor-v1/programs/hello-solana/Cargo.toml +++ b/basics/hello-solana/anchor-v1/programs/hello-solana/Cargo.toml @@ -25,8 +25,10 @@ anchor-lang = "1.2.0" [dev-dependencies] litesvm = "0.16.0" solana-signer = "3.0.0" -solana-kite = "0.5.0" -solana-transaction = "4.1.5" +solana-kite = "0.6.0" +# The named limit for the one transaction the test builds itself. Same version +# solana-kite 0.6 builds against. +solana-compute-budget = "4.2" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/hello-solana/anchor-v1/programs/hello-solana/tests/test_hello.rs b/basics/hello-solana/anchor-v1/programs/hello-solana/tests/test_hello.rs index 6dd3541db..cb6c9b1fb 100644 --- a/basics/hello-solana/anchor-v1/programs/hello-solana/tests/test_hello.rs +++ b/basics/hello-solana/anchor-v1/programs/hello-solana/tests/test_hello.rs @@ -1,9 +1,9 @@ use { anchor_lang::{solana_program::instruction::Instruction, InstructionData, ToAccountMetas}, litesvm::LiteSVM, - solana_kite::create_wallet, + solana_compute_budget::compute_budget_limits::MAX_COMPUTE_UNIT_LIMIT, + solana_kite::{build_transaction_from_instructions, create_wallet, get_transaction_config}, solana_signer::Signer, - solana_transaction::Transaction, }; #[test] @@ -22,13 +22,16 @@ fn test_say_hello() { // The program only logs; assert it emitted its greeting rather than merely // that the transaction landed. kite's send helper discards the metadata, so - // send through LiteSVM directly to read the logs. - let transaction = Transaction::new_signed_with_payer( + // build the transaction with kite and send it through LiteSVM directly to + // read the logs. + let transaction = build_transaction_from_instructions( + &svm, &[instruction], - Some(&payer.pubkey()), &[&payer], - svm.latest_blockhash(), - ); + &payer.pubkey(), + get_transaction_config(MAX_COMPUTE_UNIT_LIMIT), + ) + .unwrap(); let metadata = svm.send_transaction(transaction).unwrap(); assert!( diff --git a/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/Cargo.toml b/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/Cargo.toml index 513e4b23f..6dbcf1cd7 100644 --- a/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/Cargo.toml +++ b/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/tests/test_pda_rent_payer.rs b/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/tests/test_pda_rent_payer.rs index 650d71864..f29f15466 100644 --- a/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/tests/test_pda_rent_payer.rs +++ b/basics/pda-rent-payer/anchor-v1/programs/anchor-program-example/tests/test_pda_rent_payer.rs @@ -40,7 +40,7 @@ fn test_init_rent_vault() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![init_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify the rent vault has the correct balance @@ -75,7 +75,7 @@ fn test_create_new_account_from_rent_vault() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![init_ix], &[&payer], &payer.pubkey(), None) .unwrap(); svm.expire_blockhash(); @@ -97,6 +97,7 @@ fn test_create_new_account_from_rent_vault() { vec![create_ix], &[&payer, &new_account], &payer.pubkey(), + None, ) .unwrap(); diff --git a/basics/processing-instructions/anchor-v1/programs/processing-instructions/Cargo.toml b/basics/processing-instructions/anchor-v1/programs/processing-instructions/Cargo.toml index 16d562f5d..7fd431fdb 100644 --- a/basics/processing-instructions/anchor-v1/programs/processing-instructions/Cargo.toml +++ b/basics/processing-instructions/anchor-v1/programs/processing-instructions/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/processing-instructions/anchor-v1/programs/processing-instructions/tests/test_processing_instructions.rs b/basics/processing-instructions/anchor-v1/programs/processing-instructions/tests/test_processing_instructions.rs index 413688cc4..3e58ed277 100644 --- a/basics/processing-instructions/anchor-v1/programs/processing-instructions/tests/test_processing_instructions.rs +++ b/basics/processing-instructions/anchor-v1/programs/processing-instructions/tests/test_processing_instructions.rs @@ -29,7 +29,7 @@ fn test_go_to_park() { .data(), processing_instructions::accounts::ParkAccountConstraints {}.to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![ix_short], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![ix_short], &[&payer], &payer.pubkey(), None) .unwrap(); svm.expire_blockhash(); @@ -44,6 +44,6 @@ fn test_go_to_park() { .data(), processing_instructions::accounts::ParkAccountConstraints {}.to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![ix_tall], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![ix_tall], &[&payer], &payer.pubkey(), None) .unwrap(); } diff --git a/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/Cargo.toml b/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/Cargo.toml index d44ae17cb..db903f155 100644 --- a/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/Cargo.toml +++ b/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/Cargo.toml @@ -27,7 +27,7 @@ litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/tests/test_program_derived_addresses.rs b/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/tests/test_program_derived_addresses.rs index 1ef8645bb..4b5d13cf1 100644 --- a/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/tests/test_program_derived_addresses.rs +++ b/basics/program-derived-addresses/anchor-v1/programs/anchor-program-example/tests/test_program_derived_addresses.rs @@ -44,7 +44,7 @@ fn test_create_and_increment_page_visits() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![create_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![create_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify initial state (page_visits = 0) @@ -64,8 +64,14 @@ fn test_create_and_increment_page_visits() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![increment_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![increment_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify page_visits = 1 let account = svm.get_account(&page_visits_pda).expect("PDA should exist"); @@ -87,8 +93,14 @@ fn test_create_and_increment_page_visits() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![increment_ix2], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![increment_ix2], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify page_visits = 2 let account = svm.get_account(&page_visits_pda).expect("PDA should exist"); diff --git a/basics/pyth/anchor-v1/programs/pythexample/Cargo.toml b/basics/pyth/anchor-v1/programs/pythexample/Cargo.toml index 2bde04bf9..b565dba33 100644 --- a/basics/pyth/anchor-v1/programs/pythexample/Cargo.toml +++ b/basics/pyth/anchor-v1/programs/pythexample/Cargo.toml @@ -36,7 +36,7 @@ solana-keypair = "3.0.1" solana-account = "4.3.0" borsh = "1.6.1" sha2 = "0.10" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/pyth/anchor-v1/programs/pythexample/tests/test_pyth.rs b/basics/pyth/anchor-v1/programs/pythexample/tests/test_pyth.rs index d8c932a8c..18d5abac9 100644 --- a/basics/pyth/anchor-v1/programs/pythexample/tests/test_pyth.rs +++ b/basics/pyth/anchor-v1/programs/pythexample/tests/test_pyth.rs @@ -128,8 +128,14 @@ fn test_read_price() { set_clock_to_price_age(&mut svm, MAXIMUM_PRICE_AGE_SECONDS); let instruction = read_price_instruction(price_update_key.pubkey()); - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); } #[test] @@ -140,8 +146,13 @@ fn test_read_price_rejects_stale_price() { set_clock_to_price_age(&mut svm, MAXIMUM_PRICE_AGE_SECONDS + 1); let instruction = read_price_instruction(price_update_key.pubkey()); - let result = - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()); + let result = send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ); assert!(result.is_err(), "a stale price update must be rejected"); } @@ -156,8 +167,13 @@ fn test_read_price_rejects_wrong_owner() { set_clock_to_price_age(&mut svm, 0); let instruction = read_price_instruction(price_update_key.pubkey()); - let result = - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()); + let result = send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ); assert!( result.is_err(), "a price account not owned by the Pyth Receiver must be rejected" diff --git a/basics/realloc/anchor-v1/programs/anchor-realloc/Cargo.toml b/basics/realloc/anchor-v1/programs/anchor-realloc/Cargo.toml index 765426c04..bc5fb752f 100644 --- a/basics/realloc/anchor-v1/programs/anchor-realloc/Cargo.toml +++ b/basics/realloc/anchor-v1/programs/anchor-realloc/Cargo.toml @@ -27,7 +27,7 @@ litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/realloc/anchor-v1/programs/anchor-realloc/tests/test_realloc.rs b/basics/realloc/anchor-v1/programs/anchor-realloc/tests/test_realloc.rs index fecf1c6c1..b0254a221 100644 --- a/basics/realloc/anchor-v1/programs/anchor-realloc/tests/test_realloc.rs +++ b/basics/realloc/anchor-v1/programs/anchor-realloc/tests/test_realloc.rs @@ -51,6 +51,7 @@ fn test_initialize() { vec![instruction], &[&payer, &message_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -91,6 +92,7 @@ fn test_update_grows() { vec![init_ix], &[&payer, &message_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -109,7 +111,7 @@ fn test_update_grows() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey(), None) .unwrap(); let msg_text = fetch_message(&svm, &message_keypair.pubkey()); @@ -148,6 +150,7 @@ fn test_update_shrinks() { vec![init_ix], &[&payer, &message_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -166,7 +169,7 @@ fn test_update_shrinks() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey(), None) .unwrap(); let msg_text = fetch_message(&svm, &message_keypair.pubkey()); diff --git a/basics/rent/anchor-v1/programs/rent-example/Cargo.toml b/basics/rent/anchor-v1/programs/rent-example/Cargo.toml index 7b3de4c73..8ed384ec5 100644 --- a/basics/rent/anchor-v1/programs/rent-example/Cargo.toml +++ b/basics/rent/anchor-v1/programs/rent-example/Cargo.toml @@ -27,7 +27,7 @@ litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/rent/anchor-v1/programs/rent-example/tests/test_rent.rs b/basics/rent/anchor-v1/programs/rent-example/tests/test_rent.rs index 2451d0dcb..b04c150cf 100644 --- a/basics/rent/anchor-v1/programs/rent-example/tests/test_rent.rs +++ b/basics/rent/anchor-v1/programs/rent-example/tests/test_rent.rs @@ -61,6 +61,7 @@ fn test_create_system_account() { vec![instruction], &[&payer, &new_account], &payer.pubkey(), + None, ) .unwrap(); diff --git a/basics/repository-layout/anchor-v1/programs/carnival/Cargo.toml b/basics/repository-layout/anchor-v1/programs/carnival/Cargo.toml index 82de27436..1fc1db85e 100644 --- a/basics/repository-layout/anchor-v1/programs/carnival/Cargo.toml +++ b/basics/repository-layout/anchor-v1/programs/carnival/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/repository-layout/anchor-v1/programs/carnival/tests/test_carnival.rs b/basics/repository-layout/anchor-v1/programs/carnival/tests/test_carnival.rs index c59114e23..242ef42bf 100644 --- a/basics/repository-layout/anchor-v1/programs/carnival/tests/test_carnival.rs +++ b/basics/repository-layout/anchor-v1/programs/carnival/tests/test_carnival.rs @@ -89,7 +89,8 @@ fn test_go_on_ride_succeeds() { // Scrambler costs 3 tickets and requires 48" min height; Alice has 15 // tickets and is 56" tall. let ix = go_on_ride_ix(&payer, "Alice", 56, 15, "Scrambler"); - send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()).unwrap(); + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None) + .unwrap(); } // Insufficient tickets must produce a real error (NotEnoughTickets), not a @@ -99,7 +100,8 @@ fn test_go_on_ride_rejects_insufficient_tickets() { let (mut svm, payer) = setup(); // Tilt-a-Whirl costs 3 tickets; Bob only has 1. let ix = go_on_ride_ix(&payer, "Bob", 49, 1, "Tilt-a-Whirl"); - let result = send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()); + let result = + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None); assert!(result.is_err(), "ride must reject insufficient tickets"); } @@ -110,7 +112,8 @@ fn test_go_on_ride_rejects_too_short() { // Ferris Wheel requires 55" min height; Jimmy is 36" tall but has plenty // of tickets. let ix = go_on_ride_ix(&payer, "Jimmy", 36, 15, "Ferris Wheel"); - let result = send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()); + let result = + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None); assert!(result.is_err(), "ride must reject riders below min height"); } @@ -119,7 +122,8 @@ fn test_go_on_ride_rejects_too_short() { fn test_go_on_ride_rejects_unknown_ride() { let (mut svm, payer) = setup(); let ix = go_on_ride_ix(&payer, "Alice", 60, 100, "Quantum Coaster"); - let result = send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()); + let result = + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None); assert!(result.is_err(), "unknown ride must be rejected"); } @@ -128,7 +132,8 @@ fn test_play_game_succeeds() { let (mut svm, payer) = setup(); // Ring Toss costs 3 tickets; Alice has 15. let ix = play_game_ix(&payer, "Alice", 15, "Ring Toss"); - send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()).unwrap(); + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None) + .unwrap(); } #[test] @@ -136,7 +141,8 @@ fn test_play_game_rejects_insufficient_tickets() { let (mut svm, payer) = setup(); // Ring Toss costs 3 tickets; Mary only has 1. let ix = play_game_ix(&payer, "Mary", 1, "Ring Toss"); - let result = send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()); + let result = + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None); assert!(result.is_err(), "game must reject insufficient tickets"); } @@ -145,7 +151,8 @@ fn test_eat_food_succeeds() { let (mut svm, payer) = setup(); // Dough Boy's costs 1 ticket; Bob has 6. let ix = eat_food_ix(&payer, "Bob", 6, "Dough Boy's"); - send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()).unwrap(); + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None) + .unwrap(); } #[test] @@ -153,7 +160,8 @@ fn test_eat_food_rejects_insufficient_tickets() { let (mut svm, payer) = setup(); // Larry's Pizza costs 3 tickets; Mary has 1. let ix = eat_food_ix(&payer, "Mary", 1, "Larry's Pizza"); - let result = send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()); + let result = + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None); assert!( result.is_err(), "food stand must reject insufficient tickets" diff --git a/basics/transaction-v1/anchor-v1/Anchor.toml b/basics/transaction-v1/anchor-v1/Anchor.toml new file mode 100644 index 000000000..bc8a85099 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/Anchor.toml @@ -0,0 +1,18 @@ +[toolchain] +# Match the repo package manager (pnpm-lock.yaml at root); avoids Anchor's yarn default. +package_manager = "pnpm" +solana_version = "3.1.8" + +[features] +seeds = false +skip-lint = false + +[programs.localnet] +transaction_v1_anchor_program = "G2RNhZWhh8f3jjY9Z6CQyztFR6PGC5iM8yrbNEjvSuKa" + +[provider] +cluster = "Localnet" +wallet = "~/.config/solana/id.json" + +[scripts] +test = "cargo test" diff --git a/basics/transaction-v1/anchor-v1/CHANGELOG.md b/basics/transaction-v1/anchor-v1/CHANGELOG.md new file mode 100644 index 000000000..72786bcc3 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +## 2026-10-08 + +Added: a program that stores a 3,000 byte document in one instruction, tested with +LiteSVM 0.16 by sending the instruction in a transaction v1 (4,096 byte) transaction. diff --git a/basics/transaction-v1/anchor-v1/Cargo.toml b/basics/transaction-v1/anchor-v1/Cargo.toml new file mode 100644 index 000000000..f39770481 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/Cargo.toml @@ -0,0 +1,14 @@ +[workspace] +members = [ + "programs/*" +] +resolver = "2" + +[profile.release] +overflow-checks = true +lto = "fat" +codegen-units = 1 +[profile.release.build-override] +opt-level = 3 +incremental = false +codegen-units = 1 diff --git a/basics/transaction-v1/anchor-v1/README.md b/basics/transaction-v1/anchor-v1/README.md new file mode 100644 index 000000000..7b86fe0e9 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/README.md @@ -0,0 +1,55 @@ +# Solana Transaction v1 (Anchor) + +> [!NOTE] +> This example is on Anchor 1.2.0, the current stable Anchor release. Every `anchor` +> command on this page needs the v1 CLI: `avm install 1.2.0 && avm use 1.2.0`. There is +> no Anchor v2 copy yet: Anchor v2's test harness runs on a LiteSVM that predates v1. + +A Solana transaction v1 example: a program that stores a 3,000 byte document in a single [instruction](https://solana.com/docs/references/terminology#instruction), which only fits inside the v1 [transaction](https://solana.com/docs/references/terminology#transaction) format (4,096 bytes, up from the 1,232 bytes of legacy and v0 transactions). Nothing in the program is specific to v1: an Anchor program reads its accounts and instruction data the same way whichever format carried them, and no Anchor change is needed to be called through v1. The tests are where v1 shows up, because the client builds the transaction. + +See also: the [repository catalog](../../../README.md). + +## Major concepts + +**What v1 changes for the transaction.** The size limit rises from 1,232 to 4,096 bytes, which is what makes this example possible. The resource limits that legacy and v0 transactions set with ComputeBudget program instructions (compute unit limit, priority fee, loaded-accounts data size limit, heap size) move into a `TransactionConfig` in the message header, and any ComputeBudget instructions in a v1 transaction are ignored. The priority fee becomes a total in lamports rather than a price per compute unit. Unset config fields mean zero, not "use the default", so every v1 transaction has to set its compute unit limit and its loaded-accounts data size limit explicitly. The signatures move to the end of the wire format, so the first byte is the message version (`0x81` for v1). Address lookup tables are not supported: a transaction that needs them stays on v0. + +**What v1 changes for the program.** Nothing. The 3,000 byte document arrives as the `document: Vec` argument exactly as a 300 byte one would. + +**The document account.** `Document`, a [PDA](https://solana.com/docs/references/terminology#program-derived-account-pda) with seeds `["document", payer]`, one per payer. There is no `InitSpace`: `Document::required_space` sizes the account to each document (discriminator, borsh length prefix, bytes), and the payer pays that [rent](https://solana.com/docs/references/terminology#rent). + +## Lifecycle + +A payer signs a transaction carrying one `store_document` instruction with the document as its argument. The `StoreDocumentAccountConstraints` `init` constraint creates the PDA sized to the document and the handler rejects an empty document (`DocumentError::EmptyDocument`) before copying it in. + +## Setup + +From this directory (`basics/transaction-v1/anchor-v1/`): + +```bash +anchor build +``` + +Prerequisites: [Agave](https://docs.anza.xyz/) CLI (version in `Anchor.toml` `[toolchain]`; the LiteSVM tests carry their own v1-capable runtime, so the CLI version does not matter to them), [Anchor](https://www.anchor-lang.com/docs) v1. + +Like every `anchor-v1/` directory, this example is its own Cargo workspace outside the repository root workspace. + +## Testing + +Tests run in-process with [LiteSVM](https://www.anchor-lang.com/docs/testing/litesvm). No local validator. + +```bash +anchor test +``` + +This runs `cargo test` as configured in `Anchor.toml`. LiteSVM 0.16.0 is the first release that executes v1 transactions, and this example builds its transactions by hand. Every other Anchor v1 example sends v1 transactions too, through [solana-kite](https://crates.io/crates/solana-kite) 0.6, which sets the compute unit and loaded-accounts data size limits for them; this one sets each config field itself to show what they do. The suite covers: + +- `stores_a_document_too_large_for_a_legacy_transaction`: a 3,000 byte document in a v1 transaction. The test measures the transaction on the wire (over 1,232 bytes, at most 4,096) and reads the document back from the PDA. +- `a_legacy_transaction_still_works_for_a_small_document`: the same instruction with a 500 byte document, sent as a legacy transaction. The program did not change. +- `the_transaction_config_replaces_compute_budget_instructions`: a v1 transaction with a priority fee in the config. The payer is charged exactly rent plus the base fee plus that priority fee, and the wire format starts with the v1 version byte. +- `unset_config_fields_mean_zero_not_the_default`: an empty config fails before the program runs (zero bytes of account data may be loaded), and a config with only the data size limit fails on the program's first instruction (zero compute units). + +LiteSVM does not enforce either size limit (a validator's packet layer does), which is why the size tests check the serialized transaction themselves. + +## Sending v1 transactions to a real cluster + +The v1 format is live on mainnet beta since epoch 1035 (15 September 2026), and on devnet and testnet, behind the `enable_tx_v1` feature gate (`txv1aq4pp281K9um3tnPgkfX8UqtFT6wcVW3hNezGLL`). Sending one needs Agave 4.2 or later client crates and, on the RPC side, `maxSupportedTransactionVersion: 1` on every `getTransaction`, `getBlock` and `blockSubscribe` call, plus `encoding: "base64"` when sending, since base58 encoding stops at 1,232 bytes. Anchor's TypeScript client (`@coral-xyz/anchor`) builds its transactions with `@solana/web3.js` 1.x, which can read v1 transactions but not build them, so a v1 transaction to an Anchor program is built with `@solana/kit` 8 or later, or in Rust as in the tests here. diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/Cargo.toml b/basics/transaction-v1/anchor-v1/programs/transaction-v1/Cargo.toml new file mode 100644 index 000000000..abcc9fb00 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/Cargo.toml @@ -0,0 +1,50 @@ +[package] +name = "transaction-v1-anchor-program" +version = "0.1.0" +description = "Created with Anchor" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "transaction_v1_anchor_program" + +[features] +default = [] +cpi = ["no-entrypoint"] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +idl-build = ["anchor-lang/idl-build"] +anchor-debug = [] +custom-heap = [] +custom-panic = [] + +[dependencies] +anchor-lang = "1.2.0" + +[dev-dependencies] +# 0.16.0 is the first LiteSVM that understands v1 transactions: it reads the +# compute unit limit, priority fee, loaded-accounts data size limit and heap +# size from the message's transaction config rather than from ComputeBudget +# instructions. +# +# The other Anchor v1 examples send v1 transactions through solana-kite 0.6. +# This example builds its own, to show each config field. +litesvm = "0.16.0" +borsh = "1.6.1" +solana-keypair = "3.1" +# `solana_message::v1` (the v1 message, `TransactionConfig` and the 4,096 +# byte `MAX_TRANSACTION_SIZE`) first shipped in solana-message 4.2. +solana-message = "4.2" +solana-native-token = "3.0" +# `PACKET_DATA_SIZE`, the 1,232 byte limit legacy and v0 transactions keep. +solana-packet = "4.2" +solana-transaction = "4.1" +solana-transaction-error = "3.3" +# The SDK's serializer. `wincode::serialize` on a `VersionedTransaction` gives +# the exact bytes that would go over the wire, which is how the tests measure +# transaction size. +wincode = "0.5" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/Xargo.toml b/basics/transaction-v1/anchor-v1/programs/transaction-v1/Xargo.toml new file mode 100644 index 000000000..475fb71ed --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/instructions/mod.rs b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/instructions/mod.rs new file mode 100644 index 000000000..89cbfd5e6 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/instructions/mod.rs @@ -0,0 +1,3 @@ +pub mod store; + +pub use store::*; diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/instructions/store.rs b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/instructions/store.rs new file mode 100644 index 000000000..76fcf89e4 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/instructions/store.rs @@ -0,0 +1,32 @@ +use crate::{state::Document, DocumentError}; +use anchor_lang::prelude::*; + +#[derive(Accounts)] +#[instruction(document: Vec)] +pub struct StoreDocumentAccountConstraints<'info> { + #[account(mut)] + pub payer: Signer<'info>, + + /// Sized to this document exactly, so the rent matches what was stored. + #[account( + init, + payer = payer, + space = Document::required_space(document.len()), + seeds = [ + Document::SEED_PREFIX, + payer.key().as_ref(), + ], + bump, + )] + pub document_account: Account<'info, Document>, + pub system_program: Program<'info, System>, +} + +pub fn handle_store_document( + context: Context, + document: Vec, +) -> Result<()> { + require!(!document.is_empty(), DocumentError::EmptyDocument); + context.accounts.document_account.data = document; + Ok(()) +} diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/lib.rs b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/lib.rs new file mode 100644 index 000000000..d5aaa6513 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/lib.rs @@ -0,0 +1,35 @@ +//! Store a document of arbitrary size in a program-owned account, in one +//! instruction. +//! +//! The program itself has nothing to do with transaction v1: it reads the +//! accounts and instruction data it is given like any other program, and does +//! not know or care which transaction format carried them. What v1 changes is +//! how much a single instruction can carry: a 3,000 byte document is beyond +//! the 1,232 byte limit of a legacy or v0 transaction, so the tests send it +//! in a v1 transaction (up to 4,096 bytes) instead. + +use anchor_lang::prelude::*; +use instructions::*; + +pub mod instructions; +pub mod state; + +declare_id!("G2RNhZWhh8f3jjY9Z6CQyztFR6PGC5iM8yrbNEjvSuKa"); + +#[program] +pub mod transaction_v1_anchor_program { + use super::*; + + pub fn store_document( + context: Context, + document: Vec, + ) -> Result<()> { + store::handle_store_document(context, document) + } +} + +#[error_code] +pub enum DocumentError { + #[msg("A document cannot be empty")] + EmptyDocument, +} diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/state/document.rs b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/state/document.rs new file mode 100644 index 000000000..f915be3c1 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/state/document.rs @@ -0,0 +1,17 @@ +use anchor_lang::prelude::*; + +// There is deliberately no `InitSpace` here: the account is sized to each +// document rather than to a compile-time maximum. +#[account] +pub struct Document { + pub data: Vec, +} + +impl Document { + pub const SEED_PREFIX: &'static [u8; 8] = b"document"; + + /// Discriminator, then the borsh length prefix, then the bytes. + pub fn required_space(document_len: usize) -> usize { + Self::DISCRIMINATOR.len() + 4 + document_len + } +} diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/state/mod.rs b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/state/mod.rs new file mode 100644 index 000000000..d0889e2ad --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/src/state/mod.rs @@ -0,0 +1,3 @@ +pub mod document; + +pub use document::*; diff --git a/basics/transaction-v1/anchor-v1/programs/transaction-v1/tests/test_transaction_v1.rs b/basics/transaction-v1/anchor-v1/programs/transaction-v1/tests/test_transaction_v1.rs new file mode 100644 index 000000000..0ff26c2e7 --- /dev/null +++ b/basics/transaction-v1/anchor-v1/programs/transaction-v1/tests/test_transaction_v1.rs @@ -0,0 +1,240 @@ +//! The program is exercised with both transaction formats: legacy for a small +//! document, v1 for one that would never fit in 1,232 bytes. The v1 tests also +//! cover the part of the format that is easy to get wrong: the transaction +//! config that replaces ComputeBudget instructions, whose unset fields mean +//! zero rather than "use the default". + +use { + anchor_lang::{ + solana_program::{instruction::Instruction, pubkey::Pubkey, system_program}, + InstructionData, ToAccountMetas, + }, + borsh::BorshDeserialize, + litesvm::LiteSVM, + solana_keypair::{Keypair, Signer}, + solana_message::{v1, VersionedMessage}, + solana_native_token::LAMPORTS_PER_SOL, + solana_packet::PACKET_DATA_SIZE, + solana_transaction::{versioned::VersionedTransaction, Transaction}, + solana_transaction_error::TransactionError, + transaction_v1_anchor_program::state::Document, +}; + +/// What LiteSVM charges per signature, and what mainnet has charged since +/// genesis. +const BASE_FEE_LAMPORTS: u64 = 5_000; + +/// Enough for the account creation and the copy. Unlike a legacy transaction, +/// a v1 transaction has no 200,000 CU default to fall back on: leaving the +/// limit unset means zero. +const COMPUTE_UNIT_LIMIT: u32 = 50_000; + +/// The payer, the new account, the system program and the program itself +/// together load well under 64 KiB. Like the compute unit limit, this defaults +/// to zero when unset. +const LOADED_ACCOUNTS_DATA_SIZE_LIMIT: u32 = 64 * 1024; + +/// A v1 transaction's config carries the resource limits that legacy and v0 +/// transactions express with ComputeBudget program instructions. Every test +/// that expects to succeed starts from this one. +fn transaction_config() -> v1::TransactionConfig { + v1::TransactionConfig::empty() + .with_compute_unit_limit(COMPUTE_UNIT_LIMIT) + .with_loaded_accounts_data_size_limit(LOADED_ACCOUNTS_DATA_SIZE_LIMIT) +} + +/// The account as Anchor lays it out: discriminator, then the borsh `Vec`. +#[derive(BorshDeserialize)] +struct DocumentAccount { + _discriminator: [u8; 8], + data: Vec, +} + +fn setup() -> (LiteSVM, Pubkey, Keypair) { + let program_id = transaction_v1_anchor_program::id(); + let mut svm = LiteSVM::new(); + let program_bytes = include_bytes!("../../../target/deploy/transaction_v1_anchor_program.so"); + svm.add_program(program_id, program_bytes).unwrap(); + + let payer = Keypair::new(); + svm.airdrop(&payer.pubkey(), 10 * LAMPORTS_PER_SOL).unwrap(); + (svm, program_id, payer) +} + +/// The instruction and the PDA it will create. +fn store_document(program_id: &Pubkey, payer: &Pubkey, document: &[u8]) -> (Instruction, Pubkey) { + let (document_address, _bump) = + Pubkey::find_program_address(&[Document::SEED_PREFIX, payer.as_ref()], program_id); + let instruction = Instruction::new_with_bytes( + *program_id, + &transaction_v1_anchor_program::instruction::StoreDocument { + document: document.to_vec(), + } + .data(), + transaction_v1_anchor_program::accounts::StoreDocumentAccountConstraints { + payer: *payer, + document_account: document_address, + system_program: system_program::id(), + } + .to_account_metas(None), + ); + (instruction, document_address) +} + +/// Compile a v1 message and sign it. `try_compile_with_config` is the v1 +/// counterpart of `Message::new_with_blockhash`; the config rides in the +/// message header, so there is no ComputeBudget instruction to append. +fn build_v1_transaction( + svm: &LiteSVM, + payer: &Keypair, + instructions: &[Instruction], + config: v1::TransactionConfig, +) -> VersionedTransaction { + let message = v1::Message::try_compile_with_config( + &payer.pubkey(), + instructions, + svm.latest_blockhash(), + config, + ) + .unwrap(); + VersionedTransaction::try_new(VersionedMessage::V1(message), &[payer]).unwrap() +} + +/// The bytes that would be sent to an RPC node. +fn wire_size(transaction: &VersionedTransaction) -> usize { + wincode::serialize(transaction).unwrap().len() +} + +/// The largest prime below 256: the byte pattern repeats every 251 bytes, a +/// period no power-of-two offset lines up with. +const SAMPLE_DOCUMENT_PATTERN_LENGTH: usize = 251; + +/// A document with a recognizable pattern, so a partial or shifted copy +/// would not pass the equality check. +fn sample_document(length: usize) -> Vec { + (0..length) + .map(|index| (index % SAMPLE_DOCUMENT_PATTERN_LENGTH) as u8) + .collect() +} + +fn stored_document(svm: &LiteSVM, document_address: &Pubkey) -> Vec { + let account = svm.get_account(document_address).unwrap(); + DocumentAccount::try_from_slice(&account.data).unwrap().data +} + +#[test] +fn stores_a_document_too_large_for_a_legacy_transaction() { + let (mut svm, program_id, payer) = setup(); + let document = sample_document(3_000); + let (instruction, document_address) = store_document(&program_id, &payer.pubkey(), &document); + + let transaction = build_v1_transaction(&svm, &payer, &[instruction], transaction_config()); + + // Over the legacy limit, under the v1 one. LiteSVM does not enforce either + // (a validator's packet layer does), so the test checks the size itself. + let size = wire_size(&transaction); + assert!( + size > PACKET_DATA_SIZE, + "{size} bytes fits a legacy transaction" + ); + assert!( + size <= v1::MAX_TRANSACTION_SIZE, + "{size} bytes is over the v1 limit" + ); + + svm.send_transaction(transaction).unwrap(); + + let account = svm.get_account(&document_address).unwrap(); + assert_eq!(account.owner, program_id); + assert_eq!(account.data.len(), Document::required_space(document.len())); + assert_eq!(stored_document(&svm, &document_address), document); +} + +#[test] +fn a_legacy_transaction_still_works_for_a_small_document() { + let (mut svm, program_id, payer) = setup(); + let document = sample_document(500); + let (instruction, document_address) = store_document(&program_id, &payer.pubkey(), &document); + + // Nothing about the program changed: the same instruction goes through the + // legacy format when it fits. + let transaction = Transaction::new_signed_with_payer( + &[instruction], + Some(&payer.pubkey()), + &[&payer], + svm.latest_blockhash(), + ); + assert!(wire_size(&VersionedTransaction::from(transaction.clone())) <= PACKET_DATA_SIZE); + + svm.send_transaction(transaction).unwrap(); + + assert_eq!(stored_document(&svm, &document_address), document); +} + +#[test] +fn the_transaction_config_replaces_compute_budget_instructions() { + let (mut svm, program_id, payer) = setup(); + let document = sample_document(3_000); + let (instruction, _) = store_document(&program_id, &payer.pubkey(), &document); + let rent = svm.minimum_balance_for_rent_exemption(Document::required_space(document.len())); + + // A v1 priority fee is a total in lamports, not a price per compute unit. + let priority_fee_lamports = 10_000; + let config = transaction_config().with_priority_fee(priority_fee_lamports); + let transaction = build_v1_transaction(&svm, &payer, &[instruction], config); + + // v1 moved the signatures to the end, so the first byte on the wire is the + // message version rather than a signature count. 0x81 means v1. + assert_eq!(wincode::serialize(&transaction).unwrap()[0], v1::V1_PREFIX); + + let balance_before = svm.get_balance(&payer.pubkey()).unwrap(); + let metadata = svm.send_transaction(transaction).unwrap(); + let balance_after = svm.get_balance(&payer.pubkey()).unwrap(); + + assert!(metadata.compute_units_consumed <= u64::from(COMPUTE_UNIT_LIMIT)); + assert_eq!( + balance_before - balance_after, + rent + BASE_FEE_LAMPORTS + priority_fee_lamports + ); +} + +#[test] +fn unset_config_fields_mean_zero_not_the_default() { + let (mut svm, program_id, payer) = setup(); + let document = sample_document(500); + let (instruction, _) = store_document(&program_id, &payer.pubkey(), &document); + + // No loaded-accounts data size limit: the transaction fails before any + // program runs, because zero bytes of account data may be loaded. + let transaction = build_v1_transaction( + &svm, + &payer, + std::slice::from_ref(&instruction), + v1::TransactionConfig::empty(), + ); + let failure = svm.send_transaction(transaction).unwrap_err(); + assert_eq!( + failure.err, + TransactionError::MaxLoadedAccountsDataSizeExceeded + ); + + // Data size limit set, compute unit limit not: the program starts with a + // budget of zero and fails on its first instruction. + let config = v1::TransactionConfig::empty() + .with_loaded_accounts_data_size_limit(LOADED_ACCOUNTS_DATA_SIZE_LIMIT); + let transaction = build_v1_transaction(&svm, &payer, &[instruction], config); + let failure = svm.send_transaction(transaction).unwrap_err(); + assert!(matches!( + failure.err, + TransactionError::InstructionError(0, _) + )); + assert!( + failure + .meta + .logs + .iter() + .any(|log| log.contains("exceeded CUs")), + "{:?}", + failure.meta.logs + ); +} diff --git a/basics/transfer-sol/anchor-v1/programs/transfer-sol/Cargo.toml b/basics/transfer-sol/anchor-v1/programs/transfer-sol/Cargo.toml index 59de918a7..60e155c37 100644 --- a/basics/transfer-sol/anchor-v1/programs/transfer-sol/Cargo.toml +++ b/basics/transfer-sol/anchor-v1/programs/transfer-sol/Cargo.toml @@ -26,7 +26,7 @@ anchor-lang = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/basics/transfer-sol/anchor-v1/programs/transfer-sol/tests/test_transfer_sol.rs b/basics/transfer-sol/anchor-v1/programs/transfer-sol/tests/test_transfer_sol.rs index 3afb86614..fab096576 100644 --- a/basics/transfer-sol/anchor-v1/programs/transfer-sol/tests/test_transfer_sol.rs +++ b/basics/transfer-sol/anchor-v1/programs/transfer-sol/tests/test_transfer_sol.rs @@ -35,8 +35,14 @@ fn test_transfer_sol_with_cpi() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); let recipient_balance = svm.get_balance(&recipient.pubkey()).unwrap(); assert_eq!(recipient_balance, LAMPORTS_PER_SOL); @@ -64,6 +70,7 @@ fn test_transfer_sol_with_program() { vec![create_account_ix], &[&payer, &payer_account], &payer.pubkey(), + None, ) .unwrap(); @@ -84,8 +91,14 @@ fn test_transfer_sol_with_program() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); let recipient_balance = svm.get_balance(&recipient.pubkey()).unwrap(); assert_eq!(recipient_balance, LAMPORTS_PER_SOL); @@ -113,6 +126,7 @@ fn test_transfer_sol_with_program_rejects_insufficient_funds() { vec![create_account_ix], &[&payer, &program_owned_account], &payer.pubkey(), + None, ) .unwrap(); @@ -133,8 +147,13 @@ fn test_transfer_sol_with_program_rejects_insufficient_funds() { .to_account_metas(None), ); - let result = - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()); + let result = send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ); assert!(result.is_err(), "overdrawing the payer must fail"); // Balances are untouched. diff --git a/compression/cnft-burn/anchor-v1/programs/cnft-burn/Cargo.toml b/compression/cnft-burn/anchor-v1/programs/cnft-burn/Cargo.toml index 5acbf1be6..4975f2da6 100644 --- a/compression/cnft-burn/anchor-v1/programs/cnft-burn/Cargo.toml +++ b/compression/cnft-burn/anchor-v1/programs/cnft-burn/Cargo.toml @@ -31,11 +31,22 @@ litesvm = "0.16.0" solana-instruction = "3.0.0" solana-keypair = "3.0.1" solana-pubkey = "3.0.0" -solana-transaction = "4.1.5" solana-account = "4.3.0" solana-native-token = "3.0.0" solana-signer = "3.0.0" -solana-message = "4.2.4" +# Builds each v1 transaction the tests send. They send it through LiteSVM +# themselves to read the program error a failure carries. +solana-kite = "0.6.0" +# TODO: delete these two once solana-kite turns on `no-entrypoint` for them +# itself. kite 0.6.0 builds both with their program entrypoints, which clash +# with this program's `entrypoint` symbol when the test binary links (anchor's +# IDL build failed with `duplicate symbol: entrypoint`). Naming the same +# versions here turns the feature on through Cargo's feature unification. +spl-token = { version = "9.0.0", features = ["no-entrypoint"] } +spl-associated-token-account = { version = "8.0.0", features = ["no-entrypoint"] } +# The named limit those transactions get. Same version solana-kite 0.6 builds +# against. +solana-compute-budget = "4.2" solana-keccak-hasher = "3.0.0" [lints.rust] diff --git a/compression/cnft-burn/anchor-v1/programs/cnft-burn/tests/test_burn.rs b/compression/cnft-burn/anchor-v1/programs/cnft-burn/tests/test_burn.rs index a2ece44da..117db8b8d 100644 --- a/compression/cnft-burn/anchor-v1/programs/cnft-burn/tests/test_burn.rs +++ b/compression/cnft-burn/anchor-v1/programs/cnft-burn/tests/test_burn.rs @@ -15,13 +15,13 @@ use { borsh::BorshSerialize, litesvm::LiteSVM, + solana_compute_budget::compute_budget_limits::MAX_COMPUTE_UNIT_LIMIT, solana_instruction::{account_meta::AccountMeta, Instruction}, solana_keccak_hasher::hashv, solana_keypair::Keypair, - solana_message::Message, + solana_kite::{build_transaction_from_instructions, get_transaction_config}, solana_pubkey::{pubkey, Pubkey}, solana_signer::Signer, - solana_transaction::Transaction, }; // ---- Program IDs ---------------------------------------------------------- @@ -241,15 +241,21 @@ fn read_current_root(data: &[u8]) -> [u8; 32] { fn send( svm: &mut LiteSVM, - ixs: Vec, + instructions: Vec, payer: &Keypair, signers: &[&Keypair], ) -> Result<(), Box> { - let msg = Message::new(&ixs, Some(&payer.pubkey())); - let blockhash = svm.latest_blockhash(); - let mut tx = Transaction::new_unsigned(msg); - tx.sign(signers, blockhash); - svm.send_transaction(tx).map(|_| ()).map_err(Box::new) + let transaction = build_transaction_from_instructions( + svm, + &instructions, + signers, + &payer.pubkey(), + get_transaction_config(MAX_COMPUTE_UNIT_LIMIT), + ) + .unwrap(); + svm.send_transaction(transaction) + .map(|_| ()) + .map_err(Box::new) } #[test] diff --git a/compression/cnft-vault/anchor-v1/programs/cnft-vault/Cargo.toml b/compression/cnft-vault/anchor-v1/programs/cnft-vault/Cargo.toml index 123934404..eee1f47c9 100644 --- a/compression/cnft-vault/anchor-v1/programs/cnft-vault/Cargo.toml +++ b/compression/cnft-vault/anchor-v1/programs/cnft-vault/Cargo.toml @@ -34,9 +34,20 @@ litesvm = "0.16.0" solana-instruction = "3.0.0" solana-keypair = "3.0.1" solana-pubkey = "3.0.0" -solana-transaction = "4.1.5" solana-account = "4.3.0" solana-native-token = "3.0.0" solana-signer = "3.0.0" -solana-message = "4.2.4" +# Builds each v1 transaction the tests send. They send it through LiteSVM +# themselves to read the program error a failure carries. +solana-kite = "0.6.0" +# TODO: delete these two once solana-kite turns on `no-entrypoint` for them +# itself. kite 0.6.0 builds both with their program entrypoints, which clash +# with this program's `entrypoint` symbol when the test binary links (anchor's +# IDL build failed with `duplicate symbol: entrypoint`). Naming the same +# versions here turns the feature on through Cargo's feature unification. +spl-token = { version = "9.0.0", features = ["no-entrypoint"] } +spl-associated-token-account = { version = "8.0.0", features = ["no-entrypoint"] } +# The named limit those transactions get. Same version solana-kite 0.6 builds +# against. +solana-compute-budget = "4.2" solana-keccak-hasher = "3.0.0" diff --git a/compression/cnft-vault/anchor-v1/programs/cnft-vault/tests/test_vault.rs b/compression/cnft-vault/anchor-v1/programs/cnft-vault/tests/test_vault.rs index a57f22791..e391ec7ed 100644 --- a/compression/cnft-vault/anchor-v1/programs/cnft-vault/tests/test_vault.rs +++ b/compression/cnft-vault/anchor-v1/programs/cnft-vault/tests/test_vault.rs @@ -29,13 +29,13 @@ use { borsh::BorshSerialize, cnft_vault::error::VaultError, litesvm::LiteSVM, + solana_compute_budget::compute_budget_limits::MAX_COMPUTE_UNIT_LIMIT, solana_instruction::{account_meta::AccountMeta, Instruction}, solana_keccak_hasher::hashv, solana_keypair::Keypair, - solana_message::Message, + solana_kite::{build_transaction_from_instructions, get_transaction_config}, solana_pubkey::{pubkey, Pubkey}, solana_signer::Signer, - solana_transaction::Transaction, }; // ---- Program IDs ---------------------------------------------------------- @@ -251,15 +251,21 @@ fn read_current_root(data: &[u8]) -> [u8; 32] { fn send( svm: &mut LiteSVM, - ixs: Vec, + instructions: Vec, payer: &Keypair, signers: &[&Keypair], ) -> Result<(), Box> { - let msg = Message::new(&ixs, Some(&payer.pubkey())); - let blockhash = svm.latest_blockhash(); - let mut tx = Transaction::new_unsigned(msg); - tx.sign(signers, blockhash); - svm.send_transaction(tx).map(|_| ()).map_err(Box::new) + let transaction = build_transaction_from_instructions( + svm, + &instructions, + signers, + &payer.pubkey(), + get_transaction_config(MAX_COMPUTE_UNIT_LIMIT), + ) + .unwrap(); + svm.send_transaction(transaction) + .map(|_| ()) + .map_err(Box::new) } /// Assert a failed transaction carries the given program error. diff --git a/compression/cutils/anchor-v1/programs/cutils/Cargo.toml b/compression/cutils/anchor-v1/programs/cutils/Cargo.toml index de667a06b..f397fd74d 100644 --- a/compression/cutils/anchor-v1/programs/cutils/Cargo.toml +++ b/compression/cutils/anchor-v1/programs/cutils/Cargo.toml @@ -36,9 +36,20 @@ litesvm = "0.16.0" solana-instruction = "3.0.0" solana-keypair = "3.0.1" solana-pubkey = "3.0.0" -solana-transaction = "4.1.5" solana-account = "4.3.0" solana-native-token = "3.0.0" solana-signer = "3.0.0" -solana-message = "4.2.4" +# Builds each v1 transaction the tests send. They send it through LiteSVM +# themselves to read the program error a failure carries. +solana-kite = "0.6.0" +# TODO: delete these two once solana-kite turns on `no-entrypoint` for them +# itself. kite 0.6.0 builds both with their program entrypoints, which clash +# with this program's `entrypoint` symbol when the test binary links (anchor's +# IDL build failed with `duplicate symbol: entrypoint`). Naming the same +# versions here turns the feature on through Cargo's feature unification. +spl-token = { version = "9.0.0", features = ["no-entrypoint"] } +spl-associated-token-account = { version = "8.0.0", features = ["no-entrypoint"] } +# The named limit those transactions get. Same version solana-kite 0.6 builds +# against. +solana-compute-budget = "4.2" solana-keccak-hasher = "3.0.0" diff --git a/compression/cutils/anchor-v1/programs/cutils/tests/test_cutils.rs b/compression/cutils/anchor-v1/programs/cutils/tests/test_cutils.rs index 36be2b733..fd9351277 100644 --- a/compression/cutils/anchor-v1/programs/cutils/tests/test_cutils.rs +++ b/compression/cutils/anchor-v1/programs/cutils/tests/test_cutils.rs @@ -28,13 +28,13 @@ use { borsh::BorshSerialize, litesvm::LiteSVM, + solana_compute_budget::compute_budget_limits::MAX_COMPUTE_UNIT_LIMIT, solana_instruction::{account_meta::AccountMeta, Instruction}, solana_keccak_hasher::hashv, solana_keypair::Keypair, - solana_message::Message, + solana_kite::{build_transaction_from_instructions, get_transaction_config}, solana_pubkey::{pubkey, Pubkey}, solana_signer::Signer, - solana_transaction::Transaction, }; // ---- Program IDs ---------------------------------------------------------- @@ -280,15 +280,21 @@ fn get_asset_id(tree: &Pubkey, nonce: u64) -> Pubkey { fn send( svm: &mut LiteSVM, - ixs: Vec, + instructions: Vec, payer: &Keypair, signers: &[&Keypair], ) -> Result<(), Box> { - let msg = Message::new(&ixs, Some(&payer.pubkey())); - let blockhash = svm.latest_blockhash(); - let mut tx = Transaction::new_unsigned(msg); - tx.sign(signers, blockhash); - svm.send_transaction(tx).map(|_| ()).map_err(Box::new) + let transaction = build_transaction_from_instructions( + svm, + &instructions, + signers, + &payer.pubkey(), + get_transaction_config(MAX_COMPUTE_UNIT_LIMIT), + ) + .unwrap(); + svm.send_transaction(transaction) + .map(|_| ()) + .map_err(Box::new) } fn metadata_pda(mint: &Pubkey) -> Pubkey { diff --git a/finance/betting-market/anchor-v1/programs/betting-market/Cargo.toml b/finance/betting-market/anchor-v1/programs/betting-market/Cargo.toml index da0f66cfc..7ba08649c 100644 --- a/finance/betting-market/anchor-v1/programs/betting-market/Cargo.toml +++ b/finance/betting-market/anchor-v1/programs/betting-market/Cargo.toml @@ -34,7 +34,7 @@ spl-associated-token-account = { version = "8.0.0", features = ["no-entrypoint"] litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/finance/betting-market/anchor-v1/programs/betting-market/tests/test_betting_market.rs b/finance/betting-market/anchor-v1/programs/betting-market/tests/test_betting_market.rs index 0ed7cbf18..46390cd1d 100644 --- a/finance/betting-market/anchor-v1/programs/betting-market/tests/test_betting_market.rs +++ b/finance/betting-market/anchor-v1/programs/betting-market/tests/test_betting_market.rs @@ -88,11 +88,12 @@ fn setup() -> Market { .unwrap(); let admin = create_wallet(&mut svm, 100_000_000_000).unwrap(); - let mint = create_token_mint(&mut svm, &admin, DECIMALS, None).unwrap(); + let mint = create_token_mint(&mut svm, &admin, DECIMALS, None, None).unwrap(); let fee_recipient = create_wallet(&mut svm, 10_000_000_000).unwrap(); let fee_recipient_ata = - create_associated_token_account(&mut svm, &fee_recipient.pubkey(), &mint, &admin).unwrap(); + create_associated_token_account(&mut svm, &fee_recipient.pubkey(), &mint, &admin, None) + .unwrap(); Market { svm, @@ -145,10 +146,18 @@ fn create_bettor(market: &mut Market, amount: u64) -> (Keypair, Pubkey) { &bettor.pubkey(), &market.mint, &market.admin, + None, + ) + .unwrap(); + mint_tokens_to_token_account( + &mut market.svm, + &market.mint, + &ata, + amount, + &market.admin, + None, ) .unwrap(); - mint_tokens_to_token_account(&mut market.svm, &market.mint, &ata, amount, &market.admin) - .unwrap(); (bettor, ata) } @@ -454,6 +463,7 @@ fn transaction_fee(market: &mut Market) -> u64 { vec![system_instruction::transfer(&admin, &admin, 0)], &[&market.admin], &admin, + None, ) .unwrap(); before - get_sol_balance(&market.svm, &admin) @@ -485,6 +495,7 @@ fn close_outcomes_and_event(market: &mut Market, event_id: u64, outcome_count: u vec![close_outcome_ix(admin, event_id, index)], &[&market.admin], &admin, + None, ) .unwrap(); assert!( @@ -514,6 +525,7 @@ fn close_outcomes_and_event(market: &mut Market, event_id: u64, outcome_count: u )], &[&market.admin], &admin, + None, ) .unwrap(); assert!(!account_is_open(market, &event)); @@ -546,6 +558,7 @@ fn init_config(market: &mut Market) { vec![initialize_config_ix(admin, mint, fee_recipient)], &[&market.admin], &admin, + None, ) .unwrap(); } @@ -575,6 +588,7 @@ fn test_full_lifecycle() { ], &[&market.admin], &admin, + None, ) .unwrap(); @@ -590,6 +604,7 @@ fn test_full_lifecycle() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); send_transaction_from_instructions( @@ -604,6 +619,7 @@ fn test_full_lifecycle() { )], &[&bob], &bob.pubkey(), + None, ) .unwrap(); send_transaction_from_instructions( @@ -618,6 +634,7 @@ fn test_full_lifecycle() { )], &[&carol], &carol.pubkey(), + None, ) .unwrap(); @@ -651,6 +668,7 @@ fn test_full_lifecycle() { )], &[&market.admin], &admin, + None, ) .unwrap(); assert_eq!( @@ -670,6 +688,7 @@ fn test_full_lifecycle() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); send_transaction_from_instructions( @@ -683,6 +702,7 @@ fn test_full_lifecycle() { )], &[&bob], &bob.pubkey(), + None, ) .unwrap(); @@ -720,6 +740,7 @@ fn test_full_lifecycle() { )], &[&carol], &carol.pubkey(), + None, ); assert_fails_with(carol_claim, BettingError::NothingToClaim); @@ -731,6 +752,7 @@ fn test_full_lifecycle() { vec![close_losing_bet_ix(&carol.pubkey(), event_id, 1)], &[&carol], &carol.pubkey(), + None, ) .unwrap(); assert!(!account_is_open(&market, &carol_bet)); @@ -755,6 +777,7 @@ fn test_only_admin_can_initialize_event() { )], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(result, BettingError::Unauthorized); @@ -768,6 +791,7 @@ fn test_only_admin_can_initialize_event() { ], &[&market.admin], &admin, + None, ) .unwrap(); let unauthorized_outcome = send_transaction_from_instructions( @@ -775,6 +799,7 @@ fn test_only_admin_can_initialize_event() { vec![add_outcome_ix(mallory.pubkey(), event_id, 2, "Late entry")], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(unauthorized_outcome, BettingError::Unauthorized); let unauthorized_open = send_transaction_from_instructions( @@ -782,6 +807,7 @@ fn test_only_admin_can_initialize_event() { vec![open_betting_ix(mallory.pubkey(), event_id)], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(unauthorized_open, BettingError::Unauthorized); } @@ -810,6 +836,7 @@ fn test_only_admin_can_settle_or_cancel_event() { vec![cancel_event_ix(mallory.pubkey(), event_id)], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(unauthorized_cancel, BettingError::Unauthorized); @@ -827,6 +854,7 @@ fn test_only_admin_can_settle_or_cancel_event() { )], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(unauthorized_settle, BettingError::Unauthorized); assert!(read_event(&market, event_id).status == EventStatus::Open); @@ -862,6 +890,7 @@ fn test_cannot_bet_after_settle() { ], &[&market.admin], &admin, + None, ) .unwrap(); send_transaction_from_instructions( @@ -876,6 +905,7 @@ fn test_cannot_bet_after_settle() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); // Betting has closed, so the event can be settled. @@ -892,6 +922,7 @@ fn test_cannot_bet_after_settle() { )], &[&market.admin], &admin, + None, ) .unwrap(); @@ -907,6 +938,7 @@ fn test_cannot_bet_after_settle() { )], &[&bob], &bob.pubkey(), + None, ); assert_fails_with(late_bet, BettingError::EventNotOpen); } @@ -933,6 +965,7 @@ fn test_double_claim_fails() { ], &[&market.admin], &admin, + None, ) .unwrap(); send_transaction_from_instructions( @@ -947,6 +980,7 @@ fn test_double_claim_fails() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); send_transaction_from_instructions( @@ -961,6 +995,7 @@ fn test_double_claim_fails() { )], &[&carol], &carol.pubkey(), + None, ) .unwrap(); // Betting has closed, so the event can be settled. @@ -977,6 +1012,7 @@ fn test_double_claim_fails() { )], &[&market.admin], &admin, + None, ) .unwrap(); @@ -991,6 +1027,7 @@ fn test_double_claim_fails() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); // A fresh blockhash so the second claim is a distinct transaction. @@ -1006,6 +1043,7 @@ fn test_double_claim_fails() { )], &[&alice], &alice.pubkey(), + None, ); // The first claim closed the Bet account (`close = bettor`), so the second // transaction passes an address with no lamports and no data. Anchor @@ -1035,6 +1073,7 @@ fn test_settle_outcome_without_bets_fails() { ], &[&market.admin], &admin, + None, ) .unwrap(); // Everyone bets Horse A; Horse B has no bets. @@ -1050,6 +1089,7 @@ fn test_settle_outcome_without_bets_fails() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); @@ -1067,6 +1107,7 @@ fn test_settle_outcome_without_bets_fails() { )], &[&market.admin], &admin, + None, ); assert_fails_with(result, BettingError::OutcomeHasNoBets); } @@ -1091,6 +1132,7 @@ fn test_cancel_and_refund() { ], &[&market.admin], &admin, + None, ) .unwrap(); send_transaction_from_instructions( @@ -1105,6 +1147,7 @@ fn test_cancel_and_refund() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); send_transaction_from_instructions( @@ -1119,6 +1162,7 @@ fn test_cancel_and_refund() { )], &[&carol], &carol.pubkey(), + None, ) .unwrap(); @@ -1127,6 +1171,7 @@ fn test_cancel_and_refund() { vec![cancel_event_ix(admin, event_id)], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1144,6 +1189,7 @@ fn test_cancel_and_refund() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); @@ -1156,6 +1202,7 @@ fn test_cancel_and_refund() { vec![close_outcome_ix(admin, event_id, 0)], &[&market.admin], &admin, + None, ); assert_fails_with(outcome_still_in_use, BettingError::BetsStillOpen); assert_eq!(read_event(&market, event_id).open_bets, 1); @@ -1171,6 +1218,7 @@ fn test_cancel_and_refund() { )], &[&carol], &carol.pubkey(), + None, ) .unwrap(); @@ -1219,6 +1267,7 @@ fn test_close_losing_bet_only_after_settle_and_only_for_losers() { ], &[&market.admin], &admin, + None, ) .unwrap(); send_transaction_from_instructions( @@ -1233,6 +1282,7 @@ fn test_close_losing_bet_only_after_settle_and_only_for_losers() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); send_transaction_from_instructions( @@ -1247,6 +1297,7 @@ fn test_close_losing_bet_only_after_settle_and_only_for_losers() { )], &[&carol], &carol.pubkey(), + None, ) .unwrap(); @@ -1256,6 +1307,7 @@ fn test_close_losing_bet_only_after_settle_and_only_for_losers() { vec![close_losing_bet_ix(&carol.pubkey(), event_id, 1)], &[&carol], &carol.pubkey(), + None, ); assert_fails_with(premature_close, BettingError::EventNotSettled); @@ -1273,6 +1325,7 @@ fn test_close_losing_bet_only_after_settle_and_only_for_losers() { )], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1282,6 +1335,7 @@ fn test_close_losing_bet_only_after_settle_and_only_for_losers() { vec![close_losing_bet_ix(&alice.pubkey(), event_id, 0)], &[&alice], &alice.pubkey(), + None, ); assert_fails_with(winner_close, BettingError::BetWon); let alice_bet = bet_pda(&outcome_pda(&event_pda(event_id), 0), &alice.pubkey()); @@ -1295,6 +1349,7 @@ fn test_close_losing_bet_only_after_settle_and_only_for_losers() { vec![close_losing_bet_ix(&carol.pubkey(), event_id, 1)], &[&carol], &carol.pubkey(), + None, ) .unwrap(); let carol_bet = bet_pda(&outcome_pda(&event_pda(event_id), 1), &carol.pubkey()); @@ -1327,6 +1382,7 @@ fn test_no_cap_on_open_bets_per_wallet() { )], &[&market.admin], &admin, + None, ) .unwrap(); for index in 0..OUTCOME_COUNT { @@ -1340,6 +1396,7 @@ fn test_no_cap_on_open_bets_per_wallet() { )], &[&market.admin], &admin, + None, ) .unwrap(); } @@ -1348,6 +1405,7 @@ fn test_no_cap_on_open_bets_per_wallet() { vec![open_betting_ix(admin, wide_event_id)], &[&market.admin], &admin, + None, ) .unwrap(); send_transaction_from_instructions( @@ -1360,6 +1418,7 @@ fn test_no_cap_on_open_bets_per_wallet() { ], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1376,6 +1435,7 @@ fn test_no_cap_on_open_bets_per_wallet() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); } @@ -1391,6 +1451,7 @@ fn test_no_cap_on_open_bets_per_wallet() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); @@ -1432,6 +1493,7 @@ fn test_outcomes_lock_when_betting_opens() { ], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1448,6 +1510,7 @@ fn test_outcomes_lock_when_betting_opens() { )], &[&alice], &alice.pubkey(), + None, ); assert_fails_with(early_bet, BettingError::EventNotOpen); @@ -1460,6 +1523,7 @@ fn test_outcomes_lock_when_betting_opens() { ], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1469,6 +1533,7 @@ fn test_outcomes_lock_when_betting_opens() { vec![add_outcome_ix(admin, event_id, 2, "Late entry")], &[&market.admin], &admin, + None, ); assert_fails_with(late_outcome, BettingError::EventNotDraft); @@ -1478,6 +1543,7 @@ fn test_outcomes_lock_when_betting_opens() { vec![open_betting_ix(admin, event_id)], &[&market.admin], &admin, + None, ); assert_fails_with(reopen, BettingError::EventNotDraft); } @@ -1498,6 +1564,7 @@ fn test_open_betting_needs_two_outcomes() { ], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1506,6 +1573,7 @@ fn test_open_betting_needs_two_outcomes() { vec![open_betting_ix(admin, event_id)], &[&market.admin], &admin, + None, ); assert_fails_with(result, BettingError::NotEnoughOutcomes); @@ -1515,6 +1583,7 @@ fn test_open_betting_needs_two_outcomes() { vec![add_outcome_ix(admin, event_id, 1, "A second horse")], &[&market.admin], &admin, + None, ) .unwrap(); let mallory = create_wallet(&mut market.svm, 10_000_000_000).unwrap(); @@ -1523,6 +1592,7 @@ fn test_open_betting_needs_two_outcomes() { vec![open_betting_ix(mallory.pubkey(), event_id)], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(unauthorized, BettingError::Unauthorized); } @@ -1552,6 +1622,7 @@ fn test_betting_closes_at_close_time() { ], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1569,6 +1640,7 @@ fn test_betting_closes_at_close_time() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); @@ -1585,6 +1657,7 @@ fn test_betting_closes_at_close_time() { )], &[&market.admin], &admin, + None, ); assert_fails_with(early_settle, BettingError::BettingStillOpen); @@ -1602,6 +1675,7 @@ fn test_betting_closes_at_close_time() { )], &[&carol], &carol.pubkey(), + None, ); assert_fails_with(late_bet, BettingError::BettingClosed); @@ -1617,6 +1691,7 @@ fn test_betting_closes_at_close_time() { )], &[&market.admin], &admin, + None, ) .unwrap(); } @@ -1639,6 +1714,7 @@ fn test_close_time_must_be_in_the_future() { )], &[&market.admin], &admin, + None, ); assert_fails_with(result, BettingError::CloseTimeInPast); } @@ -1658,6 +1734,7 @@ fn open_yes_no_market(market: &mut Market, event_id: u64, description: &str) { ], &[&market.admin], &admin, + None, ) .unwrap(); } @@ -1683,6 +1760,7 @@ fn place_bet( )], &[bettor], &bettor.pubkey(), + None, ) .unwrap(); } @@ -1706,6 +1784,7 @@ fn settle(market: &mut Market, event_id: u64, winning_outcome_index: u8) { )], &[&market.admin], &admin, + None, ) .unwrap(); } @@ -1754,6 +1833,7 @@ fn test_close_event_pays_dust_to_fee_recipient_and_returns_rent() { vec![close_losing_bet_ix(&carol.pubkey(), event_id, 1)], &[&carol], &carol.pubkey(), + None, ) .unwrap(); assert_eq!(read_event(&market, event_id).open_bets, 2); @@ -1769,6 +1849,7 @@ fn test_close_event_pays_dust_to_fee_recipient_and_returns_rent() { )], &[winner], &winner.pubkey(), + None, ) .unwrap(); } @@ -1798,6 +1879,7 @@ fn test_close_event_pays_dust_to_fee_recipient_and_returns_rent() { )], &[&market.admin], &admin, + None, ); assert_fails_with(outcomes_still_open, BettingError::OutcomesStillOpen); @@ -1843,6 +1925,7 @@ fn test_close_event_refused_while_a_bet_is_open() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); assert_eq!(read_event(&market, event_id).open_bets, 1); @@ -1858,6 +1941,7 @@ fn test_close_event_refused_while_a_bet_is_open() { )], &[&market.admin], &admin, + None, ); assert_fails_with(event_close, BettingError::BetsStillOpen); let outcome_close = send_transaction_from_instructions( @@ -1865,6 +1949,7 @@ fn test_close_event_refused_while_a_bet_is_open() { vec![close_outcome_ix(admin, event_id, 1)], &[&market.admin], &admin, + None, ); assert_fails_with(outcome_close, BettingError::BetsStillOpen); @@ -1874,6 +1959,7 @@ fn test_close_event_refused_while_a_bet_is_open() { vec![close_losing_bet_ix(&carol.pubkey(), event_id, 1)], &[&carol], &carol.pubkey(), + None, ) .unwrap(); close_outcomes_and_event(&mut market, event_id, 2); @@ -1900,6 +1986,7 @@ fn test_close_event_refused_while_event_is_open() { ], &[&market.admin], &admin, + None, ) .unwrap(); @@ -1915,6 +2002,7 @@ fn test_close_event_refused_while_event_is_open() { )], &[&market.admin], &admin, + None, ); assert_fails_with(draft_close, BettingError::EventNotFinished); let draft_outcome_close = send_transaction_from_instructions( @@ -1922,6 +2010,7 @@ fn test_close_event_refused_while_event_is_open() { vec![close_outcome_ix(admin, event_id, 0)], &[&market.admin], &admin, + None, ); assert_fails_with(draft_outcome_close, BettingError::EventNotFinished); @@ -1932,6 +2021,7 @@ fn test_close_event_refused_while_event_is_open() { vec![open_betting_ix(admin, event_id)], &[&market.admin], &admin, + None, ) .unwrap(); market.svm.expire_blockhash(); @@ -1946,6 +2036,7 @@ fn test_close_event_refused_while_event_is_open() { )], &[&market.admin], &admin, + None, ); assert_fails_with(open_close, BettingError::EventNotFinished); @@ -1955,6 +2046,7 @@ fn test_close_event_refused_while_event_is_open() { vec![cancel_event_ix(admin, event_id)], &[&market.admin], &admin, + None, ) .unwrap(); let vault_balance_at_close = close_outcomes_and_event(&mut market, event_id, 2); @@ -1987,6 +2079,7 @@ fn test_only_admin_can_close_outcomes_and_event() { )], &[&alice], &alice.pubkey(), + None, ) .unwrap(); send_transaction_from_instructions( @@ -1994,6 +2087,7 @@ fn test_only_admin_can_close_outcomes_and_event() { vec![close_losing_bet_ix(&carol.pubkey(), event_id, 1)], &[&carol], &carol.pubkey(), + None, ) .unwrap(); @@ -2005,6 +2099,7 @@ fn test_only_admin_can_close_outcomes_and_event() { vec![close_outcome_ix(mallory.pubkey(), event_id, 0)], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(outcome_close, BettingError::Unauthorized); let event_close = send_transaction_from_instructions( @@ -2018,6 +2113,7 @@ fn test_only_admin_can_close_outcomes_and_event() { )], &[&mallory], &mallory.pubkey(), + None, ); assert_fails_with(event_close, BettingError::Unauthorized); let event = event_pda(event_id); diff --git a/finance/escrow/anchor-v1/programs/escrow/Cargo.toml b/finance/escrow/anchor-v1/programs/escrow/Cargo.toml index 46d88511e..224e255a1 100644 --- a/finance/escrow/anchor-v1/programs/escrow/Cargo.toml +++ b/finance/escrow/anchor-v1/programs/escrow/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/finance/escrow/anchor-v1/programs/escrow/tests/test_escrow.rs b/finance/escrow/anchor-v1/programs/escrow/tests/test_escrow.rs index b63186212..e18e22486 100644 --- a/finance/escrow/anchor-v1/programs/escrow/tests/test_escrow.rs +++ b/finance/escrow/anchor-v1/programs/escrow/tests/test_escrow.rs @@ -87,23 +87,24 @@ fn full_setup() -> EscrowSetup { // Token A is USDC and token B is TSLAx; the payer is the mint authority // of both. - let mint_a = create_token_mint(&mut svm, &payer, USDC_DECIMALS, None).unwrap(); - let mint_b = create_token_mint(&mut svm, &payer, TSLAX_DECIMALS, None).unwrap(); + let mint_a = create_token_mint(&mut svm, &payer, USDC_DECIMALS, None, None).unwrap(); + let mint_b = create_token_mint(&mut svm, &payer, TSLAX_DECIMALS, None, None).unwrap(); // Create ATAs let alice_ata_a = - create_associated_token_account(&mut svm, &alice.pubkey(), &mint_a, &payer).unwrap(); + create_associated_token_account(&mut svm, &alice.pubkey(), &mint_a, &payer, None).unwrap(); let alice_ata_b = - create_associated_token_account(&mut svm, &alice.pubkey(), &mint_b, &payer).unwrap(); + create_associated_token_account(&mut svm, &alice.pubkey(), &mint_b, &payer, None).unwrap(); let bob_ata_a = - create_associated_token_account(&mut svm, &bob.pubkey(), &mint_a, &payer).unwrap(); + create_associated_token_account(&mut svm, &bob.pubkey(), &mint_a, &payer, None).unwrap(); let bob_ata_b = - create_associated_token_account(&mut svm, &bob.pubkey(), &mint_b, &payer).unwrap(); + create_associated_token_account(&mut svm, &bob.pubkey(), &mint_b, &payer, None).unwrap(); // Both hold 1,000 USDC, and Bob holds the TSLAx. - mint_tokens_to_token_account(&mut svm, &mint_a, &alice_ata_a, ALICE_USDC, &payer).unwrap(); - mint_tokens_to_token_account(&mut svm, &mint_a, &bob_ata_a, BOB_USDC, &payer).unwrap(); - mint_tokens_to_token_account(&mut svm, &mint_b, &bob_ata_b, BOB_TSLAX, &payer).unwrap(); + mint_tokens_to_token_account(&mut svm, &mint_a, &alice_ata_a, ALICE_USDC, &payer, None) + .unwrap(); + mint_tokens_to_token_account(&mut svm, &mint_a, &bob_ata_a, BOB_USDC, &payer, None).unwrap(); + mint_tokens_to_token_account(&mut svm, &mint_b, &bob_ata_b, BOB_TSLAX, &payer, None).unwrap(); EscrowSetup { svm, @@ -169,6 +170,7 @@ fn test_make_offer() { vec![make_offer_ix], &[&es.payer, &es.alice], &es.payer.pubkey(), + None, ) .unwrap(); @@ -243,6 +245,7 @@ fn test_take_offer() { vec![make_offer_ix], &[&es.payer, &es.alice], &es.payer.pubkey(), + None, ) .unwrap(); @@ -282,6 +285,7 @@ fn test_take_offer() { vec![take_offer_ix], &[&es.payer, &es.bob], &es.payer.pubkey(), + None, ) .unwrap(); @@ -383,6 +387,7 @@ fn test_cancel_offer() { vec![make_offer_ix], &[&es.payer, &es.alice], &es.payer.pubkey(), + None, ) .unwrap(); @@ -412,6 +417,7 @@ fn test_cancel_offer() { vec![cancel_offer_ix], &[&es.payer, &es.alice], &es.payer.pubkey(), + None, ) .unwrap(); @@ -483,6 +489,7 @@ fn test_cancel_offer_rejects_non_maker() { vec![make_offer_ix], &[&es.payer, &es.alice], &es.payer.pubkey(), + None, ) .unwrap(); @@ -509,6 +516,7 @@ fn test_cancel_offer_rejects_non_maker() { vec![cancel_offer_ix], &[&es.payer, &es.bob], &es.payer.pubkey(), + None, ); // Bob passes himself as the maker, so the offer's seeds no longer derive // its address: Anchor's seeds check fails before `has_one = maker` runs. @@ -588,6 +596,7 @@ fn try_make_offer( vec![make_offer_ix], &[&es.payer, &es.alice], &es.payer.pubkey(), + None, ) } @@ -718,6 +727,7 @@ fn cancel_offer(es: &mut EscrowSetup, offer_id: u64) { vec![cancel_offer_ix], &[&es.payer, &es.alice], &es.payer.pubkey(), + None, ) .unwrap(); } @@ -780,6 +790,7 @@ fn assert_switched_offer_refused(switched_a_offered: u64, switched_b_wanted: u64 vec![take_offer_ix], &[&es.payer, &es.bob], &es.payer.pubkey(), + None, ); assert_fails_with(result, escrow::error::EscrowError::OfferTermsChanged); diff --git a/finance/fundraiser/anchor-v1/programs/fundraiser/Cargo.toml b/finance/fundraiser/anchor-v1/programs/fundraiser/Cargo.toml index 9a450cbb8..077406a68 100644 --- a/finance/fundraiser/anchor-v1/programs/fundraiser/Cargo.toml +++ b/finance/fundraiser/anchor-v1/programs/fundraiser/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" # solana-kite depends on these SPL program crates without "no-entrypoint", # so the host test binary would link their `entrypoint` symbols alongside diff --git a/finance/fundraiser/anchor-v1/programs/fundraiser/tests/test_fundraiser.rs b/finance/fundraiser/anchor-v1/programs/fundraiser/tests/test_fundraiser.rs index 42697bfb1..6bbd62873 100644 --- a/finance/fundraiser/anchor-v1/programs/fundraiser/tests/test_fundraiser.rs +++ b/finance/fundraiser/anchor-v1/programs/fundraiser/tests/test_fundraiser.rs @@ -111,7 +111,7 @@ fn full_setup() -> FundraiserSetup { let maker = create_wallet(&mut svm, 10_000_000_000).unwrap(); // The payer is the mint authority. - let mint = create_token_mint(&mut svm, &payer, MINT_DECIMALS, None).unwrap(); + let mint = create_token_mint(&mut svm, &payer, MINT_DECIMALS, None, None).unwrap(); let (fundraiser_pda, _bump) = Pubkey::find_program_address(&[b"fundraiser", maker.pubkey().as_ref()], &program_id); @@ -150,6 +150,7 @@ fn initialize_fundraiser(setup: &mut FundraiserSetup, amount: u64, duration: u16 vec![initialize_instruction], &[&setup.maker], &setup.maker.pubkey(), + None, ) .unwrap(); } @@ -164,6 +165,7 @@ fn create_funded_contributor(setup: &mut FundraiserSetup) -> (Keypair, Pubkey, P &contributor.pubkey(), &setup.mint, &setup.payer, + None, ) .unwrap(); @@ -173,6 +175,7 @@ fn create_funded_contributor(setup: &mut FundraiserSetup) -> (Keypair, Pubkey, P &contributor_ata, CONTRIBUTOR_STARTING_BALANCE, &setup.payer, + None, ) .unwrap(); @@ -317,6 +320,7 @@ fn contribute( vec![contribute_instruction], &[&contributor.keypair], &contributor.keypair.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -360,6 +364,7 @@ fn refund( vec![refund_instruction], &[fee_payer], &fee_payer.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -375,6 +380,7 @@ fn claim(setup: &mut FundraiserSetup) -> Result { vec![check_instruction], &[&maker], &maker.pubkey(), + None, ) .map(|_| maker_ata) .map_err(|error| format!("{error:?}")) @@ -397,6 +403,7 @@ fn close_contribution( vec![close_instruction], &[fee_payer], &fee_payer.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -412,6 +419,7 @@ fn close_fundraiser(setup: &mut FundraiserSetup) -> Result<(), String> { vec![close_instruction], &[&maker], &maker.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -509,6 +517,7 @@ fn test_initialize_below_minimum_target_fails() { vec![initialize_instruction], &[&setup.maker], &setup.maker.pubkey(), + None, ) .map_err(|error| format!("{error:?}")); assert_error(result, FundraiserError::InvalidAmount); @@ -756,6 +765,7 @@ fn test_second_claim_fails() { &setup.vault, ONE_TOKEN, &setup.payer, + None, ) .unwrap(); setup.svm.expire_blockhash(); @@ -800,6 +810,7 @@ fn test_check_contributions_ignores_direct_vault_donations() { &setup.vault, AMOUNT_TO_RAISE, &setup.payer, + None, ) .unwrap(); @@ -1029,6 +1040,7 @@ fn test_reinitialize_with_open_contributions_fails() { vec![initialize_instruction], &[&setup.maker], &setup.maker.pubkey(), + None, ) .map_err(|error| format!("{error:?}")); // `init` asks the System Program to allocate the fundraiser's address, @@ -1132,6 +1144,7 @@ fn test_close_fundraiser_sweeps_direct_donations_to_maker() { &setup.vault, donation, &setup.payer, + None, ) .unwrap(); diff --git a/finance/lending/anchor-v1/programs/lending/Cargo.toml b/finance/lending/anchor-v1/programs/lending/Cargo.toml index b680f61ab..ea9c3ccce 100644 --- a/finance/lending/anchor-v1/programs/lending/Cargo.toml +++ b/finance/lending/anchor-v1/programs/lending/Cargo.toml @@ -32,7 +32,7 @@ solana-sysvar = "3" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs b/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs index 39f141eeb..f94e7221d 100644 --- a/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs +++ b/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs @@ -84,7 +84,7 @@ fn send( signers: &[&Keypair], payer: &Pubkey, ) -> Result<(), String> { - send_transaction_from_instructions(svm, instructions, signers, payer) + send_transaction_from_instructions(svm, instructions, signers, payer, None) .map_err(|thrown| format!("{thrown:?}")) } @@ -114,7 +114,7 @@ impl Env { svm.add_program(lending::id(), program_bytes).unwrap(); let owner = create_wallet(&mut svm, 1_000_000_000_000).unwrap(); - let quote_mint = create_token_mint(&mut svm, &owner, 6, None).unwrap(); + let quote_mint = create_token_mint(&mut svm, &owner, 6, None, None).unwrap(); // The market is seeded by its market_id index alone (no owner). Market 0. let market_id: u64 = 0; let market = pda(&[LENDING_MARKET_SEED, &market_id.to_le_bytes()]); @@ -145,7 +145,7 @@ impl Env { /// exercise cross-market isolation. pub fn init_market_for(&mut self, market_owner: &Keypair) -> Pubkey { let env_owner = self.owner.insecure_clone(); - let quote_mint = create_token_mint(&mut self.svm, &env_owner, 6, None).unwrap(); + let quote_mint = create_token_mint(&mut self.svm, &env_owner, 6, None, None).unwrap(); // A distinct id from the env's market 0, since the id is the market's // global identifier (the owner is not part of the seed). let market_id: u64 = 1; @@ -197,7 +197,7 @@ impl Env { config: ReserveConfig, ) -> Result { let env_owner = self.owner.insecure_clone(); - let mint = create_token_mint(&mut self.svm, &env_owner, decimals, None).unwrap(); + let mint = create_token_mint(&mut self.svm, &env_owner, decimals, None, None).unwrap(); self.set_price_for( market_owner, market, @@ -403,10 +403,18 @@ impl Env { pub fn fund(&mut self, user: &Keypair, mint: Pubkey, amount: u64) -> Pubkey { let owner = self.owner.insecure_clone(); let token_account = - create_associated_token_account(&mut self.svm, &user.pubkey(), &mint, user).unwrap(); - if amount > 0 { - mint_tokens_to_token_account(&mut self.svm, &mint, &token_account, amount, &owner) + create_associated_token_account(&mut self.svm, &user.pubkey(), &mint, user, None) .unwrap(); + if amount > 0 { + mint_tokens_to_token_account( + &mut self.svm, + &mint, + &token_account, + amount, + &owner, + None, + ) + .unwrap(); } token_account } @@ -438,6 +446,7 @@ impl Env { &user.pubkey(), &handle.share_mint, user, + None, ) .unwrap(); } @@ -838,6 +847,7 @@ impl Env { &liquidator.pubkey(), &collateral.share_mint, liquidator, + None, ) .unwrap(); } @@ -910,8 +920,14 @@ impl Env { let owner = self.owner.insecure_clone(); let owner_liquidity = ata(&owner.pubkey(), &handle.mint); if self.svm.get_account(&owner_liquidity).is_none() { - create_associated_token_account(&mut self.svm, &owner.pubkey(), &handle.mint, &owner) - .unwrap(); + create_associated_token_account( + &mut self.svm, + &owner.pubkey(), + &handle.mint, + &owner, + None, + ) + .unwrap(); } let refresh = self.refresh_reserve_ix(handle); let collect = Instruction { diff --git a/finance/lending/anchor-v1/programs/lending/tests/test_deposit_redeem.rs b/finance/lending/anchor-v1/programs/lending/tests/test_deposit_redeem.rs index 622d71068..40fe3c1af 100644 --- a/finance/lending/anchor-v1/programs/lending/tests/test_deposit_redeem.rs +++ b/finance/lending/anchor-v1/programs/lending/tests/test_deposit_redeem.rs @@ -59,6 +59,7 @@ fn raw_token_donation_does_not_inflate_exchange_rate() { &usdc.liquidity_vault, amount, &owner, + None, ) .unwrap(); diff --git a/finance/lending/anchor-v1/programs/lending/tests/test_security.rs b/finance/lending/anchor-v1/programs/lending/tests/test_security.rs index 4cbb02390..3af09eae0 100644 --- a/finance/lending/anchor-v1/programs/lending/tests/test_security.rs +++ b/finance/lending/anchor-v1/programs/lending/tests/test_security.rs @@ -72,6 +72,7 @@ fn non_owner_cannot_write_market_price_feed() { vec![instruction], &[&attacker], &attacker.pubkey(), + None, ); // `SetPrice` binds the signer with `has_one = owner` on the market, so // the refusal is Anchor's constraint error, not one of the program's. diff --git a/finance/managed-fund/anchor-v1/programs/managed-fund/Cargo.toml b/finance/managed-fund/anchor-v1/programs/managed-fund/Cargo.toml index 8cd4c422f..f2660292d 100644 --- a/finance/managed-fund/anchor-v1/programs/managed-fund/Cargo.toml +++ b/finance/managed-fund/anchor-v1/programs/managed-fund/Cargo.toml @@ -33,7 +33,7 @@ litesvm = "0.16.0" solana-account = "4.3.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/finance/managed-fund/anchor-v1/programs/managed-fund/tests/managed_fund.rs b/finance/managed-fund/anchor-v1/programs/managed-fund/tests/managed_fund.rs index 026eec364..9f08968db 100644 --- a/finance/managed-fund/anchor-v1/programs/managed-fund/tests/managed_fund.rs +++ b/finance/managed-fund/anchor-v1/programs/managed-fund/tests/managed_fund.rs @@ -239,9 +239,9 @@ fn setup_with_tsla_decimals(tsla_decimals: u8) -> TestContext { let payer = create_wallet(&mut svm, 100_000_000_000).unwrap(); let manager = create_wallet(&mut svm, 10_000_000_000).unwrap(); - let usdc_mint = create_token_mint(&mut svm, &payer, USDC_DECIMALS, None).unwrap(); - let tsla_mint = create_token_mint(&mut svm, &payer, tsla_decimals, None).unwrap(); - let nvda_mint = create_token_mint(&mut svm, &payer, ASSET_DECIMALS, None).unwrap(); + let usdc_mint = create_token_mint(&mut svm, &payer, USDC_DECIMALS, None, None).unwrap(); + let tsla_mint = create_token_mint(&mut svm, &payer, tsla_decimals, None, None).unwrap(); + let nvda_mint = create_token_mint(&mut svm, &payer, ASSET_DECIMALS, None, None).unwrap(); let (router_config_pda, _) = Pubkey::find_program_address(&[b"router_config"], &router_program_id); @@ -258,7 +258,8 @@ fn setup_with_tsla_decimals(tsla_decimals: u8) -> TestContext { &[], ) .unwrap(); - send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()).unwrap(); + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None) + .unwrap(); } let (fund_pda, _) = Pubkey::find_program_address( @@ -305,8 +306,14 @@ fn setup_with_tsla_decimals(tsla_decimals: u8) -> TestContext { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_router_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_router_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); for (mint, rate, rate_pda) in [ (tsla_mint, TSLA_RATE, tsla_rate_pda), @@ -332,7 +339,8 @@ fn setup_with_tsla_decimals(tsla_decimals: u8) -> TestContext { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()).unwrap(); + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None) + .unwrap(); } mint_tokens_to_token_account( @@ -341,6 +349,7 @@ fn setup_with_tsla_decimals(tsla_decimals: u8) -> TestContext { &router_usdc_treasury, 10_000_000_000u64, &payer, + None, ) .unwrap(); @@ -360,6 +369,7 @@ fn setup_with_tsla_decimals(tsla_decimals: u8) -> TestContext { vec![init_registry_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); @@ -379,7 +389,8 @@ fn setup_with_tsla_decimals(tsla_decimals: u8) -> TestContext { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey()).unwrap(); + send_transaction_from_instructions(&mut svm, vec![ix], &[&payer], &payer.pubkey(), None) + .unwrap(); } TestContext { @@ -448,6 +459,7 @@ fn init_fund(ctx: &mut TestContext, fee_bps: u16, slippage_bps: u16, router: Pub vec![ix], &[&ctx.manager], &ctx.manager.pubkey(), + None, ) .unwrap(); } @@ -483,6 +495,7 @@ fn add_asset( vec![ix], &[&ctx.manager], &ctx.manager.pubkey(), + None, ) } @@ -587,7 +600,8 @@ fn do_deposit( ) -> Pubkey { let remaining = deposit_remaining(ctx); let ix = deposit_instruction(ctx, user, usdc_amount, minimum_shares, remaining); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[user], &user.pubkey()).unwrap(); + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[user], &user.pubkey(), None) + .unwrap(); derive_ata(&user.pubkey(), &ctx.share_mint_pda) } @@ -600,7 +614,8 @@ fn do_deposit_tsla_only( ) -> Pubkey { let remaining = deposit_remaining_tsla(ctx); let ix = deposit_instruction(ctx, user, usdc_amount, minimum_shares, remaining); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[user], &user.pubkey()).unwrap(); + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[user], &user.pubkey(), None) + .unwrap(); derive_ata(&user.pubkey(), &ctx.share_mint_pda) } @@ -627,8 +642,14 @@ fn set_router_rate(ctx: &mut TestContext, mint: Pubkey, rate: u64, rate_pda: Pub } .to_account_metas(None), ); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&ctx.payer], &ctx.payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut ctx.svm, + vec![ix], + &[&ctx.payer], + &ctx.payer.pubkey(), + None, + ) + .unwrap(); } /// Move NVDAx's price: rewrite its Pyth feed and update the router rate to match. @@ -659,6 +680,7 @@ fn set_weight( vec![ix], &[&ctx.manager], &ctx.manager.pubkey(), + None, ) } @@ -727,7 +749,8 @@ fn donate_usdc(ctx: &mut TestContext, donor: &Keypair, amount: u64) { amount, ) .unwrap(); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[donor], &donor.pubkey()).unwrap(); + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[donor], &donor.pubkey(), None) + .unwrap(); } /// A holder's position valued in USDC minor units at the test's starting prices @@ -804,7 +827,13 @@ fn try_rebalance( ) -> Result<(), solana_kite::SolanaKiteError> { let stranger = create_wallet(&mut ctx.svm, 1_000_000_000).unwrap(); let ix = rebalance_instruction(ctx, &stranger, sell_index, buy_index); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&stranger], &stranger.pubkey()) + send_transaction_from_instructions( + &mut ctx.svm, + vec![ix], + &[&stranger], + &stranger.pubkey(), + None, + ) } fn do_rebalance(ctx: &mut TestContext, sell_index: u8, buy_index: u8) { @@ -881,22 +910,34 @@ fn do_collect_fees(ctx: &mut TestContext) -> Pubkey { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&ctx.payer], &ctx.payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut ctx.svm, + vec![ix], + &[&ctx.payer], + &ctx.payer.pubkey(), + None, + ) + .unwrap(); manager_share } fn fund_user(ctx: &mut TestContext, usdc_amount: u64) -> Keypair { let user = create_wallet(&mut ctx.svm, 10_000_000_000).unwrap(); - let user_usdc = - create_associated_token_account(&mut ctx.svm, &user.pubkey(), &ctx.usdc_mint, &ctx.payer) - .unwrap(); + let user_usdc = create_associated_token_account( + &mut ctx.svm, + &user.pubkey(), + &ctx.usdc_mint, + &ctx.payer, + None, + ) + .unwrap(); mint_tokens_to_token_account( &mut ctx.svm, &ctx.usdc_mint, &user_usdc, usdc_amount, &ctx.payer, + None, ) .unwrap(); user @@ -932,7 +973,8 @@ fn test_add_asset_rejects_unapproved() { init_fund(&mut ctx, FEE_BPS, SLIPPAGE_BPS, router); // A mint that was never approved: its approved_asset PDA does not exist. - let rogue_mint = create_token_mint(&mut ctx.svm, &ctx.payer, ASSET_DECIMALS, None).unwrap(); + let rogue_mint = + create_token_mint(&mut ctx.svm, &ctx.payer, ASSET_DECIMALS, None, None).unwrap(); let (rogue_entry, _) = Pubkey::find_program_address( &[ b"approved_asset", @@ -971,7 +1013,7 @@ fn test_add_asset_rejects_weight_overflow() { /// arbitrary pubkey: callers that never value this asset (e.g. the cap boundary test) /// do not need a real feed account. fn create_and_approve_mint(ctx: &mut TestContext) -> (Pubkey, Pubkey) { - let mint = create_token_mint(&mut ctx.svm, &ctx.payer, ASSET_DECIMALS, None).unwrap(); + let mint = create_token_mint(&mut ctx.svm, &ctx.payer, ASSET_DECIMALS, None, None).unwrap(); let (entry, _) = Pubkey::find_program_address( &[b"approved_asset", ctx.registry_pda.as_ref(), mint.as_ref()], &ctx.fund_program_id, @@ -991,8 +1033,14 @@ fn create_and_approve_mint(ctx: &mut TestContext) -> (Pubkey, Pubkey) { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&ctx.payer], &ctx.payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut ctx.svm, + vec![ix], + &[&ctx.payer], + &ctx.payer.pubkey(), + None, + ) + .unwrap(); (mint, entry) } @@ -1055,6 +1103,7 @@ fn test_initialize_rejects_excessive_fee() { vec![ix], &[&ctx.manager], &ctx.manager.pubkey(), + None, ); assert_program_error( r, @@ -1095,6 +1144,7 @@ fn test_initialize_rejects_excessive_slippage() { vec![ix], &[&ctx.manager], &ctx.manager.pubkey(), + None, ); assert_program_error( r, @@ -1173,7 +1223,8 @@ fn test_deposit_rejects_underallocated() { let user = fund_user(&mut ctx, 10_000_000); let ix = deposit_instruction(&ctx, &user, 10_000_000, 1, deposit_remaining_tsla(&ctx)); - let r = send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()); + let r = + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None); assert_program_error( r, FundError::FundNotFullyAllocated, @@ -1210,7 +1261,8 @@ fn test_deposit_rejects_slippage() { let user = fund_user(&mut ctx, 10_000_000); let ix = deposit_instruction(&ctx, &user, 10_000_000, 1, deposit_remaining(&ctx)); - let r = send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()); + let r = + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None); assert_router_error( r, RouterError::SlippageExceeded, @@ -1231,7 +1283,8 @@ fn test_deposit_rejects_unregistered_router() { let user = fund_user(&mut ctx, 10_000_000); let ix = deposit_instruction(&ctx, &user, 10_000_000, 1, deposit_remaining(&ctx)); - let r = send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()); + let r = + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None); assert_program_error( r, FundError::InvalidSwapRouter, @@ -1273,7 +1326,7 @@ fn test_deposit_rejects_price_from_before_restart() { let ix = deposit_instruction(&ctx, &user, 10_000_000, 1, deposit_remaining(&ctx)); assert_program_error( - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()), + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None), FundError::PricePredatesRestart, "a deposit priced before the restart must fail", ); @@ -1455,10 +1508,22 @@ fn test_withdraw() { // User needs token accounts for each asset paid in kind. let user_usdc = derive_ata(&user.pubkey(), &ctx.usdc_mint); - create_associated_token_account(&mut ctx.svm, &user.pubkey(), &ctx.tsla_mint, &ctx.payer) - .unwrap(); - create_associated_token_account(&mut ctx.svm, &user.pubkey(), &ctx.nvda_mint, &ctx.payer) - .unwrap(); + create_associated_token_account( + &mut ctx.svm, + &user.pubkey(), + &ctx.tsla_mint, + &ctx.payer, + None, + ) + .unwrap(); + create_associated_token_account( + &mut ctx.svm, + &user.pubkey(), + &ctx.nvda_mint, + &ctx.payer, + None, + ) + .unwrap(); let mut metas = managed_fund::accounts::WithdrawAccountConstraints { user: user.pubkey(), @@ -1484,7 +1549,8 @@ fn test_withdraw() { .data(), metas, ); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()).unwrap(); + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None) + .unwrap(); // Sole holder withdraws everything in kind: all 0.016 TSLAx + 0.03333333 // NVDAx, no USDC. @@ -1509,10 +1575,22 @@ fn test_withdraw_rejects_slippage() { let shares = get_token_account_balance(&ctx.svm, &user_share).unwrap(); let user_usdc = derive_ata(&user.pubkey(), &ctx.usdc_mint); - create_associated_token_account(&mut ctx.svm, &user.pubkey(), &ctx.tsla_mint, &ctx.payer) - .unwrap(); - create_associated_token_account(&mut ctx.svm, &user.pubkey(), &ctx.nvda_mint, &ctx.payer) - .unwrap(); + create_associated_token_account( + &mut ctx.svm, + &user.pubkey(), + &ctx.tsla_mint, + &ctx.payer, + None, + ) + .unwrap(); + create_associated_token_account( + &mut ctx.svm, + &user.pubkey(), + &ctx.nvda_mint, + &ctx.payer, + None, + ) + .unwrap(); let mut metas = managed_fund::accounts::WithdrawAccountConstraints { user: user.pubkey(), @@ -1540,7 +1618,8 @@ fn test_withdraw_rejects_slippage() { .data(), metas, ); - let r = send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()); + let r = + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None); assert_program_error( r, FundError::UsdcSlippage, @@ -1558,7 +1637,8 @@ fn test_deposit_rejects_incomplete_assets() { // Only one asset's accounts supplied (5) for a two-asset fund (needs 10). let ix = deposit_instruction(&ctx, &user, amount, 1, deposit_remaining_tsla(&ctx)); - let r = send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()); + let r = + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None); assert_program_error( r, FundError::IncompleteAssetAccounts, @@ -1567,10 +1647,22 @@ fn test_deposit_rejects_incomplete_assets() { } fn do_withdraw(ctx: &mut TestContext, user: &Keypair, shares: u64, min_usdc_out: u64) { - create_associated_token_account(&mut ctx.svm, &user.pubkey(), &ctx.tsla_mint, &ctx.payer) - .unwrap(); - create_associated_token_account(&mut ctx.svm, &user.pubkey(), &ctx.nvda_mint, &ctx.payer) - .unwrap(); + create_associated_token_account( + &mut ctx.svm, + &user.pubkey(), + &ctx.tsla_mint, + &ctx.payer, + None, + ) + .unwrap(); + create_associated_token_account( + &mut ctx.svm, + &user.pubkey(), + &ctx.nvda_mint, + &ctx.payer, + None, + ) + .unwrap(); let user_usdc = derive_ata(&user.pubkey(), &ctx.usdc_mint); let user_share = derive_ata(&user.pubkey(), &ctx.share_mint_pda); let mut metas = managed_fund::accounts::WithdrawAccountConstraints { @@ -1596,7 +1688,8 @@ fn do_withdraw(ctx: &mut TestContext, user: &Keypair, shares: u64, min_usdc_out: .data(), metas, ); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[user], &user.pubkey()).unwrap(); + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[user], &user.pubkey(), None) + .unwrap(); } #[test] @@ -1613,7 +1706,8 @@ fn test_set_weight_retire() { let user = fund_user(&mut ctx, 100_000_000); let ix = deposit_instruction(&ctx, &user, 100_000_000, 1, deposit_remaining(&ctx)); - let r = send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()); + let r = + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None); assert_program_error( r, FundError::FundNotFullyAllocated, @@ -1675,6 +1769,7 @@ fn test_set_weight_rejects_non_manager() { vec![ix], &[&intruder], &intruder.pubkey(), + None, ); // The manager is bound to the fund's stored `manager` by an Anchor // constraint, so the refusal is Anchor's, not one of the program's errors. @@ -1858,6 +1953,7 @@ fn test_deposit_rejects_leg_that_buys_nothing() { vec![ix], &[&attacker], &attacker.pubkey(), + None, ); let err = format!( "{:?}", @@ -1893,7 +1989,8 @@ fn donate_token( amount, ) .unwrap(); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[donor], &donor.pubkey()).unwrap(); + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[donor], &donor.pubkey(), None) + .unwrap(); } /// A fund sitting at its target weights has nothing to rebalance, in either @@ -1978,7 +2075,7 @@ struct ExtraAsset { } fn create_routable_asset(ctx: &mut TestContext, price: i64, rate: u64) -> ExtraAsset { - let mint = create_token_mint(&mut ctx.svm, &ctx.payer, ASSET_DECIMALS, None).unwrap(); + let mint = create_token_mint(&mut ctx.svm, &ctx.payer, ASSET_DECIMALS, None, None).unwrap(); let ix = spl_token::instruction::set_authority( &spl_token::ID, &mint, @@ -1988,8 +2085,14 @@ fn create_routable_asset(ctx: &mut TestContext, price: i64, rate: u64) -> ExtraA &[], ) .unwrap(); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&ctx.payer], &ctx.payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut ctx.svm, + vec![ix], + &[&ctx.payer], + &ctx.payer.pubkey(), + None, + ) + .unwrap(); let (rate_pda, _) = Pubkey::find_program_address(&[b"rate", mint.as_ref()], &ctx.router_program_id); set_router_rate(ctx, mint, rate, rate_pda); @@ -2011,8 +2114,14 @@ fn create_routable_asset(ctx: &mut TestContext, price: i64, rate: u64) -> ExtraA } .to_account_metas(None), ); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&ctx.payer], &ctx.payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut ctx.svm, + vec![ix], + &[&ctx.payer], + &ctx.payer.pubkey(), + None, + ) + .unwrap(); let vault = derive_ata(&ctx.fund_pda, &mint); ExtraAsset { mint, @@ -2049,7 +2158,8 @@ fn test_rebalance_refuses_buying_overweight_asset() { )); let alice = fund_user(&mut ctx, 1_000_000_000); let ix = deposit_instruction(&ctx, &alice, 1_000_000_000, 1, remaining.clone()); - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&alice], &alice.pubkey()).unwrap(); + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&alice], &alice.pubkey(), None) + .unwrap(); // NVDAx and the third asset both rise 30%. NVDAx is about $520 of $1,180 // against a $472 target; the third asset $260 against $236; TSLAx $400 @@ -2066,6 +2176,7 @@ fn test_rebalance_refuses_buying_overweight_asset() { vec![into_third], &[&stranger], &stranger.pubkey(), + None, ); assert_program_error( r, @@ -2080,6 +2191,7 @@ fn test_rebalance_refuses_buying_overweight_asset() { vec![into_itself], &[&stranger], &stranger.pubkey(), + None, ); assert_program_error( r, @@ -2094,6 +2206,7 @@ fn test_rebalance_refuses_buying_overweight_asset() { vec![into_tsla], &[&stranger], &stranger.pubkey(), + None, ) .unwrap(); assert!(read_fund(&ctx).asset_holdings[0] > 160_000_000); @@ -2117,6 +2230,7 @@ fn test_rebalance_rejects_incomplete_assets() { vec![ix], &[&stranger], &stranger.pubkey(), + None, ); assert_program_error( r, @@ -2229,6 +2343,7 @@ fn test_initialize_rejects_threshold_out_of_range() { vec![ix], &[&ctx.manager], &ctx.manager.pubkey(), + None, ); assert_program_error( r, @@ -2334,7 +2449,7 @@ fn test_wide_confidence_price_rejected() { let bob = fund_user(&mut ctx, 480_000_000); let ix = deposit_instruction(&ctx, &bob, 480_000_000, 1, deposit_remaining(&ctx)); assert_program_error( - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&bob], &bob.pubkey()), + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&bob], &bob.pubkey(), None), FundError::OracleConfidenceTooWide, "a deposit priced from a wide-confidence feed must fail", ); @@ -2386,7 +2501,7 @@ fn test_partially_verified_price_rejected() { write_partially_verified_price_feed(&mut ctx.svm, ctx.price_feed_nvda, NVDA_PRICE, 2); let ix = deposit_instruction(&ctx, &user, amount, amount, deposit_remaining(&ctx)); assert_program_error( - send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey()), + send_transaction_from_instructions(&mut ctx.svm, vec![ix], &[&user], &user.pubkey(), None), FundError::PriceNotFullyVerified, "a deposit priced from a partially verified update must fail", ); diff --git a/finance/managed-fund/anchor-v1/programs/mock-swap-router/Cargo.toml b/finance/managed-fund/anchor-v1/programs/mock-swap-router/Cargo.toml index d6938bb59..bb930a85f 100644 --- a/finance/managed-fund/anchor-v1/programs/mock-swap-router/Cargo.toml +++ b/finance/managed-fund/anchor-v1/programs/mock-swap-router/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = "1.2.0" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/finance/options/anchor-v1/programs/options/Cargo.toml b/finance/options/anchor-v1/programs/options/Cargo.toml index b7e9bc270..e10d1b5a7 100644 --- a/finance/options/anchor-v1/programs/options/Cargo.toml +++ b/finance/options/anchor-v1/programs/options/Cargo.toml @@ -35,14 +35,13 @@ spl-associated-token-account = { version = "8.0.0", features = ["no-entrypoint"] litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" -# The suite sends each instruction through LiteSVM itself rather than through -# solana-kite's wrapper, so it can read the transaction's metadata back: the -# inner instructions say how many token transfers a handler made. Same major -# versions as litesvm 0.16 and solana-kite 0.5 use, so one copy of each is -# linked. -solana-transaction = "4" -solana-message = "4" +solana-kite = "0.6.0" +# The suite builds each transaction with solana-kite and sends it through +# LiteSVM itself rather than through solana-kite's sender, so it can read the +# transaction's metadata back: the inner instructions say how many token +# transfers a handler made. This crate names the compute unit limit those +# transactions get; same version solana-kite 0.6 builds against. +solana-compute-budget = "4.2" borsh = "1.6.1" [lints.rust] diff --git a/finance/options/anchor-v1/programs/options/tests/test_options.rs b/finance/options/anchor-v1/programs/options/tests/test_options.rs index e44a4e53f..4aa306842 100644 --- a/finance/options/anchor-v1/programs/options/tests/test_options.rs +++ b/finance/options/anchor-v1/programs/options/tests/test_options.rs @@ -10,15 +10,14 @@ use { instructions::write_option::OptionTerms, state::{Market as MarketState, OptionContract, OptionKind, OptionStatus}, }, + solana_compute_budget::compute_budget_limits::MAX_COMPUTE_UNIT_LIMIT, solana_keypair::Keypair, solana_kite::{ - create_associated_token_account, create_token_mint, create_wallet, - get_token_account_balance, mint_tokens_to_token_account, - send_transaction_from_instructions, + build_transaction_from_instructions, create_associated_token_account, create_token_mint, + create_wallet, get_token_account_balance, get_transaction_config, + mint_tokens_to_token_account, send_transaction_from_instructions, }, - solana_message::Message, solana_signer::Signer, - solana_transaction::Transaction, }; // The underlying is NVDAx (tokenized NVIDIA stock), which has 8 decimals, @@ -162,11 +161,12 @@ impl Venue { let payer = create_wallet(&mut svm, 100_000_000_000).unwrap(); let admin = create_wallet(&mut svm, 100_000_000_000).unwrap(); - let underlying_mint = create_token_mint(&mut svm, &admin, NVDAX_DECIMALS, None).unwrap(); + let underlying_mint = + create_token_mint(&mut svm, &admin, NVDAX_DECIMALS, None, None).unwrap(); let quote_mint = if same_mint { underlying_mint } else { - create_token_mint(&mut svm, &admin, USDC_DECIMALS, None).unwrap() + create_token_mint(&mut svm, &admin, USDC_DECIMALS, None, None).unwrap() }; let market = Pubkey::find_program_address( @@ -199,6 +199,7 @@ impl Venue { vec![initialize_market], &[&admin], &admin.pubkey(), + None, ) .map_err(|error| format!("{error:?}"))?; @@ -291,6 +292,7 @@ impl Venue { &keypair.pubkey(), &self.underlying_mint, &self.payer, + None, ) .unwrap() } else { @@ -301,6 +303,7 @@ impl Venue { &keypair.pubkey(), &self.quote_mint, &self.payer, + None, ) .unwrap(); if underlying > 0 { @@ -310,6 +313,7 @@ impl Venue { &underlying_account, underlying, &self.admin, + None, ) .unwrap(); } @@ -320,6 +324,7 @@ impl Venue { "e_account, quote, &self.admin, + None, ) .unwrap(); } @@ -350,9 +355,14 @@ impl Venue { instruction: Instruction, signer: &Keypair, ) -> Result { - let message = Message::new(&[instruction], Some(&signer.pubkey())); - let mut transaction = Transaction::new_unsigned(message); - transaction.sign(&[signer], self.svm.latest_blockhash()); + let transaction = build_transaction_from_instructions( + &self.svm, + &[instruction], + &[signer], + &signer.pubkey(), + get_transaction_config(MAX_COMPUTE_UNIT_LIMIT), + ) + .unwrap(); self.svm .send_transaction(transaction) .map_err(|failed| format!("{:?}", failed.err)) diff --git a/finance/order-book/anchor-v1/programs/order-book/Cargo.toml b/finance/order-book/anchor-v1/programs/order-book/Cargo.toml index 41b452835..8519f1c81 100644 --- a/finance/order-book/anchor-v1/programs/order-book/Cargo.toml +++ b/finance/order-book/anchor-v1/programs/order-book/Cargo.toml @@ -35,11 +35,12 @@ static_assertions = "1.1" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" -# The depth tests send transactions themselves to read the compute units -# each one used, which solana-kite's helper does not return. Same versions -# solana-kite builds against. -solana-transaction = "4.1.5" +solana-kite = "0.6.0" +# The depth tests build transactions with solana-kite and send them through +# LiteSVM themselves to read the compute units each one used, which +# solana-kite's sender does not return. This crate names the compute unit +# limit those transactions get; same version solana-kite 0.6 builds against. +solana-compute-budget = "4.2" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/finance/order-book/anchor-v1/programs/order-book/tests/test_order_book.rs b/finance/order-book/anchor-v1/programs/order-book/tests/test_order_book.rs index d8c93fd40..0ff044edf 100644 --- a/finance/order-book/anchor-v1/programs/order-book/tests/test_order_book.rs +++ b/finance/order-book/anchor-v1/programs/order-book/tests/test_order_book.rs @@ -23,11 +23,12 @@ use { Discriminator, InstructionData, ToAccountMetas, }, litesvm::LiteSVM, + solana_compute_budget::compute_budget_limits::MAX_COMPUTE_UNIT_LIMIT, solana_keypair::Keypair, solana_kite::{ - create_associated_token_account, create_token_mint, create_wallet, get_sol_balance, - get_token_account_balance, mint_tokens_to_token_account, - send_transaction_from_instructions, + build_transaction_from_instructions, create_associated_token_account, create_token_mint, + create_wallet, get_sol_balance, get_token_account_balance, get_transaction_config, + mint_tokens_to_token_account, send_transaction_from_instructions, }, solana_signer::Signer, }; @@ -173,19 +174,23 @@ fn full_setup() -> Scenario { let buyer = create_wallet(&mut svm, 10_000_000_000).unwrap(); let seller = create_wallet(&mut svm, 10_000_000_000).unwrap(); - let base_mint = create_token_mint(&mut svm, &authority, BASE_DECIMALS, None).unwrap(); - let quote_mint = create_token_mint(&mut svm, &authority, QUOTE_DECIMALS, None).unwrap(); + let base_mint = create_token_mint(&mut svm, &authority, BASE_DECIMALS, None, None).unwrap(); + let quote_mint = create_token_mint(&mut svm, &authority, QUOTE_DECIMALS, None, None).unwrap(); // Create and fund every trader's ATAs up-front so individual tests do // not need to worry about mint/ATA side effects, only about order-book state. let buyer_base_ata = - create_associated_token_account(&mut svm, &buyer.pubkey(), &base_mint, &payer).unwrap(); + create_associated_token_account(&mut svm, &buyer.pubkey(), &base_mint, &payer, None) + .unwrap(); let buyer_quote_ata = - create_associated_token_account(&mut svm, &buyer.pubkey(), "e_mint, &payer).unwrap(); + create_associated_token_account(&mut svm, &buyer.pubkey(), "e_mint, &payer, None) + .unwrap(); let seller_base_ata = - create_associated_token_account(&mut svm, &seller.pubkey(), &base_mint, &payer).unwrap(); + create_associated_token_account(&mut svm, &seller.pubkey(), &base_mint, &payer, None) + .unwrap(); let seller_quote_ata = - create_associated_token_account(&mut svm, &seller.pubkey(), "e_mint, &payer).unwrap(); + create_associated_token_account(&mut svm, &seller.pubkey(), "e_mint, &payer, None) + .unwrap(); mint_tokens_to_token_account( &mut svm, @@ -193,6 +198,7 @@ fn full_setup() -> Scenario { &seller_base_ata, TRADER_STARTING_BALANCE, &authority, + None, ) .unwrap(); mint_tokens_to_token_account( @@ -201,6 +207,7 @@ fn full_setup() -> Scenario { &buyer_quote_ata, TRADER_STARTING_BALANCE, &authority, + None, ) .unwrap(); @@ -537,6 +544,7 @@ fn initialize_market_and_users(sc: &mut Scenario) { vec![create_ix, init_ix], &[&sc.authority, &sc.order_book], &sc.authority.pubkey(), + None, ) .unwrap(); @@ -546,6 +554,7 @@ fn initialize_market_and_users(sc: &mut Scenario) { vec![buyer_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -555,6 +564,7 @@ fn initialize_market_and_users(sc: &mut Scenario) { vec![seller_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); } @@ -581,6 +591,7 @@ fn initialize_market_sets_market_and_order_book() { vec![create_ix, ix], &[&sc.authority, &sc.order_book], &sc.authority.pubkey(), + None, ) .unwrap(); @@ -630,6 +641,7 @@ fn initialize_market_user_tracks_market_and_owner() { vec![create_ix, init_ix], &[&sc.authority, &sc.order_book], &sc.authority.pubkey(), + None, ) .unwrap(); @@ -639,6 +651,7 @@ fn initialize_market_user_tracks_market_and_owner() { vec![create_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -667,8 +680,14 @@ fn place_bid_moves_quote_into_vault() { BID_PRICE, BID_QUANTITY, ); - send_transaction_from_instructions(&mut sc.svm, vec![ix], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![ix], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); // A bid locks price * quantity * quote_lot_size raw quote tokens. let locked_quote = BID_PRICE * BID_QUANTITY * QUOTE_LOT_SIZE; @@ -712,8 +731,14 @@ fn place_ask_moves_base_into_vault() { ASK_PRICE, ASK_QUANTITY, ); - send_transaction_from_instructions(&mut sc.svm, vec![ix], &[&sc.seller], &sc.seller.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![ix], + &[&sc.seller], + &sc.seller.pubkey(), + None, + ) + .unwrap(); // An ask locks quantity * base_lot_size raw base tokens in the base vault. assert_eq!( @@ -779,6 +804,7 @@ fn place_order_rejects_unaligned_tick() { vec![create_ix, init_ix], &[&sc.authority, &sc.order_book], &sc.authority.pubkey(), + None, ) .unwrap(); @@ -788,6 +814,7 @@ fn place_order_rejects_unaligned_tick() { vec![create_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -834,6 +861,7 @@ fn place_order_rejects_below_min_order_size() { vec![create_ix, init_ix], &[&sc.authority, &sc.order_book], &sc.authority.pubkey(), + None, ) .unwrap(); @@ -843,6 +871,7 @@ fn place_order_rejects_below_min_order_size() { vec![create_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -892,6 +921,7 @@ fn cancel_ask_credits_unsettled_base() { vec![place_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -906,6 +936,7 @@ fn cancel_ask_credits_unsettled_base() { vec![cancel_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -946,6 +977,7 @@ fn cancel_order_rejects_non_owner() { vec![place_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -994,6 +1026,7 @@ fn settle_funds_moves_unsettled_base_to_user() { vec![place_ix, cancel_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1009,6 +1042,7 @@ fn settle_funds_moves_unsettled_base_to_user() { vec![settle_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1054,6 +1088,7 @@ fn cancel_and_settle_bid_refunds_full_quote() { vec![place_ix, cancel_ix, settle_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1103,6 +1138,7 @@ fn settle_funds_rejects_fee_vault_substituted_for_quote_vault() { vec![place_ix, cancel_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1337,6 +1373,7 @@ fn taker_bid_fully_crosses_best_ask() { vec![maker_ask_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1359,6 +1396,7 @@ fn taker_bid_fully_crosses_best_ask() { vec![taker_bid_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1414,6 +1452,7 @@ fn taker_ask_fully_crosses_best_bid() { vec![maker_bid_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1435,6 +1474,7 @@ fn taker_ask_fully_crosses_best_bid() { vec![taker_ask_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1480,6 +1520,7 @@ fn taker_partially_fills_resting_order_rest_stays_on_book() { vec![ask_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1496,8 +1537,14 @@ fn taker_partially_fills_resting_order_rest_stays_on_book() { TAKER_BID_QUANTITY, &[(MAKER_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![bid_ix], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![bid_ix], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); // Maker order: still PartiallyFilled, filled_quantity == TAKER_BID_QUANTITY. let maker_order = order_pda(&sc.program_id, &sc.market, MAKER_ASK_ID); @@ -1550,6 +1597,7 @@ fn taker_partially_filled_remainder_rests_on_book() { vec![ask_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1566,8 +1614,14 @@ fn taker_partially_filled_remainder_rests_on_book() { TAKER_BID_QUANTITY, &[(MAKER_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![bid_ix], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![bid_ix], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); // Maker ask is fully filled. let maker_order = order_pda(&sc.program_id, &sc.market, MAKER_ASK_ID); @@ -1630,6 +1684,7 @@ fn taker_crosses_multiple_resting_orders_best_price_first() { vec![ask_one_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); let ask_two_ix = build_place_order_ix( @@ -1648,6 +1703,7 @@ fn taker_crosses_multiple_resting_orders_best_price_first() { vec![ask_two_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1672,6 +1728,7 @@ fn taker_crosses_multiple_resting_orders_best_price_first() { vec![taker_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1722,6 +1779,7 @@ fn resting_orders_at_same_price_fill_by_time_priority() { &second_seller.pubkey(), &sc.base_mint, &sc.payer, + None, ) .unwrap(); let second_seller_quote_ata = create_associated_token_account( @@ -1729,6 +1787,7 @@ fn resting_orders_at_same_price_fill_by_time_priority() { &second_seller.pubkey(), &sc.quote_mint, &sc.payer, + None, ) .unwrap(); mint_tokens_to_token_account( @@ -1737,6 +1796,7 @@ fn resting_orders_at_same_price_fill_by_time_priority() { &second_seller_base_ata, TRADER_STARTING_BALANCE, &sc.authority, + None, ) .unwrap(); let second_seller_market_user = @@ -1747,6 +1807,7 @@ fn resting_orders_at_same_price_fill_by_time_priority() { vec![__ix1], &[&second_seller], &second_seller.pubkey(), + None, ) .unwrap(); @@ -1772,6 +1833,7 @@ fn resting_orders_at_same_price_fill_by_time_priority() { vec![__ix2], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); // Seller 2 second in at the same price. @@ -1791,6 +1853,7 @@ fn resting_orders_at_same_price_fill_by_time_priority() { vec![__ix3], &[&second_seller], &second_seller.pubkey(), + None, ) .unwrap(); @@ -1813,6 +1876,7 @@ fn resting_orders_at_same_price_fill_by_time_priority() { vec![taker_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1858,6 +1922,7 @@ fn taker_bid_gets_price_improvement_from_resting_ask() { vec![__ix4], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1880,6 +1945,7 @@ fn taker_bid_gets_price_improvement_from_resting_ask() { vec![taker_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1932,6 +1998,7 @@ fn fee_rounds_up_when_gross_is_not_a_bps_multiple() { vec![maker_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -1953,6 +2020,7 @@ fn fee_rounds_up_when_gross_is_not_a_bps_multiple() { vec![taker_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .unwrap(); @@ -1994,6 +2062,7 @@ fn fee_vault_receives_exactly_bps_of_taker_gross() { vec![__ix5], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -2010,8 +2079,14 @@ fn fee_vault_receives_exactly_bps_of_taker_gross() { QUANTITY, &[(MAKER_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![__ix6], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![__ix6], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); assert_eq!( get_token_account_balance(&sc.svm, &sc.fee_vault).unwrap(), @@ -2031,6 +2106,7 @@ fn authority_can_withdraw_fees_after_match() { &sc.authority.pubkey(), &sc.quote_mint, &sc.payer, + None, ) .unwrap(); @@ -2056,6 +2132,7 @@ fn authority_can_withdraw_fees_after_match() { vec![__ix7], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -2072,8 +2149,14 @@ fn authority_can_withdraw_fees_after_match() { QUANTITY, &[(MAKER_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![__ix8], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![__ix8], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); assert_eq!( get_token_account_balance(&sc.svm, &sc.fee_vault).unwrap(), @@ -2086,6 +2169,7 @@ fn authority_can_withdraw_fees_after_match() { vec![withdraw_ix], &[&sc.authority], &sc.authority.pubkey(), + None, ) .unwrap(); @@ -2130,6 +2214,7 @@ fn withdraw_fees_rejects_a_non_authority_signer() { vec![ask_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -2146,8 +2231,14 @@ fn withdraw_fees_rejects_a_non_authority_signer() { QUANTITY, &[(MAKER_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![bid_ix], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![bid_ix], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); assert_eq!( get_token_account_balance(&sc.svm, &sc.fee_vault).unwrap(), EXPECTED_FEE @@ -2207,6 +2298,7 @@ fn settle_funds_after_match_pays_out_both_unsettled_balances() { vec![__ix9], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); const TAKER_BID_ID: u64 = 2; @@ -2222,8 +2314,14 @@ fn settle_funds_after_match_pays_out_both_unsettled_balances() { QUANTITY, &[(MAKER_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![__ix10], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![__ix10], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); // Settle both sides. let __ix11 = build_settle_funds_ix( @@ -2233,8 +2331,14 @@ fn settle_funds_after_match_pays_out_both_unsettled_balances() { sc.buyer_base_ata, sc.buyer_quote_ata, ); - send_transaction_from_instructions(&mut sc.svm, vec![__ix11], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![__ix11], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); let __ix12 = build_settle_funds_ix( &sc, &sc.seller.pubkey(), @@ -2247,6 +2351,7 @@ fn settle_funds_after_match_pays_out_both_unsettled_balances() { vec![__ix12], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -2340,12 +2445,14 @@ fn best_ask_depth(svm: &LiteSVM, order_book: &Pubkey) -> usize { // Send one instruction and return the compute units it used. fn send_and_measure(svm: &mut LiteSVM, instruction: Instruction, signer: &Keypair) -> u64 { - let transaction = solana_transaction::Transaction::new_signed_with_payer( + let transaction = build_transaction_from_instructions( + svm, &[instruction], - Some(&signer.pubkey()), &[signer], - svm.latest_blockhash(), - ); + &signer.pubkey(), + get_transaction_config(MAX_COMPUTE_UNIT_LIMIT), + ) + .unwrap(); svm.send_transaction(transaction) .unwrap() .compute_units_consumed @@ -2370,18 +2477,29 @@ fn order_bump_search_units(program_id: &Pubkey, market: &Pubkey, order_id: u64) // A fresh seller with base tokens and a market user account. fn add_funded_seller(sc: &mut Scenario) -> (Keypair, Pubkey, Pubkey, Pubkey) { let seller = create_wallet(&mut sc.svm, 10_000_000_000).unwrap(); - let base_ata = - create_associated_token_account(&mut sc.svm, &seller.pubkey(), &sc.base_mint, &sc.payer) - .unwrap(); - let quote_ata = - create_associated_token_account(&mut sc.svm, &seller.pubkey(), &sc.quote_mint, &sc.payer) - .unwrap(); + let base_ata = create_associated_token_account( + &mut sc.svm, + &seller.pubkey(), + &sc.base_mint, + &sc.payer, + None, + ) + .unwrap(); + let quote_ata = create_associated_token_account( + &mut sc.svm, + &seller.pubkey(), + &sc.quote_mint, + &sc.payer, + None, + ) + .unwrap(); mint_tokens_to_token_account( &mut sc.svm, &sc.base_mint, &base_ata, TRADER_STARTING_BALANCE, &sc.authority, + None, ) .unwrap(); let market_user = market_user_pda(&sc.program_id, &sc.market, &seller.pubkey()); @@ -2391,6 +2509,7 @@ fn add_funded_seller(sc: &mut Scenario) -> (Keypair, Pubkey, Pubkey, Pubkey) { vec![instruction], &[&seller], &seller.pubkey(), + None, ) .unwrap(); (seller, base_ata, quote_ata, market_user) @@ -2439,6 +2558,7 @@ fn run_probes_at_bottom_of_book(build_chain: bool) -> ProbeCosts { vec![instruction], &[&seller], &seller.pubkey(), + None, ) .unwrap(); next_order_id += 1; @@ -2580,7 +2700,7 @@ fn failure_text( payer: &Pubkey, must_fail: &str, ) -> String { - match send_transaction_from_instructions(svm, instructions, signers, payer) { + match send_transaction_from_instructions(svm, instructions, signers, payer, None) { Ok(_) => panic!("{must_fail}"), Err(error) => format!("{error:?}"), } @@ -2605,23 +2725,40 @@ struct Trader { fn create_trader(sc: &mut Scenario) -> Trader { let keypair = create_wallet(&mut sc.svm, 10_000_000_000).unwrap(); - let base_ata = - create_associated_token_account(&mut sc.svm, &keypair.pubkey(), &sc.base_mint, &sc.payer) - .unwrap(); - let quote_ata = - create_associated_token_account(&mut sc.svm, &keypair.pubkey(), &sc.quote_mint, &sc.payer) - .unwrap(); + let base_ata = create_associated_token_account( + &mut sc.svm, + &keypair.pubkey(), + &sc.base_mint, + &sc.payer, + None, + ) + .unwrap(); + let quote_ata = create_associated_token_account( + &mut sc.svm, + &keypair.pubkey(), + &sc.quote_mint, + &sc.payer, + None, + ) + .unwrap(); mint_tokens_to_token_account( &mut sc.svm, &sc.quote_mint, "e_ata, TRADER_STARTING_BALANCE, &sc.authority, + None, ) .unwrap(); let init_ix = build_initialize_market_user_ix(sc, &keypair.pubkey()); - send_transaction_from_instructions(&mut sc.svm, vec![init_ix], &[&keypair], &keypair.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![init_ix], + &[&keypair], + &keypair.pubkey(), + None, + ) + .unwrap(); let market_user = market_user_pda(&sc.program_id, &sc.market, &keypair.pubkey()); Trader { keypair, @@ -2657,6 +2794,7 @@ fn fill_bid_side(sc: &mut Scenario) -> Vec { vec![ix], &[&filler.keypair], &filler.keypair.pubkey(), + None, ) .unwrap_or_else(|error| panic!("bid {order_id} should rest: {error:?}")); } @@ -2688,6 +2826,7 @@ fn place_bid( vec![ix], &[&trader.keypair], &trader.keypair.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -2816,6 +2955,7 @@ fn evicted_maker_settles_their_refund() { vec![settle_ix], &[&evicted.keypair], &evicted.keypair.pubkey(), + None, ) .unwrap(); @@ -2919,6 +3059,7 @@ fn trader_can_evict_their_own_worst_order() { vec![ix], &[&owner.keypair], &owner.keypair.pubkey(), + None, ) .unwrap(); @@ -2984,7 +3125,7 @@ fn send_market_switch( instruction: Instruction, signer: &Keypair, ) -> Result<(), String> { - send_transaction_from_instructions(svm, vec![instruction], &[signer], &signer.pubkey()) + send_transaction_from_instructions(svm, vec![instruction], &[signer], &signer.pubkey(), None) .map_err(|error| format!("{error:?}")) } @@ -3002,8 +3143,14 @@ fn place_pause_ask(sc: &mut Scenario) -> Result<(), String> { PAUSE_PRICE, PAUSE_QUANTITY, ); - send_transaction_from_instructions(&mut sc.svm, vec![ix], &[&sc.seller], &sc.seller.pubkey()) - .map_err(|error| format!("{error:?}")) + send_transaction_from_instructions( + &mut sc.svm, + vec![ix], + &[&sc.seller], + &sc.seller.pubkey(), + None, + ) + .map_err(|error| format!("{error:?}")) } #[test] @@ -3064,6 +3211,7 @@ fn paused_market_still_cancels_and_settles_a_resting_order() { vec![cancel_ix, settle_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); @@ -3092,6 +3240,7 @@ fn paused_market_still_pays_out_fills_and_withdraws_fees() { &sc.authority.pubkey(), &sc.quote_mint, &sc.payer, + None, ) .unwrap(); @@ -3110,8 +3259,14 @@ fn paused_market_still_pays_out_fills_and_withdraws_fees() { PAUSE_QUANTITY, &[(PAUSE_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![bid_ix], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![bid_ix], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); let expected_fee = fee_ceil(PAUSE_GROSS); assert_eq!( get_token_account_balance(&sc.svm, &sc.fee_vault).unwrap(), @@ -3134,6 +3289,7 @@ fn paused_market_still_pays_out_fills_and_withdraws_fees() { vec![settle_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); assert_eq!( @@ -3148,6 +3304,7 @@ fn paused_market_still_pays_out_fills_and_withdraws_fees() { vec![withdraw_ix], &[&sc.authority], &sc.authority.pubkey(), + None, ) .unwrap(); assert_eq!( @@ -3234,6 +3391,7 @@ fn only_the_market_authority_can_pause_or_resume() { vec![bid_ix], &[&sc.buyer], &sc.buyer.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) .expect_err("a paused market must not take an order"); @@ -3281,6 +3439,7 @@ fn transaction_fee(svm: &mut LiteSVM, wallet: &Keypair) -> u64 { vec![system_instruction::transfer(&address, &address, 0)], &[wallet], &address, + None, ) .unwrap(); before - get_sol_balance(svm, &address) @@ -3304,6 +3463,7 @@ fn place_close_ask(sc: &mut Scenario) { vec![ask_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); } @@ -3324,8 +3484,14 @@ fn cross_close_ask(sc: &mut Scenario, quantity: u64) { quantity, &[(CLOSE_ASK_ID, sc.seller_market_user)], ); - send_transaction_from_instructions(&mut sc.svm, vec![bid_ix], &[&sc.buyer], &sc.buyer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut sc.svm, + vec![bid_ix], + &[&sc.buyer], + &sc.buyer.pubkey(), + None, + ) + .unwrap(); } /// The seller cancels their ask, which credits its locked base to their @@ -3338,6 +3504,7 @@ fn cancel_close_ask(sc: &mut Scenario) { vec![cancel_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); } @@ -3356,6 +3523,7 @@ fn settle_seller(sc: &mut Scenario) { vec![settle_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); } @@ -3373,7 +3541,8 @@ fn assert_close_returns_rent( let fee = transaction_fee(svm, owner); let before = get_sol_balance(svm, &owner.pubkey()); - send_transaction_from_instructions(svm, vec![close_ix], &[owner], &owner.pubkey()).unwrap(); + send_transaction_from_instructions(svm, vec![close_ix], &[owner], &owner.pubkey(), None) + .unwrap(); assert!(!account_is_open(svm, account)); assert_eq!(get_sol_balance(svm, &owner.pubkey()), before + rent - fee); @@ -3522,6 +3691,7 @@ fn close_market_user_returns_rent_when_nothing_is_open_or_owed() { vec![reinit_ix], &[&sc.seller], &sc.seller.pubkey(), + None, ) .unwrap(); assert!(account_is_open(&sc.svm, &sc.seller_market_user)); @@ -3625,6 +3795,7 @@ fn evicted_order_and_its_owners_market_user_close_after_settling() { vec![cancel_ix], &[&evicted.keypair], &evicted.keypair.pubkey(), + None, ) .unwrap(); } @@ -3640,6 +3811,7 @@ fn evicted_order_and_its_owners_market_user_close_after_settling() { vec![settle_ix], &[&evicted.keypair], &evicted.keypair.pubkey(), + None, ) .unwrap(); assert_eq!(read_open_order_count(&sc.svm, &evicted.market_user), 0); diff --git a/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/Cargo.toml b/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/Cargo.toml index dd3247f6a..4ec6c758c 100644 --- a/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/Cargo.toml +++ b/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/Cargo.toml @@ -40,7 +40,7 @@ solana-sysvar = "3" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" # The LiteSVM tests load the compiled mock oracle program; depending on the # crate here lets the tests reuse its instruction-argument types and program ID. diff --git a/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/tests/test_perpetual_futures.rs b/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/tests/test_perpetual_futures.rs index b11456879..fddda692c 100644 --- a/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/tests/test_perpetual_futures.rs +++ b/finance/perpetual-futures/anchor-v1/programs/perpetual-futures/tests/test_perpetual_futures.rs @@ -161,7 +161,7 @@ impl Market { let payer = create_wallet(&mut svm, 100_000_000_000).unwrap(); let admin = create_wallet(&mut svm, 100_000_000_000).unwrap(); - let collateral_mint = create_token_mint(&mut svm, &admin, DECIMALS, None).unwrap(); + let collateral_mint = create_token_mint(&mut svm, &admin, DECIMALS, None, None).unwrap(); // Create the mock oracle feed as a fresh account owned by the mock // program; the admin is its update authority. @@ -186,6 +186,7 @@ impl Market { vec![initialize_feed], &[&admin, &feed_keypair], &admin.pubkey(), + None, ) .unwrap(); let feed = feed_keypair.pubkey(); @@ -221,6 +222,7 @@ impl Market { vec![initialize_pool], &[&admin], &admin.pubkey(), + None, ) .map_err(|error| format!("{error:?}"))?; @@ -265,6 +267,7 @@ impl Market { vec![set_price], &[&self.admin], &self.admin.pubkey(), + None, ) .unwrap(); } @@ -327,6 +330,7 @@ impl Market { &liquidator.pubkey(), &self.collateral_mint, &self.payer, + None, ) .unwrap(); (liquidator, liquidator_collateral) @@ -359,6 +363,7 @@ impl Market { &trader.pubkey(), &self.collateral_mint, &self.payer, + None, ) .unwrap(); mint_tokens_to_token_account( @@ -367,6 +372,7 @@ impl Market { &token_account, amount, &self.admin, + None, ) .unwrap(); (trader, token_account) @@ -407,6 +413,7 @@ impl Market { vec![instruction], &[provider], &provider.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -446,6 +453,7 @@ impl Market { vec![instruction], &[provider], &provider.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -500,6 +508,7 @@ impl Market { vec![instruction], &[trader], &trader.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -534,6 +543,7 @@ impl Market { vec![instruction], &[trader], &trader.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -571,6 +581,7 @@ impl Market { vec![instruction], &[liquidator], &liquidator.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -597,6 +608,7 @@ impl Market { vec![instruction], &[authority], &authority.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -617,6 +629,7 @@ impl Market { vec![instruction], &[caller], &caller.pubkey(), + None, ) .map_err(|error| format!("{error:?}")) } @@ -1406,6 +1419,7 @@ fn test_liquidation_of_underwater_long() { &liquidator.pubkey(), &market.collateral_mint, &market.payer, + None, ) .unwrap(); @@ -1441,6 +1455,7 @@ fn test_healthy_position_cannot_be_liquidated() { &liquidator.pubkey(), &market.collateral_mint, &market.payer, + None, ) .unwrap(); @@ -1473,6 +1488,7 @@ fn test_collect_fees() { &admin.pubkey(), &market.collateral_mint, &market.payer, + None, ) .unwrap(); market.collect_fees(&admin).unwrap(); @@ -1512,6 +1528,7 @@ fn test_collect_fees_requires_authority() { &imposter.pubkey(), &market.collateral_mint, &market.payer, + None, ) .unwrap(); // The pool's `has_one = authority` constraint refuses the imposter, so diff --git a/finance/prop-amm/anchor-v1/programs/prop-amm/Cargo.toml b/finance/prop-amm/anchor-v1/programs/prop-amm/Cargo.toml index 24c49330c..2d2bce56f 100644 --- a/finance/prop-amm/anchor-v1/programs/prop-amm/Cargo.toml +++ b/finance/prop-amm/anchor-v1/programs/prop-amm/Cargo.toml @@ -37,7 +37,7 @@ spl-associated-token-account = { version = "8.0.0", features = ["no-entrypoint"] litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" # The LiteSVM tests load the compiled mock oracle program; depending on the # crate here lets the tests reuse its instruction-argument types and program ID. diff --git a/finance/prop-amm/anchor-v1/programs/prop-amm/tests/test_prop_amm.rs b/finance/prop-amm/anchor-v1/programs/prop-amm/tests/test_prop_amm.rs index 808eaa8d2..9fdbc6e6a 100644 --- a/finance/prop-amm/anchor-v1/programs/prop-amm/tests/test_prop_amm.rs +++ b/finance/prop-amm/anchor-v1/programs/prop-amm/tests/test_prop_amm.rs @@ -145,8 +145,8 @@ impl Market { let payer = create_wallet(&mut svm, 100_000_000_000).unwrap(); let operator = create_wallet(&mut svm, 100_000_000_000).unwrap(); - let base_mint = create_token_mint(&mut svm, &operator, NVDAX_DECIMALS, None).unwrap(); - let quote_mint = create_token_mint(&mut svm, &operator, USDC_DECIMALS, None).unwrap(); + let base_mint = create_token_mint(&mut svm, &operator, NVDAX_DECIMALS, None, None).unwrap(); + let quote_mint = create_token_mint(&mut svm, &operator, USDC_DECIMALS, None, None).unwrap(); // Create the mock oracle feed as a fresh account owned by the mock // program; the operator is its update authority. @@ -171,6 +171,7 @@ impl Market { vec![initialize_feed], &[&operator, &feed_keypair], &operator.pubkey(), + None, ) .unwrap(); let feed = feed_keypair.pubkey(); @@ -207,22 +208,29 @@ impl Market { vec![initialize_market], &[&operator], &operator.pubkey(), + None, ) .map_err(|error| format!("{error:?}"))?; // Fund the operator's inventory accounts. let operator_base = - create_associated_token_account(&mut svm, &operator.pubkey(), &base_mint, &payer) - .unwrap(); - let operator_quote = - create_associated_token_account(&mut svm, &operator.pubkey(), "e_mint, &payer) + create_associated_token_account(&mut svm, &operator.pubkey(), &base_mint, &payer, None) .unwrap(); + let operator_quote = create_associated_token_account( + &mut svm, + &operator.pubkey(), + "e_mint, + &payer, + None, + ) + .unwrap(); mint_tokens_to_token_account( &mut svm, &base_mint, &operator_base, 10_000 * ONE_NVDAX, &operator, + None, ) .unwrap(); mint_tokens_to_token_account( @@ -231,6 +239,7 @@ impl Market { &operator_quote, 10_000_000 * ONE_USDC, &operator, + None, ) .unwrap(); @@ -282,6 +291,7 @@ impl Market { vec![set_price], &[&self.operator], &self.operator.pubkey(), + None, ) .unwrap(); } @@ -313,6 +323,7 @@ impl Market { &trader.pubkey(), &self.base_mint, &self.payer, + None, ) .unwrap(); let quote_account = create_associated_token_account( @@ -320,6 +331,7 @@ impl Market { &trader.pubkey(), &self.quote_mint, &self.payer, + None, ) .unwrap(); if base > 0 { @@ -329,6 +341,7 @@ impl Market { &base_account, base, &self.operator, + None, ) .unwrap(); } @@ -339,6 +352,7 @@ impl Market { "e_account, quote, &self.operator, + None, ) .unwrap(); } @@ -404,6 +418,7 @@ impl Market { vec![instruction], &[signer], &signer.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -439,6 +454,7 @@ impl Market { vec![instruction], &[signer], &signer.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -487,6 +503,7 @@ impl Market { vec![instruction], &[trader], &trader.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -523,6 +540,7 @@ impl Market { vec![instruction], &[&payer, signer], &payer.pubkey(), + None, ) .map(|_| ()) .map_err(|error| format!("{error:?}")) @@ -569,6 +587,7 @@ impl Market { vec![transfer], &[sender], &sender.pubkey(), + None, ) .expect("a plain token transfer into a vault should succeed"); } diff --git a/finance/token-swap/anchor-v1/programs/token-swap/Cargo.toml b/finance/token-swap/anchor-v1/programs/token-swap/Cargo.toml index bde1c30bc..e01473b69 100644 --- a/finance/token-swap/anchor-v1/programs/token-swap/Cargo.toml +++ b/finance/token-swap/anchor-v1/programs/token-swap/Cargo.toml @@ -30,7 +30,7 @@ anchor-spl = { version = "1.2.0", features = ["metadata", "spl-token-interface"] litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/finance/token-swap/anchor-v1/programs/token-swap/tests/test_swap.rs b/finance/token-swap/anchor-v1/programs/token-swap/tests/test_swap.rs index d43718f4d..507cb39ae 100644 --- a/finance/token-swap/anchor-v1/programs/token-swap/tests/test_swap.rs +++ b/finance/token-swap/anchor-v1/programs/token-swap/tests/test_swap.rs @@ -68,8 +68,8 @@ fn setup() -> (LiteSVM, Pubkey, Keypair) { /// Ensure mint_a < mint_b by pubkey ordering (the program may require this). fn ordered_mints(svm: &mut LiteSVM, authority: &Keypair, decimals: u8) -> (Pubkey, Pubkey) { loop { - let a = create_token_mint(svm, authority, decimals, None).unwrap(); - let b = create_token_mint(svm, authority, decimals, None).unwrap(); + let a = create_token_mint(svm, authority, decimals, None, None).unwrap(); + let b = create_token_mint(svm, authority, decimals, None, None).unwrap(); if a.as_ref() < b.as_ref() { return (a, b); } @@ -145,14 +145,28 @@ fn setup_config_and_mints() -> TestSetup { // Create ATAs for admin and mint tokens let holder_account_a = - create_associated_token_account(&mut svm, &admin.pubkey(), &mint_a, &payer).unwrap(); + create_associated_token_account(&mut svm, &admin.pubkey(), &mint_a, &payer, None).unwrap(); let holder_account_b = - create_associated_token_account(&mut svm, &admin.pubkey(), &mint_b, &payer).unwrap(); + create_associated_token_account(&mut svm, &admin.pubkey(), &mint_b, &payer, None).unwrap(); - mint_tokens_to_token_account(&mut svm, &mint_a, &holder_account_a, minted_amount, &admin) - .unwrap(); - mint_tokens_to_token_account(&mut svm, &mint_b, &holder_account_b, minted_amount, &admin) - .unwrap(); + mint_tokens_to_token_account( + &mut svm, + &mint_a, + &holder_account_a, + minted_amount, + &admin, + None, + ) + .unwrap(); + mint_tokens_to_token_account( + &mut svm, + &mint_b, + &holder_account_b, + minted_amount, + &admin, + None, + ) + .unwrap(); // Create AMM let initialize_config_ix = Instruction::new_with_bytes( @@ -175,6 +189,7 @@ fn setup_config_and_mints() -> TestSetup { vec![initialize_config_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); @@ -230,6 +245,7 @@ fn send_initialize_pool(ts: &mut TestSetup, amount_a: u64, amount_b: u64) -> Res vec![ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .map(|_| ()) .map_err(|e| format!("{e:?}")) @@ -275,6 +291,7 @@ fn test_initialize_config() { vec![initialize_config_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); @@ -400,13 +417,15 @@ struct Depositor { fn fund_depositor(ts: &mut TestSetup, amount_a: u64, amount_b: u64) -> Depositor { let wallet = create_wallet(&mut ts.svm, 10_000_000_000).unwrap(); let token_a = - create_associated_token_account(&mut ts.svm, &wallet.pubkey(), &ts.mint_a, &ts.payer) + create_associated_token_account(&mut ts.svm, &wallet.pubkey(), &ts.mint_a, &ts.payer, None) .unwrap(); let token_b = - create_associated_token_account(&mut ts.svm, &wallet.pubkey(), &ts.mint_b, &ts.payer) + create_associated_token_account(&mut ts.svm, &wallet.pubkey(), &ts.mint_b, &ts.payer, None) .unwrap(); - mint_tokens_to_token_account(&mut ts.svm, &ts.mint_a, &token_a, amount_a, &ts.admin).unwrap(); - mint_tokens_to_token_account(&mut ts.svm, &ts.mint_b, &token_b, amount_b, &ts.admin).unwrap(); + mint_tokens_to_token_account(&mut ts.svm, &ts.mint_a, &token_a, amount_a, &ts.admin, None) + .unwrap(); + mint_tokens_to_token_account(&mut ts.svm, &ts.mint_b, &token_b, amount_b, &ts.admin, None) + .unwrap(); let lp_token = derive_ata(&wallet.pubkey(), &ts.liquidity_provider_mint); Depositor { wallet, @@ -455,6 +474,7 @@ fn send_deposit_from( vec![ix], &[&ts.payer, &depositor.wallet], &ts.payer.pubkey(), + None, ) .map(|_| ()) .map_err(|e| format!("{e:?}")) @@ -485,6 +505,7 @@ fn test_pool_creation_cannot_be_front_run() { &ts.holder_account_a, 300 * one, &ts.admin, + None, ) .unwrap(); mint_tokens_to_token_account( @@ -493,6 +514,7 @@ fn test_pool_creation_cannot_be_front_run() { &ts.holder_account_b, 800 * one, &ts.admin, + None, ) .unwrap(); send_initialize_pool(&mut ts, 400 * one, 900 * one).expect("Maria opens the pool"); @@ -548,6 +570,7 @@ fn test_pool_creation_cannot_be_front_run() { &mallory.token_b, 100 * one, &ts.admin, + None, ) .unwrap(); assert_error_code( @@ -594,6 +617,7 @@ fn test_swap_a_to_b() { vec![swap_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .unwrap(); @@ -647,6 +671,7 @@ fn test_withdraw_liquidity() { vec![withdraw_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .unwrap(); @@ -708,6 +733,7 @@ fn swap_a_to_b(ts: &mut TestSetup, input_amount: u64) { vec![swap_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .unwrap(); } @@ -738,6 +764,7 @@ fn test_claim_admin_fees() { vec![claim_ix_first], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .unwrap(); @@ -779,6 +806,7 @@ fn test_claim_admin_fees() { vec![claim_ix_second], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .unwrap(); @@ -818,6 +846,7 @@ fn test_claim_admin_fees() { vec![claim_ix_again], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ); assert_error_code(result, "NothingToClaim"); @@ -839,12 +868,22 @@ fn test_claim_admin_fees_rejects_non_admin() { // Create a non-admin actor with their own ATAs and try to claim. let attacker = create_wallet(&mut ts.svm, 100_000_000_000).unwrap(); - let attacker_token_a = - create_associated_token_account(&mut ts.svm, &attacker.pubkey(), &ts.mint_a, &ts.payer) - .unwrap(); - let attacker_token_b = - create_associated_token_account(&mut ts.svm, &attacker.pubkey(), &ts.mint_b, &ts.payer) - .unwrap(); + let attacker_token_a = create_associated_token_account( + &mut ts.svm, + &attacker.pubkey(), + &ts.mint_a, + &ts.payer, + None, + ) + .unwrap(); + let attacker_token_b = create_associated_token_account( + &mut ts.svm, + &attacker.pubkey(), + &ts.mint_b, + &ts.payer, + None, + ) + .unwrap(); let claim_ix = Instruction::new_with_bytes( ts.program_id, @@ -871,6 +910,7 @@ fn test_claim_admin_fees_rejects_non_admin() { vec![claim_ix], &[&ts.payer, &attacker], &ts.payer.pubkey(), + None, ); assert_error_code(result, "ConstraintHasOne"); } @@ -921,6 +961,7 @@ fn send_deposit(ts: &mut TestSetup, amount_a: u64, amount_b: u64) -> Result<(), vec![ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .map(|_| ()) .map_err(|e| format!("{e:?}")) @@ -1077,6 +1118,7 @@ fn test_deposit_after_swap_uses_shifted_effective_ratio() { vec![swap_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("swap a→b"); @@ -1196,6 +1238,7 @@ fn test_lp_mint_proportional_to_share_of_pool() { vec![withdraw], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("withdraw the second deposit's LP"); let pool_a_after = get_token_account_balance(&ts.svm, &ts.pool_a).unwrap(); @@ -1285,8 +1328,24 @@ fn test_donation_cannot_round_a_later_deposit_to_zero() { // The donation: tokens sent straight to the vaults, no LP minted. let donation: u64 = 1_000_000; - mint_tokens_to_token_account(&mut ts.svm, &ts.mint_a, &ts.pool_a, donation, &ts.admin).unwrap(); - mint_tokens_to_token_account(&mut ts.svm, &ts.mint_b, &ts.pool_b, donation, &ts.admin).unwrap(); + mint_tokens_to_token_account( + &mut ts.svm, + &ts.mint_a, + &ts.pool_a, + donation, + &ts.admin, + None, + ) + .unwrap(); + mint_tokens_to_token_account( + &mut ts.svm, + &ts.mint_b, + &ts.pool_b, + donation, + &ts.admin, + None, + ) + .unwrap(); // The victim deposits exactly as much as was donated. Dividing by the // bare supply of 1 would mint 1_000_000 * 1 / 1_000_101 = 0 LP tokens. @@ -1309,6 +1368,7 @@ fn test_donation_cannot_round_a_later_deposit_to_zero() { vec![attacker_exit], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("attacker withdraws"); let attacker_a_back = @@ -1337,6 +1397,7 @@ fn test_deposit_after_every_lp_token_is_burned() { vec![withdraw_all], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("withdraw everything"); assert_eq!(get_token_account_balance(&ts.svm, &ts.pool_a).unwrap(), 100); @@ -1470,6 +1531,7 @@ fn test_swap_reverts_when_output_below_min() { vec![baseline_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("baseline swap should succeed"); let after_b = get_token_account_balance(&ts.svm, &ts.holder_account_b).unwrap(); @@ -1487,6 +1549,7 @@ fn test_swap_reverts_when_output_below_min() { vec![strict_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ); assert_error_code(result, "SlippageExceeded"); } @@ -1518,6 +1581,7 @@ fn test_deposit_reverts_when_lp_below_min() { vec![strict_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ); assert_error_code(result, "DepositBelowMinimum"); @@ -1528,6 +1592,7 @@ fn test_deposit_reverts_when_lp_below_min() { vec![ok_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("deposit at exact LP floor should succeed"); } @@ -1549,6 +1614,7 @@ fn test_withdraw_reverts_when_below_min() { vec![strict_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ); assert_error_code(result, "WithdrawalBelowMinimum"); @@ -1559,6 +1625,7 @@ fn test_withdraw_reverts_when_below_min() { vec![strict_ix_b], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ); assert_error_code(result_b, "WithdrawalBelowMinimum"); } @@ -1577,6 +1644,7 @@ fn test_swap_with_zero_min_output_still_succeeds() { vec![ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("swap with min_output_amount=0 must succeed"); let after_b = get_token_account_balance(&ts.svm, &ts.holder_account_b).unwrap(); @@ -1635,6 +1703,7 @@ fn test_swap_b_to_a_trader_pays_full_input() { vec![swap_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("B→A swap should succeed"); @@ -1682,6 +1751,7 @@ fn test_invariant_holds_after_b_to_a_swap() { vec![swap_ix], &[&ts.payer, &ts.admin], &ts.payer.pubkey(), + None, ) .expect("B→A swap should succeed"); diff --git a/tokens/create-token/anchor-v1/programs/create-token/Cargo.toml b/tokens/create-token/anchor-v1/programs/create-token/Cargo.toml index 63f729b3d..699667e08 100644 --- a/tokens/create-token/anchor-v1/programs/create-token/Cargo.toml +++ b/tokens/create-token/anchor-v1/programs/create-token/Cargo.toml @@ -28,7 +28,7 @@ anchor-spl = { version = "1.2.0", features = ["metadata"] } litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/tokens/create-token/anchor-v1/programs/create-token/tests/test_create_token.rs b/tokens/create-token/anchor-v1/programs/create-token/tests/test_create_token.rs index 4f393daa9..ada4a578b 100644 --- a/tokens/create-token/anchor-v1/programs/create-token/tests/test_create_token.rs +++ b/tokens/create-token/anchor-v1/programs/create-token/tests/test_create_token.rs @@ -83,6 +83,7 @@ fn test_create_spl_token() { vec![instruction], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -137,6 +138,7 @@ fn test_create_nft() { vec![instruction], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); diff --git a/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/Cargo.toml b/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/Cargo.toml index e728e1082..7d7296754 100644 --- a/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/Cargo.toml +++ b/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/Cargo.toml @@ -32,7 +32,7 @@ libsecp256k1 = "0.7.2" litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/tests/test_external_delegate.rs b/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/tests/test_external_delegate.rs index 900aa1af6..67f363653 100644 --- a/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/tests/test_external_delegate.rs +++ b/tokens/external-delegate-token-master/anchor-v1/programs/external-delegate-token-master/tests/test_external_delegate.rs @@ -123,6 +123,7 @@ fn initialize_user_account( vec![init_instruction], &[authority, user_account], &authority.pubkey(), + None, ) .unwrap(); } @@ -149,6 +150,7 @@ fn set_ethereum_address( vec![set_address_instruction], &[authority], &authority.pubkey(), + None, ) .unwrap(); } @@ -183,21 +185,23 @@ fn setup_transfer_fixture() -> TransferFixture { let (user_pda, _bump) = Pubkey::find_program_address(&[user_account.as_ref()], &program_id); - let mint = create_token_mint(&mut svm, &authority, MINT_DECIMALS, None).unwrap(); + let mint = create_token_mint(&mut svm, &authority, MINT_DECIMALS, None, None).unwrap(); let user_pda_token_account = - create_associated_token_account(&mut svm, &user_pda, &mint, &authority).unwrap(); + create_associated_token_account(&mut svm, &user_pda, &mint, &authority, None).unwrap(); mint_tokens_to_token_account( &mut svm, &mint, &user_pda_token_account, MINT_AMOUNT, &authority, + None, ) .unwrap(); let recipient = Keypair::new(); let recipient_token_account = - create_associated_token_account(&mut svm, &recipient.pubkey(), &mint, &authority).unwrap(); + create_associated_token_account(&mut svm, &recipient.pubkey(), &mint, &authority, None) + .unwrap(); TransferFixture { svm, @@ -291,6 +295,7 @@ fn test_transfer_tokens_with_valid_signature_moves_tokens_and_increments_nonce() vec![transfer_instruction], &[&fixture.authority], &authority_pubkey, + None, ) .unwrap(); @@ -334,6 +339,7 @@ fn test_transfer_tokens_replayed_signature_fails() { vec![transfer_instruction.clone()], &[&fixture.authority], &authority_pubkey, + None, ) .unwrap(); @@ -345,6 +351,7 @@ fn test_transfer_tokens_replayed_signature_fails() { vec![transfer_instruction], &[&fixture.authority], &authority_pubkey, + None, ); assert!( replay_result.is_err(), @@ -390,6 +397,7 @@ fn test_transfer_tokens_signature_over_different_amount_fails() { vec![transfer_instruction], &[&fixture.authority], &authority_pubkey, + None, ); assert!( result.is_err(), @@ -417,6 +425,7 @@ fn test_transfer_tokens_signature_over_different_recipient_fails() { &attacker.pubkey(), &fixture.mint, &fixture.authority, + None, ) .unwrap(); @@ -442,6 +451,7 @@ fn test_transfer_tokens_signature_over_different_recipient_fails() { vec![transfer_instruction], &[&fixture.authority], &authority_pubkey, + None, ); assert!( result.is_err(), @@ -482,6 +492,7 @@ fn test_transfer_tokens_wrong_solana_authority_fails() { vec![transfer_instruction], &[&mallory], &mallory_pubkey, + None, ); assert!( result.is_err(), @@ -520,6 +531,7 @@ fn test_authority_transfer() { vec![authority_transfer_instruction], &[&fixture.authority], &fixture.authority.pubkey(), + None, ) .unwrap(); diff --git a/tokens/nft-minter/anchor-v1/programs/nft-minter/Cargo.toml b/tokens/nft-minter/anchor-v1/programs/nft-minter/Cargo.toml index 677346833..23e13dcf1 100644 --- a/tokens/nft-minter/anchor-v1/programs/nft-minter/Cargo.toml +++ b/tokens/nft-minter/anchor-v1/programs/nft-minter/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = { version = "1.2.0", features = ["metadata"] } litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/tokens/nft-minter/anchor-v1/programs/nft-minter/tests/test_nft_minter.rs b/tokens/nft-minter/anchor-v1/programs/nft-minter/tests/test_nft_minter.rs index 9dabc4c89..c39968123 100644 --- a/tokens/nft-minter/anchor-v1/programs/nft-minter/tests/test_nft_minter.rs +++ b/tokens/nft-minter/anchor-v1/programs/nft-minter/tests/test_nft_minter.rs @@ -116,6 +116,7 @@ fn test_mint_nft() { vec![instruction], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); diff --git a/tokens/nft-operations/anchor-v1/programs/mint-nft/Cargo.toml b/tokens/nft-operations/anchor-v1/programs/mint-nft/Cargo.toml index 37dd9b203..d03e0e104 100644 --- a/tokens/nft-operations/anchor-v1/programs/mint-nft/Cargo.toml +++ b/tokens/nft-operations/anchor-v1/programs/mint-nft/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = { version = "1.2.0", features = ["metadata"] } litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/tokens/nft-operations/anchor-v1/programs/mint-nft/tests/test_nft_operations.rs b/tokens/nft-operations/anchor-v1/programs/mint-nft/tests/test_nft_operations.rs index 249860449..363481fb1 100644 --- a/tokens/nft-operations/anchor-v1/programs/mint-nft/tests/test_nft_operations.rs +++ b/tokens/nft-operations/anchor-v1/programs/mint-nft/tests/test_nft_operations.rs @@ -127,6 +127,7 @@ fn test_create_collection() { vec![instruction], &[&payer, &collection_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -195,6 +196,7 @@ fn test_mint_nft_to_collection() { vec![create_collection_ix], &[&payer, &collection_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -234,6 +236,7 @@ fn test_mint_nft_to_collection() { vec![mint_nft_ix], &[&payer, &nft_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -292,6 +295,7 @@ fn test_verify_collection() { vec![create_collection_ix], &[&payer, &collection_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -331,6 +335,7 @@ fn test_verify_collection() { vec![mint_nft_ix], &[&payer, &nft_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -354,7 +359,7 @@ fn test_verify_collection() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![verify_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![verify_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify the metadata still exists after verification diff --git a/tokens/pda-mint-authority/anchor-v1/programs/token-minter/Cargo.toml b/tokens/pda-mint-authority/anchor-v1/programs/token-minter/Cargo.toml index 80ee1de4d..d1d28f4c8 100644 --- a/tokens/pda-mint-authority/anchor-v1/programs/token-minter/Cargo.toml +++ b/tokens/pda-mint-authority/anchor-v1/programs/token-minter/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = { version = "1.2.0", features = ["metadata"] } litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/tokens/pda-mint-authority/anchor-v1/programs/token-minter/tests/test_pda_mint.rs b/tokens/pda-mint-authority/anchor-v1/programs/token-minter/tests/test_pda_mint.rs index 4503a8385..6afb6c67b 100644 --- a/tokens/pda-mint-authority/anchor-v1/programs/token-minter/tests/test_pda_mint.rs +++ b/tokens/pda-mint-authority/anchor-v1/programs/token-minter/tests/test_pda_mint.rs @@ -103,7 +103,7 @@ fn test_create_token_and_mint() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![create_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![create_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify mint created @@ -136,7 +136,7 @@ fn test_create_token_and_mint() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![mint_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![mint_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify 100 tokens minted (in minor units) diff --git a/tokens/token-extensions/basics/anchor-v1/programs/basics/Cargo.toml b/tokens/token-extensions/basics/anchor-v1/programs/basics/Cargo.toml index 4d1dc1e3e..6fbc328f5 100644 --- a/tokens/token-extensions/basics/anchor-v1/programs/basics/Cargo.toml +++ b/tokens/token-extensions/basics/anchor-v1/programs/basics/Cargo.toml @@ -25,7 +25,7 @@ anchor-lang = { version = "1.2.0", features= ["init-if-needed"]} [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/basics/anchor-v1/programs/basics/tests/test_basics.rs b/tokens/token-extensions/basics/anchor-v1/programs/basics/tests/test_basics.rs index 3ad62418b..292d301cf 100644 --- a/tokens/token-extensions/basics/anchor-v1/programs/basics/tests/test_basics.rs +++ b/tokens/token-extensions/basics/anchor-v1/programs/basics/tests/test_basics.rs @@ -61,8 +61,14 @@ fn test_create_token_and_mint_and_transfer() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![create_token_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![create_token_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify mint account exists let mint_account = svm.get_account(&mint).expect("Mint account should exist"); @@ -87,8 +93,14 @@ fn test_create_token_and_mint_and_transfer() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![create_ata_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![create_ata_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify ATA exists let ata_account = svm.get_account(&payer_ata).expect("Payer ATA should exist"); @@ -114,8 +126,14 @@ fn test_create_token_and_mint_and_transfer() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![mint_token_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![mint_token_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); assert_token_account_balance( &svm, @@ -151,8 +169,14 @@ fn test_create_token_and_mint_and_transfer() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![transfer_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![transfer_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); assert_token_account_balance( &svm, diff --git a/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/Cargo.toml b/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/Cargo.toml index 727b37608..a2a3408a7 100644 --- a/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/Cargo.toml +++ b/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/Cargo.toml @@ -25,7 +25,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/tests/test_cpi_guard.rs b/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/tests/test_cpi_guard.rs index 28a46ccf3..f5117dda2 100644 --- a/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/tests/test_cpi_guard.rs +++ b/tokens/token-extensions/cpi-guard/anchor-v1/programs/cpi-guard/tests/test_cpi_guard.rs @@ -115,7 +115,7 @@ fn test_cpi_guard_prevents_transfer_then_allows_after_disable() { let token_keypair = Keypair::new(); // Step 1: Create a Token Extensions mint (no extensions needed on the mint itself) - let mint = create_token_extensions_mint(&mut svm, &payer, 2, None, &[]).unwrap(); + let mint = create_token_extensions_mint(&mut svm, &payer, 2, None, &[], None).unwrap(); svm.expire_blockhash(); // Step 2: Create basic token account (needs explicit keypair for reallocate flow) @@ -130,6 +130,7 @@ fn test_cpi_guard_prevents_transfer_then_allows_after_disable() { token_ixs, &[&payer, &token_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -142,19 +143,32 @@ fn test_cpi_guard_prevents_transfer_then_allows_after_disable() { &payer.pubkey(), &[cpi_guard_extension_type], ); - send_transaction_from_instructions(&mut svm, vec![reallocate_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![reallocate_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 4: Enable CPI Guard let enable_ix = enable_cpi_guard_instruction(&token_keypair.pubkey(), &payer.pubkey()); - send_transaction_from_instructions(&mut svm, vec![enable_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![enable_ix], &[&payer], &payer.pubkey(), None) .unwrap(); svm.expire_blockhash(); // Step 5: Mint 1 token to the token account - mint_tokens_to_token_extensions_account(&mut svm, &mint, &token_keypair.pubkey(), 1, &payer) - .unwrap(); + mint_tokens_to_token_extensions_account( + &mut svm, + &mint, + &token_keypair.pubkey(), + 1, + &payer, + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 6: Try CPI transfer - should fail because CPI Guard is enabled @@ -174,8 +188,13 @@ fn test_cpi_guard_prevents_transfer_then_allows_after_disable() { .to_account_metas(None), ); - let result = - send_transaction_from_instructions(&mut svm, vec![transfer_ix], &[&payer], &payer.pubkey()); + let result = send_transaction_from_instructions( + &mut svm, + vec![transfer_ix], + &[&payer], + &payer.pubkey(), + None, + ); assert!( result.is_err(), "Transfer should fail when CPI Guard is enabled" @@ -184,8 +203,14 @@ fn test_cpi_guard_prevents_transfer_then_allows_after_disable() { // Step 7: Disable CPI Guard let disable_ix = disable_cpi_guard_instruction(&token_keypair.pubkey(), &payer.pubkey()); - send_transaction_from_instructions(&mut svm, vec![disable_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![disable_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 8: Transfer should now succeed @@ -203,8 +228,14 @@ fn test_cpi_guard_prevents_transfer_then_allows_after_disable() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![transfer_ix2], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![transfer_ix2], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); assert_token_account_balance( &svm, diff --git a/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/Cargo.toml b/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/Cargo.toml index a96ab9c3a..463e15e6a 100644 --- a/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/Cargo.toml +++ b/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/Cargo.toml @@ -25,7 +25,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/tests/test_default_account_state.rs b/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/tests/test_default_account_state.rs index 72265cf5c..34359e9e5 100644 --- a/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/tests/test_default_account_state.rs +++ b/tokens/token-extensions/default-account-state/anchor-v1/programs/default-account-state/tests/test_default_account_state.rs @@ -80,6 +80,7 @@ fn test_default_account_state() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -101,6 +102,7 @@ fn test_default_account_state() { create_token1_ixs, &[&payer, &token1], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -119,6 +121,7 @@ fn test_default_account_state() { &token1.pubkey(), 1, &payer, + None, ); assert!(result.is_err(), "Minting to a frozen account should fail"); svm.expire_blockhash(); @@ -138,7 +141,7 @@ fn test_default_account_state() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![update_ix], &[&payer], &payer.pubkey(), None) .unwrap(); svm.expire_blockhash(); @@ -155,6 +158,7 @@ fn test_default_account_state() { create_token2_ixs, &[&payer, &token2], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -173,6 +177,7 @@ fn test_default_account_state() { &token2.pubkey(), 1, &payer, + None, ) .unwrap(); diff --git a/tokens/token-extensions/group/anchor-v1/programs/group/Cargo.toml b/tokens/token-extensions/group/anchor-v1/programs/group/Cargo.toml index f92fc3e15..8e8be6c17 100644 --- a/tokens/token-extensions/group/anchor-v1/programs/group/Cargo.toml +++ b/tokens/token-extensions/group/anchor-v1/programs/group/Cargo.toml @@ -25,7 +25,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/group/anchor-v1/programs/group/tests/test_group.rs b/tokens/token-extensions/group/anchor-v1/programs/group/tests/test_group.rs index 114d7a443..e675c312e 100644 --- a/tokens/token-extensions/group/anchor-v1/programs/group/tests/test_group.rs +++ b/tokens/token-extensions/group/anchor-v1/programs/group/tests/test_group.rs @@ -36,8 +36,14 @@ fn test_initialize_group() { .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![instruction], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![instruction], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify mint was created with group pointer extension let mint_data = svm diff --git a/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/Cargo.toml b/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/Cargo.toml index 99cd6d7b1..a398f45b1 100644 --- a/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/Cargo.toml +++ b/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/Cargo.toml @@ -25,7 +25,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/tests/test_immutable_owner.rs b/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/tests/test_immutable_owner.rs index dd5ad978c..301f36a57 100644 --- a/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/tests/test_immutable_owner.rs +++ b/tokens/token-extensions/immutable-owner/anchor-v1/programs/immutable-owner/tests/test_immutable_owner.rs @@ -61,7 +61,7 @@ fn test_create_token_account_with_immutable_owner() { let token_keypair = Keypair::new(); // Step 1: Create a Token Extensions mint with 2 decimals (no extensions needed on mint) - let mint = create_token_extensions_mint(&mut svm, &payer, 2, None, &[]).unwrap(); + let mint = create_token_extensions_mint(&mut svm, &payer, 2, None, &[], None).unwrap(); svm.expire_blockhash(); // Step 2: Call program to create token account with ImmutableOwner extension @@ -82,6 +82,7 @@ fn test_create_token_account_with_immutable_owner() { vec![initialize_ix], &[&payer, &token_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -109,6 +110,7 @@ fn test_create_token_account_with_immutable_owner() { vec![set_authority_ix], &[&payer], &payer.pubkey(), + None, ); assert!( result.is_err(), diff --git a/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/Cargo.toml b/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/Cargo.toml index cd239276b..1c8374fd6 100644 --- a/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/Cargo.toml +++ b/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/Cargo.toml @@ -26,7 +26,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/tests/test_interest_bearing.rs b/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/tests/test_interest_bearing.rs index 59fee9f80..63013f92d 100644 --- a/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/tests/test_interest_bearing.rs +++ b/tokens/token-extensions/interest-bearing/anchor-v1/programs/interest-bearing/tests/test_interest_bearing.rs @@ -45,6 +45,7 @@ fn test_initialize_and_update_rate() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -68,8 +69,14 @@ fn test_initialize_and_update_rate() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![update_rate_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![update_rate_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify mint still exists after rate update let mint_account = svm diff --git a/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/Cargo.toml b/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/Cargo.toml index b1c82c0a3..aaf413bcd 100644 --- a/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/Cargo.toml +++ b/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/Cargo.toml @@ -25,7 +25,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/tests/test_memo_transfer.rs b/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/tests/test_memo_transfer.rs index c611a9da1..69a38f8c0 100644 --- a/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/tests/test_memo_transfer.rs +++ b/tokens/token-extensions/memo-transfer/anchor-v1/programs/memo-transfer/tests/test_memo_transfer.rs @@ -112,7 +112,7 @@ fn test_memo_transfer() { let token_keypair = Keypair::new(); // Step 1: Create a standard Token Extensions mint (no extensions on the mint) - let mint = create_token_extensions_mint(&mut svm, &payer, 2, None, &[]).unwrap(); + let mint = create_token_extensions_mint(&mut svm, &payer, 2, None, &[], None).unwrap(); svm.expire_blockhash(); // Step 2: Create token account with RequiredMemo extension via program @@ -133,6 +133,7 @@ fn test_memo_transfer() { vec![initialize_ix], &[&payer, &token_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -160,12 +161,20 @@ fn test_memo_transfer() { create_source_ixs, &[&payer, &source_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); - mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_keypair.pubkey(), 100, &payer) - .unwrap(); + mint_tokens_to_token_extensions_account( + &mut svm, + &mint, + &source_keypair.pubkey(), + 100, + &payer, + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 4: Transfer without memo - should fail @@ -175,8 +184,13 @@ fn test_memo_transfer() { &payer.pubkey(), 1, ); - let result = - send_transaction_from_instructions(&mut svm, vec![transfer_ix], &[&payer], &payer.pubkey()); + let result = send_transaction_from_instructions( + &mut svm, + vec![transfer_ix], + &[&payer], + &payer.pubkey(), + None, + ); assert!(result.is_err(), "Transfer without memo should fail"); svm.expire_blockhash(); @@ -193,6 +207,7 @@ fn test_memo_transfer() { vec![memo_ix, transfer_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -215,8 +230,14 @@ fn test_memo_transfer() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![disable_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![disable_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 7: Transfer without memo should now succeed (memo disabled) @@ -232,6 +253,7 @@ fn test_memo_transfer() { create_source2_ixs, &[&payer, &source2_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -242,6 +264,7 @@ fn test_memo_transfer() { &source2_keypair.pubkey(), 100, &payer, + None, ) .unwrap(); svm.expire_blockhash(); @@ -252,8 +275,14 @@ fn test_memo_transfer() { &payer.pubkey(), 1, ); - send_transaction_from_instructions(&mut svm, vec![transfer_ix2], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![transfer_ix2], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); assert_token_account_balance( &svm, diff --git a/tokens/token-extensions/metadata/anchor-v1/programs/metadata/Cargo.toml b/tokens/token-extensions/metadata/anchor-v1/programs/metadata/Cargo.toml index 54a310ede..f7aebdecd 100644 --- a/tokens/token-extensions/metadata/anchor-v1/programs/metadata/Cargo.toml +++ b/tokens/token-extensions/metadata/anchor-v1/programs/metadata/Cargo.toml @@ -27,7 +27,7 @@ spl-type-length-value = "0.9.1" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/metadata/anchor-v1/programs/metadata/tests/test_metadata.rs b/tokens/token-extensions/metadata/anchor-v1/programs/metadata/tests/test_metadata.rs index 8439e9d3c..ac301ccfe 100644 --- a/tokens/token-extensions/metadata/anchor-v1/programs/metadata/tests/test_metadata.rs +++ b/tokens/token-extensions/metadata/anchor-v1/programs/metadata/tests/test_metadata.rs @@ -52,6 +52,7 @@ fn test_metadata_full_flow() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -81,8 +82,14 @@ fn test_metadata_full_flow() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![update_name_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![update_name_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 3: Add custom field @@ -108,6 +115,7 @@ fn test_metadata_full_flow() { vec![add_custom_field_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -127,8 +135,14 @@ fn test_metadata_full_flow() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![remove_key_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![remove_key_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 5: Update authority to None @@ -149,6 +163,7 @@ fn test_metadata_full_flow() { vec![update_authority_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -163,7 +178,7 @@ fn test_metadata_full_flow() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![emit_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![emit_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify mint still exists after all operations diff --git a/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/Cargo.toml b/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/Cargo.toml index e88db0c2b..f3eea6484 100644 --- a/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/Cargo.toml +++ b/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/Cargo.toml @@ -22,7 +22,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/tests/test_mint_close_authority.rs b/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/tests/test_mint_close_authority.rs index 81e724d01..3b0b801fc 100644 --- a/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/tests/test_mint_close_authority.rs +++ b/tokens/token-extensions/mint-close-authority/anchor-v1/programs/mint-close-authority/tests/test_mint_close_authority.rs @@ -45,6 +45,7 @@ fn test_create_and_close_mint() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -67,7 +68,7 @@ fn test_create_and_close_mint() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![close_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![close_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify mint no longer exists (lamports returned to authority) @@ -93,6 +94,7 @@ fn test_create_and_close_mint() { vec![initialize_ix2], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -123,8 +125,14 @@ fn test_create_and_close_mint() { ], data: vec![9], // CloseAccount }; - send_transaction_from_instructions(&mut svm, vec![close_direct_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![close_direct_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify mint is closed again let mint_account = svm.get_account(&mint_keypair.pubkey()); diff --git a/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/Cargo.toml b/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/Cargo.toml index 72af552c9..80e0fc185 100644 --- a/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/Cargo.toml +++ b/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/Cargo.toml @@ -43,7 +43,7 @@ solana-keypair = "3.0.1" solana-signer = "3.0.0" solana-instruction = "3.0.0" solana-pubkey = "3.0.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } diff --git a/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/tests/test_extension_nft.rs b/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/tests/test_extension_nft.rs index ef982a143..9f2ef9df9 100644 --- a/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/tests/test_extension_nft.rs +++ b/tokens/token-extensions/nft-meta-data-pointer/anchor-example/anchor-v1/programs/extension_nft/tests/test_extension_nft.rs @@ -169,6 +169,7 @@ fn test_init_player_mint_and_chop() { vec![init_player_ix(&program_id, &signer)], &[&payer], &signer, + None, ) .expect("init_player should succeed"); @@ -188,6 +189,7 @@ fn test_init_player_mint_and_chop() { vec![mint_nft_ix(&program_id, &signer, &mint.pubkey())], &[&payer, &mint], &signer, + None, ) .expect("mint_nft should succeed"); @@ -219,6 +221,7 @@ fn test_init_player_mint_and_chop() { vec![chop_tree_ix(&program_id, &signer, &mint.pubkey(), 1)], &[&payer], &signer, + None, ) .expect("chop_tree should succeed"); diff --git a/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/Cargo.toml b/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/Cargo.toml index eedc94848..4f92bf905 100644 --- a/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/Cargo.toml +++ b/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/Cargo.toml @@ -22,7 +22,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/tests/test_non_transferable.rs b/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/tests/test_non_transferable.rs index 3a67f7412..42a1b401a 100644 --- a/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/tests/test_non_transferable.rs +++ b/tokens/token-extensions/non-transferable/anchor-v1/programs/non-transferable/tests/test_non_transferable.rs @@ -49,6 +49,7 @@ fn test_create_non_transferable_mint_and_attempt_transfer() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -65,9 +66,14 @@ fn test_create_non_transferable_mint_and_attempt_transfer() { // Step 2: Create ATAs for sender and recipient let recipient = Keypair::new(); - let source_ata = - create_token_extensions_account(&mut svm, &payer.pubkey(), &mint_keypair.pubkey(), &payer) - .unwrap(); + let source_ata = create_token_extensions_account( + &mut svm, + &payer.pubkey(), + &mint_keypair.pubkey(), + &payer, + None, + ) + .unwrap(); svm.expire_blockhash(); let dest_ata = create_token_extensions_account( @@ -75,6 +81,7 @@ fn test_create_non_transferable_mint_and_attempt_transfer() { &recipient.pubkey(), &mint_keypair.pubkey(), &payer, + None, ) .unwrap(); svm.expire_blockhash(); @@ -86,6 +93,7 @@ fn test_create_non_transferable_mint_and_attempt_transfer() { &source_ata, 1, &payer, + None, ) .unwrap(); svm.expire_blockhash(); @@ -100,6 +108,7 @@ fn test_create_non_transferable_mint_and_attempt_transfer() { 1, 2, // decimals &[], + None, ); assert!( result.is_err(), diff --git a/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/Cargo.toml b/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/Cargo.toml index 0363c3390..7f3c16923 100644 --- a/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/Cargo.toml +++ b/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/Cargo.toml @@ -26,7 +26,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/tests/test_permanent_delegate.rs b/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/tests/test_permanent_delegate.rs index 20d0f8acb..3b427655a 100644 --- a/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/tests/test_permanent_delegate.rs +++ b/tokens/token-extensions/permanent-delegate/anchor-v1/programs/permanent-delegate/tests/test_permanent_delegate.rs @@ -102,6 +102,7 @@ fn test_create_mint_with_permanent_delegate_and_burn() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -120,6 +121,7 @@ fn test_create_mint_with_permanent_delegate_and_burn() { create_ata_ixs, &[&payer, &token_account], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -131,6 +133,7 @@ fn test_create_mint_with_permanent_delegate_and_burn() { &token_account.pubkey(), 100, &payer, + None, ) .unwrap(); svm.expire_blockhash(); @@ -143,7 +146,7 @@ fn test_create_mint_with_permanent_delegate_and_burn() { 100, 2, // decimals ); - send_transaction_from_instructions(&mut svm, vec![burn_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![burn_ix], &[&payer], &payer.pubkey(), None) .unwrap(); assert_token_account_balance( diff --git a/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/Cargo.toml b/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/Cargo.toml index e989081b9..07ca360e6 100644 --- a/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/Cargo.toml +++ b/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/Cargo.toml @@ -22,7 +22,7 @@ anchor-spl = "1.2.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/tests/test_transfer_fee.rs b/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/tests/test_transfer_fee.rs index 2d7de4cbd..55ae4fda3 100644 --- a/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/tests/test_transfer_fee.rs +++ b/tokens/token-extensions/transfer-fee/anchor-v1/programs/transfer-fee/tests/test_transfer_fee.rs @@ -68,13 +68,20 @@ fn test_transfer_fee_full_flow() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); // Step 2: Create sender ATA and mint 300 tokens - create_token_extensions_account(&mut svm, &payer.pubkey(), &mint_keypair.pubkey(), &payer) - .unwrap(); + create_token_extensions_account( + &mut svm, + &payer.pubkey(), + &mint_keypair.pubkey(), + &payer, + None, + ) + .unwrap(); svm.expire_blockhash(); mint_tokens_to_token_extensions_account( @@ -83,6 +90,7 @@ fn test_transfer_fee_full_flow() { &sender_ata, 300, &payer, + None, ) .unwrap(); svm.expire_blockhash(); @@ -103,8 +111,14 @@ fn test_transfer_fee_full_flow() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![transfer_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![transfer_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 4: Transfer 200 tokens (fee = min(1% * 200 = 2, max_fee = 1) = 1, capped by maximumFee) @@ -123,8 +137,14 @@ fn test_transfer_fee_full_flow() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![transfer_ix2], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![transfer_ix2], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 5: Harvest transfer fees from recipient token account to mint @@ -138,8 +158,14 @@ fn test_transfer_fee_full_flow() { metas.push(AccountMeta::new(recipient_ata, false)); metas }); - send_transaction_from_instructions(&mut svm, vec![harvest_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![harvest_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 6: Withdraw harvested fees from mint to sender's token account @@ -154,8 +180,14 @@ fn test_transfer_fee_full_flow() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![withdraw_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![withdraw_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 7: Update transfer fee to 0 @@ -173,6 +205,12 @@ fn test_transfer_fee_full_flow() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![update_fee_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![update_fee_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); } diff --git a/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/Cargo.toml b/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/Cargo.toml index a0ed6e3a1..a9dce9e2b 100644 --- a/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/Cargo.toml +++ b/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/Cargo.toml @@ -28,7 +28,7 @@ spl-transfer-hook-interface = "0.9.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs b/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs index 39de57ed7..1d698c893 100644 --- a/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs +++ b/tokens/token-extensions/transfer-hook/account-data-as-seed/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs @@ -69,6 +69,7 @@ fn test_transfer_hook_account_data_as_seed() { &[MintExtension::TransferHook { program_id: program_id, }], + None, ) .unwrap(); svm.expire_blockhash(); @@ -78,14 +79,16 @@ fn test_transfer_hook_account_data_as_seed() { // Step 2: Create token accounts and mint tokens let amount: u64 = 100 * 10u64.pow(decimals as u32); let source_ata = - create_token_extensions_account(&mut svm, &payer.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &payer.pubkey(), &mint, &payer, None).unwrap(); svm.expire_blockhash(); let dest_ata = - create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer, None) + .unwrap(); svm.expire_blockhash(); - mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer).unwrap(); + mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer, None) + .unwrap(); svm.expire_blockhash(); // Step 3: Initialize ExtraAccountMetaList (also creates counter PDA) @@ -103,8 +106,14 @@ fn test_transfer_hook_account_data_as_seed() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_extra_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_extra_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 4: Transfer with hook @@ -127,6 +136,7 @@ fn test_transfer_hook_account_data_as_seed() { transfer_amount, decimals, &extra_accounts, + None, ) .unwrap(); svm.expire_blockhash(); @@ -154,6 +164,7 @@ fn test_transfer_hook_account_data_as_seed() { vec![direct_hook_ix], &[&payer], &payer.pubkey(), + None, ); assert!( result.is_err(), diff --git a/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/Cargo.toml b/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/Cargo.toml index 9dde9fefd..edc8d6382 100644 --- a/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/Cargo.toml +++ b/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/Cargo.toml @@ -38,7 +38,7 @@ spl-discriminator = "0.5.1" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/tests/test_abl_token.rs b/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/tests/test_abl_token.rs index d63851fa5..11eb906c6 100644 --- a/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/tests/test_abl_token.rs +++ b/tokens/token-extensions/transfer-hook/allow-block-list-token/anchor-v1/programs/abl-token/tests/test_abl_token.rs @@ -46,8 +46,14 @@ fn test_init_config_and_init_mint() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_config_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_config_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 2: Initialize mint with transfer hook and metadata @@ -83,6 +89,7 @@ fn test_init_config_and_init_mint() { vec![init_mint_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); } diff --git a/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/Cargo.toml b/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/Cargo.toml index a0ed6e3a1..a9dce9e2b 100644 --- a/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/Cargo.toml +++ b/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/Cargo.toml @@ -28,7 +28,7 @@ spl-transfer-hook-interface = "0.9.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/tests/test_transfer_hook_counter.rs b/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/tests/test_transfer_hook_counter.rs index a09de2069..90defca81 100644 --- a/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/tests/test_transfer_hook_counter.rs +++ b/tokens/token-extensions/transfer-hook/counter/anchor-v1/programs/transfer-hook/tests/test_transfer_hook_counter.rs @@ -67,6 +67,7 @@ fn test_transfer_hook_counter() { &[MintExtension::TransferHook { program_id: program_id, }], + None, ) .unwrap(); svm.expire_blockhash(); @@ -78,14 +79,16 @@ fn test_transfer_hook_counter() { let amount: u64 = 100 * 10u64.pow(decimals as u32); let source_ata = - create_token_extensions_account(&mut svm, &payer.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &payer.pubkey(), &mint, &payer, None).unwrap(); svm.expire_blockhash(); let dest_ata = - create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer, None) + .unwrap(); svm.expire_blockhash(); - mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer).unwrap(); + mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer, None) + .unwrap(); svm.expire_blockhash(); // Step 3: Initialize ExtraAccountMetaList (also creates counter PDA) @@ -103,8 +106,14 @@ fn test_transfer_hook_counter() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_extra_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_extra_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 4: Transfer with hook (this triggers the counter increment) @@ -127,6 +136,7 @@ fn test_transfer_hook_counter() { transfer_amount, decimals, &extra_accounts, + None, ) .unwrap(); svm.expire_blockhash(); @@ -154,6 +164,7 @@ fn test_transfer_hook_counter() { vec![direct_hook_ix], &[&payer], &payer.pubkey(), + None, ); assert!( result.is_err(), diff --git a/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/Cargo.toml b/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/Cargo.toml index a0ed6e3a1..a9dce9e2b 100644 --- a/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/Cargo.toml +++ b/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/Cargo.toml @@ -28,7 +28,7 @@ spl-transfer-hook-interface = "0.9.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs b/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs index 99a5a2e8a..f80ff0d79 100644 --- a/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs +++ b/tokens/token-extensions/transfer-hook/hello-world/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs @@ -64,15 +64,21 @@ fn test_transfer_hook_hello_world() { vec![initialize_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); // Step 2: Create token accounts and mint tokens let amount: u64 = 100 * 10u64.pow(decimals as u32); - let source_ata = - create_token_extensions_account(&mut svm, &payer.pubkey(), &mint_keypair.pubkey(), &payer) - .unwrap(); + let source_ata = create_token_extensions_account( + &mut svm, + &payer.pubkey(), + &mint_keypair.pubkey(), + &payer, + None, + ) + .unwrap(); svm.expire_blockhash(); let dest_ata = create_token_extensions_account( @@ -80,6 +86,7 @@ fn test_transfer_hook_hello_world() { &recipient.pubkey(), &mint_keypair.pubkey(), &payer, + None, ) .unwrap(); svm.expire_blockhash(); @@ -90,6 +97,7 @@ fn test_transfer_hook_hello_world() { &source_ata, amount, &payer, + None, ) .unwrap(); svm.expire_blockhash(); @@ -108,8 +116,14 @@ fn test_transfer_hook_hello_world() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_extra_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_extra_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 4: Transfer with transfer hook @@ -128,6 +142,7 @@ fn test_transfer_hook_hello_world() { transfer_amount, decimals, &extra_accounts, + None, ) .unwrap(); svm.expire_blockhash(); @@ -150,6 +165,7 @@ fn test_transfer_hook_hello_world() { vec![direct_hook_ix], &[&payer], &payer.pubkey(), + None, ); assert!( result.is_err(), diff --git a/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/Cargo.toml b/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/Cargo.toml index d001009a9..1611f0ce8 100644 --- a/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/Cargo.toml +++ b/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/Cargo.toml @@ -33,7 +33,7 @@ spl-transfer-hook-interface = "2.1.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs b/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs index 04128be8f..a7a38343a 100644 --- a/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs +++ b/tokens/token-extensions/transfer-hook/transfer-cost/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs @@ -40,6 +40,7 @@ fn test_initialize_extra_account_meta_list() { &[MintExtension::TransferHook { program_id: program_id, }], + None, ) .unwrap(); svm.expire_blockhash(); @@ -61,8 +62,14 @@ fn test_initialize_extra_account_meta_list() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_extra_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_extra_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify the ExtraAccountMetaList account was created let account = svm.get_account(&extra_account_meta_list); diff --git a/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/Cargo.toml b/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/Cargo.toml index d300dc792..0bbb52a90 100644 --- a/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/Cargo.toml +++ b/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/Cargo.toml @@ -28,7 +28,7 @@ spl-transfer-hook-interface = "0.9.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/tests/test_transfer_switch.rs b/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/tests/test_transfer_switch.rs index 3c3de0d08..d741d73af 100644 --- a/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/tests/test_transfer_switch.rs +++ b/tokens/token-extensions/transfer-hook/transfer-switch/anchor-v1/programs/transfer-switch/tests/test_transfer_switch.rs @@ -48,6 +48,7 @@ fn test_transfer_switch() { &[MintExtension::TransferHook { program_id: program_id, }], + None, ) .unwrap(); svm.expire_blockhash(); @@ -57,14 +58,16 @@ fn test_transfer_switch() { // Step 2: Create token accounts and mint tokens let amount: u64 = 100 * 10u64.pow(decimals as u32); let source_ata = - create_token_extensions_account(&mut svm, &sender.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &sender.pubkey(), &mint, &payer, None).unwrap(); svm.expire_blockhash(); let dest_ata = - create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer, None) + .unwrap(); svm.expire_blockhash(); - mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer).unwrap(); + mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer, None) + .unwrap(); svm.expire_blockhash(); // Step 3: Configure admin @@ -84,6 +87,7 @@ fn test_transfer_switch() { vec![configure_admin_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -100,8 +104,14 @@ fn test_transfer_switch() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_extra_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_extra_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 5: Turn transfers OFF for sender @@ -117,8 +127,14 @@ fn test_transfer_switch() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![switch_off_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![switch_off_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 6: Try transfer - should FAIL (switch is off) @@ -141,6 +157,7 @@ fn test_transfer_switch() { transfer_amount, decimals, &extra_accounts, + None, ); assert!(result.is_err(), "Transfer should fail when switch is off"); svm.expire_blockhash(); @@ -158,8 +175,14 @@ fn test_transfer_switch() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![switch_on_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![switch_on_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 8: Transfer - should SUCCEED (switch is on) @@ -172,6 +195,7 @@ fn test_transfer_switch() { transfer_amount, decimals, &extra_accounts, + None, ) .unwrap(); } diff --git a/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/Cargo.toml b/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/Cargo.toml index 9af5af5ea..e2d51e19a 100644 --- a/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/Cargo.toml +++ b/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/Cargo.toml @@ -28,7 +28,7 @@ spl-transfer-hook-interface = "0.9.0" [dev-dependencies] litesvm = "0.16.0" -solana-kite = "0.5.0" +solana-kite = "0.6.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" borsh = "1.6.1" diff --git a/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs b/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs index 14ddbfdb8..66017e72c 100644 --- a/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs +++ b/tokens/token-extensions/transfer-hook/whitelist/anchor-v1/programs/transfer-hook/tests/test_transfer_hook.rs @@ -46,6 +46,7 @@ fn test_whitelist_transfer_hook() { &[MintExtension::TransferHook { program_id: program_id, }], + None, ) .unwrap(); svm.expire_blockhash(); @@ -55,14 +56,16 @@ fn test_whitelist_transfer_hook() { // Step 2: Create token accounts and mint tokens let amount: u64 = 100 * 10u64.pow(decimals as u32); let source_ata = - create_token_extensions_account(&mut svm, &payer.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &payer.pubkey(), &mint, &payer, None).unwrap(); svm.expire_blockhash(); let dest_ata = - create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer).unwrap(); + create_token_extensions_account(&mut svm, &recipient.pubkey(), &mint, &payer, None) + .unwrap(); svm.expire_blockhash(); - mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer).unwrap(); + mint_tokens_to_token_extensions_account(&mut svm, &mint, &source_ata, amount, &payer, None) + .unwrap(); svm.expire_blockhash(); // Step 3: Initialize ExtraAccountMetaList (also creates whitelist) @@ -78,8 +81,14 @@ fn test_whitelist_transfer_hook() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![init_extra_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![init_extra_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); svm.expire_blockhash(); // Step 4: Add destination token account to whitelist @@ -98,6 +107,7 @@ fn test_whitelist_transfer_hook() { vec![add_to_whitelist_ix], &[&payer], &payer.pubkey(), + None, ) .unwrap(); svm.expire_blockhash(); @@ -122,6 +132,7 @@ fn test_whitelist_transfer_hook() { transfer_amount, decimals, &extra_accounts, + None, ) .unwrap(); } diff --git a/tokens/token-minter/anchor-v1/programs/token-minter/Cargo.toml b/tokens/token-minter/anchor-v1/programs/token-minter/Cargo.toml index 0c3ce64fb..1f6f82252 100644 --- a/tokens/token-minter/anchor-v1/programs/token-minter/Cargo.toml +++ b/tokens/token-minter/anchor-v1/programs/token-minter/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = { version = "1.2.0", features = ["metadata"] } litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/tokens/token-minter/anchor-v1/programs/token-minter/tests/test_token_minter.rs b/tokens/token-minter/anchor-v1/programs/token-minter/tests/test_token_minter.rs index 4d213c9fb..7a5feedb9 100644 --- a/tokens/token-minter/anchor-v1/programs/token-minter/tests/test_token_minter.rs +++ b/tokens/token-minter/anchor-v1/programs/token-minter/tests/test_token_minter.rs @@ -105,6 +105,7 @@ fn test_create_token() { vec![create_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -152,6 +153,7 @@ fn test_create_and_mint_tokens() { vec![create_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -176,7 +178,7 @@ fn test_create_and_mint_tokens() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![mint_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![mint_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify 100 tokens minted (in minor units) diff --git a/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/Cargo.toml b/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/Cargo.toml index b388d4bb1..702a56438 100644 --- a/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/Cargo.toml +++ b/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/Cargo.toml @@ -27,7 +27,7 @@ anchor-spl = { version = "1.2.0", features = ["metadata"] } litesvm = "0.16.0" solana-signer = "3.0.0" solana-keypair = "3.0.1" -solana-kite = "0.5.0" +solana-kite = "0.6.0" borsh = "1.6.1" [lints.rust] diff --git a/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/tests/test_transfer_tokens.rs b/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/tests/test_transfer_tokens.rs index 34479b943..0bc8ab33d 100644 --- a/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/tests/test_transfer_tokens.rs +++ b/tokens/transfer-tokens/anchor-v1/programs/transfer-tokens/tests/test_transfer_tokens.rs @@ -106,6 +106,7 @@ fn test_create_mint_and_transfer() { vec![create_ix], &[&payer, &mint_keypair], &payer.pubkey(), + None, ) .unwrap(); @@ -136,7 +137,7 @@ fn test_create_mint_and_transfer() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![mint_ix], &[&payer], &payer.pubkey()) + send_transaction_from_instructions(&mut svm, vec![mint_ix], &[&payer], &payer.pubkey(), None) .unwrap(); // Verify 100 tokens minted (in minor units) @@ -168,8 +169,14 @@ fn test_create_mint_and_transfer() { } .to_account_metas(None), ); - send_transaction_from_instructions(&mut svm, vec![transfer_ix], &[&payer], &payer.pubkey()) - .unwrap(); + send_transaction_from_instructions( + &mut svm, + vec![transfer_ix], + &[&payer], + &payer.pubkey(), + None, + ) + .unwrap(); // Verify: sender 50 tokens, recipient 50 tokens (in minor units) assert_eq!(