Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

feat: add ability to parse addr infos from strings #143

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Feb 15, 2023

Overview

Will be used to parse bootstrappers from a comma separated list.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@rach-id rach-id added the p2p p2p network related label Feb 15, 2023
@rach-id rach-id requested a review from rahulghangas February 15, 2023 17:07
@rach-id rach-id requested a review from evan-forbes as a code owner February 15, 2023 17:07
@rach-id rach-id self-assigned this Feb 15, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #143 (9e25d42) into main (27f6375) will increase coverage by 0.56%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
+ Coverage   45.90%   46.46%   +0.56%     
==========================================
  Files          15       16       +1     
  Lines         952      962      +10     
==========================================
+ Hits          437      447      +10     
  Misses        466      466              
  Partials       49       49              
Impacted Files Coverage Δ
cmd/qgb/helpers/parse.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

logger.Error("parsing info from multiaddr", "addr", addr, "err", err)
return nil, err
}
infos = append(infos, *info)
Copy link
Member

Choose a reason for hiding this comment

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

[non blocking question]
dereferencing this value makes sense to me, as I never like using pointers when we don't strictly need to (like for a read only struct such as AddrInfo), especially since its already a slice. However, I'm uncertain if there is a reason why we need a pointer, since the maintainers return a pointer. Do we know why they use a pointer?

Copy link
Member Author

Choose a reason for hiding this comment

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

I took the implementation from Celestia-node 🐱

I guess the reason for using pointers is that the addresses could get heavy and we don't want to copy them every time.

What dl you think? Should i switch to using pointers?

Copy link
Member Author

Choose a reason for hiding this comment

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

I took the implementation from Celestia-node 🐱

I guess the reason for using pointers is that the addresses could get heavy and we don't want to copy them every time.

What dl you think? Should i switch to using pointers?

Copy link
Member

Choose a reason for hiding this comment

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

nah, if celestia-node uses it and they don't have issues its probably fine. It should be an improvement to not use pointers, as it makes no sense to me, but I'm just paranoid lol.

Copy link
Member Author

Choose a reason for hiding this comment

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

Shit, after merging I remembered that I did couple changes, here is the original implementation:
https://github.com/celestiaorg/celestia-node/blob/bd96b3dab06e7d733cf0e62adb94802e2007a407/nodebuilder/p2p/bootstrap.go#L45-L64

But internally, it's almost the same functions called. Do I revert? or we keep it until we have an issue?

@rach-id rach-id merged commit ac657a0 into celestiaorg:main Feb 15, 2023
@rach-id rach-id deleted the parse_bootstrapper branch February 15, 2023 20:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2p p2p network related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants