Add feature_set_override parameter to mock_process_instruction() (#24386)
This commit is contained in:
@ -1326,6 +1326,7 @@ mod tests {
|
||||
transaction_accounts,
|
||||
instruction_accounts,
|
||||
None,
|
||||
None,
|
||||
expected_result,
|
||||
super::process_instruction,
|
||||
)
|
||||
@ -1587,6 +1588,7 @@ mod tests {
|
||||
vec![(program_id, program_account.clone())],
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
Err(InstructionError::ProgramFailedToComplete),
|
||||
|first_instruction_account: usize, invoke_context: &mut InvokeContext| {
|
||||
invoke_context
|
||||
@ -2852,6 +2854,7 @@ mod tests {
|
||||
transaction_accounts,
|
||||
instruction_accounts,
|
||||
None,
|
||||
None,
|
||||
expected_result,
|
||||
super::process_instruction,
|
||||
)
|
||||
|
@ -169,6 +169,7 @@ mod tests {
|
||||
transaction_accounts,
|
||||
instruction_accounts,
|
||||
None,
|
||||
None,
|
||||
expected_result,
|
||||
super::process_instruction,
|
||||
)
|
||||
|
@ -538,6 +538,7 @@ mod tests {
|
||||
transaction_accounts,
|
||||
instruction_accounts,
|
||||
sysvar_cache_override,
|
||||
None,
|
||||
expected_result,
|
||||
super::process_instruction,
|
||||
)
|
||||
@ -6077,6 +6078,7 @@ mod tests {
|
||||
transaction_accounts,
|
||||
instruction_accounts,
|
||||
None,
|
||||
None,
|
||||
Ok(()),
|
||||
|first_instruction_account, invoke_context| {
|
||||
super::process_instruction(first_instruction_account, invoke_context)?;
|
||||
@ -6199,6 +6201,13 @@ mod tests {
|
||||
Err(InstructionError::NotEnoughAccountKeys),
|
||||
),
|
||||
] {
|
||||
let mut feature_set = FeatureSet::all_enabled();
|
||||
if !is_feature_enabled {
|
||||
feature_set.deactivate(
|
||||
&feature_set::add_get_minimum_delegation_instruction_to_stake_program::id(),
|
||||
);
|
||||
}
|
||||
|
||||
mock_process_instruction(
|
||||
&id(),
|
||||
Vec::new(),
|
||||
@ -6206,19 +6215,9 @@ mod tests {
|
||||
transaction_accounts.clone(),
|
||||
instruction_accounts.clone(),
|
||||
None,
|
||||
Some(Arc::new(feature_set)),
|
||||
expected_result,
|
||||
if is_feature_enabled {
|
||||
|first_instruction_account, invoke_context| {
|
||||
super::process_instruction(first_instruction_account, invoke_context)
|
||||
}
|
||||
} else {
|
||||
|first_instruction_account, invoke_context| {
|
||||
let mut feature_set = FeatureSet::all_enabled();
|
||||
feature_set.deactivate(&feature_set::add_get_minimum_delegation_instruction_to_stake_program::id());
|
||||
invoke_context.feature_set = Arc::new(feature_set);
|
||||
super::process_instruction(first_instruction_account, invoke_context)
|
||||
}
|
||||
},
|
||||
super::process_instruction,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +203,7 @@ mod tests {
|
||||
transaction_accounts,
|
||||
instruction_accounts,
|
||||
None,
|
||||
None,
|
||||
expected_result,
|
||||
super::process_instruction,
|
||||
)
|
||||
@ -221,11 +222,9 @@ mod tests {
|
||||
transaction_accounts,
|
||||
instruction_accounts,
|
||||
None,
|
||||
Some(std::sync::Arc::new(FeatureSet::default())),
|
||||
expected_result,
|
||||
|first_instruction_account: usize, invoke_context: &mut InvokeContext| {
|
||||
invoke_context.feature_set = std::sync::Arc::new(FeatureSet::default());
|
||||
super::process_instruction(first_instruction_account, invoke_context)
|
||||
},
|
||||
super::process_instruction,
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user