Skip to content

fix: rest fix for sync protocol#3503

Merged
darshankabariya merged 3 commits intomasterfrom
rest_fix_sync
Aug 6, 2025
Merged

fix: rest fix for sync protocol#3503
darshankabariya merged 3 commits intomasterfrom
rest_fix_sync

Conversation

@darshankabariya
Copy link
Copy Markdown
Contributor

@darshankabariya darshankabariya commented Jul 11, 2025

Now the rest will see sync-related protocol also while facing details.

Close #3492

@SionoiS

Test Instructions

  1. Start two nodes: [ Node 1: Should have store and store-sync protocols enable ] [Node 2: A standard relay-enabled node is sufficient]
  2. Run nodes using the following commands: [ ./build/wakunode2 --config-file="../config/peer1.txt" ] [ ./build/wakunode2 --config-file="../config/peer2.txt" ] seperate terminal.
  3. Ensure both nodes are connected via static node configuration.
  4. Once connected, send a REST request from Node 2 to Node 1 to verify peer status: [curl -X GET "http://127.0.0.1:46422/admin/v1/peers" -H "accept: application/json" ]

Note :-

Node 1 - configuration
nodekey = "6dcae22a737a01541b2852ebe5c5157f936042e79a7fcec87d5b1559701c0e7f"
staticnode = ["/ip4/127.0.0.1/tcp/64002/p2p/16Uiu2HAm1LDVFukcPVVFFcsxofX8HNnWZjELYb2UHFek1vf2z2GQ"]
tcp-port = 64000
max-connections = 20
log-level = "TRACE"
rest = true
rest-port = 46420
rest-admin = true
relay = true
filter = true
lightpush = true
rln-relay = false
store = true
store-sync = true
rln-relay-dynamic = false
rln-relay-user-message-limit = 100

Node 2 - configuration
nodekey = "554f13e4b8cdf48edd526249f92ee653df43939a713ce95b51b74b48283d0df6i"
staticnode = ["/ip4/127.0.0.1/tcp/64000/p2p/16Uiu2HAkzqu7KFZwt9zaNYXfAkyu4AkupthsjudW45NLPuQmqL8r"]
tcp-port = 64002
log-level = "TRACE"
max-connections = 20
rest = true
rest-port = 46422
rest-admin = true
metrics-server = true
relay = true
store-sync = false
filter = false
filternode = "/ip4/127.0.0.1/tcp/64000/p2p/16Uiu2HAkzqu7KFZwt9zaNYXfAkyu4AkupthsjudW45NLPuQmqL8r"

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 11, 2025

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3503

Built from 81c8d50

Copy link
Copy Markdown
Contributor

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Copy Markdown
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! 💯
Just adding a tiny nitpick comment

Comment on lines +243 to +249
if conf.remoteStoreNode.isSome():
let storeNode = parsePeerInfo(conf.remoteStoreNode.get())
if storeNode.isOk():
node.peerManager.addServicePeer(storeNode.value, WakuReconciliationCodec)
node.peerManager.addServicePeer(storeNode.value, WakuTransferCodec)
else:
return err("failed to set node waku store-sync peer: " & storeNode.error)
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.

Just a simple simplification with valueOr technique:

Suggested change
if conf.remoteStoreNode.isSome():
let storeNode = parsePeerInfo(conf.remoteStoreNode.get())
if storeNode.isOk():
node.peerManager.addServicePeer(storeNode.value, WakuReconciliationCodec)
node.peerManager.addServicePeer(storeNode.value, WakuTransferCodec)
else:
return err("failed to set node waku store-sync peer: " & storeNode.error)
if conf.remoteStoreNode.isSome():
let storeNode = parsePeerInfo(conf.remoteStoreNode.get()).valueOr:
return err("failed to set node waku store-sync peer: " & error)
node.peerManager.addServicePeer(storeNode, WakuReconciliationCodec)
node.peerManager.addServicePeer(storeNode, WakuTransferCodec)

@darshankabariya darshankabariya merged commit 9de9f9e into master Aug 6, 2025
12 of 13 checks passed
@darshankabariya darshankabariya deleted the rest_fix_sync branch August 6, 2025 18:33
Ivansete-status pushed a commit that referenced this pull request Jan 28, 2026
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.

bug: libp2p identify & peer manager discrepancies

3 participants