Skip to content

Commit eba5efd

Browse files
committed
correct misnomer: enc_key for DecryptionKeyCell
1 parent affd510 commit eba5efd

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

tests/src/tests/timeboost.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ where
104104
.decrypt_committee((decrypt_committee.clone(), key_store.clone()))
105105
.recover(recover_index.map(|r| r == i).unwrap_or(false))
106106
.leash_len(100)
107-
.threshold_enc_key(enc_key.clone())
107+
.threshold_dec_key(enc_key.clone())
108108
.chain_config(ChainConfig::new(
109109
1,
110110
"https://theserversroom.com/ethereum/54cmzzhcj1o/"

tests/src/tests/timeboost/handover.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ where
152152
)
153153
.recover(false)
154154
.leash_len(100)
155-
.threshold_enc_key(enc_key.clone())
155+
.threshold_dec_key(enc_key.clone())
156156
.chain_config(ChainConfig::new(
157157
1,
158158
"https://theserversroom.com/ethereum/54cmzzhcj1o/"

timeboost-sequencer/src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub struct SequencerConfig {
5252
pub(crate) leash_len: usize,
5353

5454
/// Atomic cell holding the threshold encryption key post DKG.
55-
pub(crate) threshold_enc_key: DecryptionKeyCell,
55+
pub(crate) threshold_dec_key: DecryptionKeyCell,
5656

5757
/// Chain configuration
5858
pub(crate) chain_config: ChainConfig,
@@ -99,8 +99,8 @@ impl SequencerConfig {
9999
self.recover
100100
}
101101

102-
pub fn enc_key(&self) -> &DecryptionKeyCell {
103-
&self.threshold_enc_key
102+
pub fn dec_key(&self) -> &DecryptionKeyCell {
103+
&self.threshold_dec_key
104104
}
105105

106106
/// Derive an RBC config from this sequencer config.
@@ -124,7 +124,7 @@ impl SequencerConfig {
124124
.committee(self.decrypt_committee.clone())
125125
.maybe_prev_committee(self.previous_decrypt_committee.clone())
126126
.retain(self.leash_len)
127-
.threshold_enc_key(self.threshold_enc_key.clone())
127+
.threshold_dec_key(self.threshold_dec_key.clone())
128128
.build()
129129
}
130130
}
@@ -137,6 +137,6 @@ pub struct DecrypterConfig {
137137
pub(crate) dkg_key: DkgDecKey,
138138
pub(crate) committee: (AddressableCommittee, KeyStore),
139139
pub(crate) prev_committee: Option<(AddressableCommittee, KeyStore)>,
140-
pub(crate) threshold_enc_key: DecryptionKeyCell,
140+
pub(crate) threshold_dec_key: DecryptionKeyCell,
141141
pub(crate) retain: usize,
142142
}

timeboost-sequencer/src/decrypt.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub struct Decrypter {
9797
/// Worker task handle.
9898
worker: JoinHandle<EndOfPlay>,
9999
/// Pending threshold encryption key material
100-
enc_key: DecryptionKeyCell,
100+
dec_key: DecryptionKeyCell,
101101
/// Key stores (shared with Worker)
102102
key_stores: Arc<RwLock<KeyStoreVec<2>>>,
103103
/// Current committee.
@@ -169,7 +169,7 @@ impl Decrypter {
169169
.state(state)
170170
.tx(dec_tx)
171171
.rx(cmd_rx)
172-
.enc_key(cfg.threshold_enc_key.clone())
172+
.dec_key(cfg.threshold_dec_key.clone())
173173
.retain(cfg.retain)
174174
.build();
175175

@@ -179,7 +179,7 @@ impl Decrypter {
179179
worker_tx: cmd_tx,
180180
worker_rx: dec_rx,
181181
worker: spawn(worker.go()),
182-
enc_key: cfg.threshold_enc_key,
182+
dec_key: cfg.threshold_dec_key,
183183
key_stores: key_stores.clone(),
184184
current,
185185
metrics: seq_metrics,
@@ -193,7 +193,7 @@ impl Decrypter {
193193

194194
/// Garbage collect cached state of `r` and prior rounds.
195195
pub async fn gc(&mut self, r: RoundNumber) -> StdResult<(), DecrypterDown> {
196-
if self.enc_key.get_ref().is_some() {
196+
if self.dec_key.get_ref().is_some() {
197197
self.worker_tx
198198
.send(Command::Gc(r))
199199
.await
@@ -273,7 +273,7 @@ impl Decrypter {
273273
return None;
274274
};
275275

276-
let Some(dec_sk) = self.enc_key.get() else {
276+
let Some(dec_sk) = self.dec_key.get() else {
277277
warn!(node = %self.label, committee = %committee_id, "no existing key to reshare");
278278
return None;
279279
};
@@ -429,8 +429,8 @@ struct Worker {
429429
/// Channel for receiving commands from the parent.
430430
rx: Receiver<Command>,
431431

432-
/// Pending encryption key that will be updated after DKG/resharing is done.
433-
enc_key: DecryptionKeyCell,
432+
/// Pending decryption key that will be updated after DKG/resharing is done.
433+
dec_key: DecryptionKeyCell,
434434

435435
/// First round where an inclusion list was received (ignore shares for earlier rounds).
436436
first_requested_round: Option<RoundNumber>,
@@ -735,7 +735,7 @@ impl Worker {
735735
.result()
736736
.map_err(|e| DecrypterError::Dkg(e.to_string()))?;
737737

738-
self.enc_key.set(dec_sk.clone());
738+
self.dec_key.set(dec_sk.clone());
739739
self.state = WorkerState::Running;
740740
info!(node = %self.label, committee_id = %committee.id(), "dkg finished (catchup successful)");
741741
}
@@ -805,7 +805,7 @@ impl Worker {
805805

806806
info!(committee_id = %committee.id(), node = %self.label, "handover finished");
807807
self.state = WorkerState::HandoverComplete;
808-
self.enc_key.set(next_dec_key);
808+
self.dec_key.set(next_dec_key);
809809
self.dkg_completed.insert(committee.id());
810810
}
811811

@@ -885,7 +885,7 @@ impl Worker {
885885
.result()
886886
.map_err(|e| DecrypterError::Dkg(e.to_string()))?;
887887

888-
self.enc_key.set(dec_sk);
888+
self.dec_key.set(dec_sk);
889889
self.state = WorkerState::Running;
890890
self.dkg_completed.insert(committee.id());
891891
info!(committee_id = %committee.id(), node = %self.label, "dkg finished");
@@ -904,7 +904,7 @@ impl Worker {
904904
);
905905
return Ok(());
906906
}
907-
let Some(dec_key) = self.enc_key.get() else {
907+
let Some(dec_key) = self.dec_key.get() else {
908908
warn!(
909909
node = %self.label,
910910
committee_id = %cid,
@@ -1127,7 +1127,7 @@ impl Worker {
11271127
incl.round()
11281128
)));
11291129
}
1130-
_ => self.enc_key.get().ok_or_else(|| {
1130+
_ => self.dec_key.get().ok_or_else(|| {
11311131
DecrypterError::Internal("Worker running without dec key".to_string())
11321132
})?,
11331133
};
@@ -1219,7 +1219,7 @@ impl Worker {
12191219
let dec_sk = match &self.state {
12201220
WorkerState::Running
12211221
| WorkerState::ResharingComplete(_)
1222-
| WorkerState::ShuttingDown => self.enc_key.get().ok_or_else(|| {
1222+
| WorkerState::ShuttingDown => self.dec_key.get().ok_or_else(|| {
12231223
DecrypterError::Internal("Worker running without dec key".to_string())
12241224
})?,
12251225
_ => {
@@ -1436,7 +1436,7 @@ impl Worker {
14361436
}
14371437
WorkerState::ResharingComplete(next_key) => {
14381438
info!(node = %self.label, committee = %self.current, "(old node) successful committee switch");
1439-
self.enc_key.set(next_key.clone());
1439+
self.dec_key.set(next_key.clone());
14401440
WorkerState::Running
14411441
}
14421442
WorkerState::ShuttingDown => {
@@ -1862,7 +1862,7 @@ mod tests {
18621862
// Verify all committee members derive the same public encryption keys
18631863
let generated_keys = try_join_all(
18641864
setup
1865-
.enc_keys()
1865+
.dec_keys()
18661866
.iter()
18671867
.map(|cell| async { Ok::<_, ()>(cell.read().await) }),
18681868
)
@@ -1928,11 +1928,11 @@ mod tests {
19281928

19291929
enqueue_all_dkg_bundles(&mut com1_decrypters, None).await;
19301930

1931-
for cell in com1_setup.enc_keys() {
1931+
for cell in com1_setup.dec_keys() {
19321932
cell.read().await;
19331933
}
19341934

1935-
let encryption_key = com1_setup.enc_keys()[0]
1935+
let encryption_key = com1_setup.dec_keys()[0]
19361936
.get()
19371937
.expect("encryption key should be generated after DKG");
19381938

@@ -1951,7 +1951,7 @@ mod tests {
19511951
enqueue_all_dkg_bundles(&mut com1_decrypters, Some(com2_setup.key_store().clone())).await;
19521952

19531953
// make sure that all nodes in COM2 consider resharing complete
1954-
for cell in com2_setup.enc_keys() {
1954+
for cell in com2_setup.dec_keys() {
19551955
cell.read().await;
19561956
}
19571957

@@ -2059,11 +2059,11 @@ mod tests {
20592059
enqueue_all_dkg_bundles(&mut decrypters, None).await;
20602060
}
20612061

2062-
for cell in setup.enc_keys() {
2062+
for cell in setup.dec_keys() {
20632063
cell.read().await;
20642064
}
20652065

2066-
let encryption_key = setup.enc_keys()[0]
2066+
let encryption_key = setup.dec_keys()[0]
20672067
.get()
20682068
.expect("encryption key should be generated after DKG");
20692069

@@ -2269,29 +2269,29 @@ mod tests {
22692269

22702270
#[derive(Clone)]
22712271
struct DecrypterSetup {
2272-
enc_keys: Vec<DecryptionKeyCell>,
2272+
dec_keys: Vec<DecryptionKeyCell>,
22732273
addr_comm: AddressableCommittee,
22742274
key_store: KeyStore,
22752275
sig_keys: Vec<SecretKey>,
22762276
}
22772277

22782278
impl DecrypterSetup {
22792279
pub fn new(
2280-
enc_keys: Vec<DecryptionKeyCell>,
2280+
dec_keys: Vec<DecryptionKeyCell>,
22812281
addr_comm: AddressableCommittee,
22822282
key_store: KeyStore,
22832283
sig_keys: Vec<SecretKey>,
22842284
) -> Self {
22852285
Self {
2286-
enc_keys,
2286+
dec_keys,
22872287
addr_comm,
22882288
key_store,
22892289
sig_keys,
22902290
}
22912291
}
22922292

2293-
pub fn enc_keys(&self) -> &Vec<DecryptionKeyCell> {
2294-
&self.enc_keys
2293+
pub fn dec_keys(&self) -> &Vec<DecryptionKeyCell> {
2294+
&self.dec_keys
22952295
}
22962296

22972297
pub fn addr_comm(&self) -> &AddressableCommittee {
@@ -2389,7 +2389,7 @@ mod tests {
23892389
.map(|s| (s.addr_comm().clone(), s.key_store().clone())),
23902390
)
23912391
.retain(RETAIN_ROUNDS)
2392-
.threshold_enc_key(encryption_key_cell.clone())
2392+
.threshold_dec_key(encryption_key_cell.clone())
23932393
.build();
23942394

23952395
let decrypter = Decrypter::new(

timeboost/src/binaries/timeboost.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ async fn main() -> Result<()> {
247247
.internal_api(my_keyset.internal_address.clone())
248248
.maybe_nitro_addr(my_keyset.nitro_addr.clone())
249249
.recover(is_recover)
250-
.threshold_enc_key(enc_key.clone())
250+
.threshold_dec_key(enc_key.clone())
251251
.robusta((
252252
robusta::Config::builder()
253253
.base_url(cli.espresso_base_url)

timeboost/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub struct TimeboostConfig {
5959
pub(crate) leash_len: usize,
6060

6161
/// Pending threshold encryption key that will be updated after DKG/resharing.
62-
pub(crate) threshold_enc_key: DecryptionKeyCell,
62+
pub(crate) threshold_dec_key: DecryptionKeyCell,
6363

6464
/// Configuration of espresso network client.
6565
pub(crate) robusta: (robusta::Config, Vec<robusta::Config>),
@@ -83,7 +83,7 @@ impl TimeboostConfig {
8383
.decrypt_committee((self.decrypt_committee.clone(), self.key_store.clone()))
8484
.recover(self.recover)
8585
.leash_len(self.leash_len)
86-
.threshold_enc_key(self.threshold_enc_key.clone())
86+
.threshold_dec_key(self.threshold_dec_key.clone())
8787
.chain_config(self.chain_config.clone())
8888
.build()
8989
}

0 commit comments

Comments
 (0)