-
Notifications
You must be signed in to change notification settings - Fork 62
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
refactor: configurations of HbarLimitService
#3014
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
🚨 Memory Leak Detected 🚨A potential memory leak has been detected in the test titled Details📊 Memory Leak Detection Report 📊 GC Type: Scavenge Heap Statistics (before vs after executing the test):
Heap Space Statistics (before vs after executing the test):
RecommendationsPlease investigate the memory allocations in this test, focusing on objects that are not being properly deallocated. |
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]> # Conflicts: # packages/relay/src/lib/db/repositories/hbarLimiter/hbarSpendingPlanRepository.ts # packages/relay/src/lib/services/hbarLimitService/index.ts # packages/relay/tests/lib/services/hbarLimitService/hbarLimitService.spec.ts
Signed-off-by: Victor Yanev <[email protected]> # Conflicts: # packages/relay/src/lib/db/repositories/hbarLimiter/hbarSpendingPlanRepository.ts # packages/relay/src/lib/services/hbarLimitService/index.ts # packages/relay/tests/lib/services/hbarLimitService/hbarLimitService.spec.ts
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Signed-off-by: Victor Yanev <[email protected]>
Quality Gate passedIssues Measures |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3014 +/- ##
==========================================
- Coverage 90.14% 89.97% -0.17%
==========================================
Files 42 58 +16
Lines 3185 3911 +726
Branches 641 782 +141
==========================================
+ Hits 2871 3519 +648
- Misses 270 348 +78
Partials 44 44
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Description:
This PR includes changes to the configurations of the
HbarLimitService
to make use of the env variables for the total budget and the limit duration that were used for the oldHbarLimit
implementation.As a result, also had to rename
spentToday
field toamountSpent
since we are no longer doing daily limiting and we are limiting based on a configurable time window.It also adds a
Configurations
section in thehbar-limiter.md doc
which describes all configurations used for the redesigned HBAR limiter, and also added the new env vars used in theconfigurations.md
doc.Related issue(s):
Fixes #2970
Fixes #3018
Notes for reviewer:
As part of doing #2970 and #3018, I noticed a flaw in the configurations of the
HbarLimitService
- we usenumber
for the type of thetotalBudget
andremainingBudget
and if this value becomes too big, we would hit a bug of overflowing numbers.Current limiting of the existing
HbarLimit
class is 110 ℏ per minute - if we want to keep this limit the same (but limit on a per day basis instead of per minute) that would be:These numbers get increasingly big, especially if we decide to change the limit duration to be per month instead of per day - then we would overflow the
Number.MAX_VALUE
and break the hbar limiter.This is why in this PR, I have changed the type of
totalBudget
andremainingBudget
fromnumber
toHbar
, which internally uses theLong
library.Checklist