-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
Nest.jsStellar WaveIssues in the Stellar wave programIssues in the Stellar wave programbackendNew feature or requestNew feature or request
Description
π Overview
Frequent gas queries can overload RPC nodes, leading to higher latency and potential rate-limiting issues. Caching responses improves performance, reduces backend load, and ensures consistent data delivery.
This task introduces a caching layer for gas queries using Redis to optimize GasGuard API responsiveness and reliability.
π― Objective
Build a system that:
- Caches gas query results to reduce repeated RPC calls
- Provides configurable cache expiration per endpoint or chain
- Maintains data accuracy while improving response times
- Lowers API latency and backend resource usage
π Scope of Work
1οΈβ£ Caching Implementation
- Integrate Redis as caching backend
- Cache gas query results:
- Base fee, priority fee, max fee
- Chain-specific metrics
- Volatility or analytics data if frequently requested
- Support configurable TTL (time-to-live) per query type
- Implement cache invalidation for outdated data
2οΈβ£ API Integration
-
Intercept gas query endpoints to:
- Check cache before making RPC call
- Serve cached data if available
- Update cache when RPC response is retrieved
-
Example pseudo-flow:
Client -> API Endpoint -> Redis Cache? -> Return Cached / Fetch from RPC -> Store in Cache -> Return Response
3οΈβ£ Metrics & Monitoring
- Track cache hit/miss rates for each endpoint
- Optional integration with Prometheus for cache performance monitoring
- Log cache failures or Redis connection issues for diagnostics
4οΈβ£ Security & Access
- Redis access secured via authentication
- Cache only non-sensitive public data (gas queries)
- Logging for operational transparency
π§° Suggested Tech Stack
Core
- TypeScript
- Node.js
- Redis (in-memory caching)
- ioredis or node-redis library
- Express / Fastify / NestJS
Optional Enhancements
- Prometheus metrics for cache efficiency
- Redis cluster for high availability and scalability
- Jest (unit testing)
π§ Implementation Expectations
- Clear separation between:
- RPC query layer
- Redis caching layer
- API response layer
- Efficient cache lookup and invalidation logic
- Unit tests covering:
- Cache hit/miss behavior
- TTL expiration
- RPC fallback when cache unavailable
- Multi-chain and multi-endpoint queries
π Deliverables
- Redis caching layer integrated with gas query endpoints
- Configurable TTL and cache invalidation logic
- Metrics and logging for cache performance
- Documentation explaining:
- Cache usage
- TTL configuration
- Operational monitoring
- Unit tests (minimum 70% coverage)
- Updated README
π· Difficulty Level
Intermediate
Ideal for contributors with:
- Backend TypeScript experience
- Knowledge of caching strategies and Redis
- Understanding of multi-chain gas query patterns
- Performance optimization mindset
π Estimated Time
24hrs (part-time contributor)
β Acceptance Criteria
- Gas queries return cached data when available
- RPC calls reduced due to effective caching
- Configurable TTL implemented
- Metrics and logging operational
- Documentation updated
- All tests passing
π― Expected Outcome
GasGuard achieves lower latency and reduced RPC load, ensuring faster responses and more reliable gas data delivery for clients and dApps.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Nest.jsStellar WaveIssues in the Stellar wave programIssues in the Stellar wave programbackendNew feature or requestNew feature or request