From 0d773352e9198f6c766fb1aa4ba0c1cfd178a8d1 Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Thu, 24 Oct 2024 15:29:16 +0300 Subject: [PATCH 1/3] prepare release 4.3.0 --- Cargo.lock | 6 +- node/Cargo.toml | 2 +- node/chain_spec/Cargo.toml | 2 +- pallets/vested-rewards/src/benchmarking.rs | 90 +------------ pallets/vested-rewards/src/lib.rs | 143 ++++++++------------- pallets/vested-rewards/src/mock.rs | 1 - pallets/vested-rewards/src/tests.rs | 43 ++----- runtime/Cargo.toml | 2 +- runtime/src/lib.rs | 4 +- runtime/src/tests/xor_fee.rs | 8 +- runtime/src/xor_fee_impls.rs | 53 +------- 11 files changed, 85 insertions(+), 269 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33f406eea5..aff410c203 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3559,7 +3559,7 @@ dependencies = [ [[package]] name = "framenode" -version = "4.2.0" +version = "4.3.0" dependencies = [ "ahash 0.8.5", "assert_cmd", @@ -3643,7 +3643,7 @@ dependencies = [ [[package]] name = "framenode-chain-spec" -version = "4.2.0" +version = "4.3.0" dependencies = [ "common", "faucet", @@ -3669,7 +3669,7 @@ dependencies = [ [[package]] name = "framenode-runtime" -version = "4.2.0" +version = "4.3.0" dependencies = [ "apollo-platform", "assets", diff --git a/node/Cargo.toml b/node/Cargo.toml index c14a728aa8..a98196ea64 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framenode" -version = "4.2.0" +version = "4.3.0" authors = ["Parity Technologies "] build = "build.rs" edition = "2021" diff --git a/node/chain_spec/Cargo.toml b/node/chain_spec/Cargo.toml index 71d3d79303..e6011fda11 100644 --- a/node/chain_spec/Cargo.toml +++ b/node/chain_spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framenode-chain-spec" -version = "4.2.0" +version = "4.3.0" authors = ["Parity Technologies "] edition = "2021" diff --git a/pallets/vested-rewards/src/benchmarking.rs b/pallets/vested-rewards/src/benchmarking.rs index 0e973d6554..eba0b2f879 100644 --- a/pallets/vested-rewards/src/benchmarking.rs +++ b/pallets/vested-rewards/src/benchmarking.rs @@ -36,7 +36,7 @@ use super::*; use codec::Decode; use frame_benchmarking::benchmarks; use frame_support::assert_ok; -#[cfg(feature = "wip")] // ORML multi asset vesting + use frame_system::EventRecord; use frame_system::RawOrigin; use hex_literal::hex; @@ -46,7 +46,6 @@ use traits::MultiCurrency; use common::{AssetManager, AssetName, AssetSymbol, CrowdloanTag, FromGenericPair, PSWAP, XOR}; -#[cfg(feature = "wip")] // ORML multi asset vesting use crate::vesting_currencies::{LinearPendingVestingSchedule, LinearVestingSchedule}; use crate::Pallet as VestedRewards; use technical::Pallet as Technical; @@ -56,7 +55,7 @@ fn alice() -> T::AccountId { let bytes = hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"); T::AccountId::decode(&mut &bytes[..]).expect("Failed to decode account ID") } -#[cfg(feature = "wip")] // ORML multi asset vesting + fn bob() -> T::AccountId { let bytes = hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27c"); T::AccountId::decode(&mut &bytes[..]).expect("Failed to decode account ID") @@ -121,11 +120,11 @@ fn prepare_rewards_update( } rewards } -#[cfg(feature = "wip")] // ORML multi asset vesting + fn assert_last_event(generic_event: ::RuntimeEvent) { frame_system::Pallet::::assert_last_event(generic_event.into()); } -#[cfg(feature = "wip")] // ORML multi asset vesting + benchmarks! { claim_rewards { let caller = alice::(); @@ -343,84 +342,3 @@ benchmarks! { impl_benchmark_test_suite!(Pallet, mock::ExtBuilder::default().build(), mock::Runtime) } - -#[cfg(not(feature = "wip"))] // ORML multi asset vesting -benchmarks! { - claim_rewards { - let caller = alice::(); - - ::MultiCurrency::deposit(PSWAP.into(), &T::GetBondingCurveRewardsAccountId::get(), balance!(100)).unwrap(); - ::MultiCurrency::deposit(PSWAP.into(), &T::GetMarketMakerRewardsAccountId::get(), balance!(200)).unwrap(); - ::MultiCurrency::deposit(XOR.into(), &caller, balance!(1)).unwrap(); // to prevent inc ref error - - VestedRewards::::add_tbc_reward(&caller, balance!(100)).expect("Failed to add reward."); - VestedRewards::::distribute_limits(balance!(100)); - }: _( - RawOrigin::Signed(caller.clone()) - ) - verify { - assert_eq!( - ::MultiCurrency::free_balance(PSWAP.into(), &caller), - balance!(100) - ); - } - - update_rewards { - let n in 0 .. 100; - let rewards = prepare_rewards_update::(n.into()); - }: { - Pallet::::update_rewards(RawOrigin::Root.into(), rewards).unwrap() - } - verify { - assert_eq!( - TotalRewards::::get(), - balance!(n) * 2 - ); - } - - register_crowdloan { - let m in 1 .. 1000; - ::MultiCurrency::deposit(XOR.into(), &alice::(), balance!(1)).unwrap(); // to prevent inc ref error - let tag = CrowdloanTag(b"crowdloan".to_vec().try_into().unwrap()); - let rewards = prepare_crowdloan_rewards::(10); - let contributions = prepare_crowdloan_contributions::(m as u128); - }: _(RawOrigin::Root, tag.clone(), 0u32.into(), 100u32.into(), rewards, contributions) - verify { - assert!(crate::CrowdloanInfos::::contains_key(&tag)); - } - - claim_crowdloan_rewards { - ::MultiCurrency::deposit(XOR.into(), &alice::(), balance!(1)).unwrap(); // to prevent inc ref error - let tag = CrowdloanTag(b"crowdloan".to_vec().try_into().unwrap()); - let rewards = prepare_crowdloan_rewards::(5); - let contributions = prepare_crowdloan_contributions::(100); - let account = contributions.get(0).cloned().unwrap().0; - let first_asset_id = rewards.get(0).cloned().unwrap().0; - Pallet::::register_crowdloan(RawOrigin::Root.into(), tag.clone(), 0u32.into(), T::BLOCKS_PER_DAY * 4u32.into(), rewards.clone(), contributions).unwrap(); - let info = crate::CrowdloanInfos::::get(&tag).unwrap(); - for (asset_id, _) in rewards { - ::MultiCurrency::deposit(asset_id.clone(), &info.account, balance!(1000)).unwrap(); - } - frame_system::Pallet::::set_block_number(T::BLOCKS_PER_DAY); - }: _(RawOrigin::Signed(account.clone()), tag.clone()) - verify { - assert_eq!( - ::MultiCurrency::free_balance(first_asset_id, &account), - balance!(0.025) // 10 / 100 / 4 - ); - } - - claim_unlocked {}: {} - verify {} - - vested_transfer {}: {} - verify {} - - update_vesting_schedules {}: {} - verify {} - - unlock_pending_schedule_by_manager {}: {} - verify {} - - impl_benchmark_test_suite!(Pallet, mock::ExtBuilder::default().build(), mock::Runtime) -} diff --git a/pallets/vested-rewards/src/lib.rs b/pallets/vested-rewards/src/lib.rs index feb869d893..e65d34cab9 100644 --- a/pallets/vested-rewards/src/lib.rs +++ b/pallets/vested-rewards/src/lib.rs @@ -134,7 +134,6 @@ pub struct Claim { pub use weights::WeightInfo; impl Pallet { - #[cfg(feature = "wip")] // ORML multi asset vesting fn do_claim_unlocked( asset_id: AssetIdOf, who: &T::AccountId, @@ -148,7 +147,6 @@ impl Pallet { Ok(locked) } - #[cfg(feature = "wip")] // ORML multi asset vesting /// Returns locked balance based on current block number. fn locked_balance( asset_id: AssetIdOf, @@ -189,7 +187,6 @@ impl Pallet { }) } - #[cfg(feature = "wip")] // ORML multi asset vesting fn do_vested_transfer( from: &T::AccountId, to: &T::AccountId, @@ -221,7 +218,6 @@ impl Pallet { Ok(()) } - #[cfg(feature = "wip")] // ORML multi asset vesting fn do_update_vesting_schedules( who: &T::AccountId, new_schedules: BoundedVec, T::MaxVestingSchedules>, @@ -282,7 +278,6 @@ impl Pallet { Ok(()) } - #[cfg(feature = "wip")] // Pending Vesting fn do_unlock_pending_schedule_by_manager( manager: T::AccountId, dest: T::AccountId, @@ -330,39 +325,34 @@ impl Pallet { } } - #[allow(unused)] fn set_auto_claim_block( who: AccountIdOf, schedule: &VestingScheduleOf, ) -> DispatchResult { - #[cfg(feature = "wip")] // Auto Vesting + let claim_asset_for_account = Claim::, AccountIdOf> { + account_id: who.clone(), + asset_id: schedule.asset_id(), + }; + + if let Some(block_number) = + schedule.next_claim_block::(frame_system::Pallet::::current_block_number())? { - let claim_asset_for_account = Claim::, AccountIdOf> { - account_id: who.clone(), - asset_id: schedule.asset_id(), - }; - - if let Some(block_number) = - schedule.next_claim_block::(frame_system::Pallet::::current_block_number())? - { - if !>::get(block_number).contains(&claim_asset_for_account) { - >::append(block_number, claim_asset_for_account.clone()) - } - } else { - if let Ok(vesting_schedules) = >::try_get(who) { - if schedule.end().is_some() - && vesting_schedules.contains(schedule) - && !>::get().contains(&claim_asset_for_account) - { - >::append(claim_asset_for_account) - } + if !>::get(block_number).contains(&claim_asset_for_account) { + >::append(block_number, claim_asset_for_account.clone()) + } + } else { + if let Ok(vesting_schedules) = >::try_get(who) { + if schedule.end().is_some() + && vesting_schedules.contains(schedule) + && !>::get().contains(&claim_asset_for_account) + { + >::append(claim_asset_for_account) } } } Ok(()) } - #[cfg(feature = "wip")] // Auto Vesting fn do_auto_claim(claim: &ClaimOf) { match Self::do_claim_unlocked(claim.asset_id, &claim.account_id) { Ok(locked_amount) => { @@ -378,7 +368,6 @@ impl Pallet { } } - #[cfg(feature = "wip")] // Auto Vesting fn claim_for_vec( claim_for: Vec>, max_claims: usize, @@ -399,7 +388,6 @@ impl Pallet { } } - #[cfg(feature = "wip")] // Auto Vesting /// Auto claim unlocked tokens from VestingSchedules fn auto_claim(current_block: BlockNumberFor, claim_weight: Weight) -> Weight { let mut weight: Weight = T::DbWeight::get().reads(3); @@ -871,7 +859,6 @@ pub mod pallet { AccountIdOf, >; - #[cfg(feature = "wip")] // Auto Vesting pub(crate) type ClaimOf = Claim, AccountIdOf>; #[pallet::config] @@ -1002,7 +989,6 @@ pub mod pallet { Ok(().into()) } - #[allow(unused_variables)] #[pallet::call_index(4)] #[pallet::weight(::WeightInfo::claim_unlocked())] pub fn claim_unlocked( @@ -1010,20 +996,16 @@ pub mod pallet { asset_id: AssetIdOf, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - #[cfg(feature = "wip")] // ORML multi asset vesting - { - let locked_amount = Self::do_claim_unlocked(asset_id, &who)?; + let locked_amount = Self::do_claim_unlocked(asset_id, &who)?; - Self::deposit_event(Event::ClaimedVesting { - who, - asset_id, - locked_amount, - }); - } + Self::deposit_event(Event::ClaimedVesting { + who, + asset_id, + locked_amount, + }); Ok(().into()) } - #[allow(unused_variables)] #[pallet::call_index(5)] #[pallet::weight(::WeightInfo::vested_transfer())] pub fn vested_transfer( @@ -1032,31 +1014,27 @@ pub mod pallet { schedule: VestingScheduleOf, ) -> DispatchResultWithPostInfo { let from = ensure_signed(origin)?; - #[cfg(feature = "wip")] // ORML multi asset vesting - { - let to = T::Lookup::lookup(dest)?; - - if to == from { - ensure!( - T::Currency::free_balance(schedule.asset_id(), &from) - >= VestingScheduleVariant::total_amount(&schedule) - .ok_or(Error::::ArithmeticError)?, - Error::::InsufficientBalanceToLock, - ); - } + let to = T::Lookup::lookup(dest)?; + + if to == from { + ensure!( + T::Currency::free_balance(schedule.asset_id(), &from) + >= VestingScheduleVariant::total_amount(&schedule) + .ok_or(Error::::ArithmeticError)?, + Error::::InsufficientBalanceToLock, + ); + } - Self::do_vested_transfer(&from, &to, schedule.clone())?; + Self::do_vested_transfer(&from, &to, schedule.clone())?; - Self::deposit_event(Event::VestingScheduleAdded { - from, - to, - vesting_schedule: schedule, - }); - } + Self::deposit_event(Event::VestingScheduleAdded { + from, + to, + vesting_schedule: schedule, + }); Ok(().into()) } - #[allow(unused_variables)] #[pallet::call_index(6)] #[pallet::weight(::WeightInfo::update_vesting_schedules())] pub fn update_vesting_schedules( @@ -1065,17 +1043,14 @@ pub mod pallet { vesting_schedules: BoundedVec, T::MaxVestingSchedules>, ) -> DispatchResultWithPostInfo { ensure_root(origin)?; - #[cfg(feature = "wip")] // ORML multi asset vesting - { - let account = T::Lookup::lookup(who)?; - Self::do_update_vesting_schedules(&account, vesting_schedules)?; - Self::deposit_event(Event::VestingSchedulesUpdated { who: account }); - } + let account = T::Lookup::lookup(who)?; + Self::do_update_vesting_schedules(&account, vesting_schedules)?; + + Self::deposit_event(Event::VestingSchedulesUpdated { who: account }); Ok(().into()) } - #[allow(unused_variables)] #[pallet::call_index(7)] #[pallet::weight(::WeightInfo::claim_unlocked())] pub fn claim_for( @@ -1084,22 +1059,17 @@ pub mod pallet { dest: ::Source, ) -> DispatchResultWithPostInfo { let _ = ensure_signed(origin)?; - #[cfg(feature = "wip")] // ORML multi asset vesting - { - let who = T::Lookup::lookup(dest)?; - let locked_amount = Self::do_claim_unlocked(asset_id, &who)?; - - Self::deposit_event(Event::ClaimedVesting { - who, - asset_id, - locked_amount, - }); - } + let who = T::Lookup::lookup(dest)?; + let locked_amount = Self::do_claim_unlocked(asset_id, &who)?; + + Self::deposit_event(Event::ClaimedVesting { + who, + asset_id, + locked_amount, + }); Ok(().into()) } - #[allow(unused_variables)] - #[allow(unused_mut)] #[pallet::call_index(8)] #[pallet::weight(::WeightInfo::unlock_pending_schedule_by_manager())] pub fn unlock_pending_schedule_by_manager( @@ -1108,11 +1078,8 @@ pub mod pallet { mut filter_schedule: VestingScheduleOf, ) -> DispatchResultWithPostInfo { let manager = ensure_signed(origin)?; - #[cfg(feature = "wip")] // Pending Vesting - { - let dest = T::Lookup::lookup(dest)?; - Self::do_unlock_pending_schedule_by_manager(manager, dest, &mut filter_schedule)?; - } + let dest = T::Lookup::lookup(dest)?; + Self::do_unlock_pending_schedule_by_manager(manager, dest, &mut filter_schedule)?; Ok(().into()) } } @@ -1200,14 +1167,12 @@ pub mod pallet { }, } - #[cfg(feature = "wip")] // Auto Vesting /// Claims was not processed. #[pallet::storage] #[pallet::getter(fn pending_claims)] #[pallet::unbounded] pub type PendingClaims = StorageValue<_, Vec>, ValueQuery>; - #[cfg(feature = "wip")] // Auto Vesting /// Vesting claims of a block. /// /// VestingSchedules: map AccountId => Vec @@ -1217,7 +1182,6 @@ pub mod pallet { pub type ClaimSchedules = StorageMap<_, Blake2_128Concat, BlockNumberFor, Vec>, ValueQuery>; - #[cfg(feature = "wip")] // ORML multi asset vesting /// Vesting schedules of an account. /// /// VestingSchedules: map AccountId => Vec @@ -1273,7 +1237,6 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - #[cfg(feature = "wip")] // Auto Vesting fn on_initialize(current_block: BlockNumberFor) -> Weight { let claim_weight = ::WeightInfo::claim_unlocked(); Self::auto_claim(current_block, claim_weight) diff --git a/pallets/vested-rewards/src/mock.rs b/pallets/vested-rewards/src/mock.rs index ae2944d54f..359d00cef4 100644 --- a/pallets/vested-rewards/src/mock.rs +++ b/pallets/vested-rewards/src/mock.rs @@ -428,7 +428,6 @@ impl ExtBuilder { } } -#[cfg(feature = "wip")] // ORML multi asset vesting pub fn run_to_block(n: u64) { while System::block_number() < n { System::on_initialize(System::block_number()); diff --git a/pallets/vested-rewards/src/tests.rs b/pallets/vested-rewards/src/tests.rs index 9af9a3a250..d60a88d2c7 100644 --- a/pallets/vested-rewards/src/tests.rs +++ b/pallets/vested-rewards/src/tests.rs @@ -34,10 +34,10 @@ use crate::Error::ArithmeticError; use crate::{ mock::*, Claim, CrowdloanInfo, CrowdloanInfos, CrowdloanUserInfo, CrowdloanUserInfos, Event, }; -#[cfg(feature = "wip")] // Auto Vesting + use crate::{ClaimSchedules, PendingClaims}; use crate::{Error, RewardInfo}; -#[cfg(feature = "wip")] // ORML multi asset vesting + use crate::{VestingSchedules, VESTING_LOCK_ID}; use common::mock::charlie; use common::{ @@ -1026,8 +1026,7 @@ fn update_rewards_works() { } // Tests for Linear Vesting and Vesting -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting + #[test] fn linear_vested_transfer_works() { ExtBuilder::default().build().execute_with(|| { @@ -1081,7 +1080,7 @@ fn linear_vested_transfer_works() { ); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting + #[test] fn self_linear_vesting() { ExtBuilder::default().build().execute_with(|| { @@ -1144,8 +1143,7 @@ fn self_linear_vesting() { )); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting + #[test] fn add_new_vesting_schedule_merges_with_current_locked_balance_and_until() { ExtBuilder::default().build().execute_with(|| { @@ -1245,8 +1243,6 @@ fn add_new_vesting_schedule_merges_with_current_locked_balance_and_until() { }); } -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting #[test] fn cannot_use_fund_if_not_claimed_from_linear() { ExtBuilder::default().build().execute_with(|| { @@ -1282,7 +1278,6 @@ fn cannot_use_fund_if_not_claimed_from_linear() { }); } -#[cfg(feature = "wip")] // Pending Vesting #[test] fn linear_vesting_unlock_correct() { ExtBuilder::default().build().execute_with(|| { @@ -1340,8 +1335,6 @@ fn linear_vesting_unlock_correct() { }) } -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting #[test] fn linear_vested_transfer_fails_if_zero_period_or_count() { ExtBuilder::default().build().execute_with(|| { @@ -1436,8 +1429,6 @@ fn linear_vested_transfer_fails_if_zero_period_or_count() { }); } -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting #[test] fn vested_transfer_fails_if_transfer_err() { ExtBuilder::default().build().execute_with(|| { @@ -1469,8 +1460,7 @@ fn vested_transfer_fails_if_transfer_err() { ); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting + #[test] fn vested_linear_transfer_and_unlock_pending_fails_if_overflow() { ExtBuilder::default().build().execute_with(|| { @@ -1621,7 +1611,7 @@ fn vested_linear_transfer_and_unlock_pending_fails_if_overflow() { ); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting + #[test] fn vested_transfer_check_for_min() { ExtBuilder::default().build().execute_with(|| { @@ -1639,8 +1629,7 @@ fn vested_transfer_check_for_min() { ); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting + #[test] fn claim_linear_works() { ExtBuilder::default().build().execute_with(|| { @@ -1748,7 +1737,7 @@ fn claim_linear_works() { assert!(!VestingSchedules::::contains_key(bob())); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting + #[test] fn claim_for_works() { ExtBuilder::default().build().execute_with(|| { @@ -1795,8 +1784,7 @@ fn claim_for_works() { assert!(!VestingSchedules::::contains_key(&bob())); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting -#[cfg(feature = "wip")] // Pending Vesting + #[test] fn update_vesting_schedules_works() { ExtBuilder::default().build().execute_with(|| { @@ -1908,7 +1896,7 @@ fn update_vesting_schedules_works() { assert_eq!(Tokens::locks(bob(), DOT), vec![]); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting + #[test] fn multiple_vesting_linear_schedule_claim_works() { ExtBuilder::default().build().execute_with(|| { @@ -1965,7 +1953,7 @@ fn multiple_vesting_linear_schedule_claim_works() { assert_eq!(Tokens::locks(bob(), DOT), vec![]); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting + #[test] fn exceeding_maximum_schedules_should_fail() { ExtBuilder::default().build().execute_with(|| { @@ -1995,7 +1983,7 @@ fn exceeding_maximum_schedules_should_fail() { ); }); } -#[cfg(feature = "wip")] // ORML multi asset vesting + #[test] fn cliff_vesting_linear_works() { const VESTING_AMOUNT: Balance = 12; @@ -2055,7 +2043,6 @@ fn cliff_vesting_linear_works() { }); } -#[cfg(feature = "wip")] // Auto Vesting #[test] fn auto_claim_hook_works_fine() { ExtBuilder::default().build().execute_with(|| { @@ -2150,7 +2137,6 @@ fn auto_claim_hook_works_fine() { }) } -#[cfg(feature = "wip")] // Auto Vesting #[test] fn auto_claim_hook_works_fine_if_period_lasts_before_transction() { ExtBuilder::default().build().execute_with(|| { @@ -2229,7 +2215,6 @@ fn auto_claim_hook_works_fine_if_period_lasts_before_transction() { }) } -#[cfg(feature = "wip")] // Auto Vesting #[test] fn auto_claim_hook_works_fine_for_pending_if_period_lasts_before_transction() { ExtBuilder::default().build().execute_with(|| { @@ -2346,7 +2331,6 @@ fn auto_claim_hook_works_fine_for_pending_if_period_lasts_before_transction() { }) } -#[cfg(feature = "wip")] // Auto Vesting #[test] fn auto_claim_works_fine_for_pending() { ExtBuilder::default().build().execute_with(|| { @@ -2416,7 +2400,6 @@ fn auto_claim_works_fine_for_pending() { }) } -#[cfg(feature = "wip")] // Auto Vesting #[test] fn auto_claim_works_fine_for_pending_and_block() { ExtBuilder::default().build().execute_with(|| { diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index c7f366fd44..e94d1e6168 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -5,7 +5,7 @@ license = "BSD-4-Clause" homepage = "https://sora.org" repository = "https://github.com/sora-xor/sora2-network" name = "framenode-runtime" -version = "4.2.0" +version = "4.3.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 933fe16a09..3e6263229e 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -255,10 +255,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: 101, + spec_version: 102, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 101, + transaction_version: 102, state_version: 0, }; diff --git a/runtime/src/tests/xor_fee.rs b/runtime/src/tests/xor_fee.rs index fb484a720c..547b6aa8ec 100644 --- a/runtime/src/tests/xor_fee.rs +++ b/runtime/src/tests/xor_fee.rs @@ -39,7 +39,7 @@ use crate::{ use common::mock::{alice, bob, charlie}; use common::prelude::constants::{BIG_FEE, SMALL_FEE}; use common::prelude::{AssetName, AssetSymbol, FixedWrapper, SwapAmount}; -#[cfg(feature = "wip")] // ORML multi asset vesting + use common::DOT; use common::{ assert_approx_eq_abs, balance, fixed_wrapper, AssetInfoProvider, DEXId, FilterMode, @@ -59,11 +59,11 @@ use referrals::ReferrerBalances; use sp_runtime::traits::{Dispatchable, SignedExtension}; use sp_runtime::{AccountId32, FixedPointNumber, FixedU128}; use traits::MultiCurrency; -#[cfg(feature = "wip")] // ORML multi asset vesting + use vested_rewards::vesting_currencies::{ LinearVestingSchedule, VestingSchedule, VestingScheduleVariant, }; -#[cfg(feature = "wip")] // ORML multi asset vesting + use vested_rewards::{Config, WeightInfo}; use xor_fee::extension::ChargeTransactionPayment; use xor_fee::{ApplyCustomFees, LiquidityInfo, XorToVXor, XorToVal}; @@ -1351,7 +1351,6 @@ fn fee_payment_postpone_failed_xorless_transfer() { }); } -#[cfg(feature = "wip")] // ORML multi asset vesting #[test] fn right_custom_fee_for_vested_transfer_ok() { ext().execute_with(|| { @@ -1412,7 +1411,6 @@ fn right_custom_fee_for_vested_transfer_ok() { }); } -#[cfg(feature = "wip")] // ORML multi asset vesting #[test] fn right_custom_fee_for_vested_transfer_err() { ext().execute_with(|| { diff --git a/runtime/src/xor_fee_impls.rs b/runtime/src/xor_fee_impls.rs index eb080ea530..83b9a91b3b 100644 --- a/runtime/src/xor_fee_impls.rs +++ b/runtime/src/xor_fee_impls.rs @@ -149,7 +149,6 @@ impl RuntimeCall { pub struct CustomFees; impl CustomFees { - #[cfg(feature = "wip")] // ORML multi asset vesting fn base_fee(call: &RuntimeCall) -> Option { match call { RuntimeCall::LiquidityProxy(liquidity_proxy::Call::swap_transfer_batch { @@ -190,44 +189,6 @@ impl CustomFees { _ => None, } } - #[cfg(not(feature = "wip"))] // ORML multi asset vesting - fn base_fee(call: &RuntimeCall) -> Option { - match call { - RuntimeCall::LiquidityProxy(liquidity_proxy::Call::swap_transfer_batch { - swap_batches, - .. - }) => Some( - swap_batches - .iter() - .map(|x| x.receivers.len() as Balance) - .fold(Balance::zero(), |acc, x| acc.saturating_add(x)) - .saturating_mul(SMALL_FEE) - .max(SMALL_FEE), - ), - RuntimeCall::Assets(assets::Call::register { .. }) - | RuntimeCall::EthBridge(eth_bridge::Call::transfer_to_sidechain { .. }) - | RuntimeCall::BridgeProxy(bridge_proxy::Call::burn { .. }) - | RuntimeCall::PoolXYK(pool_xyk::Call::withdraw_liquidity { .. }) - | RuntimeCall::Rewards(rewards::Call::claim { .. }) - | RuntimeCall::VestedRewards(vested_rewards::Call::claim_crowdloan_rewards { - .. - }) - | RuntimeCall::VestedRewards(vested_rewards::Call::claim_rewards { .. }) - | RuntimeCall::OrderBook(order_book::Call::update_orderbook { .. }) => Some(BIG_FEE), - RuntimeCall::Assets(..) - | RuntimeCall::EthBridge(..) - | RuntimeCall::LiquidityProxy(..) - | RuntimeCall::MulticollateralBondingCurvePool(..) - | RuntimeCall::PoolXYK(..) - | RuntimeCall::Rewards(..) - | RuntimeCall::Staking(pallet_staking::Call::payout_stakers { .. }) - | RuntimeCall::TradingPair(..) - | RuntimeCall::Band(..) - | RuntimeCall::Referrals(..) - | RuntimeCall::OrderBook(..) => Some(SMALL_FEE), - _ => None, - } - } } #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -410,7 +371,6 @@ impl xor_fee::ApplyCustomFees for CustomFees { true } - #[allow(unused_variables)] fn compute_actual_fee( _post_info: &sp_runtime::traits::PostDispatchInfoOf, _info: &sp_runtime::traits::DispatchInfoOf, @@ -428,16 +388,11 @@ impl xor_fee::ApplyCustomFees for CustomFees { ) } CustomFeeDetails::VestedTransferClaims((fee, fee_without_claims)) => { - #[cfg(feature = "wip")] // ORML multi asset vesting - { - if _result.is_err() { - return Some(fee_without_claims); - } else { - return Some(fee); - } + return if _result.is_err() { + Some(fee_without_claims) + } else { + Some(fee) } - #[cfg(not(feature = "wip"))] // ORML multi asset vesting - None } } } From 80e8a7eb0fd43ba84792757f222dedfe5ab70a01 Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Fri, 25 Oct 2024 14:10:14 +0300 Subject: [PATCH 2/3] change back to 4.2.0 --- Cargo.lock | 6 +++--- node/Cargo.toml | 2 +- node/chain_spec/Cargo.toml | 2 +- runtime/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aff410c203..33f406eea5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3559,7 +3559,7 @@ dependencies = [ [[package]] name = "framenode" -version = "4.3.0" +version = "4.2.0" dependencies = [ "ahash 0.8.5", "assert_cmd", @@ -3643,7 +3643,7 @@ dependencies = [ [[package]] name = "framenode-chain-spec" -version = "4.3.0" +version = "4.2.0" dependencies = [ "common", "faucet", @@ -3669,7 +3669,7 @@ dependencies = [ [[package]] name = "framenode-runtime" -version = "4.3.0" +version = "4.2.0" dependencies = [ "apollo-platform", "assets", diff --git a/node/Cargo.toml b/node/Cargo.toml index a98196ea64..c14a728aa8 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framenode" -version = "4.3.0" +version = "4.2.0" authors = ["Parity Technologies "] build = "build.rs" edition = "2021" diff --git a/node/chain_spec/Cargo.toml b/node/chain_spec/Cargo.toml index e6011fda11..71d3d79303 100644 --- a/node/chain_spec/Cargo.toml +++ b/node/chain_spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framenode-chain-spec" -version = "4.3.0" +version = "4.2.0" authors = ["Parity Technologies "] edition = "2021" diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index e94d1e6168..c7f366fd44 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -5,7 +5,7 @@ license = "BSD-4-Clause" homepage = "https://sora.org" repository = "https://github.com/sora-xor/sora2-network" name = "framenode-runtime" -version = "4.3.0" +version = "4.2.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] From de4d3fa455745c18fc4a0d15031e1439b97e0edc Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Mon, 28 Oct 2024 20:56:27 +0300 Subject: [PATCH 3/3] Revert "change back to 4.2.0" This reverts commit 80e8a7eb0fd43ba84792757f222dedfe5ab70a01. --- Cargo.lock | 6 +++--- node/Cargo.toml | 2 +- node/chain_spec/Cargo.toml | 2 +- runtime/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33f406eea5..aff410c203 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3559,7 +3559,7 @@ dependencies = [ [[package]] name = "framenode" -version = "4.2.0" +version = "4.3.0" dependencies = [ "ahash 0.8.5", "assert_cmd", @@ -3643,7 +3643,7 @@ dependencies = [ [[package]] name = "framenode-chain-spec" -version = "4.2.0" +version = "4.3.0" dependencies = [ "common", "faucet", @@ -3669,7 +3669,7 @@ dependencies = [ [[package]] name = "framenode-runtime" -version = "4.2.0" +version = "4.3.0" dependencies = [ "apollo-platform", "assets", diff --git a/node/Cargo.toml b/node/Cargo.toml index c14a728aa8..a98196ea64 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framenode" -version = "4.2.0" +version = "4.3.0" authors = ["Parity Technologies "] build = "build.rs" edition = "2021" diff --git a/node/chain_spec/Cargo.toml b/node/chain_spec/Cargo.toml index 71d3d79303..e6011fda11 100644 --- a/node/chain_spec/Cargo.toml +++ b/node/chain_spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framenode-chain-spec" -version = "4.2.0" +version = "4.3.0" authors = ["Parity Technologies "] edition = "2021" diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index c7f366fd44..e94d1e6168 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -5,7 +5,7 @@ license = "BSD-4-Clause" homepage = "https://sora.org" repository = "https://github.com/sora-xor/sora2-network" name = "framenode-runtime" -version = "4.2.0" +version = "4.3.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"]