Closed sideninja closed 2 months ago
[!WARNING]
Rate limit exceeded
@sideninja has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 34 seconds before requesting another review.
How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.Commits
Files that changed from the base of the PR and between ec697a74d52065b5f5ed30551cd5a45c8a6caba2 and c91c1e3b51f914afcbd8e2f120ebec434ba2c9a5.
The changes introduce a caching mechanism to the Requester
service, which enhances the efficiency of script execution. A new type, scriptType
, categorizes script operations, and a map associates these types with their bytecode. The EVM
struct now includes a scriptCache
field that utilizes an LRU cache. The executeScriptAtHeight
method is refactored to leverage this cache, optimizing performance by reducing redundant executions and improving error handling.
Files | Change Summary |
---|---|
config/config.go |
Added CacheSize field to Config struct and updated FromFlags function to include a command-line flag for cache size. |
services/requester/requester.go |
Introduced caching mechanism, defined scriptType , added scripts map, modified EVM struct with scriptCache , and refactored executeScriptAtHeight . |
services/requester/requester_test.go |
Added unit tests for caching functionality, including tests for cache behavior at specific heights and cache expiry. New functions for testing cache key generation included. |
sequenceDiagram
participant Client
participant EVM
participant Cache
participant Script
Client->>EVM: Request script execution (scriptType)
EVM->>Cache: Check if result exists
alt Cache hit
Cache-->>EVM: Return cached result
EVM-->>Client: Return result
else Cache miss
EVM->>Script: Execute script
Script-->>EVM: Return execution result
EVM->>Cache: Store result in cache
EVM-->>Client: Return result
end
🐰
In the meadow where scripts do play,
A cache was built to save the day.
With types and maps, oh what a sight,
Efficiency hops, taking flight!
No more waits, just swift delight,
Thank you, dear code, for making it right!
🌼
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Description
Add support for caching on the EVM requester so it offloads the ANs.
For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
New Features
Bug Fixes
Tests