Skip to content

Commit 8ae45f4

Browse files
committed
remove debugging printlns
1 parent 6b83e03 commit 8ae45f4

File tree

1 file changed

+31
-32
lines changed
  • pallets/mining/rewards-allowance/src

1 file changed

+31
-32
lines changed

pallets/mining/rewards-allowance/src/lib.rs

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub mod pallet {
3939
traits::{
4040
Currency,
4141
ExistenceRequirement,
42-
GenesisBuild,
4342
},
4443
};
4544
use frame_system::pallet_prelude::*;
@@ -479,7 +478,7 @@ pub mod pallet {
479478
}
480479
}
481480
log::info!("requested_date_as_u64: {:?}", requested_date_as_u64.clone());
482-
println!("requested_date_as_u64: {:?}", requested_date_as_u64.clone());
481+
// println!("requested_date_as_u64: {:?}", requested_date_as_u64.clone());
483482

484483
// do not run when block number is 1, which is when timestamp is 0 because this
485484
// timestamp corresponds to 1970-01-01
@@ -498,7 +497,7 @@ pub mod pallet {
498497
}
499498
}
500499
log::info!("start_of_requested_date_millis: {:?}", start_of_requested_date_millis.clone());
501-
println!("start_of_requested_date_millis: {:?}", start_of_requested_date_millis.clone());
500+
// println!("start_of_requested_date_millis: {:?}", start_of_requested_date_millis.clone());
502501

503502
// https://substrate.dev/rustdocs/latest/frame_support/storage/trait.StorageMap.html
504503
let contains_key = <RewardsAllowanceDHXForDateRemaining<T>>::contains_key(&start_of_requested_date_millis);
@@ -584,7 +583,7 @@ pub mod pallet {
584583
min_bonded_dhx_daily_default_u128 = x.1;
585584
}
586585
}
587-
println!("min_bonded_dhx_daily_default_u128: {:?}", min_bonded_dhx_daily_default_u128.clone());
586+
// println!("min_bonded_dhx_daily_default_u128: {:?}", min_bonded_dhx_daily_default_u128.clone());
588587

589588
let mut min_mpower_daily_default: u128 = 5u128;
590589
if let Some(_min_mpower_daily_default) = <MinMPowerDailyDefault<T>>::get() {
@@ -615,14 +614,14 @@ pub mod pallet {
615614
log::info!("rm_next_period_days: {:?}", &rm_next_period_days);
616615
log::info!("rm_current_period_days_remaining: {:?}", &rm_current_period_days_remaining);
617616

618-
println!("rm_paused: {:?}", &rm_paused);
619-
println!("rm_reset: {:?}", &rm_reset);
620-
println!("rm_default_change: {:?}", &rm_default_change);
621-
println!("rm_current_change: {:?}", &rm_current_change);
622-
println!("rm_next_change: {:?}", &rm_next_change);
623-
println!("rm_default_period_days: {:?}", &rm_default_period_days);
624-
println!("rm_next_period_days: {:?}", &rm_next_period_days);
625-
println!("rm_current_period_days_remaining: {:?}", &rm_current_period_days_remaining);
617+
// println!("rm_paused: {:?}", &rm_paused);
618+
// println!("rm_reset: {:?}", &rm_reset);
619+
// println!("rm_default_change: {:?}", &rm_default_change);
620+
// println!("rm_current_change: {:?}", &rm_current_change);
621+
// println!("rm_next_change: {:?}", &rm_next_change);
622+
// println!("rm_default_period_days: {:?}", &rm_default_period_days);
623+
// println!("rm_next_period_days: {:?}", &rm_next_period_days);
624+
// println!("rm_current_period_days_remaining: {:?}", &rm_current_period_days_remaining);
626625

627626
// pause the process of automatically changing to the next period change and next period day
628627
// until unpaused again by governance
@@ -671,7 +670,7 @@ pub mod pallet {
671670
if rm_current_period_days_remaining.1 != start_of_requested_date_millis.clone() {
672671
// if there are still days remaining in the countdown
673672
if rm_current_period_days_remaining.3 > 0u32 {
674-
println!("[reducing_multiplier_days] block: {:#?}, date_start: {:#?} remain_days: {:#?}", _n, rm_current_period_days_remaining.0, rm_current_period_days_remaining.3);
673+
// println!("[reducing_multiplier_days] block: {:#?}, date_start: {:#?} remain_days: {:#?}", _n, rm_current_period_days_remaining.0, rm_current_period_days_remaining.3);
675674
let old_rm_current_period_days_remaining = rm_current_period_days_remaining.3.clone();
676675

677676
// Subtract, handling overflow
@@ -700,7 +699,7 @@ pub mod pallet {
700699
log::info!("Reduced RewardsMultiplierCurrentPeriodDaysRemaining {:?} {:?}", start_of_requested_date_millis.clone(), new_rm_current_period_days_remaining.clone());
701700
} else {
702701
// if no more days remaining
703-
println!("[reducing_multiplier_days] no more remaining days");
702+
// println!("[reducing_multiplier_days] no more remaining days");
704703

705704
// run an operation with the the next change and the current min bonded dhx daily to determine the
706705
// new min. bonded dhx daily for the next period
@@ -718,7 +717,7 @@ pub mod pallet {
718717
min_bonded_dhx_daily_u128 = x.1;
719718
}
720719
}
721-
println!("min_bonded_dhx_daily_u128: {:?}", min_bonded_dhx_daily_u128.clone());
720+
// println!("min_bonded_dhx_daily_u128: {:?}", min_bonded_dhx_daily_u128.clone());
722721

723722
let rewards_multipler_operation;
724723
if let Some(_rewards_multipler_operation) = <RewardsMultiplierOperation<T>>::get() {
@@ -730,7 +729,7 @@ pub mod pallet {
730729

731730
let mut new_min_bonded_dhx_daily_u128 = 0u128; // initialize
732731

733-
println!("rewards_multipler_operation: {:?}", rewards_multipler_operation.clone());
732+
// println!("rewards_multipler_operation: {:?}", rewards_multipler_operation.clone());
734733

735734
// prepare for 'add' operation
736735

@@ -755,10 +754,10 @@ pub mod pallet {
755754
rm_next_change_as_fixedu128 = x;
756755
}
757756
}
758-
println!("rm_next_change_as_fixedu128: {:?}", rm_next_change_as_fixedu128.clone());
757+
// println!("rm_next_change_as_fixedu128: {:?}", rm_next_change_as_fixedu128.clone());
759758
// round down the fixed point number to the nearest integer of type u128
760759
let rm_next_change_u128: u128 = rm_next_change_as_fixedu128.floor().to_num::<u128>();
761-
println!("rm_next_change_u128: {:?}", rm_next_change_as_fixedu128.clone());
760+
// println!("rm_next_change_u128: {:?}", rm_next_change_as_fixedu128.clone());
762761

763762
// case of addition
764763
if rewards_multipler_operation == 1u8 {
@@ -783,7 +782,7 @@ pub mod pallet {
783782
return 0;
784783
}
785784

786-
println!("new_min_bonded_dhx_daily_u128 {:?}", new_min_bonded_dhx_daily_u128);
785+
// println!("new_min_bonded_dhx_daily_u128 {:?}", new_min_bonded_dhx_daily_u128);
787786

788787
let new_min_bonded_dhx_daily;
789788
let _new_min_bonded_dhx_daily = Self::convert_u128_to_balance(new_min_bonded_dhx_daily_u128.clone());
@@ -797,11 +796,11 @@ pub mod pallet {
797796
}
798797
}
799798
log::info!("new_min_bonded_dhx_daily: {:?}", new_min_bonded_dhx_daily.clone());
800-
println!("new_min_bonded_dhx_daily: {:?}", new_min_bonded_dhx_daily.clone());
799+
// println!("new_min_bonded_dhx_daily: {:?}", new_min_bonded_dhx_daily.clone());
801800

802801
<MinBondedDHXDaily<T>>::put(new_min_bonded_dhx_daily.clone());
803802
log::info!("New MinBondedDHXDaily {:?} {:?}", start_of_requested_date_millis.clone(), new_min_bonded_dhx_daily_u128.clone());
804-
println!("New MinBondedDHXDaily {:?} {:?}", start_of_requested_date_millis.clone(), new_min_bonded_dhx_daily_u128.clone());
803+
// println!("New MinBondedDHXDaily {:?} {:?}", start_of_requested_date_millis.clone(), new_min_bonded_dhx_daily_u128.clone());
805804

806805
// FIXME - can we automatically change the next period days value to (~90 days depending on days in included months 28, 29, 30, or 31)
807806
// depending on the date? and do this from genesis too?
@@ -849,7 +848,7 @@ pub mod pallet {
849848
}
850849
}
851850
log::info!("new_min_bonded_dhx_daily: {:?}", new_min_bonded_dhx_daily.clone());
852-
println!("new_min_bonded_dhx_daily: {:?}", new_min_bonded_dhx_daily.clone());
851+
// println!("new_min_bonded_dhx_daily: {:?}", new_min_bonded_dhx_daily.clone());
853852
}
854853
}
855854
}
@@ -899,7 +898,7 @@ pub mod pallet {
899898
let mut locks_first_amount_as_u128 = default_bonded_amount_u128.clone();
900899
let locked_vec = <pallet_balances::Pallet<T>>::locks(miner.clone()).into_inner();
901900
if locked_vec.len() != 0 {
902-
println!("locked_vec: {:?}", locked_vec);
901+
// println!("locked_vec: {:?}", locked_vec);
903902
let locks_first_amount: <T as pallet_balances::Config>::Balance =
904903
<pallet_balances::Pallet<T>>::locks(miner.clone()).into_inner().clone()[0].amount;
905904

@@ -1052,7 +1051,7 @@ pub mod pallet {
10521051
is_bonding_min_dhx == true &&
10531052
has_min_mpower_daily == true
10541053
{
1055-
println!("[reducing_days] block: {:#?}, miner: {:#?}, date_start: {:#?} remain_days: {:#?}", _n, miner_count, start_of_requested_date_millis, cooling_off_period_days_remaining);
1054+
// println!("[reducing_days] block: {:#?}, miner: {:#?}, date_start: {:#?} remain_days: {:#?}", _n, miner_count, start_of_requested_date_millis, cooling_off_period_days_remaining);
10561055
let old_cooling_off_period_days_remaining = cooling_off_period_days_remaining.1.clone();
10571056

10581057
// we cannot do this because of error: cannot use the `?` operator in a method that returns `()`
@@ -1097,7 +1096,7 @@ pub mod pallet {
10971096
is_bonding_min_dhx == true &&
10981097
has_min_mpower_daily == true
10991098
{
1100-
println!("[eligible] block: {:#?}, miner: {:#?}, date_start: {:#?} remain_days: {:#?}", _n, miner_count, start_of_requested_date_millis, cooling_off_period_days_remaining);
1099+
// println!("[eligible] block: {:#?}, miner: {:#?}, date_start: {:#?} remain_days: {:#?}", _n, miner_count, start_of_requested_date_millis, cooling_off_period_days_remaining);
11011100

11021101
// we need to add that they are eligible for rewards on the current date too
11031102
<CoolingOffPeriodDaysRemaining<T>>::insert(
@@ -1147,7 +1146,7 @@ pub mod pallet {
11471146
}
11481147
}
11491148
log::info!("daily_reward_for_miner_as_u128: {:?}", daily_reward_for_miner_as_u128.clone());
1150-
println!("[eligible] block: {:#?}, miner: {:#?}, date_start: {:#?} daily_reward_for_miner_as_u128: {:#?}", _n, miner_count, start_of_requested_date_millis, daily_reward_for_miner_as_u128);
1149+
// println!("[eligible] block: {:#?}, miner: {:#?}, date_start: {:#?} daily_reward_for_miner_as_u128: {:#?}", _n, miner_count, start_of_requested_date_millis, daily_reward_for_miner_as_u128);
11511150

11521151
// if we have a rewards_aggregated_dhx_daily of 25.133 k DHX, then after the above manipulation
11531152
// since we're dealing with a mixture of u128 and BalanceOf<T> so the values are more readable in the UI.
@@ -1208,7 +1207,7 @@ pub mod pallet {
12081207
}
12091208

12101209
log::info!("new_rewards_aggregated_dhx_daily_as_u128: {:?}", new_rewards_aggregated_dhx_daily_as_u128.clone());
1211-
println!("[eligible] block: {:#?}, miner: {:#?}, date_start: {:#?} new_rewards_aggregated_dhx_daily_as_u128: {:#?}", _n, miner_count, start_of_requested_date_millis, new_rewards_aggregated_dhx_daily_as_u128);
1210+
// println!("[eligible] block: {:#?}, miner: {:#?}, date_start: {:#?} new_rewards_aggregated_dhx_daily_as_u128: {:#?}", _n, miner_count, start_of_requested_date_millis, new_rewards_aggregated_dhx_daily_as_u128);
12121211

12131212
let new_rewards_aggregated_dhx_daily;
12141213
let _new_rewards_aggregated_dhx_daily = Self::convert_u128_to_balance(new_rewards_aggregated_dhx_daily_as_u128.clone());
@@ -1240,10 +1239,10 @@ pub mod pallet {
12401239
);
12411240
log::info!("Added RewardsAccumulatedDHXForMinerForDate for miner {:?} {:?} {:?}", start_of_requested_date_millis.clone(), miner.clone(), daily_reward_for_miner.clone());
12421241

1243-
println!("date: {:?}, miner_count: {:?}, reg_dhx_miners.len: {:?}", start_of_requested_date_millis.clone(), miner_count.clone(), reg_dhx_miners.len());
1242+
// println!("date: {:?}, miner_count: {:?}, reg_dhx_miners.len: {:?}", start_of_requested_date_millis.clone(), miner_count.clone(), reg_dhx_miners.len());
12441243
// if last miner being iterated then reset for next day
12451244
if reg_dhx_miners.len() == miner_count {
1246-
println!("date: {:?}, rewards_allowance_dhx_daily: {:?}", start_of_requested_date_millis.clone(), rewards_allowance_dhx_daily.clone());
1245+
// println!("date: {:?}, rewards_allowance_dhx_daily: {:?}", start_of_requested_date_millis.clone(), rewards_allowance_dhx_daily.clone());
12471246

12481247
// reset to latest set by governance
12491248
<RewardsAllowanceDHXForDateRemaining<T>>::insert(start_of_requested_date_millis.clone(), rewards_allowance_dhx_daily.clone());
@@ -1316,7 +1315,7 @@ pub mod pallet {
13161315
),
13171316
);
13181317

1319-
println!("[reduce] block: {:#?}, miner: {:#?}, date_start: {:#?} new_cooling_off_period_days_remaining: {:#?}", _n, miner_count, start_of_requested_date_millis, new_cooling_off_period_days_remaining);
1318+
// println!("[reduce] block: {:#?}, miner: {:#?}, date_start: {:#?} new_cooling_off_period_days_remaining: {:#?}", _n, miner_count, start_of_requested_date_millis, new_cooling_off_period_days_remaining);
13201319
log::info!("Unbonded miner. Reducing cooling down period dates remaining {:?} {:?}", miner.clone(), new_cooling_off_period_days_remaining.clone());
13211320

13221321
// if cooling_off_period_days_remaining.0 is not the start of the current date
@@ -1346,7 +1345,7 @@ pub mod pallet {
13461345
}
13471346

13481347
log::info!("Finished initial loop of registered miners");
1349-
println!("Finished initial loop of registered miners");
1348+
// println!("Finished initial loop of registered miners");
13501349

13511350
// TODO - consider the miner's mPower that we have fetched. it should have been added earlier above
13521351
// to the aggregated (all miners for that day) and accumulated (specific miner for a day) rewards
@@ -2113,7 +2112,7 @@ pub mod pallet {
21132112
min_bonded_dhx_daily_u128 = x.1;
21142113
}
21152114
}
2116-
println!("Reset to the min. bonded DHX daily default");
2115+
// println!("Reset to the min. bonded DHX daily default");
21172116
}
21182117
// Return a successful DispatchResultWithPostInfo
21192118
Ok(

0 commit comments

Comments
 (0)