Skip to content

Commit

Permalink
eliminate gas fee requirement for syncing GK messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nanometerzhu committed Dec 4, 2024
1 parent 309e465 commit 7d98b24
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pallets/phala/src/mq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub mod pallet {
pub fn sync_offchain_message(
origin: OriginFor<T>,
signed_message: SignedMessage,
) -> DispatchResult {
) -> DispatchResultWithPostInfo {
ensure_signed(origin)?;

// Check sender
Expand All @@ -89,9 +89,16 @@ pub mod pallet {
crate::registry::Pallet::<T>::check_message(&signed_message)?;
// Update ingress
OffchainIngress::<T>::insert(sender.clone(), expected_seq + 1);
// Check if is Gatekeeper
let is_gatekeeper = matches!(sender, phala_types::messaging::SenderId::Gatekeeper);
// Call dispatch_message
Self::dispatch_message(signed_message.message);
Ok(())

if is_gatekeeper {
Ok(Pays::No.into())
} else {
Ok(Pays::Yes.into())
}
}

// Messaging API for end user.
Expand Down

0 comments on commit 7d98b24

Please sign in to comment.