Implement comprehensive LRU caching to reduce Ethereum RPC and IPFS gateway calls#2281
Draft
Implement comprehensive LRU caching to reduce Ethereum RPC and IPFS gateway calls#2281
Conversation
Co-authored-by: pablomendezroyo <41727368+pablomendezroyo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement caching to reduce unnecessary Ethereum RPC and IPFS gateway calls
Implement comprehensive LRU caching to reduce Ethereum RPC and IPFS gateway calls
Oct 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a robust caching solution to address performance issues with repeated Ethereum RPC and IPFS gateway calls throughout the DAppNode system. The solution introduces a new
@dappnode/cachepackage with LRU (Least Recently Used) cache functionality and integrates it into three critical areas.Problem
DAppNode was making unnecessary repeated calls to:
This resulted in increased latency, potential rate limiting, and inefficient resource usage.
Solution
New Cache Package (
@dappnode/cache)Created a dedicated caching package built on
lru-cachev11.x with:DappnodeCacheclass with configurable TTL and size limitsCache Integration Points
1. DAppStore Data Caching (
fetchDirectory)2. Smart Contract Address Caching (
updateMyPackages)3. Staker Configuration Caching (
stakerConfigGet)Cache Configuration
Each cache is optimized for its specific use case:
Performance Benefits
Testing
All functionality is thoroughly tested with:
The implementation maintains full backward compatibility while providing significant performance improvements for high-traffic operations.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
binaries.soliditylang.org/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)ethereum.github.io/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)ns.dappnode.io/usr/local/bin/node --experimental-specifier-resolution=node --import=tsx/esm /home/REDACTED/work/DNP_DAPPMANAGER/DNP_DAPPMANAGER/packages/utils/node_modules/mocha/lib/cli/cli.js ./test/unit --no-config --recursive --no-package --color --exit --extension ts --require dotenv/config --diff --reporter spec --slow 75 --timeout 2000 --ui bdd --watch-ignore node_modules --watch-ignore .git(dns block)ofcncog2cu-dsn.algolia.netnode /usr/local/bin/yarn add @dappnode/cache@workspace:^0.1.0(dns block)relay.trufflesuite.com/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)solc-bin.ethereum.org/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.