diff --git a/Cargo.lock b/Cargo.lock index 06324a135..fd1e00271 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1540,7 +1540,7 @@ dependencies = [ [[package]] name = "dock-node" -version = "0.28.0" +version = "0.29.0" dependencies = [ "async-trait", "beefy-gadget", @@ -1766,7 +1766,7 @@ dependencies = [ [[package]] name = "dock-runtime" -version = "0.28.0" +version = "0.29.0" dependencies = [ "beefy-merkle-tree", "beefy-primitives", diff --git a/node/Cargo.toml b/node/Cargo.toml index e5300a724..3a1d01aff 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -3,13 +3,13 @@ authors = ["Dock.io"] build = "build.rs" edition = "2021" name = "dock-node" -version = "0.28.0" +version = "0.29.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "3.2.5", features = [ "derive" ] } +clap = { version = "3.2.5", features = ["derive"] } zstd = { version = "^0.11.2" } futures = "0.3.4" log = "0.4.8" @@ -28,7 +28,7 @@ optional = true [dependencies.dock-runtime] path = "../runtime" -version = "0.28.0" +version = "0.29.0" [dependencies.beefy-primitives] git = "https://github.com/paritytech/substrate.git" @@ -602,26 +602,26 @@ name = "dock-node" path = "src/main.rs" [features] -default = [ "cli" ] +default = ["cli"] cli = [ - "sc-executor/wasmi-errno", - "node-inspect", - "sc-cli", - "frame-benchmarking", - "frame-benchmarking-cli", - "structopt", - "substrate-build-script-utils", + "sc-executor/wasmi-errno", + "node-inspect", + "sc-cli", + "frame-benchmarking", + "frame-benchmarking-cli", + "structopt", + "substrate-build-script-utils", ] wasmtime = [ - "sc-cli/wasmtime", - "sc-executor/wasmtime", - "sc-service/wasmtime", - "frame-benchmarking-cli", - "structopt", - "substrate-build-script-utils", + "sc-cli/wasmtime", + "sc-executor/wasmtime", + "sc-service/wasmtime", + "frame-benchmarking-cli", + "structopt", + "substrate-build-script-utils", ] runtime-benchmarks = [ - "frame-benchmarking", - "dock-runtime/runtime-benchmarks", - "frame-benchmarking-cli", + "frame-benchmarking", + "dock-runtime/runtime-benchmarks", + "frame-benchmarking-cli", ] diff --git a/pallets/core/src/modules/trust_registry/mod.rs b/pallets/core/src/modules/trust_registry/mod.rs index 989cd4bc2..965378207 100644 --- a/pallets/core/src/modules/trust_registry/mod.rs +++ b/pallets/core/src/modules/trust_registry/mod.rs @@ -10,7 +10,6 @@ use crate::{ UpdateTranslationError, }, }; -use alloc::collections::BTreeSet; use core::convert::Infallible; use frame_support::{ dispatch::DispatchErrorWithPostInfo, @@ -523,39 +522,6 @@ pub mod pallet { .map_err(Into::into) } } - - #[pallet::hooks] - impl Hooks for Pallet { - fn on_runtime_upgrade() -> Weight { - let mut reads = 0; - let mut writes = 0; - - for registry_id in TrustRegistriesInfo::::iter_keys() { - reads += 1; - let issuers = TrustRegistryIssuerSchemas::::iter_keys() - .map(|(_, issuer)| IssuerOrVerifier(*issuer)); - let verifiers = TrustRegistryVerifierSchemas::::iter_keys() - .map(|(_, verifier)| IssuerOrVerifier(*verifier)); - - let participants = TrustRegistryStoredParticipants( - issuers - .chain(verifiers) - .inspect(|_| reads += 1) - .collect::>() - .try_into() - .unwrap(), - ); - - TrustRegistriesParticipants::::insert( - TrustRegistryIdForParticipants(registry_id), - participants, - ); - writes += 1; - } - - T::DbWeight::get().reads_writes(reads, writes) - } - } } impl> SubstrateWeight { diff --git a/pallets/staking-rewards/src/lib.rs b/pallets/staking-rewards/src/lib.rs index 195491e53..c56335091 100644 --- a/pallets/staking-rewards/src/lib.rs +++ b/pallets/staking-rewards/src/lib.rs @@ -220,6 +220,13 @@ impl Pallet { .unwrap_or_else(T::LowRateRewardDecayPct::get) } + pub fn treasury_rewards_pct() -> Percent { + Self::high_rate_rewards() + .is_active() + .then(Default::default) + .unwrap_or_else(T::TreasuryRewardsPct::get) + } + /// Get maximum emission per year according to the decay percentage and given emission supply fn get_max_yearly_emission(emission_supply: BalanceOf) -> BalanceOf { // Emission supply decreases by "decay percentage" of the remaining emission supply per year @@ -267,7 +274,8 @@ impl EraPayout> for Pallet { (BalanceOf::::zero(), BalanceOf::::zero()) } else { Self::set_new_emission_supply(remaining); - let treasury_reward = T::TreasuryRewardsPct::get() * emission_reward; + let treasury_reward = Self::treasury_rewards_pct() * emission_reward; + ( emission_reward.saturating_sub(treasury_reward), treasury_reward, diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index ebb6f90fc..3a5224381 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Dock.io"] edition = "2021" name = "dock-runtime" -version = "0.28.0" +version = "0.29.0" license = "Apache-2.0" [package.metadata.docs.rs] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 7d7849a6e..951b73e61 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -200,7 +200,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("dock-pos-dev-runtime"), impl_name: create_runtime_str!("Dock"), authoring_version: 1, - spec_version: 59, + spec_version: 60, impl_version: 2, transaction_version: 2, apis: RUNTIME_API_VERSIONS, @@ -1566,13 +1566,14 @@ pallet_staking_reward_curve::build! { ); } -/// Pay high-rate rewards for 1 month (in eras) after the upgrade. +/// Pay high-rate rewards for 3 months (in eras) after the upgrade. +/// At the moment, we still have 18 remaining eras of enabled high-rate rewards. const POST_UPGRADE_HIGH_RATE_DURATION: DurationInEras = - DurationInEras::new_non_zero((30 * DAY / EPOCH_DURATION_IN_BLOCKS / SESSIONS_PER_ERA) as u16); + DurationInEras::new_non_zero((81 * DAY / EPOCH_DURATION_IN_BLOCKS / SESSIONS_PER_ERA) as u16); -#[cfg(not(feature = "small_durations"))] // 1 era lasts for 12h. -const_assert_eq!(POST_UPGRADE_HIGH_RATE_DURATION.0.get(), 30 * 2); +#[cfg(not(feature = "small_durations"))] +const_assert_eq!(POST_UPGRADE_HIGH_RATE_DURATION.0.get(), 81 * 2); parameter_types! { pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;