ExocoreNetwork / exocore

5 stars 9 forks source link

[fix] Fix the issue regarding voting power not taking effect #65

Closed TimmyExogenous closed 1 month ago

TimmyExogenous commented 1 month ago

Description

In the function GetAvgDelegatedValue, the order of input parameters when calling the GetOperatorUSDValue is incorrect. It might cause the voting power not to take effect. This might be the reason for Issue 58. This PR fixed the issue and a small test issue regarding an incorrect public key simultaneously.

cloud8little commented 1 month ago

Changing the epoch to hour and apply this fix, the voting power still not update.

TimmyExogenous commented 1 month ago

Changing the epoch to hour and apply this fix, the voting power still not update.

The epoch configuration won't take effect when manually modifying the genesis.json. The hour epoch has been configured in the last commit when starting a local node, which can facilitate testing.

cloud8little commented 1 month ago

Test passed, test object: https://github.com/ExocoreNetwork/exocore/pull/65/commits/8d1743bf814474cfcc209849e4fb52f8ce3e64bb validators voting power update after a day with initial voting power 3000, 2000, 1000.

{
  "jsonrpc": "2.0",
  "id": -1,
  "result": {
    "block_height": "3980044",
    "validators": [
      {
        "address": "46B029E2D285423E4288C434D1AC727B8C9B97DE",
        "pub_key": {
          "type": "tendermint/PubKeyEd25519",
          "value": "TJ3pTh8yJZBmAq6BLjDxvlZCcSbWDy9stmG39P2mONw="
        },
        "voting_power": "3002",
        "proposer_priority": "-3048"
      },
      {
        "address": "4FFE906A72A2F05770FD3A9AB034FD324CCED4EE",
        "pub_key": {
          "type": "tendermint/PubKeyEd25519",
          "value": "XLtFCK0/nB1xExSXEhH5kaxRte3aIXSGaBfWSeNOtpE="
        },
        "voting_power": "2000",
        "proposer_priority": "2104"
      },
      {
        "address": "38A21AA8D3386568C4FC0B041F16B77A9D7F06AB",
        "pub_key": {
          "type": "tendermint/PubKeyEd25519",
          "value": "8PaRnlIsW5fbLIJVv/dD+d/d162fw3ywwWcLSA0PmRQ="
        },
        "voting_power": "1001",
        "proposer_priority": "945"
      }
    ],
    "count": "3",
    "total": "3"
  }
}