Skip to content

Refactor buffer capacity tests to reduce duplication #2292

@gilcu3

Description

@gilcu3

Background

PR #2268 introduced buffer capacity tests across all threshold-signature protocols. Each protocol module has its own test that follows the same pattern:

  1. Set up participants with Comms::with_buffer_capacity(usize::MAX)
  2. Run the protocol via run_protocol()
  3. Assert comms.buffer_len() matches the expected constant (with coordinator vs non-coordinator handling)

This pattern is duplicated across ~10 files:

  • confidential_key_derivation/protocol.rs
  • dkg.rs
  • ecdsa/ot_based_ecdsa/{presign,sign}.rs
  • ecdsa/ot_based_ecdsa/triples/generation.rs
  • ecdsa/robust_ecdsa/{presign,sign}.rs
  • frost/eddsa/sign.rs
  • frost/mod.rs
  • frost/redjubjub/sign.rs

Only the protocol-specific setup (building the future) differs between tests; the harness (loop over participants, run protocol, assert buffer lengths) is copy-pasted.

Acceptance Criteria

  • Extract a shared test helper (e.g. in test_utils) that takes a protocol factory closure and expected buffer entries, and handles the setup/run/assert loop.
  • Each protocol test calls the helper with its specific setup, eliminating the duplicated harness code.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions