Skip to content

Commit a1589cc

Browse files
committed
Address comments.
1 parent a06216f commit a1589cc

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

timeboost-builder/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ serde = { workspace = true }
2222
smallvec = { workspace = true }
2323
thiserror = { workspace = true }
2424
timeboost-types = { path = "../timeboost-types" }
25+
timeboost-utils = { path = "../timeboost-utils" }
2526
tokio = { workspace = true }
2627
tokio-util = { workspace = true }
2728
tracing = { workspace = true }

timeboost-builder/src/certifier.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use multisig::{
1616
use smallvec::SmallVec;
1717
use timeboost_types::sailfish::{CommitteeVec, NodeInfo, Round, RoundNumber};
1818
use timeboost_types::{Block, BlockInfo, BlockNumber, CertifiedBlock};
19+
use timeboost_utils::keyset::CERTIFIER_PORT_OFFSET;
1920
use tokio::select;
2021
use tokio::spawn;
2122
use tokio::sync::mpsc::{Receiver, Sender, channel};
@@ -170,7 +171,7 @@ fn translate_addr(c: AddressableCommittee) -> AddressableCommittee {
170171
let shifted_entries = c
171172
.entries()
172173
.map(|(pk, dh, addr)| {
173-
let cert_port = addr.port().saturating_add(2000);
174+
let cert_port = addr.port().saturating_add(CERTIFIER_PORT_OFFSET);
174175
let new_addr = addr.with_port(cert_port);
175176
(pk, dh, new_addr)
176177
})

timeboost-sequencer/src/decrypt.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use timeboost_types::{
2323
AccumulatorMode, DecryptionKey, DecryptionKeyCell, DkgAccumulator, DkgBundle, DkgSubset,
2424
InclusionList, KeyStore, KeyStoreVec,
2525
};
26+
use timeboost_utils::keyset::DECRYPTER_PORT_OFFSET;
2627
use tokio::spawn;
2728
use tokio::sync::mpsc::{Receiver, Sender, channel};
2829
use tokio::task::{JoinError, JoinHandle};
@@ -80,15 +81,14 @@ impl NextKey {
8081

8182
/// Next committee state.
8283
#[derive(Default)]
83-
#[allow(clippy::large_enum_variant)]
8484
enum NextCommittee {
8585
/// No next committee is scheduled.
8686
#[default]
8787
None,
8888
/// The next committee should become effective at the given round.
8989
///
9090
/// Key material is supplied if member of both current and next.
91-
Use(Round, Option<NextKey>),
91+
Use(Round, Option<Box<NextKey>>),
9292
/// The old committee should be removed when the given round is garbage collected.
9393
Del(Round),
9494
}
@@ -377,7 +377,7 @@ fn translate_addr(c: AddressableCommittee) -> AddressableCommittee {
377377
let shifted_entries = c
378378
.entries()
379379
.map(|(pk, dh, addr)| {
380-
let dec_port = addr.port().saturating_add(1000);
380+
let dec_port = addr.port().saturating_add(DECRYPTER_PORT_OFFSET);
381381
let new_addr = addr.with_port(dec_port);
382382
(pk, dh, new_addr)
383383
})
@@ -1240,7 +1240,7 @@ impl Worker {
12401240
.map_err(|e| DecrypterError::Dkg(format!("key extraction failed: {e}")))?;
12411241

12421242
self.next_committee =
1243-
NextCommittee::Use(round, Some(NextKey::new(new_dkg_sk, new_dec_key)));
1243+
NextCommittee::Use(round, Some(Box::new(NextKey::new(new_dkg_sk, new_dec_key))));
12441244
trace!(node = %self.label, %round, "completed key extraction");
12451245
} else {
12461246
// not in new committee - request DKG subset from current committee
@@ -1297,9 +1297,9 @@ impl Worker {
12971297
.map_err(|_: NetworkDown| EndOfPlay::NetworkDown)?;
12981298

12991299
// update keys if also member of next committee
1300-
if let Some(NextKey { dkg_key, dec_key }) = next_key {
1301-
self.dec_key.set(dec_key.clone());
1302-
self.dkg_sk = dkg_key.clone();
1300+
if let Some(next_key) = next_key.as_ref() {
1301+
self.dec_key.set(next_key.dec_key.clone());
1302+
self.dkg_sk = next_key.dkg_key.clone();
13031303
}
13041304
self.current = start.committee();
13051305
self.next_committee = NextCommittee::Del(*start);

0 commit comments

Comments
 (0)