harmony
harmony copied to clipboard
Make blockNumber rpc more efficient with atomic uint64
Previous _blockNumber rpc is retrieving the latest block, copying the header and returning the number from the header, which is very unnecessary and expensive.
Adding a uint64 atomic value to store the latest block number and directly turning it.
Also increase receiptsCacheLimit to 256 and reduce rpcGetBlocksLimit to 64
Change tested locally.
How much resources we are saving for blockNumber requests? Is there a benchmark showing the improvement?
No benchmark yet. @AlexiaChen is working on a loadtest and benchmark tool.
I really like this PR. I will be resubmitting it.