Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/light-system-programs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
name: system-programs
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 60
timeout-minutes: 90
strategy:
matrix:
include:
Expand All @@ -50,6 +50,8 @@ jobs:
sub-tests: '["cargo-test-sbf -p compressed-token-test"]'
- program: system-cpi-test
sub-tests: '["cargo-test-sbf -p system-cpi-test"]'
- program: system-cpi-test-v2
sub-tests: '["cargo-test-sbf -p system-cpi-v2-test"]'
- program: random-e2e-test
sub-tests: '["cargo-test-sbf -p e2e-test"]'
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ output.txt
output1.txt
.zed

**/.claude/settings.local.json
**/.claude/**/*
63 changes: 54 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ members = [
"program-tests/e2e-test",
"program-tests/registry-test",
"program-tests/system-cpi-test",
"program-tests/system-cpi-v2-test",
"program-tests/system-test",
# Issue is that anchor discriminator now returns a slice instead of an array
# "program-tests/sdk-anchor-test/programs/sdk-anchor-test",
Expand Down Expand Up @@ -78,12 +79,27 @@ solana-bn254 = "2.2.1"
solana-sysvar = { version = "2.1.1" }
solana-program-error = { version = "2.1.1" }
solana-account-info = { version = "2.1.1" }
solana-transaction = { version = "2.2.1" }
solana-transaction-error = { version = "2.2.1" }
solana-hash = { version = "2.2.1" }
solana-clock = { version = "2.2.1" }
solana-signature = { version = "2.2.1" }
solana-commitment-config = { version = "2.2.1" }
solana-account = { version = "2.2.1" }
solana-epoch-info = { version = "2.2.1" }
solana-keypair = { version = "2.2.1" }
solana-compute-budget-interface = { version = "2.2.1" }
solana-signer = { version = "2.2.1" }
solana-instruction = "2.2.1"
solana-rpc-client = "2.2.1"
solana-system-interface = { version = "1" }
solana-security-txt = "1.1.1"
spl-token = "7.0.0"
spl-token-2022 = { version = "7", no-default-features = true, features = [
"no-entrypoint",
] }
pinocchio = { version = "0.8.1" }
bs58 = "^0.5.1"

# Anchor
anchor-lang = { version = "=0.31.1", features = ["idl-build"] }
Expand Down
51 changes: 22 additions & 29 deletions examples/anchor/counter/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use light_client::{
use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext;
use light_program_test::{
indexer::{TestIndexer, TestIndexerExtensions},
test_env::{setup_test_programs_with_accounts_v2, EnvAccounts},
test_rpc::ProgramTestRpcConnection,
test_env::{setup_test_programs_with_accounts_v2, TestAccounts},
program_test::LightProgramTest,
};
use light_prover_client::gnark::helpers::{spawn_prover, ProverConfig, ProverMode};
use light_sdk::{
Expand All @@ -31,39 +31,32 @@ use solana_sdk::{

#[tokio::test]
async fn test_counter() {
spawn_prover(
true,
ProverConfig {
run_mode: Some(ProverMode::Rpc),
circuits: vec![],
},
)
.await;
spawn_prover(ProverConfig::default()).await;

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

let mut test_indexer: TestIndexer<ProgramTestRpcConnection> = TestIndexer::new(
let mut test_indexer: TestIndexer = TestIndexer::new(
Vec::from(&[StateMerkleTreeAccounts {
merkle_tree: env.merkle_tree_pubkey,
nullifier_queue: env.nullifier_queue_pubkey,
cpi_context: env.cpi_context_account_pubkey,
merkle_tree: env.v1_state_trees[0].merkle_tree,
nullifier_queue: env.v1_state_trees[0].nullifier_queue,
cpi_context: env.v1_state_trees[0].cpi_context,
}]),
Vec::from(&[AddressMerkleTreeAccounts {
merkle_tree: env.address_merkle_tree_pubkey,
queue: env.address_merkle_tree_queue_pubkey,
merkle_tree: env.v1_address_trees[0].merkle_tree,
queue: env.v1_address_trees[0].queue,
}]),
payer.insecure_clone(),
env.group_pda,
env.protocol.group_pda,
None,
)
.await;

let address_merkle_context = AddressMerkleContext {
address_merkle_tree_pubkey: env.address_merkle_tree_pubkey,
address_queue_pubkey: env.address_merkle_tree_queue_pubkey,
address_merkle_tree_pubkey: env.v1_address_trees[0].merkle_tree,
address_queue_pubkey: env.v1_address_trees[0].queue,
};

let (address, _) = derive_address(
Expand Down Expand Up @@ -172,8 +165,8 @@ async fn test_counter() {
#[allow(clippy::too_many_arguments)]
async fn create_counter<R>(
rpc: &mut R,
test_indexer: &mut TestIndexer<R>,
env: &EnvAccounts,
test_indexer: &mut TestIndexer,
env: &TestAccounts,
payer: &Keypair,
address: &[u8; 32],
) -> Result<(), RpcError>
Expand All @@ -189,18 +182,18 @@ where
None,
None,
Some(&[*address]),
Some(vec![env.address_merkle_tree_pubkey]),
Some(vec![env.v1_address_trees[0].merkle_tree]),
rpc,
)
.await
.unwrap();

let address_merkle_context = AddressMerkleContext {
address_merkle_tree_pubkey: env.address_merkle_tree_pubkey,
address_queue_pubkey: env.address_merkle_tree_queue_pubkey,
address_merkle_tree_pubkey: env.v1_address_trees[0].merkle_tree,
address_queue_pubkey: env.v1_address_trees[0].queue,
};

let output_merkle_tree_index = remaining_accounts.insert_or_get(env.merkle_tree_pubkey);
let output_merkle_tree_index = remaining_accounts.insert_or_get(env.v1_state_trees[0].merkle_tree);
let packed_address_merkle_context = pack_address_merkle_context(
&address_merkle_context,
&mut remaining_accounts,
Expand Down Expand Up @@ -249,7 +242,7 @@ where
#[allow(clippy::too_many_arguments)]
async fn increment_counter<R>(
rpc: &mut R,
test_indexer: &mut TestIndexer<R>,
test_indexer: &mut TestIndexer,
payer: &Keypair,
compressed_account: &CompressedAccountWithMerkleContext,
) -> Result<(), RpcError>
Expand Down Expand Up @@ -338,7 +331,7 @@ where
#[allow(clippy::too_many_arguments)]
async fn decrement_counter<R>(
rpc: &mut R,
test_indexer: &mut TestIndexer<R>,
test_indexer: &mut TestIndexer,
payer: &Keypair,
compressed_account: &CompressedAccountWithMerkleContext,
) -> Result<(), RpcError>
Expand Down Expand Up @@ -426,7 +419,7 @@ where

async fn reset_counter<R>(
rpc: &mut R,
test_indexer: &mut TestIndexer<R>,
test_indexer: &mut TestIndexer,
payer: &Keypair,
compressed_account: &CompressedAccountWithMerkleContext,
) -> Result<(), RpcError>
Expand Down Expand Up @@ -514,7 +507,7 @@ where

async fn close_counter<R>(
rpc: &mut R,
test_indexer: &mut TestIndexer<R>,
test_indexer: &mut TestIndexer,
payer: &Keypair,
compressed_account: &CompressedAccountWithMerkleContext,
) -> Result<(), RpcError>
Expand Down
Loading