feat: CON-1391 Introduce payload field for early remote NiDKG transcripts #8644
+426
−77
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.
Background
Remote NiDKG requests (i.e. for subnet recovery/creation) currently take anywhere between 1 and 2 DKG intervals of the source subnet to complete. This is because once a request is made, the corresponding NiDKG config will be included only in the following summary block, and the final transcript is only created in the subsequent summary block.
We can reduce this latency by creating and delivering the transcripts already as part of a data block, as soon as enough dealings are available on the blockchain.
Proposed Changes
To prepare for this change, this PR proposes to introduce a new field to the
DkgDataPayload. This field will hold the result of remote transcript creations, analogous to how it is already done for summary payloads.Additionally, we add unit tests and make the folllowing refactorings which will be helpful for implementing the functionality later:
get_dkg_dealings, which returns all dealings on the blockchain, now excludes dealings of DKGs for which there is already a completed transcript in one of the data blocks. The excluded DKG IDs are returned.extract_from_dkg_dealing_messageswhich avoids cloning dealings when called fromget_dealers_from_chainNote that for now, payloads containing a non-empty remote early transcripts field are rejected. Therefore, this PR does not change the current functionality yet.