Conversation
| topic_weight: network.total_topics_weight / subnets as f64, /* Set topic weight with | ||
| * equal weights across | ||
| * all subnets */ | ||
| expected_msg_rate: 0.0, // calculate_message_rate_for_topic(committees), |
There was a problem hiding this comment.
This will be added in the next PR cause it's a big file
|
The Go code does a sanitization at the end to avoid NaN and Inf values. Do you think we need that? Or can we guarantee that we do not reach such values? I am worried about edge cases like subnets without committees, which we may subscribe to when in |
I was planning to add in a new PR, I'll push it here |
There was a problem hiding this comment.
Pull Request Overview
Adds a new module for computing dynamic topic scoring parameters, exposes shared decay utilities, and integrates them into the scoring subsystem.
- Introduces
topic_score_configwithNetworkConfig,TopicConfig, andTopicScoringOptionsto calculateTopicScoreParams. - Makes
calculate_score_decay_factoranddecay_convergencepub(crate), and adds a newdecay_thresholdhelper. - Updates
scoring/mod.rsto wire intopic_score_configand includedecay_threshold.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| anchor/network/src/scoring/topic_score_config.rs | New topic scoring config module, default impls, and param conversion |
| anchor/network/src/scoring/peer_score_config.rs | Changed decay utilities to pub(crate) for reuse |
| anchor/network/src/scoring/mod.rs | Added topic_score_config module and decay_threshold function |
Comments suppressed due to low confidence (3)
anchor/network/src/scoring/mod.rs:5
- Public helper
decay_thresholdlacks doc comments. Please add///-style documentation describing its parameters, return value, and error conditions.
pub(crate) fn decay_threshold(decay_factor: f64, target_value: f64) -> Result<f64, String> {
anchor/network/src/scoring/mod.rs:5
- The new
decay_thresholdfunction is not covered by unit tests. Consider adding tests for both valid inputs and error branches to ensure correct behavior.
pub(crate) fn decay_threshold(decay_factor: f64, target_value: f64) -> Result<f64, String> {
anchor/network/src/scoring/topic_score_config.rs:310
topic_score_params_for_subnetisn't exercised by any tests. Add unit tests to validate its output in both success and fallback scenarios.
pub fn topic_score_params_for_subnet(
Tests will be added in a new PR |
sigp#371 Adds a new topic scoring configuration module and integrates decay functions into the scoring submodule - Defines network and topic config structs with default values and computes Gossipsub `TopicScoreParams` - Exposes `calculate_score_decay_factor` and `decay_convergence` as `pub(crate)` in `peer_score_config.rs` - Introduces a `decay_threshold` helper and wires in the new `topic_score_config` module
sigp#371 Adds a new topic scoring configuration module and integrates decay functions into the scoring submodule - Defines network and topic config structs with default values and computes Gossipsub `TopicScoreParams` - Exposes `calculate_score_decay_factor` and `decay_convergence` as `pub(crate)` in `peer_score_config.rs` - Introduces a `decay_threshold` helper and wires in the new `topic_score_config` module
Issue Addressed
#371
Proposed Changes
Adds a new topic scoring configuration module and integrates decay functions into the scoring submodule
TopicScoreParamscalculate_score_decay_factoranddecay_convergenceaspub(crate)inpeer_score_config.rsdecay_thresholdhelper and wires in the newtopic_score_configmoduleAdditional Info
For reference, that's the go code https://github.com/ssvlabs/ssv/blob/main/network/topics/params/topic_score.go#L229