-
Notifications
You must be signed in to change notification settings - Fork 57
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
fix: mount metadata in wakucanary #2793
Conversation
You can find the image built from this PR at
Built from 70f3696 |
You can find the image built from this PR at
Built from 70f3696 |
This PR may contain changes to configuration options of one of the apps. If you are introducing a breaking change (i.e. the set of options in latest release would no longer be applicable) make sure the original option is preserved with a deprecation note for 2 following releases before it is actually removed. Please also make sure the label |
a9bbe91
to
f14b908
Compare
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.
Ooh thanks so much! added a small comment :))
waku/node/waku_node.nim
Outdated
proc mountMetadata*( | ||
node: WakuNode, clusterId: uint32, shards: seq[uint16] = @[] | ||
): Result[void, string] = | ||
if not node.wakuMetadata.isNil(): | ||
return err("Waku metadata already mounted, skipping") | ||
|
||
let metadata = WakuMetadata.new(clusterId, node.enr, node.topicSubscriptionQueue) | ||
|
||
for shard in shards: | ||
metadata.shards.incl(uint32(shard)) |
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.
I think this change is not necessary and might be problematic.
The shards are added to metadata in WakuMetadata.new
by using the parameter node.enr
If the node used in the Canary is subscribed to the right shards, then they should be in the ENR and added from there
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.
Thanks Gabriel !
Then i should try to add this shards information in ENR.
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.
It looks well so far! Good work 🙌
Nevertheless, there are a couple of points to be considered. See my comments:)
Also, kindly revert the change around vendor/nim-bearssl
. We shouldn't change that in this PR
apps/wakucanary/README.md
Outdated
--websocket-secure-key-path Secure websocket key path: '/path/to/key.txt' . | ||
--websocket-secure-cert-path Secure websocket Certificate path: '/path/to/cert.txt' . | ||
|
||
-c, --cluster-id Cluster ID of the fleet node to check status [Default=1]. |
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.
In the README.md I think is missing explaining about the shards
parameter and give an example on how to use it and why
waku/node/waku_node.nim
Outdated
for shard in shards: | ||
metadata.shards.incl(uint32(shard)) |
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.
That seems correct from my PoV but let's ask SP about it:
@SionoiS - Do you think there is a more idiomatic way to achieve that?
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.
Yes? I find it weird to add this to waku_node.nim
when this PR is about adapting the Canary to it. I would expect that if this line would be missing, then we would have some bug open about it
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.
Yes? I find it weird to add this to
waku_node.nim
when this PR is about adapting the Canary to it. I would expect that if this line would be missing, then we would have some bug open about it
I think that @darshankabariya's suggestion sounds very reasonable and looks more explicit. Also, it seems correct too because we are already passing the clusterId
as a parameter in mountMetadata
.
Nevertheless, you and SP might have more context than me about that and there might be a more idiomatic way to achieve that, i.e. the way you suggested (which I didn't see while I was adding my first comment .)
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.
The less we add to wakunode
the better IMO. In this case, you can have WakuMetadata
add shard by subscribing to them.
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.
Thanks for the feedback @SionoiS, @gabrielmer, and @Ivansete-status. I'll update the implementation to add shard information via ENR.
7b31e0c
to
f14b908
Compare
f14b908
to
dcff7e9
Compare
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.
Looks amazing! Thanks so much! 🚀
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.
LGTM! Thanks for it! 💯
Beautiful changes and great work! Congrats 🥳
I'm just adding a small suggestion to have the code more aligned with the style that we use to have (use valueOr
and isOkOr
.)
apps/wakucanary/wakucanary.nim
Outdated
let relayShards = RelayShards.init(conf.clusterId, conf.shards) | ||
if relayShards.isok(): | ||
enrBuilder.withWakuRelaySharding(relayShards.get()).isOkOr: | ||
error "Building ENR with relay sharding failed", error = error | ||
else: | ||
error "Relay shards initialization failed", error = relayShards.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.
Just a nitpick comment where we use valueOr
and, in case of error, we stop the wakucanary
execution.
Notice how valueOr
is very similar to isOkOr
, in concept, but in this case, it allows to return an item.
let relayShards = RelayShards.init(conf.clusterId, conf.shards) | |
if relayShards.isok(): | |
enrBuilder.withWakuRelaySharding(relayShards.get()).isOkOr: | |
error "Building ENR with relay sharding failed", error = error | |
else: | |
error "Relay shards initialization failed", error = relayShards.error | |
let relayShards = RelayShards.init(conf.clusterId, conf.shards).valueOr: | |
error "Relay shards initialization failed", error = error | |
return 1 | |
enrBuilder.withWakuRelaySharding(relayShards.get()).isOkOr: | |
error "Building ENR with relay sharding failed", error = error | |
return 1 |
b7bca0c
to
942ffa9
Compare
This PR may contain changes to database schema of one of the drivers. If you are introducing any changes to the schema, make sure the upgrade from the latest release to this change passes without any errors/issues. Please make sure the label |
4e3d790
to
ab4b5b2
Compare
* chore: integrate cluster id and shards to waku node.
closes #2720
Add cluster ID and shards in the Wakucanary configuration, and then mount this metadata information to Wakunode.