From 3ff488a668a4abe95f275929780e8a6c8b07027c Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 19 Dec 2024 19:06:43 +0400 Subject: [PATCH 1/2] remove solana-sdk from cost-model --- Cargo.lock | 19 +++- cost-model/Cargo.toml | 37 ++++++-- cost-model/benches/cost_model.rs | 20 ++--- cost-model/benches/cost_tracker.rs | 2 +- cost-model/src/cost_model.rs | 93 +++++++++----------- cost-model/src/cost_tracker.rs | 136 ++++++++++++----------------- cost-model/src/transaction_cost.rs | 39 ++++----- 7 files changed, 176 insertions(+), 170 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8df165733c5c87..baa396209e402a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6864,20 +6864,37 @@ dependencies = [ "lazy_static", "log", "rand 0.8.5", + "solana-bincode", + "solana-borsh", "solana-builtins-default-costs", "solana-compute-budget", "solana-compute-budget-instruction", + "solana-compute-budget-interface", "solana-compute-budget-program", "solana-cost-model", "solana-feature-set", + "solana-fee-structure", "solana-frozen-abi", "solana-frozen-abi-macro", + "solana-hash", + "solana-instruction", + "solana-keypair", "solana-logger", + "solana-message", "solana-metrics", + "solana-packet", + "solana-pubkey", + "solana-reserved-account-keys", "solana-runtime-transaction", - "solana-sdk", + "solana-sdk-ids", + "solana-signature", + "solana-signer", "solana-svm-transaction", + "solana-system-interface", "solana-system-program", + "solana-system-transaction", + "solana-transaction", + "solana-transaction-error", "solana-vote-program", "static_assertions", "test-case", diff --git a/cost-model/Cargo.toml b/cost-model/Cargo.toml index 1e0593daedeeaa..4554e54c65302c 100644 --- a/cost-model/Cargo.toml +++ b/cost-model/Cargo.toml @@ -13,20 +13,32 @@ edition = { workspace = true } ahash = { workspace = true } lazy_static = { workspace = true } log = { workspace = true } +solana-bincode = { workspace = true } +solana-borsh = { workspace = true } solana-builtins-default-costs = { workspace = true } solana-compute-budget = { workspace = true } solana-compute-budget-instruction = { workspace = true } +solana-compute-budget-interface = { workspace = true } solana-feature-set = { workspace = true } +solana-fee-structure = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ "frozen-abi", ] } solana-frozen-abi-macro = { workspace = true, optional = true, features = [ "frozen-abi", ] } +solana-hash = { workspace = true, optional = true } +solana-message = { workspace = true, optional = true } solana-metrics = { workspace = true } +solana-packet = { workspace = true } +solana-pubkey = { workspace = true } solana-runtime-transaction = { workspace = true } -solana-sdk = { workspace = true } +solana-sdk-ids = { workspace = true } +solana-signature = { workspace = true, optional = true } solana-svm-transaction = { workspace = true } +solana-system-interface = { workspace = true } +solana-transaction = { workspace = true, optional = true } +solana-transaction-error = { workspace = true } solana-vote-program = { workspace = true } [lib] @@ -37,15 +49,22 @@ name = "solana_cost_model" itertools = { workspace = true } rand = "0.8.5" # See order-crates-for-publishing.py for using this unusual `path = "."` -solana-compute-budget-instruction = { workspace = true, features = ["dev-context-only-utils"] } +solana-compute-budget-instruction = { workspace = true, features = [ + "dev-context-only-utils", +] } +solana-compute-budget-interface = { workspace = true } solana-compute-budget-program = { workspace = true } solana-cost-model = { path = ".", features = ["dev-context-only-utils"] } +solana-instruction = { workspace = true } +solana-keypair = { workspace = true } solana-logger = { workspace = true } +solana-reserved-account-keys = { workspace = true } solana-runtime-transaction = { workspace = true, features = [ "dev-context-only-utils", ] } -solana-sdk = { workspace = true, features = ["dev-context-only-utils"] } +solana-signer = { workspace = true } solana-system-program = { workspace = true } +solana-system-transaction = { workspace = true } static_assertions = { workspace = true } test-case = { workspace = true } @@ -53,13 +72,19 @@ test-case = { workspace = true } targets = ["x86_64-unknown-linux-gnu"] [features] -dev-context-only-utils = [] +dev-context-only-utils = [ + "dep:solana-hash", + "dep:solana-message", + "dep:solana-signature", + "dep:solana-transaction", + "solana-compute-budget-interface/dev-context-only-utils" +] frozen-abi = [ "dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "solana-compute-budget/frozen-abi", - "solana-sdk/frozen-abi", - "solana-vote-program/frozen-abi", + "solana-pubkey/frozen-abi", + "solana-vote-program/frozen-abi" ] [[bench]] diff --git a/cost-model/benches/cost_model.rs b/cost-model/benches/cost_model.rs index 50882835f3e6f0..63bb5b9560eba4 100644 --- a/cost-model/benches/cost_model.rs +++ b/cost-model/benches/cost_model.rs @@ -2,17 +2,15 @@ extern crate test; use { solana_cost_model::cost_model::CostModel, + solana_feature_set::FeatureSet, + solana_hash::Hash, + solana_keypair::Keypair, + solana_message::Message, + solana_pubkey::Pubkey, solana_runtime_transaction::runtime_transaction::RuntimeTransaction, - solana_sdk::{ - feature_set::FeatureSet, - hash::Hash, - message::Message, - pubkey::Pubkey, - signature::Keypair, - signer::Signer, - system_instruction, - transaction::{SanitizedTransaction, Transaction}, - }, + solana_signer::Signer, + solana_system_interface::instruction as system_instruction, + solana_transaction::{sanitized::SanitizedTransaction, Transaction}, test::Bencher, }; @@ -66,7 +64,7 @@ fn bench_cost_model_requested_write_locks(bencher: &mut Bencher) { mut feature_set, } = setup(NUM_TRANSACTIONS_PER_ITER); feature_set.activate( - &solana_sdk::feature_set::cost_model_requested_write_lock_cost::id(), + &solana_feature_set::cost_model_requested_write_lock_cost::id(), 0, ); diff --git a/cost-model/benches/cost_tracker.rs b/cost-model/benches/cost_tracker.rs index f5335fe88af8cf..5b37ef4fd952e5 100644 --- a/cost-model/benches/cost_tracker.rs +++ b/cost-model/benches/cost_tracker.rs @@ -6,7 +6,7 @@ use { cost_tracker::CostTracker, transaction_cost::{TransactionCost, UsageCostDetails, WritableKeysTransaction}, }, - solana_sdk::pubkey::Pubkey, + solana_pubkey::Pubkey, test::Bencher, }; diff --git a/cost-model/src/cost_model.rs b/cost-model/src/cost_model.rs index f958ce6cb4eed1..bad2d3a2cdda3c 100644 --- a/cost-model/src/cost_model.rs +++ b/cost-model/src/cost_model.rs @@ -7,28 +7,26 @@ use { crate::{block_cost_limits::*, transaction_cost::*}, + solana_bincode::limited_deserialize, + solana_borsh::v1::try_from_slice_unchecked, solana_builtins_default_costs::get_builtin_instruction_cost, solana_compute_budget::compute_budget_limits::{ DEFAULT_HEAP_COST, DEFAULT_INSTRUCTION_COMPUTE_UNIT_LIMIT, MAX_COMPUTE_UNIT_LIMIT, }, + solana_compute_budget_interface::ComputeBudgetInstruction, solana_feature_set::{self as feature_set, FeatureSet}, + solana_fee_structure::FeeStructure, + solana_pubkey::Pubkey, solana_runtime_transaction::{ transaction_meta::StaticMeta, transaction_with_meta::TransactionWithMeta, }, - solana_sdk::{ - borsh1::try_from_slice_unchecked, - compute_budget::{self, ComputeBudgetInstruction}, - fee::FeeStructure, - program_utils::limited_deserialize, - pubkey::Pubkey, - saturating_add_assign, - system_instruction::{ - SystemInstruction, MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION, - MAX_PERMITTED_DATA_LENGTH, - }, - system_program, - }, + solana_sdk_ids::{compute_budget, system_program}, solana_svm_transaction::{instruction::SVMInstruction, svm_message::SVMMessage}, + solana_system_interface::{ + instruction::SystemInstruction, MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION, + MAX_PERMITTED_DATA_LENGTH, + }, + std::num::Saturating, }; pub struct CostModel; @@ -359,7 +357,9 @@ impl CostModel { instruction: SVMInstruction, ) -> SystemProgramAccountAllocation { if program_id == &system_program::id() { - if let Ok(instruction) = limited_deserialize(instruction.data) { + if let Ok(instruction) = + limited_deserialize(instruction.data, solana_packet::PACKET_DATA_SIZE as u64) + { Self::calculate_account_data_size_on_deserialized_system_instruction(instruction) } else { SystemProgramAccountAllocation::Failed @@ -374,7 +374,7 @@ impl CostModel { fn calculate_allocated_accounts_data_size<'a>( instructions: impl Iterator)>, ) -> u64 { - let mut tx_attempted_allocation_size: u64 = 0; + let mut tx_attempted_allocation_size = Saturating(0u64); for (program_id, instruction) in instructions { match Self::calculate_account_data_size_on_instruction(program_id, instruction) { SystemProgramAccountAllocation::Failed => { @@ -387,10 +387,7 @@ impl CostModel { } SystemProgramAccountAllocation::None => continue, SystemProgramAccountAllocation::Some(ix_attempted_allocation_size) => { - saturating_add_assign!( - tx_attempted_allocation_size, - ix_attempted_allocation_size - ); + tx_attempted_allocation_size += ix_attempted_allocation_size; } } } @@ -404,7 +401,7 @@ impl CostModel { // shouldn't assume that a large sum of allocations will necessarily // lead to transaction failure. (MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION as u64) - .min(tx_attempted_allocation_size) + .min(tx_attempted_allocation_size.0) } } @@ -413,21 +410,24 @@ mod tests { use { super::*, itertools::Itertools, - solana_compute_budget::compute_budget_limits::{ - DEFAULT_INSTRUCTION_COMPUTE_UNIT_LIMIT, MAX_BUILTIN_ALLOCATION_COMPUTE_UNIT_LIMIT, + solana_compute_budget::{ + compute_budget_limits::{ + DEFAULT_INSTRUCTION_COMPUTE_UNIT_LIMIT, MAX_BUILTIN_ALLOCATION_COMPUTE_UNIT_LIMIT, + }, + {self}, }, + solana_compute_budget_interface::ComputeBudgetInstruction, + solana_fee_structure::ACCOUNT_DATA_COST_PAGE_SIZE, + solana_hash::Hash, + solana_instruction::Instruction, + solana_keypair::Keypair, + solana_message::{compiled_instruction::CompiledInstruction, Message}, solana_runtime_transaction::runtime_transaction::RuntimeTransaction, - solana_sdk::{ - compute_budget::{self, ComputeBudgetInstruction}, - fee::ACCOUNT_DATA_COST_PAGE_SIZE, - hash::Hash, - instruction::{CompiledInstruction, Instruction}, - message::Message, - signature::{Keypair, Signer}, - system_instruction::{self}, - system_program, system_transaction, - transaction::Transaction, - }, + solana_sdk_ids::system_program, + solana_signer::Signer, + solana_system_interface::instruction::{self as system_instruction}, + solana_system_transaction as system_transaction, + solana_transaction::Transaction, }; fn test_setup() -> (Keypair, Hash) { @@ -653,10 +653,7 @@ mod tests { let instructions = vec![CompiledInstruction::new(3, &(), vec![1, 2, 0])]; let tx = Transaction::new_with_compiled_instructions( &[&mint_keypair], - &[ - solana_sdk::pubkey::new_rand(), - solana_sdk::pubkey::new_rand(), - ], + &[solana_pubkey::new_rand(), solana_pubkey::new_rand()], start_hash, vec![Pubkey::new_unique()], instructions, @@ -728,10 +725,7 @@ mod tests { ]; let tx = Transaction::new_with_compiled_instructions( &[&mint_keypair], - &[ - solana_sdk::pubkey::new_rand(), - solana_sdk::pubkey::new_rand(), - ], + &[solana_pubkey::new_rand(), solana_pubkey::new_rand()], start_hash, vec![Pubkey::new_unique(), compute_budget::id()], instructions, @@ -779,10 +773,7 @@ mod tests { ]; let tx = Transaction::new_with_compiled_instructions( &[&mint_keypair], - &[ - solana_sdk::pubkey::new_rand(), - solana_sdk::pubkey::new_rand(), - ], + &[solana_pubkey::new_rand(), solana_pubkey::new_rand()], start_hash, vec![Pubkey::new_unique(), compute_budget::id()], instructions, @@ -804,8 +795,8 @@ mod tests { fn test_cost_model_transaction_many_transfer_instructions() { let (mint_keypair, start_hash) = test_setup(); - let key1 = solana_sdk::pubkey::new_rand(); - let key2 = solana_sdk::pubkey::new_rand(); + let key1 = solana_pubkey::new_rand(); + let key2 = solana_pubkey::new_rand(); let instructions = system_instruction::transfer_many(&mint_keypair.pubkey(), &[(key1, 1), (key2, 1)]); let message = Message::new(&instructions, Some(&mint_keypair.pubkey())); @@ -838,10 +829,10 @@ mod tests { let (mint_keypair, start_hash) = test_setup(); // construct a transaction with multiple random instructions - let key1 = solana_sdk::pubkey::new_rand(); - let key2 = solana_sdk::pubkey::new_rand(); - let prog1 = solana_sdk::pubkey::new_rand(); - let prog2 = solana_sdk::pubkey::new_rand(); + let key1 = solana_pubkey::new_rand(); + let key2 = solana_pubkey::new_rand(); + let prog1 = solana_pubkey::new_rand(); + let prog2 = solana_pubkey::new_rand(); let instructions = vec![ CompiledInstruction::new(3, &(), vec![0, 1]), CompiledInstruction::new(4, &(), vec![0, 2]), diff --git a/cost-model/src/cost_tracker.rs b/cost-model/src/cost_tracker.rs index 98a6433ebdf698..1baaefe8010b37 100644 --- a/cost-model/src/cost_tracker.rs +++ b/cost-model/src/cost_tracker.rs @@ -6,11 +6,10 @@ use { crate::{block_cost_limits::*, transaction_cost::TransactionCost}, solana_metrics::datapoint_info, + solana_pubkey::Pubkey, solana_runtime_transaction::transaction_with_meta::TransactionWithMeta, - solana_sdk::{ - clock::Slot, pubkey::Pubkey, saturating_add_assign, transaction::TransactionError, - }, - std::{cmp::Ordering, collections::HashMap}, + solana_transaction_error::TransactionError, + std::{cmp::Ordering, collections::HashMap, num::Saturating}, }; const WRITABLE_ACCOUNTS_PER_BLOCK: usize = 4096; @@ -67,15 +66,15 @@ pub struct CostTracker { cost_by_writable_accounts: HashMap, block_cost: u64, vote_cost: u64, - transaction_count: u64, - allocated_accounts_data_size: u64, - transaction_signature_count: u64, - secp256k1_instruction_signature_count: u64, - ed25519_instruction_signature_count: u64, + transaction_count: Saturating, + allocated_accounts_data_size: Saturating, + transaction_signature_count: Saturating, + secp256k1_instruction_signature_count: Saturating, + ed25519_instruction_signature_count: Saturating, /// The number of transactions that have had their estimated cost added to /// the tracker, but are still waiting for an update with actual usage or /// removal if the transaction does not end up getting committed. - in_flight_transaction_count: usize, + in_flight_transaction_count: Saturating, } impl Default for CostTracker { @@ -96,12 +95,12 @@ impl Default for CostTracker { ), block_cost: 0, vote_cost: 0, - transaction_count: 0, - allocated_accounts_data_size: 0, - transaction_signature_count: 0, - secp256k1_instruction_signature_count: 0, - ed25519_instruction_signature_count: 0, - in_flight_transaction_count: 0, + transaction_count: Saturating(0), + allocated_accounts_data_size: Saturating(0), + transaction_signature_count: Saturating(0), + secp256k1_instruction_signature_count: Saturating(0), + ed25519_instruction_signature_count: Saturating(0), + in_flight_transaction_count: Saturating(0), } } } @@ -121,12 +120,12 @@ impl CostTracker { self.cost_by_writable_accounts.clear(); self.block_cost = 0; self.vote_cost = 0; - self.transaction_count = 0; - self.allocated_accounts_data_size = 0; - self.transaction_signature_count = 0; - self.secp256k1_instruction_signature_count = 0; - self.ed25519_instruction_signature_count = 0; - self.in_flight_transaction_count = 0; + self.transaction_count = Saturating(0); + self.allocated_accounts_data_size = Saturating(0); + self.transaction_signature_count = Saturating(0); + self.secp256k1_instruction_signature_count = Saturating(0); + self.ed25519_instruction_signature_count = Saturating(0); + self.in_flight_transaction_count = Saturating(0); } /// Get the overall block limit. @@ -147,20 +146,15 @@ impl CostTracker { } pub fn in_flight_transaction_count(&self) -> usize { - self.in_flight_transaction_count + self.in_flight_transaction_count.0 } pub fn add_transactions_in_flight(&mut self, in_flight_transaction_count: usize) { - saturating_add_assign!( - self.in_flight_transaction_count, - in_flight_transaction_count - ); + self.in_flight_transaction_count += in_flight_transaction_count; } pub fn sub_transactions_in_flight(&mut self, in_flight_transaction_count: usize) { - self.in_flight_transaction_count = self - .in_flight_transaction_count - .saturating_sub(in_flight_transaction_count); + self.in_flight_transaction_count -= in_flight_transaction_count } pub fn try_add( @@ -216,12 +210,12 @@ impl CostTracker { } pub fn transaction_count(&self) -> u64 { - self.transaction_count + self.transaction_count.0 } - pub fn report_stats(&self, bank_slot: Slot) { + pub fn report_stats(&self, bank_slot: u64) { // skip reporting if block is empty - if self.transaction_count == 0 { + if self.transaction_count.0 == 0 { return; } @@ -232,33 +226,33 @@ impl CostTracker { ("bank_slot", bank_slot as i64, i64), ("block_cost", self.block_cost as i64, i64), ("vote_cost", self.vote_cost as i64, i64), - ("transaction_count", self.transaction_count as i64, i64), + ("transaction_count", self.transaction_count.0 as i64, i64), ("number_of_accounts", self.number_of_accounts() as i64, i64), ("costliest_account", costliest_account.to_string(), String), ("costliest_account_cost", costliest_account_cost as i64, i64), ( "allocated_accounts_data_size", - self.allocated_accounts_data_size, + self.allocated_accounts_data_size.0, i64 ), ( "transaction_signature_count", - self.transaction_signature_count, + self.transaction_signature_count.0, i64 ), ( "secp256k1_instruction_signature_count", - self.secp256k1_instruction_signature_count, + self.secp256k1_instruction_signature_count.0, i64 ), ( "ed25519_instruction_signature_count", - self.ed25519_instruction_signature_count, + self.ed25519_instruction_signature_count.0, i64 ), ( "inflight_transaction_count", - self.in_flight_transaction_count, + self.in_flight_transaction_count.0, i64 ), ); @@ -295,11 +289,10 @@ impl CostTracker { return Err(CostTrackerError::WouldExceedAccountMaxLimit); } - let allocated_accounts_data_size = self - .allocated_accounts_data_size - .saturating_add(tx_cost.allocated_accounts_data_size()); + let allocated_accounts_data_size = + self.allocated_accounts_data_size + Saturating(tx_cost.allocated_accounts_data_size()); - if allocated_accounts_data_size > MAX_BLOCK_ACCOUNTS_DATA_SIZE_DELTA { + if allocated_accounts_data_size.0 > MAX_BLOCK_ACCOUNTS_DATA_SIZE_DELTA { return Err(CostTrackerError::WouldExceedAccountDataBlockLimit); } @@ -322,42 +315,24 @@ impl CostTracker { // Returns the highest account cost for all write-lock accounts `TransactionCost` updated fn add_transaction_cost(&mut self, tx_cost: &TransactionCost) -> u64 { - saturating_add_assign!( - self.allocated_accounts_data_size, - tx_cost.allocated_accounts_data_size() - ); - saturating_add_assign!(self.transaction_count, 1); - saturating_add_assign!( - self.transaction_signature_count, - tx_cost.num_transaction_signatures() - ); - saturating_add_assign!( - self.secp256k1_instruction_signature_count, - tx_cost.num_secp256k1_instruction_signatures() - ); - saturating_add_assign!( - self.ed25519_instruction_signature_count, - tx_cost.num_ed25519_instruction_signatures() - ); + self.allocated_accounts_data_size += tx_cost.allocated_accounts_data_size(); + self.transaction_count += 1; + self.transaction_signature_count += tx_cost.num_transaction_signatures(); + self.secp256k1_instruction_signature_count += + tx_cost.num_secp256k1_instruction_signatures(); + self.ed25519_instruction_signature_count += tx_cost.num_ed25519_instruction_signatures(); self.add_transaction_execution_cost(tx_cost, tx_cost.sum()) } fn remove_transaction_cost(&mut self, tx_cost: &TransactionCost) { let cost = tx_cost.sum(); self.sub_transaction_execution_cost(tx_cost, cost); - self.allocated_accounts_data_size = self - .allocated_accounts_data_size - .saturating_sub(tx_cost.allocated_accounts_data_size()); - self.transaction_count = self.transaction_count.saturating_sub(1); - self.transaction_signature_count = self - .transaction_signature_count - .saturating_sub(tx_cost.num_transaction_signatures()); - self.secp256k1_instruction_signature_count = self - .secp256k1_instruction_signature_count - .saturating_sub(tx_cost.num_secp256k1_instruction_signatures()); - self.ed25519_instruction_signature_count = self - .ed25519_instruction_signature_count - .saturating_sub(tx_cost.num_ed25519_instruction_signatures()); + self.allocated_accounts_data_size -= tx_cost.allocated_accounts_data_size(); + self.transaction_count -= 1; + self.transaction_signature_count -= tx_cost.num_transaction_signatures(); + self.secp256k1_instruction_signature_count -= + tx_cost.num_secp256k1_instruction_signatures(); + self.ed25519_instruction_signature_count -= tx_cost.num_ed25519_instruction_signatures(); } /// Apply additional actual execution units to cost_tracker @@ -417,7 +392,8 @@ mod tests { use { super::*, crate::transaction_cost::{WritableKeysTransaction, *}, - solana_sdk::signature::{Keypair, Signer}, + solana_keypair::Keypair, + solana_signer::Signer, std::cmp, }; @@ -535,7 +511,7 @@ mod tests { assert!(testee.would_fit(&tx_cost).is_ok()); let old = testee.allocated_accounts_data_size; testee.add_transaction_cost(&tx_cost); - assert_eq!(old + 1, testee.allocated_accounts_data_size); + assert_eq!(old.0 + 1, testee.allocated_accounts_data_size.0); } #[test] @@ -939,7 +915,7 @@ mod tests { for writable_account_cost in cost_tracker.cost_by_writable_accounts.values() { assert_eq!(expected_cost, *writable_account_cost); } - assert_eq!(1, cost_tracker.transaction_count); + assert_eq!(1, cost_tracker.transaction_count.0); }; test_update_cost_tracker(0, 0); @@ -962,18 +938,18 @@ mod tests { let tx_cost = simple_transaction_cost(&transaction, cost); cost_tracker.add_transaction_cost(&tx_cost); // assert cost_tracker is reverted to default - assert_eq!(1, cost_tracker.transaction_count); + assert_eq!(1, cost_tracker.transaction_count.0); assert_eq!(1, cost_tracker.number_of_accounts()); assert_eq!(cost, cost_tracker.block_cost); assert_eq!(0, cost_tracker.vote_cost); - assert_eq!(0, cost_tracker.allocated_accounts_data_size); + assert_eq!(0, cost_tracker.allocated_accounts_data_size.0); cost_tracker.remove_transaction_cost(&tx_cost); // assert cost_tracker is reverted to default - assert_eq!(0, cost_tracker.transaction_count); + assert_eq!(0, cost_tracker.transaction_count.0); assert_eq!(0, cost_tracker.number_of_accounts()); assert_eq!(0, cost_tracker.block_cost); assert_eq!(0, cost_tracker.vote_cost); - assert_eq!(0, cost_tracker.allocated_accounts_data_size); + assert_eq!(0, cost_tracker.allocated_accounts_data_size.0); } } diff --git a/cost-model/src/transaction_cost.rs b/cost-model/src/transaction_cost.rs index 429a1b90d4b1af..97fbb62720ad1e 100644 --- a/cost-model/src/transaction_cost.rs +++ b/cost-model/src/transaction_cost.rs @@ -1,8 +1,9 @@ #[cfg(feature = "dev-context-only-utils")] use solana_compute_budget_instruction::compute_budget_instruction_details::ComputeBudgetInstructionDetails; use { - crate::block_cost_limits, solana_runtime_transaction::transaction_meta::StaticMeta, - solana_sdk::pubkey::Pubkey, solana_svm_transaction::svm_message::SVMMessage, + crate::block_cost_limits, solana_pubkey::Pubkey, + solana_runtime_transaction::transaction_meta::StaticMeta, + solana_svm_transaction::svm_message::SVMMessage, }; /// TransactionCost is used to represent resources required to process @@ -173,7 +174,7 @@ impl solana_svm_transaction::svm_message::SVMMessage for WritableKeysTransaction unimplemented!("WritableKeysTransaction::num_write_locks") } - fn recent_blockhash(&self) -> &solana_sdk::hash::Hash { + fn recent_blockhash(&self) -> &solana_hash::Hash { unimplemented!("WritableKeysTransaction::recent_blockhash") } @@ -194,8 +195,8 @@ impl solana_svm_transaction::svm_message::SVMMessage for WritableKeysTransaction core::iter::empty() } - fn account_keys(&self) -> solana_sdk::message::AccountKeys { - solana_sdk::message::AccountKeys::new(&self.0, None) + fn account_keys(&self) -> solana_message::AccountKeys { + solana_message::AccountKeys::new(&self.0, None) } fn fee_payer(&self) -> &Pubkey { @@ -229,18 +230,18 @@ impl solana_svm_transaction::svm_message::SVMMessage for WritableKeysTransaction #[cfg(feature = "dev-context-only-utils")] impl solana_svm_transaction::svm_transaction::SVMTransaction for WritableKeysTransaction { - fn signature(&self) -> &solana_sdk::signature::Signature { + fn signature(&self) -> &solana_signature::Signature { unimplemented!("WritableKeysTransaction::signature") } - fn signatures(&self) -> &[solana_sdk::signature::Signature] { + fn signatures(&self) -> &[solana_signature::Signature] { unimplemented!("WritableKeysTransaction::signatures") } } #[cfg(feature = "dev-context-only-utils")] impl solana_runtime_transaction::transaction_meta::StaticMeta for WritableKeysTransaction { - fn message_hash(&self) -> &solana_sdk::hash::Hash { + fn message_hash(&self) -> &solana_hash::Hash { unimplemented!("WritableKeysTransaction::message_hash") } @@ -248,9 +249,9 @@ impl solana_runtime_transaction::transaction_meta::StaticMeta for WritableKeysTr unimplemented!("WritableKeysTransaction::is_simple_vote_transaction") } - fn signature_details(&self) -> &solana_sdk::message::TransactionSignatureDetails { - const DUMMY: solana_sdk::message::TransactionSignatureDetails = - solana_sdk::message::TransactionSignatureDetails::new(0, 0, 0, 0); + fn signature_details(&self) -> &solana_message::TransactionSignatureDetails { + const DUMMY: solana_message::TransactionSignatureDetails = + solana_message::TransactionSignatureDetails::new(0, 0, 0, 0); &DUMMY } @@ -266,11 +267,11 @@ impl solana_runtime_transaction::transaction_with_meta::TransactionWithMeta #[allow(refining_impl_trait)] fn as_sanitized_transaction( &self, - ) -> std::borrow::Cow { + ) -> std::borrow::Cow { unimplemented!("WritableKeysTransaction::as_sanitized_transaction"); } - fn to_versioned_transaction(&self) -> solana_sdk::transaction::VersionedTransaction { + fn to_versioned_transaction(&self) -> solana_transaction::versioned::VersionedTransaction { unimplemented!("WritableKeysTransaction::to_versioned_transaction") } } @@ -281,14 +282,12 @@ mod tests { super::*, crate::cost_model::CostModel, solana_feature_set::FeatureSet, + solana_hash::Hash, + solana_keypair::Keypair, + solana_message::SimpleAddressLoader, + solana_reserved_account_keys::ReservedAccountKeys, solana_runtime_transaction::runtime_transaction::RuntimeTransaction, - solana_sdk::{ - hash::Hash, - message::SimpleAddressLoader, - reserved_account_keys::ReservedAccountKeys, - signer::keypair::Keypair, - transaction::{MessageHash, VersionedTransaction}, - }, + solana_transaction::{sanitized::MessageHash, versioned::VersionedTransaction}, solana_vote_program::{vote_state::TowerSync, vote_transaction}, }; From 77cf885de0efa5f1cea287fa0dc4ea660d51f25c Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 19 Dec 2024 19:09:04 +0400 Subject: [PATCH 2/2] update lock files --- programs/sbf/Cargo.lock | 10 +++++++++- svm/examples/Cargo.lock | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index d30186c24c18d6..1b27ed1820fc80 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -5518,14 +5518,22 @@ dependencies = [ "ahash 0.8.11", "lazy_static", "log", + "solana-bincode", + "solana-borsh", "solana-builtins-default-costs", "solana-compute-budget", "solana-compute-budget-instruction", + "solana-compute-budget-interface", "solana-feature-set", + "solana-fee-structure", "solana-metrics", + "solana-packet", + "solana-pubkey", "solana-runtime-transaction", - "solana-sdk", + "solana-sdk-ids", "solana-svm-transaction", + "solana-system-interface", + "solana-transaction-error", "solana-vote-program", ] diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 1b7291092c71ac..418577d2763fe2 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -5369,14 +5369,22 @@ dependencies = [ "ahash 0.8.11", "lazy_static", "log", + "solana-bincode", + "solana-borsh", "solana-builtins-default-costs", "solana-compute-budget", "solana-compute-budget-instruction", + "solana-compute-budget-interface", "solana-feature-set", + "solana-fee-structure", "solana-metrics", + "solana-packet", + "solana-pubkey", "solana-runtime-transaction", - "solana-sdk", + "solana-sdk-ids", "solana-svm-transaction", + "solana-system-interface", + "solana-transaction-error", "solana-vote-program", ]