feat(jsonrpc): add blockTimestamp to logs and receipts#6671
Open
0xbigapple wants to merge 1 commit intotronprotocol:developfrom
Open
feat(jsonrpc): add blockTimestamp to logs and receipts#66710xbigapple wants to merge 1 commit intotronprotocol:developfrom
0xbigapple wants to merge 1 commit intotronprotocol:developfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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