Move ECDH public key setting to generateDKGPolyV3 - #529
Draft
PropzSaladaz wants to merge 3 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the DKG v3 flow to persist recipient-binding metadata (t/n + ordered recipient ECDH public keys) alongside the encrypted polynomial, introduces a getSecretShareV3 endpoint that derives recipients from that metadata (instead of caller-provided keys), and consolidates DKG-related cleanup into atomic LevelDB batch deletes. It also adds a generic LevelDB writeBatch() API to support atomic put/delete operations.
Changes:
- Added
LevelDB::writeBatch()for atomic multi-key put/delete commits, with an optional “require new keys” pre-check. - Updated DKG v3 polynomial generation to require
(n, publicKeys)and to persist polynomial + binding metadata atomically. - Added
getSecretShareV3(JSON-RPC + ZMQ) and updated cleanup paths to delete all DKG v3 artifacts (incl. metadata) via a single batch operation; updated tests/spec accordingly.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
zmq_src/ZMQMessage.h |
Adds ZMQ request type/enum for getSecretShareV3. |
zmq_src/ZMQMessage.cpp |
Wires GET_SECRET_SHARE_V3_REQ into request factory/map. |
zmq_src/ZMQClient.h |
Extends generateDKGPolyV3 signature; adds getSecretShareV3. |
zmq_src/ZMQClient.cpp |
Sends new params for generateDKGPolyV3; implements getSecretShareV3. |
zmq_src/ReqMessage.h |
Adds request message class for getSecretShareV3. |
zmq_src/ReqMessage.cpp |
Parses new generateDKGPolyV3 params; implements getSecretShareV3 request processing. |
WalletDBKeys.h |
Introduces DKG_META_V1_PREFIX for v3 binding metadata storage. |
testw.cpp |
Updates DKG v3 API tests to pass recipient keys to generation and use getSecretShareV3. |
TestUtils.cpp |
Updates DKG v3 rotation helpers to use new gen/signature and getSecretShareV3. |
stubclient.h |
Updates JSON-RPC client wrapper for new generateDKGPolyV3 params; adds getSecretShareV3. |
spec.json |
Documents updated generateDKGPolyV3 params and new getSecretShareV3 method. |
SGXWalletServer.hpp |
Updates server interface: new params for generateDKGPolyV3, adds getSecretShareV3. |
SGXWalletServer.cpp |
Implements metadata binding, atomic persistence, getSecretShareV3, and batch cleanup deletes. |
sgxwallet_common.h |
Adds new error codes for v3 pubkey validation and metadata mismatch cases. |
LevelDB.h |
Declares writeBatch() API. |
LevelDB.cpp |
Implements writeBatch() using LevelDB WriteBatch. |
abstractstubserver.h |
Updates JSON-RPC method signature for generateDKGPolyV3; registers getSecretShareV3. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PropzSaladaz
marked this pull request as draft
July 3, 2026 15:31
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.
Description
This PR updates DKG v3 persistence and cleanup paths to use atomic LevelDB batch operations and updates dkg flow into a safer version.
What changed:
generateSecretSharesV3call. The call now only requirespoly_name. No longer expects ECDH public keys.complaintResponse and createBLSPrivateKeyV3 cleanup now remove all DKG-related keys via a single atomic batch delete operation.
Cleanup includes DH keys, shareG2 entries, polynomial entry, encrypted secret share entry, and DKG metadata entry.
Please see https://github.com/skalenetwork/internal-support/issues/1474
Fixes https://github.com/skalenetwork/internal-support/issues/1475