Skip to content

Commit

Permalink
revert some useless changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eason committed Oct 11, 2023
1 parent 02bf649 commit a3432b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/consensus/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,8 @@ pub fn generate_new_crypto_map(metadata: Metadata) -> ProtocolResult<HashMap<Byt
let mut new_addr_pubkey_map = HashMap::new();
for validator in metadata.verifier_list.into_iter() {
let addr = validator.pub_key.as_bytes();
let hex_pubkey = validator.bls_pub_key.as_bytes();
let pubkey = BlsPublicKey::try_from(hex_pubkey.as_ref())
let bls_pubkey = validator.bls_pub_key.as_bytes();
let pubkey = BlsPublicKey::try_from(bls_pubkey.as_ref())
.map_err(|err| ConsensusError::Other(format!("try from bls pubkey error {:?}", err)))?;
new_addr_pubkey_map.insert(addr, pubkey);
}
Expand Down
5 changes: 1 addition & 4 deletions core/run/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use common_config_parser::types::spec::{ChainSpec, InitialAccount};
use common_config_parser::types::{Config, ConfigMempool};
use common_crypto::{
BlsPrivateKey, BlsPublicKey, Secp256k1, Secp256k1PrivateKey, Secp256k1RecoverablePrivateKey,
ToBlsPublicKey, ToPublicKey,
ToPublicKey,
};

use protocol::tokio::{
Expand Down Expand Up @@ -238,14 +238,11 @@ async fn start<K: KeyProvider>(
let hardfork_info = storage.hardfork_proposal(Default::default()).await?;
let overlord_consensus = {
let consensus_wal_path = config.data_path_for_consensus_wal();
let bls_priv_key =
BlsPrivateKey::try_from(config.bls_privkey.as_ref()).map_err(MainError::Crypto)?;
let node_info = Secp256k1PrivateKey::try_from(config.net_privkey.as_ref())
.map(|privkey| {
NodeInfo::new(
current_block.header.chain_id,
privkey.pub_key(),
bls_priv_key.pub_key(&Default::default()),
hardfork_info,
)
})
Expand Down
5 changes: 1 addition & 4 deletions protocol/src/traits/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
sync::{Arc, RwLock},
};

use common_crypto::{BlsPublicKey, Secp256k1PublicKey};
use common_crypto::Secp256k1PublicKey;

use crate::types::{
Address, Block, BlockNumber, Bytes, ExecResp, HardforkInfoInner, Hash, Header, Hex, MerkleRoot,
Expand All @@ -21,7 +21,6 @@ pub enum MessageTarget {
pub struct NodeInfo {
pub chain_id: u64,
pub self_pub_key: Secp256k1PublicKey,
pub self_bls_pub_key: BlsPublicKey,
pub self_address: Address,
pub hardfork_proposals: Arc<RwLock<Option<HardforkInfoInner>>>,
}
Expand All @@ -30,14 +29,12 @@ impl NodeInfo {
pub fn new(
chain_id: u64,
pub_key: Secp256k1PublicKey,
bls_pub_key: BlsPublicKey,
hardfork_info: Option<HardforkInfoInner>,
) -> Self {
let address = Address::from_pubkey(&pub_key);
Self {
chain_id,
self_pub_key: pub_key,
self_bls_pub_key: bls_pub_key,
self_address: address,
hardfork_proposals: Arc::new(RwLock::new(hardfork_info)),
}
Expand Down

0 comments on commit a3432b4

Please sign in to comment.