hashgraph / hedera-json-rpc-relay

Implementation of Ethereum JSON-RPC APIs for Hedera
Apache License 2.0
68 stars 73 forks source link

[EPIC] Update RPC endpoints to handle the new implicit 60d limit in mirror node #3038

Open victor-yanev opened 1 month ago

victor-yanev commented 1 month ago

Problem

With the recent changes to the Hedera-operated mirror node, queries to the mirror node REST API are now limited to a 60-day historical data range by default. Several RPC methods that rely on these API endpoints for fetching account, transaction, block, and contract data need to be updated to handle this implicit 60-day limit. Without these updates, users querying for data beyond this time range may experience incomplete results or data inconsistencies.

Solution

Update all relevant RPC endpoints to comply with the new 60-day limit by utilizing timestamp parameters in API requests. For endpoints where time-based data is fetched, ensure that the appropriate timestamps are passed in API calls to retrieve historical data. Additionally, modify logic to handle pagination through the links.next functionality for retrieving data outside the default 60-day window. These changes will ensure that the RPC endpoints return consistent and complete results while respecting the mirror node’s new limitations.

Notes for reviewer:

RPC endpoint # extra calls to MAPI needed
eth_getBlockByHash no extra calls needed
eth_getBlockByNumber no extra calls needed
eth_getTransactionByHash one call to transactions/{transactionId}
eth_getTransactionReceipt one call to transactions/{transactionId}
eth_getTransactionByBlockHashAndIndex one call to blocks/{hashOrNumber}
eth_getTransactionByBlockNumberAndIndex one call to blocks/{hashOrNumber}
debug_traceTransaction no extra calls needed

Alternatives

No response

### Tasks
- [ ] https://github.com/hashgraph/hedera-json-rpc-relay/issues/3039
- [ ] https://github.com/hashgraph/hedera-json-rpc-relay/issues/3040
- [ ] https://github.com/hashgraph/hedera-json-rpc-relay/issues/3041
- [ ] https://github.com/hashgraph/hedera-json-rpc-relay/issues/3042
- [ ] https://github.com/hashgraph/hedera-json-rpc-relay/issues/3043
quiet-node commented 1 month ago

@victor-yanev I saw the ticket is moved to done. Please confirm if we can close this.