Skip to content

[Libp2p] Add libp2p based P2P Network implementation (part 3)#540

Merged
bryanchriswhite merged 33 commits intomainfrom
chore/libp2p-2
Mar 3, 2023
Merged

[Libp2p] Add libp2p based P2P Network implementation (part 3)#540
bryanchriswhite merged 33 commits intomainfrom
chore/libp2p-2

Conversation

@bryanchriswhite
Copy link
Copy Markdown
Collaborator

@bryanchriswhite bryanchriswhite commented Feb 23, 2023

Description

This is another of a series of PRs split out from #500. Here we add a new implementation of typesP2P.Network in terms of libp2p abstractions, utilizing the helpers which were added in #534.

Issue

#347

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Added a new typesP2P.Network implementation to the libp2p module directory
  • Added embedded modules.InitializableModule to the P2P AddrBookProvider interface so that it can be dependency injected as a modules.Module via the bus registry.
  • Added PoktProtocolID for use within the libp2p module or by public API consumers

Testing

  • make develop_test
  • LocalNet w/ all of the steps outlined in the README

Required Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have tested my changes using the available tooling
  • I have updated the corresponding CHANGELOG

If Applicable Checklist

  • I have updated the corresponding README(s); local and/or global
  • I have added tests that prove my fix is effective or that my feature works
  • I have added, or updated, mermaid.js diagrams in the corresponding README(s)
  • I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

@bryanchriswhite bryanchriswhite added the p2p P2P specific changes label Feb 23, 2023
@bryanchriswhite bryanchriswhite self-assigned this Feb 23, 2023
@bryanchriswhite bryanchriswhite marked this pull request as ready for review February 23, 2023 13:55
@bryanchriswhite bryanchriswhite requested review from Olshansk and deblasis and removed request for Olshansk February 23, 2023 13:56
(cherry picked from commit 2c8989f)
Comment on lines +73 to +74
// IMPROVE: receive context in interface methods.
ctx := context.Background()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not actionable: 💯 it's something that we should do across the board more or less. I am dealing with this in persistence at the moment. It's fun!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

➕ 1️⃣

Copy link
Copy Markdown
Contributor

@deblasis deblasis left a comment

Choose a reason for hiding this comment

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

Nice one @bryanchriswhite! A couple minor changes but otherwise LGTM 🚀

Copy link
Copy Markdown
Contributor

@deblasis deblasis left a comment

Choose a reason for hiding this comment

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

There's a small typo but I trust you to fix it even if I am approving this. :)

@bryanchriswhite bryanchriswhite linked an issue Mar 1, 2023 that may be closed by this pull request
6 tasks
* main:
  [Libp2p] Add libp2p module directories and helpers (part 1) (#534)
  [P2P, Runtime] Update P2P & base config (part 2) (#535)
  [Utility] Foundational bugs, tests, code cleanup and improvements (2/3) (#550)
  [CONSENSUS] Find issue with sending metadata request (#548)
  [Tooling] SLIP-0010 HD Child Key Generation (#510)
@gitguardian

This comment was marked as outdated.

@bryanchriswhite bryanchriswhite changed the base branch from chore/libp2p-1 to main March 3, 2023 11:20
@bryanchriswhite bryanchriswhite merged commit 43d5c2b into main Mar 3, 2023
@bryanchriswhite bryanchriswhite deleted the chore/libp2p-2 branch March 3, 2023 12:40
bryanchriswhite added a commit that referenced this pull request Mar 3, 2023
## Description

This is another of a series of PRs split out from
#500. Here we add a new
`modules.P2PModule` implementation which utilizes the `typesP2P.Network`
implementation which was added in #540. It will be utilized together
with the config changes introduced by #535 in forthcoming changes to the
node and debug CLI.

## Issue

#347 

## Type of change

Please mark the relevant option(s):

- [x] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Added a new `modules.P2PModule` implementation to the `libp2p` module
directory

## Testing

- [x] `make develop_test`
- [x]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
w/ all of the steps outlined in the `README`

## Required Checklist

- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have tested my changes using the available tooling
- [x] I have updated the corresponding CHANGELOG

### If Applicable Checklist

- [ ] I have updated the corresponding README(s); local and/or global
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)
// PoktProtocolID is the libp2p protocol ID used when opening a new stream
// to a remote peer and setting the stream handler for the local peer.
// Libp2p APIs use this to distinguish which multiplexed protocols/streams to consider.
PoktProtocolID = protocol.ID("pokt/v1.0.0")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One small line of code for a go package, one giant leap for the protocol

Comment on lines +73 to +74
// IMPROVE: receive context in interface methods.
ctx := context.Background()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

➕ 1️⃣

bryanchriswhite added a commit that referenced this pull request Mar 18, 2023
## Description

Due to circumstances and timing, @Olshansk's final review on #540 came
in after merging. This PR implements improvements based on that review
feedback.

## Issue

Related to #347

## Type of change

Please mark the relevant option(s):

- [ ] New feature, functionality or library
- [ ] Bug fix
- [x] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Correct libp2p module tests
- Improve libp2p code quality in response to post-merge review feedback

## Testing

- [ ] `make develop_test`
- [ ]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
w/ all of the steps outlined in the `README`

## Required Checklist

- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have tested my changes using the available tooling
- [ ] I have updated the corresponding CHANGELOG

### If Applicable Checklist

- [ ] I have updated the corresponding README(s); local and/or global
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)
dylanlott pushed a commit that referenced this pull request Mar 24, 2023
## Description

Due to circumstances and timing, @Olshansk's final review on #540 came
in after merging. This PR implements improvements based on that review
feedback.

## Issue

Related to #347

## Type of change

Please mark the relevant option(s):

- [ ] New feature, functionality or library
- [ ] Bug fix
- [x] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Correct libp2p module tests
- Improve libp2p code quality in response to post-merge review feedback

## Testing

- [ ] `make develop_test`
- [ ]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
w/ all of the steps outlined in the `README`

## Required Checklist

- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have tested my changes using the available tooling
- [ ] I have updated the corresponding CHANGELOG

### If Applicable Checklist

- [ ] I have updated the corresponding README(s); local and/or global
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)
@reviewpad reviewpad bot added the large Pull request is large label May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

large Pull request is large p2p P2P specific changes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[P2P] Integrate LibP2P

3 participants