Open
Description
Description
We need to optimize the smart contract state query to make the RPC API requests cache-able by Glif. Currently, our implementation is causing excessive RPC calls which is significantly increasing our Glif bill.
Background
This issue was identified in PR #117 where we're adding ethers.js as a dependency to address miners not having their scores recorded. While implementing this solution, we discovered that our current approach to state queries is not optimal for cacheability.
Proposed Solution
- Use the existing
rpc
helper inlib/miner-info.js
to make RPC API calls directly - Rework smart contract state queries to ask for state as of a given tipset
- Implement a lightweight solution to parse binary responses to JavaScript objects
Implementation Notes
- We already use the
rpc
helper for MinerInfo state queries - This approach may be easier than using Ethers.js or viem for this specific use case
- The optimization should be implemented soon after the initial version deployment (within days)
Related PR
- feat: peer id smart contract support #117 (Adding ethers.js dependency)
Originally posted by @bajtos in feat: peer id smart contract support #117 (comment)
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
📥 candidate