Skip to content

Commit

Permalink
use SanitizedMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-stones committed Dec 20, 2023
1 parent 0167f3e commit 7e8bfbb
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions cost-model/src/cost_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ use {
solana_sdk::{
borsh1::try_from_slice_unchecked,
compute_budget::{self, ComputeBudgetInstruction},
ed25519_program,
feature_set::{include_loaded_accounts_data_size_in_fee_calculation, FeatureSet},
fee::FeeStructure,
instruction::CompiledInstruction,
program_utils::limited_deserialize,
pubkey::Pubkey,
secp256k1_program,
system_instruction::SystemInstruction,
system_program,
transaction::SanitizedTransaction,
Expand Down Expand Up @@ -86,7 +84,7 @@ impl CostModel {
let mut loaded_accounts_data_size_cost = 0u64;
let mut data_bytes_len_total = 0u64;
let mut compute_unit_limit_is_set = false;
let mut num_signatures = transaction.signatures().len() as u64;
let num_signatures = transaction.message().num_signatures();

for (program_id, instruction) in transaction.message().program_instructions_iter() {
// to keep the same behavior, look for builtin first
Expand All @@ -107,12 +105,6 @@ impl CostModel {
compute_unit_limit_is_set = true;
}
}

if (secp256k1_program::check_id(program_id) || ed25519_program::check_id(program_id))
&& !instruction.data.is_empty()
{
num_signatures = num_signatures.saturating_add(instruction.data[0] as u64);
}
}

// calculate bpf cost based on compute budget instructions
Expand Down

0 comments on commit 7e8bfbb

Please sign in to comment.