Skip to content

Conversation

@Mikerah
Copy link
Contributor

@Mikerah Mikerah commented Jan 16, 2026

Summary

This PR addresses review comments from PR #1 (MPCaaS implementation):

  • Default to maximum threshold for stronger security guarantees
  • Remove ConnectionType enum - unnecessary abstraction
  • Make preprocessing timeout configurable - with_preprocessing_timeout()
  • Remove ComputationComplete message - clients don't need completion signal
  • Remove PeerManager - replaced with direct Vec<(usize, SocketAddr)>

Commits

  1. 73f9a9d - Default to maximum threshold for stronger security
  2. f3b144c - Remove unnecessary ConnectionType enum
  3. 79a4f43 - Make preprocessing wait timeout configurable
  4. c35f0be - Remove ComputationComplete message
  5. 68ec11a - Remove PeerManager, use direct peer addresses

Test plan

  • All 67 tests pass (cargo test)
  • No clippy warnings (cargo clippy)

🤖 Generated with Claude Code

Mikerah and others added 5 commits January 13, 2026 00:55
Change threshold default from hardcoded 1 (minimum) to maximum fault
tolerance formula (n-1)/3, matching CLI behavior.

JUSTIFICATION: The threshold determines Byzantine fault tolerance - how
many malicious or crashed parties the protocol can tolerate. Defaulting
to maximum provides the strongest security guarantees by default.

Changes:
- Add `threshold: Option<usize>` field to StoffelServerBuilder
- Add `.with_threshold(t)` builder method for explicit override
- Calculate default threshold as (n-1)/3 for n >= 4, otherwise 1
- Add validation: n >= 3t+1 (HoneyBadger constraint)
- Add comprehensive unit tests for threshold calculation

Trade-off: Higher threshold increases preprocessing cost, but security
should not be silently compromised for performance. Users needing faster
preprocessing for development can explicitly opt-in via with_threshold(1).

Addresses PR #1 review comment 2 (line 338).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Incoming connections are always from clients (peer connections are
established outbound), so the ConnectionType enum and match statement
were unnecessary complexity.

Changes:
- Remove ConnectionType enum (dead Server variant was never used)
- Remove match wrapper in handle_incoming_connection
- Update function documentation to clarify it handles client connections
- Simplify code by removing extra indentation levels

Addresses PR #1 review comment (line 1020).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The hardcoded 30-second timeout for clients waiting for preprocessing
was arbitrary. Changed to a configurable timeout with a more reasonable
default of 60 seconds.

Changes:
- Add `preprocessing_wait_timeout` field to StoffelServerBuilder (default: 60s)
- Add `.with_preprocessing_wait_timeout(Duration)` builder method
- Pass timeout through StoffelServer to handle_incoming_connection
- Replace hardcoded 30s with configurable value

Example usage:
```rust
let server = Stoffel::server(0)
    .with_preprocessing_wait_timeout(Duration::from_secs(120))
    .build()?;
```

Addresses PR #1 review comment (line 1091).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
OutputMessage now serves as both output delivery and completion signal.
This simplifies the protocol by removing an unnecessary message type.

Changes:
- Remove ComputationComplete variant from MPCaaSMessage enum
- Update protocol documentation
- Remove ComputationComplete sending code in server.rs
- Client now triggers reconstruction when enough output shares received

Addresses PR #1 review comment 12.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PeerManager was acting as a container without actual connection logic.
Since STO-404 will unify networks using QuicNetworkManager directly,
remove PeerManager and store peer addresses as Vec<(usize, SocketAddr)>.

Changes:
- Delete src/mpcaas/peer_manager.rs
- Update server.rs to use peer_addresses directly
- Remove PeerManager exports from mod.rs and prelude.rs
- Update CLAUDE.md module structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Mikerah Mikerah requested a review from cadaniluk January 16, 2026 03:30
//
// Formula: For HoneyBadger, n >= 3t + 1, so max t = (n-1)/3
let threshold = self.threshold.unwrap_or_else(|| {
if n_parties < 4 {
Copy link

@cadaniluk cadaniluk Jan 21, 2026

Choose a reason for hiding this comment

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

If the no. of parties is lower than 4, then all parties must be honest, so t=0, not t=1.

@cadaniluk
Copy link

cadaniluk commented Jan 21, 2026

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