Skip to content

Conversation

@adklempner
Copy link
Member

@adklempner adklempner commented Jul 21, 2025

Problem / Description

There was some unnecessary code leftover after RouterInfo refactor

Solution

Consolidate core sharding functions into unified routing info classes:

  • Simplify type guards with router info class-based checks (isAutoShardingRoutingInfo)
  • Move formatPubsubTopic, ensureValidContentTopic, contentTopicToShardIndex into routing_info.ts
  • Replace utility function calls with createRoutingInfo() pattern

Notes

  • Breaking change: removes deprecated functions like contentTopicToPubsubTopic
  • Migration: use createRoutingInfo(networkConfig, { contentTopic }).pubsubTopic

Checklist

  • Code changes are covered by unit tests.
  • Code changes are covered by e2e tests, if applicable.
  • Dogfooding has been performed, if feasible.
  • A test version has been published, if required.
  • All CI checks pass successfully.

@github-actions
Copy link

github-actions bot commented Jul 21, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 70.32 KB (+0.02% 🔺) 1.5 s (+0.02% 🔺) 902 ms (-47.36% 🔽) 2.4 s
Waku Simple Light Node 122.12 KB (+0.03% 🔺) 2.5 s (+0.03% 🔺) 2 s (+42.29% 🔺) 4.4 s
ECIES encryption 20.86 KB (0%) 418 ms (0%) 271 ms (-38.99% 🔽) 688 ms
Symmetric encryption 20.3 KB (0%) 406 ms (0%) 285 ms (-40.28% 🔽) 691 ms
DNS discovery 51.95 KB (0%) 1.1 s (0%) 1.2 s (+139.91% 🔺) 2.2 s
Peer Exchange discovery 52.4 KB (0%) 1.1 s (0%) 800 ms (+7.92% 🔺) 1.9 s
Local Peer Cache Discovery 46.1 KB (0%) 922 ms (0%) 1.1 s (+167.64% 🔺) 2 s
Privacy preserving protocols 53.54 KB (0%) 1.1 s (0%) 1.3 s (+58.82% 🔺) 2.4 s
Waku Filter 55.25 KB (0%) 1.2 s (0%) 1.2 s (+34.85% 🔺) 2.3 s
Waku LightPush 52.91 KB (0%) 1.1 s (0%) 953 ms (+33.8% 🔺) 2.1 s
History retrieval protocols 59.18 KB (0%) 1.2 s (0%) 783 ms (-1.2% 🔽) 2 s
Deterministic Message Hashing 28.42 KB (0%) 569 ms (0%) 1.1 s (+141.65% 🔺) 1.7 s

@adklempner adklempner changed the title Feat/simpler routing info feat: simpler routing info Jul 21, 2025
Base automatically changed from waku-api/fix-nwaku-master to master July 22, 2025 01:38
@adklempner adklempner force-pushed the feat/simpler-routing-info branch from 1f5a456 to 01cd002 Compare July 22, 2025 02:03
@adklempner adklempner marked this pull request as ready for review July 22, 2025 02:09
@adklempner adklempner requested a review from a team as a code owner July 22, 2025 02:09
}

/**
* @deprecated will be removed
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@weboko mentioned it might be good to move this to core. I have no strong opinion on the matter.

Comment on lines +125 to +131
public pubsubTopic: PubsubTopic;
public shardId: ShardId;

protected constructor(
public networkConfig: NetworkConfig,
public pubsubTopic: PubsubTopic,
public shardId: ShardId
) {}
pubsubTopic: PubsubTopic,
shardId: ShardId
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the change? When you don't do it for networkConfig?

}
}

export function isAutoShardingRoutingInfo(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you check if those are actually used? I wonder if they are actually needed.

export * from "./local_storage.js";
export * from "./sharding.js";
export * from "./health_status.js";
export type { ShardInfo } from "./sharding.js";
Copy link
Collaborator

Choose a reason for hiding this comment

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

it is covered by the line above: export * from "./sharding.js";

Suggested change
export type { ShardInfo } from "./sharding.js";

numShardsInCluster
};
const Shard = [
AutoShardingRoutingInfo.fromContentTopic(ContentTopic, networkConfig)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why won't you simply use createRoutingInfo in these types of places?

clusterId: TestClusterId,
numShardsInCluster: TestNumShardsInCluster
};
export const TestShardIndex = AutoShardingRoutingInfo.fromContentTopic(
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't you get it from TestRoutingInfo?

@weboko weboko closed this Aug 12, 2025
@weboko
Copy link
Collaborator

weboko commented Aug 12, 2025

@adklempner confirmed this PR can be closed

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.

4 participants