diff --git a/Cargo.lock b/Cargo.lock
index 3f5886256b..ed5f3782c1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8462,26 +8462,6 @@ dependencies = [
"sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)",
]
-[[package]]
-name = "pallet-dapp-staking-migration"
-version = "1.0.0"
-dependencies = [
- "astar-primitives",
- "frame-benchmarking",
- "frame-support",
- "frame-system",
- "log",
- "pallet-balances",
- "pallet-dapp-staking-v3",
- "parity-scale-codec",
- "scale-info",
- "sp-arithmetic",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)",
-]
-
[[package]]
name = "pallet-dapp-staking-v3"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index b593673a52..badba367f8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -282,7 +282,6 @@ orml-oracle = { git = "https://github.com/AstarNetwork/open-runtime-module-libra
# (wasm)
pallet-collator-selection = { path = "./pallets/collator-selection", default-features = false }
pallet-dapp-staking-v3 = { path = "./pallets/dapp-staking-v3", default-features = false }
-pallet-dapp-staking-migration = { path = "./pallets/dapp-staking-migration", default-features = false }
pallet-xc-asset-config = { path = "./pallets/xc-asset-config", default-features = false }
pallet-ethereum-checked = { path = "./pallets/ethereum-checked", default-features = false }
pallet-inflation = { path = "./pallets/inflation", default-features = false }
diff --git a/pallets/dapp-staking-migration/Cargo.toml b/pallets/dapp-staking-migration/Cargo.toml
deleted file mode 100644
index 270e496d81..0000000000
--- a/pallets/dapp-staking-migration/Cargo.toml
+++ /dev/null
@@ -1,62 +0,0 @@
-[package]
-name = "pallet-dapp-staking-migration"
-version = "1.0.0"
-license = "GPL-3.0-or-later"
-description = "Pallet for managing dApp staking v2 to v3 migration."
-authors.workspace = true
-edition.workspace = true
-homepage.workspace = true
-repository.workspace = true
-
-[dependencies]
-frame-benchmarking = { workspace = true, optional = true }
-frame-support = { workspace = true }
-frame-system = { workspace = true }
-log = { workspace = true }
-parity-scale-codec = { workspace = true }
-scale-info = { workspace = true }
-sp-io = { workspace = true }
-sp-runtime = { workspace = true }
-sp-std = { workspace = true }
-
-astar-primitives = { workspace = true }
-pallet-dapp-staking-v3 = { workspace = true }
-
-[dev-dependencies]
-pallet-balances = { workspace = true }
-sp-arithmetic = { workspace = true }
-sp-core = { workspace = true }
-
-[features]
-default = ["std"]
-std = [
- "parity-scale-codec/std",
- "scale-info/std",
- "sp-std/std",
- "sp-io/std",
- "log/std",
- "frame-support/std",
- "frame-system/std",
- "pallet-dapp-staking-v3/std",
- "frame-benchmarking/std",
- "astar-primitives/std",
- "sp-core/std",
- "pallet-balances/std",
- "sp-runtime/std",
-]
-runtime-benchmarks = [
- "frame-benchmarking",
- "frame-support/runtime-benchmarks",
- "frame-system/runtime-benchmarks",
- "sp-runtime/runtime-benchmarks",
- "pallet-dapp-staking-v3/runtime-benchmarks",
- "astar-primitives/runtime-benchmarks",
- "frame-benchmarking/runtime-benchmarks",
-]
-try-runtime = [
- "frame-support/try-runtime",
- "astar-primitives/try-runtime",
- "frame-system/try-runtime",
- "pallet-dapp-staking-v3/try-runtime",
- "sp-runtime/try-runtime",
-]
diff --git a/pallets/dapp-staking-migration/src/benchmarking.rs b/pallets/dapp-staking-migration/src/benchmarking.rs
deleted file mode 100644
index f5c7fc717a..0000000000
--- a/pallets/dapp-staking-migration/src/benchmarking.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-// This file is part of Astar.
-
-// Copyright (C) Stake Technologies Pte.Ltd.
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-// Astar 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.
-
-// Astar 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.
-
-// You should have received a copy of the GNU General Public License
-// along with Astar. If not, see .
-
-use super::{Pallet as Migration, *};
-
-use astar_primitives::{dapp_staking::SmartContractHandle, Balance};
-use frame_benchmarking::{account as benchmark_account, v2::*};
-use pallet_dapp_staking_v3::StakeAmount;
-
-fn smart_contract(idx: u8) -> T::SmartContract {
- let address: T::AccountId = benchmark_account("smart_contract", idx.into(), 456);
- T::SmartContract::wasm(address)
-}
-
-pub(super) fn initial_config() {
- for idx in 0..10 {
- let account: T::AccountId = benchmark_account("developer", idx.into(), 123);
- let smart_contract = smart_contract::(idx);
-
- v5::StakerInfo::::insert(
- &account,
- &smart_contract,
- v5::SingularStakingInfo {
- staked: StakeAmount {
- voting: 123 * (idx as Balance + 1),
- build_and_earn: 345 * (idx as Balance + 1),
- era: 1,
- period: 2,
- },
- loyal_staker: true,
- },
- );
- }
-}
-
-#[benchmarks]
-mod benchmarks {
- use super::*;
-
- #[benchmark]
- fn translate_staking_info_success() {
- initial_config::();
-
- #[block]
- {
- assert!(Migration::::translate_staking_info(None).is_ok());
- }
- }
-
- #[benchmark]
- fn translate_staking_info_success_noop() {
- #[block]
- {
- assert!(Migration::::translate_staking_info(None).is_err());
- }
- }
-}
diff --git a/pallets/dapp-staking-migration/src/lib.rs b/pallets/dapp-staking-migration/src/lib.rs
deleted file mode 100644
index 3c8db1030e..0000000000
--- a/pallets/dapp-staking-migration/src/lib.rs
+++ /dev/null
@@ -1,445 +0,0 @@
-// This file is part of Astar.
-
-// Copyright (C) Stake Technologies Pte.Ltd.
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-// Astar 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.
-
-// Astar 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.
-
-// You should have received a copy of the GNU General Public License
-// along with Astar. If not, see .
-
-#![cfg_attr(not(feature = "std"), no_std)]
-
-pub use pallet::*;
-
-use frame_support::{
- dispatch::PostDispatchInfo,
- pallet_prelude::*,
- storage_alias,
- traits::{ConstU32, Get},
- WeakBoundedVec,
-};
-
-use frame_system::pallet_prelude::*;
-use parity_scale_codec::{Decode, Encode};
-use sp_runtime::Saturating;
-
-use pallet_dapp_staking_v3::{SingularStakingInfo, StakeAmount, StakerInfo};
-
-#[cfg(feature = "try-runtime")]
-use sp_std::vec::Vec;
-
-pub use crate::pallet::SingularStakingInfoTranslationUpgrade;
-
-#[cfg(feature = "runtime-benchmarks")]
-mod benchmarking;
-
-pub mod weights;
-pub use weights::WeightInfo;
-
-const LOG_TARGET: &str = "dapp-staking-migration";
-
-mod v5 {
- use super::*;
-
- #[derive(
- Encode, Decode, MaxEncodedLen, Copy, Clone, Debug, PartialEq, Eq, TypeInfo, Default,
- )]
- #[scale_info(skip_type_params(T))]
- pub struct SingularStakingInfo {
- /// Staked amount
- pub(crate) staked: StakeAmount,
- /// Indicates whether a staker is a loyal staker or not.
- pub(crate) loyal_staker: bool,
- }
-
- #[storage_alias]
- pub type StakerInfo = StorageDoubleMap<
- pallet_dapp_staking_v3::Pallet,
- Blake2_128Concat,
- ::AccountId,
- Blake2_128Concat,
- ::SmartContract,
- SingularStakingInfo,
- OptionQuery,
- >;
-}
-
-const MAX_KEY_SIZE: u32 = 1024;
-type StakingInfoKey = WeakBoundedVec>;
-
-#[frame_support::pallet]
-pub mod pallet {
- use super::*;
-
- #[pallet::pallet]
- pub struct Pallet(PhantomData);
-
- #[pallet::config]
- pub trait Config:
- // Tight coupling, but it's fine since pallet is supposed to be just temporary and will be removed after migration.
- frame_system::Config + pallet_dapp_staking_v3::Config
- {
- /// The overarching event type.
- type RuntimeEvent: From> + IsType<::RuntimeEvent>;
-
- /// Weight info for various calls & operations in the pallet.
- type WeightInfo: WeightInfo;
- }
-
- /// Used to store the current migration state.
- #[pallet::storage]
- pub type MigrationStateStorage = StorageValue<_, MigrationState, ValueQuery>;
-
- #[pallet::event]
- #[pallet::generate_deposit(pub(crate) fn deposit_event)]
- pub enum Event {
- /// Number of staking info entries translated
- SingularStakingInfoTranslated(u32),
- }
-
- #[pallet::call]
- impl Pallet {
- /// Attempt to execute migration steps, consuming up to the specified amount of weight.
- /// If no weight is specified, max allowed weight is used.
- ///
- /// Regardless of the specified weight limit, it will be clamped between the minimum & maximum allowed values.
- /// This means that even if user specifies `Weight::zero()` as the limit,
- /// the call will be charged & executed using the minimum allowed weight.
- #[pallet::call_index(0)]
- #[pallet::weight({
- Pallet::::clamp_call_weight(*weight_limit)
- })]
- pub fn migrate(
- origin: OriginFor,
- weight_limit: Option,
- ) -> DispatchResultWithPostInfo {
- ensure_signed(origin)?;
-
- let weight_to_use = Self::clamp_call_weight(weight_limit);
- let consumed_weight = Self::do_migrate(weight_to_use);
-
- // Refund the user in case migration call was needed.
- match consumed_weight {
- Ok(weight) => Ok(PostDispatchInfo {
- actual_weight: Some(weight),
- pays_fee: Pays::No,
- }),
- // No refunds or adjustments!
- Err(_) => Ok(().into()),
- }
- }
- }
-
- #[pallet::hooks]
- impl Hooks> for Pallet {
- fn integrity_test() {
- assert!(Pallet::::max_call_weight().all_gte(Pallet::::min_call_weight()));
-
- assert!(Pallet::::max_call_weight()
- .all_lte(::BlockWeights::get().max_block));
-
- assert!(Pallet::::migration_weight_margin().all_lte(Pallet::::min_call_weight()));
- }
- }
-
- impl Pallet {
- /// Execute migrations steps until the specified weight limit has been consumed.
- ///
- /// Depending on the number of entries migrated and/or deleted, appropriate events are emitted.
- ///
- /// In case at least some progress is made, `Ok(_)` is returned.
- /// If no progress is made, `Err(_)` is returned.
- fn do_migrate(weight_limit: Weight) -> Result {
- // Find out if migration is still in progress
- let init_migration_state = MigrationStateStorage::::get();
- let mut consumed_weight = T::DbWeight::get().reads(1);
-
- if init_migration_state == MigrationState::Finished {
- log::trace!(
- target: LOG_TARGET,
- "Migration has been finished, skipping any action."
- );
- return Err(consumed_weight);
- }
-
- consumed_weight.saturating_accrue(T::DbWeight::get().writes(1));
-
- let mut migration_state = init_migration_state;
- let mut entries_migrated = 0_u32;
-
- while weight_limit
- .saturating_sub(consumed_weight)
- .all_gte(Self::migration_weight_margin())
- {
- match migration_state.clone() {
- MigrationState::NotInProgress => match Self::translate_staking_info(None) {
- Ok((last_key, weight)) => {
- consumed_weight.saturating_accrue(weight);
- entries_migrated.saturating_inc();
-
- migration_state = MigrationState::SingularStakingInfo(last_key);
- }
- Err(weight) => {
- consumed_weight.saturating_accrue(weight);
- migration_state = MigrationState::Finished;
- }
- },
- MigrationState::SingularStakingInfo(last_key) => {
- match Self::translate_staking_info(Some(last_key)) {
- Ok((last_key, weight)) => {
- consumed_weight.saturating_accrue(weight);
- entries_migrated.saturating_inc();
-
- migration_state = MigrationState::SingularStakingInfo(last_key);
- }
- Err(weight) => {
- consumed_weight.saturating_accrue(weight);
- migration_state = MigrationState::Finished;
- }
- }
- }
- MigrationState::Finished => {
- // Nothing more to do here
- break;
- }
- }
- }
-
- // Deposit events if needed
- if entries_migrated > 0 {
- Self::deposit_event(Event::::SingularStakingInfoTranslated(entries_migrated));
- }
-
- // Update the migration status
- MigrationStateStorage::::put(migration_state.clone());
-
- // Once migration has been finished, disable the maintenance mode and set correct storage version.
- if migration_state == MigrationState::Finished {
- log::trace!(target: LOG_TARGET, "Migration has been finished.");
-
- pallet_dapp_staking_v3::ActiveProtocolState::::mutate(|state| {
- state.maintenance = false;
- });
- StorageVersion::new(6).put::>();
- consumed_weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 2));
- }
-
- Ok(consumed_weight)
- }
-
- pub(crate) fn translate_staking_info(
- last_key: Option,
- ) -> Result<(StakingInfoKey, Weight), Weight> {
- // Create an iterator to be used for reading a single entry
- let mut iter = if let Some(last_key) = last_key {
- v5::StakerInfo::::iter_from(last_key.into_inner())
- } else {
- v5::StakerInfo::::iter()
- };
-
- // Try to read the next entry
- if let Some((account_id, smart_contract_id, old)) = iter.next() {
- // Entry exists so it needs to be translated into the new format
- let new_staking_info = SingularStakingInfo::new_migration(
- StakeAmount::default(),
- old.staked,
- old.loyal_staker,
- );
- StakerInfo::::insert(&account_id, &smart_contract_id, new_staking_info);
-
- let hashed_key = StakerInfo::::hashed_key_for(&account_id, &smart_contract_id);
-
- if cfg!(feature = "try-runtime") {
- assert!(
- hashed_key.len() < MAX_KEY_SIZE as usize,
- "Key size exceeded max limit!"
- );
- }
-
- Ok((
- WeakBoundedVec::force_from(hashed_key, None),
- ::WeightInfo::translate_staking_info_success(),
- ))
- } else {
- Err(::WeightInfo::translate_staking_info_success_noop())
- }
- }
-
- /// Max allowed weight that migration should be allowed to consume.
- pub(crate) fn max_call_weight() -> Weight {
- // 50% of block should be fine
- T::BlockWeights::get().max_block / 2
- }
-
- /// Min allowed weight that migration should be allowed to consume.
- ///
- /// This serves as a safety margin, to prevent accidental overspending, due to
- /// imprecision in implementation or benchmarks, when small weight limit is specified.
- pub(crate) fn min_call_weight() -> Weight {
- // 5% of block should be fine
- T::BlockWeights::get().max_block / 10
- }
-
- /// Calculate call weight to use.
- ///
- /// In case of `None`, use the max allowed call weight.
- /// Otherwise clamp the specified weight between the allowed min & max values.
- fn clamp_call_weight(weight: Option) -> Weight {
- weight
- .unwrap_or(Self::max_call_weight())
- .min(Self::max_call_weight())
- .max(Self::min_call_weight())
- }
-
- /// Returns the least amount of weight which should be remaining for migration in order to attempt another step.
- ///
- /// This is used to ensure we don't go over the limit.
- fn migration_weight_margin() -> Weight {
- // Consider the weight of all steps
- ::WeightInfo::translate_staking_info_success()
- // and add the weight of updating migration status
- .saturating_add(T::DbWeight::get().writes(1))
- }
- }
-
- #[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug, MaxEncodedLen)]
- pub enum MigrationState {
- /// No migration in progress
- NotInProgress,
- /// In the middle of `SingularStakingInfo` migration/translation.
- SingularStakingInfo(StakingInfoKey),
- /// All migrations have been finished
- Finished,
- }
-
- impl Default for MigrationState {
- fn default() -> Self {
- MigrationState::NotInProgress
- }
- }
-
- pub struct SingularStakingInfoTranslationUpgrade(PhantomData);
- impl frame_support::traits::UncheckedOnRuntimeUpgrade
- for SingularStakingInfoTranslationUpgrade
- {
- fn on_runtime_upgrade() -> Weight {
- let mut consumed_weight = T::DbWeight::get().reads_writes(1, 2);
-
- // Enable maintenance mode.
- pallet_dapp_staking_v3::ActiveProtocolState::::mutate(|state| {
- state.maintenance = true;
- });
-
- // In case of try-runtime, we want to execute the whole logic, to ensure it works
- // with on-chain data.
- if cfg!(feature = "try-runtime") {
- let mut steps = 0_u32;
- while MigrationStateStorage::::get() != MigrationState::Finished {
- match Pallet::::do_migrate(crate::Pallet::::max_call_weight()) {
- Ok(weight) => {
- consumed_weight.saturating_accrue(weight);
- steps.saturating_inc();
- }
- Err(_) => {
- panic!("Must never happen since we check whether state is `Finished` before calling `do_migrate`.");
- }
- }
- }
-
- log::trace!(
- target: LOG_TARGET,
- "dApp Staking migration finished after {} steps with total weight of {}.",
- steps,
- consumed_weight,
- );
-
- consumed_weight
- } else {
- consumed_weight
- }
- }
-
- #[cfg(feature = "try-runtime")]
- fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> {
- // Get all staker info entries to be used later for verification
- let staker_info: Vec<_> = v5::StakerInfo::::iter()
- .map(|(account_id, smart_contract, staking_info)| {
- (
- account_id,
- smart_contract,
- staking_info.staked,
- staking_info.loyal_staker,
- )
- })
- .collect();
-
- let helper = Helper:: { staker_info };
-
- Ok(helper.encode())
- }
-
- #[cfg(feature = "try-runtime")]
- fn post_upgrade(state: Vec) -> Result<(), sp_runtime::TryRuntimeError> {
- use sp_runtime::traits::TrailingZeroInput;
-
- // 0. Verify that migration state is `Finished`
- if MigrationStateStorage::::get() != MigrationState::Finished {
- return Err("Migration state is not `Finished`".into());
- }
-
- let helper = Helper::::decode(&mut TrailingZeroInput::new(state.as_ref()))
- .map_err(|_| "Cannot decode data from pre_upgrade")?;
-
- // 1. Verify that staker info is essentially same as before
- for (account_id, smart_contract, staked, loyal_staker) in helper.staker_info {
- let staking_info = StakerInfo::::get(&account_id, &smart_contract)
- .ok_or("Staking info not found but it must exist!")?;
-
- let expected_staking_info = SingularStakingInfo::new_migration(
- StakeAmount::default(),
- staked,
- loyal_staker,
- );
-
- if staking_info != expected_staking_info {
- log::error!(target: LOG_TARGET,
- "Staking info mismatch for account {:?} and smart contract {:?}. Expected: {:?}, got: {:?}",
- account_id, smart_contract, expected_staking_info, staking_info
- );
-
- return Err("Failed to verify staking info".into());
- }
- }
-
- // 2. Verify pallet is no longer in maintenance mode
- if pallet_dapp_staking_v3::ActiveProtocolState::::get().maintenance {
- return Err("Pallet is still in maintenance mode".into());
- }
-
- // 3. Verify on-chain storage version is correct
- if StorageVersion::get::>() != 6 {
- return Err("Storage version is not correct".into());
- }
-
- log::trace!(target: LOG_TARGET, "Post-upgrade checks successful.");
-
- Ok(())
- }
- }
-}
-
-#[cfg(feature = "try-runtime")]
-/// Used to help with `try-runtime` testing.
-#[derive(Encode, Decode)]
-struct Helper {
- staker_info: Vec<(T::AccountId, T::SmartContract, StakeAmount, bool)>,
-}
diff --git a/pallets/dapp-staking-migration/src/weights.rs b/pallets/dapp-staking-migration/src/weights.rs
deleted file mode 100644
index 837bac773e..0000000000
--- a/pallets/dapp-staking-migration/src/weights.rs
+++ /dev/null
@@ -1,105 +0,0 @@
-
-// This file is part of Astar.
-
-// Copyright (C) Stake Technologies Pte.Ltd.
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-// Astar 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.
-
-// Astar 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.
-
-// You should have received a copy of the GNU General Public License
-// along with Astar. If not, see .
-
-//! Autogenerated weights for pallet_dapp_staking_migration
-//!
-//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2024-03-12, STEPS: `5`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
-//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `Dinos-MBP.fritz.box`, CPU: ``
-//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024
-
-// Executed Command:
-// ./target/release/astar-collator
-// benchmark
-// pallet
-// --chain=shibuya-dev
-// --steps=5
-// --repeat=1
-// --pallet=pallet_dapp_staking_migration
-// --extrinsic=*
-// --execution=wasm
-// --wasm-execution=compiled
-// --heap-pages=4096
-// --output=weights.rs
-// --template=./scripts/templates/weight-template.hbs
-
-#![cfg_attr(rustfmt, rustfmt_skip)]
-#![allow(unused_parens)]
-#![allow(unused_imports)]
-
-use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
-use core::marker::PhantomData;
-
-/// Weight functions needed for pallet_dapp_staking_migration.
-pub trait WeightInfo {
- fn translate_staking_info_success() -> Weight;
- fn translate_staking_info_success_noop() -> Weight;
-}
-
-/// Weights for pallet_dapp_staking_migration using the Substrate node and recommended hardware.
-pub struct SubstrateWeight(PhantomData);
-impl WeightInfo for SubstrateWeight {
- /// Storage: DappStaking StakerInfo (r:2 w:1)
- /// Proof: DappStaking StakerInfo (max_values: None, max_size: Some(178), added: 2653, mode: MaxEncodedLen)
- fn translate_staking_info_success() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `368`
- // Estimated: `6296`
- // Minimum execution time: 16_000_000 picoseconds.
- Weight::from_parts(16_000_000, 6296)
- .saturating_add(T::DbWeight::get().reads(2_u64))
- .saturating_add(T::DbWeight::get().writes(1_u64))
- }
- /// Storage: DappStaking StakerInfo (r:1 w:0)
- /// Proof: DappStaking StakerInfo (max_values: None, max_size: Some(178), added: 2653, mode: MaxEncodedLen)
- fn translate_staking_info_success_noop() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `19`
- // Estimated: `3643`
- // Minimum execution time: 4_000_000 picoseconds.
- Weight::from_parts(4_000_000, 3643)
- .saturating_add(T::DbWeight::get().reads(1_u64))
- }
-}
-
-// For backwards compatibility and tests
-impl WeightInfo for () {
- /// Storage: DappStaking StakerInfo (r:2 w:1)
- /// Proof: DappStaking StakerInfo (max_values: None, max_size: Some(178), added: 2653, mode: MaxEncodedLen)
- fn translate_staking_info_success() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `368`
- // Estimated: `6296`
- // Minimum execution time: 16_000_000 picoseconds.
- Weight::from_parts(16_000_000, 6296)
- .saturating_add(RocksDbWeight::get().reads(2_u64))
- .saturating_add(RocksDbWeight::get().writes(1_u64))
- }
- /// Storage: DappStaking StakerInfo (r:1 w:0)
- /// Proof: DappStaking StakerInfo (max_values: None, max_size: Some(178), added: 2653, mode: MaxEncodedLen)
- fn translate_staking_info_success_noop() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `19`
- // Estimated: `3643`
- // Minimum execution time: 4_000_000 picoseconds.
- Weight::from_parts(4_000_000, 3643)
- .saturating_add(RocksDbWeight::get().reads(1_u64))
- }
-}
diff --git a/pallets/dapp-staking-v3/src/migration.rs b/pallets/dapp-staking-v3/src/migration.rs
index 07075800b8..b2e81c3a38 100644
--- a/pallets/dapp-staking-v3/src/migration.rs
+++ b/pallets/dapp-staking-v3/src/migration.rs
@@ -270,6 +270,7 @@ mod v7 {
},
}
+ #[cfg(feature = "try-runtime")]
impl TierThreshold {
/// Return threshold for the tier.
pub fn threshold(&self) -> Balance {
diff --git a/pallets/dapp-staking-v3/src/types.rs b/pallets/dapp-staking-v3/src/types.rs
index c8cd9d9c98..df6a613023 100644
--- a/pallets/dapp-staking-v3/src/types.rs
+++ b/pallets/dapp-staking-v3/src/types.rs
@@ -998,19 +998,6 @@ impl SingularStakingInfo {
}
}
- /// TODO: remove this after migration to v6 has been done.
- pub fn new_migration(
- previous_staked: StakeAmount,
- staked: StakeAmount,
- loyal_staker: bool,
- ) -> Self {
- Self {
- previous_staked,
- staked,
- loyal_staker,
- }
- }
-
/// Stake the specified amount on the contract, for the specified subperiod.
pub fn stake(&mut self, amount: Balance, current_era: EraNumber, subperiod: Subperiod) {
// Keep the previous stake amount for future reference