Skip to content

chore: remove traits with single implementors - #891

Open
dvdplm wants to merge 5 commits into
mainfrom
dvdplm/refactor/drop-single-impl-traits
Open

dvdplm wants to merge 5 commits into
mainfrom
dvdplm/refactor/drop-single-impl-traits

Conversation

@dvdplm

@dvdplm dvdplm commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Noticed that we have a series of traits that have a single implementor.

This PR removes 11 such traits:

EpochManager
UserDecryptor
PublicDecryptor
KeyGenerator
InsecureKeyGenerator
KeyGenPreprocessor
CrsGenerator
InsecureCrsGenerator
BackupOperator
BaseKms
Kms

This is a mechanical change, nothing exciting.

Git history says the traits were added to enable mocking in tests but the last such test was removed a year ago. This should be safe to do.

@dvdplm
dvdplm requested a review from a team as a code owner September 25, 2026 10:57
@cla-bot cla-bot Bot added the cla-signed The CLA has been signed. label Sep 25, 2026
@dvdplm dvdplm self-assigned this Sep 25, 2026
@dvdplm
dvdplm requested a lite review from Copilot September 25, 2026 10:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unresolved public API removals and the backup operator visibility issue must be addressed.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 3 Medium severity

Open (4)
What changed in this PR

This PR replaces single-implementor service traits with concrete KMS components and updates their wiring.

Changes:

  • Replaces trait dispatch with inherent methods.
  • Simplifies centralized and threshold KMS generics.
  • Updates endpoints, tests, server setup, and architecture documentation.
File Summary
core/​service/​src/​engine/​traits.rs Removes service traits, including public BaseKms and Kms APIs.
core/​service/​src/​engine/​threshold/​traits.rs Removes threshold service traits.
core/​service/​src/​engine/​threshold/​threshold_kms.rs Uses concrete threshold components.
core/​service/​src/​engine/​threshold/​service/​user_decryptor.rs Converts decryptor methods to inherent methods.
core/​service/​src/​engine/​threshold/​service/​public_decryptor.rs Converts decryptor methods to inherent methods.
core/​service/​src/​engine/​threshold/​service/​preprocessor.rs Converts preprocessing methods to inherent methods.
core/​service/​src/​engine/​threshold/​service/​mod.rs Adjusts service module visibility.
core/​service/​src/​engine/​threshold/​service/​kms_impl.rs Removes the public RealThresholdKms alias.
core/​service/​src/​engine/​threshold/​service/​key_generator.rs Converts key generation methods to inherent methods.
core/​service/​src/​engine/​threshold/​service/​epoch_manager.rs Converts epoch methods to inherent methods.
core/​service/​src/​engine/​threshold/​service/​crs_generator.rs Converts CRS methods to inherent methods.
core/​service/​src/​engine/​threshold/​mod.rs Removes the threshold traits module.
core/​service/​src/​engine/​threshold/​endpoint.rs Dispatches directly to concrete services.
core/​service/​src/​engine/​centralized/​service/​preprocessing.rs Simplifies centralized service generics.
core/​service/​src/​engine/​centralized/​service/​mod.rs Updates centralized test types.
core/​service/​src/​engine/​centralized/​service/​key_gen.rs Simplifies key-generation service generics.
core/​service/​src/​engine/​centralized/​service/​initiator.rs Simplifies initiator service generics.
core/​service/​src/​engine/​centralized/​service/​decryption.rs Simplifies decryption service generics.
core/​service/​src/​engine/​centralized/​service/​crs_gen.rs Simplifies CRS service generics.
core/​service/​src/​engine/​centralized/​endpoint.rs Simplifies the centralized endpoint implementation.
core/​service/​src/​engine/​centralized/​central_kms.rs Uses concrete components and removes the public RealCentralizedKms alias.
core/​service/​src/​engine/​base.rs Removes obsolete base trait delegation.
core/​service/​src/​engine/​backup_operator.rs Converts backup operations to inherent methods; public construction remains while operations are crate-private.
core/​service/​src/​client/​tests/​threshold/​misc_tests.rs Updates threshold service type references.
core/​service/​src/​client/​tests/​centralized/​misc_tests.rs Updates centralized service type references.
core/​service/​src/​client/​test_tools.rs Updates test infrastructure types.
core/​service/​src/​bin/​kms-server.rs Uses the concrete centralized KMS type.
ai-docs/​ARCHITECTURE.md Updates the centralized KMS reference.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/service/src/engine/backup_operator.rs
Comment thread core/service/src/engine/centralized/central_kms.rs
Comment thread core/service/src/engine/threshold/service/kms_impl.rs
Comment thread core/service/src/engine/traits.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It removes additional public traits and compatibility aliases beyond the stated scope.

Review effort: Balanced
Findings: 1 High severity · 3 Medium severity

Open (4)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The refactor rewires both service modes and feature-gated endpoint dispatch across 28 files, so final human validation is warranted.

Review effort: Balanced
Findings: None

Resolved since last review (4)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants