Skip to content
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

Unit tests for HBAR Rate limit #582

Closed
georgi-l95 opened this issue Oct 3, 2022 · 1 comment · Fixed by #584
Closed

Unit tests for HBAR Rate limit #582

georgi-l95 opened this issue Oct 3, 2022 · 1 comment · Fixed by #584
Assignees
Labels
enhancement New feature or request limechain P2
Milestone

Comments

@georgi-l95
Copy link
Member

Problem

There are no unit test for the hbar rate limiter. We need to cover this functionality.

Solution

Add unit tests to test shouldLimit, addExpenses, shouldResetLimiter

Alternatives

No response

@georgi-l95 georgi-l95 added the enhancement New feature or request label Oct 3, 2022
@georgi-l95 georgi-l95 self-assigned this Oct 3, 2022
@Nana-EC
Copy link
Collaborator

Nana-EC commented Oct 3, 2022

@georgi-l95 when addressing this can you add logic for

Enable flag that is set to false when a valid HBAR_RATE_LIMIT_TINYBAR and HBAR_RATE_LIMIT_DURATION is not set. This will support enabling and disabling

  • add checks for this.enabled in
    • constructor(), if false don't set other variables. This will require other variables to have a default value (mostly 0)
    • shouldLimit(), if false return false
    • addExpense() if false don't decrement

@georgi-l95 georgi-l95 added this to the 0.10 milestone Oct 4, 2022
@georgi-l95 georgi-l95 linked a pull request Oct 4, 2022 that will close this issue
2 tasks
@Nana-EC Nana-EC added the P2 label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request limechain P2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants