From a21378d30d667f33a1326b3c7227125055d20c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Fri, 13 Jan 2023 18:16:23 +0100 Subject: [PATCH] Removes ignored test: test_program_sbf_test_use_latest_executor2(). --- programs/sbf/tests/programs.rs | 104 --------------------------------- 1 file changed, 104 deletions(-) diff --git a/programs/sbf/tests/programs.rs b/programs/sbf/tests/programs.rs index fca988b778939e..22fc4c8a5df2a3 100644 --- a/programs/sbf/tests/programs.rs +++ b/programs/sbf/tests/programs.rs @@ -1666,110 +1666,6 @@ fn test_program_sbf_test_use_latest_executor() { .is_ok()); } -#[ignore] // Invoking SBF loaders from CPI not allowed -#[test] -#[cfg(feature = "sbf_rust")] -fn test_program_sbf_test_use_latest_executor2() { - solana_logger::setup(); - - let GenesisConfigInfo { - genesis_config, - mint_keypair, - .. - } = create_genesis_config(50); - let mut bank = Bank::new_for_tests(&genesis_config); - let (name, id, entrypoint) = solana_bpf_loader_program!(); - bank.add_builtin(&name, &id, entrypoint); - let bank_client = BankClient::new(bank); - let invoke_and_error = create_deprecated_program( - &bank_client, - &bpf_loader::id(), - &mint_keypair, - "solana_sbf_rust_invoke_and_error", - ); - let invoke_and_ok = create_deprecated_program( - &bank_client, - &bpf_loader::id(), - &mint_keypair, - "solana_sbf_rust_invoke_and_ok", - ); - - // Write the panic program into the program account - let (program_keypair, mut instruction) = load_and_finalize_deprecated_program( - &bank_client, - &bpf_loader::id(), - None, - &mint_keypair, - "solana_sbf_rust_panic", - ); - - // - invoke finalize and return error, swallow error - instruction.accounts.insert( - 0, - AccountMeta { - is_signer: false, - is_writable: false, - pubkey: instruction.program_id, - }, - ); - instruction.program_id = invoke_and_ok; - instruction.accounts.insert( - 0, - AccountMeta { - is_signer: false, - is_writable: false, - pubkey: invoke_and_error, - }, - ); - let message = Message::new(&[instruction], Some(&mint_keypair.pubkey())); - assert!(bank_client - .send_and_confirm_message(&[&mint_keypair, &program_keypair], message) - .is_ok()); - - // invoke program, verify not found - let message = Message::new( - &[Instruction::new_with_bytes( - program_keypair.pubkey(), - &[0], - vec![], - )], - Some(&mint_keypair.pubkey()), - ); - assert_eq!( - bank_client - .send_and_confirm_message(&[&mint_keypair], message) - .unwrap_err() - .unwrap(), - TransactionError::InvalidProgramForExecution - ); - - // Write the noop program into the same program account - let (program_keypair, instruction) = load_and_finalize_deprecated_program( - &bank_client, - &bpf_loader::id(), - Some(program_keypair), - &mint_keypair, - "solana_sbf_rust_noop", - ); - let message = Message::new(&[instruction], Some(&mint_keypair.pubkey())); - bank_client - .send_and_confirm_message(&[&mint_keypair, &program_keypair], message) - .unwrap(); - - // Call the program, should get noop, not panic - let message = Message::new( - &[Instruction::new_with_bytes( - program_keypair.pubkey(), - &[0], - vec![], - )], - Some(&mint_keypair.pubkey()), - ); - assert!(bank_client - .send_and_confirm_message(&[&mint_keypair], message) - .is_ok()); -} - #[test] #[cfg(feature = "sbf_rust")] fn test_program_sbf_upgrade() {