resolved beta clippy issues in DKG contract

This commit is contained in:
Jędrzej Stuczyński
2024-10-16 16:16:22 +01:00
parent 24773f68a4
commit 973d51eeec
2 changed files with 2 additions and 3 deletions
@@ -57,10 +57,9 @@ pub fn try_advance_epoch_state(deps: DepsMut<'_>, env: Env) -> Result<Response,
// if we're advancing into dealing exchange, we need to set the threshold value based on the number of registered dealers
if next_state.is_dealing_exchange() {
// note: ceiling in integer division can be achieved via q = (x + y - 1) / y;
let registered_dealers = current_epoch.state_progress.registered_dealers as u64;
// set the threshold to 2/3 amount of registered dealers
let threshold = (2 * registered_dealers + 3 - 1) / 3;
let threshold = (2 * registered_dealers).div_ceil(3);
// update current threshold values
THRESHOLD.save(deps.storage, &threshold)?;
@@ -16,7 +16,7 @@ pub(crate) struct VkShareIndex<'a> {
pub(crate) epoch_id: MultiIndex<'a, EpochId, ContractVKShare, VKShareKey<'a>>,
}
impl<'a> IndexList<ContractVKShare> for VkShareIndex<'a> {
impl IndexList<ContractVKShare> for VkShareIndex<'_> {
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<ContractVKShare>> + '_> {
let v: Vec<&dyn Index<ContractVKShare>> = vec![&self.epoch_id];
Box::new(v.into_iter())