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

JSON-RPC local cache for v2 bots #855

Merged

Conversation

dkeysil
Copy link
Contributor

@dkeysil dkeysil commented Mar 8, 2024

  • One more HTTP server inside json-rpc-proxy
  • Polls combined block events from the Dispatcher as a R2 links
  • Transforms proto CBE to jsonrpc structures
  • Keeps hot in memory cache for different chains
  • Garbage collection for the cache
  • Authorization and Chain ID extraction from http header

@dkeysil dkeysil force-pushed the kisel/forta-1609-accept-json-rpc-cache-requests-from-bots branch 3 times, most recently from 092a5d7 to c28a758 Compare March 11, 2024 16:31
@dkeysil dkeysil marked this pull request as ready for review March 11, 2024 16:41
Copy link
Contributor

@canercidam canercidam left a comment

Choose a reason for hiding this comment

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

It looks great overall! We could polish it a little more.

services/json-rpc/cache/errors.go Outdated Show resolved Hide resolved
services/json-rpc/cache/cache.go Outdated Show resolved Hide resolved
services/json-rpc/cache/json_rpc_cache.go Outdated Show resolved Hide resolved
clients/r2cbe/events_client.go Outdated Show resolved Hide resolved
services/json-rpc/cache/json_rpc_cache.go Outdated Show resolved Hide resolved
services/json-rpc/cache/json_rpc_cache.go Outdated Show resolved Hide resolved
clients/r2cbe/events_client.go Outdated Show resolved Hide resolved
@dkeysil dkeysil force-pushed the kisel/forta-1609-accept-json-rpc-cache-requests-from-bots branch from 482c8fc to c82476b Compare March 12, 2024 15:12
@dkeysil dkeysil force-pushed the kisel/forta-1609-accept-json-rpc-cache-requests-from-bots branch from c33cbbd to 2f3b2a9 Compare March 15, 2024 10:17
@dkeysil dkeysil force-pushed the kisel/forta-1609-accept-json-rpc-cache-requests-from-bots branch from 927c56f to f83bc1d Compare March 15, 2024 15:56
@dkeysil dkeysil force-pushed the kisel/forta-1609-accept-json-rpc-cache-requests-from-bots branch from f83bc1d to ed41b8c Compare March 21, 2024 08:09
Add cache test

Add json rpc cache to executable

Make cache config optional, debug logs in cache, fix dispatcher url path

Refactor json rpc cache

Fix cache keys

Use mappers from the forta-core-go

Move jsonrpc changes of proxy to cache package

Tweak events polling in cache

Use go-cache package

Rename cbe (Combined Block Event) to BlockData

Add retries to r2_client

Check 404 error body, check if node has assigned bots

Inject sdk cache configuration to agents

Refactor

Fix registry usage

Add logging

Update forta-core-go

Metrics draft

Fix nil panic

Fix params string

Add log on cache miss

Improve polling

Increase bucket time if no bots assigned

Decrease max backoff to 10 seconds

Fix bug in r2 client

Retry on 'Block too old'

Clean metrics in jsonrpc cache
@dkeysil dkeysil changed the title JsonRPC Cache JSON-RPC local cache for v2 bots Apr 1, 2024
@dkeysil dkeysil merged commit d913ff8 into master Apr 2, 2024
6 checks passed
@dkeysil dkeysil deleted the kisel/forta-1609-accept-json-rpc-cache-requests-from-bots branch April 2, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants