Skip to content

Speeding up eth_getTransactionReceipt #26974

@fjl

Description

@fjl

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:

  1. load inclusion block from the txhash -> block index
  2. load the full block from the database
  3. find the tx in the block
  4. verify tx signature and derive the sender
  5. load/parse all receipts in the block
  6. derive non-consensus fields for all receipts
  7. 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:

  1. load the inclusion block, sender, etc. from the txhash -> block index
  2. load the full block from the database
  3. find the tx in the block
  4. load all receipts in the block
  5. find receipt n
  6. derive fields of receipt n
  7. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions