ton-blockchain / ton

Main TON monorepo
Other
3.04k stars 952 forks source link

validator-engine-console: list keys #258

Open akme opened 4 years ago

akme commented 4 years ago

It would be nice to have an option to get the list of all keys added to a validator, so we can manage them more easily.

Currently, if we didn't remember which key was added as permanent for current election date, then we can't add new one, because of error Failed addpermkey query: [Error : 621 : failed to add validator permanent key: duplicate election date] and in this case, we can't participate in the whole election, until we figure out which key was added for the election.

While actively being a validator on testnet, we already have more than 100 keys in the keyring, most of them are already expired and won't be used anymore, so if you can get a list of keys with additional information like election date and expire date, it will help us keep our keyring clean.

igroman787 commented 4 years ago

Currently, if we didn't remember which key was added as permanent for current election date, then we can't add new one, because of error

In order to avoid such an error, you can see having a key for a certain stage of validation. To do this, look at the list of validators in the console output of the getconfig command and compare the election_date with the real active_election_id. For example, we have already added a key for the validator for the next election (election_date = active_election_id = 1582434941):

> getconfig
...
...
...
"validators" : [
      {
         "@type" : "engine.validator",
         "id" : "NwnSyVM9Uw9H7coaawQdKVaVrASmrQB3T5zenAjyjkg=",
         "temp_keys" : [
            {
               "@type" : "engine.validatorTempKey",
               "key" : "NwnSyVM9Uw9H7coaawQdKVaVrASmrQB3T5zenAjyjkg=",
               "expire_at" : 1582500777
            }
         ],
         "adnl_addrs" : [
            {
               "@type" : "engine.validatorAdnlAddress",
               "id" : "s9NjdBfOiBFQcYC1ETwo4e0pHBZR9/ntV72ljnuTpkE=",
               "expire_at" : 1582500777
            }
         ],
         "election_date" : 1582434941,
         "expire_at" : 1582500777
      }
   ],
...
...
...
> runmethod -1:3333333333333333333333333333333333333333333333333333333333333333 active_election_id

arguments:  [ 86535 ]
result:  [ 1582434941]