Skip to content

Commit

Permalink
feat: use blsstc instead of threshold_crypto
Browse files Browse the repository at this point in the history
BREAKING CHANGE: updates to use blsstc
  • Loading branch information
grumbach committed Jun 29, 2021
1 parent 580d271 commit 4044c27
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ thiserror = "1.0.24"
quickcheck = "1"
quickcheck_macros = "1"
rand = "0.7.1"
threshold_crypto = "0.4"
blsttc = "1.0.1"
hex = "0.4.3"

[dependencies.bls_dkg]
version = "~0.3.8"
version = "~0.4"
optional = true

[dependencies.tiny-keccak]
Expand Down
2 changes: 1 addition & 1 deletion examples/mint-repl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ https://iancoleman.io/threshold_crypto_ui/

Key components are:
* [sn_dbc](https://github.com/maidsafe/sn_dbc/) - Safe Network DBC library
* [threshold_crypto](https://github.com/poanetwork/threshold_crypto) - BLS key library
* [blsttc](https://github.com/maidsafe/blsttc) - BLS key library


## Building
Expand Down
8 changes: 3 additions & 5 deletions examples/mint-repl/mint-repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
//! Safe Network DBC Mint CLI playground.
use anyhow::{anyhow, Error, Result};
use blsttc::poly::Poly;
use blsttc::serde_impl::SerdeSecret;
use blsttc::{PublicKey, PublicKeySet, SecretKeySet, SecretKeyShare, Signature, SignatureShare};
use rustyline::config::Configurer;
use rustyline::error::ReadlineError;
use rustyline::Editor;
Expand All @@ -21,11 +24,6 @@ use sn_dbc::{
};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::iter::FromIterator;
use threshold_crypto::poly::Poly;
use threshold_crypto::serde_impl::SerdeSecret;
use threshold_crypto::{
PublicKey, PublicKeySet, SecretKeySet, SecretKeyShare, Signature, SignatureShare,
};

/// Holds information about the Mint, which may be comprised
/// of 1 or more nodes.
Expand Down
2 changes: 1 addition & 1 deletion src/dbc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mod tests {
dbc_owner: &bls_dkg::outcome::Outcome,
dbc: &Dbc,
n_ways: u8,
output_owner: &threshold_crypto::PublicKeySet,
output_owner: &blsttc::PublicKeySet,
) -> ReissueRequest {
let inputs = HashSet::from_iter(vec![dbc.clone()]);
let input_hashes = BTreeSet::from_iter(inputs.iter().map(|in_dbc| in_dbc.name()));
Expand Down
2 changes: 1 addition & 1 deletion src/dbc_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// permissions and limitations relating to use of the SAFE Network Software.
use std::collections::BTreeSet;

use blsttc::PublicKey;
use serde::{Deserialize, Serialize};
use threshold_crypto::PublicKey;
use tiny_keccak::{Hasher, Sha3};

use crate::{DbcContentHash, Error, Hash};
Expand Down
6 changes: 3 additions & 3 deletions src/key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
// permissions and limitations relating to use of the SAFE Network Software.

use crate::{Error, Hash, Result};
use blsttc::{serde_impl::SerdeSecret, SecretKeyShare, SignatureShare};
pub use blsttc::{PublicKey, PublicKeySet, Signature};
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use threshold_crypto::{serde_impl::SerdeSecret, SecretKeyShare, SignatureShare};
pub use threshold_crypto::{PublicKey, PublicKeySet, Signature};

#[derive(Debug, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct NodeSignature {
Expand Down Expand Up @@ -63,7 +63,7 @@ impl SimpleSigner {
self.public_key_set.clone()
}

fn sign<M: AsRef<[u8]>>(&self, msg: M) -> threshold_crypto::SignatureShare {
fn sign<M: AsRef<[u8]>>(&self, msg: M) -> blsttc::SignatureShare {
self.secret_key_share.1.sign(msg)
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ impl ReissueTransaction {
pub struct ReissueRequest {
pub transaction: ReissueTransaction,
// Signatures from the owners of each input, signing `self.transaction.blinded().hash()`
pub input_ownership_proofs:
HashMap<DbcContentHash, (threshold_crypto::PublicKey, threshold_crypto::Signature)>,
pub input_ownership_proofs: HashMap<DbcContentHash, (blsttc::PublicKey, blsttc::Signature)>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -740,7 +739,7 @@ mod tests {

let mut input_ownership_proofs: HashMap<
crate::Hash,
(threshold_crypto::PublicKey, threshold_crypto::Signature),
(blsttc::PublicKey, blsttc::Signature),
> = Default::default();
input_ownership_proofs.extend(
inputs_to_create_owner_proofs
Expand Down

0 comments on commit 4044c27

Please sign in to comment.