makerdao/auction-keeper

Keeper not exiting full amount of DAI from Vat

Closed this issue · 3 comments

Here is the output as I shut down the keeper:

2020-06-15 20:13:12,744 INFO     Dai token balance: 0.000000000000000000, Vat balance: 1.109625485353810202432866878071399109333638325
2020-06-15 20:13:19,423 WARNING  Keeper received SIGINT/SIGTERM signal, will terminate gracefully
2020-06-15 20:13:19,636 WARNING  The keeper is terminating due do SIGINT/SIGTERM signal received
2020-06-15 20:13:19,636 INFO     Shutting down the keeper
2020-06-15 20:13:19,636 INFO     Waiting for all threads to terminate...
2020-06-15 20:13:19,636 INFO     Waiting for outstanding callback to terminate...
2020-06-15 20:13:19,636 INFO     Waiting for outstanding timers to terminate...
2020-06-15 20:13:19,637 INFO     Executing keeper shutdown logic...
2020-06-15 20:13:19,647 INFO     Exiting 1.109625485353810202 Dai from the Vat before shutdown
2020-06-15 20:13:19,736 INFO     Sent transaction <pymaker.dss.DaiJoin object at 0x7fd5921a2828>.exit('0xd536eA64B9865059fc5e2D8BFd9Aa9bF677722f3', 1109625485353810202) with nonce=342, gas=180157, gas_price=10000000000
(tx_hash=0xff715af269eed77b89dd16c1cefc4447babc31225aba3d624fd365ff97beb56b)
2020-06-15 20:13:28,462 INFO     Transaction <pymaker.dss.DaiJoin object at 0x7fd5921a2828>.exit('0xd536eA64B9865059fc5e2D8BFd9Aa9bF677722f3', 1109625485353810202) was successful (tx_hash=0xff715af269eed77b89dd16c1cefc4447babc31225aba3d624fd365ff97beb56b)
2020-06-15 20:13:28,569 INFO     Shutdown logic finished
2020-06-15 20:13:28,569 INFO     Keeper terminate

When exiting DAI from the Vat, only amounts up to 18 decimals of ether are exited (1.109625485353810202). However, the full amount of DAI is 45 decimals (1.109625485353810202432866878071399109333638325).

I believe the main.py file is pulling out a Wad amount (18 decimals of ether), but the actual balances are Rad amounts (45 decimals). Can the python file be updated to exit the full amount of DAI in the Vat?

No; the token and join contract only support 18 decimals, so some dust is left behind.

To my understanding, more than 18 decimals cannot be exited because Ethereum itself only supports 18 decimals (e.g. wei). The Rad balances of 45 decimals are only used for internal accounting purposes in the contracts.

Correct me if I'm wrong in my assumptions. In any case, thanks for clarifying.

In theory, I believe ERC20 tokens could have more decimal places, so long as the value could be represented by a uint(256). I'm unaware of any token which uses more than 18. And yes, 45 decimals is useful when calculating fees and DSR accruals.