Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Generate class-groups key pair & proof with crypto lib #420

Open
wants to merge 17 commits into
base: 459-update-api
Choose a base branch
from

Conversation

yaelAbergel
Copy link
Contributor

@yaelAbergel yaelAbergel commented Dec 19, 2024

Up until now, the real Class-Groups key generation logic was not fully implemented, and each generation process took a long time.
This PR introduces the actual functions and types required for the Class-Groups key generation. It also stores each validator's encryption key and proof on-chain.

Notes:

  1. Objects in Move cannot exceed 250KB in size, and each encryption key and proof set is 248KB.
  2. Running without the mock-class-groups feature in "dev" mode takes a significant amount of time, though it is faster in "release" mode.
  3. The decryption key is not saved currently as it cause EXC_BAD_ACCESS dwallet-network: Save the class-groups private key for each validator safely #462

Copy link

vercel bot commented Dec 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
dwallet-network-docs ⬜️ Ignored (Inspect) Visit Preview Jan 6, 2025 4:05pm

@ItayLevyOfficial ItayLevyOfficial force-pushed the 369-real-class-groups-keygen branch from fdb94e6 to 2dad3a3 Compare December 23, 2024 14:40
Base automatically changed from 400-dwallet-super-user to 393-async-network-dkg December 23, 2024 15:11
Base automatically changed from 393-async-network-dkg to crypto-new-api December 23, 2024 15:12
Copy link
Contributor

@ItayLevyOfficial ItayLevyOfficial left a comment

Choose a reason for hiding this comment

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

lgtm

.cargo/config.toml Show resolved Hide resolved
crates/class-groups-constants/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

create mock keypairs and proofs we'll be able to keep using for local development

crates/pera-config/src/node.rs Outdated Show resolved Hide resolved
crates/pera-core/src/dwallet_mpc/mpc_instance.rs Outdated Show resolved Hide resolved
crates/pera-core/src/dwallet_mpc/mpc_manager.rs Outdated Show resolved Hide resolved
crates/pera-core/src/dwallet_mpc/mpc_party.rs Outdated Show resolved Hide resolved
@ItayLevyOfficial ItayLevyOfficial changed the base branch from crypto-new-api to new-main December 26, 2024 17:21
@yaelAbergel yaelAbergel changed the base branch from new-main to crypto-new-api December 30, 2024 10:05
@yaelAbergel yaelAbergel changed the base branch from crypto-new-api to cleanup2 December 30, 2024 14:30
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to modify this file because of the updated API of the cryptography-private lib.

@yaelAbergel yaelAbergel force-pushed the 369-real-class-groups-keygen branch 2 times, most recently from 079cdcc to 112cf68 Compare December 30, 2024 17:02
@yaelAbergel yaelAbergel force-pushed the 369-real-class-groups-keygen branch from 112cf68 to 31acde9 Compare December 30, 2024 17:04
Cargo.toml Show resolved Hide resolved
…oups-keygen

# Conflicts:
#	crates/pera-core/src/dwallet_mpc/mpc_manager.rs
…ass-groups-keygen

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	crates/class-groups-constants/src/lib.rs
#	crates/dwallet-classgroups-types/src/lib.rs
#	crates/pera-config/src/node.rs
#	crates/pera-core/src/authority/authority_per_epoch_store.rs
#	crates/pera-core/src/dwallet_mpc/mpc_manager.rs
#	crates/pera-core/src/dwallet_mpc/mpc_session.rs
#	crates/pera-keys/src/keypair_file.rs
#	crates/pera-swarm-config/src/genesis_config.rs
#	sdk/dwallet-mpc-wasm/Cargo.lock
@yaelAbergel yaelAbergel changed the base branch from cleanup2 to 459-update-api January 2, 2025 09:09
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved

@yaelAbergel yaelAbergel requested a review from zeevmoney January 2, 2025 09:33
@yaelAbergel yaelAbergel marked this pull request as ready for review January 2, 2025 09:36
Copy link
Contributor

@zeevmoney zeevmoney left a comment

Choose a reason for hiding this comment

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

see comments

.cargo/config.toml Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
crates/dwallet-classgroups-types/src/lib.rs Show resolved Hide resolved
Comment on lines +381 to +383
public(package) fun emit_validator_data_for_secret_share(data: ValidatorDataForDWalletSecretShare) {
event::emit(data);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public(package) fun emit_validator_data_for_secret_share(data: ValidatorDataForDWalletSecretShare) {
event::emit(data);
}

@@ -347,32 +352,54 @@ module pera_system::validator_set {
// ==== epoch change functions ====

public(package) fun lock_next_epoch_committee(self: &mut ValidatorSet, epoch: u64) {
let mut next_epoch_vals = vector::empty();
let mut _next_epoch_vals = vector::empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

why _?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

crates/pera-swarm-config/src/genesis_config.rs Outdated Show resolved Hide resolved
Co-authored-by: Zeev Manilovich <zeevmoney@users.noreply.github.com>
Comment on lines 37 to 43
let validators_len = validators_data.length();
let mut i = 0;
while (i < validators_len) {
let validator_data = validators_data[i];
emit_validator_data_for_secret_share(validator_data);
i = i + 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let validators_len = validators_data.length();
let mut i = 0;
while (i < validators_len) {
let validator_data = validators_data[i];
emit_validator_data_for_secret_share(validator_data);
i = i + 1;
}
let mut i = 0;
while (i < validators_data.length()) {
emit_validator_data_for_secret_share(validators_data[i]);
i = i + 1;
}

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.

3 participants