Skip to content

Commit

Permalink
feat: Add missing NodeOperator node feature and update offboarding fo…
Browse files Browse the repository at this point in the history
…r sygnum zh5 (#1166)
  • Loading branch information
sasa-tomic authored Dec 23, 2024
1 parent 7cb6022 commit f0dea0e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cordoned_features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ features:
- feature: data_center
value: ty2
explanation: "offboarding TY2 DC after 48 months; https://forum.dfinity.org/t/proposal-update-interim-gen-1-node-provider-remuneration-after-48-months/35001/32 and https://forum.dfinity.org/t/proposal-update-interim-gen-1-node-provider-remuneration-after-48-months/35001/42"
- feature: data_center
value: zh5
explanation: "offboarding ZH5 DC after 48 months; https://forum.dfinity.org/t/proposal-update-interim-gen-1-node-provider-remuneration-after-48-months/35001/27"
- feature: node_operator
value: 4ohfd-bdyeu-5djlz-rf3lc-bqca2-h22rg-t5ipt-cjhl2-r5dbf-tk3fv-hae
explanation: "offboarding Sygnum ZH5 DC after 48 months; https://forum.dfinity.org/t/proposal-update-interim-gen-1-node-provider-remuneration-after-48-months/35001/27"
- feature: data_center
value: ch2
explanation: "offboarding CH2 DC after 48 months; https://forum.dfinity.org/t/proposal-update-interim-gen-1-node-provider-remuneration-after-48-months/35001/40"
Expand Down
4 changes: 3 additions & 1 deletion rs/cli/src/cordoned_feature_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ features:
value: mu1
- feature: node_provider
value: some-np
- feature: node_operator
value: some-node-operator
- feature: data_center_owner
value: some-dco
- feature: area
Expand All @@ -162,7 +164,7 @@ features:

let parsed = fetcher.parse(contents).unwrap();

assert_eq!(parsed.len(), 6)
assert_eq!(parsed.len(), 7)
}

#[test]
Expand Down
6 changes: 4 additions & 2 deletions rs/decentralization/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ impl SubnetChangeResponse {
change.old_nodes.iter().fold(
NodeFeature::variants()
.into_iter()
.filter(|f| f != &NodeFeature::NodeOperator)
.map(|f| (f, FeatureDiff::new()))
.collect::<IndexMap<NodeFeature, FeatureDiff>>(),
|mut acc, n| {
for f in NodeFeature::variants() {
for f in NodeFeature::variants().into_iter().filter(|f| f != &NodeFeature::NodeOperator) {
acc.get_mut(&f).unwrap().entry(n.get_feature(&f).unwrap_or_default()).or_insert((0, 0)).0 += 1;
}
acc
},
),
|mut acc, n| {
for f in NodeFeature::variants() {
for f in NodeFeature::variants().into_iter().filter(|f| f != &NodeFeature::NodeOperator) {
acc.get_mut(&f).unwrap().entry(n.get_feature(&f).unwrap_or_default()).or_insert((0, 0)).1 += 1;
}
acc
Expand Down Expand Up @@ -96,6 +97,7 @@ impl Display for SubnetChangeResponse {
.scores_individual()
.keys()
.sorted()
.filter(|f| *f != &NodeFeature::NodeOperator)
.map(|k| {
let before = before_individual.get(k).unwrap();
let after = after_individual.get(k).unwrap();
Expand Down
4 changes: 3 additions & 1 deletion rs/decentralization/src/nakamoto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ mod tests {
let score_expected = NakamotoScore {
coefficients: IndexMap::from([
(NodeFeature::NodeProvider, 1.),
(NodeFeature::NodeOperator, 1.),
(NodeFeature::DataCenter, 1.),
(NodeFeature::DataCenterOwner, 1.),
(NodeFeature::Area, 1.),
Expand All @@ -538,6 +539,7 @@ mod tests {
value_counts: IndexMap::new(),
controlled_nodes: IndexMap::from([
(NodeFeature::NodeProvider, 1),
(NodeFeature::NodeOperator, 1),
(NodeFeature::DataCenter, 1),
(NodeFeature::DataCenterOwner, 1),
(NodeFeature::Area, 1),
Expand Down Expand Up @@ -854,7 +856,7 @@ mod tests {
// Convert the subnet snapshot to the "Subnet" struct
let subnet_all: DecentralizedSubnet = DecentralizedSubnet::from(subnet_all);
let re_unhealthy_nodes = Regex::new(r"^(gp7wd|e4ysi|qhz4y|2fbvp)-.+$").unwrap();
let subnet_healthy: DecentralizedSubnet = DecentralizedSubnet {
let subnet_healthy = DecentralizedSubnet {
id: subnet_all.id,
nodes: subnet_all
.nodes
Expand Down
2 changes: 2 additions & 0 deletions rs/ic-management-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ impl Node {
.map(|d| d.name.clone())
.unwrap_or_else(|| "unknown".to_string()),
),
(NodeFeature::NodeOperator, self.operator.principal.to_string()),
(NodeFeature::NodeProvider, self.operator.provider.principal.to_string()),
])
};
Expand Down Expand Up @@ -471,6 +472,7 @@ impl Eq for Node {}
#[serde(rename_all = "snake_case")]
pub enum NodeFeature {
NodeProvider,
NodeOperator,
DataCenter,
DataCenterOwner,
Area, // Represents smaller geographic entities like cities and states
Expand Down

0 comments on commit f0dea0e

Please sign in to comment.