-
Notifications
You must be signed in to change notification settings - Fork 21.3k
Open
Labels
Description
Here's an idea for speeding up RPC method eth_getTransactionReceipt
, i.e. the operation that
loads a single receipt by txhash. Right now, this operation is very slow because it has to:
- load inclusion block from the txhash -> block index
- load the full block from the database
- find the tx in the block
- verify tx signature and derive the sender
- load/parse all receipts in the block
- derive non-consensus fields for all receipts
- return receipt n
Some of these steps should be avoidable. I propose that, in the tx inclusion index (txhash -> block)
we should also store the tx sender, as well as other information required to derive receipt fields.
If this information was available, the steps for resolving a single receipts would be:
- load the inclusion block, sender, etc. from the txhash -> block index
- load the full block from the database
- find the tx in the block
- load all receipts in the block
- find receipt n
- derive fields of receipt n
- return it
This doesn't look very different, but there is another advantage: we wouldn't need to actually parse the receipts just to load the nth one. Decoding receipts is slow, and a bit of time can be saved by not doing it. Unrelated derivation of receipt fields is also avoided.