Skip to content

Commit

Permalink
Sync Phala pallets to aa14857f7ee75ead1dc10c52576ab7c2fc12c2d2
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Jul 24, 2023
1 parent 816c6f8 commit 105003b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pallets/phala/src/phat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,8 @@ pub mod pallet {
cluster_id: ContractClusterId,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let cluster_info = Clusters::<T>::get(cluster_id).ok_or(Error::<T>::ClusterNotFound)?;
let mut cluster_info =
Clusters::<T>::get(cluster_id).ok_or(Error::<T>::ClusterNotFound)?;
ensure!(
cluster_info.owner == origin,
Error::<T>::ClusterPermissionDenied
Expand All @@ -504,6 +505,8 @@ pub mod pallet {
// TODO: Do we need to check whether the worker agree to join the cluster?
ClusterByWorkers::<T>::insert(worker_pubkey, cluster_id);
ClusterWorkers::<T>::append(cluster_id, worker_pubkey);
cluster_info.workers.push(worker_pubkey);
Clusters::<T>::insert(cluster_id, cluster_info);
Self::deposit_event(Event::WorkerAddedToCluster {
worker: worker_pubkey,
cluster: cluster_id,
Expand Down

0 comments on commit 105003b

Please sign in to comment.