From 7b31cbb5fc45db994c06f1b8b90ab165645f3689 Mon Sep 17 00:00:00 2001 From: Michal Swietek <4404982+mike1729@users.noreply.github.com> Date: Fri, 20 Dec 2024 18:04:16 +0100 Subject: [PATCH] A0-0000: Use hash as msg in signature (#1899) Co-authored-by: Michal Swietek --- pallets/aleph/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/aleph/src/lib.rs b/pallets/aleph/src/lib.rs index 38b961b6..ba117c1d 100644 --- a/pallets/aleph/src/lib.rs +++ b/pallets/aleph/src/lib.rs @@ -40,7 +40,7 @@ pub mod pallet { }; use pallet_session::SessionManager; use primitives::{Score, ScoreNonce, SessionInfoProvider, TotalIssuanceProvider}; - use sp_runtime::traits::ValidateUnsigned; + use sp_runtime::traits::{Hash, ValidateUnsigned}; use sp_std::collections::btree_map::BTreeMap; #[cfg(feature = "std")] use sp_std::marker::PhantomData; @@ -344,7 +344,7 @@ pub mod pallet { score: &Score, signature: &SignatureSet>, ) -> Result<(), TransactionValidityError> { - let msg = score.encode(); + let msg = T::Hashing::hash_of(&score.encode()).encode(); let authority_verifier = AuthorityVerifier::new(Self::authorities()); if !AuthorityVerifier::is_complete(&authority_verifier, &msg, signature) { return Err(InvalidTransaction::BadProof.into());