From e0d223084d6fec7320e28004123c77b585dc6044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Enrique=20Mu=C3=B1oz=20Mart=C3=ADn?= Date: Fri, 9 Aug 2024 10:42:40 +0200 Subject: [PATCH] LPv2: Fix weights with batch messages (#1951) * fix weights with limits * tests on_idle with weights * fix namings * fix clippy --- libs/mocks/src/liquidity_pools_gateway.rs | 14 ++- libs/traits/src/liquidity_pools.rs | 3 + .../liquidity-pools-gateway/queue/src/lib.rs | 56 +++++---- .../liquidity-pools-gateway/queue/src/mock.rs | 16 +-- .../queue/src/tests.rs | 112 ++++++++++++++---- .../queue/src/weights.rs | 30 ----- pallets/liquidity-pools-gateway/src/lib.rs | 43 ++++--- .../liquidity-pools-gateway/src/weights.rs | 8 +- runtime/altair/src/lib.rs | 1 - runtime/centrifuge/src/lib.rs | 1 - runtime/development/src/lib.rs | 1 - 11 files changed, 163 insertions(+), 122 deletions(-) delete mode 100644 pallets/liquidity-pools-gateway/queue/src/weights.rs diff --git a/libs/mocks/src/liquidity_pools_gateway.rs b/libs/mocks/src/liquidity_pools_gateway.rs index 51a5a86158..56561a7249 100644 --- a/libs/mocks/src/liquidity_pools_gateway.rs +++ b/libs/mocks/src/liquidity_pools_gateway.rs @@ -2,7 +2,7 @@ pub mod pallet { use cfg_traits::liquidity_pools::{MessageProcessor, OutboundMessageHandler}; use frame_support::pallet_prelude::*; - use mock_builder::{execute_call, register_call}; + use mock_builder::{execute_call, register_call, CallHandler}; use orml_traits::GetByKey; #[pallet::config] @@ -18,7 +18,13 @@ pub mod pallet { type CallIds = StorageMap<_, _, String, mock_builder::CallId>; impl Pallet { - pub fn mock_process(f: impl Fn(T::Message) -> (DispatchResult, Weight) + 'static) { + pub fn mock_process( + f: impl Fn(T::Message) -> (DispatchResult, Weight) + 'static, + ) -> CallHandler { + register_call!(f) + } + + pub fn mock_max_processing_weight(f: impl Fn(&T::Message) -> Weight + 'static) { register_call!(f); } @@ -39,6 +45,10 @@ pub mod pallet { fn process(msg: Self::Message) -> (DispatchResult, Weight) { execute_call!(msg) } + + fn max_processing_weight(msg: &Self::Message) -> Weight { + execute_call!(msg) + } } impl GetByKey> for Pallet { diff --git a/libs/traits/src/liquidity_pools.rs b/libs/traits/src/liquidity_pools.rs index e3b8cafe69..9ee729e4c6 100644 --- a/libs/traits/src/liquidity_pools.rs +++ b/libs/traits/src/liquidity_pools.rs @@ -64,6 +64,9 @@ pub trait MessageProcessor { /// Process a message. fn process(msg: Self::Message) -> (DispatchResult, Weight); + + /// Process a message. + fn max_processing_weight(msg: &Self::Message) -> Weight; } /// The trait required for handling outbound LP messages. diff --git a/pallets/liquidity-pools-gateway/queue/src/lib.rs b/pallets/liquidity-pools-gateway/queue/src/lib.rs index ded51430a5..57c5817e17 100644 --- a/pallets/liquidity-pools-gateway/queue/src/lib.rs +++ b/pallets/liquidity-pools-gateway/queue/src/lib.rs @@ -15,7 +15,7 @@ use core::fmt::Debug; use cfg_traits::liquidity_pools::{MessageProcessor, MessageQueue as MessageQueueT}; -use frame_support::pallet_prelude::*; +use frame_support::{dispatch::PostDispatchInfo, pallet_prelude::*}; use frame_system::pallet_prelude::*; pub use pallet::*; use parity_scale_codec::FullCodec; @@ -29,10 +29,6 @@ mod mock; #[cfg(test)] mod tests; -pub mod weights; - -pub use weights::WeightInfo; - #[frame_support::pallet] pub mod pallet { use super::*; @@ -56,9 +52,6 @@ pub mod pallet { /// Type used for processing messages. type MessageProcessor: MessageProcessor; - - /// Weight information. - type WeightInfo: WeightInfo; } #[pallet::pallet] @@ -128,21 +121,25 @@ pub mod pallet { /// are not reverted. /// - an extra defensive weight is added in order to cover the weight /// used when processing the message. - #[pallet::weight(T::WeightInfo::process_message())] + #[pallet::weight(MessageQueue::::get(nonce) + .map(|msg| T::MessageProcessor::max_processing_weight(&msg)) + .unwrap_or(T::DbWeight::get().reads(1)))] #[pallet::call_index(0)] - pub fn process_message(origin: OriginFor, nonce: T::MessageNonce) -> DispatchResult { + pub fn process_message( + origin: OriginFor, + nonce: T::MessageNonce, + ) -> DispatchResultWithPostInfo { ensure_signed(origin)?; let message = MessageQueue::::take(nonce).ok_or(Error::::MessageNotFound)?; - match Self::process_message_and_deposit_event(nonce, message.clone()) { - (Ok(_), _) => Ok(()), - (Err(e), _) => { - FailedMessageQueue::::insert(nonce, (message, e)); + let (result, weight) = Self::process_message_and_deposit_event(nonce, message.clone()); - Ok(()) - } + if let Err(e) = result { + FailedMessageQueue::::insert(nonce, (message, e)); } + + Ok(PostDispatchInfo::from(Some(weight))) } /// Convenience method for manually processing a failed message. @@ -156,25 +153,26 @@ pub mod pallet { /// are not reverted. /// - an extra defensive weight is added in order to cover the weight /// used when processing the message. - #[pallet::weight(T::WeightInfo::process_failed_message())] + #[pallet::weight(FailedMessageQueue::::get(nonce) + .map(|(msg, _)| T::MessageProcessor::max_processing_weight(&msg)) + .unwrap_or(T::DbWeight::get().reads(1)))] #[pallet::call_index(1)] pub fn process_failed_message( origin: OriginFor, nonce: T::MessageNonce, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { ensure_signed(origin)?; let (message, _) = FailedMessageQueue::::get(nonce).ok_or(Error::::MessageNotFound)?; - match Self::process_message_and_deposit_event(nonce, message.clone()) { - (Ok(_), _) => { - FailedMessageQueue::::remove(nonce); + let (result, weight) = Self::process_message_and_deposit_event(nonce, message); - Ok(()) - } - (Err(_), _) => Ok(()), + if result.is_ok() { + FailedMessageQueue::::remove(nonce); } + + Ok(PostDispatchInfo::from(Some(weight))) } } @@ -207,7 +205,13 @@ pub mod pallet { let mut processed_entries = Vec::new(); for (nonce, message) in MessageQueue::::iter() { - processed_entries.push(nonce); + let remaining_weight = max_weight.saturating_sub(weight_used); + let next_weight = T::MessageProcessor::max_processing_weight(&message); + + // We ensure we have still capacity in the block before processing the message + if remaining_weight.any_lt(next_weight) { + break; + } let weight = match Self::process_message_and_deposit_event(nonce, message.clone()) { (Ok(()), weight) => { @@ -229,6 +233,8 @@ pub mod pallet { } }; + processed_entries.push(nonce); + weight_used = weight_used.saturating_add(weight); if weight_used.all_gte(max_weight) { diff --git a/pallets/liquidity-pools-gateway/queue/src/mock.rs b/pallets/liquidity-pools-gateway/queue/src/mock.rs index 3785d5d35e..f4a7af0895 100644 --- a/pallets/liquidity-pools-gateway/queue/src/mock.rs +++ b/pallets/liquidity-pools-gateway/queue/src/mock.rs @@ -15,14 +15,12 @@ use cfg_mocks::pallet_mock_liquidity_pools_gateway; use cfg_primitives::LPGatewayQueueMessageNonce; use cfg_types::domain_address::Domain; use frame_support::derive_impl; -use sp_runtime::traits::ConstU128; use crate::{self as pallet_liquidity_pools_gateway_queue, Config}; frame_support::construct_runtime!( pub enum Runtime { System: frame_system, - Balances: pallet_balances, LPGatewayMock: pallet_mock_liquidity_pools_gateway, LPGatewayQueue: pallet_liquidity_pools_gateway_queue, } @@ -34,26 +32,16 @@ impl frame_system::Config for Runtime { type Block = frame_system::mocking::MockBlock; } -#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)] -impl pallet_balances::Config for Runtime { - type AccountStore = System; - type Balance = u128; - type DustRemoval = (); - type ExistentialDeposit = ConstU128<1>; - type RuntimeHoldReason = (); -} - impl pallet_mock_liquidity_pools_gateway::Config for Runtime { type Destination = Domain; - type Message = (); + type Message = u32; } impl Config for Runtime { - type Message = (); + type Message = u32; type MessageNonce = LPGatewayQueueMessageNonce; type MessageProcessor = LPGatewayMock; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); } pub fn new_test_ext() -> sp_io::TestExternalities { diff --git a/pallets/liquidity-pools-gateway/queue/src/tests.rs b/pallets/liquidity-pools-gateway/queue/src/tests.rs index e48bcd4e8d..6ee9e4e10b 100644 --- a/pallets/liquidity-pools-gateway/queue/src/tests.rs +++ b/pallets/liquidity-pools-gateway/queue/src/tests.rs @@ -1,6 +1,8 @@ use cfg_primitives::LPGatewayQueueMessageNonce; use cfg_traits::liquidity_pools::MessageQueue as MessageQueueT; -use frame_support::{assert_noop, assert_ok, dispatch::RawOrigin}; +use frame_support::{ + assert_noop, assert_ok, dispatch::RawOrigin, pallet_prelude::Hooks, weights::Weight, +}; use sp_runtime::{ traits::{BadOrigin, One, Zero}, DispatchError, @@ -33,14 +35,13 @@ mod process_message { #[test] fn success() { new_test_ext().execute_with(|| { - let message = (); + let message = 1; let nonce = LPGatewayQueueMessageNonce::one(); - MessageQueue::::insert(nonce, message.clone()); + MessageQueue::::insert(nonce, message); - let msg_clone = message.clone(); LPGatewayMock::mock_process(move |msg| { - assert_eq!(msg, msg_clone); + assert_eq!(msg, message); (Ok(()), Default::default()) }); @@ -85,16 +86,15 @@ mod process_message { #[test] fn failure_message_processor() { new_test_ext().execute_with(|| { - let message = (); + let message = 1; let nonce = LPGatewayQueueMessageNonce::one(); - MessageQueue::::insert(nonce, message.clone()); + MessageQueue::::insert(nonce, message); - let msg_clone = message.clone(); let error = DispatchError::Unavailable; LPGatewayMock::mock_process(move |msg| { - assert_eq!(msg, msg_clone); + assert_eq!(msg, message); (Err(error), Default::default()) }); @@ -106,7 +106,7 @@ mod process_message { assert_eq!( FailedMessageQueue::::get(nonce), - Some((message.clone(), error)) + Some((message, error)) ); event_exists(Event::::MessageExecutionFailure { @@ -124,15 +124,14 @@ mod process_failed_message { #[test] fn success() { new_test_ext().execute_with(|| { - let message = (); + let message = 1; let nonce = LPGatewayQueueMessageNonce::one(); let error = DispatchError::Unavailable; - FailedMessageQueue::::insert(nonce, (message.clone(), error)); + FailedMessageQueue::::insert(nonce, (message, error)); - let msg_clone = message.clone(); LPGatewayMock::mock_process(move |msg| { - assert_eq!(msg, msg_clone); + assert_eq!(msg, message); (Ok(()), Default::default()) }); @@ -177,16 +176,15 @@ mod process_failed_message { #[test] fn failure_message_processor() { new_test_ext().execute_with(|| { - let message = (); + let message = 1; let nonce = LPGatewayQueueMessageNonce::one(); let error = DispatchError::Unavailable; - FailedMessageQueue::::insert(nonce, (message.clone(), error)); + FailedMessageQueue::::insert(nonce, (message, error)); - let msg_clone = message.clone(); let error = DispatchError::Unavailable; LPGatewayMock::mock_process(move |msg| { - assert_eq!(msg, msg_clone); + assert_eq!(msg, message); (Err(error), Default::default()) }); @@ -198,7 +196,7 @@ mod process_failed_message { assert_eq!( FailedMessageQueue::::get(nonce), - Some((message.clone(), error)) + Some((message, error)) ); event_exists(Event::::MessageExecutionFailure { @@ -216,15 +214,85 @@ mod message_queue_impl { #[test] fn success() { new_test_ext().execute_with(|| { - let message = (); + let message = 1; - assert_ok!(LPGatewayQueue::submit(message.clone())); + assert_ok!(LPGatewayQueue::submit(message)); let nonce = LPGatewayQueueMessageNonce::one(); - assert_eq!(MessageQueue::::get(nonce), Some(message.clone())); + assert_eq!(MessageQueue::::get(nonce), Some(message)); event_exists(Event::::MessageSubmitted { nonce, message }) }); } } + +mod on_idle { + use super::*; + + const PROCESS_LIMIT_WEIGHT: Weight = Weight::from_all(2000); + const PROCESS_WEIGHT: Weight = Weight::from_all(1000); + const TOTAL_WEIGHT: Weight = PROCESS_WEIGHT.mul(5); + + #[test] + fn success_all() { + new_test_ext().execute_with(|| { + (1..=3).for_each(|i| MessageQueue::::insert(i as u64, i * 10)); + + LPGatewayMock::mock_max_processing_weight(|_| PROCESS_LIMIT_WEIGHT); + let handle = LPGatewayMock::mock_process(|_| (Ok(()), PROCESS_WEIGHT)); + + let weight = LPGatewayQueue::on_idle(0, TOTAL_WEIGHT); + + assert_eq!(weight, PROCESS_WEIGHT * 3); + assert_eq!(handle.times(), 3); + assert_eq!(MessageQueue::::iter().count(), 0); + assert_eq!(FailedMessageQueue::::iter().count(), 0); + }); + } + + #[test] + fn not_all_messages_fit_in_the_block() { + new_test_ext().execute_with(|| { + (1..=5).for_each(|i| MessageQueue::::insert(i as u64, i * 10)); + + LPGatewayMock::mock_max_processing_weight(|_| PROCESS_LIMIT_WEIGHT); + let handle = LPGatewayMock::mock_process(|_| (Ok(()), PROCESS_WEIGHT)); + + let weight = LPGatewayQueue::on_idle(0, TOTAL_WEIGHT); + + assert_eq!(weight, PROCESS_WEIGHT * 4); + assert_eq!(handle.times(), 4); + assert_eq!(MessageQueue::::iter().count(), 1); + assert_eq!(FailedMessageQueue::::iter().count(), 0); + + // Next block + + let weight = LPGatewayQueue::on_idle(0, TOTAL_WEIGHT); + + assert_eq!(weight, PROCESS_WEIGHT); + assert_eq!(handle.times(), 5); + assert_eq!(MessageQueue::::iter().count(), 0); + }); + } + + #[test] + fn with_failed_messages() { + new_test_ext().execute_with(|| { + (1..=3).for_each(|i| MessageQueue::::insert(i as u64, i * 10)); + + LPGatewayMock::mock_max_processing_weight(|_| PROCESS_LIMIT_WEIGHT); + let handle = LPGatewayMock::mock_process(|msg| match msg { + 20 => (Err(DispatchError::Unavailable), PROCESS_WEIGHT / 2), + _ => (Ok(()), PROCESS_WEIGHT), + }); + + let weight = LPGatewayQueue::on_idle(0, TOTAL_WEIGHT); + + assert_eq!(weight, PROCESS_WEIGHT * 2 + PROCESS_WEIGHT / 2); + assert_eq!(handle.times(), 3); + assert_eq!(MessageQueue::::iter().count(), 0); + assert_eq!(FailedMessageQueue::::iter().count(), 1); + }); + } +} diff --git a/pallets/liquidity-pools-gateway/queue/src/weights.rs b/pallets/liquidity-pools-gateway/queue/src/weights.rs deleted file mode 100644 index cccb61dc75..0000000000 --- a/pallets/liquidity-pools-gateway/queue/src/weights.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2021 Centrifuge Foundation (centrifuge.io). -// This file is part of Centrifuge chain project. - -// Centrifuge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version (see http://www.gnu.org/licenses). - -// Centrifuge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -use cfg_primitives::LP_DEFENSIVE_WEIGHT; -use frame_support::weights::Weight; - -pub trait WeightInfo { - fn process_message() -> Weight; - fn process_failed_message() -> Weight; -} - -impl WeightInfo for () { - fn process_message() -> Weight { - LP_DEFENSIVE_WEIGHT - } - - fn process_failed_message() -> Weight { - LP_DEFENSIVE_WEIGHT - } -} diff --git a/pallets/liquidity-pools-gateway/src/lib.rs b/pallets/liquidity-pools-gateway/src/lib.rs index 0ca9a22dfd..c981b0a8ce 100644 --- a/pallets/liquidity-pools-gateway/src/lib.rs +++ b/pallets/liquidity-pools-gateway/src/lib.rs @@ -28,7 +28,7 @@ use core::fmt::Debug; -use cfg_primitives::{LP_DEFENSIVE_WEIGHT, LP_DEFENSIVE_WEIGHT_REF_TIME}; +use cfg_primitives::LP_DEFENSIVE_WEIGHT; use cfg_traits::{ liquidity_pools::{ InboundMessageHandler, LPEncoding, MessageProcessor, MessageQueue, OutboundMessageHandler, @@ -212,7 +212,7 @@ pub mod pallet { StorageMap<_, Blake2_128Concat, Domain, [u8; 20], OptionQuery>; /// Stores a batch message, not ready yet to be enqueue. - /// Lifetime handled by `start_pack_messages()` and `end_pack_messages()` + /// Lifetime handled by `start_batch_message()` and `end_batch_message()` /// extrinsics. #[pallet::storage] pub(crate) type PackedMessage = @@ -254,12 +254,12 @@ pub mod pallet { /// signals malforming of the wrapping information. RelayerMessageDecodingFailed { reason: RelayerMessageDecodingError }, - /// Emitted when you call `start_pack_messages()` but that was already - /// called. You should finalize the message with `end_pack_messages()` + /// Emitted when you call `start_batch_message()` but that was already + /// called. You should finalize the message with `end_batch_message()` MessagePackingAlreadyStarted, - /// Emitted when you can `end_pack_messages()` but the packing process - /// was not started by `start_pack_messages()`. + /// Emitted when you can `end_batch_message()` but the packing process + /// was not started by `start_batch_message()`. MessagePackingNotStarted, } @@ -471,8 +471,8 @@ pub mod pallet { /// Start packing messages in a single message instead of enqueue /// messages. - /// The message will be enqueued once `end_pack_messages()` is called. - #[pallet::weight(T::WeightInfo::start_pack_messages())] + /// The message will be enqueued once `end_batch_messages()` is called. + #[pallet::weight(T::WeightInfo::start_batch_message())] #[pallet::call_index(9)] pub fn start_batch_message(origin: OriginFor, destination: Domain) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -489,7 +489,7 @@ pub mod pallet { /// End packing messages. /// If exists any batch message it will be enqueued. /// Empty batches are no-op - #[pallet::weight(T::WeightInfo::end_pack_messages())] + #[pallet::weight(T::WeightInfo::end_batch_message())] #[pallet::call_index(10)] pub fn end_batch_message(origin: OriginFor, destination: Domain) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -539,23 +539,12 @@ pub mod pallet { return (Err(Error::::RouterNotFound.into()), read_weight); }; - let serialized = message.serialize(); - let serialized_len = serialized.len() as u64; - - // TODO: do we really need to return the weights in send() if later we use the - // defensive ones? - let (result, router_weight) = match router.send(sender, serialized) { + let (result, router_weight) = match router.send(sender, message.serialize()) { Ok(dispatch_info) => (Ok(()), dispatch_info.actual_weight), Err(e) => (Err(e.error), e.post_info.actual_weight), }; - ( - result, - router_weight - .unwrap_or(Weight::from_parts(LP_DEFENSIVE_WEIGHT_REF_TIME, 0)) - .saturating_add(read_weight) - .saturating_add(Weight::from_parts(0, serialized_len)), - ) + (result, router_weight.unwrap_or(read_weight)) } fn queue_message(destination: Domain, message: T::Message) -> DispatchResult { @@ -615,5 +604,15 @@ pub mod pallet { } => Self::process_outbound_message(sender, destination, message), } } + + /// Process a message. + fn max_processing_weight(msg: &Self::Message) -> Weight { + match msg { + GatewayMessage::Inbound { message, .. } => { + LP_DEFENSIVE_WEIGHT.saturating_mul(message.submessages().len() as u64) + } + GatewayMessage::Outbound { .. } => LP_DEFENSIVE_WEIGHT, + } + } } } diff --git a/pallets/liquidity-pools-gateway/src/weights.rs b/pallets/liquidity-pools-gateway/src/weights.rs index 32109817e5..b1ac9ed578 100644 --- a/pallets/liquidity-pools-gateway/src/weights.rs +++ b/pallets/liquidity-pools-gateway/src/weights.rs @@ -21,8 +21,8 @@ pub trait WeightInfo { fn receive_message() -> Weight; fn process_outbound_message() -> Weight; fn process_failed_outbound_message() -> Weight; - fn start_pack_messages() -> Weight; - fn end_pack_messages() -> Weight; + fn start_batch_message() -> Weight; + fn end_batch_message() -> Weight; } // NOTE: We use temporary weights here. `execute_epoch` is by far our heaviest @@ -125,7 +125,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(1)) } - fn start_pack_messages() -> Weight { + fn start_batch_message() -> Weight { // TODO: BENCHMARK CORRECTLY // // NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve` @@ -136,7 +136,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(1)) } - fn end_pack_messages() -> Weight { + fn end_batch_message() -> Weight { // TODO: BENCHMARK CORRECTLY // // NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve` diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index 6a609b6f98..ce68321f14 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -1828,7 +1828,6 @@ impl pallet_liquidity_pools_gateway_queue::Config for Runtime { type MessageNonce = LPGatewayQueueMessageNonce; type MessageProcessor = LiquidityPoolsGateway; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); } parameter_types! { diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 2df9dff2b9..1353bcbfb2 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -1924,7 +1924,6 @@ impl pallet_liquidity_pools_gateway_queue::Config for Runtime { type MessageNonce = LPGatewayQueueMessageNonce; type MessageProcessor = LiquidityPoolsGateway; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); } parameter_types! { diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index 9bd6f8f09c..3d7f1aaf7f 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -1930,7 +1930,6 @@ impl pallet_liquidity_pools_gateway_queue::Config for Runtime { type MessageNonce = LPGatewayQueueMessageNonce; type MessageProcessor = LiquidityPoolsGateway; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); } parameter_types! {