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

chore: returning seqs in libwaku as comma separated strings #3121

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

gabrielmer
Copy link
Contributor

@gabrielmer gabrielmer commented Oct 16, 2024

Description

In libwaku, when returning sequences as outputs, in some places we are returning the sequence as a comma-separated string such as in

of GET_ALL_PEER_IDS:
## returns a comma-separated string of peerIDs
let peerIDs =
waku.node.peerManager.wakuPeerStore.peers().mapIt($it.peerId).join(",")
return ok(peerIDs)
of GET_PEER_IDS_BY_PROTOCOL:
## returns a comma-separated string of peerIDs that mount the given protocol
let connectedPeers = waku.node.peerManager.wakuPeerStore
.peers($self[].protocol)
.filterIt(it.connectedness == Connected)
.mapIt($it.peerId)
.join(",")

while in others we return a string wrapped with the [ ] characters, representing an array

For the sake of simplicity and consistence - and mainly so the parsing client-side can be the same in all cases - I propose to return all sequences as comma-separated strings

Changes

  • returning output of RETRIEVE_LISTENING_ADDRESSES as comma-separated string
  • returning output of GET_BOOTSTRAP_NODES as comma-separated string

Issue

#3115

Copy link

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3121

Built from c492bb4

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for it! 💯

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

Looks great!

@gabrielmer gabrielmer merged commit 3321fd0 into master Oct 16, 2024
13 of 14 checks passed
@gabrielmer gabrielmer deleted the chore-unifying-return-format-in-libwaku branch October 16, 2024 11:07
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.

3 participants