Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(strategy-tests): add extra_keys field for StartIdentities and use random identities for transfers #1794

Merged
merged 9 commits into from
Mar 29, 2024

Conversation

pauldelucia
Copy link
Member

@pauldelucia pauldelucia commented Mar 21, 2024

Issue being fixed or feature implemented

We might want Strategy StartIdentities to have transfer keys or other extra keys in addition to the main keys. Also, there was an issue with public key IDs in transitions.rs.

What was done?

We add an extra_keys field similar to that in IdentityInserts and fix the issue in transitions.rs.

How Has This Been Tested?

Platform TUI strategy tests

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Comment on lines 1333 to 1346
// Make sure we insert a key for transfers
let mut key_maps: KeyMaps = [(
Purpose::TRANSFER,
[(SecurityLevel::CRITICAL, vec![KeyType::ECDSA_SECP256K1])].into(),
)]
.into();
let mut new_key_count = self.start_identities.keys_per_identity - 1;

// Also an authentication key with critical security level for documents
key_maps.insert(
Purpose::AUTHENTICATION,
[(SecurityLevel::CRITICAL, vec![KeyType::ECDSA_SECP256K1])].into(),
);
new_key_count -= 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I on purpose didn't want to add the transfer key to all identities.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I added extra_keys field for StartIdentities struct and the users can select whether or not to add a transfer key in the TUI

Comment on lines 421 to 423
for identity in &identities {
identity_nonce_counter.insert(identity.id(), 1);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this means we would start things at 2.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (removed it because it wasn't necessary)

@pauldelucia pauldelucia changed the title fix: make sure newly created identities have proper keys for strategy feat: add extra_keys field for Strategy StartIdentities Mar 25, 2024
@pauldelucia pauldelucia changed the title feat: add extra_keys field for Strategy StartIdentities feat(strategies): add extra_keys field for StartIdentities and use random identities for transfers Mar 25, 2024
@pauldelucia pauldelucia changed the title feat(strategies): add extra_keys field for StartIdentities and use random identities for transfers feat(strategy-tests): add extra_keys field for StartIdentities and use random identities for transfers Mar 25, 2024
}

// Select a random identity from the current_identities for the sender
let random_index_sender = thread_rng().gen_range(0..identities_count);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you want to use rng, so that tests are determinisitic based on the seed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Changed to rng

@QuantumExplorer QuantumExplorer merged commit b8fd57d into v1.0-dev Mar 29, 2024
17 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/strategy-test-updates branch March 29, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants