-
Notifications
You must be signed in to change notification settings - Fork 51
Initial commit for reworked select k indices function. #2733
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
base: main
Are you sure you want to change the base?
Conversation
Test Results 3 files - 1 141 suites - 23 48m 3s ⏱️ + 24m 31s Results for commit e3c2b19. ± Comparison against base commit 9f90c66. This pull request removes 98 and adds 112 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
| use std::collections::{BTreeMap, HashMap, HashSet}; | ||
| use std::time::Instant; | ||
|
|
||
| use rug::integer::IsPrime; |
Check warning
Code scanning / clippy
unused import: rug::integer::IsPrime Warning
| let mut removal_idx_by_vk: HashMap<&SingleSignatureWithRegisteredParty, Vec<Index>> = | ||
| HashMap::new(); | ||
|
|
||
| let mut basic_verif_time = 0; |
Check warning
Code scanning / clippy
variable basic_verif_time is assigned to, but never used Warning
| HashMap::new(); | ||
|
|
||
| let mut basic_verif_time = 0; | ||
| let now = Instant::now(); |
Check warning
Code scanning / clippy
unused variable: now Warning
| let mut dedup_sigs: HashSet<SingleSignatureWithRegisteredParty> = HashSet::new(); | ||
| let mut count: u64 = 0; | ||
|
|
||
| let now = Instant::now(); |
Check warning
Code scanning / clippy
unused variable: now Warning
| msg: &[u8], | ||
| sigs: &[SingleSignatureWithRegisteredParty], | ||
| ) -> Result<Vec<SingleSignatureWithRegisteredParty>, AggregationError> { | ||
| let now = Instant::now(); |
Check warning
Code scanning / clippy
unused variable: now Warning
| let (idx_by_mtidx, btm) = Self::get_k_indices(total_stake, params, msg, sigs); | ||
| // println!("First function took: {:?}ms.", now.elapsed().as_millis()); | ||
|
|
||
| let now = Instant::now(); |
Check warning
Code scanning / clippy
unused variable: now Warning
| msg: &[u8], | ||
| sigs: &[SingleSignatureWithRegisteredParty], | ||
| ) -> Result<Vec<SingleSignatureWithRegisteredParty>, AggregationError> { | ||
| let now = Instant::now(); |
Check warning
Code scanning / clippy
unused variable: now Warning
| let btm = Self::get_k_indices_opti(total_stake, params, msg, sigs); | ||
| // println!("First function OPTI? took: {:?}ms.\n", now.elapsed().as_millis()); | ||
|
|
||
| let now = Instant::now(); |
Check warning
Code scanning / clippy
unused variable: now Warning
| sig_by_mt_index: BTreeMap<Index, &SingleSignatureWithRegisteredParty>, | ||
| ) -> Result<Vec<SingleSignatureWithRegisteredParty>, AggregationError> { | ||
| let mut valid_idx_for_mt_idx: HashMap<u64, Vec<u64>> = HashMap::new(); | ||
| let mut valid_idx_for_sig: HashMap<&SingleSignatureWithRegisteredParty, Vec<u64>> = HashMap::new(); |
Check warning
Code scanning / clippy
variable does not need to be mutable Warning
| sig_by_mt_index: BTreeMap<Index, &SingleSignatureWithRegisteredParty>, | ||
| ) -> Result<Vec<SingleSignatureWithRegisteredParty>, AggregationError> { | ||
| let mut valid_idx_for_mt_idx: HashMap<u64, Vec<u64>> = HashMap::new(); | ||
| let mut valid_idx_for_sig: HashMap<&SingleSignatureWithRegisteredParty, Vec<u64>> = HashMap::new(); |
Check warning
Code scanning / clippy
unused variable: valid_idx_for_sig Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Content
This PR includes a new function to perform the selection of k unique indices for the aggregated signature of mithril-stm. The goal of the new function is to improve readability and performances (memory and time) if possible.
Pre-submit checklist
Comments
Issue(s)
Relates to #YYY or Closes #YYY