Skip to content

Commit 9acea14

Browse files
committed
fix cherry-pick conflicts
1 parent 6f9c1f0 commit 9acea14

File tree

11 files changed

+44
-216
lines changed

11 files changed

+44
-216
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builtins-default-costs/src/lib.rs

-58
Original file line numberDiff line numberDiff line change
@@ -54,66 +54,8 @@ lazy_static! {
5454
temp_table
5555
};
5656
}
57-
<<<<<<< HEAD
58-
=======
59-
60-
pub fn get_builtin_instruction_cost<'a>(
61-
program_id: &'a Pubkey,
62-
feature_set: &'a FeatureSet,
63-
) -> Option<u64> {
64-
BUILTIN_INSTRUCTION_COSTS
65-
.get(program_id)
66-
.filter(
67-
// Returns true if builtin program id has no core_bpf_migration_feature or feature is not activated;
68-
// otherwise returns false because it's not considered as builtin
69-
|builtin_cost| -> bool {
70-
builtin_cost
71-
.core_bpf_migration_feature
72-
.map(|feature_id| !feature_set.is_active(&feature_id))
73-
.unwrap_or(true)
74-
},
75-
)
76-
.map(|builtin_cost| builtin_cost.native_cost)
77-
}
7857

7958
#[inline]
8059
pub fn is_builtin_program(program_id: &Pubkey) -> bool {
8160
BUILTIN_INSTRUCTION_COSTS.contains_key(program_id)
8261
}
83-
84-
#[cfg(test)]
85-
mod test {
86-
use super::*;
87-
88-
#[test]
89-
fn test_get_builtin_instruction_cost() {
90-
// use native cost if no migration planned
91-
assert_eq!(
92-
Some(solana_compute_budget_program::DEFAULT_COMPUTE_UNITS),
93-
get_builtin_instruction_cost(&compute_budget::id(), &FeatureSet::all_enabled())
94-
);
95-
96-
// use native cost if migration is planned but not activated
97-
assert_eq!(
98-
Some(solana_stake_program::stake_instruction::DEFAULT_COMPUTE_UNITS),
99-
get_builtin_instruction_cost(&solana_stake_program::id(), &FeatureSet::default())
100-
);
101-
102-
// None if migration is planned and activated, in which case, it's no longer builtin
103-
assert!(get_builtin_instruction_cost(
104-
&solana_stake_program::id(),
105-
&FeatureSet::all_enabled()
106-
)
107-
.is_none());
108-
109-
// None if not builtin
110-
assert!(
111-
get_builtin_instruction_cost(&Pubkey::new_unique(), &FeatureSet::default()).is_none()
112-
);
113-
assert!(
114-
get_builtin_instruction_cost(&Pubkey::new_unique(), &FeatureSet::all_enabled())
115-
.is_none()
116-
);
117-
}
118-
}
119-
>>>>>>> 3e9af14f3a (Fix reserve minimal compute units for builtins (#3799))

core/src/banking_stage/consumer.rs

+4-15
Original file line numberDiff line numberDiff line change
@@ -574,19 +574,12 @@ impl Consumer {
574574
.sanitized_transactions()
575575
.iter()
576576
.filter_map(|transaction| {
577-
<<<<<<< HEAD
578-
process_compute_budget_instructions(SVMMessage::program_instructions_iter(
579-
transaction,
580-
))
577+
process_compute_budget_instructions(
578+
SVMMessage::program_instructions_iter(transaction),
579+
&bank.feature_set,
580+
)
581581
.ok()
582582
.map(|limits| limits.compute_unit_price)
583-
=======
584-
transaction
585-
.compute_budget_instruction_details()
586-
.sanitize_and_convert_to_compute_budget_limits(&bank.feature_set)
587-
.ok()
588-
.map(|limits| limits.compute_unit_price)
589-
>>>>>>> 3e9af14f3a (Fix reserve minimal compute units for builtins (#3799))
590583
})
591584
.minmax();
592585
let (min_prioritization_fees, max_prioritization_fees) =
@@ -765,12 +758,8 @@ impl Consumer {
765758
) -> Result<(), TransactionError> {
766759
let fee_payer = message.fee_payer();
767760
let fee_budget_limits = FeeBudgetLimits::from(process_compute_budget_instructions(
768-
<<<<<<< HEAD
769761
SVMMessage::program_instructions_iter(message),
770-
=======
771-
message.program_instructions_iter(),
772762
&bank.feature_set,
773-
>>>>>>> 3e9af14f3a (Fix reserve minimal compute units for builtins (#3799))
774763
)?);
775764
let fee = solana_fee::calculate_fee(
776765
message,

core/src/banking_stage/immutable_deserialized_packet.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,13 @@ pub enum DeserializedPacketError {
4141
FailedFilter(#[from] PacketFilterFailure),
4242
}
4343

44-
<<<<<<< HEAD
45-
#[derive(Debug, Eq)]
46-
=======
4744
lazy_static::lazy_static! {
4845
// Make a dummy feature_set with all features enabled to
4946
// fetch compute_unit_price and compute_unit_limit for legacy leader.
5047
static ref FEATURE_SET: FeatureSet = FeatureSet::all_enabled();
5148
}
5249

53-
#[derive(Debug)]
54-
>>>>>>> 3e9af14f3a (Fix reserve minimal compute units for builtins (#3799))
50+
#[derive(Debug, Eq)]
5551
pub struct ImmutableDeserializedPacket {
5652
original_packet: Packet,
5753
transaction: SanitizedVersionedTransaction,

core/src/banking_stage/transaction_scheduler/scheduler_controller.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -544,11 +544,12 @@ impl<T: LikeClusterInfo> SchedulerController<T> {
544544
.is_ok()
545545
})
546546
.filter_map(|(packet, tx, deactivation_slot)| {
547-
process_compute_budget_instructions(SVMMessage::program_instructions_iter(&tx))
548-
.map(|compute_budget| {
549-
(packet, tx, deactivation_slot, compute_budget.into())
550-
})
551-
.ok()
547+
process_compute_budget_instructions(
548+
SVMMessage::program_instructions_iter(&tx),
549+
&working_bank.feature_set,
550+
)
551+
.map(|compute_budget| (packet, tx, deactivation_slot, compute_budget.into()))
552+
.ok()
552553
})
553554
.for_each(|(packet, tx, deactivation_slot, fee_budget_limits)| {
554555
arc_packets.push(packet);

cost-model/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ name = "solana_cost_model"
3636
itertools = { workspace = true }
3737
rand = "0.8.5"
3838
# See order-crates-for-publishing.py for using this unusual `path = "."`
39+
solana-compute-budget-program = { workspace = true }
3940
solana-cost-model = { path = ".", features = ["dev-context-only-utils"] }
4041
solana-logger = { workspace = true }
4142
solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }

0 commit comments

Comments
 (0)