Repository navigation
fix(jsonrpc): reuse receipts for transaction values - #7147
Closed
0xbigapple wants to merge 1 commit into
Closed
0xbigapple wants to merge 1 commit into
0xbigapple wants to merge 1 commit into
Conversation
Reuse the block receipt list when formatting full transaction objects. Read the value of withdrawal and unfreeze transactions from their receipts and use zero when the block receipt list is unavailable. Pass the receipt from single-transaction queries to TransactionResult so gas and value share one lookup.
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?
Reuse the transaction receipts already loaded by JSON-RPC block and transaction queries to populate
gasandvalue.eth_getBlockByNumberandeth_getBlockByHashwithfullTx=true, pass each transaction's receipt fromBlockResulttoTransactionResult. When the receipt and transaction counts match, use the receipt at the same index. Otherwise, use an empty receipt for each transaction in the full response.eth_getTransactionByHash,eth_getTransactionByBlockHashAndIndex, andeth_getTransactionByBlockNumberAndIndex, use the same receipt for both fields. If the transaction exists but its receipt is missing, the five receipt-dependent transaction types return"0x0"for both fields.Why are these changes required?
The five affected types are
UnfreezeBalanceContract,UnfreezeBalanceV2Contract,WithdrawBalanceContract,WithdrawExpireUnfreezeContract, andCancelAllUnfreezeV2Contract. Their reportedvaluecomes from the execution receipt.Previously, after loading the block's receipts, the formatter looked up each affected transaction again by ID. With receipts stored in
TransactionRetStore, each lookup read and decoded the entire block's receipts to find one transaction. A full block query containing five affected transactions therefore decoded the same receipt record six times. It now decodes it once.This PR has been tested by:
Follow up
Extra details