Skip to content

Commit 00428e9

Browse files
committed
docs: add rationale comments to test configuration changes
- Bankrun projects (7): explain why [test.validator] was removed — these use in-process simulation and don't need the local validator - Real-validator projects (2): explain why startup_wait is 120s — they clone programs from devnet which is slow in CI - Escrow native: explain why Cargo.lock is committed and blake3 is pinned (edition 2024 incompatibility with solana-program 1.18.17's toolchain) - Escrow test: comment explaining borsh deserializes pubkeys as byte arrays - .gitignore: exception for escrow Cargo.lock with explanation
1 parent aa5a8e5 commit 00428e9

12 files changed

Lines changed: 43 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ node_modules/
88
**/*/node_modules
99
**/*/package-lock.json
1010
**/*/Cargo.lock
11+
# Exception: escrow native needs Cargo.lock to pin blake3 (see tokens/escrow/native/Cargo.toml)
12+
!tokens/escrow/native/Cargo.lock
1113

1214
**/*/.anchor
1315
**/*/.DS_Store

tokens/create-token/anchor/Anchor.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ wallet = "~/.config/solana/id.json"
1818
[scripts]
1919
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2020

21+
# Tests use solana-bankrun (in-process simulation), not the local validator.
22+
# No [test.validator] section needed — adding one (e.g. to clone programs from
23+
# mainnet) would slow down validator startup without benefit, since bankrun
24+
# loads programs directly from the local build.
2125
[test]
2226
startup_wait = 25000
2327
shutdown_wait = 2000

tokens/escrow/native/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[workspace]
22
members = ["program"]
33
resolver = "2"
4+
5+
# Cargo.lock is committed to pin blake3 to 1.5.5 (and constant_time_eq to 0.3.1).
6+
# blake3 >= 1.8.3 requires Rust edition 2024, which the Cargo bundled with
7+
# solana-program 1.18.17's platform-tools (Cargo 1.84.0) doesn't support.
8+
# When solana-program is upgraded to a version with edition 2024 support,
9+
# this Cargo.lock pin can be removed and the crate re-resolved freely.

tokens/escrow/native/tests/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ describe('Escrow!', async () => {
6464
const vaultTokenAccount = AccountLayout.decode(vaultInfo.data);
6565

6666
assert(offer.id.toString() === values.id.toString(), 'wrong id');
67+
// borsh deserializes pubkeys as raw byte arrays, wrap in PublicKey for comparison
6768
assert(new PublicKey(offer.maker).toBase58() === values.maker.publicKey.toBase58(), 'maker key does not match');
6869
assert(new PublicKey(offer.token_mint_a).toBase58() === values.mintAKeypair.publicKey.toBase58(), 'wrong mint A');
6970
assert(new PublicKey(offer.token_mint_b).toBase58() === values.mintBKeypair.publicKey.toBase58(), 'wrong mint B');

tokens/nft-minter/anchor/Anchor.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ wallet = "~/.config/solana/id.json"
1919
[scripts]
2020
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2121

22+
# Tests use solana-bankrun (in-process simulation), not the local validator.
23+
# No [test.validator] section needed — adding one (e.g. to clone programs from
24+
# mainnet) would slow down validator startup without benefit, since bankrun
25+
# loads programs directly from the local build.
2226
[test]
2327
startup_wait = 25000
2428
shutdown_wait = 2000

tokens/nft-operations/anchor/Anchor.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ url = "https://api.apr.dev"
1818
cluster = "localnet"
1919
wallet = "~/.config/solana/id.json"
2020

21+
# Tests use solana-bankrun (in-process simulation), not the local validator.
22+
# No [test.validator] section needed — adding one (e.g. to clone programs from
23+
# mainnet) would slow down validator startup without benefit, since bankrun
24+
# loads programs directly from the local build.
2125
[test]
2226
startup_wait = 25000
2327

tokens/pda-mint-authority/anchor/Anchor.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ wallet = "~/.config/solana/id.json"
1818
[scripts]
1919
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2020

21+
# Tests use solana-bankrun (in-process simulation), not the local validator.
22+
# No [test.validator] section needed — adding one (e.g. to clone programs from
23+
# mainnet) would slow down validator startup without benefit, since bankrun
24+
# loads programs directly from the local build.
2125
[test]
2226
startup_wait = 25000
2327
shutdown_wait = 2000

tokens/spl-token-minter/anchor/Anchor.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ wallet = "~/.config/solana/id.json"
1818
[scripts]
1919
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2020

21+
# Tests use solana-bankrun (in-process simulation), not the local validator.
22+
# No [test.validator] section needed — adding one (e.g. to clone programs from
23+
# mainnet) would slow down validator startup without benefit, since bankrun
24+
# loads programs directly from the local build.
2125
[test]
2226
startup_wait = 25000
2327
shutdown_wait = 2000

tokens/token-2022/basics/anchor/Anchor.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ url = "https://api.apr.dev"
1414
cluster = "Localnet"
1515
wallet = "~/.config/solana/id.json"
1616

17+
# Tests use solana-bankrun (in-process simulation), not the local validator.
18+
# No [test.validator] section needed — adding one (e.g. to clone programs from
19+
# mainnet) would slow down validator startup without benefit, since bankrun
20+
# loads programs directly from the local build.
1721
[test]
1822
startup_wait = 25000
1923

tokens/token-2022/transfer-hook/hello-world/anchor/Anchor.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ wallet = "~/.config/solana/id.json"
1818
[scripts]
1919
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2020

21+
# Tests use the real local validator (not bankrun) because transfer-hook
22+
# tests need the actual validator runtime. startup_wait is 120s because the
23+
# validator clones programs from devnet which is slow in CI.
2124
[test]
2225
startup_wait = 120000
2326
shutdown_wait = 2000

0 commit comments

Comments
 (0)