feat: allow overriding actual shard values in auto-sharding - #3963
Draft
igor-sirotin wants to merge 1 commit into
Draft
feat: allow overriding actual shard values in auto-sharding#3963igor-sirotin wants to merge 1 commit into
igor-sirotin wants to merge 1 commit into
Conversation
Auto-sharding currently produces shard ids in the range [0..NUM_SHARDS_IN_NETWORK-1], derived from the content topic hash. To interoperate with Status, which uses a specific set of shard values, we need to be able to force the actual shard values while keeping the auto-sharding distribution. This adds an optional shard override array (length NUM_SHARDS_IN_NETWORK): auto-sharding still hashes the content topic to an index, but the shard id placed in the pubsub topic becomes shardOverride[index] instead of the index itself. Wired through: - Sharding.getGenZeroShard remaps the computed index via shardOverride - ShardingConf gains a shardOverride field; default subscribe shards and shard validation use the actual (override) shard values - WakuConfBuilder.withShardOverride + buildShardingConf threading - CLI arg --shard-override (repeatable) - mountAutoSharding accepts the override (validates length) - api_conf AutoShardingConfig gains shardOverride (+ JSON) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You can find the image built from this PR at Built from 3fa6045 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Auto-sharding currently produces shard ids in the range
[0..NUM_SHARDS_IN_NETWORK-1], derived from the content-topic hash. To make this work in Status — which uses a specific set of shard values — we need to be able to force the actual shard values while keeping the auto-sharding distribution.This PR introduces an optional shard override array of length
NUM_SHARDS_IN_NETWORK:[0..NUM_SHARDS_IN_NETWORK-1].shardOverride[index]instead of the index itself.How to use
CLI:
Provide exactly
NUM_SHARDS_IN_NETWORKvalues (repeatable arg). The node also subscribes to the override values by default (instead of[0..n-1]), so it relays/receives on the forced shards.The same is exposed via the (deprecated)
AutoShardingConfigJSON config asshardOverride.Changes
waku_core/topics/sharding.nim—Sharding.shardOverride;getGenZeroShardremaps the computed index through the override.factory/networks_config.nim—ShardingConf.shardOverride; newshards()helper (effective shard set);validateShardsvalidates against the actual shard values and checks override length.factory/conf_builder/waku_conf_builder.nim—withShardOverride+buildShardingConfthreading; default subscribe shards use the actual shards.node/waku_node.nim—mountAutoShardingaccepts the override (validates length).factory/node_factory.nim— passes the override through.tools/confutils/cli_args.nim— new--shard-overridearg.api/api_conf.nim—AutoShardingConfig.shardOverride(+ JSON read/write/wiring).tests/waku_core/topics/test_sharding.nim— unit tests for the remapping and the length-mismatch fallback.Notes / open questions
nphformatting).--shardto keep meaning indices.🤖 Generated with Claude Code