Skip to content

Commit

Permalink
secret-sharing/src/churp: Decouple switch points and handoff kind
Browse files Browse the repository at this point in the history
  • Loading branch information
peternose committed Sep 10, 2024
1 parent 97e7ffd commit ba02052
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 139 deletions.
36 changes: 11 additions & 25 deletions secret-sharing/src/churp/handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,9 @@ where
return Err(Error::NotEnoughShareholders.into());
}

let share_distribution = DimensionSwitch::new_full_share_distribution(
threshold,
me,
shareholders,
HandoffKind::DealingPhase,
)?;
let zero_hole = HandoffKind::DealingPhase.require_zero_hole();
let share_distribution =
DimensionSwitch::new_full_share_distribution(threshold, zero_hole, me, shareholders)?;

share_distribution.skip_accumulating()?;
share_distribution.start_merging(None)?;
Expand Down Expand Up @@ -232,12 +229,9 @@ where
return Err(Error::NotEnoughShareholders.into());
}

let share_distribution = DimensionSwitch::new_full_share_distribution(
threshold,
me,
shareholders,
HandoffKind::CommitteeUnchanged,
)?;
let zero_hole = HandoffKind::CommitteeUnchanged.require_zero_hole();
let share_distribution =
DimensionSwitch::new_full_share_distribution(threshold, zero_hole, me, shareholders)?;

share_distribution.skip_accumulating()?;

Expand Down Expand Up @@ -296,19 +290,11 @@ where
return Err(Error::NotEnoughShareholders.into());
}

let share_reduction = DimensionSwitch::new_share_reduction(
threshold,
me,
shareholders,
HandoffKind::CommitteeChanged,
)?;

let share_distribution = DimensionSwitch::new_full_share_distribution(
threshold,
me,
Vec::new(), // Skip proactivization.
HandoffKind::CommitteeChanged,
)?;
let zero_hole = HandoffKind::CommitteeChanged.require_zero_hole();
let share_reduction =
DimensionSwitch::new_share_reduction(threshold, zero_hole, me, shareholders)?;
let share_distribution =
DimensionSwitch::new_full_share_distribution(threshold, zero_hole, me, Vec::new())?;

Ok(Self {
share_reduction,
Expand Down
Loading

0 comments on commit ba02052

Please sign in to comment.