Adds feature reject_empty_instruction_without_program. (#21591)
This commit is contained in:
committed by
GitHub
parent
015250f96c
commit
1a4a039913
@@ -6506,6 +6506,7 @@ pub(crate) mod tests {
|
||||
compute_budget::ComputeBudgetInstruction,
|
||||
epoch_schedule::MINIMUM_SLOTS_PER_EPOCH,
|
||||
feature::Feature,
|
||||
feature_set::reject_empty_instruction_without_program,
|
||||
genesis_config::create_genesis_config,
|
||||
hash,
|
||||
instruction::{AccountMeta, CompiledInstruction, Instruction, InstructionError},
|
||||
@@ -15445,17 +15446,23 @@ pub(crate) mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_an_empty_transaction_without_program() {
|
||||
fn test_an_empty_instruction_without_program() {
|
||||
let (genesis_config, mint_keypair) = create_genesis_config(1);
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
|
||||
let destination = solana_sdk::pubkey::new_rand();
|
||||
let mut ix = system_instruction::transfer(&mint_keypair.pubkey(), &destination, 0);
|
||||
ix.program_id = native_loader::id(); // Empty executable account chain
|
||||
|
||||
let message = Message::new(&[ix], Some(&mint_keypair.pubkey()));
|
||||
let tx = Transaction::new(&[&mint_keypair], message, genesis_config.hash());
|
||||
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
|
||||
let mut bank = Bank::new_for_tests(&genesis_config);
|
||||
bank.activate_feature(&reject_empty_instruction_without_program::id());
|
||||
assert_eq!(
|
||||
bank.process_transaction(&tx).unwrap_err(),
|
||||
TransactionError::InstructionError(0, InstructionError::UnsupportedProgramId),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user