-
Notifications
You must be signed in to change notification settings - Fork 43
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
Overhaul "free budget" and migrate non-metered code #1123
Conversation
2939881
to
f335934
Compare
budget.rs
As I was writing some test, I realize most of the currently diagnostic code are unmetered. I will fix the metering on them. Marked as draft. |
budget.rs
All diagnostic workflows have been converted to metered code. Marking this back to ready for review. |
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.
Looking good! Handful of changes requested but I think this is fairly close to what we should be merging, thanks!
What
Resolves #1061
Overhaul the "free budget":
internal_limit
andinternal_total_count
to budget dimension for keeping track of internal work being done, which don't get metered for fee, but need to be limited for DOS prevention.with_free_budget
interface and replace it withwith_internal_mode
(and awith_debug_budget
on the host side that wraps around it and asserts host is inDEBUG
mode), taking two closures and ensuring 1. theinternal_limit
is not exceeded 2. any error occurring within is suppressed. The error suppression part is to prevent error-based logic existing outside the closure that accidentally causes divergences between debug and no-debug workflows.A refactoring to split the
budget.rs
into multiple smaller files. The file was getting big (1200+ lines) and hard to navigate.Migrate all existing non-metered code to metered version, this includes diagnostic logging, diagnostic event, auth preflight code.
Why
[TODO: Why this change is being made. Include any context required to understand the why.]
Known limitations
[TODO or N/A]