Skip to content

Commit

Permalink
deadlock? uwu
Browse files Browse the repository at this point in the history
  • Loading branch information
distractedm1nd committed Sep 21, 2024
1 parent 3b6a5a0 commit cf85467
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/common/src/hashchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Hashchain {
.find_map(|entry| match entry.operation.clone() {
Operation::RevokeKey(args) if args.value == key => Some(true),
Operation::AddKey(args) if args.value == key => Some(false),
Operation::CreateAccount(args) if args.value == key => Some(true),
Operation::CreateAccount(args) if args.value == key => Some(false),
_ => None,
})
.unwrap_or(false)
Expand Down
6 changes: 6 additions & 0 deletions crates/common/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,11 @@ mod tests {

let mut account = tree_state.create_account("key_1".to_string());
tree_state.insert_account(account.clone()).unwrap();

// Add a new key
tree_state.add_key_to_account(&mut account).unwrap();

// Update the account using the correct key index
let update_proof = tree_state.update_account(account.clone()).unwrap();
assert!(update_proof.verify().is_ok());

Expand Down Expand Up @@ -519,6 +522,7 @@ mod tests {
tree_state.add_key_to_account(&mut account1).unwrap();
tree_state.add_key_to_account(&mut account2).unwrap();

// Update accounts using the correct key indices
tree_state.update_account(account1.clone()).unwrap();
tree_state.update_account(account2.clone()).unwrap();

Expand All @@ -539,12 +543,14 @@ mod tests {
test_tree.insert_account(account_1.clone()).unwrap();

test_tree.add_key_to_account(&mut account_1).unwrap();
// Update account_1 using the correct key index
test_tree.update_account(account_1.clone()).unwrap();

test_tree.insert_account(account_2.clone()).unwrap();

test_tree.add_key_to_account(&mut account_2).unwrap();

// Update account_2 using the correct key index
let last_proof = test_tree.update_account(account_2.clone()).unwrap();

assert_eq!(
Expand Down
6 changes: 2 additions & 4 deletions crates/prism/src/node_types/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,11 @@ mod tests {

Operation::AddKey(KeyOperationArgs {
id: id.to_string(),
value: dbg!(new_key),
value: new_key,
signature: SignatureBundle {
key_idx,
signature: signing_key
.sign(&dbg!(
bincode::serialize(&operation_without_signature).unwrap()
))
.sign(&bincode::serialize(&operation_without_signature).unwrap())
.to_vec(),
},
})
Expand Down

0 comments on commit cf85467

Please sign in to comment.