-
Couldn't load subscription status.
- Fork 159
Remove customlogs package
#1371
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
base: master
Are you sure you want to change the base?
Conversation
e217ea6 to
b7b10f5
Compare
b7b10f5 to
e625127
Compare
customlogs package
eth/filters/filter.go
Outdated
| unfiltered = append(unfiltered, receipt.Logs...) | ||
| receiptLogs = append(receiptLogs, receipt.Logs) | ||
| } | ||
| logs = logs[:0] // reset the slice |
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.
Is this a bug? We're resetting the slice - so all of the txLogs that matched the filter are now gone from the slice and are replaced by things in receiptLogs that match the filter.
The old code reset the slice because it put the unfiltered receipt logs into that var - and copied over things that matched the filter in to logs. If we wanted to simplify we could get rid of unfiltered and just have a single logs var that we just add matches to like:
for _, r := range receipts {
logs = append(logs, filterLogs(r.Logs, nil, nil, f.addresses, f.topics)...)
}
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.
This is significantly cleaner thank you
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.
We still reset the slice - is this a bug?
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.
No, I don't think so. first pass: we get some logs and filter them to find matches, then we check the log to see if has a TxHash, if yes return, if not the logs are incomplete, so we get the "real" full logs from reciepts, but first we throw away the incomplete logs (logs = logs[:0]) and then replace them with the complete filtered logs from receipts.
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.
I don't know the difference between receipts and underived logs (the sentinel value of empty hash is confusing to me - I don't know when it's supposed to be used) - so the reviewer on EVM should double-check me here.
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.
Sounds good - I would also appreciate some clarification. My understanding is that reciepts are a superset of logs, as they're both derived from the same source but undergo varying degrees of refinement. @ceyonur do you know?
Why this should be merged
See this comment ava-labs/avalanchego#4332 (comment) by @joshua-kim. The package is not needed and shouldn't be removed. Where it is used can be adjusted, or the function can just be in-lined.
How this was tested
Existing CI
Need to be documented?
No
Need to update RELEASES.md?
No