-
Notifications
You must be signed in to change notification settings - Fork 33
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
[Libp2p] Add libp2p module directories and helpers (part 1) #534
Conversation
773daae
to
2449b9f
Compare
Changelog validation failureI think this is a false positive caused by the changelog in question having no previous version (as it's new). To prove this locally:
|
2449b9f
to
bd4caf2
Compare
bd4caf2
to
da417ed
Compare
This comment was marked as outdated.
This comment was marked as outdated.
6d71f72
to
27cfe05
Compare
(cherry picked from commit 27cfe05)
27cfe05
to
01e970f
Compare
## Description This PR updated our Github workflow to return the full output of failed tests for easier debugging/troubleshooting. It was raised by @bryanchriswhite here: #534 (comment) ![image](https://user-images.githubusercontent.com/29378614/220946245-07865c91-f0eb-4564-a8e9-773926c11cd7.png) And also probably related: ![image](https://user-images.githubusercontent.com/29378614/220948460-0f80797d-dff0-4823-bb43-fa12da59e968.png) ## Issue N/A ## 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 - updated `jq` 🪄 to return all the rows that match a failed test ## 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` <!-- REMOVE this comment block after following the instructions If you added additional tests or infrastructure, describe it here. Bonus points for images and videos or gifs. --> ## 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](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)
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.
A few minor comments, but for the most part super clean and well compartmentalized as a separate PR. Appreciate making it easy for the reviewer
This comment was marked as outdated.
This comment was marked as outdated.
d2f2569
to
8768593
Compare
* pokt/main: [Tooling] SLIP-0010 HD Child Key Generation (#510)
strs []string | ||
} | ||
|
||
func (marshaler stringLogArrayMarshaler) MarshalZerologArray(arr *zerolog.Array) { |
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.
Where is this being used?
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 called by zerolog
and is required by the zerolog.LogArrayMarshaler
interface, which is the type of the second argument to zerolog.Evt#Array
.
I don't have a strong opinions on doing it this way, this just seemed to me like the most appropriate way to convey the information available via our structured logging. I've simplified as you suggested and added comments so nobody else has to ask the same question. 😅
@bryanchriswhite Going to take a look at this tomorrow, but I think it should be good to go after the next set of changes. |
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.
Thank you for leaving thorough comments in your code - that definitely helps me to understand what's going on! :)
return fmt.Errorf(errResolvePeerIPMsg, hostname, err) | ||
} | ||
|
||
func getPeerIP(hostname string) (net.IP, error) { |
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.
Though having multiple A DNS records for the same hostname should not happen often in our case, I can see a scenario when nodes are provisioned behind a multi-zone LB, which is often a default for Kubernetes set up in clouds (I suppose they make more 🤑 that way).
Do you think there might be issues when the same node has a hostname that resolves to multiple IP addresses?
I assume PeerID has no correlation with Multiaddr. I suppose it should be fine if one PeerID has different addresses. Imagine a situation with multiple network interfaces, e.g. internet and local networks on one machine, both interfaces have different addresses in that case. But the same node can be exposed on both interfaces. In that case, (I assume) the PeerID stays the same, but other peers should be able to connect to it just fine even if IP addresses are different. Not sure if that makes sense, I'm just kind of fascinated by this topic and my guess is random address should work as long as packets flow correctly. :)
return fmt.Errorf(errResolvePeerIPMsg, hostname, err) | ||
} | ||
|
||
func getPeerIP(hostname string) (net.IP, error) { |
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.
puts us in the driver seat
Do you mean something like we could sort the IP addresses and always use the first one so all nodes in the network predictably connect to the same IP even if there are multiple A DNS records?
|
GitGuardian id | Secret | Commit | Filename | |
---|---|---|---|---|
5841025 | Generic High Entropy Secret | b694338 | build/localnet/manifests/configs.yaml | View secret |
5841025 | Generic High Entropy Secret | b694338 | build/config/genesis.json | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
@Olshansk, @okdas thanks again for taking the time! 🙏 Apologies for changing things at the last minute, but as was surfaced in discussion with @okdas, we should be selecting a random record from the DNS response until we decide to support multiple IPs natively. As a result, There's a bit more code in I've added a test for the error case of |
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.
Thank you!
I am not 100% sure if you can merge the PR unless @Olshansk reviews again due to his prior review, maybe resolving all conversation can help? Otherwise, I should be able to bypass.
* 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)
## 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): - [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 `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 - [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 - [x] 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) --------- Co-authored-by: Alessandro De Blasis <[email protected]>
func TestGetPeerIP_Success(t *testing.T) { | ||
t.Skip("TODO: replace `net.DefaultResolver` with one which has a `Dial` function that returns a mocked `net.Conn` (see: https://pkg.go.dev/net#Resolver)") | ||
|
||
//nolint:gocritic // commentedOutCode - Outlines the minimum requirements for disproving regression. |
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.
👍
Description
This is the first of a series of PRs split out from #500. Here we set up the new libp2p module directory structure and add crypto and identity / network helpers.
Issue
#347
Type of change
Please mark the relevant option(s):
List of changes
Testing
make develop_test
README
Required Checklist
If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)