Skip to content

Commit 17bdd0d

Browse files
authored
chore: cleanup light client and light-program-test (#1720)
* refactored dependencies in light-client * refactor program-test * chore: split up system-cpi-test into v1 and v2 * fix test_state_indexer_async_batched * ignore flaky forester test
1 parent 2822b9c commit 17bdd0d

File tree

141 files changed

+9792
-8870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+9792
-8870
lines changed

.github/workflows/light-system-programs-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
name: system-programs
3737
if: github.event.pull_request.draft == false
3838
runs-on: ubuntu-latest
39-
timeout-minutes: 60
39+
timeout-minutes: 90
4040
strategy:
4141
matrix:
4242
include:
@@ -50,6 +50,8 @@ jobs:
5050
sub-tests: '["cargo-test-sbf -p compressed-token-test"]'
5151
- program: system-cpi-test
5252
sub-tests: '["cargo-test-sbf -p system-cpi-test"]'
53+
- program: system-cpi-test-v2
54+
sub-tests: '["cargo-test-sbf -p system-cpi-v2-test"]'
5355
- program: random-e2e-test
5456
sub-tests: '["cargo-test-sbf -p e2e-test"]'
5557
steps:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ output.txt
8585
output1.txt
8686
.zed
8787

88-
**/.claude/settings.local.json
88+
**/.claude/**/*

Cargo.lock

Lines changed: 54 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ members = [
3333
"program-tests/e2e-test",
3434
"program-tests/registry-test",
3535
"program-tests/system-cpi-test",
36+
"program-tests/system-cpi-v2-test",
3637
"program-tests/system-test",
3738
# Issue is that anchor discriminator now returns a slice instead of an array
3839
# "program-tests/sdk-anchor-test/programs/sdk-anchor-test",
@@ -78,12 +79,27 @@ solana-bn254 = "2.2.1"
7879
solana-sysvar = { version = "2.1.1" }
7980
solana-program-error = { version = "2.1.1" }
8081
solana-account-info = { version = "2.1.1" }
82+
solana-transaction = { version = "2.2.1" }
83+
solana-transaction-error = { version = "2.2.1" }
84+
solana-hash = { version = "2.2.1" }
85+
solana-clock = { version = "2.2.1" }
86+
solana-signature = { version = "2.2.1" }
87+
solana-commitment-config = { version = "2.2.1" }
88+
solana-account = { version = "2.2.1" }
89+
solana-epoch-info = { version = "2.2.1" }
90+
solana-keypair = { version = "2.2.1" }
91+
solana-compute-budget-interface = { version = "2.2.1" }
92+
solana-signer = { version = "2.2.1" }
93+
solana-instruction = "2.2.1"
94+
solana-rpc-client = "2.2.1"
95+
solana-system-interface = { version = "1" }
8196
solana-security-txt = "1.1.1"
8297
spl-token = "7.0.0"
8398
spl-token-2022 = { version = "7", no-default-features = true, features = [
8499
"no-entrypoint",
85100
] }
86101
pinocchio = { version = "0.8.1" }
102+
bs58 = "^0.5.1"
87103

88104
# Anchor
89105
anchor-lang = { version = "=0.31.1", features = ["idl-build"] }

examples/anchor/counter/tests/test.rs

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use light_client::{
99
use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext;
1010
use light_program_test::{
1111
indexer::{TestIndexer, TestIndexerExtensions},
12-
test_env::{setup_test_programs_with_accounts_v2, EnvAccounts},
13-
test_rpc::ProgramTestRpcConnection,
12+
test_env::{setup_test_programs_with_accounts_v2, TestAccounts},
13+
program_test::LightProgramTest,
1414
};
1515
use light_prover_client::gnark::helpers::{spawn_prover, ProverConfig, ProverMode};
1616
use light_sdk::{
@@ -31,39 +31,32 @@ use solana_sdk::{
3131

3232
#[tokio::test]
3333
async fn test_counter() {
34-
spawn_prover(
35-
true,
36-
ProverConfig {
37-
run_mode: Some(ProverMode::Rpc),
38-
circuits: vec![],
39-
},
40-
)
41-
.await;
34+
spawn_prover(ProverConfig::default()).await;
4235

4336
let (mut rpc, env) =
4437
setup_test_programs_with_accounts_v2(Some(vec![("counter", counter::ID)]))
4538
.await;
4639
let payer = rpc.get_payer().insecure_clone();
4740

48-
let mut test_indexer: TestIndexer<ProgramTestRpcConnection> = TestIndexer::new(
41+
let mut test_indexer: TestIndexer = TestIndexer::new(
4942
Vec::from(&[StateMerkleTreeAccounts {
50-
merkle_tree: env.merkle_tree_pubkey,
51-
nullifier_queue: env.nullifier_queue_pubkey,
52-
cpi_context: env.cpi_context_account_pubkey,
43+
merkle_tree: env.v1_state_trees[0].merkle_tree,
44+
nullifier_queue: env.v1_state_trees[0].nullifier_queue,
45+
cpi_context: env.v1_state_trees[0].cpi_context,
5346
}]),
5447
Vec::from(&[AddressMerkleTreeAccounts {
55-
merkle_tree: env.address_merkle_tree_pubkey,
56-
queue: env.address_merkle_tree_queue_pubkey,
48+
merkle_tree: env.v1_address_trees[0].merkle_tree,
49+
queue: env.v1_address_trees[0].queue,
5750
}]),
5851
payer.insecure_clone(),
59-
env.group_pda,
52+
env.protocol.group_pda,
6053
None,
6154
)
6255
.await;
6356

6457
let address_merkle_context = AddressMerkleContext {
65-
address_merkle_tree_pubkey: env.address_merkle_tree_pubkey,
66-
address_queue_pubkey: env.address_merkle_tree_queue_pubkey,
58+
address_merkle_tree_pubkey: env.v1_address_trees[0].merkle_tree,
59+
address_queue_pubkey: env.v1_address_trees[0].queue,
6760
};
6861

6962
let (address, _) = derive_address(
@@ -172,8 +165,8 @@ async fn test_counter() {
172165
#[allow(clippy::too_many_arguments)]
173166
async fn create_counter<R>(
174167
rpc: &mut R,
175-
test_indexer: &mut TestIndexer<R>,
176-
env: &EnvAccounts,
168+
test_indexer: &mut TestIndexer,
169+
env: &TestAccounts,
177170
payer: &Keypair,
178171
address: &[u8; 32],
179172
) -> Result<(), RpcError>
@@ -189,18 +182,18 @@ where
189182
None,
190183
None,
191184
Some(&[*address]),
192-
Some(vec![env.address_merkle_tree_pubkey]),
185+
Some(vec![env.v1_address_trees[0].merkle_tree]),
193186
rpc,
194187
)
195188
.await
196189
.unwrap();
197190

198191
let address_merkle_context = AddressMerkleContext {
199-
address_merkle_tree_pubkey: env.address_merkle_tree_pubkey,
200-
address_queue_pubkey: env.address_merkle_tree_queue_pubkey,
192+
address_merkle_tree_pubkey: env.v1_address_trees[0].merkle_tree,
193+
address_queue_pubkey: env.v1_address_trees[0].queue,
201194
};
202195

203-
let output_merkle_tree_index = remaining_accounts.insert_or_get(env.merkle_tree_pubkey);
196+
let output_merkle_tree_index = remaining_accounts.insert_or_get(env.v1_state_trees[0].merkle_tree);
204197
let packed_address_merkle_context = pack_address_merkle_context(
205198
&address_merkle_context,
206199
&mut remaining_accounts,
@@ -249,7 +242,7 @@ where
249242
#[allow(clippy::too_many_arguments)]
250243
async fn increment_counter<R>(
251244
rpc: &mut R,
252-
test_indexer: &mut TestIndexer<R>,
245+
test_indexer: &mut TestIndexer,
253246
payer: &Keypair,
254247
compressed_account: &CompressedAccountWithMerkleContext,
255248
) -> Result<(), RpcError>
@@ -338,7 +331,7 @@ where
338331
#[allow(clippy::too_many_arguments)]
339332
async fn decrement_counter<R>(
340333
rpc: &mut R,
341-
test_indexer: &mut TestIndexer<R>,
334+
test_indexer: &mut TestIndexer,
342335
payer: &Keypair,
343336
compressed_account: &CompressedAccountWithMerkleContext,
344337
) -> Result<(), RpcError>
@@ -426,7 +419,7 @@ where
426419

427420
async fn reset_counter<R>(
428421
rpc: &mut R,
429-
test_indexer: &mut TestIndexer<R>,
422+
test_indexer: &mut TestIndexer,
430423
payer: &Keypair,
431424
compressed_account: &CompressedAccountWithMerkleContext,
432425
) -> Result<(), RpcError>
@@ -514,7 +507,7 @@ where
514507

515508
async fn close_counter<R>(
516509
rpc: &mut R,
517-
test_indexer: &mut TestIndexer<R>,
510+
test_indexer: &mut TestIndexer,
518511
payer: &Keypair,
519512
compressed_account: &CompressedAccountWithMerkleContext,
520513
) -> Result<(), RpcError>

0 commit comments

Comments
 (0)