Phala-Network / phala-blockchain

The Phala Network Blockchain, pRuntime and the bridge.
https://phala.network
Apache License 2.0
332 stars 149 forks source link

Integrate stakepool with wapod workers #1584

Open kvinwang opened 2 weeks ago

kvinwang commented 2 weeks ago

Introduction

This PR integrate wapod workers to phala chain. Only the chain runtime changes is included in this PR. The corresponding out-of-tree code of wapod-pherry, wapod-types and the benchmark app can be reviewed here: https://github.com/Phala-Network/wapo/pull/1

Concepts

The computaion workflow

Worker registeration

Worker v3 share the same chain API as pruntime v2 to register workers, where the remote attestation is done.

Beside the traditional registration, the following extra information is required to be submitted on chain for a worker:

Ticket based - market mode

Steps

Related pallet calls: worker_list_create, worker_list_add_workers, ticket_create, ticket_close, ticket_settle.

Benchmark based - v2 compatible mode

Steps

Related pallet calls: benchmark_app_add, benchmark_app_set_recommended, benchmark_app_set, benchmark_score_submit, benchmark_app_remove.

Changes in GK

Static V switch

A mq message SetStaticV added to switch the GK to static v mode, in which mode the v never increase.

HeartbeatV3

When handling the new added HeartbeatV3 in GK, it is no longer required to be 1:1 map from hearbeat to challenge, any on heartbeat will flush the waiting heartbeat queue.