hashgraph / hedera-json-rpc-relay

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

Investigate potential performance improvements to eth_getBlockByNumber/eth_getBlockByHash #841

Open lukelee-sl opened 1 year ago

lukelee-sl commented 1 year ago

Problem

Issue #840 describes a bug where calls to eth_getBlockByNumber/eth_getBlockByHash when specifying a block that contains lots of contract results can lead to performance issues and 502 errors being returned to the user.

One example of such a case is described in #827

FIxing Issue #840 may improve performance in the case where the showDetails parameter is false but does not improve performance sufficiently for blocks with a large set of contract results when the parameter is true.

Solution

Investigate existing or new ways to batch contract results from the mirror node to improve performance.

Alternatives

No response

mshakeg commented 1 year ago

Hi @lukelee-sl , would it not be better to simply get all transactions in a block using the following mirror node endpoint:

/api/v1/contracts/results?limit={contractResults.results.length}&order=asc&block.{number|hash}={blockHashOrNumber}&internal={false??}

instead of doing batches on the existing call:

/api/v1/contracts/results/{txHash}
lukelee-sl commented 1 year ago

Hi @mshakeg. Thanks for the suggestion. I'd have to look into it further but looks like that should work.

Nana-EC commented 6 hours ago

We made some advancements here and no longer have large perf concerns. However, we should also see how to add this consideration of large blocks to the load testing flow