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

Example: Manual P2P #4736

Merged
merged 6 commits into from
Sep 24, 2023
Merged

Conversation

mouseless0x
Copy link
Contributor

Example of peer communication using low level components from the net crate.

  • Find peers using discv4
  • Make a P2P handshake with a peer
  • Make an ETH Wire handshake with a peer
  • Listen in on peer's broadcasts (new txs & blocks)

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #4736 (a026a95) into main (f153d8f) will increase coverage by 0.17%.
Report is 72 commits behind head on main.
The diff coverage is n/a.

Impacted file tree graph

see 114 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.50% <ø> (-0.47%) ⬇️
unit-tests 63.48% <ø> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 32.11% <ø> (+0.73%) ⬆️
blockchain tree 83.73% <ø> (+0.14%) ⬆️
pipeline 88.53% <ø> (-0.01%) ⬇️
storage (db) 73.70% <ø> (+0.25%) ⬆️
trie 94.77% <ø> (+0.03%) ⬆️
txpool 49.50% <ø> (+0.33%) ⬆️
networking 77.08% <ø> (-0.11%) ⬇️
rpc 57.55% <ø> (+0.20%) ⬆️
consensus 63.09% <ø> (+0.67%) ⬆️
revm 28.33% <ø> (+8.66%) ⬆️
payload builder 8.32% <ø> (-0.76%) ⬇️
primitives 86.54% <ø> (+0.09%) ⬆️

Copy link
Member

@gakonst gakonst 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 cool. no objections. thank you for taking this on! curious if you have any api feedback improvement ideas?

find peer via discv4 -> p2p handshake -> eth handshake -> listen to msgs

maybe @mattsse has thoughts on API improvements so holding off on merging

examples/manual-p2p.rs Outdated Show resolved Hide resolved
examples/manual-p2p.rs Outdated Show resolved Hide resolved
examples/manual-p2p.rs Outdated Show resolved Hide resolved
examples/manual-p2p.rs Outdated Show resolved Hide resolved
examples/manual-p2p.rs Outdated Show resolved Hide resolved
@mouseless0x
Copy link
Contributor Author

this is cool. no objections. thank you for taking this on! curious if you have any api feedback improvement ideas?

find peer via discv4 -> p2p handshake -> eth handshake -> listen to msgs

maybe @mattsse has thoughts on API improvements so holding off on merging

Don't have any immediate feedback, setting up each layer was clear + intuitive enough

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.

last style nits

examples/manual-p2p/src/color_print_macros.rs Outdated Show resolved Hide resolved
examples/manual-p2p/src/main.rs Outdated Show resolved Hide resolved
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.

tysm for this

@mattsse mattsse added this pull request to the merge queue Sep 24, 2023
Merged via the queue into paradigmxyz:main with commit 0a4e428 Sep 24, 2023
23 checks passed
@mouseless0x mouseless0x deleted the manual-p2p-example branch September 24, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants