diff --git a/forester/tests/e2e_test.rs b/forester/tests/e2e_test.rs index dac4620dc7..0f15ae85e6 100644 --- a/forester/tests/e2e_test.rs +++ b/forester/tests/e2e_test.rs @@ -1,4 +1,5 @@ use env_logger::Env; +use forester::external_services_config::ExternalServicesConfig; use forester::nullifier::{get_nullifier_queue, nullify, Config}; use forester::utils::spawn_validator; use light_test_utils::e2e_test_env::{E2ETestEnv, GeneralActionConfig, KeypairActionConfig}; @@ -10,7 +11,6 @@ use log::info; use solana_sdk::native_token::LAMPORTS_PER_SOL; use solana_sdk::signature::{Keypair, Signer}; use std::sync::Arc; -use forester::external_services_config::ExternalServicesConfig; #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_state_tree_nullifier() { diff --git a/forester/tests/empty_address_tree_test.rs b/forester/tests/empty_address_tree_test.rs index 06906ee384..3163300d92 100644 --- a/forester/tests/empty_address_tree_test.rs +++ b/forester/tests/empty_address_tree_test.rs @@ -1,6 +1,6 @@ -use std::sync::Arc; use anchor_lang::solana_program::native_token::LAMPORTS_PER_SOL; use env_logger::Env; +use forester::external_services_config::ExternalServicesConfig; use forester::nullifier::{empty_address_queue, get_nullifier_queue, Config}; use forester::utils::spawn_validator; use light_test_utils::e2e_test_env::{E2ETestEnv, GeneralActionConfig, KeypairActionConfig}; @@ -10,7 +10,7 @@ use light_test_utils::rpc::SolanaRpcConnection; use light_test_utils::test_env::{get_test_env_accounts, REGISTRY_ID_TEST_KEYPAIR}; use log::info; use solana_sdk::signature::{Keypair, Signer}; -use forester::external_services_config::ExternalServicesConfig; +use std::sync::Arc; #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn empty_address_tree_test() { diff --git a/forester/tests/interop_address_test.rs b/forester/tests/interop_address_test.rs index d16d4960cc..83e46ed605 100644 --- a/forester/tests/interop_address_test.rs +++ b/forester/tests/interop_address_test.rs @@ -1,4 +1,5 @@ use env_logger::Env; +use forester::external_services_config::ExternalServicesConfig; use forester::indexer::PhotonIndexer; use forester::utils::{spawn_validator, LightValidatorConfig}; use light_test_utils::e2e_test_env::{E2ETestEnv, GeneralActionConfig, KeypairActionConfig}; @@ -11,7 +12,6 @@ use log::info; use solana_sdk::native_token::LAMPORTS_PER_SOL; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Signer; -use forester::external_services_config::ExternalServicesConfig; // truncate to <254 bit pub fn generate_pubkey_254() -> Pubkey { diff --git a/forester/tests/interop_nullify_test.rs b/forester/tests/interop_nullify_test.rs index a358eebdcb..411d804601 100644 --- a/forester/tests/interop_nullify_test.rs +++ b/forester/tests/interop_nullify_test.rs @@ -1,22 +1,18 @@ -use account_compression::StateMerkleTreeAccount; use env_logger::Env; -use forester::external_services_config::{INDEXER_URL, SERVER_URL}; +use forester::external_services_config::ExternalServicesConfig; use forester::indexer::PhotonIndexer; -use forester::nullifier::{get_nullifier_queue, nullify, Config}; -use forester::utils::{get_state_queue_length, spawn_validator, LightValidatorConfig}; -use light_hasher::Poseidon; +use forester::utils::{spawn_validator, LightValidatorConfig}; use light_test_utils::e2e_test_env::{E2ETestEnv, GeneralActionConfig, KeypairActionConfig, User}; -use light_test_utils::get_concurrent_merkle_tree; use light_test_utils::indexer::Indexer; use light_test_utils::indexer::TestIndexer; use light_test_utils::rpc::rpc_connection::RpcConnection; use light_test_utils::rpc::solana_rpc::SolanaRpcUrl; use light_test_utils::rpc::SolanaRpcConnection; -use light_test_utils::test_env::{get_test_env_accounts, REGISTRY_ID_TEST_KEYPAIR}; +use light_test_utils::test_env::get_test_env_accounts; use log::info; use solana_sdk::native_token::LAMPORTS_PER_SOL; use solana_sdk::pubkey::Pubkey; -use solana_sdk::signature::{Keypair, Signer}; +use solana_sdk::signature::Signer; pub async fn assert_accounts_by_owner( indexer: &mut TestIndexer<500, SolanaRpcConnection>, @@ -106,11 +102,14 @@ pub async fn assert_account_proofs_for_photon_and_test_indexer( async fn test_photon_interop_nullify_account() { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); - let mut validator_config = LightValidatorConfig::default(); - validator_config.enable_indexer = true; - validator_config.enable_prover = true; - validator_config.enable_forester = true; - validator_config.wait_time = 25; + let validator_config = LightValidatorConfig { + enable_indexer: true, + enable_prover: true, + enable_forester: true, + wait_time: 25, + ..LightValidatorConfig::default() + }; + spawn_validator(validator_config).await; let env_accounts = get_test_env_accounts(); @@ -139,14 +138,14 @@ async fn test_photon_interop_nullify_account() { add_keypair: None, create_state_mt: None, create_address_mt: None, - ..GeneralActionConfig::default() }, 0, Some(1), ) .await; - let photon_indexer = PhotonIndexer::new(INDEXER_URL.to_string()); + let photon_indexer = + PhotonIndexer::new(ExternalServicesConfig::local().indexer_url.to_string()); let user_index = 0; let balance = env .rpc @@ -197,7 +196,7 @@ async fn test_photon_interop_nullify_account() { let alice = &mut env.users[0]; assert_accounts_by_owner(&mut env.indexer, alice, &photon_indexer).await; // TODO(photon): Test-indexer and photon should return equivalent - // merkleproofs for the same account. + // merkle proofs for the same account. assert_account_proofs_for_photon_and_test_indexer( &mut env.indexer, &alice.keypair.pubkey(), diff --git a/forester/tests/nullifier_test.rs b/forester/tests/nullifier_test.rs index 7ac04d7930..a9405dd54f 100644 --- a/forester/tests/nullifier_test.rs +++ b/forester/tests/nullifier_test.rs @@ -2,7 +2,7 @@ use std::mem; use std::sync::Arc; use account_compression::StateMerkleTreeAccount; -use forester::external_services_config::{INDEXER_URL, SERVER_URL}; +use forester::external_services_config::ExternalServicesConfig; use forester::indexer::PhotonIndexer; use forester::nullifier::{get_nullifier_queue, nullify, subscribe_nullify, Config}; use forester::utils::u8_arr_to_hex_string; @@ -23,7 +23,7 @@ fn test_config() -> Config { let env_accounts = get_test_env_accounts(); Config { - server_url: SERVER_URL.to_string(), + external_services: ExternalServicesConfig::local(), nullifier_queue_pubkey: env_accounts.nullifier_queue_pubkey, state_merkle_tree_pubkey: env_accounts.merkle_tree_pubkey, address_merkle_tree_pubkey: env_accounts.address_merkle_tree_pubkey, @@ -72,7 +72,7 @@ async fn tree_info_test() { nullifier_queue_pubkey, merkle_tree_pubkey ); - let client = RpcClient::new(SERVER_URL); + let client = RpcClient::new(test_config().external_services.rpc_url); client .request_airdrop(&payer_pubkey, LAMPORTS_PER_SOL * 1000) .unwrap(); @@ -94,10 +94,10 @@ async fn tree_info_test() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn test_nullify_leaves() { - let config = test_config(); + let config = Arc::new(test_config()); let rpc = SolanaRpcConnection::new(SolanaRpcUrl::Localnet, None); let indexer = Arc::new(tokio::sync::Mutex::new(PhotonIndexer::new( - INDEXER_URL.to_string(), + config.external_services.indexer_url.to_string(), ))); let rpc = Arc::new(tokio::sync::Mutex::new(rpc)); rpc.lock() @@ -107,7 +107,7 @@ async fn test_nullify_leaves() { .unwrap(); let time = std::time::Instant::now(); - match nullify(indexer, rpc, &config).await { + match nullify(indexer, rpc, config).await { Ok(_) => { info!("Nullify completed"); info!("Total time elapsed: {:?}", time.elapsed()); diff --git a/js/compressed-token/src/idl/light_compressed_token.ts b/js/compressed-token/src/idl/light_compressed_token.ts index 90171f351f..d8ba40d3ff 100644 --- a/js/compressed-token/src/idl/light_compressed_token.ts +++ b/js/compressed-token/src/idl/light_compressed_token.ts @@ -1360,108 +1360,23 @@ export type LightCompressedToken = { errors: [ { code: 6000; - name: 'PublicKeyAmountMissmatch'; - msg: 'public keys and amounts must be of same length'; + name: 'SignerCheckFailed'; + msg: 'Signer check failed'; }, { code: 6001; - name: 'SignerCheckFailed'; - msg: 'SignerCheckFailed'; + name: 'CreateTransferInstructionFailed'; + msg: 'Create transfer instruction failed'; }, { code: 6002; - name: 'ComputeInputSumFailed'; - msg: 'ComputeInputSumFailed'; + name: 'AccountNotFound'; + msg: 'Account not found'; }, { code: 6003; - name: 'ComputeOutputSumFailed'; - msg: 'ComputeOutputSumFailed'; - }, - { - code: 6004; - name: 'ComputeCompressSumFailed'; - msg: 'ComputeCompressSumFailed'; - }, - { - code: 6005; - name: 'ComputeDecompressSumFailed'; - msg: 'ComputeDecompressSumFailed'; - }, - { - code: 6006; - name: 'SumCheckFailed'; - msg: 'SumCheckFailed'; - }, - { - code: 6007; - name: 'DecompressRecipientUndefinedForDecompress'; - msg: 'DecompressRecipientUndefinedForDecompress'; - }, - { - code: 6008; - name: 'CompressedPdaUndefinedForDecompress'; - msg: 'CompressedPdaUndefinedForDecompress'; - }, - { - code: 6009; - name: 'DeCompressAmountUndefinedForDecompress'; - msg: 'DeCompressAmountUndefinedForDecompress'; - }, - { - code: 6010; - name: 'CompressedPdaUndefinedForCompress'; - msg: 'CompressedPdaUndefinedForCompress'; - }, - { - code: 6011; - name: 'DeCompressAmountUndefinedForCompress'; - msg: 'DeCompressAmountUndefinedForCompress'; - }, - { - code: 6012; - name: 'DelegateUndefined'; - msg: 'DelegateUndefined while delegated amount is defined'; - }, - { - code: 6013; - name: 'DelegateSignerCheckFailed'; - msg: 'DelegateSignerCheckFailed'; - }, - { - code: 6014; - name: 'SplTokenSupplyMismatch'; - msg: 'SplTokenSupplyMismatch'; - }, - { - code: 6015; - name: 'HeapMemoryCheckFailed'; - msg: 'HeapMemoryCheckFailed'; - }, - { - code: 6016; - name: 'InstructionNotCallable'; - msg: 'The instruction is not callable'; - }, - { - code: 6017; - name: 'ArithmeticUnderflow'; - msg: 'ArithmeticUnderflow'; - }, - { - code: 6018; - name: 'InvalidDelegate'; - msg: 'InvalidDelegate'; - }, - { - code: 6019; - name: 'HashToFieldError'; - msg: 'HashToFieldError'; - }, - { - code: 6020; - name: 'InvalidMint'; - msg: 'InvalidMint'; + name: 'SerializationError'; + msg: 'Serialization error'; }, ]; }; @@ -2832,108 +2747,23 @@ export const IDL: LightCompressedToken = { errors: [ { code: 6000, - name: 'PublicKeyAmountMissmatch', - msg: 'public keys and amounts must be of same length', + name: 'SignerCheckFailed', + msg: 'Signer check failed', }, { code: 6001, - name: 'SignerCheckFailed', - msg: 'SignerCheckFailed', + name: 'CreateTransferInstructionFailed', + msg: 'Create transfer instruction failed', }, { code: 6002, - name: 'ComputeInputSumFailed', - msg: 'ComputeInputSumFailed', + name: 'AccountNotFound', + msg: 'Account not found', }, { code: 6003, - name: 'ComputeOutputSumFailed', - msg: 'ComputeOutputSumFailed', - }, - { - code: 6004, - name: 'ComputeCompressSumFailed', - msg: 'ComputeCompressSumFailed', - }, - { - code: 6005, - name: 'ComputeDecompressSumFailed', - msg: 'ComputeDecompressSumFailed', - }, - { - code: 6006, - name: 'SumCheckFailed', - msg: 'SumCheckFailed', - }, - { - code: 6007, - name: 'DecompressRecipientUndefinedForDecompress', - msg: 'DecompressRecipientUndefinedForDecompress', - }, - { - code: 6008, - name: 'CompressedPdaUndefinedForDecompress', - msg: 'CompressedPdaUndefinedForDecompress', - }, - { - code: 6009, - name: 'DeCompressAmountUndefinedForDecompress', - msg: 'DeCompressAmountUndefinedForDecompress', - }, - { - code: 6010, - name: 'CompressedPdaUndefinedForCompress', - msg: 'CompressedPdaUndefinedForCompress', - }, - { - code: 6011, - name: 'DeCompressAmountUndefinedForCompress', - msg: 'DeCompressAmountUndefinedForCompress', - }, - { - code: 6012, - name: 'DelegateUndefined', - msg: 'DelegateUndefined while delegated amount is defined', - }, - { - code: 6013, - name: 'DelegateSignerCheckFailed', - msg: 'DelegateSignerCheckFailed', - }, - { - code: 6014, - name: 'SplTokenSupplyMismatch', - msg: 'SplTokenSupplyMismatch', - }, - { - code: 6015, - name: 'HeapMemoryCheckFailed', - msg: 'HeapMemoryCheckFailed', - }, - { - code: 6016, - name: 'InstructionNotCallable', - msg: 'The instruction is not callable', - }, - { - code: 6017, - name: 'ArithmeticUnderflow', - msg: 'ArithmeticUnderflow', - }, - { - code: 6018, - name: 'InvalidDelegate', - msg: 'InvalidDelegate', - }, - { - code: 6019, - name: 'HashToFieldError', - msg: 'HashToFieldError', - }, - { - code: 6020, - name: 'InvalidMint', - msg: 'InvalidMint', + name: 'SerializationError', + msg: 'Serialization error', }, ], }; diff --git a/js/stateless.js/src/idls/light_compressed_token.ts b/js/stateless.js/src/idls/light_compressed_token.ts index 90171f351f..d8ba40d3ff 100644 --- a/js/stateless.js/src/idls/light_compressed_token.ts +++ b/js/stateless.js/src/idls/light_compressed_token.ts @@ -1360,108 +1360,23 @@ export type LightCompressedToken = { errors: [ { code: 6000; - name: 'PublicKeyAmountMissmatch'; - msg: 'public keys and amounts must be of same length'; + name: 'SignerCheckFailed'; + msg: 'Signer check failed'; }, { code: 6001; - name: 'SignerCheckFailed'; - msg: 'SignerCheckFailed'; + name: 'CreateTransferInstructionFailed'; + msg: 'Create transfer instruction failed'; }, { code: 6002; - name: 'ComputeInputSumFailed'; - msg: 'ComputeInputSumFailed'; + name: 'AccountNotFound'; + msg: 'Account not found'; }, { code: 6003; - name: 'ComputeOutputSumFailed'; - msg: 'ComputeOutputSumFailed'; - }, - { - code: 6004; - name: 'ComputeCompressSumFailed'; - msg: 'ComputeCompressSumFailed'; - }, - { - code: 6005; - name: 'ComputeDecompressSumFailed'; - msg: 'ComputeDecompressSumFailed'; - }, - { - code: 6006; - name: 'SumCheckFailed'; - msg: 'SumCheckFailed'; - }, - { - code: 6007; - name: 'DecompressRecipientUndefinedForDecompress'; - msg: 'DecompressRecipientUndefinedForDecompress'; - }, - { - code: 6008; - name: 'CompressedPdaUndefinedForDecompress'; - msg: 'CompressedPdaUndefinedForDecompress'; - }, - { - code: 6009; - name: 'DeCompressAmountUndefinedForDecompress'; - msg: 'DeCompressAmountUndefinedForDecompress'; - }, - { - code: 6010; - name: 'CompressedPdaUndefinedForCompress'; - msg: 'CompressedPdaUndefinedForCompress'; - }, - { - code: 6011; - name: 'DeCompressAmountUndefinedForCompress'; - msg: 'DeCompressAmountUndefinedForCompress'; - }, - { - code: 6012; - name: 'DelegateUndefined'; - msg: 'DelegateUndefined while delegated amount is defined'; - }, - { - code: 6013; - name: 'DelegateSignerCheckFailed'; - msg: 'DelegateSignerCheckFailed'; - }, - { - code: 6014; - name: 'SplTokenSupplyMismatch'; - msg: 'SplTokenSupplyMismatch'; - }, - { - code: 6015; - name: 'HeapMemoryCheckFailed'; - msg: 'HeapMemoryCheckFailed'; - }, - { - code: 6016; - name: 'InstructionNotCallable'; - msg: 'The instruction is not callable'; - }, - { - code: 6017; - name: 'ArithmeticUnderflow'; - msg: 'ArithmeticUnderflow'; - }, - { - code: 6018; - name: 'InvalidDelegate'; - msg: 'InvalidDelegate'; - }, - { - code: 6019; - name: 'HashToFieldError'; - msg: 'HashToFieldError'; - }, - { - code: 6020; - name: 'InvalidMint'; - msg: 'InvalidMint'; + name: 'SerializationError'; + msg: 'Serialization error'; }, ]; }; @@ -2832,108 +2747,23 @@ export const IDL: LightCompressedToken = { errors: [ { code: 6000, - name: 'PublicKeyAmountMissmatch', - msg: 'public keys and amounts must be of same length', + name: 'SignerCheckFailed', + msg: 'Signer check failed', }, { code: 6001, - name: 'SignerCheckFailed', - msg: 'SignerCheckFailed', + name: 'CreateTransferInstructionFailed', + msg: 'Create transfer instruction failed', }, { code: 6002, - name: 'ComputeInputSumFailed', - msg: 'ComputeInputSumFailed', + name: 'AccountNotFound', + msg: 'Account not found', }, { code: 6003, - name: 'ComputeOutputSumFailed', - msg: 'ComputeOutputSumFailed', - }, - { - code: 6004, - name: 'ComputeCompressSumFailed', - msg: 'ComputeCompressSumFailed', - }, - { - code: 6005, - name: 'ComputeDecompressSumFailed', - msg: 'ComputeDecompressSumFailed', - }, - { - code: 6006, - name: 'SumCheckFailed', - msg: 'SumCheckFailed', - }, - { - code: 6007, - name: 'DecompressRecipientUndefinedForDecompress', - msg: 'DecompressRecipientUndefinedForDecompress', - }, - { - code: 6008, - name: 'CompressedPdaUndefinedForDecompress', - msg: 'CompressedPdaUndefinedForDecompress', - }, - { - code: 6009, - name: 'DeCompressAmountUndefinedForDecompress', - msg: 'DeCompressAmountUndefinedForDecompress', - }, - { - code: 6010, - name: 'CompressedPdaUndefinedForCompress', - msg: 'CompressedPdaUndefinedForCompress', - }, - { - code: 6011, - name: 'DeCompressAmountUndefinedForCompress', - msg: 'DeCompressAmountUndefinedForCompress', - }, - { - code: 6012, - name: 'DelegateUndefined', - msg: 'DelegateUndefined while delegated amount is defined', - }, - { - code: 6013, - name: 'DelegateSignerCheckFailed', - msg: 'DelegateSignerCheckFailed', - }, - { - code: 6014, - name: 'SplTokenSupplyMismatch', - msg: 'SplTokenSupplyMismatch', - }, - { - code: 6015, - name: 'HeapMemoryCheckFailed', - msg: 'HeapMemoryCheckFailed', - }, - { - code: 6016, - name: 'InstructionNotCallable', - msg: 'The instruction is not callable', - }, - { - code: 6017, - name: 'ArithmeticUnderflow', - msg: 'ArithmeticUnderflow', - }, - { - code: 6018, - name: 'InvalidDelegate', - msg: 'InvalidDelegate', - }, - { - code: 6019, - name: 'HashToFieldError', - msg: 'HashToFieldError', - }, - { - code: 6020, - name: 'InvalidMint', - msg: 'InvalidMint', + name: 'SerializationError', + msg: 'Serialization error', }, ], };