Skip to content
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(dre): implementing checks for correct node rewards set for node operators #436

Merged
merged 2 commits into from
May 30, 2024

Conversation

NikolaMilosa
Copy link
Contributor

This PR builds upon dump-registry command. It adds node status to the node output which looks like the following:

  {
    "node_id": "zxxo4-abmdb-uj3ok-cbj4k-is36g-b5o2d-c6akl-vmgyu-d2wie-hgr3y-uae",
    "xnet": {
      "ip_addr": "2a00:fc0:5000:300:6801:4fff:fe2e:6276",
      "port": 2497
    },
    "http": {
      "ip_addr": "2a00:fc0:5000:300:6801:4fff:fe2e:6276",
      "port": 8080
    },
    "node_operator_id": "3xiew-2wo3x-tnbn2-o7kok-wwsnw-7koo2-gna5r-rlrt3-zotsh-dwpg6-kae",
    "chip_id": null,
    "hostos_version_id": "e268b9807f1ab4ae65d7b29fe70a3b358d014d6a",
    "public_ipv4_config": null,
    "subnet_id": null,
    "dc_id": "mb1",
    "node_provider_id": "wdjjk-blh44-lxm74-ojj43-rvgf4-j5rie-nm6xs-xvnuv-j3ptn-25t4v-6ae",
    "status": "Healthy"
  },
  {
    "node_id": "zzhpj-v2jd7-sfsts-suhfq-k4otv-fy5n3-tsogo-6jrk2-adsxv-c3jwu-xqe",
    "xnet": {
      "ip_addr": "2001:1900:2100:2827:6801:bff:fe3b:cab1",
      "port": 2497
    },
    "http": {
      "ip_addr": "2001:1900:2100:2827:6801:bff:fe3b:cab1",
      "port": 8080
    },
    "node_operator_id": "nj365-76cya-vjwgn-vyuxb-y74nh-bhlti-l6mzp-5efbh-u7nld-5jeba-kae",
    "chip_id": null,
    "hostos_version_id": "e268b9807f1ab4ae65d7b29fe70a3b358d014d6a",
    "public_ipv4_config": null,
    "subnet_id": null,
    "dc_id": "mm1",
    "node_provider_id": "wwdbq-xuqhf-eydzu-oyl7p-ga565-zm7s7-yrive-ozgsy-zzgh3-qwb3j-cae",
    "status": "Healthy"
  },
  {
    "node_id": "zzuq4-xiygt-ypkox-2tgdr-yvpzp-optye-xazeq-vnpw5-pata3-4jlle-wqe",
    "xnet": {
      "ip_addr": "2602:ffe4:1:45:6801:75ff:fe37:3ebd",
      "port": 2497
    },
    "http": {
      "ip_addr": "2602:ffe4:1:45:6801:75ff:fe37:3ebd",
      "port": 8080
    },
    "node_operator_id": "4lbqo-vgpoe-kemak-voout-777uo-kk74n-fnct3-pc4eg-3txi3-7cghf-rqe",
    "chip_id": null,
    "hostos_version_id": null,
    "public_ipv4_config": {
      "ip_addr": "128.14.26.19",
      "gateway_ip_addr": [
        "128.14.26.18"
      ],
      "prefix_length": 29
    },
    "subnet_id": null,
    "dc_id": "hk3",
    "node_provider_id": "4fedi-eu6ue-nd7ts-vnof5-hzg66-hgzl7-liy5n-3otyp-h7ipw-owycg-uae",
    "status": "Healthy"
  }

And adds two fields to the node operators output:

  1. total_up_nodes - number of Healthy and Degraded nodes an operator has
  2. rewards_correct - boolean field which checks if the total number of rewardable_nodes matches the total_up_nodes field.
    These fields look like the following:
  {
    "node_operator_principal_id": "mjeqs-wxqp7-tecvn-77uxe-eowch-4l4gy-6lc6f-ys6je-qnybm-5fxya-qqe",
    "node_allowance": 0,
    "node_provider_principal_id": "rbn2y-6vfsb-gv35j-4cyvy-pzbdu-e5aum-jzjg6-5b4n5-vuguf-ycubq-zae",
    "dc_id": "br1",
    "rewardable_nodes": {
      "type0": 0,
      "type1": 28
    },
    "ipv6": null,
    "total_up_nodes": 28,
    "rewards_correct": true
  },
  {
    "node_operator_principal_id": "7fnoo-4pqrc-tpnof-6mce7-ue5p4-5pe3d-rvyo3-jd2ah-c3bbq-lhyrx-7qe",
    "node_allowance": 2,
    "node_provider_principal_id": "wwdbq-xuqhf-eydzu-oyl7p-ga565-zm7s7-yrive-ozgsy-zzgh3-qwb3j-cae",
    "dc_id": "tp1",
    "rewardable_nodes": {
      "type0": 7
    },
    "ipv6": null,
    "total_up_nodes": 5,
    "rewards_correct": false
  },
  {
    "node_operator_principal_id": "zc635-ppr46-ap6eg-pghtn-wtnxz-6czvv-a4uxm-adjgb-wtoh4-2ddnl-uae",
    "node_allowance": 0,
    "node_provider_principal_id": "efem5-kmwaw-xose7-zzhgg-6bfif-twmcw-csg7a-lmqvn-wrdou-mjwlb-vqe",
    "dc_id": "bn1",
    "rewardable_nodes": {
      "type3.1": 6
    },
    "ipv6": null,
    "total_up_nodes": 6,
    "rewards_correct": true
  }

Together this can be used to determine which node operators need to have their rewardable_nodes adjusted in many ways. One way is to use jq:

dre dump-registry | jq '[.node_operators.[] | select(.rewards_correct == false)]'

@NikolaMilosa NikolaMilosa requested a review from a team as a code owner May 30, 2024 10:03
Copy link
Member

@sasa-tomic sasa-tomic left a comment

Choose a reason for hiding this comment

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

LGTM!

rs/cli/src/registry_dump.rs Show resolved Hide resolved
@NikolaMilosa NikolaMilosa merged commit 04c7ba8 into main May 30, 2024
4 checks passed
@NikolaMilosa NikolaMilosa deleted the nm-check-node-rewards branch May 30, 2024 10:41
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.

None yet

2 participants