Price: Allow consumers to raise budget by a limited amount#150
Merged
That3Percent merged 1 commit intomainfrom Apr 19, 2022
Merged
Price: Allow consumers to raise budget by a limited amount#150That3Percent merged 1 commit intomainfrom
That3Percent merged 1 commit intomainfrom
Conversation
Theodus
requested changes
Apr 14, 2022
src/query_engine/mod.rs
Outdated
| // .min prevents the budget from being set beyond what it would be automatically. The reason | ||
| // this is important is because sometimes queries are subsidized and we would be at-risk | ||
| // to allow arbitrarily high values. | ||
| budget = max_budget.min(budget * 10u32); |
Member
There was a problem hiding this comment.
Suggested change
| budget = max_budget.min(budget * 10u32); | |
| budget = max_budget.min(budget * 10u32.try_into().unwrap()); |
This does the job, without needing the RHS of operations to be of any uint type. Stamping out all the ops we want to support for all possible RHS types seems like a lot of codegen for little benefit (compile times are already longer than I would like).
Contributor
Author
There was a problem hiding this comment.
It would have come with a performance penalty, so I compromised by adding an impl Mul<U256> for UDecimal (removing the macro)
46e725e to
0f0ac9d
Compare
0f0ac9d to
5141fda
Compare
Theodus
approved these changes
Apr 19, 2022
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.