feat(jsonrpc): add blockTimestamp to logs and receipts#6671
feat(jsonrpc): add blockTimestamp to logs and receipts#66710xbigapple wants to merge 3 commits intotronprotocol:developfrom
Conversation
92d7b71 to
b3c6ccb
Compare
|
[SHOULD] The implementation looks good and I’m comfortable approving it. One follow-up I’d still recommend is adding direct API-level coverage for |
Thanks for the follow-up. Since |
What does this PR do?
Adds the
blockTimestampfield to the log objects returned by JSON-RPC event and receipt query interfaces, aligning the TRON JSON-RPC implementation with the Ethereum execution-apis specification. close #6617Specifically, it updates:
LogFilterElement(used ineth_getLogs,eth_getFilterLogs,eth_getFilterChanges(about log/event filter)) to includeblockTimestamp.TransactionLogwithinTransactionReceipt(used ineth_getTransactionReceipt,eth_getBlockReceipts) to includeblockTimestamp.The timestamp is extracted from the corresponding
TransactionInfo'sblockTimeStamp, divided by 1000 to convert to seconds, and returned as a hexadecimal string (e.g.,"0x3e8").Why are these changes required?
To maintain compatibility with the evolving Ethereum JSON-RPC API standards. Adding the block generation timestamp directly to the log objects enables developers and dApps to process event streams with precise time context without needing to perform secondary
eth_getBlockByHash/Numberqueries, significantly reducing network overhead and improving client efficiency.This PR has been tested by:
LogMatchExactlyTest.javato verifyblockTimestampinLogFilterElement.TransactionReceiptTest.javato verifyblockTimestampinTransactionReceipt.TransactionLog.Follow up
Extra details