-
Notifications
You must be signed in to change notification settings - Fork 856
refactor: static meta compute budget details #3853
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
Conversation
apfitzge
left a comment
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.
I personally like this interface more. There are a few places where we do not need the compute budget limits in full; just the CU price/limit. which we could refactor visibility on.
Specifically for re-iterating instructions, I think we should avoid that if we can achieve the same outcome with a few cached u16s.
Please let @tao-stones review, since he has mainly designed this interface
|
Exposes |
|
I personally see the runtime tx crate as an internal crate anyways so I'm not concerned with what's publicly exposed. But in any case, |
tao-stones
left a comment
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.
Can't find strong reason to not make it public, given the understanding RuntimeTransaction is a internal crate. (tho not clear how to enforce it). Small nit to potentially reduce number of files followup PR touches.
| transaction | ||
| .compute_budget_limits(&bank.feature_set) | ||
| .compute_budget_instruction_details() | ||
| .sanitize_and_convert_to_compute_budget_limits() |
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.
nit: if can add _feature_set: &FeatureSet to sanitize_and_convert_to_compute_budget_limits() as placeholder parameter, next PRs that's going to use feature_set won't have to touch these files again.
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.
Yeah I considered that but it just felt strange to modify that function when it wasn't related to the purpose of the PR
Problem
StaticMeta::compute_budget_limitsis the only trait method onStaticMetawhich is not a simple getter function. In fact, it's actually a fairly expensive trait method given that it has to do extra sanitization and computation for the transaction's default compute limit. This design limits the flexibility of thesanitize_and_convert_to_compute_budget_limitsmethod (e.g. it's not possible to change it to accept an iterator of instructions for computing the default compute unit limit).Summary of Changes
StaticMeta::compute_budget_limitswithStaticMeta::compute_budget_instruction_detailsforcing the caller to explicitly sanitize the result if needed.ComputeBudgetInstructionDetailstopubFixes #