From 196d9ec60aa866cdac78627e1272adc1325b4536 Mon Sep 17 00:00:00 2001 From: Drew Stone Date: Tue, 12 Dec 2023 00:38:52 -0700 Subject: [PATCH] Fix tests build --- Cargo.lock | 1 + pallets/dkg-metadata/Cargo.toml | 1 + pallets/dkg-metadata/src/mock.rs | 3 ++- pallets/dkg-proposal-handler/src/lib.rs | 6 +----- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 55f58f456..399eb3f37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7194,6 +7194,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-staking", + "sp-state-machine", "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", "webb-proposals 0.8.0", ] diff --git a/pallets/dkg-metadata/Cargo.toml b/pallets/dkg-metadata/Cargo.toml index b6e31a07a..22cc712b3 100644 --- a/pallets/dkg-metadata/Cargo.toml +++ b/pallets/dkg-metadata/Cargo.toml @@ -37,6 +37,7 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-staking = { workspace = true } sp-keystore = { workspace = true } +sp-state-machine = { workspace = true } k256 = { version = "0.11.5", default-features = false, features = ["arithmetic", "ecdsa"] } [features] diff --git a/pallets/dkg-metadata/src/mock.rs b/pallets/dkg-metadata/src/mock.rs index 8f602e884..16d966658 100644 --- a/pallets/dkg-metadata/src/mock.rs +++ b/pallets/dkg-metadata/src/mock.rs @@ -15,7 +15,7 @@ // construct_runtime requires this #![allow(clippy::from_over_into, clippy::unwrap_used)] use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::{construct_runtime, parameter_types, BasicExternalities}; +use frame_support::{construct_runtime, parameter_types}; use frame_system::EnsureRoot; use sp_core::{ sr25519::{self, Signature}, @@ -33,6 +33,7 @@ use sp_runtime::{ }, BuildStorage, Percent, Permill, }; +use sp_state_machine::BasicExternalities; use std::{sync::Arc, vec}; use crate as pallet_dkg_metadata; diff --git a/pallets/dkg-proposal-handler/src/lib.rs b/pallets/dkg-proposal-handler/src/lib.rs index 810ccee47..2a54549bc 100644 --- a/pallets/dkg-proposal-handler/src/lib.rs +++ b/pallets/dkg-proposal-handler/src/lib.rs @@ -462,15 +462,11 @@ pub mod pallet { let data = prop_batch.data(); // check the signature is valid - let _result = ensure_signed_by_dkg::>( + let result = ensure_signed_by_dkg::>( &prop_batch.signature, &data, ); - // Accept all signatures to make testing easier - #[cfg(test)] - let result: Result<(), dkg_runtime_primitives::utils::SignatureError> = Ok(()); - match result { Ok(_) => { // Do nothing, it is all good.