-
Notifications
You must be signed in to change notification settings - Fork 314
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
v2.1: Fix builtin default cost dependents on migration (backport of #3768) #4415
Conversation
Cherry-pick of d791c9a has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
A prerequisite bp for backporting #3975 to 2.1 (#4091). Details:
|
For the record, I don't think the |
|
* Add public function to as placeholder to implement fetching default cost depends on feature_set; Make AhashMap private * Add BuiltinCost to help determine default cost based on migration status * test * fix - after migration feature activation, it should no longer be considered as builtin * use lazy_static, avoid naked unwrap * rename * add comments to BUILINS (cherry picked from commit d791c9a) # Conflicts: # builtins-default-costs/src/lib.rs # cost-model/src/cost_model.rs
69fb25c
to
218169e
Compare
Yeah, only in |
right, it's the execution path before feature |
is #4091 not smuggling this change set? 4091 looks nothing like the master pr |
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.
seems like an awfully roundabout way to get the job done 😭
(secp256k1_program::id(), 0), | ||
(ed25519_program::id(), 0), | ||
// DO NOT ADD MORE ENTRIES TO THIS MAP | ||
static ref BUILTIN_INSTRUCTION_COSTS: AHashMap<Pubkey, BuiltinCost> = [ |
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.
discarding pub
breaks api here. probably what we eventually want, but not the way to do it
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.
discarding
pub
breaks api here. probably what we eventually want, but not the way to do it
then again the signature is wrecked too, sigh. at least any brain dead consumers can adapt if it remains pub
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 are you concerned with API compatibility in this crate?
lazy_static! { | ||
// To calculate the static_builtin_cost_sum conservatively, an all-enabled dummy feature_set | ||
// is used. It lowers required minimal compute_unit_limit, aligns with future versions. | ||
static ref FEATURE_SET: FeatureSet = FeatureSet::all_enabled(); |
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 can't we just resolve the feature gate status at a higher level and use a bool instead of some poorly named sentinel value?
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.
Is this important for backport review? Also can you explain the bool you're talking about? I'm not getting what you're suggesting
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.
At the receiving & buffer part of Banking_stage, resolving feature gate status is always bit fuzzy since we have a 'working_bank' yet. There are certainly ways around it, but nothing is clean and easy afaik.
The urge to sneak it into #4091 was strong, but we decided to do it right: #4091 (comment). With this, 4091 looks pretty close to its original PR #3975 |
Problem
Some of builtin programs are being migrated to sbpf, while the rest is being planned for too. Once a builtin program is migrated in a cluster, it's "default cost" defined in BUILTIN_INSTRUCTION_COSTS should be changed to
0
.Summary of Changes
Fixes #
This is an automatic backport of pull request #3768 done by [Mergify](https://mergify.com).