From 7e8bfbbb726e2a40805fc3e72254d88ec923e5e4 Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Wed, 20 Dec 2023 23:36:45 +0000 Subject: [PATCH] use SanitizedMessage --- cost-model/src/cost_model.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cost-model/src/cost_model.rs b/cost-model/src/cost_model.rs index 9d3b3009b4220e..79ce7a82ad5438 100644 --- a/cost-model/src/cost_model.rs +++ b/cost-model/src/cost_model.rs @@ -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, @@ -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 @@ -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