Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions rust/lit-node/lit-node/src/tasks/fsm/epoch_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ pub(crate) async fn perform_epoch_change(
}
};

trace!("new_key_sets: {:?}", new_key_sets);
trace!("existing_key_sets: {:?}", existing_key_sets);

trace!("New/existing key sets: {:?} / {:?}", new_key_sets.iter().map(|ks| ks.identifier.clone()).collect::<Vec<_>>(), existing_key_sets.iter().map(|ks| ks.identifier.clone()).collect::<Vec<_>>());

// start by processing the epoch change for the new key sets
let mut epoch_change_res_or_update_needed_for_new_keys = None;
if !new_key_sets.is_empty() {
trace!("Processing epoch change for new key sets");
if current_peers != new_peers && !current_peers.is_empty() {
warn!(
"When creating a new set of root keys, current peers should be empty or equivalent to new peers. DKG will not be performed until the keyset is removed or the current peer set is equivalent to the new peer set."
Expand Down Expand Up @@ -145,6 +144,7 @@ pub(crate) async fn perform_epoch_change(
};
}

trace!("Processing epoch change for existing key sets");
let epoch_change_res_or_update_needed = match process_epoch_for_key_set(
dkg_manager,
fsm_worker_metadata.clone(),
Expand Down Expand Up @@ -391,7 +391,7 @@ pub async fn get_existing_and_new_key_sets(
}
Err(e) => {
// this is temporary until we have a proper way to get the root keys from the chain.
warn!("Error in getting root keys: {}", e);
warn!("Error in getting root keys, thus key set {} will be treated as a new key set: {}", keyset.identifier, e);
new_key_sets.push(keyset.clone());
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/lit-node/lit-node/src/tss/dkg/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl DkgManager {
DkgType::RecoveryParty => 1,
DkgType::Standard => hd_root_key_count,
};
let epoch_dkg_id = format!("{}.{}.{}", dkg_id, curve_type, self.dkg_type);
let epoch_dkg_id = format!("{}.{}.{}.{}", dkg_id, &key_set_config.identifier, curve_type, self.dkg_type);
let existing_root_keys = key_set_config
.root_keys_by_curve
.get(&curve_type)
Expand Down
11 changes: 7 additions & 4 deletions rust/lit-node/lit-node/tests/integration/keysets.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use super::signing::sign_with_each_curve_type;
use crate::common::ecdsa::simple_single_sign_with_hd_key;

use ethers::types::U256;
use lit_node_core::SigningScheme;
use lit_node_testnet::TestSetupBuilder;
use tracing::info;

Expand All @@ -15,10 +17,10 @@ pub async fn test_add_second_keyset() {
let pubkey = end_user.first_pkp().pubkey.clone();

let realm_id = U256::from(1);
let current_epoch = actions.get_current_epoch(realm_id).await;

// check to see that we can sign
sign_with_each_curve_type(&validator_collection, &end_user, pubkey.clone()).await;
let result = simple_single_sign_with_hd_key(&validator_collection, &end_user, pubkey.clone(), SigningScheme::EcdsaK256Sha256, &vec![]).await;
assert!(result, "Failed to sign with all nodes up.");

info!("**** Adding second keyset ****");
// add a second keyset
Expand All @@ -39,7 +41,8 @@ pub async fn test_add_second_keyset() {

actions.sleep_millis(2000).await;
// test signing
sign_with_each_curve_type(&validator_collection, &end_user, pubkey.clone()).await;
let result = simple_single_sign_with_hd_key(&validator_collection, &end_user, pubkey.clone(), SigningScheme::EcdsaK256Sha256, &vec![]).await;
assert!(result, "Failed to sign with all nodes up.");
}

actions.sleep_millis(2000000).await;
Expand Down