-
Notifications
You must be signed in to change notification settings - Fork 846
v2.1: Fix reserve minimal compute units for builtins (backport of #3799) #3931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ use { | |
| solana_sanitize::SanitizeError, | ||
| solana_sdk::{ | ||
| clock::Slot, | ||
| feature_set::FeatureSet, | ||
| hash::Hash, | ||
| message::{v0::LoadedAddresses, AddressLoaderError, Message, SimpleAddressLoader}, | ||
| pubkey::Pubkey, | ||
|
|
@@ -40,6 +41,12 @@ pub enum DeserializedPacketError { | |
| FailedFilter(#[from] PacketFilterFailure), | ||
| } | ||
|
|
||
| lazy_static::lazy_static! { | ||
| // Make a dummy feature_set with all features enabled to | ||
| // fetch compute_unit_price and compute_unit_limit for legacy leader. | ||
| static ref FEATURE_SET: FeatureSet = FeatureSet::all_enabled(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why all and not just the one we care about here? what if someone naively decides to leverage the arg in at an intermediary call site for something unrelated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea a lazy step for dummy. |
||
| } | ||
|
|
||
| #[derive(Debug, Eq)] | ||
| pub struct ImmutableDeserializedPacket { | ||
| original_packet: Packet, | ||
|
|
@@ -68,6 +75,7 @@ impl ImmutableDeserializedPacket { | |
| .get_message() | ||
| .program_instructions_iter() | ||
| .map(|(pubkey, ix)| (pubkey, SVMInstruction::from(ix))), | ||
| &FEATURE_SET, | ||
| ) | ||
| .map_err(|_| DeserializedPacketError::PrioritizationFailure)?; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? could have easily resolved the feature set higher in the call stack and passed a bool down instead of introducing an entire sentinel feature set instance
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considered that too, since we plan to remove
immutable_deserialized_packetsoon m(when legacy "scheduler" is removed), adding dummy here is easier for backporting than piping a bool through more files.