-
Notifications
You must be signed in to change notification settings - Fork 3
Do not recycle presignatures #697
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f4691f8
do not recycle presignatures
volovyks 24874e3
Merge branch 'develop' into serhii/do-not-recycle-presignatures
volovyks 59808b8
add .vscode to gitignore
volovyks feb9b13
clippy
volovyks 33a4e10
Merge branch 'develop' into serhii/do-not-recycle-presignatures
volovyks 568fa99
merge develop
volovyks 9b7091b
Merge branch 'develop' into serhii/do-not-recycle-presignatures
volovyks 7a8815b
extend comment
volovyks dba03ff
Merge branch 'develop' into serhii/do-not-recycle-presignatures
volovyks d5eb909
Merge branch 'develop' into serhii/do-not-recycle-presignatures
volovyks 860e90f
Merge branch 'develop' into serhii/do-not-recycle-presignatures
volovyks c355c10
Merge branch 'develop' into serhii/do-not-recycle-presignatures
volovyks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -557,10 +557,6 @@ impl TripleSpawner { | |
| /// Generate new triples if this node owns fewer than the per-node minimum | ||
| /// (`min_triples`) and the network-wide total hasn't reached the cap (`max_triples`). | ||
| async fn stockpile(&mut self, participants: &[Participant], cfg: &ProtocolConfig) { | ||
| if participants.len() < self.threshold { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check is already done before calling the stockpile() function |
||
| return; | ||
| } | ||
|
|
||
| let not_enough_triples = { | ||
| // Network-wide cap: stop generating once total potential triples reach max_triples. | ||
| if self.len_potential().await >= cfg.triple.max_triples as usize { | ||
|
|
@@ -590,6 +586,7 @@ impl TripleSpawner { | |
|
|
||
| let mut active = mesh_state.borrow().active().keys_vec(); | ||
| let mut protocol = cfg.borrow().protocol.clone(); | ||
| let mut last_active_warn = None; | ||
|
|
||
| loop { | ||
| tokio::select! { | ||
|
|
@@ -618,22 +615,28 @@ impl TripleSpawner { | |
| self.ongoing_introduced.remove(&id); | ||
| let _ = ongoing_gen_tx.send(self.ongoing.len()); | ||
| } | ||
| _ = stockpile_interval.tick(), if active.len() >= self.threshold => { | ||
| self.stockpile(&active, &protocol).await; | ||
| let _ = ongoing_gen_tx.send(self.ongoing.len()); | ||
|
|
||
| crate::metrics::storage::NUM_TRIPLES_MINE | ||
|
|
||
| .set(self.len_mine().await as i64); | ||
| crate::metrics::storage::NUM_TRIPLES_TOTAL | ||
|
|
||
| .set(self.triple_storage.len_generated().await as i64); | ||
| crate::metrics::protocols::NUM_TRIPLE_GENERATORS_INTRODUCED | ||
|
|
||
| .set(self.len_introduced() as i64); | ||
| crate::metrics::protocols::NUM_TRIPLE_GENERATORS_TOTAL | ||
|
|
||
| .set(self.len_ongoing() as i64); | ||
| _ = stockpile_interval.tick() => { | ||
| if active.len() >= self.threshold { | ||
| last_active_warn = None; | ||
| self.stockpile(&active, &protocol).await; | ||
| let _ = ongoing_gen_tx.send(self.ongoing.len()); | ||
|
|
||
| crate::metrics::storage::NUM_TRIPLES_MINE | ||
| .set(self.len_mine().await as i64); | ||
| crate::metrics::storage::NUM_TRIPLES_TOTAL | ||
| .set(self.triple_storage.len_generated().await as i64); | ||
| crate::metrics::protocols::NUM_TRIPLE_GENERATORS_INTRODUCED | ||
| .set(self.len_introduced() as i64); | ||
| crate::metrics::protocols::NUM_TRIPLE_GENERATORS_TOTAL | ||
| .set(self.len_ongoing() as i64); | ||
| } else if last_active_warn.is_none_or(|i: Instant| i.elapsed() > Duration::from_secs(60)) { | ||
| tracing::warn!( | ||
| ?active, | ||
| threshold = self.threshold, | ||
| "not enough active participants to generate triples" | ||
| ); | ||
| last_active_warn = Some(Instant::now()); | ||
| } | ||
| } | ||
| Ok(()) = cfg.changed() => { | ||
| protocol = cfg.borrow().protocol.clone(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Logic is the same here. I've only added logging.