Skip to content

Commit ee85494

Browse files
committed
Dkg GetRequest over CommitteeId instead of Round
1 parent e84830a commit ee85494

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

timeboost-sequencer/src/decrypt.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type DecSharesCache = BTreeMap<RoundNumber, HashMap<Round, Vec<Vec<Option<DecSha
3838
#[derive(Debug, Serialize, Deserialize)]
3939
enum Protocol {
4040
/// A request to retrieve a subset identified by the committee id.
41-
GetRequest(Round),
41+
GetRequest(CommitteeId),
4242

4343
/// The direct reply to a get request.
4444
GetResponse(SubsetResponse),
@@ -576,9 +576,8 @@ impl Worker {
576576
}
577577

578578
/// A get request for DKG subset has been received.
579-
async fn on_get_request(&mut self, src: PublicKey, round: Round) -> Result<()> {
580-
let (round_num, committee_id) = round.into_parts();
581-
trace!(node = %self.label, from=%src, %committee_id, round=%round_num, "received get_request");
579+
async fn on_get_request(&mut self, src: PublicKey, committee_id: CommitteeId) -> Result<()> {
580+
trace!(node = %self.label, from=%src, %committee_id, "received get_request");
582581

583582
if !matches!(self.dkg_state, DkgState::Completed(_)) {
584583
return Err(DecrypterError::Dkg(
@@ -604,13 +603,13 @@ impl Worker {
604603
};
605604

606605
let response = SubsetResponse {
607-
round,
606+
committee_id,
608607
subset: Subset::new(committee_id, subset.to_vec()),
609608
};
610609
self.net
611610
.unicast(
612611
src,
613-
*round_num,
612+
0, // Minimal round number since API requires it
614613
serialize(&Protocol::GetResponse(response))?,
615614
)
616615
.await
@@ -621,9 +620,11 @@ impl Worker {
621620

622621
/// A get response for DKG subset has been received.
623622
async fn on_get_response(&mut self, src: PublicKey, res: SubsetResponse) -> Result<()> {
624-
let SubsetResponse { round, subset } = res;
625-
let (round_num, committee_id) = round.into_parts();
626-
trace!(node = %self.label, from=%src, %committee_id, round=%round_num, "received get_response");
623+
let SubsetResponse {
624+
committee_id,
625+
subset,
626+
} = res;
627+
trace!(node = %self.label, from=%src, %committee_id, "received get_response");
627628

628629
let DkgState::Pending(ref mut subsets) = self.dkg_state else {
629630
trace!("received get_response but not in a recovering state");
@@ -833,10 +834,9 @@ impl Worker {
833834

834835
/// The node will always try to catchup with the help of remote nodes first.
835836
async fn dkg_catchup(&mut self) -> Result<()> {
836-
let round = self.first_requested_round.unwrap_or_default();
837-
let req = Protocol::GetRequest(Round::new(round, self.current));
837+
let req = Protocol::GetRequest(self.current);
838838
self.net
839-
.broadcast(round.u64(), serialize(&req)?)
839+
.broadcast(0, serialize(&req)?) // placeholder round value, ignored by receiver
840840
.await
841841
.map_err(|e| DecrypterError::End(e.into()))?;
842842
Ok(())
@@ -1180,7 +1180,7 @@ impl DecShareBatch {
11801180
/// A response with the agreed-upon subset of dealings.
11811181
#[derive(Clone, Debug, Serialize, Deserialize)]
11821182
struct SubsetResponse {
1183-
round: Round,
1183+
committee_id: CommitteeId,
11841184
subset: Subset,
11851185
}
11861186

0 commit comments

Comments
 (0)