Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Adding experimental command to list validators #328

Merged
merged 13 commits into from
May 8, 2020
Merged

Conversation

ilblackdragon
Copy link
Member

@ilblackdragon ilblackdragon commented Apr 24, 2020

Ref #188

Command:

near validators current

Current output:

Validators (total: 54, seat price: 51,205):
.------------------------------------------------------------------------------------.
|     Validator Id      |  Stake  | # seats | % online | bls produced | bls expected |
|-----------------------|---------|---------|----------|--------------|--------------|
| node3                 | 304,940 | 6       |      100 |          360 |          360 |
| node1                 | 304,924 | 6       |      100 |          361 |          361 |
| node0                 | 304,903 | 6       |      100 |          362 |          362 |
| node2                 | 277,171 | 5       |      100 |          361 |          361 |
| huglester.betanet     | 209,874 | 4       |      100 |          288 |          288 |
| hashquark             | 166,381 | 3       |      100 |          217 |          217 |
| unknown.test          | 137,481 | 3       |      100 |          144 |          144 |
| nuc2.test             | 110,512 | 2       |      100 |          145 |          145 |
| fredrikmalmqvist.test | 109,606 | 2       |       99 |          144 |          145 |
| dochpryof.test        | 109,566 | 2       |      100 |          144 |          144 |
| launooskuarttu.test   | 109,159 | 2       |      100 |          145 |          145 |
| janliamnilsson.test   | 108,907 | 2       |       99 |          143 |          144 |
| olaiolsen.test        | 108,806 | 2       |       99 |          144 |          145 |
| bowen.test            | 108,779 | 2       |      100 |          145 |          145 |
| tommywesley.test      | 108,583 | 2       |       98 |          143 |          145 |
| simonhugo.test        | 108,081 | 2       |      100 |          145 |          145 |
| oligarr.test          | 107,980 | 2       |      100 |          144 |          144 |
| felixschulz.test      | 107,478 | 2       |       75 |          109 |          145 |
| staked.test           | 107,033 | 2       |      100 |          144 |          144 |
| bitoven.test          | 106,765 | 2       |      100 |          144 |          144 |
| volvos60909.test      | 105,928 | 2       |      100 |          145 |          145 |
| jaroslavrud.test      | 105,579 | 2       |       59 |           86 |          144 |
| anonstake.test        | 105,525 | 2       |      100 |          144 |          144 |
| isillien.betanet      | 105,093 | 2       |      100 |          145 |          145 |
| pony.test             | 104,468 | 2       |      100 |          145 |          145 |
| buster.betanet        | 104,146 | 2       |      100 |          145 |          145 |
| pathrock.test         | 103,716 | 2       |      100 |          145 |          145 |
| gunray.test           | 102,611 | 2       |      100 |          145 |          145 |
| validatorsonline.test | 102,459 | 2       |      100 |          145 |          145 |
| andreyvelde.test      | 102,415 | 2       |      100 |          144 |          144 |
| unicorn.betanet       | 102,410 | 2       |      100 |          145 |          145 |
| nodeasy.test          | 102,179 | 2       |      100 |           72 |           72 |
| catcatcat.test        | 101,628 | 2       |      100 |           72 |           72 |
| danil.betanet         | 101,005 | 2       |      100 |           73 |           73 |
| zav.betanet           | 100,958 | 2       |      100 |           72 |           72 |
| sll.betanet           | 100,902 | 2       |      100 |           72 |           72 |
| fattox.test           | 100,721 | 2       |      100 |           72 |           72 |
| gaia.test             | 100,721 | 2       |        0 |            0 |           72 |
| stateb.betanet        | 100,717 | 2       |      100 |           72 |           72 |
| sparkpool.test        | 100,596 | 2       |      100 |           72 |           72 |
| moonlet.test          | 100,595 | 2       |      100 |           72 |           72 |
| afi.betanet           | 100,500 | 2       |      100 |           73 |           73 |
| fra.betanet           | 100,500 | 2       |      100 |           72 |           72 |
| max.betanet           | 100,500 | 2       |      100 |           72 |           72 |
| itokenpool.betanet    | 100,402 | 2       |      100 |           73 |           73 |
| harrypotter           | 100,304 | 2       |      100 |           72 |           72 |
| gladba.betanet        | 89,290  | 2       |      100 |           72 |           72 |
| ubikcapital.test      | 85,260  | 2       |      100 |           72 |           72 |
| lxyw.betanet          | 75,730  | 1       |      100 |           72 |           72 |
| zavodil.betanet       | 75,564  | 1       |      100 |           72 |           72 |
| something.betanet     | 75,229  | 1       |      100 |           72 |           72 |
| gamah.betanet         | 75,197  | 1       |        0 |            0 |           72 |
| vitalpointai.betanet  | 70,032  | 1       |      100 |           72 |           72 |
| blaze.betanet         | 55,168  | 1       |      100 |           72 |           72 |
'------------------------------------------------------------------------------------'
near validators next

Output:

Next validators (total: 54, seat price: 51,112):
.-------------------------------------------------------------------.
|   Status   |       Validator       |       Stake        | # seats |
|------------|-----------------------|--------------------|---------|
| New        | c1.nearkat            | 80,206             | 2       |
| New        | c29r3.betanet         | 100,499            | 2       |
| New        | kokos.betanet         | 100,000            | 2       |
| Rewarded   | afi.betanet           | 100,500 -> 100,545 | 2       |
| Rewarded   | andreyvelde.test      | 102,415 -> 102,460 | 2       |
| Rewarded   | anonstake.test        | 105,525 -> 105,572 | 2       |
| Rewarded   | bitoven.test          | 106,765 -> 106,812 | 2       |
| Rewarded   | blaze.betanet         | 55,168 -> 55,192   | 1       |
| Rewarded   | bowen.test            | 108,779 -> 108,827 | 2       |
| Rewarded   | buster.betanet        | 104,146 -> 104,192 | 2       |
| Rewarded   | catcatcat.test        | 101,628 -> 101,673 | 2       |
| Rewarded   | danil.betanet         | 101,005 -> 101,050 | 2       |
| Rewarded   | dochpryof.test        | 109,566 -> 109,614 | 2       |
| Rewarded   | fattox.test           | 100,721 -> 100,766 | 2       |
| Rewarded   | felixschulz.test      | 107,478 -> 107,525 | 2       |
| Rewarded   | fra.betanet           | 100,500 -> 100,545 | 2       |
| Rewarded   | fredrikmalmqvist.test | 109,606 -> 109,655 | 2       |
| Rewarded   | gladba.betanet        | 89,290 -> 89,330   | 2       |
| Rewarded   | gunray.test           | 102,611 -> 102,656 | 2       |
| Rewarded   | harrypotter           | 100,304 -> 100,348 | 2       |
| Rewarded   | hashquark             | 166,381 -> 166,455 | 3       |
| Rewarded   | huglester.betanet     | 209,874 -> 209,967 | 4       |
| Rewarded   | isillien.betanet      | 105,093 -> 105,140 | 2       |
| Rewarded   | itokenpool.betanet    | 100,402 -> 100,447 | 2       |
| Rewarded   | janliamnilsson.test   | 108,907 -> 108,955 | 2       |
| Rewarded   | launooskuarttu.test   | 109,159 -> 109,207 | 2       |
| Rewarded   | lxyw.betanet          | 75,730 -> 75,763   | 1       |
| Rewarded   | max.betanet           | 100,500 -> 100,545 | 2       |
| Rewarded   | moonlet.test          | 100,595 -> 100,640 | 2       |
| Rewarded   | node0                 | 304,903 -> 305,037 | 6       |
| Rewarded   | node1                 | 304,924 -> 305,058 | 6       |
| Rewarded   | node2                 | 277,171 -> 277,294 | 5       |
| Rewarded   | node3                 | 304,940 -> 305,074 | 6       |
| Rewarded   | nodeasy.test          | 102,179 -> 102,224 | 2       |
| Rewarded   | nuc2.test             | 110,512 -> 110,561 | 2       |
| Rewarded   | olaiolsen.test        | 108,806 -> 108,854 | 2       |
| Rewarded   | oligarr.test          | 107,980 -> 108,028 | 2       |
| Rewarded   | pathrock.test         | 103,716 -> 103,762 | 2       |
| Rewarded   | pony.test             | 104,468 -> 104,514 | 2       |
| Rewarded   | simonhugo.test        | 108,081 -> 108,129 | 2       |
| Rewarded   | sll.betanet           | 100,902 -> 100,947 | 2       |
| Rewarded   | something.betanet     | 75,229 -> 75,262   | 1       |
| Rewarded   | sparkpool.test        | 100,596 -> 100,640 | 2       |
| Rewarded   | staked.test           | 107,033 -> 107,080 | 2       |
| Rewarded   | stateb.betanet        | 100,717 -> 100,762 | 2       |
| Rewarded   | tommywesley.test      | 108,583 -> 108,631 | 2       |
| Rewarded   | ubikcapital.test      | 85,260 -> 85,297   | 2       |
| Rewarded   | unicorn.betanet       | 102,410 -> 102,456 | 2       |
| Rewarded   | unknown.test          | 137,481 -> 137,542 | 3       |
| Rewarded   | validatorsonline.test | 102,459 -> 102,504 | 2       |
| Rewarded   | vitalpointai.betanet  | 70,032 -> 70,062   | 1       |
| Rewarded   | volvos60909.test      | 105,928 -> 105,974 | 2       |
| Rewarded   | zav.betanet           | 100,958 -> 101,003 | 2       |
| Rewarded   | zavodil.betanet       | 75,564 -> 75,597   | 1       |
| Kicked out | gaia.test             | -                  | -       |
| Kicked out | gamah.betanet         | -                  | -       |
| Kicked out | jaroslavrud.test      | -                  | -       |
'-------------------------------------------------------------------'
near proposals

Output:

Proposals for the epoch after next (total: 6, expected seat price = 52,234)
.-----------------------------------------------------------------.
|       Status       |       Validator       | Stake => New Stake |
|--------------------|-----------------------|--------------------|
| Rollover           | node3                 | 304,940            |
| Rollover           | node1                 | 304,924            |
| Rollover           | node0                 | 304,903            |
| Rollover           | node2                 | 277,171            |
| Rollover           | huglester.betanet     | 209,874            |
| Rollover           | hashquark             | 166,381            |
| Proposal(Accepted) | unknown.test          | 137,481 => 165,985 |
| Rollover           | nuc2.test             | 110,512            |
| Rollover           | fredrikmalmqvist.test | 109,606            |
| Rollover           | dochpryof.test        | 109,566            |
| Proposal(Accepted) | ractolechoc5.test     | 109,296            |
| Rollover           | launooskuarttu.test   | 109,159            |
| Proposal(Accepted) | villiamsivertsen.test | 108,964            |
| Rollover           | janliamnilsson.test   | 108,907            |
| Rollover           | olaiolsen.test        | 108,806            |
| Rollover           | bowen.test            | 108,779            |
| Rollover           | tommywesley.test      | 108,583            |
| Rollover           | simonhugo.test        | 108,081            |
| Rollover           | oligarr.test          | 107,980            |
| Rollover           | felixschulz.test      | 107,478            |
| Rollover           | staked.test           | 107,033            |
| Rollover           | bitoven.test          | 106,765            |
| Rollover           | volvos60909.test      | 105,928            |
| Rollover           | jaroslavrud.test      | 105,579            |
| Rollover           | anonstake.test        | 105,525            |
| Rollover           | isillien.betanet      | 105,093            |
| Rollover           | pony.test             | 104,468            |
| Rollover           | buster.betanet        | 104,146            |
| Rollover           | pathrock.test         | 103,716            |
| Rollover           | gunray.test           | 102,611            |
| Rollover           | validatorsonline.test | 102,459            |
| Rollover           | andreyvelde.test      | 102,415            |
| Rollover           | unicorn.betanet       | 102,410            |
| Rollover           | nodeasy.test          | 102,179            |
| Rollover           | catcatcat.test        | 101,628            |
| Rollover           | danil.betanet         | 101,005            |
| Rollover           | zav.betanet           | 100,958            |
| Rollover           | sll.betanet           | 100,902            |
| Rollover           | fattox.test           | 100,721            |
| Rollover           | gaia.test             | 100,721            |
| Rollover           | stateb.betanet        | 100,717            |
| Rollover           | sparkpool.test        | 100,596            |
| Rollover           | moonlet.test          | 100,595            |
| Rollover           | afi.betanet           | 100,500            |
| Rollover           | fra.betanet           | 100,500            |
| Rollover           | max.betanet           | 100,500            |
| Rollover           | itokenpool.betanet    | 100,402            |
| Rollover           | harrypotter           | 100,304            |
| Proposal(Accepted) | stakingfund.test      | 100,000            |
| Rollover           | gladba.betanet        | 89,290             |
| Rollover           | ubikcapital.test      | 85,260             |
| Rollover           | lxyw.betanet          | 75,730             |
| Rollover           | zavodil.betanet       | 75,564             |
| Rollover           | something.betanet     | 75,229             |
| Rollover           | gamah.betanet         | 75,197             |
| Rollover           | vitalpointai.betanet  | 70,032             |
| Rollover           | blaze.betanet         | 55,168             |
| Proposal(Declined) | dokiacapital.betanet  | 11,133             |
| Proposal(Declined) | a.betanet             | 500                |
'-----------------------------------------------------------------'
Expected seat price is calculated based on observed so far proposals and validators.
It can change from new proposals or some validators going offline.
Note: this currently doesn't account for offline kickouts and rewards for current epoch

@mfornet
Copy link
Member

mfornet commented Apr 24, 2020

WDYT about sorting the rows by total staked instead of by validator name?

@ilblackdragon
Copy link
Member Author

@mfornet done.

@ilblackdragon ilblackdragon marked this pull request as ready for review April 27, 2020 10:18
@ilblackdragon
Copy link
Member Author

ilblackdragon commented Apr 27, 2020

Also @bowenwang1996 @frol interestingly, indeed near/nearcore#2259 is not needed, but seat price is actually not everything. We also cut some validators from their seats, because usually with given threshold it will be over 100 seats filled. To reproduce this logic, we actually need to reproduce the random shuffle that our EpochManager does... In this PR seat number is not always correct and doesn't add up to 100.

PS. Will need to move logic to near-api-js in a separate PR - near/near-api-js#297 to track it.

Copy link
Contributor

@bowenwang1996 bowenwang1996 left a comment

Choose a reason for hiding this comment

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

shouldn't this be in near-api-js?

package.json Show resolved Hide resolved
commands/validators.js Outdated Show resolved Hide resolved
commands/validators.js Outdated Show resolved Hide resolved
commands/validators.js Outdated Show resolved Hide resolved
commands/validators.js Outdated Show resolved Hide resolved
commands/validators.js Outdated Show resolved Hide resolved
commands/validators.js Outdated Show resolved Hide resolved
@stefanopepe
Copy link

Super welcome feature! I feel limited by the structure of the CLI, mostly because it can only see "the now" and not in the past.

Example of needed features:

  • As a CLI user, I want to know the per-seat cost, such that I don't risk to stake a too small amount
  • As a CLI user, I want to know if my stake transaction was included in the proposals, such that I know that I will become validator
  • As a CLI user, I want to know if my "state" is [no stake, proposal, validator, future validator, future kicked out, past kicked out], such that I can plan my actions accordingly
  • As a CLI user, I want to know my "rewards" and performance from the last epoch, such that I can easily report my rewards

On the other hand, I'm not sure that displaying the whole Validator RPC endpoint would be helpful without some time-related queries (e.g., look at past blocks, to know my node performance over time). From this point of view, I'd rather build an application to capture the time series, trying to catch the anomalies.

@ilblackdragon ilblackdragon changed the title Adding experimental API to list validators Adding experimental command to list validators Apr 28, 2020
@bowenwang1996
Copy link
Contributor

To reproduce this logic, we actually need to reproduce the random shuffle that our EpochManager does... In this PR seat number is not always correct and doesn't add up to 100.

@ilblackdragon do we actually want to reproduce this logic? It seems very difficult. We not only need to implement rust's random number generator in javascript, but also find the random seed used there, which means we also need to reproduce the logic of epoch id computation. I suggest that we not do it.

@ilblackdragon
Copy link
Member Author

@vgrichina Moving into near/near-api-js#300

@bowenwang1996 Well, we need to make it reproducible for other clients to be able to reproduce... If we don't think our current random function is reproducible (and I looked into it - it's very complicated) - we should change it.

@bowenwang1996
Copy link
Contributor

If we don't think our current random function is reproducible (and I looked into it - it's very complicated) - we should change it.

Agree. Probably some simple shuffling would suffice.

package.json Outdated Show resolved Hide resolved
@vgrichina vgrichina merged commit bf8da4e into master May 8, 2020
@ilblackdragon ilblackdragon deleted the validator-list branch May 8, 2020 09:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants