Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ impl DistributionFunction {
return Ok(*distribution_start_amount);
}

let steps_passed = (x - s_val) / (*step_count as u64);
let era_intervals_passed = (x - s_val) / (*step_count as u64);
let max_intervals = max_interval_count.unwrap_or(
DEFAULT_STEP_DECREASING_AMOUNT_MAX_CYCLES_BEFORE_TRAILING_DISTRIBUTION,
) as u64;

if steps_passed > max_intervals {
if era_intervals_passed > max_intervals {
return Ok(*trailing_distribution_interval_amount);
}

Expand All @@ -86,7 +86,7 @@ impl DistributionFunction {
let reduction_numerator =
denominator.saturating_sub(*decrease_per_interval_numerator as u64);

for _ in 0..steps_passed {
for _ in 0..era_intervals_passed {
numerator = numerator * reduction_numerator / denominator;
}

Expand All @@ -101,9 +101,12 @@ impl DistributionFunction {
Ok(result)
}
DistributionFunction::Stepwise(steps) => {
if x < contract_registration_step {
return Ok(0);
}
// Return the emission corresponding to the greatest key <= x.
Ok(steps
.range(..=x)
.range(..=(x - contract_registration_step))
.next_back()
.map(|(_, amount)| *amount)
.unwrap_or(0))
Expand Down
1 change: 1 addition & 0 deletions packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3658,6 +3658,7 @@ mod tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3662,6 +3662,7 @@ mod creation_tests {
None::<fn(&mut TokenConfiguration)>,
None,
None,
None,
platform_version,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mod token_burn_tests {
None::<fn(&mut TokenConfiguration)>,
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -110,6 +111,7 @@ mod token_burn_tests {
None::<fn(&mut TokenConfiguration)>,
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -202,6 +204,7 @@ mod token_burn_tests {
None::<fn(&mut TokenConfiguration)>,
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -321,6 +324,7 @@ mod token_burn_tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -582,6 +586,7 @@ mod token_burn_tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ mod token_config_update_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -145,6 +146,7 @@ mod token_config_update_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -291,6 +293,7 @@ mod token_config_update_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -400,6 +403,7 @@ mod token_config_update_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -553,6 +557,7 @@ mod token_config_update_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -643,6 +648,7 @@ mod token_config_update_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -733,6 +739,7 @@ mod token_config_update_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -829,6 +836,7 @@ mod token_config_update_tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -949,6 +957,7 @@ mod token_config_update_tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -1065,6 +1074,7 @@ mod token_config_update_tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -1279,6 +1289,7 @@ mod token_config_update_tests {
]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -1669,6 +1680,7 @@ mod token_config_update_tests {
]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -2130,6 +2142,7 @@ mod token_config_update_tests {
]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -2879,6 +2892,7 @@ mod token_config_update_tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ mod token_selling_tests {
)]
.into(),
),
None,
platform_version,
);

Expand Down Expand Up @@ -268,6 +269,7 @@ mod token_selling_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -386,6 +388,7 @@ mod token_selling_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -619,6 +622,7 @@ mod token_selling_tests {
}),
None,
None,
None,
platform_version,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mod perpetual_distribution_block {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -298,6 +299,7 @@ mod perpetual_distribution_block {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -419,6 +421,7 @@ mod perpetual_distribution_block {
}),
None,
None,
None,
platform_version,
);

Expand Down Expand Up @@ -2695,6 +2698,7 @@ mod test_suite {
token_config_fn,
self.start_time,
None,
None,
self.platform_version,
);

Expand Down
Loading
Loading