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

feat(discv4): neighbors packet logging #12042

Merged

Conversation

khayss
Copy link
Contributor

@khayss khayss commented Oct 24, 2024

This is a draft PR.

I have gone through the code base and discovered where the Neighbours packet is received.

I believe it is in here:
https://github.com/paradigmxyz/reth/blob/bea6e278dfdb052ce7bbcec5d42349221aa04b84/crates/net/discv4/src/lib.rs#L1770C28-L1773C30

Based on the current structure of the match block the packet is received, I added the implementation of the trace logs in the on_neighbours method definition of the Discv4Service impl block.
I also added a dependency in the misc section of discv4, this is the itertools package which allows for nice formatting of Vec items.

The code compiled and I ran tests which all passed.

I'd like to get reviews and also help on how I can test to see if the logs are emitted.

Tests

All tests passed.
image

@onbjerg onbjerg marked this pull request as draft October 24, 2024 13:29
Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

Converted the PR to a draft, you can do that when opening it, or on the right if you already have the PR open under "Reviewers" (it will say something like "Convert to draft")

I also changed the PR title, we try to just use feat:/fix:/test:/perf:/chore: and so on :)

Generally, the PR looks good! Just some minor formatting nits. Thanks for taking this on.

For testing, you can try just running the neighbors test and adding --nocapture to the test command and setting RUST_LOG=discv4=trace, e.g. RUST_LOG=discv4=trace cargo test -p reth-discv4 neighbors_max_nodes -- --nocapture

crates/net/discv4/src/lib.rs Outdated Show resolved Hide resolved
crates/net/discv4/src/lib.rs Outdated Show resolved Hide resolved
crates/net/discv4/src/lib.rs Outdated Show resolved Hide resolved
@onbjerg onbjerg added A-observability Related to tracing, metrics, logs and other observability tools A-discv4 Related to discv4 discovery labels Oct 24, 2024
@onbjerg onbjerg changed the title [Draft] C enhancement: neighbors packet logging feat(discv4): neighbors packet logging Oct 24, 2024
@khayss
Copy link
Contributor Author

khayss commented Oct 24, 2024

I have made all the changes as specified above.

Also ran the test with the log level set to TRACE and confirmed the trace log is emitted when neighbor peers are received.

Kindly review and point out any corrections where necessary. Thanks

image

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this is good, but please remove all additional ; :)

and use nightly formatting cargo +nightly fmt

@mattsse mattsse marked this pull request as ready for review October 26, 2024 06:19
Copy link
Member

onbjerg commented Oct 29, 2024

ping @khayss, could you remove the extra semicolons? otherwise this looks good to me:)

@onbjerg onbjerg force-pushed the c-enhancement/neighbors-packet-logging branch from f46723f to 2841fc6 Compare October 29, 2024 21:10
@onbjerg onbjerg added this pull request to the merge queue Oct 29, 2024
Copy link
Member

onbjerg commented Oct 29, 2024

Merge activity

  • Oct 29, 5:24 PM EDT: Graphite couldn't merge this PR because it failed for an unknown reason (Stack merges are not currently supported for forked repositories. Please create a branch in the target repository in order to merge).

Merged via the queue into paradigmxyz:main with commit 734c78f Oct 29, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-discv4 Related to discv4 discovery A-observability Related to tracing, metrics, logs and other observability tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants