diff --git a/app-libs/sgx-runtime/pallets/guess-the-number/src/lib.rs b/app-libs/sgx-runtime/pallets/guess-the-number/src/lib.rs index ce0a328de..ba894c707 100644 --- a/app-libs/sgx-runtime/pallets/guess-the-number/src/lib.rs +++ b/app-libs/sgx-runtime/pallets/guess-the-number/src/lib.rs @@ -145,7 +145,7 @@ pub mod pallet { } #[pallet::call_index(1)] - #[pallet::weight((::WeightInfo::push_by_one_day(), DispatchClass::Normal, Pays::Yes) + #[pallet::weight((::WeightInfo::guess(), DispatchClass::Normal, Pays::Yes) )] pub fn guess(origin: OriginFor, guess: GuessType) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; @@ -209,7 +209,7 @@ where fn end_round() -> DispatchResult { let current_round_index = >::get(); info!("ending round {}", current_round_index); - + Self::payout_winners(); >::put(Self::winners()); >::kill(); >::put(Self::winning_distance().unwrap_or(GuessType::MAX)); @@ -228,7 +228,11 @@ where >::put(lucky_number); Ok(()) } - +} +impl OnTimestampSet for Pallet +where + sp_core::H256: From<::Hash>, +{ fn on_timestamp_set(now: T::Moment) { if Self::next_round_timestamp() == T::Moment::zero() { // only executed in first block after genesis. @@ -250,11 +254,6 @@ where }; } } -impl OnTimestampSet for Pallet { - fn on_timestamp_set(moment: T::Moment) { - Self::on_timestamp_set(moment) - } -} #[cfg(test)] mod mock; #[cfg(test)] diff --git a/app-libs/sgx-runtime/pallets/guess-the-number/src/weights.rs b/app-libs/sgx-runtime/pallets/guess-the-number/src/weights.rs index 73d369e76..10a3beded 100644 --- a/app-libs/sgx-runtime/pallets/guess-the-number/src/weights.rs +++ b/app-libs/sgx-runtime/pallets/guess-the-number/src/weights.rs @@ -3,6 +3,7 @@ pub use frame_support::weights::{constants::RocksDbWeight, Weight}; /// Weight functions needed for pallet_parentchain. pub trait WeightInfo { fn push_by_one_day() -> Weight; + fn guess() -> Weight; } /// Weights for pallet_parentchain using the Integritee parachain node and recommended hardware. @@ -10,4 +11,8 @@ impl WeightInfo for () { fn push_by_one_day() -> Weight { Weight::from_parts(10_000, 0u64) } + + fn guess() -> Weight { + Weight::from_parts(10_000, 0u64) + } }