core-contracts icon indicating copy to clipboard operation
core-contracts copied to clipboard

Staking pool does not check whether owner account exists upon creation

Open bowenwang1996 opened this issue 3 years ago • 3 comments

When a staking pool is created, there is no check on whether the owner account exists. Since staking pool is usually locked (when created from the factory for example), the owner cannot do anything but abandon this staking pool if this happens.

bowenwang1996 avatar Sep 25 '20 14:09 bowenwang1996

Granted, there is no easy way to check whether an account exists from the smart contract, but I think we can find some hacky solution (for example try sending some small amount to the owner account and check whether the promise succeeds).

bowenwang1996 avatar Sep 25 '20 14:09 bowenwang1996

Can't frontend or something like this check the existence of the owner's account? E.g. for testnet lockup contract deployment we verify that the master account exists: https://github.com/near/core-contracts/blob/4f245101d7d029ffb3450c560770db244fc7b3ce/scripts/deploy_lockup.sh#L24-L30

For staking pool, we should provide a similar script to do the same

evgenykuzyakov avatar Sep 25 '20 18:09 evgenykuzyakov

@evgenykuzyakov sure let's do it

bowenwang1996 avatar Sep 25 '20 18:09 bowenwang1996