Skip to content

Commit

Permalink
feat: remove dalek ng (#4769)
Browse files Browse the repository at this point in the history
Description
---
Removed and replaced the  `curve25519-dalek-ng` dependency and rather use `curve25519-dalek` as this is the more updated repo.
Updated the version as this is a breaking change with respect to dependencies.
Matched the version of `rand` to `rand_core` so that the traits can work.`

How Has This Been Tested?
---
All unit test pass. 

Fixes: #4736
  • Loading branch information
SWvheerden committed Oct 5, 2022
1 parent 2dc7deb commit 953b0b7
Show file tree
Hide file tree
Showing 35 changed files with 492 additions and 450 deletions.
795 changes: 419 additions & 376 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions applications/tari_app_grpc/Cargo.toml
Expand Up @@ -11,9 +11,9 @@ edition = "2018"
tari_common_types = { version = "^0.38", path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
tari_core = { path = "../../base_layer/core" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_script = { path = "../../infrastructure/tari_script" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

argon2 = { version = "0.4.1", features = ["std"] }
base64 = "0.13.0"
Expand All @@ -23,10 +23,10 @@ log = "0.4"
num-traits = "0.2.15"
prost = "0.9"
prost-types = "0.9"
rand = "0.8"
rand = "0.8.5"
thiserror = "1"
tonic = "0.6.2"
zeroize = "1.5"
zeroize = "1.3"

[build-dependencies]
tonic-build = "0.6.2"
Expand Down
4 changes: 2 additions & 2 deletions applications/tari_app_grpc/src/authentication/basic_auth.rs
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::{borrow::Cow, string::FromUtf8Error};
use std::{borrow::Cow, ops::Deref, string::FromUtf8Error};

use argon2::{password_hash::Encoding, Argon2, PasswordHash, PasswordVerifier};
use tari_utilities::SafePassword;
Expand Down Expand Up @@ -93,7 +93,7 @@ impl BasicAuthCredentials {
pub fn generate_header(username: &str, password: &[u8]) -> Result<MetadataValue<Ascii>, BasicAuthError> {
let password_str = String::from_utf8_lossy(password);
let token_str = Zeroizing::new(format!("{}:{}", username, password_str));
let mut token = base64::encode(token_str);
let mut token = base64::encode(token_str.deref());
let header = format!("Basic {}", token);
token.zeroize();
match password_str {
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_app_utilities/Cargo.toml
Expand Up @@ -7,18 +7,18 @@ license = "BSD-3-Clause"

[dependencies]
tari_comms = { path = "../../comms/core" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_common = { path = "../../common" }
tari_common_types = { path = "../../base_layer/common_types" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

clap = { version = "3.2.0", features = ["derive", "env"] }
config = { version = "0.13.0" }
futures = { version = "^0.3.16", default-features = false, features = ["alloc"] }
dirs-next = "1.0.2"
json5 = "0.2.2"
log = { version = "0.4.8", features = ["std"] }
rand = "0.8"
rand = "0.7.3"
tokio = { version = "1.20", features = ["signal"] }
serde = "1.0.126"
structopt = { version = "0.3.13", default_features = false }
Expand Down
4 changes: 2 additions & 2 deletions applications/tari_base_node/Cargo.toml
Expand Up @@ -15,14 +15,14 @@ tari_comms = { path = "../../comms/core", features = ["rpc"] }
tari_common_types = { path = "../../base_layer/common_types" }
tari_comms_dht = { path = "../../comms/dht" }
tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_libtor = { path = "../../infrastructure/libtor", optional = true }
tari_mmr = { path = "../../base_layer/mmr", features = ["native_bitmap"] }
tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] }
tari_storage = {path="../../infrastructure/storage"}
tari_service_framework = { path = "../../base_layer/service_framework" }
tari_shutdown = { path = "../../infrastructure/shutdown" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

anyhow = "1.0.53"
async-trait = "0.1.52"
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_console_wallet/Cargo.toml
Expand Up @@ -7,7 +7,7 @@ license = "BSD-3-Clause"

[dependencies]
tari_wallet = { path = "../../base_layer/wallet", features = ["bundled_sqlite"] }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_common = { path = "../../common" }
tari_app_utilities = { path = "../tari_app_utilities" }
tari_comms = { path = "../../comms/core" }
Expand All @@ -18,7 +18,7 @@ tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] }
tari_app_grpc = { path = "../tari_app_grpc" }
tari_shutdown = { path = "../../infrastructure/shutdown" }
tari_key_manager = { path = "../../base_layer/key_manager" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

# Uncomment for tokio tracing via tokio-console (needs "tracing" featurs)
#console-subscriber = "0.1.3"
Expand All @@ -36,7 +36,7 @@ digest = "0.9.0"
futures = { version = "^0.3.16", default-features = false, features = ["alloc"] }
log = { version = "0.4.8", features = ["std"] }
qrcode = { version = "0.12" }
rand = "0.8"
rand = "0.7.3"
regex = "1.5.4"
rpassword = "5.0"
rustyline = "9.0"
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_merge_mining_proxy/Cargo.toml
Expand Up @@ -15,8 +15,8 @@ tari_common = { path = "../../common" }
tari_comms = { path = "../../comms/core" }
tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] }
tari_app_utilities = { path = "../tari_app_utilities" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }
tari_base_node_grpc_client = {path="../../clients/rust/base_node_grpc_client" }
tari_wallet_grpc_client = {path="../../clients/rust/wallet_grpc_client" }

Expand All @@ -33,7 +33,7 @@ hex = "0.4.2"
hyper = "0.14.12"
jsonrpc = "0.12.0"
log = { version = "0.4.8", features = ["std"] }
rand = "0.8"
rand = "0.7.3"
reqwest = { version = "0.11.4", features = ["json"] }
serde = { version = "1.0.106", features = ["derive"] }
serde_json = "1.0.57"
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_miner/Cargo.toml
Expand Up @@ -14,8 +14,8 @@ tari_common_types = { path = "../../base_layer/common_types" }
tari_comms = { path = "../../comms/core" }
tari_app_utilities = { path = "../tari_app_utilities" }
tari_app_grpc = { path = "../tari_app_grpc" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

crossterm = { version = "0.17" }
clap = { version = "3.1.1", features = ["derive"] }
Expand All @@ -24,7 +24,7 @@ futures = "0.3"
log = { version = "0.4", features = ["std"] }
num_cpus = "1.13"
prost-types = "0.9"
rand = "0.8"
rand = "0.7.3"
sha3 = "0.9"
serde = { version = "1.0", default_features = false, features = ["derive"] }
tonic = { version = "0.6.2", features = ["transport"] }
Expand Down
6 changes: 3 additions & 3 deletions base_layer/common_types/Cargo.toml
Expand Up @@ -7,13 +7,13 @@ version = "0.38.5"
edition = "2018"

[dependencies]
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

base64 = "0.13.0"
digest = "0.9.0"
lazy_static = "1.4.0"
rand = "0.8"
rand = "0.7.3"
serde = { version = "1.0.106", features = ["derive"] }
thiserror = "1.0.29"
tokio = { version = "1.20", features = ["time", "sync"] }
Expand Down
6 changes: 3 additions & 3 deletions base_layer/core/Cargo.toml
Expand Up @@ -24,7 +24,7 @@ tari_common_types = { version = "^0.38", path = "../../base_layer/common_types"
tari_comms = { version = "^0.38", path = "../../comms/core" }
tari_comms_dht = { version = "^0.38", path = "../../comms/dht" }
tari_comms_rpc_macros = { version = "^0.38", path = "../../comms/rpc_macros" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_metrics = { path = "../../infrastructure/metrics" }
tari_mmr = { version = "^0.38", path = "../../base_layer/mmr", optional = true, features = ["native_bitmap"] }
tari_p2p = { version = "^0.38", path = "../../base_layer/p2p" }
Expand All @@ -33,7 +33,7 @@ tari_service_framework = { version = "^0.38", path = "../service_framework" }
tari_shutdown = { version = "^0.38", path = "../../infrastructure/shutdown" }
tari_storage = { version = "^0.38", path = "../../infrastructure/storage" }
tari_test_utils = { version = "^0.38", path = "../../infrastructure/test_utils" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

async-trait = "0.1.50"
bincode = "1.1.4"
Expand Down Expand Up @@ -62,7 +62,7 @@ num-format = "0.4.0"
once_cell = "1.8.0"
prost = "0.9"
prost-types = "0.9"
rand = "0.8"
rand = "0.7.3"
randomx-rs = { git = "https://github.com/tari-project/randomx-rs", tag = "v1.1.13", optional = true }
serde = { version = "1.0.106", features = ["derive"] }
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/iterators/chunk.rs
Expand Up @@ -286,7 +286,7 @@ mod test {

#[test]
fn iterator_symmetry() {
let size = OsRng.gen_range(3usize..=10);
let size = OsRng.gen_range(3usize, 10 + 1);
let rand_start = OsRng.gen::<u8>();
let rand_end = OsRng.gen::<u8>().saturating_add(rand_start);

Expand Down
6 changes: 3 additions & 3 deletions base_layer/key_manager/Cargo.toml
Expand Up @@ -13,8 +13,8 @@ crate-type = ["lib", "cdylib"]
# NB: All dependencies must support or be gated for the WASM target.
[dependencies]
tari_common_types = { version = "^0.38", path = "../../base_layer/common_types", optional = true }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

arrayvec = "0.7.1"
argon2 = { version = "0.2", features = ["std"] }
Expand All @@ -27,7 +27,7 @@ derivative = "2.2.0"
digest = "0.9.0"
getrandom = { version = "0.2.3", optional = true }
js-sys = { version = "0.3.55", optional = true }
rand = "0.8"
rand = "0.7.3"
serde = "1.0.89"
serde_derive = "1.0.89"
serde_json = "1.0.39"
Expand Down
5 changes: 2 additions & 3 deletions base_layer/mmr/Cargo.toml
Expand Up @@ -13,8 +13,8 @@ native_bitmap = ["croaring"]
benches = ["criterion"]

[dependencies]
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_common = {path = "../../common"}
thiserror = "1.0.26"
digest = "0.9.0"
Expand All @@ -26,7 +26,6 @@ criterion = { version="0.2", optional = true }
[dev-dependencies]
rand="0.8.0"
blake2 = "0.9.0"
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
serde_json = "1.0"
bincode = "1.1"
[lib]
Expand Down
8 changes: 4 additions & 4 deletions base_layer/p2p/Cargo.toml
Expand Up @@ -13,11 +13,11 @@ edition = "2018"
tari_comms = { version = "^0.38", path = "../../comms/core" }
tari_comms_dht = { version = "^0.38", path = "../../comms/dht" }
tari_common = { version = "^0.38", path = "../../common" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_service_framework = { version = "^0.38", path = "../service_framework" }
tari_shutdown = { version = "^0.38", path = "../../infrastructure/shutdown" }
tari_storage = { version = "^0.38", path = "../../infrastructure/storage" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

anyhow = "1.0.53"
bytes = "0.5"
Expand All @@ -26,9 +26,9 @@ fs2 = "0.4.0"
futures = { version = "^0.3.1" }
lmdb-zero = "0.4.4"
log = "0.4.6"
pgp = { version = "0.8.0", optional = true }
pgp = { version = "0.7.2", optional = true }
prost = "=0.9.0"
rand = "0.8"
rand = "0.7.3"
reqwest = { version = "0.11", optional = true, default-features = false }
rustls = "0.20.2"
semver = { version = "1.0.1", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion base_layer/p2p/examples/gen_node_identity.rs
Expand Up @@ -40,7 +40,7 @@ use tari_comms::{
use tari_utilities::message_format::MessageFormat;

fn random_address() -> Multiaddr {
let port = OsRng.gen_range(9000..std::u16::MAX);
let port = OsRng.gen_range(9000, std::u16::MAX);
let socket_addr: SocketAddr = (Ipv4Addr::LOCALHOST, port).into();
socketaddr_to_multiaddr(&socket_addr)
}
Expand Down
6 changes: 3 additions & 3 deletions base_layer/tari_mining_helper_ffi/Cargo.toml
Expand Up @@ -8,10 +8,10 @@ edition = "2018"

[dependencies]
tari_comms = { version = "^0.38", path = "../../comms/core" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_common = { path = "../../common" }
tari_core = { path = "../core", default-features = false, features = ["transactions"]}
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }
libc = "0.2.65"
thiserror = "1.0.26"
hex = "0.4.2"
Expand All @@ -21,7 +21,7 @@ serde_json = "1.0.57"
[dev-dependencies]
tari_core = { path = "../core", features = ["transactions", "base_node"]}

rand = "0.8.1"
rand = "0.7.3"

[lib]
crate-type = ["staticlib","cdylib"]
8 changes: 4 additions & 4 deletions base_layer/wallet/Cargo.toml
Expand Up @@ -11,15 +11,15 @@ tari_common = { path = "../../common" }
tari_common_types = { version = "^0.38", path = "../../base_layer/common_types" }
tari_comms = { version = "^0.38", path = "../../comms/core" }
tari_comms_dht = { version = "^0.38", path = "../../comms/dht" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.5" }
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", tag = "v0.15.6" }
tari_key_manager = { version = "^0.38", path = "../key_manager" }
tari_p2p = { version = "^0.38", path = "../p2p", features = ["auto-update"] }
tari_script = { path = "../../infrastructure/tari_script" }
tari_service_framework = { version = "^0.38", path = "../service_framework" }
tari_shutdown = { version = "^0.38", path = "../../infrastructure/shutdown" }
tari_storage = { version = "^0.38", path = "../../infrastructure/storage" }
tari_common_sqlite = { path = "../../common_sqlite" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.5" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag="v0.4.7" }

# Uncomment for tokio tracing via tokio-console (needs "tracing" featurs)
#console-subscriber = "0.1.3"
Expand All @@ -44,7 +44,7 @@ libsqlite3-sys = { version = "0.22.2", features = ["bundled"], optional = true }
lmdb-zero = "0.4.4"
log = "0.4.6"
log4rs = { version = "1.0.0", features = ["console_appender", "file_appender", "yaml_format"] }
rand = "0.8"
rand = "0.7.3"
serde = { version = "1.0.89", features = ["derive"] }
serde_json = "1.0.39"
strum = "0.22"
Expand All @@ -54,7 +54,7 @@ thiserror = "1.0.26"
tower = "0.4"
prost = "0.9"
itertools = "0.10.3"
chacha20poly1305 = "0.10.1"
chacha20poly1305 = "0.9.1"

[dependencies.tari_core]
path = "../../base_layer/core"
Expand Down
Expand Up @@ -1455,7 +1455,7 @@ impl Encryptable<XChaCha20Poly1305> for KnownOneSidedPaymentScriptSql {
mod test {
use std::{mem::size_of, time::Duration};

use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305};
use chacha20poly1305::{aead::NewAead, Key, XChaCha20Poly1305};
use diesel::{Connection, SqliteConnection};
use rand::{rngs::OsRng, RngCore};
use tari_common_sqlite::sqlite_connection_pool::SqliteConnectionPool;
Expand Down
2 changes: 1 addition & 1 deletion base_layer/wallet/src/storage/sqlite_db/wallet.rs
Expand Up @@ -31,7 +31,7 @@ use argon2::{
password_hash::{rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
Argon2,
};
use chacha20poly1305::{Key, KeyInit, Tag, XChaCha20Poly1305, XNonce};
use chacha20poly1305::{aead::NewAead, Key, Tag, XChaCha20Poly1305, XNonce};
use diesel::{prelude::*, SqliteConnection};
use log::*;
use tari_common_types::chain_metadata::ChainMetadata;
Expand Down
Expand Up @@ -2202,7 +2202,7 @@ impl UnconfirmedTransactionInfoSql {
mod test {
use std::{convert::TryFrom, mem::size_of, time::Duration};

use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305};
use chacha20poly1305::{aead::NewAead, Key, XChaCha20Poly1305};
use chrono::Utc;
use diesel::{Connection, SqliteConnection};
use rand::{rngs::OsRng, RngCore};
Expand Down
2 changes: 1 addition & 1 deletion base_layer/wallet/src/util/encryption.rs
Expand Up @@ -104,7 +104,7 @@ pub fn encrypt_bytes_integral_nonce(
mod test {
use std::mem::size_of;

use chacha20poly1305::{Key, KeyInit, Tag, XChaCha20Poly1305, XNonce};
use chacha20poly1305::{aead::NewAead, Key, Tag, XChaCha20Poly1305, XNonce};
use rand::{rngs::OsRng, RngCore};
use tari_utilities::ByteArray;

Expand Down
Expand Up @@ -22,7 +22,7 @@

use std::mem::size_of;

use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305};
use chacha20poly1305::{aead::NewAead, Key, XChaCha20Poly1305};
use rand::{rngs::OsRng, RngCore};
use tari_key_manager::cipher_seed::CipherSeed;
use tari_wallet::key_manager_service::{
Expand Down
Expand Up @@ -22,7 +22,7 @@

use std::mem::size_of;

use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305};
use chacha20poly1305::{aead::NewAead, Key, XChaCha20Poly1305};
use rand::{rngs::OsRng, RngCore};
use tari_common_types::{transaction::TxId, types::FixedHash};
use tari_core::transactions::{tari_amount::MicroTari, CryptoFactories};
Expand Down
Expand Up @@ -22,7 +22,7 @@

use std::mem::size_of;

use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305};
use chacha20poly1305::{aead::NewAead, Key, XChaCha20Poly1305};
use chrono::{NaiveDateTime, Utc};
use rand::{rngs::OsRng, RngCore};
use tari_common_types::{
Expand Down

0 comments on commit 953b0b7

Please sign in to comment.