-
Notifications
You must be signed in to change notification settings - Fork 229
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
Fix reserve minimal compute units for builtins #3799
base: master
Are you sure you want to change the base?
Fix reserve minimal compute units for builtins #3799
Conversation
e416a8f
to
6bbd650
Compare
num_compute_budget_instructions: u32, | ||
num_builtin_instructions: u32, | ||
num_non_builtin_instructions: u32, |
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.
these can be u16
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.
It could, made them u32
mainly because they are used to calculate cu-limits, which is u32
, saves a bunch of try_into()
. Honestly I don't see it, but is changing them into u16
necessary?
num_builtin_instructions: u32, | ||
num_non_builtin_instructions: u32, | ||
// A list of migration feature IDs for builtin instructions | ||
maybe_builtin: Vec<Pubkey>, |
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.
we shouldn't allocate like this per transaction
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.
This is sort of proof of concept - it implements the function, but not great for allocation.
To improve performance, maybe need @buffalojoec PR, then Vec<pubkey>
can be replaced with maybe_builtin: [u12; 10]
- a fixed array that maps BUILTINS
, each u12
counts number of builtin instructions. That way sanitize
can refer to BUILTINS
for migration feature id.
77381a1
to
8faee07
Compare
8faee07
to
c181481
Compare
runtime-transaction/Cargo.toml
Outdated
@@ -27,6 +27,7 @@ name = "solana_runtime_transaction" | |||
bincode = { workspace = true } | |||
criterion = { workspace = true } | |||
rand = { workspace = true } | |||
solana-stake-program = { workspace = true } |
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.
This dependency is added specifically for a test. Can the test be reworked to move this dependency out of SVM related crates? We are trying to keep the deps to a minimum so that SVM can be moved to its own Github repo.
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.
thanks for pointing this out, change in 34f497d
8711a52
to
59a7305
Compare
…lculate default CUs for builtin instructions per feature_set
… static meta with feature gate
59a7305
to
4f13a31
Compare
4f13a31
to
0e8a348
Compare
Problem
Implementing solana-foundation/solana-improvement-documents#170 by defining MAX_BUILTIN_ALLOCATION_COMPUTE_UNIT_LIMIT to 3K CUs, then use it to allocate builtin instructions' CU Meters for VM and cost tracking for leaders.
Summary of Changes
Feature Gate Issue: #2562