Why my funds is still "releasing" after 7 / 14 days?

中文: 【教程】为什么我的质押在在7/14天后仍然为releasing的状态?
Italia: Perché lo stato dei miei fondi è "releasing" dopo 7/14 giorni?
Español: ¿Por qué mis fondos todavía no se “liberan” después de 7/14 días?
Français: Pourquoi mes fonds sont-ils toujours « en attente de libération » après 7 / 14 jours ?

Recently we got quite a lot questions about the “releasing stake”. So here’s a post to explain what it is and how to get back the released stake.

The token release process

The token release is a complex process. As a delegator (staker), you can always withdraw (undelegate) some stake on the Phala App (or through PhalaStakePool.withdraw()). If there’s free stake, you can get your withdraw request fulfilled immediately. However if there’s no free stake, you need to wait in the “withdraw queue”. This is called a “withdraw request”. You can find the requests in the “Pool Details” window (or PhalaStakePool.stakePools() -> withdraw_queue).

The withdraw queue

Each withdraw request has a count down for the max waiting time. We call it a 7 days “grace period”, as a buffer time to notify the pool owner someone wants to withdraw the stake, and therefore they need to take action. In the grace period, whenever another contributor adds the stake to the pool, their stake gets in and your stake gets out.

But what if there’s no in stake to unlock yours? There’s a “force stop” mechanism. The blockchain automatically checks if there’s a request already waiting for 7 days not being fulfilled. If there’s any such request, the pool will be force shutdown, releasing all the stake.

Of course the pool owners don’t want their workers to stop. So they will need to make sure their pool not being shutdown by force. They either add more stake or stop a few miners to fulfill the withdraw request.

Things are getting complicated, because this is a game theory between the delegator and the pool owner. This is necessary because miners and delegators don’t trust each other. The delegators should be able to withdraw the stake at any time. Otherwise the pool owner may never allow them to withdraw. On the other hand, the delegator may decide to “attack” a pool by withdraw the stake immediately after the miner starts mining, if there’s no grace period to delay the request.

After the grace period

The last thing people need to take care about is the “releasing stake” in a pool. It means some miners are stopped, in Cool Down state. The CD state takes 7 days. When the CD time reached, we need one to trigger the release of the stake, and put it back to “Ready” state. For performance considerations, it’s not done automatically.

This operation is called “reclaim”. To trigger a reclaim, any account can send a transaction on Polkadot.js (the UI in Phala App is in development now):

PhalaStakePool.reclaimPoolWorker(pid, workerPubkey)

Then the pending stake will be released, and the “releasing stake” in a pool will be realized and allocated to the withdraw queue.

I’m not a pool operator. Where can I find the worker pubkey?

The Phala team is working on an “one-click reclaim” button on the Phala App. However before it’s ready, as a delegator you can still trigger it manually.

Anyone can call relcaimPoolWorker, but you have to find out the pubkey of the workers in the pool that finished the CoolDown period. There can be multiple workers waiting for reclaiming. You need to reclaim them one by one.

You can find the workers in the pool by checking workers field in PhalaStakePool.stakePools(pid) (or on the Phala App). And then check if they are ready to reclaim (or just try them all). However if the owner has removed the worker, it will not show in the stakePools. If that’s the case, you will need to figure it out. A potential way is to search the pool operator account in a blockchain explorer, and filter by PhalaStakePool.remove_worker.

To check if a worker is ready to reclaim, you either try it directly, or check the miner state at PhalaMining.miners(miner). The miner argument is the “virtual account” generated by (pid + worker pubkey). If the worker is not removed, you can lookup the miner account by PhalaMining.workerBindings(pubkey). However if it’s moved, I suggest to search the corresponding PhalaStakePool.add_worker call in the explorer, and check the MinerBound event generated by the transaction. It will mention the miner account as shown in the screenshot below.

Improvements

Overall speaking, the concept is hard, and the UI is not complete, which gives users big troubles. The team was busy in fixing on-chain bugs and we just start to fix the UI. Anyway, the UI will be updated shortly once it’s ready.

Issue #500

TL;DR. If you removed workers in CD state and added it back to the pool before reclaiming, you may have some stake frozen in “releasing stake” and are unable to reclaim it due to the bug #500. You will need to wait a few days for the team to unfreeze them. For details please check the Github issue.

7 Likes

Basically, withdraw is a request, signaling you want to withdraw some funds. And reclaim is an action to release some stake to “free stake”. And as long as there’s any free stake, it will fulfill the withdraw queue in a “first come first serve” way.

But if there’s a withdraw request waiting for 7 days, the pool owner must make sure to stop enough miners to release the funds, otherwise the pool will be shut down, releasing all the stake in 7 days (CD period).

After the worker is stopped and 7 days CD period passed, anyone can “reclaim” the stake by callingphalaStakePool.reclaimPoolWorker().

A caveat is that, if you call withdraw multiple times, your old request will be canceled and replaced by a the new request. Therefore the countdown also reset.

Hello again.

About issue #500, here said “need to wait a few days for the team to unfreeze them” but on explorer I don’t see success phalastakepool(backfill_issue500_reclaim) transactions. If team unfreeze stakes manually, maybe they can help with my case?

Pool ID - 906
Pool owner - Subscan | Substrate based blockchain explorer
Worker - 0xe0ceff18069bb5859f8d9ea60f7aed9ff15787ff45a0880a1b747b4b4131de5c

Many times tried “PhalaStakePool.reclaimPoolWorker(pid, workerPubkey)” but failed with error “CoolDownNotReady”.
Worker removed (removed, added, again removed) 17 days ago. Withdrawal request sent 26 days ago.
I think I have problem #500 but you can correct me if it’s not.