-
Notifications
You must be signed in to change notification settings - Fork 693
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: fix not append logs when tx was reverted #1747
Conversation
We require contributors @graykode to read our Contributor License Agreement, please check the CLA document |
Hey @graykode thanks for your feedback on this. I'll take a look into that to make sure we don't return the logs from reverted transactions when calling The solution you propose fixes the problem, but solving it in the I'll be performing an investigation around this topic to make sure the behavior works as is in Ethereum and also want to try a different solution to reduce the overhead in the |
@tclemos Cool I'll check it out too in Ethereum |
@tclemos I have a question, https://github.com/0xPolygonHermez/zkevm-node/blob/develop/jsonrpc/endpoints_eth.go#L343 already uses context related to |
yep, the |
@tclemos Then, isn't this also the overhead caused by using |
Also I find bug that failed txs(reverted) are not mined. It was denied by rpc node. |
it was fixed here: #1744 |
No, the overhead is calling the state for every log, we can filter it directly when reading the logs from the db for example, but we could also avoid storing these logs if they are not needed, I still need to investigate if they should affect the state somehow. |
@cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
I checked the code in go-ethereum and found that event logs are not recorded in a block when transactions fail. This causes issues when trying to debug failed transactions using tools like etherscan, which execute Here are the reasons I found:
Therefore, I reverted before commit and added a filter where |
Yes, nice investigation. The approach to filter logs in the query DB is correct when trying to avoid the overhead by calling the DB multiple times, but the change to the DB query is wrong. Inner join is meant to join tables, so when adding the So, instead of having this: INNER JOIN state.receipt r ON r.status = 1 we should have something like this: INNER JOIN state.receipt r ON r.tx_hash = t.hash
...
WHERE ...
AND r.status = 1 |
@tclemos Then, can I open new pr about fixing postgresql query. @arnaubennassar |
@graykode It's not needed, the problem is going to be solved in a step before, the current query will work and the data will be filtered when the tx is executed, not generating logs for reverted TXs. |
#1746.
What does this PR do?
Skip event logs on failed tx.
Reviewers
Main reviewers:
Codeowner reviewers: