diff --git a/pallets/kensetsu/benchmarking/src/lib.rs b/pallets/kensetsu/benchmarking/src/lib.rs index 25fc1c2643..3c3a47cbe7 100644 --- a/pallets/kensetsu/benchmarking/src/lib.rs +++ b/pallets/kensetsu/benchmarking/src/lib.rs @@ -214,10 +214,6 @@ benchmarks! { create_cdp { initialize_liquidity_sources::(); set_xor_as_collateral_type::(); - kensetsu::Pallet::::update_hard_cap_total_supply( - RawOrigin::Root.into(), - Balance::MAX, - ).expect("Shall update hard cap"); let collateral = balance!(10); let debt = balance!(1); assets::Pallet::::update_balance( @@ -265,10 +261,6 @@ benchmarks! { borrow { initialize_liquidity_sources::(); set_xor_as_collateral_type::(); - kensetsu::Pallet::::update_hard_cap_total_supply( - RawOrigin::Root.into(), - Balance::MAX, - ).expect("Shall update hard cap"); let cdp_id = create_cdp_with_xor::(); let amount = balance!(10); deposit_xor_collateral::(cdp_id, amount); @@ -289,10 +281,6 @@ benchmarks! { let amount = balance!(10); deposit_xor_collateral::(cdp_id, amount); let debt = balance!(1); - kensetsu::Pallet::::update_hard_cap_total_supply( - RawOrigin::Root.into(), - Balance::MAX, - ).expect("Shall update hard cap"); kensetsu::Pallet::::borrow(RawOrigin::Signed(caller::()).into(), cdp_id, debt, debt) .expect("Shall borrow"); }: { @@ -310,10 +298,6 @@ benchmarks! { let amount = balance!(100); deposit_xor_collateral::(cdp_id, amount); let debt = balance!(50); - kensetsu::Pallet::::update_hard_cap_total_supply( - RawOrigin::Root.into(), - Balance::MAX, - ).expect("Shall update hard cap"); kensetsu::Pallet::::borrow(RawOrigin::Signed(caller::()).into(), cdp_id, debt, debt) .expect("Shall borrow"); make_cdps_unsafe::(); @@ -328,10 +312,6 @@ benchmarks! { let amount = balance!(1000); deposit_xor_collateral::(cdp_id, amount); let debt = balance!(100); - kensetsu::Pallet::::update_hard_cap_total_supply( - RawOrigin::Root.into(), - Balance::MAX, - ).expect("Shall update hard cap"); kensetsu::Pallet::::borrow( RawOrigin::Signed(caller::()).into(), cdp_id, @@ -357,13 +337,6 @@ benchmarks! { ).unwrap(); } - update_hard_cap_total_supply {}: { - kensetsu::Pallet::::update_hard_cap_total_supply( - RawOrigin::Root.into(), - balance!(1000) - ).unwrap(); - } - update_borrow_tax { let new_borrow_tax = Percent::from_percent(1); }:{ diff --git a/pallets/kensetsu/src/lib.rs b/pallets/kensetsu/src/lib.rs index bc7c749577..7d30109726 100644 --- a/pallets/kensetsu/src/lib.rs +++ b/pallets/kensetsu/src/lib.rs @@ -343,12 +343,6 @@ pub mod pallet { pub type CollateralInfos = StorageMap<_, Identity, AssetIdOf, CollateralInfo>; - /// Risk parameter - /// Hard cap of KUSD may be minted by the system - #[pallet::storage] - #[pallet::getter(fn max_supply)] - pub type KusdHardCap = StorageValue<_, Balance, ValueQuery>; - /// Risk parameter /// Borrows tax to buy back and burn KEN #[pallet::storage] @@ -429,11 +423,6 @@ pub mod pallet { collateral_asset_id: AssetIdOf, risk_parameters: CollateralRiskParameters, }, - DebtTokenHardCapUpdated { - debt_asset_id: AssetIdOf, - new_hard_cap: Balance, - old_hard_cap: Balance, - }, BorrowTaxUpdated { old_borrow_tax: Percent, new_borrow_tax: Percent, @@ -686,36 +675,13 @@ pub mod pallet { Ok(()) } - /// Updates the hard cap for the total supply of a stablecoin. - /// - /// ## Parameters - /// - /// - `origin`: The origin of the transaction. - /// - `new_hard_cap`: The new hard cap value to be set for the total supply. - #[pallet::call_index(8)] - #[pallet::weight(::WeightInfo::update_hard_cap_total_supply())] - pub fn update_hard_cap_total_supply( - origin: OriginFor, - new_hard_cap: Balance, - ) -> DispatchResult { - ensure_root(origin)?; - let old_hard_cap = KusdHardCap::::get(); - KusdHardCap::::set(new_hard_cap); - Self::deposit_event(Event::DebtTokenHardCapUpdated { - debt_asset_id: T::KusdAssetId::get(), - new_hard_cap, - old_hard_cap, - }); - Ok(()) - } - /// Updates the borrow tax applied during borrow. /// /// ## Parameters /// /// - `origin`: The origin of the transaction. /// - `new_borrow_tax`: The new borrow tax percentage to be set. - #[pallet::call_index(9)] + #[pallet::call_index(8)] #[pallet::weight(::WeightInfo::update_borrow_tax())] pub fn update_borrow_tax(origin: OriginFor, new_borrow_tax: Percent) -> DispatchResult { ensure_root(origin)?; @@ -735,7 +701,7 @@ pub mod pallet { /// /// - `origin`: The origin of the transaction. /// - `new_liquidation_penalty`: The new liquidation penalty percentage to be set. - #[pallet::call_index(10)] + #[pallet::call_index(9)] #[pallet::weight(::WeightInfo::update_liquidation_penalty())] pub fn update_liquidation_penalty( origin: OriginFor, @@ -759,7 +725,7 @@ pub mod pallet { /// - `origin`: The origin of the transaction. /// - `beneficiary` : The destination account where assets will be withdrawn. /// - `kusd_amount`: The amount of stablecoin (KUSD) to withdraw as protocol profit. - #[pallet::call_index(11)] + #[pallet::call_index(10)] #[pallet::weight(::WeightInfo::withdraw_profit())] pub fn withdraw_profit( origin: OriginFor, @@ -787,7 +753,7 @@ pub mod pallet { /// /// - `origin`: The origin of the transaction. /// - `kusd_amount`: The amount of stablecoin (KUSD) to donate to cover bad debt. - #[pallet::call_index(12)] + #[pallet::call_index(11)] #[pallet::weight(::WeightInfo::donate())] pub fn donate(origin: OriginFor, kusd_amount: Balance) -> DispatchResult { let who = ensure_signed(origin)?; @@ -935,19 +901,6 @@ pub mod pallet { Ok(()) } - /// Ensures that new emission will not exceed system KUSD hard cap - fn ensure_protocol_cap(new_emission: Balance) -> DispatchResult { - let current_supply = T::AssetInfoProvider::total_issuance(&T::KusdAssetId::get())?; - ensure!( - current_supply - .checked_add(new_emission) - .ok_or(Error::::ArithmeticError)? - <= Self::max_supply(), - Error::::HardCapSupply - ); - Ok(()) - } - /// Deposits collateral to CDP. /// Handles internal deposit of collateral into a Collateralized Debt Position (CDP). /// @@ -1048,7 +1001,6 @@ pub mod pallet { Self::incentivize_ken_token(borrow_tax)?; Self::ensure_collateral_cap(cdp.collateral_asset_id, borrow_amount_with_tax)?; - Self::ensure_protocol_cap(borrow_amount_with_tax)?; Self::mint_to(who, borrow_amount)?; Self::increase_cdp_debt(cdp_id, borrow_amount_with_tax)?; Self::deposit_event(Event::DebtIncreased { diff --git a/pallets/kensetsu/src/migrations.rs b/pallets/kensetsu/src/migrations.rs index a31633f0c3..888f09567e 100644 --- a/pallets/kensetsu/src/migrations.rs +++ b/pallets/kensetsu/src/migrations.rs @@ -98,122 +98,30 @@ pub mod init { } } -/// Due to bug in stability fee update some extra KUSD were minted, this migration burns and sets -/// correct amounts. -pub mod stage_correction { - use crate::{BadDebt, CDPDepository, CollateralInfos, Config, Error}; - use common::AssetInfoProvider; - use common::Balance; +/// Removes hard_cap. This migration for stage only, will not change storage version. +pub mod remove_hard_cap { + use crate::Config; use core::marker::PhantomData; use frame_support::dispatch::Weight; - use frame_support::log::error; use frame_support::traits::OnRuntimeUpgrade; - use sp_arithmetic::traits::Zero; use sp_core::Get; - use sp_runtime::DispatchResult; - - pub struct CorrectKusdBalances(PhantomData); - - impl CorrectKusdBalances { - fn runtime_upgrade_internal(weight: &mut Weight) -> DispatchResult { - let mut total_debt = Balance::zero(); - - for asset_id in CollateralInfos::::iter_keys() { - let accumulated_debt_for_collateral = CDPDepository::::iter() - .filter(|(_, cdp)| { - *weight += ::DbWeight::get().reads(1); - cdp.collateral_asset_id == asset_id - }) - .fold( - Balance::zero(), - |accumulated_debt_for_collateral, (_, cdp)| { - accumulated_debt_for_collateral + cdp.debt - }, - ); - - CollateralInfos::::try_mutate(asset_id, |collateral_info| { - let collateral_info = - collateral_info.as_mut().ok_or(Error::::CDPNotFound)?; - collateral_info.kusd_supply = accumulated_debt_for_collateral; - DispatchResult::Ok(()) - })?; - *weight += ::DbWeight::get().writes(1); - - total_debt += accumulated_debt_for_collateral; - } - - let bad_debt = BadDebt::::get(); - total_debt += bad_debt; - - // kusd supply must be equal to aggregated debt: - // kusd_supply == sum(cdp.debt) + bad_debt - let kusd_supply = T::AssetInfoProvider::total_issuance(&T::KusdAssetId::get())?; - *weight += ::DbWeight::get().reads(1); - - let (surplus, shortage) = if kusd_supply > total_debt { - (kusd_supply - total_debt, 0) - } else { - (0, total_debt - kusd_supply) - }; - - let treasury_account_id = technical::Pallet::::tech_account_id_to_account_id( - &T::TreasuryTechAccount::get(), - )?; - let profit = - T::AssetInfoProvider::free_balance(&T::KusdAssetId::get(), &treasury_account_id)?; - *weight += ::DbWeight::get().reads(1); - // burn KUSD surplus on tech acc profit or add to bad debt - if surplus > 0 { - let (to_burn, to_bad_debt) = if profit > surplus { - (surplus, 0) - } else { - (profit, surplus - profit) - }; - assets::Pallet::::burn_from( - &T::KusdAssetId::get(), - &treasury_account_id, - &treasury_account_id, - to_burn, - )?; + mod old { + use crate::{Config, Pallet}; + use common::Balance; + use frame_support::pallet_prelude::ValueQuery; - BadDebt::::set(bad_debt + to_bad_debt); - - *weight += ::DbWeight::get().writes(2); - } - - // mint KUSD shortage to tech acc or cover bad debt - if shortage > 0 { - let (from_bad_debt, to_mint) = if bad_debt > shortage { - (shortage, 0) - } else { - (bad_debt, shortage - bad_debt) - }; - - technical::Pallet::::mint( - &T::KusdAssetId::get(), - &T::TreasuryTechAccount::get(), - to_mint, - )?; - - BadDebt::::set(bad_debt - from_bad_debt); - - *weight += ::DbWeight::get().writes(2); - } - - Ok(()) - } + /// value to remove + #[frame_support::storage_alias] + pub type KusdHardCap = StorageValue, Balance, ValueQuery>; } - impl OnRuntimeUpgrade - for CorrectKusdBalances - { + pub struct RemoveHardCap(PhantomData); + + impl OnRuntimeUpgrade for RemoveHardCap { fn on_runtime_upgrade() -> Weight { - let mut weight = Weight::zero(); - Self::runtime_upgrade_internal(&mut weight).unwrap_or_else(|err| { - error!("Runtime upgrade error {:?}", err); - }); - weight + old::KusdHardCap::::kill(); + ::DbWeight::get().writes(1) } } } diff --git a/pallets/kensetsu/src/test_utils.rs b/pallets/kensetsu/src/test_utils.rs index 7987ce24bc..ac7b2eaeba 100644 --- a/pallets/kensetsu/src/test_utils.rs +++ b/pallets/kensetsu/src/test_utils.rs @@ -108,7 +108,6 @@ pub fn set_xor_as_collateral_type( minimal_collateral_deposit, } )); - KusdHardCap::::set(hard_cap); } /// Makes CDPs unsafe by changing liquidation ratio. diff --git a/pallets/kensetsu/src/tests.rs b/pallets/kensetsu/src/tests.rs index 3ad5b5deeb..b1e0b5c016 100644 --- a/pallets/kensetsu/src/tests.rs +++ b/pallets/kensetsu/src/tests.rs @@ -601,30 +601,6 @@ fn test_borrow_cdp_type_hard_cap() { }); } -/// CDP with collateral exists, hard cap is set in protocol risk parameters. -/// Borrow results with an error `HardCapSupply` -#[test] -fn test_borrow_protocol_hard_cap() { - new_test_ext().execute_with(|| { - set_xor_as_collateral_type( - Balance::MAX, - Perbill::from_percent(50), - FixedU128::from_float(0.0), - balance!(0), - ); - assert_ok!(KensetsuPallet::update_hard_cap_total_supply( - RuntimeOrigin::root(), - balance!(10) - )); - let cdp_id = create_cdp_for_xor(alice(), balance!(100), balance!(0)); - - assert_noop!( - KensetsuPallet::borrow(alice(), cdp_id, balance!(20), balance!(20)), - KensetsuError::HardCapSupply - ); - }); -} - /// Test borrow call with wrong parameters: min_borrow_amount > max_borrow_amount #[test] fn test_borrow_wrong_parameters() { @@ -1592,7 +1568,6 @@ fn test_liquidate_kusd_bad_debt() { #[test] fn test_liquidate_zero_lot() { new_test_ext().execute_with(|| { - KusdHardCap::::set(Balance::MAX); let new_parameters = CollateralRiskParameters { hard_cap: Balance::MAX, liquidation_ratio: Perbill::from_percent(100), @@ -1995,45 +1970,6 @@ fn test_update_collateral_risk_parameters_no_rate_change() { }); } -/// Only root can update hard cap -#[test] -fn test_update_hard_cap_only_root() { - new_test_ext().execute_with(|| { - assert_noop!( - KensetsuPallet::update_hard_cap_total_supply(RuntimeOrigin::none(), balance!(0)), - BadOrigin - ); - assert_noop!( - KensetsuPallet::update_hard_cap_total_supply(alice(), balance!(0)), - BadOrigin - ); - }); -} - -/// Root can update hard cap -#[test] -fn test_update_hard_cap_sunny_day() { - new_test_ext().execute_with(|| { - let new_hard_cap = balance!(100); - - assert_ok!(KensetsuPallet::update_hard_cap_total_supply( - RuntimeOrigin::root(), - new_hard_cap - )); - - let old_hard_cap = balance!(0); - System::assert_has_event( - Event::DebtTokenHardCapUpdated { - debt_asset_id: KUSD, - new_hard_cap, - old_hard_cap, - } - .into(), - ); - assert_eq!(new_hard_cap, KusdHardCap::::get()); - }); -} - /// Only root can update borrow tax #[test] fn test_update_borrow_tax_only_root() { diff --git a/pallets/kensetsu/src/weights.rs b/pallets/kensetsu/src/weights.rs index f2541efcd3..9870cc554f 100644 --- a/pallets/kensetsu/src/weights.rs +++ b/pallets/kensetsu/src/weights.rs @@ -31,7 +31,7 @@ //! Autogenerated weights for kensetsu //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-05-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-05-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `MacBook-Pro-Alexey.local`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 @@ -73,7 +73,6 @@ pub trait WeightInfo { fn liquidate() -> Weight; fn accrue() -> Weight; fn update_collateral_risk_parameters() -> Weight; - fn update_hard_cap_total_supply() -> Weight; fn update_borrow_tax() -> Weight; fn update_liquidation_penalty() -> Weight; fn withdraw_profit() -> Weight; @@ -105,21 +104,19 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: PriceTools PriceInfos (max_values: None, max_size: None, mode: Measured) /// Storage: Kensetsu BorrowTax (r:1 w:0) /// Proof: Kensetsu BorrowTax (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: Tokens TotalIssuance (r:1 w:1) - /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) - /// Storage: Kensetsu KusdHardCap (r:1 w:0) - /// Proof: Kensetsu KusdHardCap (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(136), added: 2611, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) /// Storage: Kensetsu CDPDepository (r:0 w:1) /// Proof: Kensetsu CDPDepository (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn create_cdp() -> Weight { // Proof Size summary in bytes: - // Measured: `5759` - // Estimated: `213431` - // Minimum execution time: 123_000_000 picoseconds. - Weight::from_parts(131_000_000, 213431) - .saturating_add(T::DbWeight::get().reads(16_u64)) + // Measured: `5723` + // Estimated: `212776` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(118_000_000, 212776) + .saturating_add(T::DbWeight::get().reads(15_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } /// Storage: Kensetsu CDPDepository (r:1 w:1) @@ -142,8 +139,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2269` // Estimated: `185464` - // Minimum execution time: 75_000_000 picoseconds. - Weight::from_parts(77_000_000, 185464) + // Minimum execution time: 70_000_000 picoseconds. + Weight::from_parts(72_000_000, 185464) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -159,8 +156,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1669` // Estimated: `14584` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(49_000_000, 14584) + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(45_000_000, 14584) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -182,19 +179,17 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: PriceTools PriceInfos (max_values: None, max_size: None, mode: Measured) /// Storage: Kensetsu BorrowTax (r:1 w:0) /// Proof: Kensetsu BorrowTax (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: Tokens TotalIssuance (r:1 w:1) - /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) - /// Storage: Kensetsu KusdHardCap (r:1 w:0) - /// Proof: Kensetsu KusdHardCap (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(136), added: 2611, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) fn borrow() -> Weight { // Proof Size summary in bytes: - // Measured: `5569` - // Estimated: `47048` - // Minimum execution time: 85_000_000 picoseconds. - Weight::from_parts(92_000_000, 47048) - .saturating_add(T::DbWeight::get().reads(13_u64)) + // Measured: `5533` + // Estimated: `46393` + // Minimum execution time: 78_000_000 picoseconds. + Weight::from_parts(79_000_000, 46393) + .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Kensetsu CDPDepository (r:1 w:1) @@ -217,10 +212,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) fn repay_debt() -> Weight { // Proof Size summary in bytes: - // Measured: `3159` - // Estimated: `30767` - // Minimum execution time: 71_000_000 picoseconds. - Weight::from_parts(76_000_000, 30767) + // Measured: `3126` + // Estimated: `30668` + // Minimum execution time: 67_000_000 picoseconds. + Weight::from_parts(68_000_000, 30668) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -270,10 +265,10 @@ impl WeightInfo for SubstrateWeight { /// Proof Skipped: PoolXYK Reserves (max_values: None, max_size: None, mode: Measured) fn liquidate() -> Weight { // Proof Size summary in bytes: - // Measured: `8040` - // Estimated: `155655` - // Minimum execution time: 294_000_000 picoseconds. - Weight::from_parts(318_000_000, 155655) + // Measured: `8007` + // Estimated: `155259` + // Minimum execution time: 278_000_000 picoseconds. + Weight::from_parts(282_000_000, 155259) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) } @@ -299,10 +294,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn accrue() -> Weight { // Proof Size summary in bytes: - // Measured: `3168` - // Estimated: `33397` - // Minimum execution time: 70_000_000 picoseconds. - Weight::from_parts(75_000_000, 33397) + // Measured: `3135` + // Estimated: `33298` + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(67_000_000, 33298) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -316,22 +311,11 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `776` // Estimated: `6385` - // Minimum execution time: 16_000_000 picoseconds. + // Minimum execution time: 15_000_000 picoseconds. Weight::from_parts(16_000_000, 6385) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: Kensetsu KusdHardCap (r:1 w:1) - /// Proof: Kensetsu KusdHardCap (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - fn update_hard_cap_total_supply() -> Weight { - // Proof Size summary in bytes: - // Measured: `147` - // Estimated: `511` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(8_000_000, 511) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } /// Storage: Kensetsu BorrowTax (r:1 w:1) /// Proof: Kensetsu BorrowTax (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) fn update_borrow_tax() -> Weight { @@ -364,8 +348,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1361` // Estimated: `14264` - // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(44_000_000, 14264) + // Minimum execution time: 41_000_000 picoseconds. + Weight::from_parts(42_000_000, 14264) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -383,8 +367,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1929` // Estimated: `17874` - // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(61_000_000, 17874) + // Minimum execution time: 56_000_000 picoseconds. + Weight::from_parts(57_000_000, 17874) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -414,21 +398,19 @@ impl WeightInfo for () { /// Proof Skipped: PriceTools PriceInfos (max_values: None, max_size: None, mode: Measured) /// Storage: Kensetsu BorrowTax (r:1 w:0) /// Proof: Kensetsu BorrowTax (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: Tokens TotalIssuance (r:1 w:1) - /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) - /// Storage: Kensetsu KusdHardCap (r:1 w:0) - /// Proof: Kensetsu KusdHardCap (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(136), added: 2611, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) /// Storage: Kensetsu CDPDepository (r:0 w:1) /// Proof: Kensetsu CDPDepository (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn create_cdp() -> Weight { // Proof Size summary in bytes: - // Measured: `5759` - // Estimated: `213431` - // Minimum execution time: 123_000_000 picoseconds. - Weight::from_parts(131_000_000, 213431) - .saturating_add(RocksDbWeight::get().reads(16_u64)) + // Measured: `5723` + // Estimated: `212776` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(118_000_000, 212776) + .saturating_add(RocksDbWeight::get().reads(15_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// Storage: Kensetsu CDPDepository (r:1 w:1) @@ -451,8 +433,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2269` // Estimated: `185464` - // Minimum execution time: 75_000_000 picoseconds. - Weight::from_parts(77_000_000, 185464) + // Minimum execution time: 70_000_000 picoseconds. + Weight::from_parts(72_000_000, 185464) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -468,8 +450,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1669` // Estimated: `14584` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(49_000_000, 14584) + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(45_000_000, 14584) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -491,19 +473,17 @@ impl WeightInfo for () { /// Proof Skipped: PriceTools PriceInfos (max_values: None, max_size: None, mode: Measured) /// Storage: Kensetsu BorrowTax (r:1 w:0) /// Proof: Kensetsu BorrowTax (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: Tokens TotalIssuance (r:1 w:1) - /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) - /// Storage: Kensetsu KusdHardCap (r:1 w:0) - /// Proof: Kensetsu KusdHardCap (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: Tokens Accounts (r:1 w:1) /// Proof: Tokens Accounts (max_values: None, max_size: Some(136), added: 2611, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) fn borrow() -> Weight { // Proof Size summary in bytes: - // Measured: `5569` - // Estimated: `47048` - // Minimum execution time: 85_000_000 picoseconds. - Weight::from_parts(92_000_000, 47048) - .saturating_add(RocksDbWeight::get().reads(13_u64)) + // Measured: `5533` + // Estimated: `46393` + // Minimum execution time: 78_000_000 picoseconds. + Weight::from_parts(79_000_000, 46393) + .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Kensetsu CDPDepository (r:1 w:1) @@ -526,10 +506,10 @@ impl WeightInfo for () { /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) fn repay_debt() -> Weight { // Proof Size summary in bytes: - // Measured: `3159` - // Estimated: `30767` - // Minimum execution time: 71_000_000 picoseconds. - Weight::from_parts(76_000_000, 30767) + // Measured: `3126` + // Estimated: `30668` + // Minimum execution time: 67_000_000 picoseconds. + Weight::from_parts(68_000_000, 30668) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -579,10 +559,10 @@ impl WeightInfo for () { /// Proof Skipped: PoolXYK Reserves (max_values: None, max_size: None, mode: Measured) fn liquidate() -> Weight { // Proof Size summary in bytes: - // Measured: `8040` - // Estimated: `155655` - // Minimum execution time: 294_000_000 picoseconds. - Weight::from_parts(318_000_000, 155655) + // Measured: `8007` + // Estimated: `155259` + // Minimum execution time: 278_000_000 picoseconds. + Weight::from_parts(282_000_000, 155259) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) } @@ -608,10 +588,10 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn accrue() -> Weight { // Proof Size summary in bytes: - // Measured: `3168` - // Estimated: `33397` - // Minimum execution time: 70_000_000 picoseconds. - Weight::from_parts(75_000_000, 33397) + // Measured: `3135` + // Estimated: `33298` + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(67_000_000, 33298) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -625,22 +605,11 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `776` // Estimated: `6385` - // Minimum execution time: 16_000_000 picoseconds. + // Minimum execution time: 15_000_000 picoseconds. Weight::from_parts(16_000_000, 6385) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: Kensetsu KusdHardCap (r:1 w:1) - /// Proof: Kensetsu KusdHardCap (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - fn update_hard_cap_total_supply() -> Weight { - // Proof Size summary in bytes: - // Measured: `147` - // Estimated: `511` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(8_000_000, 511) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } /// Storage: Kensetsu BorrowTax (r:1 w:1) /// Proof: Kensetsu BorrowTax (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) fn update_borrow_tax() -> Weight { @@ -673,8 +642,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1361` // Estimated: `14264` - // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(44_000_000, 14264) + // Minimum execution time: 41_000_000 picoseconds. + Weight::from_parts(42_000_000, 14264) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -692,8 +661,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1929` // Estimated: `17874` - // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(61_000_000, 17874) + // Minimum execution time: 56_000_000 picoseconds. + Weight::from_parts(57_000_000, 17874) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 1d7827334d..5c2a39c013 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -256,10 +256,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("sora-substrate"), impl_name: create_runtime_str!("sora-substrate"), authoring_version: 1, - spec_version: 82, + spec_version: 83, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 82, + transaction_version: 83, state_version: 0, }; diff --git a/runtime/src/migrations.rs b/runtime/src/migrations.rs index a73b1d5693..67133de406 100644 --- a/runtime/src/migrations.rs +++ b/runtime/src/migrations.rs @@ -35,4 +35,4 @@ use crate::*; pub type Migrations = (); #[cfg(feature = "ready-to-test")] // kensetsu -pub type Migrations = (kensetsu::migrations::stage_correction::CorrectKusdBalances,); +pub type Migrations = (kensetsu::migrations::remove_hard_cap::RemoveHardCap,);