Skip to content

Commit

Permalink
core: Make lib wasm compilable
Browse files Browse the repository at this point in the history
This commit also removes the `rand_core` dependency as it can be
replaced by `rand`.

Resolves #195
  • Loading branch information
moCello committed Jun 3, 2024
1 parent 28eaa46 commit 431f10a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Rename `crossover` to `deposit` [#190]

### Removed

- Remove `"getrandom"` feature from `aes-gcm` dependency [#195]

## [0.28.1] - 2024-05-23

### Changed
Expand Down Expand Up @@ -321,6 +325,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Canonical implementation shielded by feature.

<!-- ISSUES -->
[#195]: https://github.com/dusk-network/phoenix/issues/195
[#190]: https://github.com/dusk-network/phoenix/issues/190
[#183]: https://github.com/dusk-network/phoenix/issues/183
[#179]: https://github.com/dusk-network/phoenix/issues/179
Expand Down
4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MPL-2.0"
exclude = [".github/workflows/dusk-ci.yml", ".gitignore"]

[dependencies]
rand_core = { version = "0.6", default-features = false }
rand = { version = "0.8", default-features = false }
dusk-bytes = "0.1"
dusk-bls12_381 = { version = "0.13", default-features = false }
bls12_381-bls = { version = "0.3", default-features = false }
Expand All @@ -17,7 +17,7 @@ dusk-poseidon = "0.39"
jubjub-schnorr = "0.4"
subtle = { version = "^2.2.1", default-features = false }
ff = { version = "0.13", default-features = false }
aes-gcm = "0.10"
aes-gcm = { version = "0.10", default-features = false, features = ["aes", "alloc", "rand_core"] }
zeroize = { version = "1", default-features = false, features = ["derive"] }
rkyv = { version = "0.7", optional = true, default-features = false }
bytecheck = { version = "0.6", optional = true, default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion core/src/encryption/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_jubjub::JubJubAffine;
use rand_core::{CryptoRng, RngCore};
use rand::{CryptoRng, RngCore};

use aes_gcm::{
aead::{Aead, AeadCore, KeyInit},
Expand Down
2 changes: 1 addition & 1 deletion core/src/keys/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use zeroize::Zeroize;
use rkyv::{Archive, Deserialize, Serialize};

use dusk_bytes::{DeserializableSlice, Error, Serializable};
use rand_core::{CryptoRng, RngCore};
use rand::{CryptoRng, RngCore};
use subtle::{Choice, ConstantTimeEq};

/// Secret pair of `a` and `b` defining a [`SecretKey`]
Expand Down
2 changes: 1 addition & 1 deletion core/src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::aes;

use dusk_poseidon::{Domain, Hash};
use ff::Field;
use rand_core::{CryptoRng, RngCore};
use rand::{CryptoRng, RngCore};

#[cfg(feature = "rkyv-impl")]
use rkyv::{Archive, Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion core/tests/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use dusk_jubjub::{JubJubAffine, JubJubScalar, GENERATOR};
use phoenix_core::aes;
use rand_core::OsRng;
use rand::rngs::OsRng;

#[test]
fn test_aes_encrypt_and_decrypt() {
Expand Down
2 changes: 1 addition & 1 deletion core/tests/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use dusk_bytes::{DeserializableSlice, Serializable};
use dusk_jubjub::JubJubScalar;
use ff::Field;
use phoenix_core::{PublicKey, SecretKey, ViewKey};
use rand_core::OsRng;
use rand::rngs::OsRng;
use zeroize::Zeroize;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion core/tests/note_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ff::Field;
use phoenix_core::{
Error, Note, NoteType, Ownable, PublicKey, SecretKey, ViewKey,
};
use rand_core::OsRng;
use rand::rngs::OsRng;

#[test]
fn transparent_note() -> Result<(), Error> {
Expand Down
2 changes: 1 addition & 1 deletion core/tests/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use dusk_bls12_381::BlsScalar;
use dusk_jubjub::JubJubScalar;
use ff::Field;
use phoenix_core::{Error, Note, PublicKey, SecretKey, TxSkeleton};
use rand_core::OsRng;
use rand::rngs::OsRng;

#[test]
fn transaction_parse() -> Result<(), Error> {
Expand Down

0 comments on commit 431f10a

Please sign in to comment.