autonity / aut

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

`aut validator bond` increments in wei not in auton #75

Closed cmjc closed 1 year ago

cmjc commented 1 year ago

If I bond 1 then my NTN balance decrements in wei not whole Auton:

ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut validator bond --validator 0xA9F070101236476fe077F4A058C0C22E81b8A6C9 1 | aut tx sign - | aut tx send -
(consider using 'KEYFILEPWD' env var).
Enter passphrase (or CTRL-d to exit): 
0xa7a4575447383978e5e1d8e5a0bdb14fcedc0eec5d2d2648a03fe13de5c1e815
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut token balance-of --ntn 0xd4eddde5d1d0d7129a7f9c35ec55254f43b8e6d4
5.000000000000010009
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut validator bond --validator 0xA9F070101236476fe077F4A058C0C22E81b8A6C9 1 | aut tx sign - | aut tx send -
(consider using 'KEYFILEPWD' env var).
Enter passphrase (or CTRL-d to exit): 
0x736038db422ec948f822930b5855a1fbbf74f0d2e70b53effb26e834a32a2863
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut token balance-of --ntn 0xd4eddde5d1d0d7129a7f9c35ec55254f43b8e6d4
5.000000000000010008
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut validator info --validator 0xA9F070101236476fe077F4A058C0C22E81b8A6C9                 

{
  "treasury": "0x11A87b260Dd85ff7189d848Fd44b28Cc8505fa9C",
  "addr": "0xA9F070101236476fe077F4A058C0C22E81b8A6C9",
  "enode": "enode://11e025123dc489f30c26f2f46cef177de2c72d07c3b0f6aa948a2575e2b4be362b8098c14ec4720e4e46daceb390caeb1ad273f3adbfca8c4150e58c0c71f24b@51.89.151.55:30303",
  "commission_rate": 1000,
  "bonded_stake": 10000,
  "total_slashed": 0,
  "liquid_contract": "0xf4D9599aFd90B5038b18e3B551Bc21a97ed21c37",
  "liquid_supply": 10000,
  "registration_block": 0,
  "state": 0
}
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ 

The validator info only shows the amount in whole auton, so the dust amount of .000000000000010002 is not showing in either the liquid_supply or the bonded_stake amount, either.

dtebbs commented 1 year ago

In develop and contract-updates branches, this appears to be fixed:

$ aut validator bond --validator 0x9f793D2c7E1D5a72A020281F383bfc5e3086AcA9 --keyfile tests/data/alice.key 0.000000000000000001 --gas 1
{"value": 0, "maxFeePerGas": 1500000000, "maxPriorityFeePerGas": 500000000, "chainId": 65100000, "from": "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf", "gas": 1000000000000000000, "to": "0xBd770416a3345F91E4B34576cb804a576fa48EB1", "data": "0xa515366a0000000000000000000000009f793d2c7e1d5a72a020281f383bfc5e3086aca90000000000000000000000000000000000000000000000000000000000000001", "nonce": 43}

(notice the call data ends with 000000000000000000001 meaning 10^-18 NTN)

$ aut validator bond --validator 0x9f793D2c7E1D5a72A020281F383bfc5e3086AcA9 --keyfile tests/data/alice.key 1 --gas 1
{"value": 0, "maxFeePerGas": 1500000000, "maxPriorityFeePerGas": 500000000, "chainId": 65100000, "from": "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf", "gas": 1000000000000000000, "to": "0xBd770416a3345F91E4B34576cb804a576fa48EB1", "data": "0xa515366a0000000000000000000000009f793d2c7e1d5a72a020281f383bfc5e3086aca90000000000000000000000000000000000000000000000000de0b6b3a7640000", "nonce": 43}

(notice the call data ends with de0b6b3a7640000" meaning 1 NTN or 10^18 units).

@cmjs If you get a chance to check against a running network could you let me know. Thanks.

cmjc commented 1 year ago

Sure, will when I get some test NTN funds.

dtebbs commented 1 year ago

Closign as I believe this was not an aut cli issue in the end. Please reopen if that's not correct.