Skip to content

Commit

Permalink
Merge pull request Phala-Network#991 from Index0011/add_registry_events
Browse files Browse the repository at this point in the history
add registry events
  • Loading branch information
jasl authored Oct 11, 2022
2 parents e84053a + f03181d commit 9b1f413
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions pallets/phala/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ pub mod pallet {
},
WorkerAdded {
pubkey: WorkerPublicKey,
confidence_level: u8,
},
WorkerUpdated {
pubkey: WorkerPublicKey,
confidence_level: u8,
},
MasterKeyRotated {
rotation_id: u64,
Expand All @@ -181,6 +183,10 @@ pub mod pallet {
rotation_lock: Option<u64>,
gatekeeper_rotation_id: u64,
},
InitialScoreSet {
pubkey: WorkerPublicKey,
init_score: u32,
},
PRuntimeManagement(PRuntimeManagementEvent),
}

Expand Down Expand Up @@ -272,7 +278,10 @@ pub mod pallet {
confidence_level: worker_info.confidence_level,
}),
));
Self::deposit_event(Event::<T>::WorkerAdded { pubkey });
Self::deposit_event(Event::<T>::WorkerAdded {
pubkey,
confidence_level: worker_info.confidence_level,
});

Ok(())
}
Expand Down Expand Up @@ -451,7 +460,10 @@ pub mod pallet {
confidence_level: fields.confidence_level,
}),
));
Self::deposit_event(Event::<T>::WorkerUpdated { pubkey });
Self::deposit_event(Event::<T>::WorkerUpdated {
pubkey,
confidence_level: fields.confidence_level,
});
}
None => {
// Case 2 - New worker register
Expand All @@ -471,7 +483,10 @@ pub mod pallet {
confidence_level: fields.confidence_level,
}),
));
Self::deposit_event(Event::<T>::WorkerAdded { pubkey });
Self::deposit_event(Event::<T>::WorkerAdded {
pubkey,
confidence_level: fields.confidence_level,
});
}
}
});
Expand Down Expand Up @@ -722,6 +737,10 @@ pub mod pallet {
*worker_pubkey,
WorkerEvent::BenchScore(score),
));
Self::deposit_event(Event::<T>::InitialScoreSet{
pubkey: *worker_pubkey,
init_score: score,
});
}
RegistryEvent::MasterPubkey { master_pubkey } => {
let gatekeepers = Gatekeeper::<T>::get();
Expand Down

0 comments on commit 9b1f413

Please sign in to comment.