Skip to content

Conversation

@JonathanOppenheimer
Copy link
Member

@JonathanOppenheimer JonathanOppenheimer commented Oct 27, 2025

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

@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/remove-customlogs branch from e217ea6 to b7b10f5 Compare October 27, 2025 19:21
@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/remove-customlogs branch from b7b10f5 to e625127 Compare October 27, 2025 19:22
@JonathanOppenheimer JonathanOppenheimer changed the title Jonathan oppenheimer/remove customlogs Remove customlogs package Oct 27, 2025
@JonathanOppenheimer JonathanOppenheimer self-assigned this Oct 27, 2025
@JonathanOppenheimer JonathanOppenheimer marked this pull request as ready for review October 27, 2025 20:23
@JonathanOppenheimer JonathanOppenheimer requested a review from a team as a code owner October 27, 2025 20:23
unfiltered = append(unfiltered, receipt.Logs...)
receiptLogs = append(receiptLogs, receipt.Logs)
}
logs = logs[:0] // reset the slice
Copy link
Contributor

@joshua-kim joshua-kim Oct 28, 2025

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)...)
	}

Copy link
Member Author

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

Copy link
Contributor

@joshua-kim joshua-kim Oct 28, 2025

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?

Copy link
Member Author

@JonathanOppenheimer JonathanOppenheimer Oct 28, 2025

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.

Copy link
Contributor

@joshua-kim joshua-kim Oct 28, 2025

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.

Copy link
Member Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants