Skip to content

fix: applied limits to HBAR-consumed queries and allowed atomic queries to bypass HBAR rate limiting #3708

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

Conversation

quiet-node
Copy link
Contributor

@quiet-node quiet-node commented Apr 17, 2025

Description:
This PR improve the HBAR rate limiting mechanism of the relay particularly for query operations.

  1. Updated executeQuery to apply HBAR rate limiting more selectively:

    • Queries with zero cost (base cost = 0) are exempt from rate limiting
    • Added support for "atomic queries" (queries that are part of a larger operation like file operations, e.g., FileInfoQuery in createFile(), deleteFile()) which bypass rate limiting
    • Only apply rate limiting when a query has an actual HBAR cost and isn't an atomic operation
  2. Enhanced shouldLimit method to handle transaction and query modes differently:

    • In TRANSACTION mode: checks both the total relay budget and the spending plan limits for the specific user
    • In QUERY mode: only checks the total relay budget (ignores individual spending plan limits)

Fixes #3678

@quiet-node quiet-node added the enhancement New feature or request label Apr 17, 2025
@quiet-node quiet-node added this to the 0.68.0 milestone Apr 17, 2025
@quiet-node quiet-node self-assigned this Apr 17, 2025
@quiet-node quiet-node requested review from a team as code owners April 17, 2025 17:44
Copy link

github-actions bot commented Apr 17, 2025

Test Results

 20 files  ± 0  270 suites  +15   40m 43s ⏱️ -6s
631 tests + 2  624 ✅ + 3  4 💤 ±0  3 ❌  - 1 
750 runs   - 65  743 ✅  - 64  4 💤 ±0  3 ❌  - 1 

For more details on these failures, see this check.

Results for commit 167b6a7. ± Comparison against base commit b882f71.

♻️ This comment has been updated with latest results.

@quiet-node quiet-node force-pushed the 3678-hbarlimitservice-extend-hbarlimitservice-to-block-all-hbar-consuming-rpc-methods branch from 8566b7b to 167b6a7 Compare April 17, 2025 17:51
@quiet-node
Copy link
Contributor Author

Closing this PR as not planned. More information is found in this comment #3678 (comment)

@quiet-node quiet-node closed this Apr 21, 2025
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
None yet
Development

Successfully merging this pull request may close these issues.

[HbarLimitService] Extend HbarLimitService to block all HBAR-consuming RPC methods
1 participant