-
Notifications
You must be signed in to change notification settings - Fork 698
Add /v3/contracts/fast-call-read endpoint for (authorized) read only calls without cost tracking #6207
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
Add /v3/contracts/fast-call-read endpoint for (authorized) read only calls without cost tracking #6207
Conversation
@kantai as discussed in the nakameeting it does not make too much sense to allow the user to decide about the cost tracking strategy. At this point is not better to just use free cost tracking and enforce max_execution time ? this will result in faster readonly calls "by default" and zero work for builders/users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am not mistaken, the FreeCostTracker doesn't even track memory usage. Could a read-only operation potentially consume significant memory? If so, we might consider implementing a third cost tracker option, something like "MemoryOnly"—that would track memory consumption while still returning zero for runtime costs.
Regarding how to handle the choice between Limited and MemoryOnly trackers: since using FreeTracker can be a security risk, we could restrict the cost_tracker= parameter to authenticated requests only (similar to our current implementation in /v3/block_proposal and /v3/blocks/upload). This would allow trusted clients to specify their preferred tracker while forcing untrusted clients to use the Limited tracker by default
Co-authored-by: Francesco <2530388+Jiloc@users.noreply.github.com>
Co-authored-by: Brice <brice@obycode.com>
Co-authored-by: Brice <brice@obycode.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just missing the timeout error in the open api spec, everything else lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
c76743e
Codecov ReportAttention: Patch coverage is
❌ Your project status has failed because the head coverage (76.63%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #6207 +/- ##
============================================
+ Coverage 45.49% 76.63% +31.13%
============================================
Files 536 543 +7
Lines 343845 345656 +1811
Branches 0 323 +323
============================================
+ Hits 156439 264896 +108457
+ Misses 187406 80752 -106654
- Partials 0 8 +8
... and 427 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This patch adds a new endpoint /v3/contracts/fast-call-read allowing read-only calls to be executed without the cost-tracker.
Given that cost tracking for readonly calls is here mostly for security reasons (avoid run-away calls), the max_execution_time feature of contract calls is automatically enabled (default 30 seconds) and HTTP authorization is required too (not setting the auth-token will basically disable this endpoint) .
The max_execution_time can be configured with the read_only_max_execution_time_secs connection options:
The main reason for this feature is to improve performance of readonly calls (the default cost tracker linearly increases execution times based on the clarity code complexity).
Description
Applicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml