-
Notifications
You must be signed in to change notification settings - Fork 21.2k
ethapi: reduce some of the wasted effort in GetTransactionReceipt #32021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a25ac66
to
92ac972
Compare
92ac972
to
b6270a5
Compare
e83328c
to
5970887
Compare
all done @fjl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
@rjl493456442, here are the benchmark numbers you asked for
|
9cab99c
to
977bcf4
Compare
squashed everything so I can rebase another PR on top of this. |
this is an attempt at reducing wasted effort in GetReceiptByHash by not decoding or deriving unrelated receipts
977bcf4
to
9a8da8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Btw, I just realized that our RPC (e.g. eth_getTransactionReceipt) doesn't serve receipt on side chain. It's aligned with the old implementation though, not sure if we should fix it or now. |
for indx, receipt := range receipts { | ||
receiptByLookup, err := chain.GetCanonicalReceipt(body.Transactions[indx], receipt.BlockHash, | ||
receipt.BlockNumber.Uint64(), uint64(indx)) | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this would get rid of the new assert dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not an entirely new dependency since it is being used by other packages, so I thought it would be fine. But we could remove if its not something we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Compared to the latest release, this PR achieves around 1.5x speed up. |
…hereum#32021) Towards ethereum#26974 --------- Co-authored-by: Gary Rong <[email protected]>
Towards #26974
Best reviewed commit by commit.
From my benchmarks, it seems that the dominant cost is still the DB reads. Sender derivation seems to be negligible.
Currently for a single receipt to be served we need to do multiple DB reads. If we are so concerned about the performance of this RPC, we should make the receipts self-contained so they don't need data from multiple queries to be stitched together to make a full receipt. This comes at the expense of slight increase in storage requirements but it might be acceptable given that EIP-4444 is in the works.