-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat: set cluster ID as optional when specifying shard info #1780
Conversation
size-limit report 📦
|
0957c59
to
e5f0cf4
Compare
packages/interfaces/src/message.ts
Outdated
@@ -1,7 +1,7 @@ | |||
import type { PubsubTopic } from "./misc.js"; | |||
|
|||
export interface SingleShardInfo { | |||
clusterId: number; | |||
clusterId?: number; |
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.
instead of making this optional, i'd rather use DEFAULT_CLUSTER_ID
that refers to 1
for TWN.
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.
let's do this a followup PR @adklempner
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.
@danisharora099 I made an update in my latest commit that makes all the fields required and instead uses Partial<ShardingParams>
in all SDK create node functions, which are converted to regular ShardingParams
before being used internally
8286264
to
c548c42
Compare
c548c42
to
68d3229
Compare
Problem
To setup a node for autosharding, a user needs to explicitly specify both content topics and a cluster id to determine the pubsub topics. According to the RFC, the Waku Network always uses a cluster id of 1.
Solution
Makes
clusterId
(and all other fields inShardingParams
) optional when user creates a node using the sdk functions, by acceptingPartial<ShardingParams>
.Each sdk function calls a sharding util function to validated the parameters and replace any missing ones with defaults where possible.
Internally, we mostly use
ShardingParams
where all fields are required.Notes