Skip to content

refactor: extract KeyGenerationResult message from GenerateKeyResponse#7

Merged
maximedrn merged 2 commits intomasterfrom
dev
Apr 11, 2026
Merged

refactor: extract KeyGenerationResult message from GenerateKeyResponse#7
maximedrn merged 2 commits intomasterfrom
dev

Conversation

@maximedrn
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 11, 2026 11:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the gRPC GenerateKey response shape by extracting a dedicated KeyGenerationResult message and nesting it under GenerateKeyResponse.result, updating the worker processor and documentation accordingly.

Changes:

  • Update GenerateKeyResponse in both protobuf and TypeScript types to wrap key material in result: KeyGenerationResult.
  • Adjust key-generation queue processor to read publicKey / publicKeyPackage from response.result.
  • Tweak README API docs (add Algorithm enum reference link; remove section separators).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/queue/key-generation.processor.ts Updates processor to consume the new nested GenerateKeyResponse.result shape.
src/grpc/grpc.types.ts Introduces KeyGenerationResult and refactors GenerateKeyResponse to reference it.
proto/engine/v1/engine.proto Extracts KeyGenerationResult message and nests it under GenerateKeyResponse.
README.md Adds Algorithm enum documentation link and adjusts markdown formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +73 to +77
const publicKey: string = Buffer.from(
result.value.result.publicKey,
).toString("hex");
const publicKeyPackage: string = Buffer.from(
result.value.publicKeyPackage,
result.value.result.publicKeyPackage,
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GenerateKeyResponse is now expected to contain a nested result message. This PR updates the processor, but existing unit tests/mocks still return the old shape { publicKey, publicKeyPackage } (e.g. src/queue/key-generation.processor.spec.ts), which will make the test suite fail. Update the mocks (and any other call sites) to return { result: { publicKey, publicKeyPackage } } instead.

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +51
/** Generated public key and public key package. */
KeyGenerationResult result = 1;
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the wire shape of GenerateKeyResponse from two top-level bytes fields to a nested message (result). That is a breaking protobuf change: older clients will interpret field 1 as raw bytes of the embedded message (not the canonical public key) and will fail in non-obvious ways. If backward compatibility matters, keep the original fields (deprecated) alongside the new result, or introduce a new RPC / service version instead of changing the existing response shape.

Suggested change
/** Generated public key and public key package. */
KeyGenerationResult result = 1;
/**
* Canonical public key bytes.
* Deprecated: prefer result.public_key. Kept for wire compatibility with
* older clients.
*/
bytes public_key = 1 [deprecated = true];
/**
* Opaque protocol-internal serialization of the public key package.
* Deprecated: prefer result.public_key_package. Kept for wire compatibility
* with older clients.
*/
bytes public_key_package = 2 [deprecated = true];
/** Generated public key and public key package. */
KeyGenerationResult result = 3;

Copilot uses AI. Check for mistakes.
Comment on lines +112 to 114
- `Algorithm`: see [documentation](https://shreeed-app.github.io/multi-party-computation-controller-api/enums/grpc_grpc.types.Algorithm.html) for possible enum values.

**Response:** `202 Accepted`
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README still documents the engine's GenerateKey response as { publicKey, publicKeyPackage } in the key-generation Mermaid sequence diagram, but the proto/types in this PR now wrap those fields under result. Please update the diagram (and any other references) to match the new response shape to avoid misleading API consumers.

Copilot uses AI. Check for mistakes.
@maximedrn maximedrn merged commit cc5e00f into master Apr 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants