clean feature: `request_units_deprecated` (#27102)
clean feature: request_units_deprecated
This commit is contained in:
parent
014a926645
commit
bdce208fe5
|
@ -24,7 +24,6 @@ pub trait GetTransactionPriorityDetails {
|
||||||
.process_instructions(
|
.process_instructions(
|
||||||
instructions,
|
instructions,
|
||||||
true, // use default units per instruction
|
true, // use default units per instruction
|
||||||
true, // don't reject txs that use set compute unit price ix
|
|
||||||
)
|
)
|
||||||
.ok()?;
|
.ok()?;
|
||||||
Some(TransactionPriorityDetails {
|
Some(TransactionPriorityDetails {
|
||||||
|
|
|
@ -127,7 +127,6 @@ impl ComputeBudget {
|
||||||
&mut self,
|
&mut self,
|
||||||
instructions: impl Iterator<Item = (&'a Pubkey, &'a CompiledInstruction)>,
|
instructions: impl Iterator<Item = (&'a Pubkey, &'a CompiledInstruction)>,
|
||||||
default_units_per_instruction: bool,
|
default_units_per_instruction: bool,
|
||||||
support_set_compute_unit_price_ix: bool,
|
|
||||||
) -> Result<PrioritizationFeeDetails, TransactionError> {
|
) -> Result<PrioritizationFeeDetails, TransactionError> {
|
||||||
let mut num_non_compute_budget_instructions: usize = 0;
|
let mut num_non_compute_budget_instructions: usize = 0;
|
||||||
let mut updated_compute_unit_limit = None;
|
let mut updated_compute_unit_limit = None;
|
||||||
|
@ -136,70 +135,47 @@ impl ComputeBudget {
|
||||||
|
|
||||||
for (i, (program_id, instruction)) in instructions.enumerate() {
|
for (i, (program_id, instruction)) in instructions.enumerate() {
|
||||||
if compute_budget::check_id(program_id) {
|
if compute_budget::check_id(program_id) {
|
||||||
if support_set_compute_unit_price_ix {
|
let invalid_instruction_data_error = TransactionError::InstructionError(
|
||||||
let invalid_instruction_data_error = TransactionError::InstructionError(
|
i as u8,
|
||||||
i as u8,
|
InstructionError::InvalidInstructionData,
|
||||||
InstructionError::InvalidInstructionData,
|
);
|
||||||
);
|
let duplicate_instruction_error = TransactionError::DuplicateInstruction(i as u8);
|
||||||
let duplicate_instruction_error =
|
|
||||||
TransactionError::DuplicateInstruction(i as u8);
|
|
||||||
|
|
||||||
match try_from_slice_unchecked(&instruction.data) {
|
match try_from_slice_unchecked(&instruction.data) {
|
||||||
Ok(ComputeBudgetInstruction::RequestUnitsDeprecated {
|
Ok(ComputeBudgetInstruction::RequestUnitsDeprecated {
|
||||||
units: compute_unit_limit,
|
units: compute_unit_limit,
|
||||||
additional_fee,
|
additional_fee,
|
||||||
}) => {
|
}) => {
|
||||||
if updated_compute_unit_limit.is_some() {
|
if updated_compute_unit_limit.is_some() {
|
||||||
return Err(duplicate_instruction_error);
|
return Err(duplicate_instruction_error);
|
||||||
}
|
|
||||||
if prioritization_fee.is_some() {
|
|
||||||
return Err(duplicate_instruction_error);
|
|
||||||
}
|
|
||||||
updated_compute_unit_limit = Some(compute_unit_limit);
|
|
||||||
prioritization_fee =
|
|
||||||
Some(PrioritizationFeeType::Deprecated(additional_fee as u64));
|
|
||||||
}
|
}
|
||||||
Ok(ComputeBudgetInstruction::RequestHeapFrame(bytes)) => {
|
if prioritization_fee.is_some() {
|
||||||
if requested_heap_size.is_some() {
|
return Err(duplicate_instruction_error);
|
||||||
return Err(duplicate_instruction_error);
|
|
||||||
}
|
|
||||||
requested_heap_size = Some((bytes, i as u8));
|
|
||||||
}
|
}
|
||||||
Ok(ComputeBudgetInstruction::SetComputeUnitLimit(compute_unit_limit)) => {
|
updated_compute_unit_limit = Some(compute_unit_limit);
|
||||||
if updated_compute_unit_limit.is_some() {
|
prioritization_fee =
|
||||||
return Err(duplicate_instruction_error);
|
Some(PrioritizationFeeType::Deprecated(additional_fee as u64));
|
||||||
}
|
|
||||||
updated_compute_unit_limit = Some(compute_unit_limit);
|
|
||||||
}
|
|
||||||
Ok(ComputeBudgetInstruction::SetComputeUnitPrice(micro_lamports)) => {
|
|
||||||
if prioritization_fee.is_some() {
|
|
||||||
return Err(duplicate_instruction_error);
|
|
||||||
}
|
|
||||||
prioritization_fee =
|
|
||||||
Some(PrioritizationFeeType::ComputeUnitPrice(micro_lamports));
|
|
||||||
}
|
|
||||||
_ => return Err(invalid_instruction_data_error),
|
|
||||||
}
|
}
|
||||||
} else if i < 3 {
|
Ok(ComputeBudgetInstruction::RequestHeapFrame(bytes)) => {
|
||||||
match try_from_slice_unchecked(&instruction.data) {
|
if requested_heap_size.is_some() {
|
||||||
Ok(ComputeBudgetInstruction::RequestUnitsDeprecated {
|
return Err(duplicate_instruction_error);
|
||||||
units: compute_unit_limit,
|
|
||||||
additional_fee,
|
|
||||||
}) => {
|
|
||||||
updated_compute_unit_limit = Some(compute_unit_limit);
|
|
||||||
prioritization_fee =
|
|
||||||
Some(PrioritizationFeeType::Deprecated(additional_fee as u64));
|
|
||||||
}
|
|
||||||
Ok(ComputeBudgetInstruction::RequestHeapFrame(bytes)) => {
|
|
||||||
requested_heap_size = Some((bytes, 0));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return Err(TransactionError::InstructionError(
|
|
||||||
0,
|
|
||||||
InstructionError::InvalidInstructionData,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
requested_heap_size = Some((bytes, i as u8));
|
||||||
}
|
}
|
||||||
|
Ok(ComputeBudgetInstruction::SetComputeUnitLimit(compute_unit_limit)) => {
|
||||||
|
if updated_compute_unit_limit.is_some() {
|
||||||
|
return Err(duplicate_instruction_error);
|
||||||
|
}
|
||||||
|
updated_compute_unit_limit = Some(compute_unit_limit);
|
||||||
|
}
|
||||||
|
Ok(ComputeBudgetInstruction::SetComputeUnitPrice(micro_lamports)) => {
|
||||||
|
if prioritization_fee.is_some() {
|
||||||
|
return Err(duplicate_instruction_error);
|
||||||
|
}
|
||||||
|
prioritization_fee =
|
||||||
|
Some(PrioritizationFeeType::ComputeUnitPrice(micro_lamports));
|
||||||
|
}
|
||||||
|
_ => return Err(invalid_instruction_data_error),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// only include non-request instructions in default max calc
|
// only include non-request instructions in default max calc
|
||||||
|
@ -255,19 +231,8 @@ mod tests {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn request_units_deprecated(units: u32, additional_fee: u32) -> Instruction {
|
|
||||||
Instruction::new_with_borsh(
|
|
||||||
compute_budget::id(),
|
|
||||||
&ComputeBudgetInstruction::RequestUnitsDeprecated {
|
|
||||||
units,
|
|
||||||
additional_fee,
|
|
||||||
},
|
|
||||||
vec![],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! test {
|
macro_rules! test {
|
||||||
( $instructions: expr, $expected_result: expr, $expected_budget: expr, $type_change: expr ) => {
|
( $instructions: expr, $expected_result: expr, $expected_budget: expr ) => {
|
||||||
let payer_keypair = Keypair::new();
|
let payer_keypair = Keypair::new();
|
||||||
let tx = SanitizedTransaction::from_transaction_for_tests(Transaction::new(
|
let tx = SanitizedTransaction::from_transaction_for_tests(Transaction::new(
|
||||||
&[&payer_keypair],
|
&[&payer_keypair],
|
||||||
|
@ -275,16 +240,13 @@ mod tests {
|
||||||
Hash::default(),
|
Hash::default(),
|
||||||
));
|
));
|
||||||
let mut compute_budget = ComputeBudget::default();
|
let mut compute_budget = ComputeBudget::default();
|
||||||
let result = compute_budget.process_instructions(
|
let result =
|
||||||
tx.message().program_instructions_iter(),
|
compute_budget.process_instructions(tx.message().program_instructions_iter(), true);
|
||||||
true,
|
|
||||||
$type_change,
|
|
||||||
);
|
|
||||||
assert_eq!($expected_result, result);
|
assert_eq!($expected_result, result);
|
||||||
assert_eq!(compute_budget, $expected_budget);
|
assert_eq!(compute_budget, $expected_budget);
|
||||||
};
|
};
|
||||||
( $instructions: expr, $expected_result: expr, $expected_budget: expr) => {
|
( $instructions: expr, $expected_result: expr, $expected_budget: expr) => {
|
||||||
test!($instructions, $expected_result, $expected_budget, true);
|
test!($instructions, $expected_result, $expected_budget);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,35 +308,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
test!(
|
|
||||||
&[
|
|
||||||
Instruction::new_with_bincode(Pubkey::new_unique(), &0_u8, vec![]),
|
|
||||||
Instruction::new_with_bincode(Pubkey::new_unique(), &0_u8, vec![]),
|
|
||||||
Instruction::new_with_bincode(Pubkey::new_unique(), &0_u8, vec![]),
|
|
||||||
ComputeBudgetInstruction::set_compute_unit_limit(1), // ignored
|
|
||||||
],
|
|
||||||
Ok(PrioritizationFeeDetails::default()),
|
|
||||||
ComputeBudget {
|
|
||||||
compute_unit_limit: DEFAULT_INSTRUCTION_COMPUTE_UNIT_LIMIT as u64 * 3,
|
|
||||||
..ComputeBudget::default()
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// Prioritization fee
|
|
||||||
test!(
|
|
||||||
&[request_units_deprecated(1, 42)],
|
|
||||||
Ok(PrioritizationFeeDetails::new(
|
|
||||||
PrioritizationFeeType::Deprecated(42),
|
|
||||||
1,
|
|
||||||
)),
|
|
||||||
ComputeBudget {
|
|
||||||
compute_unit_limit: 1,
|
|
||||||
..ComputeBudget::default()
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
test!(
|
test!(
|
||||||
&[
|
&[
|
||||||
ComputeBudgetInstruction::set_compute_unit_limit(1),
|
ComputeBudgetInstruction::set_compute_unit_limit(1),
|
||||||
|
@ -390,19 +323,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
test!(
|
|
||||||
&[request_units_deprecated(1, u32::MAX)],
|
|
||||||
Ok(PrioritizationFeeDetails::new(
|
|
||||||
PrioritizationFeeType::Deprecated(u32::MAX as u64),
|
|
||||||
1
|
|
||||||
)),
|
|
||||||
ComputeBudget {
|
|
||||||
compute_unit_limit: 1,
|
|
||||||
..ComputeBudget::default()
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// HeapFrame
|
// HeapFrame
|
||||||
test!(
|
test!(
|
||||||
&[],
|
&[],
|
||||||
|
@ -520,21 +440,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
test!(
|
|
||||||
&[
|
|
||||||
Instruction::new_with_bincode(Pubkey::new_unique(), &0_u8, vec![]),
|
|
||||||
ComputeBudgetInstruction::request_heap_frame(MAX_HEAP_FRAME_BYTES),
|
|
||||||
ComputeBudgetInstruction::set_compute_unit_limit(MAX_COMPUTE_UNIT_LIMIT),
|
|
||||||
ComputeBudgetInstruction::set_compute_unit_price(u64::MAX),
|
|
||||||
],
|
|
||||||
Err(TransactionError::InstructionError(
|
|
||||||
0,
|
|
||||||
InstructionError::InvalidInstructionData,
|
|
||||||
)),
|
|
||||||
ComputeBudget::default(),
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
test!(
|
test!(
|
||||||
&[
|
&[
|
||||||
Instruction::new_with_bincode(Pubkey::new_unique(), &0_u8, vec![]),
|
Instruction::new_with_bincode(Pubkey::new_unique(), &0_u8, vec![]),
|
||||||
|
@ -553,24 +458,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
test!(
|
|
||||||
&[
|
|
||||||
Instruction::new_with_bincode(Pubkey::new_unique(), &0_u8, vec![]),
|
|
||||||
request_units_deprecated(MAX_COMPUTE_UNIT_LIMIT, u32::MAX),
|
|
||||||
ComputeBudgetInstruction::request_heap_frame(MIN_HEAP_FRAME_BYTES as u32),
|
|
||||||
],
|
|
||||||
Ok(PrioritizationFeeDetails::new(
|
|
||||||
PrioritizationFeeType::Deprecated(u32::MAX as u64),
|
|
||||||
MAX_COMPUTE_UNIT_LIMIT as u64,
|
|
||||||
)),
|
|
||||||
ComputeBudget {
|
|
||||||
compute_unit_limit: MAX_COMPUTE_UNIT_LIMIT as u64,
|
|
||||||
heap_size: Some(MIN_HEAP_FRAME_BYTES as usize),
|
|
||||||
..ComputeBudget::default()
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// Duplicates
|
// Duplicates
|
||||||
test!(
|
test!(
|
||||||
&[
|
&[
|
||||||
|
|
|
@ -3798,7 +3798,6 @@ fn test_program_fees() {
|
||||||
congestion_multiplier,
|
congestion_multiplier,
|
||||||
&fee_structure,
|
&fee_structure,
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
bank_client
|
bank_client
|
||||||
.send_and_confirm_message(&[&mint_keypair], message)
|
.send_and_confirm_message(&[&mint_keypair], message)
|
||||||
|
@ -3820,7 +3819,6 @@ fn test_program_fees() {
|
||||||
congestion_multiplier,
|
congestion_multiplier,
|
||||||
&fee_structure,
|
&fee_structure,
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
assert!(expected_normal_fee < expected_prioritized_fee);
|
assert!(expected_normal_fee < expected_prioritized_fee);
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,7 @@ use {
|
||||||
account_utils::StateMut,
|
account_utils::StateMut,
|
||||||
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
||||||
clock::{BankId, Slot, INITIAL_RENT_EPOCH},
|
clock::{BankId, Slot, INITIAL_RENT_EPOCH},
|
||||||
feature_set::{
|
feature_set::{self, use_default_units_in_fee_calculation, FeatureSet},
|
||||||
self, add_set_compute_unit_price_ix, use_default_units_in_fee_calculation, FeatureSet,
|
|
||||||
},
|
|
||||||
fee::FeeStructure,
|
fee::FeeStructure,
|
||||||
genesis_config::ClusterType,
|
genesis_config::ClusterType,
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
|
@ -554,7 +552,6 @@ impl Accounts {
|
||||||
tx.message(),
|
tx.message(),
|
||||||
lamports_per_signature,
|
lamports_per_signature,
|
||||||
fee_structure,
|
fee_structure,
|
||||||
feature_set.is_active(&add_set_compute_unit_price_ix::id()),
|
|
||||||
feature_set.is_active(&use_default_units_in_fee_calculation::id()),
|
feature_set.is_active(&use_default_units_in_fee_calculation::id()),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1674,7 +1671,6 @@ mod tests {
|
||||||
lamports_per_signature,
|
lamports_per_signature,
|
||||||
&FeeStructure::default(),
|
&FeeStructure::default(),
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
assert_eq!(fee, lamports_per_signature);
|
assert_eq!(fee, lamports_per_signature);
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,7 @@ use {
|
||||||
epoch_schedule::EpochSchedule,
|
epoch_schedule::EpochSchedule,
|
||||||
feature,
|
feature,
|
||||||
feature_set::{
|
feature_set::{
|
||||||
self, add_set_compute_unit_price_ix, disable_fee_calculator,
|
self, disable_fee_calculator, enable_early_verification_of_account_modifications,
|
||||||
enable_early_verification_of_account_modifications,
|
|
||||||
use_default_units_in_fee_calculation, FeatureSet,
|
use_default_units_in_fee_calculation, FeatureSet,
|
||||||
},
|
},
|
||||||
fee::FeeStructure,
|
fee::FeeStructure,
|
||||||
|
@ -3683,8 +3682,6 @@ impl Bank {
|
||||||
message,
|
message,
|
||||||
lamports_per_signature,
|
lamports_per_signature,
|
||||||
&self.fee_structure,
|
&self.fee_structure,
|
||||||
self.feature_set
|
|
||||||
.is_active(&add_set_compute_unit_price_ix::id()),
|
|
||||||
self.feature_set
|
self.feature_set
|
||||||
.is_active(&use_default_units_in_fee_calculation::id()),
|
.is_active(&use_default_units_in_fee_calculation::id()),
|
||||||
))
|
))
|
||||||
|
@ -3726,8 +3723,6 @@ impl Bank {
|
||||||
message,
|
message,
|
||||||
lamports_per_signature,
|
lamports_per_signature,
|
||||||
&self.fee_structure,
|
&self.fee_structure,
|
||||||
self.feature_set
|
|
||||||
.is_active(&add_set_compute_unit_price_ix::id()),
|
|
||||||
self.feature_set
|
self.feature_set
|
||||||
.is_active(&use_default_units_in_fee_calculation::id()),
|
.is_active(&use_default_units_in_fee_calculation::id()),
|
||||||
)
|
)
|
||||||
|
@ -4536,40 +4531,30 @@ impl Bank {
|
||||||
.map(|(accs, tx)| match accs {
|
.map(|(accs, tx)| match accs {
|
||||||
(Err(e), _nonce) => TransactionExecutionResult::NotExecuted(e.clone()),
|
(Err(e), _nonce) => TransactionExecutionResult::NotExecuted(e.clone()),
|
||||||
(Ok(loaded_transaction), nonce) => {
|
(Ok(loaded_transaction), nonce) => {
|
||||||
let mut feature_set_clone_time = Measure::start("feature_set_clone");
|
let compute_budget = if let Some(compute_budget) =
|
||||||
let feature_set = self.feature_set.clone();
|
self.runtime_config.compute_budget
|
||||||
feature_set_clone_time.stop();
|
{
|
||||||
saturating_add_assign!(
|
compute_budget
|
||||||
timings.execute_accessories.feature_set_clone_us,
|
} else {
|
||||||
feature_set_clone_time.as_us()
|
let mut compute_budget =
|
||||||
);
|
ComputeBudget::new(compute_budget::MAX_COMPUTE_UNIT_LIMIT as u64);
|
||||||
|
|
||||||
let compute_budget =
|
let mut compute_budget_process_transaction_time =
|
||||||
if let Some(compute_budget) = self.runtime_config.compute_budget {
|
Measure::start("compute_budget_process_transaction_time");
|
||||||
compute_budget
|
let process_transaction_result = compute_budget
|
||||||
} else {
|
.process_instructions(tx.message().program_instructions_iter(), true);
|
||||||
let mut compute_budget =
|
compute_budget_process_transaction_time.stop();
|
||||||
ComputeBudget::new(compute_budget::MAX_COMPUTE_UNIT_LIMIT as u64);
|
saturating_add_assign!(
|
||||||
|
timings
|
||||||
let mut compute_budget_process_transaction_time =
|
.execute_accessories
|
||||||
Measure::start("compute_budget_process_transaction_time");
|
.compute_budget_process_transaction_us,
|
||||||
let process_transaction_result = compute_budget.process_instructions(
|
compute_budget_process_transaction_time.as_us()
|
||||||
tx.message().program_instructions_iter(),
|
);
|
||||||
true,
|
if let Err(err) = process_transaction_result {
|
||||||
feature_set.is_active(&add_set_compute_unit_price_ix::id()),
|
return TransactionExecutionResult::NotExecuted(err);
|
||||||
);
|
}
|
||||||
compute_budget_process_transaction_time.stop();
|
compute_budget
|
||||||
saturating_add_assign!(
|
};
|
||||||
timings
|
|
||||||
.execute_accessories
|
|
||||||
.compute_budget_process_transaction_us,
|
|
||||||
compute_budget_process_transaction_time.as_us()
|
|
||||||
);
|
|
||||||
if let Err(err) = process_transaction_result {
|
|
||||||
return TransactionExecutionResult::NotExecuted(err);
|
|
||||||
}
|
|
||||||
compute_budget
|
|
||||||
};
|
|
||||||
|
|
||||||
self.execute_loaded_transaction(
|
self.execute_loaded_transaction(
|
||||||
tx,
|
tx,
|
||||||
|
@ -4841,7 +4826,6 @@ impl Bank {
|
||||||
message: &SanitizedMessage,
|
message: &SanitizedMessage,
|
||||||
lamports_per_signature: u64,
|
lamports_per_signature: u64,
|
||||||
fee_structure: &FeeStructure,
|
fee_structure: &FeeStructure,
|
||||||
support_set_compute_unit_price_ix: bool,
|
|
||||||
use_default_units_per_instruction: bool,
|
use_default_units_per_instruction: bool,
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
// Fee based on compute units and signatures
|
// Fee based on compute units and signatures
|
||||||
|
@ -4858,7 +4842,6 @@ impl Bank {
|
||||||
.process_instructions(
|
.process_instructions(
|
||||||
message.program_instructions_iter(),
|
message.program_instructions_iter(),
|
||||||
use_default_units_per_instruction,
|
use_default_units_per_instruction,
|
||||||
support_set_compute_unit_price_ix,
|
|
||||||
)
|
)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let prioritization_fee = prioritization_fee_details.get_fee();
|
let prioritization_fee = prioritization_fee_details.get_fee();
|
||||||
|
@ -4922,8 +4905,6 @@ impl Bank {
|
||||||
tx.message(),
|
tx.message(),
|
||||||
lamports_per_signature,
|
lamports_per_signature,
|
||||||
&self.fee_structure,
|
&self.fee_structure,
|
||||||
self.feature_set
|
|
||||||
.is_active(&add_set_compute_unit_price_ix::id()),
|
|
||||||
self.feature_set
|
self.feature_set
|
||||||
.is_active(&use_default_units_in_fee_calculation::id()),
|
.is_active(&use_default_units_in_fee_calculation::id()),
|
||||||
);
|
);
|
||||||
|
@ -10893,7 +10874,6 @@ pub(crate) mod tests {
|
||||||
.lamports_per_signature,
|
.lamports_per_signature,
|
||||||
&FeeStructure::default(),
|
&FeeStructure::default(),
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let (expected_fee_collected, expected_fee_burned) =
|
let (expected_fee_collected, expected_fee_burned) =
|
||||||
|
@ -11075,7 +11055,6 @@ pub(crate) mod tests {
|
||||||
cheap_lamports_per_signature,
|
cheap_lamports_per_signature,
|
||||||
&FeeStructure::default(),
|
&FeeStructure::default(),
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
bank.get_balance(&mint_keypair.pubkey()),
|
bank.get_balance(&mint_keypair.pubkey()),
|
||||||
|
@ -11093,7 +11072,6 @@ pub(crate) mod tests {
|
||||||
expensive_lamports_per_signature,
|
expensive_lamports_per_signature,
|
||||||
&FeeStructure::default(),
|
&FeeStructure::default(),
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
bank.get_balance(&mint_keypair.pubkey()),
|
bank.get_balance(&mint_keypair.pubkey()),
|
||||||
|
@ -11209,7 +11187,6 @@ pub(crate) mod tests {
|
||||||
.lamports_per_signature,
|
.lamports_per_signature,
|
||||||
&FeeStructure::default(),
|
&FeeStructure::default(),
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
) * 2
|
) * 2
|
||||||
)
|
)
|
||||||
.0
|
.0
|
||||||
|
@ -17809,7 +17786,6 @@ pub(crate) mod tests {
|
||||||
..FeeStructure::default()
|
..FeeStructure::default()
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
@ -17824,7 +17800,6 @@ pub(crate) mod tests {
|
||||||
..FeeStructure::default()
|
..FeeStructure::default()
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
@ -17844,7 +17819,6 @@ pub(crate) mod tests {
|
||||||
..FeeStructure::default()
|
..FeeStructure::default()
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
|
@ -17864,7 +17838,7 @@ pub(crate) mod tests {
|
||||||
let message =
|
let message =
|
||||||
SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap();
|
SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Bank::calculate_fee(&message, 1, &fee_structure, true, true,),
|
Bank::calculate_fee(&message, 1, &fee_structure, true),
|
||||||
max_fee + lamports_per_signature
|
max_fee + lamports_per_signature
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -17876,7 +17850,7 @@ pub(crate) mod tests {
|
||||||
SanitizedMessage::try_from(Message::new(&[ix0, ix1], Some(&Pubkey::new_unique())))
|
SanitizedMessage::try_from(Message::new(&[ix0, ix1], Some(&Pubkey::new_unique())))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Bank::calculate_fee(&message, 1, &fee_structure, true, true,),
|
Bank::calculate_fee(&message, 1, &fee_structure, true),
|
||||||
max_fee + 3 * lamports_per_signature
|
max_fee + 3 * lamports_per_signature
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -17909,7 +17883,7 @@ pub(crate) mod tests {
|
||||||
Some(&Pubkey::new_unique()),
|
Some(&Pubkey::new_unique()),
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let fee = Bank::calculate_fee(&message, 1, &fee_structure, true, true);
|
let fee = Bank::calculate_fee(&message, 1, &fee_structure, true);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
fee,
|
fee,
|
||||||
lamports_per_signature + prioritization_fee_details.get_fee()
|
lamports_per_signature + prioritization_fee_details.get_fee()
|
||||||
|
@ -17947,10 +17921,7 @@ pub(crate) mod tests {
|
||||||
Some(&key0),
|
Some(&key0),
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(Bank::calculate_fee(&message, 1, &fee_structure, true), 2);
|
||||||
Bank::calculate_fee(&message, 1, &fee_structure, true, true,),
|
|
||||||
2
|
|
||||||
);
|
|
||||||
|
|
||||||
secp_instruction1.data = vec![0];
|
secp_instruction1.data = vec![0];
|
||||||
secp_instruction2.data = vec![10];
|
secp_instruction2.data = vec![10];
|
||||||
|
@ -17959,10 +17930,7 @@ pub(crate) mod tests {
|
||||||
Some(&key0),
|
Some(&key0),
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(Bank::calculate_fee(&message, 1, &fee_structure, true), 11);
|
||||||
Bank::calculate_fee(&message, 1, &fee_structure, true, true,),
|
|
||||||
11
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue