Skip to content

Price: Allow consumers to raise budget by a limited amount#150

Merged
That3Percent merged 1 commit intomainfrom
zac/raised-budgets
Apr 19, 2022
Merged

Price: Allow consumers to raise budget by a limited amount#150
That3Percent merged 1 commit intomainfrom
zac/raised-budgets

Conversation

@That3Percent
Copy link
Contributor

No description provided.

@That3Percent That3Percent requested a review from Theodus April 14, 2022 20:54
// .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);
Copy link
Member

@Theodus Theodus Apr 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would have come with a performance penalty, so I compromised by adding an impl Mul<U256> for UDecimal (removing the macro)

@Theodus Theodus mentioned this pull request Apr 19, 2022
@That3Percent That3Percent merged commit e3f615a into main Apr 19, 2022
@That3Percent That3Percent deleted the zac/raised-budgets branch April 19, 2022 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants