Skip to content

Commit

Permalink
misc: nomenclature consistency & comment cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ipapandinas committed Feb 13, 2025
1 parent cf5ba43 commit 433f5d0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pallets/dapp-staking/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ mod benchmarks {
amount,
));

// Move over to the build&earn subperiod to ensure 'non-loyal' staking.
// Move over to the build&earn subperiod to ensure staking without a bonus status.
// This is needed so we can achieve staker entry cleanup after claiming unlocked tokens.
force_advance_to_next_subperiod::<T>();
assert_eq!(
Expand Down Expand Up @@ -782,7 +782,7 @@ mod benchmarks {
fn cleanup_expired_entries(x: Linear<1, { T::MaxNumberOfStakedContracts::get() }>) {
initial_config::<T>();

// Move over to the build&earn subperiod to ensure 'non-loyal' staking.
// Move over to the build&earn subperiod to ensure staking without a bonus status.
force_advance_to_next_subperiod::<T>();

// Prepare staker & lock some amount
Expand Down
10 changes: 4 additions & 6 deletions pallets/dapp-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub mod pallet {
era: EraNumber,
amount: Balance,
},
/// Bonus reward has been paid out to a loyal staker.
/// Bonus reward has been paid out to a staker with an eligible bonus status.
BonusReward {
account: T::AccountId,
smart_contract: T::SmartContract,
Expand Down Expand Up @@ -1217,8 +1217,8 @@ pub mod pallet {
/// Cleanup expired stake entries for the contract.
///
/// Entry is considered to be expired if:
/// 1. It's from a past period & the account wasn't a loyal staker, meaning there's no claimable bonus reward.
/// 2. It's from a period older than the oldest claimable period, regardless whether the account was loyal or not.
/// 1. It's from a past period & the account did not maintain an eligible bonus status, meaning there's no claimable bonus reward.
/// 2. It's from a period older than the oldest claimable period, regardless of whether the account had an eligible bonus status or not.
#[pallet::call_index(17)]
#[pallet::weight(T::WeightInfo::cleanup_expired_entries(
T::MaxNumberOfStakedContracts::get()
Expand Down Expand Up @@ -1529,8 +1529,6 @@ pub mod pallet {

Self::update_ledger(&account, ledger)?;

// Implementation comment, remove once production code is ready:
// We need to know what & how much was unstaked. The code can be made cleaner later, maybe there are redundant parts now.
// Return the `StakeAmount` that has max total value - that's the one that is equal to the `amount` parameter.
let unstake_amount = stake_amount_iter
.iter()
Expand Down Expand Up @@ -2373,7 +2371,7 @@ pub mod pallet {

// Ensure:
// 1. Period for which rewards are being claimed has ended.
// 2. Account has been a loyal staker.
// 2. Account has maintained an eligible bonus status.
// 3. Rewards haven't expired.
let staked_period = staker_info.period_number();
ensure!(
Expand Down
4 changes: 2 additions & 2 deletions pallets/dapp-staking/src/test/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ fn stake_fails_due_to_too_many_staked_contracts() {
let account = 1;
assert_lock(account, 100 as Balance * max_number_of_contracts as Balance);

// Advance to build&earn subperiod so we ensure 'non-loyal' staking
// Advance to the build&earn subperiod to ensure staking without a bonus status.
advance_to_next_subperiod();

// Register smart contracts up to the max allowed number
Expand Down Expand Up @@ -1333,7 +1333,7 @@ fn move_fails_due_to_too_many_staked_contracts() {
let account = 1;
assert_lock(account, 100 as Balance * max_number_of_contracts as Balance);

// Advance to build&earn subperiod so we ensure 'non-loyal' staking
// Advance to the build&earn subperiod to ensure staking without a bonus status.
advance_to_next_subperiod();

let source_contract = MockSmartContract::Wasm(1);
Expand Down
2 changes: 1 addition & 1 deletion pallets/dapp-staking/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl PeriodInfo {
/// Struct with relevant information for a finished period.
#[derive(Encode, Decode, MaxEncodedLen, Clone, Copy, Debug, PartialEq, Eq, TypeInfo)]
pub struct PeriodEndInfo {
/// Bonus reward pool allocated for 'loyal' stakers
/// Bonus reward pool allocated for eligible stakers with a non-null bonus status
#[codec(compact)]
pub(crate) bonus_reward_pool: Balance,
/// Total amount staked (remaining) from the voting subperiod.
Expand Down
2 changes: 1 addition & 1 deletion pallets/inflation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ pub struct InflationConfiguration {
/// This is provided to the stakers according to formula: 'pool * min(1, total_staked / ideal_staked)'.
#[codec(compact)]
pub adjustable_staker_reward_pool_per_era: Balance,
/// Bonus reward pool per period, for loyal stakers.
/// Bonus reward pool per period, for eligible stakers.
#[codec(compact)]
pub bonus_reward_pool_per_period: Balance,
/// The ideal staking rate, in respect to total issuance.
Expand Down
2 changes: 1 addition & 1 deletion precompiles/dapp-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ where
Ok(true)
}

/// Attempts to claim bonus reward for being a loyal staker of the given dApp.
/// Attempts to claim a bonus reward for maintaining an eligible bonus status with the given dApp.
#[precompile::public("claim_bonus_reward((uint8,bytes))")]
fn claim_bonus_reward(
handle: &mut impl PrecompileHandle,
Expand Down

0 comments on commit 433f5d0

Please sign in to comment.