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

feat: Added ability to load spending plans from environment variable. #3153

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ebadiere
Copy link
Collaborator

This enhancement adds the ability to load HBar Rate Limiter spending plans from an environment variable.
Related issue(s):

Fixes #3152

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: ebadiere <ebadiere@gmail.com>
@ebadiere ebadiere added the enhancement New feature or request label Oct 23, 2024
@ebadiere ebadiere added this to the 0.59.0 milestone Oct 23, 2024
@ebadiere ebadiere self-assigned this Oct 23, 2024
Copy link

github-actions bot commented Oct 23, 2024

🚨 Memory Leak Detected 🚨

A potential memory leak has been detected in the test titled validates enforcement of request id. This may impact the application's performance and stability.

Details

📊 Memory Leak Detection Report 📊

GC Type: MarkSweepCompact
Cost: 25,387.9 ms

Heap Statistics (before vs after executing the test):

  • Total Heap Size: increased with 1.46 MB
  • Total Heap Size Executable: no changes
  • Total Physical Size: decreased with 348.16 KB
  • Total Available Size: decreased with 13.74 MB
  • Total Global Handles Size: no changes
  • Used Global Handles Size: decreased with 64.00 bytes
  • Used Heap Size: decreased with 3.44 MB
  • Heap Size Limit: no changes
  • Malloced Memory: no changes
  • External Memory: no changes
  • Peak Malloced Memory: no changes

Heap Space Statistics (before vs after executing the test):

  • Old Space:

    • Space Size: increased with 1.84 MB
    • Space Used Size: increased with 2.07 MB
    • Space Available Size: decreased with 16.55 MB
    • Physical Space Size: increased with 1.84 MB
  • Large Object Space:

    • Space Size: increased with 835.58 KB
    • Space Used Size: increased with 813.50 KB
    • Space Available Size: no changes
    • Physical Space Size: increased with 835.58 KB

Recommendations

Please investigate the memory allocations in this test, focusing on objects that are not being properly deallocated.

Copy link

github-actions bot commented Oct 23, 2024

Test Results

  6 files   -  14   82 suites   - 201   28m 4s ⏱️ - 6m 31s
225 tests  - 380  225 ✅  - 366  0 💤  - 4  0 ❌  - 10 
247 runs   - 547  247 ✅  - 533  0 💤  - 4  0 ❌  - 10 

Results for commit dba50bc. ± Comparison against base commit 9afe7c2.

This pull request removes 380 tests.
"before all" hook in "@tokenmanagement HTS Precompile Token Management Acceptance Tests" ‑ RPC Server Acceptance Tests Acceptance tests @tokenmanagement HTS Precompile Token Management Acceptance Tests "before all" hook in "@tokenmanagement HTS Precompile Token Management Acceptance Tests"
"eth_call" for non-existing contract address returns 0x ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call "eth_call" for non-existing contract address returns 0x
001 Should call pureMultiply ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With evm address 001 Should call pureMultiply
001 Should call pureMultiply ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With long-zero address 001 Should call pureMultiply
002 Should call msgSender ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With evm address 002 Should call msgSender
002 Should call msgSender ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With long-zero address 002 Should call msgSender
003 Should call txOrigin ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With evm address 003 Should call txOrigin
003 Should call txOrigin ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With long-zero address 003 Should call txOrigin
004 Should call msgSig ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With evm address 004 Should call msgSig
004 Should call msgSig ‑ RPC Server Acceptance Tests Acceptance tests @api-batch-3 RPC Server Acceptance Tests eth_call Caller contract With long-zero address 004 Should call msgSig
…

♻️ This comment has been updated with latest results.

@ebadiere ebadiere changed the title feat: Added ability to load spening plans from environment variable. feat: Added ability to load spending plans from environment variable. Oct 23, 2024
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

Config suggestion, other than that looks good.

docs/configuration.md Outdated Show resolved Hide resolved
Copy link
Contributor

@victor-yanev victor-yanev left a comment

Choose a reason for hiding this comment

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

Looks good, just a few suggestions:

Nana-EC
Nana-EC previously approved these changes Oct 24, 2024
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

Looking good, just a non-blocking clean up suggestion on the logic.

…tent.

Signed-off-by: ebadiere <ebadiere@gmail.com>

fix: removed .only

Signed-off-by: ebadiere <ebadiere@gmail.com>

fix: Cleaned up file and env var evaluation.

Signed-off-by: ebadiere <ebadiere@gmail.com>

fix: Flaky unit test fix.

Signed-off-by: ebadiere <ebadiere@gmail.com>

feat: Refactored implementation and updated tests.

Signed-off-by: ebadiere <ebadiere@gmail.com>
Signed-off-by: ebadiere <ebadiere@gmail.com>
Signed-off-by: ebadiere <ebadiere@gmail.com>
…_CONFIG

Signed-off-by: ebadiere <ebadiere@gmail.com>
Signed-off-by: ebadiere <ebadiere@gmail.com>
Copy link

sonarcloud bot commented Oct 26, 2024

Copy link

codecov bot commented Oct 26, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.57%. Comparing base (9afe7c2) to head (c035dce).

Files with missing lines Patch % Lines
...ay/src/lib/config/hbarSpendingPlanConfigService.ts 75.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3153      +/-   ##
==========================================
- Coverage   85.59%   85.57%   -0.02%     
==========================================
  Files          48       48              
  Lines        3395     3398       +3     
  Branches      670      670              
==========================================
+ Hits         2906     2908       +2     
  Misses        283      283              
- Partials      206      207       +1     
Flag Coverage Δ
config-service 98.14% <ø> (ø)
relay 85.37% <75.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ckages/config-service/src/services/globalConfig.ts 100.00% <ø> (ø)
...ay/src/lib/config/hbarSpendingPlanConfigService.ts 94.73% <75.00%> (-3.09%) ⬇️

... and 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Sprint Backlog
Development

Successfully merging this pull request may close these issues.

Add the ability for spending plans to be defined using environment variables.
4 participants