-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rpc] Add New RPC GetReceiptsByBlockHash for quering all receipts of the block in bulk #3826
Conversation
03fe3aa
to
d988736
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not very sure about this design, but why can't we simply use Receipt.GasUsed
? Is there anything missing here?
From @hypnagonia 's description, the explorer usually calls RPC GetBlocks, and GetBlocks calls GetBlockByNumber one by one from start height to end height. the information returned here does not have the usedGas of each tx. maybe @hypnagonia needs to get each tx directly from the return message here And indeed there is no similar interface like GetReceiptByTxHash, only GetReceiptsByBlockHash |
3a770e5
to
cbf44a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand whether there is need to modify APIs. This operation will add some extra burden to already heavily used GetBlockByNumber
. Would you please add some lines of description of the necessity of modifying APIs instead of optimizing at DAPP?
Do you mean to add a new RPC to serve the query usedGas? Instead of putting it inside the return body of GetBlockByNumber improve payload pressure? Actually, here's what I was thinking
Perhaps, you have other better suggestions? |
Why don't you implement a new RPC method called |
As I mentioned above, adding a new RPC is indeed one way to do this. So it mostly depends on @hypnagonia 's needs. If he feels that this approach will not cause too many changes to his business code, I can do that. |
cbf44a4
to
a1050ef
Compare
886672d
to
93dbfba
Compare
Hi,@JackyWYX could you pleaese review it again? |
Hi, Did the gas returned through hmy_getTransactionReceipt experience hex twice? |
Issue
#3821
Test
No test with @hypnagonia
Local Test
Use RPC to comapre reponse data for same blockHash and TxHash is consistent:
curl -d '{ "jsonrpc":"2.0", "method":"hmy_getBlockByHash", "params":[ "0x73852a261acd91e6ee0b72e4b39eb3ee42ec31cfb13a5b1b0fdb676e9dbc358c", true], "id":1 }' -H "Content-Type:application/json" -X POST http://127.0.0.1:9500
response data:
data.zip
curl -d '{ "jsonrpc":"2.0", "method":"hmy_getReceiptsByBlockHash", "params":["0x73852a261acd91e6ee0b72e4b39eb3ee42ec31cfb13a5b1b0fdb676e9dbc358c"], "id":1 }' -H "Content-Type:application/json" -X POST http://127.0.0.1:9500
reponse data:
bb.zip
curl -d '{ "jsonrpc": "2.0", "method": "hmy_getTransactionReceipt", "params": [ "0xcd2634fdaaff70ab8c538e99b8cbf44ee56fd2073f54ceeeeeb9962b447691a8"], "id": 1}' -H "Content-Type:application/json" -X POST http: //127.0.0.1:9500
reponse data:
uu.zip