[ 🔝 ] Secure Worker Mining FAQ

This topic is created to collect all of the FAQ and issues you cannot solve during the mining process. We’ll gather all issues and post them here after coming up with proper solutions.
Please search under this topic first to find answers related to your questions and try to solve them using the solutions provided.

Do not hesitate to comment below whether the solutions work or not.

Related Issues:

:on: In Progress: /

:white_check_mark: SOLVED!

:white_check_mark: pherry exited HeaderHashMismatch

[2021-09-18T04:00:58Z INFO pherry] bridge() exited with result: Err(HeaderHashMismatch)

:warning: Update: The latest 09-17 snapshot is perfect and thus don’t need to apply the walkaround.

Solution: Delete the Khala block history in the database

1.Stop the node (keep pruntime)
2.Delete the Khala data directory (Keep Kusama): rm -rf khala-node/chains/khala
3.Restart the node and pherry

The reason of this issue is that in the block data snapshot from the bittorrent file, the data of Khala is damaged, but the data of Kusama can still be used. The speed of synchronizing Khala after deleting the snapshot is relatively fast.

:white_check_mark: Pherry reported an error “Could not decode RuntimeMetadata::V9.0/10.0/…”

Could not decode `RuntimeMetadata::V9.0`
Decoding is not supported

Solution: Wait until the Kusama node is synchronized

The reason for this issue is that the Kusama node is still an old block and is not synchronized well. When pherry starts, it will connect to the Kusama node. The first operation when connecting is to parse the metadata. Metadata is highly bound to the block. Currently, we only support v13, which is the latest version. If the Kusama node is still stuck at 2020 or even 2019, there is a high probability that the metadata retrieved is too old. Therefore, we recommend checking the Kusama block height of the Khala node first when encountering this problem.

Check method: upgrade the script, the latest script will display the height of Kusama. Or you can check the node log, observe the Best height displayed in the [Relaychain] line, and compare it with the latest height on the Kusama block explorer.

:white_check_mark: Pherry exits pruntime log error bad justification for header

Situation: Pherry exited with an error during synchronization. Check the pruntime log and found the last few logs contain the following information:

[ERROR phactory::prpc_service] Rpc error: AppError("bad justification for header: invalid commit in grandpa justification")

Solution: Update pherry docker image

This issue is caused by the bad pherry version shipped with the solo mining script before the launch day. The problem was fixed before the launch but you may not notice the update.

:white_check_mark: pRuntime exited with "memory allocation of X bytes failed"

You may get similar error around or after parachain block 400829:

[INFO  phactory::prpc_service] Dispatching request: PhactoryAPI.SyncHeader
memory allocation of 74349772 bytes failed

Solution: Update the solo mining script if you are using it.

The new solo mining script added --fetch-blocks=512 to pherry. So it will reduce the memory usage in syncing process. If you are building your own stack, you can consider to limit --fetch-blocks to 512 as well. In the future we will adjust the memory layout to optimize it better.

:white_check_mark: Khala or Kusama block stuck forever

The Khala node may get stuck at some block height (usually between 8M and 9M relay chain block).


  1. Upgrade to the latest khala node docker image. The problem was already fixed in a new release.
  2. Optionally, you can try to download the blockchain snapshot (17/09).

Root cause: Kusama Node Fails to Sync Beyond 8949248 · Issue #3778 · paritytech/polkadot · GitHub

:white_check_mark: pherry syncing too slow

pherry may sync as slow as around 10 blocks per second. However with the performance tweak, it should run at 100 blk/s speed.

Solution: Upgrade to the latest solo mining script (this time a full reinstall of the script and the SGX driver is required).

If you are a power user, you can try to add these environment variables to your docker container:

PARACHAIN_EXTRA_ARGS='--state-cache-size 671088640 --db-cache 2048 --max-runtime-instances 16'
RELAYCHAIN_EXTRA_ARGS='--state-cache-size 671088640 --db-cache 2048 --max-runtime-instances 16' 

:white_check_mark: pRuntime crash due to insufficient memory of SGX

Situation: Solo script, when synced to about 900 million or more Kusama height, memory becomes insufficient, pRuntime exits, and “memory allocation of xxxx bytes failed” appears.

Solution: A new version of pRuntime was published on docker hub (9/30)
Follow the step below to update

sudo phala update
sudo phala start

if your current solo mining script is running without problem, you don’t have to run this update.

Tracking Issue: https://github.com/Phala-Network/phala-blockchain/issues/504


Already mentioned on discord.
@h4x3rotab already informed he will check it but for clarity I will post it here.

I have problem when syncing Kusama.
I tried it twice from 0 and syncing stops at block #8949248

In logs lot of messages:

[Parachain] 💔 Ignored block (#417054 -- 0x6915…b3ae) announcement from 12D3KooWSgwefJ4EtTxytSdTL5xvaKAbxYe7Ax6s5bo2tbmEkJMD because all validation slots for this peer are occupied. 
[Parachain] 💔 Ignored block (#417038 -- 0xbb73…f4e8) announcement from 12D3KooWSgwefJ4EtTxytSdTL5xvaKAbxYe7Ax6s5bo2tbmEkJMD because all validation slots for this peer are occupied.

And frequently:

[Relaychain] 💔 Error importing block 0x3054d46b58ce9c35b28a062488d8ad0b836b4da71bb1c36d9ee21b8bc795047c: Err(UnknownParent)

Sync status

[Relaychain] 💤 Idle (27 peers), best: #8949641 (0x135a…dd8f), finalized #8949248 (0x102e…0032), ⬇ 18.7kiB/s ⬆ 181.7kiB/s    
[Parachain] 💤 Idle (30 peers), best: #417683 (0x5430…e632), finalized #194400 (0xdfec…3ca0), ⬇ 4.8kiB/s ⬆ 45.0kiB/s

I still cannot obtain my worker public key

I’m getting a frontend error when I navigate to My Delegate | Phala App

This was working yesterday, but is broken today.

Console trace in browser (non-debug) is:

app-136d2c85c795ebcd7ed9.js:2 Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bdisplay%2C%20verified%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Sa (framework-05d3f9acc72f0711a6e8.js:2)
    at framework-05d3f9acc72f0711a6e8.js:2
    at Do (framework-05d3f9acc72f0711a6e8.js:2)
    at Qu (framework-05d3f9acc72f0711a6e8.js:2)
    at Ni (framework-05d3f9acc72f0711a6e8.js:2)
    at Ci (framework-05d3f9acc72f0711a6e8.js:2)
    at xi (framework-05d3f9acc72f0711a6e8.js:2)
    at gi (framework-05d3f9acc72f0711a6e8.js:2)
    at framework-05d3f9acc72f0711a6e8.js:2
    at t.unstable_runWithPriority (framework-05d3f9acc72f0711a6e8.js:2)
    at $l (framework-05d3f9acc72f0711a6e8.js:2)
    at ql (framework-05d3f9acc72f0711a6e8.js:2)
    at Ql (framework-05d3f9acc72f0711a6e8.js:2)
    at t.yi [as batchNotifyFn] (framework-05d3f9acc72f0711a6e8.js:2)
    at app-136d2c85c795ebcd7ed9.js:2

Browser: Version 1.29.81 Chromium: 93.0.4577.82 (Official Build) (x86_64)
](Brave Release Notes | Brave Browser)

i am not a dev but i am participating in delegation with my Kpha. when i go to “my deligate” on the app i am getting a load message and then a blank screen. i have tried this on multiple browsers.

Hi @investopps I move your issue here,

and he try tried following… still does not work

sudo phala update clean
sudo phala update script
sudo phala install dcap
sudo phala install isgx
sudo phala install
sudo phala uninstall

even uninstall phala… and rebuild… same error !
all phala-node, phala-pruntime and phala-pherry are STOP due to not able start it.

the node cannot be up issue partially solved. This is because when re-download the “main.zip” phala script. It goes to the same directory which previously has the old “main.zip” file. It does not overwrite it, instead it name as main1.zip. When unzip and install, it still use the old main.zip.
I deleted the old file and re-installed, node/pruntime/pherry are UP.

But node goes down after re-start every few minutes.

4 more issues are:

  1. phala-node goes down every few minutes after it re-start. “docker ps” found out that it goes down between >3mins and <4mins … any idea ?

  2. phala-pherry keep re-starting every few seconds. This is error “Could not decode RuntimeMetadata::V12.0:”. I guess this will solve only after Kusama synced?

  3. finalized #0 ==> always showing zero. Deleted /var/khala-dev-node/chains/khala/, and sync. Still the same. Any idea ?

  4. currentblock does not show anything in “sudo phala status” - will show once node Kusama fully synced?

Same issue. Blank page when clicking “My delegate”
Log : Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.

anyone can check and confirm above 4 issues i encountered?

Same Here.
Please look at that issues, as it is impossible to undelegate without access to that page.

Hey, this was fixed in today’s Phala App update.

pherry 添加–fetch-blocks=512 一样报memory allocation of 48072019 bytes failed,垃圾!