osmosis-labs / osmosis

The AMM Laboratory
https://app.osmosis.zone
Apache License 2.0
887 stars 590 forks source link

Remove all (non-community pool) module accounts from derive-account-balances #479

Open ValarDragon opened 3 years ago

ValarDragon commented 3 years ago

We should remove all module accounts from the produced airdrop balances. (https://github.com/osmosis-labs/osmosis/blob/main/cmd/osmosisd/cmd/balances_from_state_export.go)

Alot of the balances are from module accounts. (Unvested developer tokens, all bonded osmo, etc.). You can get the module accounts from a genesis file hackily as cat state_export.json | grep -A 9 -B 1 /cosmos.auth.v1beta1.ModuleAccount > module_account_list.txt

We should parse all of those in golang, and remove them (except the community-pool) from the output derived balances.

AlpinYukseloglu commented 2 years ago

@ValarDragon Is there an easy way to check if an account is a module account, or should we create a list using the hacky method you mentioned and hardcode it in as a "blacklist"?

It feels as though the cleaner approach would be to have some sort of check while the lists are being generated so that we don't have to manually update the module account list if it changes (especially if superfluid staking accounts are considered modules in which case some change to the airdrop list generation process will be necessary).

ValarDragon commented 2 years ago

Its unfortunately pretty inconvenient atm.

Basically you have to call GetAccount. Then you have to see if you can type-cast the account into a authtypes.ModuleAccount. (You should attempt type casting into *authtypes.ModuleAccount. Its best to attempt type casting into both)

AlpinYukseloglu commented 2 years ago

Its unfortunately pretty inconvenient atm.

Basically you have to call GetAccount. Then you have to see if you can type-cast the account into a authtypes.ModuleAccount. (You should attempt type casting into *authtypes.ModuleAccount. Its best to attempt type casting into both)

Would the idea be that if trying to typecast a given account into a authtypes.ModuleAccount throws an error, we keep that specific account in the list? e.g.:

for currentAccount in airdrop list {
   acc = GetAccount(currentAccount)
   err = *authtypes.ModuleAccount(acc)
   if err != nil {break}
}
ValarDragon commented 2 years ago

not break, but continue yeah