diff --git a/libs/traits/src/lib.rs b/libs/traits/src/lib.rs index 17f2ca6812..4769f10265 100644 --- a/libs/traits/src/lib.rs +++ b/libs/traits/src/lib.rs @@ -99,7 +99,6 @@ pub trait TrancheTokenPrice { #[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebug, TypeInfo)] pub enum UpdateState { NoExecution, - Executed(u32), Stored(u32), } diff --git a/pallets/pool-registry/src/lib.rs b/pallets/pool-registry/src/lib.rs index 3809a56d9e..d6d743197e 100644 --- a/pallets/pool-registry/src/lib.rs +++ b/pallets/pool-registry/src/lib.rs @@ -148,8 +148,6 @@ pub mod pallet { Registered { pool_id: T::PoolId }, /// A pool update was registered. UpdateRegistered { pool_id: T::PoolId }, - /// A pool update was executed. - UpdateExecuted { pool_id: T::PoolId }, /// A pool update was stored for later execution. UpdateStored { pool_id: T::PoolId }, /// Pool metadata was set. @@ -248,7 +246,7 @@ pub mod pallet { /// /// The caller must have the `PoolAdmin` role in order to /// invoke this extrinsic. - #[pallet::weight(T::WeightInfo::update_and_execute(MaxTranches::::get()))] + #[pallet::weight(T::WeightInfo::update(MaxTranches::::get()))] #[pallet::call_index(1)] pub fn update( origin: OriginFor, @@ -279,16 +277,13 @@ pub mod pallet { Self::deposit_event(Event::UpdateRegistered { pool_id }); let weight = match state { - UpdateState::NoExecution => T::WeightInfo::update_no_execution(0), - UpdateState::Executed(num_tranches) => { - Self::deposit_event(Event::UpdateExecuted { pool_id }); - T::WeightInfo::update_and_execute(num_tranches) - } + UpdateState::NoExecution => T::WeightInfo::update(0), UpdateState::Stored(num_tranches) => { Self::deposit_event(Event::UpdateStored { pool_id }); - T::WeightInfo::update_no_execution(num_tranches) + T::WeightInfo::update(num_tranches) } }; + Ok(Some(weight).into()) } diff --git a/pallets/pool-registry/src/weights.rs b/pallets/pool-registry/src/weights.rs index 6342aea163..c19bc20488 100644 --- a/pallets/pool-registry/src/weights.rs +++ b/pallets/pool-registry/src/weights.rs @@ -15,8 +15,7 @@ use frame_support::weights::Weight; pub trait WeightInfo { fn register(n: u32, m: u32) -> Weight; - fn update_no_execution(n: u32) -> Weight; - fn update_and_execute(n: u32) -> Weight; + fn update(n: u32) -> Weight; fn execute_update(n: u32) -> Weight; fn set_metadata() -> Weight; } @@ -26,11 +25,7 @@ impl WeightInfo for () { Weight::zero() } - fn update_no_execution(_n: u32) -> Weight { - Weight::zero() - } - - fn update_and_execute(_n: u32) -> Weight { + fn update(_n: u32) -> Weight { Weight::zero() } diff --git a/pallets/pool-system/src/impls.rs b/pallets/pool-system/src/impls.rs index b90239fbd6..2b391b81ff 100644 --- a/pallets/pool-system/src/impls.rs +++ b/pallets/pool-system/src/impls.rs @@ -272,17 +272,10 @@ impl PoolMutate for Pallet { submitted_at: now, }; - let num_tranches = pool.tranches.num_tranches().try_into().unwrap(); - if T::MinUpdateDelay::get() == 0 && T::UpdateGuard::released(&pool, &update, now) { - Self::do_update_pool(&pool_id, &changes)?; + ScheduledUpdate::::insert(pool_id, update); - Ok(UpdateState::Executed(num_tranches)) - } else { - // If an update was already stored, this will override it - ScheduledUpdate::::insert(pool_id, update); - - Ok(UpdateState::Stored(num_tranches)) - } + let num_tranches = pool.tranches.num_tranches().ensure_into()?; + Ok(UpdateState::Stored(num_tranches)) } fn execute_update(pool_id: T::PoolId) -> Result { diff --git a/runtime/altair/src/weights/pallet_pool_registry.rs b/runtime/altair/src/weights/pallet_pool_registry.rs index 3467d7d6ca..604982c89e 100644 --- a/runtime/altair/src/weights/pallet_pool_registry.rs +++ b/runtime/altair/src/weights/pallet_pool_registry.rs @@ -83,37 +83,6 @@ impl pallet_pool_registry::WeightInfo for WeightInfo /// Proof: `Permissions::Permission` (`max_values`: None, `max_size`: Some(228), added: 2703, mode: `MaxEncodedLen`) /// Storage: `PoolSystem::EpochExecution` (r:1 w:0) /// Proof: `PoolSystem::EpochExecution` (`max_values`: None, `max_size`: Some(754), added: 3229, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::Pool` (r:1 w:0) - /// Proof: `PoolSystem::Pool` (`max_values`: None, `max_size`: Some(813), added: 3288, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Investments::ActiveRedeemOrders` (r:5 w:0) - /// Proof: `Investments::ActiveRedeemOrders` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) - /// Storage: `PoolFees::ActiveFees` (r:1 w:0) - /// Proof: `PoolFees::ActiveFees` (`max_values`: None, `max_size`: Some(14043), added: 16518, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::ScheduledUpdate` (r:0 w:1) - /// Proof: `PoolSystem::ScheduledUpdate` (`max_values`: None, `max_size`: Some(1504), added: 3979, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 5]`. - /// The range of component `m` is `[0, 100]`. - fn update_no_execution(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `924 + m * (124 ±0) + n * (133 ±0)` - // Estimated: `17508 + n * (2531 ±0)` - // Minimum execution time: 58_639_000 picoseconds. - Weight::from_parts(49_321_092, 0) - .saturating_add(Weight::from_parts(0, 17508)) - // Standard Error: 32_924 - .saturating_add(Weight::from_parts(2_803_470, 0).saturating_mul(n.into())) - // Standard Error: 1_502 - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) - } - /// Storage: `Permissions::Permission` (r:1 w:0) - /// Proof: `Permissions::Permission` (`max_values`: None, `max_size`: Some(228), added: 2703, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::EpochExecution` (r:1 w:0) - /// Proof: `PoolSystem::EpochExecution` (`max_values`: None, `max_size`: Some(754), added: 3229, mode: `MaxEncodedLen`) /// Storage: `PoolSystem::Pool` (r:1 w:1) /// Proof: `PoolSystem::Pool` (`max_values`: None, `max_size`: Some(813), added: 3288, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -128,7 +97,7 @@ impl pallet_pool_registry::WeightInfo for WeightInfo /// Proof: `PoolSystem::ScheduledUpdate` (`max_values`: None, `max_size`: Some(1504), added: 3979, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 5]`. /// The range of component `m` is `[0, 100]`. - fn update_and_execute(n: u32) -> Weight { + fn update(n: u32) -> Weight { // Proof Size summary in bytes: // Measured: `927 + m * (124 ±0) + n * (200 ±0)` // Estimated: `17508 + n * (3417 ±0)` diff --git a/runtime/centrifuge/src/weights/pallet_pool_registry.rs b/runtime/centrifuge/src/weights/pallet_pool_registry.rs index 23319bdb19..f84633cedc 100644 --- a/runtime/centrifuge/src/weights/pallet_pool_registry.rs +++ b/runtime/centrifuge/src/weights/pallet_pool_registry.rs @@ -85,37 +85,6 @@ impl pallet_pool_registry::WeightInfo for WeightInfo /// Proof: `Permissions::Permission` (`max_values`: None, `max_size`: Some(228), added: 2703, mode: `MaxEncodedLen`) /// Storage: `PoolSystem::EpochExecution` (r:1 w:0) /// Proof: `PoolSystem::EpochExecution` (`max_values`: None, `max_size`: Some(754), added: 3229, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::Pool` (r:1 w:0) - /// Proof: `PoolSystem::Pool` (`max_values`: None, `max_size`: Some(813), added: 3288, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Investments::ActiveRedeemOrders` (r:5 w:0) - /// Proof: `Investments::ActiveRedeemOrders` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) - /// Storage: `PoolFees::ActiveFees` (r:1 w:0) - /// Proof: `PoolFees::ActiveFees` (`max_values`: None, `max_size`: Some(14043), added: 16518, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::ScheduledUpdate` (r:0 w:1) - /// Proof: `PoolSystem::ScheduledUpdate` (`max_values`: None, `max_size`: Some(1504), added: 3979, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 5]`. - /// The range of component `m` is `[0, 100]`. - fn update_no_execution(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `957 + m * (124 ±0) + n * (133 ±0)` - // Estimated: `17508 + n * (2531 ±0)` - // Minimum execution time: 58_350_000 picoseconds. - Weight::from_parts(49_218_674, 0) - .saturating_add(Weight::from_parts(0, 17508)) - // Standard Error: 39_378 - .saturating_add(Weight::from_parts(2_932_409, 0).saturating_mul(n.into())) - // Standard Error: 1_796 - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) - } - /// Storage: `Permissions::Permission` (r:1 w:0) - /// Proof: `Permissions::Permission` (`max_values`: None, `max_size`: Some(228), added: 2703, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::EpochExecution` (r:1 w:0) - /// Proof: `PoolSystem::EpochExecution` (`max_values`: None, `max_size`: Some(754), added: 3229, mode: `MaxEncodedLen`) /// Storage: `PoolSystem::Pool` (r:1 w:1) /// Proof: `PoolSystem::Pool` (`max_values`: None, `max_size`: Some(813), added: 3288, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -130,7 +99,7 @@ impl pallet_pool_registry::WeightInfo for WeightInfo /// Proof: `PoolSystem::ScheduledUpdate` (`max_values`: None, `max_size`: Some(1504), added: 3979, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 5]`. /// The range of component `m` is `[0, 100]`. - fn update_and_execute(n: u32) -> Weight { + fn update(n: u32) -> Weight { // Proof Size summary in bytes: // Measured: `960 + m * (124 ±0) + n * (200 ±0)` // Estimated: `17508 + n * (3417 ±0)` diff --git a/runtime/development/src/weights/pallet_pool_registry.rs b/runtime/development/src/weights/pallet_pool_registry.rs index 9e300ae2a1..f84633cedc 100644 --- a/runtime/development/src/weights/pallet_pool_registry.rs +++ b/runtime/development/src/weights/pallet_pool_registry.rs @@ -85,36 +85,6 @@ impl pallet_pool_registry::WeightInfo for WeightInfo /// Proof: `Permissions::Permission` (`max_values`: None, `max_size`: Some(228), added: 2703, mode: `MaxEncodedLen`) /// Storage: `PoolSystem::EpochExecution` (r:1 w:0) /// Proof: `PoolSystem::EpochExecution` (`max_values`: None, `max_size`: Some(754), added: 3229, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::Pool` (r:1 w:0) - /// Proof: `PoolSystem::Pool` (`max_values`: None, `max_size`: Some(813), added: 3288, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Investments::ActiveRedeemOrders` (r:5 w:0) - /// Proof: `Investments::ActiveRedeemOrders` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) - /// Storage: `PoolFees::ActiveFees` (r:1 w:0) - /// Proof: `PoolFees::ActiveFees` (`max_values`: None, `max_size`: Some(14043), added: 16518, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::ScheduledUpdate` (r:0 w:1) - /// Proof: `PoolSystem::ScheduledUpdate` (`max_values`: None, `max_size`: Some(1504), added: 3979, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 5]`. - /// The range of component `m` is `[0, 100]`. - fn update_no_execution(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `957 + m * (124 ±0) + n * (133 ±0)` - // Estimated: `17508 + n * (2531 ±0)` - // Minimum execution time: 58_350_000 picoseconds. - Weight::from_parts(49_218_674, 0) - .saturating_add(Weight::from_parts(0, 17508)) - // Standard Error: 39_378 - .saturating_add(Weight::from_parts(2_932_409, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) - } - /// Storage: `Permissions::Permission` (r:1 w:0) - /// Proof: `Permissions::Permission` (`max_values`: None, `max_size`: Some(228), added: 2703, mode: `MaxEncodedLen`) - /// Storage: `PoolSystem::EpochExecution` (r:1 w:0) - /// Proof: `PoolSystem::EpochExecution` (`max_values`: None, `max_size`: Some(754), added: 3229, mode: `MaxEncodedLen`) /// Storage: `PoolSystem::Pool` (r:1 w:1) /// Proof: `PoolSystem::Pool` (`max_values`: None, `max_size`: Some(813), added: 3288, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -129,7 +99,7 @@ impl pallet_pool_registry::WeightInfo for WeightInfo /// Proof: `PoolSystem::ScheduledUpdate` (`max_values`: None, `max_size`: Some(1504), added: 3979, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 5]`. /// The range of component `m` is `[0, 100]`. - fn update_and_execute(n: u32) -> Weight { + fn update(n: u32) -> Weight { // Proof Size summary in bytes: // Measured: `960 + m * (124 ±0) + n * (200 ±0)` // Estimated: `17508 + n * (3417 ±0)`