Skip to content

Commit

Permalink
fix events (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
1xstj committed Apr 28, 2023
1 parent ed68aeb commit 75f0bfa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions dkg-runtime-primitives/src/proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub trait ProposalHandlerTrait {

fn handle_signed_refresh_proposal(
_proposal: RefreshProposal,
_signature: Vec<u8>,
) -> frame_support::pallet_prelude::DispatchResult {
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/dkg-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ pub mod pallet {
Error::<T>::InvalidSignature
})?;
// Remove unsigned refresh proposal from queue
T::ProposalHandler::handle_signed_refresh_proposal(data)?;
T::ProposalHandler::handle_signed_refresh_proposal(data, signature.clone())?;
let bounded_signature: BoundedVec<_, _> =
signature.clone().try_into().map_err(|_| Error::<T>::OutOfBounds)?;
NextPublicKeySignature::<T>::put(bounded_signature);
Expand Down
9 changes: 9 additions & 0 deletions pallets/dkg-proposal-handler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ impl<T: Config> ProposalHandlerTrait for Pallet<T> {

fn handle_signed_refresh_proposal(
proposal: dkg_runtime_primitives::RefreshProposal,
signature: Vec<u8>,
) -> DispatchResult {
// Attempt to remove all previous unsigned refresh proposals too
// This may also remove ProposerSetUpdate proposals that haven't been signed
Expand All @@ -636,6 +637,14 @@ impl<T: Config> ProposalHandlerTrait for Pallet<T> {
let remaining_untyped_proposals: usize =
UnsignedProposalQueue::<T>::iter_key_prefix(TypedChainId::None).count();

// emit an event for the signed refresh proposal
Self::deposit_event(Event::<T>::ProposalSigned {
key: DKGPayloadKey::RefreshVote(proposal.nonce),
target_chain: TypedChainId::None,
data: proposal.pub_key,
signature,
});

for i in 0..remaining_untyped_proposals {
let index = i as u32;
// Ensure we break when we reach the bottom
Expand Down

0 comments on commit 75f0bfa

Please sign in to comment.