poanetwork / poa-dapps-validators

DApp for a list of validators with metadata for POA Network (Core/Sokol). Validators can update metadata using DApp.
https://validators.poa.network
GNU General Public License v3.0
13 stars 41 forks source link

Display physical addresses status based on voting key #82

Closed phahulin closed 6 years ago

phahulin commented 6 years ago

It turns out, most validators use their voting key to send postcards in PoPA.

So it would be better to fetched physical addresses based on that key (except for MoC who doesn't have voting key). If there are no addresses on that voting key or voting key doesn't exist - retry fetching by mining key.

unjapones commented 6 years ago

@phahulin this is probably a dumb question, but what are MoC s?

phahulin commented 6 years ago

MoC stands for Master of Ceremony. In a network like ours, he's the initial validator who starts the network and deploys required contracts to get it into operational state. Then he invites first "real" validators to join the network.

After that the "Ceremony" is over, and MoC only supports the network by producing blocks, he does not have any voting rights. This is why he doesn't have a voting key, only the mining key. The first validator on the list https://validators.poa.network is MoC.

That said, I think this should cover all cases at once including MoC:

  1. take i-th validator's mining key
  2. get voting key by mining key
  3. if voting key is zero (0x0000000000000000000000000000000000000000 or 0x0 or 0x00 or 0x) - take mining key instead
  4. check PoPA addresses for that key
  5. if no addresses found and we're using mining key - that's all; if we're using voting key - repeat 4 with mining key
varasev commented 6 years ago

@unjapones To retrieve voting key by mining key, you can use KeysManager.getVotingByMining public method: https://github.com/poanetwork/poa-network-consensus-contracts/blob/e6e04e926e3b44a2e48a897c03225726a241537f/contracts/KeysManager.sol#L337 - it will always return zero address for the wrong (or zero) mining key.

unjapones commented 6 years ago

@phahulin https://github.com/poanetwork/poa-dapps-validators/pull/84 has been merged. Are there any pending items that I should check?

If not, after verifying that the merged code works as expected, feel free to close this issue (not sure about the process).