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: Add OPERATOR tier #3316

Merged
merged 18 commits into from
Dec 17, 2024
Merged

feat: Add OPERATOR tier #3316

merged 18 commits into from
Dec 17, 2024

Conversation

victor-yanev
Copy link
Contributor

@victor-yanev victor-yanev commented Dec 9, 2024

Description:

Instead of tracking the remaining total budget in-memory inside HbarLimitService (we would have to divide it by the number of Kubernetes instances, etc - it is creating unnecessary complexity in the configurations), we could create a new subscription tier (SubscriptionTier.OPERATOR) and add a pre-configured spending plan in the JSON configuration file which links the EVM address(es) of the relay operator account(s) to it.

In this way we can only set the total limit for the OPERATOR tier to HBAR_RATE_LIMIT_TINYBAR and it will be shared by all instances of the relay.

Related issue(s):

Fixes #3099

Notes for reviewer:

Checklist

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

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
@victor-yanev victor-yanev added the enhancement New feature or request label Dec 9, 2024
@victor-yanev victor-yanev self-assigned this Dec 9, 2024
@victor-yanev victor-yanev added this to the 0.63.0 milestone Dec 9, 2024
@victor-yanev victor-yanev added the Technical Debt Issue which resolves technical debt label Dec 9, 2024
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Copy link

github-actions bot commented Dec 9, 2024

Test Results

 22 files  +  1  301 suites   - 14   41m 49s ⏱️ - 4m 44s
611 tests +  4  600 ✅ +  2  4 💤 ±0  7 ❌ +2 
801 runs  +107  787 ✅ +108  6 💤 +2  8 ❌  - 3 

For more details on these failures, see this check.

Results for commit db14ad6. ± Comparison against base commit c006489.

This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
"before all" hook in "@precompile-calls Tests for eth_call with HTS" ‑ RPC Server Acceptance Tests Acceptance tests @precompile-calls Tests for eth_call with HTS "before all" hook in "@precompile-calls Tests for eth_call with HTS"
"before all" hook in "@web-socket-batch-3 eth_subscribe newHeads" ‑ RPC Server Acceptance Tests Acceptance tests @web-socket-batch-3 eth_subscribe newHeads "before all" hook in "@web-socket-batch-3 eth_subscribe newHeads"
calls createFungibleToken with custom fees ‑ RPC Server Acceptance Tests Acceptance tests @precompile-calls Tests for eth_call with HTS Create HTS token via direct call to Hedera Token service calls createFungibleToken with custom fees
calls createFungibleToken ‑ RPC Server Acceptance Tests Acceptance tests @precompile-calls Tests for eth_call with HTS Create HTS token via direct call to Hedera Token service calls createFungibleToken
calls createNonFungibleToken with fees ‑ RPC Server Acceptance Tests Acceptance tests @precompile-calls Tests for eth_call with HTS Create HTS token via direct call to Hedera Token service calls createNonFungibleToken with fees
calls createNonFungibleToken ‑ RPC Server Acceptance Tests Acceptance tests @precompile-calls Tests for eth_call with HTS Create HTS token via direct call to Hedera Token service calls createNonFungibleToken

♻️ This comment has been updated with latest results.

…ient

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
…nse`

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
@victor-yanev victor-yanev marked this pull request as ready for review December 10, 2024 12:27
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
konstantinabl
konstantinabl previously approved these changes Dec 10, 2024
Copy link
Collaborator

@konstantinabl konstantinabl left a comment

Choose a reason for hiding this comment

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

lgtm! but please fix the failing tests in CI

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
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.

Nice work.
Some suggestions and questions

packages/relay/src/lib/relay.ts Show resolved Hide resolved
docs/configuration.md Show resolved Hide resolved
Copy link
Member

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

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

Good work some questions!

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Member

@quiet-node quiet-node left a comment

Choose a reason for hiding this comment

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

Just couple of Qs otherwise everything LGTM! Great work! 🚀

@victor-yanev victor-yanev merged commit 13d09e9 into main Dec 17, 2024
41 of 43 checks passed
@victor-yanev victor-yanev deleted the 3099-Add-operator-tier branch December 17, 2024 14:01
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 85.05%. Comparing base (c006489) to head (db14ad6).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
...s/relay/src/lib/services/hbarLimitService/index.ts 89.74% 3 Missing and 1 partial ⚠️
packages/relay/src/lib/relay.ts 50.00% 0 Missing and 1 partial ⚠️
.../relay/src/lib/services/hapiService/hapiService.ts 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3316      +/-   ##
==========================================
+ Coverage   84.79%   85.05%   +0.25%     
==========================================
  Files          69       69              
  Lines        4637     4683      +46     
  Branches     1041     1048       +7     
==========================================
+ Hits         3932     3983      +51     
+ Misses        398      391       -7     
- Partials      307      309       +2     
Flag Coverage Δ
config-service 98.14% <ø> (ø)
relay 79.72% <84.00%> (+0.99%) ⬆️
server 83.28% <ø> (ø)
ws-server 36.66% <ø> (ø)

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% <ø> (ø)
...y/src/lib/db/types/hbarLimiter/subscriptionTier.ts 100.00% <100.00%> (ø)
packages/relay/src/lib/relay.ts 91.54% <50.00%> (-1.31%) ⬇️
.../relay/src/lib/services/hapiService/hapiService.ts 79.78% <87.50%> (-0.65%) ⬇️
...s/relay/src/lib/services/hbarLimitService/index.ts 93.16% <89.74%> (+0.46%) ⬆️

... and 7 files 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 Technical Debt Issue which resolves technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HBAR Rate Limit Redesign] Add OPERATOR tier
4 participants