autonity / aut

A command-line RPC client for Autonity
MIT License
11 stars 10 forks source link

Detect if an address is not a validator #119

Closed noandrea closed 1 year ago

noandrea commented 1 year ago

When there is a request to get the info of a validator by address, check that the response identify a validator, otherwise print an error.

How to smoke test:

For a validator

aut  validator info --validator 0x32F3493Ef14c28419a98Ff20dE8A033cf9e6aB97

should print

{
  "treasury": "0x75474aC55768fAb6fE092191eea8016b955072F5",
  "addr": "0x32F3493Ef14c28419a98Ff20dE8A033cf9e6aB97",
  "enode": "enode://d4dc137f987e17155a69b31e566494c16edafd228912483cc519a48ce85864781faccc38141cc0eb1df8cdb28b9b3ccd10e1c298bac78ac43bbe5804021c1152@34.142.71.5:30303",
  "commission_rate": 1000,
  "bonded_stake": 10000000000000000000000,
  "total_slashed": 0,
  "liquid_contract": "0xf4D9599aFd90B5038b18e3B551Bc21a97ed21c37",
  "liquid_supply": 10000000000000000000000,
  "registration_block": 0,
  "state": 0
}

For an address that is not a validator

aut validator info --validator 0xe2Fb069045dFB19f3DD2B95A5A09D6F62984932d

should print

The address 0xe2Fb069045dFB19f3DD2B95A5A09D6F62984932d is not registered as a validator.

gh-113