diff --git a/cost-model/src/cost_model.rs b/cost-model/src/cost_model.rs index fa12a7343bc7e0..978c05038bf3d9 100644 --- a/cost-model/src/cost_model.rs +++ b/cost-model/src/cost_model.rs @@ -571,7 +571,7 @@ mod tests { // default loaded_accounts_data_size_limit const DEFAULT_PAGE_COST: u64 = 8; let expected_loaded_accounts_data_size_cost = - solana_program_runtime::compute_budget_processor::MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES + solana_program_runtime::compute_budget_processor::DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES as u64 / ACCOUNT_DATA_COST_PAGE_SIZE * DEFAULT_PAGE_COST; diff --git a/cost-model/src/transaction_cost.rs b/cost-model/src/transaction_cost.rs index ee280c873312f9..3ee7e5ce7010be 100644 --- a/cost-model/src/transaction_cost.rs +++ b/cost-model/src/transaction_cost.rs @@ -201,6 +201,7 @@ mod tests { crate::cost_model::CostModel, solana_sdk::{ feature_set::FeatureSet, + fee::ACCOUNT_DATA_COST_PAGE_SIZE, hash::Hash, message::SimpleAddressLoader, reserved_account_keys::ReservedAccountKeys, @@ -246,16 +247,22 @@ mod tests { ) .unwrap(); - // expected vote tx cost: 2 write locks, 1 sig, 1 vote ix, 8cu of loaded accounts size, + // expected vote tx cost: 2 write locks, 1 sig, 1 vote ix, 8cu of ix data bytes, let expected_vote_cost = SIMPLE_VOTE_USAGE_COST; - // expected non-vote tx cost would include default loaded accounts size cost (16384) additionally - let expected_none_vote_cost = 20535; + // expected non-vote tx cost would include default loaded accounts size cost additionally + const DEFAULT_PAGE_COST: u64 = 8; + let expected_loaded_accounts_data_size_cost = + solana_program_runtime::compute_budget_processor::DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES + as u64 + / ACCOUNT_DATA_COST_PAGE_SIZE + * DEFAULT_PAGE_COST; + let min_none_vote_cost = SIMPLE_VOTE_USAGE_COST + expected_loaded_accounts_data_size_cost; let vote_cost = CostModel::calculate_cost(&vote_transaction, &FeatureSet::all_enabled()); let none_vote_cost = CostModel::calculate_cost(&none_vote_transaction, &FeatureSet::all_enabled()); assert_eq!(expected_vote_cost, vote_cost.sum()); - assert_eq!(expected_none_vote_cost, none_vote_cost.sum()); + assert!(min_none_vote_cost < none_vote_cost.sum()); } } diff --git a/program-runtime/src/compute_budget_processor.rs b/program-runtime/src/compute_budget_processor.rs index b9e1dbc05085bc..c495e8a310e45b 100644 --- a/program-runtime/src/compute_budget_processor.rs +++ b/program-runtime/src/compute_budget_processor.rs @@ -443,7 +443,7 @@ mod tests { // budget is set to default data size let expected_result = Ok(ComputeBudgetLimits { compute_unit_limit: DEFAULT_INSTRUCTION_COMPUTE_UNIT_LIMIT, - loaded_accounts_bytes: MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES, + loaded_accounts_bytes: DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES, ..ComputeBudgetLimits::default() }); diff --git a/svm/src/account_loader.rs b/svm/src/account_loader.rs index 6190fafa36c6b2..baeb7b81feb037 100644 --- a/svm/src/account_loader.rs +++ b/svm/src/account_loader.rs @@ -1176,7 +1176,7 @@ mod tests { let result_default_limit = Ok(Some( NonZeroUsize::new( - usize::try_from(compute_budget_processor::MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES) + usize::try_from(compute_budget_processor::DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES) .unwrap(), ) .unwrap(),