feat: CON-1445 Helper functions to create NiDkgConfigs from request contexts#9926
Merged
feat: CON-1445 Helper functions to create NiDkgConfigs from request contexts#9926
NiDkgConfigs from request contexts#9926Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an (currently unused) internal module to derive remote NiDKG configs directly from replicated-state request contexts, enabling remote DKG work to begin before the next summary block is produced.
Changes:
- Added
build_callback_id_config_mapto derive per-callback remote DKG config results fromReplicatedStateand the latestDkgSummary, including timeout handling viainitial_dkg_attempts. - Added
merge_configsto combine summary-derived configs with context-derived configs (successes only). - Refactored
create_remote_dkg_config_for_key_idto accept a transcript lookup function and widened visibility of a few helper functions for reuse.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
rs/consensus/dkg/src/remote.rs |
New module with remote-context→config derivation + merge helper and unit tests. |
rs/consensus/dkg/src/payload_builder.rs |
Adjusted remote config creation API (closure-based transcript lookup) and made helper functions pub(crate) for reuse. |
rs/consensus/dkg/src/lib.rs |
Added remote module to the crate with a module-level #[allow(dead_code)]. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NiDkgConfigs from request contexts
fspreiss
approved these changes
Apr 21, 2026
pierugo-dfinity
approved these changes
Apr 22, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, configs for Remote DKG requests were only created and included as part of summary blocks. This implies that a request has to wait until the end of the current interval to even be started.
This PR introduces two new functions that will be used to start working on remote DKG requests as soon as they appear in the replicated state.
build_callback_id_config_mapThis function iterates over all remote DKG request contexts and attempts to derive the corresponding DKG configs. This is done by using the start height of the most recent summary block. In case of malformed inputs, errors are returned instead.
One special aspect is the use of the
initial_dkg_attemptsmap, which is maintained by the summary payload. Entries of this map are incremented whenever there is still an outstanding request context in the replicated state, when the summary block is created. If the number of attempts exceeds the maximum, the new function will generate a timeout error instead. Furthermore, we will use this map to track remote DKG requests that have been completed as part of the previous interval. Target IDs for such requests will be inserted into this map with a count of 0. This ensures that they will not be attempted again in the subsequent interval.merge_configsThis function takes configs from the recent summary, and merges them with configs derived from the latest state using
build_callback_id_config_map. The output represents the combined set of configs for currently ongoing DKGs.Note that the new functions are still unused.