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

randomness #6: dkg manager update from randomnet #12226

Merged
merged 5 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions config/src/config/identity_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
// SPDX-License-Identifier: Apache-2.0

use crate::{config::SecureBackend, keys::ConfigKey};
use anyhow::anyhow;
use aptos_crypto::{
bls12381,
ed25519::Ed25519PrivateKey,
x25519::{self, PRIVATE_KEY_SIZE},
ValidCryptoMaterial,
};
use aptos_types::account_address::{
from_identity_public_key, AccountAddress, AccountAddress as PeerId,
use aptos_types::{
account_address::{from_identity_public_key, AccountAddress, AccountAddress as PeerId},
dkg::{real_dkg::maybe_dk_from_bls_sk, DKGTrait, DefaultDKG},
};
use serde::{Deserialize, Serialize};
use std::{
Expand Down Expand Up @@ -43,6 +45,21 @@ impl IdentityBlob {
let mut file = File::open(path)?;
Ok(file.write_all(serde_yaml::to_string(self)?.as_bytes())?)
}

pub fn try_into_dkg_dealer_private_key(
self,
) -> Option<<DefaultDKG as DKGTrait>::DealerPrivateKey> {
self.consensus_private_key
}

pub fn try_into_dkg_new_validator_decrypt_key(
self,
) -> anyhow::Result<<DefaultDKG as DKGTrait>::NewValidatorDecryptKey> {
let consensus_sk = self.consensus_private_key.as_ref().ok_or_else(|| {
anyhow!("try_into_dkg_new_validator_decrypt_key failed with missing consensus key")
})?;
maybe_dk_from_bls_sk(consensus_sk)
}
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
Expand Down
5 changes: 5 additions & 0 deletions consensus/src/consensus_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
persistent_liveness_storage::StorageWriteProxy,
pipeline::execution_client::ExecutionProxyClient,
quorum_store::quorum_store_db::QuorumStoreDB,
rand::rand_gen::storage::db::RandDb,
state_computer::ExecutionProxy,
transaction_filter::TransactionFilter,
txn_notifier::MempoolNotifier,
Expand Down Expand Up @@ -66,13 +67,16 @@ pub fn start_consensus(
aptos_channels::new_unbounded(&counters::PENDING_SELF_MESSAGES);
let consensus_network_client = ConsensusNetworkClient::new(network_client);
let bounded_executor = BoundedExecutor::new(8, runtime.handle().clone());
let rand_storage = Arc::new(RandDb::new(node_config.storage.dir()));

let execution_client = Arc::new(ExecutionProxyClient::new(
node_config.consensus.clone(),
Arc::new(execution_proxy),
node_config.validator_network.as_ref().unwrap().peer_id(),
self_sender.clone(),
consensus_network_client.clone(),
bounded_executor.clone(),
rand_storage.clone(),
));

let epoch_mgr = EpochManager::new(
Expand All @@ -89,6 +93,7 @@ pub fn start_consensus(
bounded_executor,
aptos_time_service::TimeService::real(),
vtxn_pool,
rand_storage,
);

let (network_task, network_receiver) = NetworkTask::new(network_service_events, self_receiver);
Expand Down
Loading
Loading