Skip to content

Wrap SetupParameters in Arc to fix memory issue#12

Open
ycscaly wants to merge 2 commits into
mainfrom
fix/arc-wrap-setup-parameters
Open

Wrap SetupParameters in Arc to fix memory issue#12
ycscaly wants to merge 2 commits into
mainfrom
fix/arc-wrap-setup-parameters

Conversation

@ycscaly

@ycscaly ycscaly commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

No description provided.

ycscaly and others added 2 commits December 29, 2025 00:33
The reconfiguration protocol's PublicInput contained 7 SetupParameters
directly (not wrapped in Arc), each containing large accelerator tables
(~8MB each with 4096 entries of ~512 bytes). Every PublicInput.clone()
was copying ~56-80MB of data.

With 80 validators and multiple protocol rounds, this caused memory
usage to grow to tens of GB.

Changes:
- Wrap setup_parameters and setup_parameters_per_crt_prime in Arc in
  class_groups::reconfiguration::PublicInput
- Wrap ristretto_setup_parameters, curve25519_setup_parameters, and
  secp256r1_setup_parameters in Arc in
  twopc_mpc::decentralized_party::reconfiguration::PublicInput
- Add "rc" feature to serde for Arc serialization support
- Update usages to dereference Arc when inner value is needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Apply the same Arc-wrapping treatment to DKG that was done for
reconfiguration. This ensures SetupParameters (which contain large
accelerator tables ~8MB each) are reference-counted rather than
deep-cloned when PublicInput is cloned.

Changes:
- 2pc-mpc: Wrap setup parameters in Arc in DKG PublicInput struct
- class-groups: Wrap setup_parameters and setup_parameters_per_crt_prime in Arc
- Update party.rs, third_round.rs, fourth_round.rs to dereference Arc

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant