Skip to content

Commit

Permalink
fix(paseo): adjust inflation values for multiplier_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
al3mart committed Nov 18, 2024
1 parent 41617f4 commit c204f46
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions relay/paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ impl pallet_staking::EraPayout<Balance> for EraPayout {
let relative_era_len =
FixedU128::from_rational(era_duration_millis.into(), MILLISECONDS_PER_YEAR.into());

// TI at the time of execution of [Referendum 1139](https://paseo.subsquare.io/referenda/1139), block hash: `0x39422610299a75ef69860417f4d0e1d94e77699f45005645ffc5e8e619950f9f`.
let fixed_total_issuance: i128 = 15_011_657_390_566_252_333;
// TI at the time of execution of [Referendum 1139](https://polkadot.subsquare.io/referenda/1139), block hash: `0x39422610299a75ef69860417f4d0e1d94e77699f45005645ffc5e8e619950f9f`.
let fixed_total_issuance: i128 = 1_487_502_468_008_283_162;
let fixed_inflation_rate = FixedU128::from_rational(8, 100);
let yearly_emission = fixed_inflation_rate.saturating_mul_int(fixed_total_issuance);

Expand Down Expand Up @@ -3236,12 +3236,12 @@ mod multiplier_tests {
);

// Values are within 0.1%
assert_relative_eq!(to_stakers as f64, (279_477 * UNITS) as f64, max_relative = 0.001);
assert_relative_eq!(to_treasury as f64, (49_320 * UNITS) as f64, max_relative = 0.001);
// Total per day is ~328,797 PAS
assert_relative_eq!(to_stakers as f64, (27_693 * UNITS) as f64, max_relative = 0.001);
assert_relative_eq!(to_treasury as f64, (4_887 * UNITS) as f64, max_relative = 0.001);
// Total per day is ~32,580 PAS
assert_relative_eq!(
(to_stakers as f64 + to_treasury as f64),
(328_797 * UNITS) as f64,
(32_580 * UNITS) as f64,
max_relative = 0.001
);
}
Expand All @@ -3257,12 +3257,12 @@ mod multiplier_tests {

assert_relative_eq!(
to_stakers as f64,
(279_477 * UNITS) as f64 * 2.0,
(27_693 * UNITS) as f64 * 2.0,
max_relative = 0.001
);
assert_relative_eq!(
to_treasury as f64,
(49_320 * UNITS) as f64 * 2.0,
(4_887 * UNITS) as f64 * 2.0,
max_relative = 0.001
);
}
Expand All @@ -3275,8 +3275,8 @@ mod multiplier_tests {
(36525 * MILLISECONDS_PER_DAY) / 100, // 1 year
);

// Our yearly emissions is about 120M PAS:
let yearly_emission = 120_093_259 * UNITS;
// Our yearly emissions is about 12M PAS:
let yearly_emission = 11_909_325 * UNITS;
assert_relative_eq!(
to_stakers as f64 + to_treasury as f64,
yearly_emission as f64,
Expand All @@ -3299,13 +3299,13 @@ mod multiplier_tests {
456, // ignored
(36525 * MILLISECONDS_PER_DAY) / 10, // 10 years
);
let initial_ti: i128 = 15_011_657_390_566_252_333;
let initial_ti: i128 = 1_487_502_468_008_283_162;
let projected_total_issuance = (to_stakers as i128 + to_treasury as i128) + initial_ti;

// In 2034, there will be about 2.7 billion PAS in existence.
// In 2034, there will be about 267 million PAS in existence.
assert_relative_eq!(
projected_total_issuance as f64,
(2_700_000_000 * UNITS) as f64,
(267_750_000 * UNITS) as f64,
max_relative = 0.001
);
}
Expand All @@ -3319,7 +3319,7 @@ mod multiplier_tests {
(36525 * MILLISECONDS_PER_DAY) / 100, // 1 year
);
let yearly_emission = to_stakers + to_treasury;
let mut ti: i128 = 15_011_657_390_566_252_333;
let mut ti: i128 = 1_487_502_468_008_283_162;

for y in 0..10 {
let new_ti = ti + yearly_emission as i128;
Expand Down

0 comments on commit c204f46

Please sign in to comment.