Skip to content
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

fix: Eth Event Receipt Logs: use event index for logs #12269

Merged
merged 9 commits into from
Jul 23, 2024

Conversation

aarshkshah1992
Copy link
Contributor

Closes #12254.

itests/eth_filter_test.go Outdated Show resolved Hide resolved
node/impl/full/eth.go Outdated Show resolved Hide resolved
@rvagg
Copy link
Member

rvagg commented Jul 22, 2024

As per my testing methodology for mainnet in #12262 (comment) (using a recent transaction for that same contract):

time curl http://localhost:1234/rpc/v1 -X POST -H "Content-Type: application/json" --data '{"method":"eth_getTransactionReceipt","params":["0x5822ec9187b621b6bdcdbea41c7b52aa2d1d1c88dd9decb38a8f5c6004b14603"],"id":1,"jsonrpc":"2.0"}' | jq .result.logs > /tmp/transaction_receipt.logs
real    0m0.017s
time curl http://localhost:1234/rpc/v1 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock": "0x3eb89b", "toBlock": "0x3eb89b"}],"id":1}' | jq '[.result[] | select(.transactionHash == "0x5822ec9187b621b6bdcdbea41c7b52aa2d1d1c88dd9decb38a8f5c6004b14603")]' > /tmp/get_logs.logs
real    0m0.011s
diff /tmp/transaction_receipt.logs /tmp/get_logs.logs

(no output)

So it looks correct. In this case logIndex starts at 0x77.

eth_getTransactionReceipt is taking longer here than eth_getLogs. Running them repeatedly shows a fairly consistent timing averaging around 0.017s vs 0.011s. I think that can be explained by needing to do a bunch of blockstore loads and a call to ComputeGasOutputs.

@rvagg rvagg mentioned this pull request Jul 22, 2024
9 tasks
@rvagg
Copy link
Member

rvagg commented Jul 23, 2024

@aarshkshah1992 I just discovered this: #10287 which has some notes about potential speed-ups. Not necessary for this PR but important to file away in the memory banks because it goes to the speed concerns that are similar to trace_block and trace_filter.

@aarshkshah1992
Copy link
Contributor Author

@rvagg Yeah I am putting together a list of high value work items for RPC and will add it there.

node/impl/full/eth.go Outdated Show resolved Hide resolved
Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions in there

Base automatically changed from rvagg/events-db-perf to master July 23, 2024 09:19
@aarshkshah1992 aarshkshah1992 force-pushed the fix/eth_getTransactionReceipt-use-event-index branch from c193b32 to 45baa76 Compare July 23, 2024 09:34
@aarshkshah1992 aarshkshah1992 merged commit 4f63a08 into master Jul 23, 2024
79 checks passed
@aarshkshah1992 aarshkshah1992 deleted the fix/eth_getTransactionReceipt-use-event-index branch July 23, 2024 09:54
ribasushi pushed a commit to ribasushi/ci-abusing-lotus-fork that referenced this pull request Aug 20, 2024
…ct#12269)

* use event index for receipt logs

* tests

* increment event count if there is an address mismatch

* itests for receipt logs consistency

* update ChangeLog

* changes as per review

* do not increment event count if address resolution fails

* Apply suggestions from code review

Co-authored-by: Rod Vagg <rod@vagg.org>

* address review

---------

Co-authored-by: Rod Vagg <rod@vagg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ☑️ Done (Archive)
Development

Successfully merging this pull request may close these issues.

Inconsistent logIndex between eth_getLogs and eth_getTransactionReceipt
2 participants