From 1084cfab8e21c9ae40245f1982e1e2a6d574a92a Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Tue, 27 Aug 2024 05:43:27 +0000 Subject: [PATCH] add test --- .../tests/process_transaction.rs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/programs/ed25519-tests/tests/process_transaction.rs b/programs/ed25519-tests/tests/process_transaction.rs index e8b1c3b85a1c8b..7ffb64ef0d6499 100644 --- a/programs/ed25519-tests/tests/process_transaction.rs +++ b/programs/ed25519-tests/tests/process_transaction.rs @@ -3,6 +3,7 @@ use { solana_program_test::*, solana_sdk::{ ed25519_instruction::new_ed25519_instruction, + feature_set, instruction::InstructionError, precompiles::PrecompileError, signature::Signer, @@ -46,6 +47,37 @@ async fn test_success() { assert_matches!(client.process_transaction(transaction).await, Ok(())); } +#[tokio::test] +async fn test_failure_without_move_precompiles_feature() { + let mut program_test = ProgramTest::default(); + program_test.deactivate_feature(feature_set::move_precompile_verification_to_svm::id()); + let mut context = program_test.start_with_context().await; + + let client = &mut context.banks_client; + let payer = &context.payer; + let recent_blockhash = context.last_blockhash; + + let privkey = generate_keypair(); + let message_arr = b"hello"; + let mut instruction = new_ed25519_instruction(&privkey, message_arr); + + instruction.data[0] += 1; + + let transaction = Transaction::new_signed_with_payer( + &[instruction], + Some(&payer.pubkey()), + &[payer], + recent_blockhash, + ); + + assert_matches!( + client.process_transaction(transaction).await, + Err(BanksClientError::TransactionError( + TransactionError::InvalidAccountIndex + )) + ); +} + #[tokio::test] async fn test_failure() { let mut context = ProgramTest::default().start_with_context().await;