diff --git a/CHANGELOG.md b/CHANGELOG.md index b5ff2cd..544e8bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `asyncify`ing FFI imports - Add `unstake` function to allow unstaking a previously staked amount [#58] - Add `fetch_existing_nullifiers` to the `StateClient` [#41] +- Add `ff` dependency at `0.13` ### Changed @@ -49,6 +50,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update `dusk-poseidon` `0.29.1-rc.0` -> `0.30` - Update `dusk-plonk` `0.13` -> `0.14` - Change `dusk-merkle` dependency to `poseidon-merkle` after merkle crate separation +- Update `phoenix-core` `0.20.0-rc.0` -> `0.21` +- Update `dusk-pki` `0.12` -> `0.13` +- Update `dusk-schnorr` `0.13` -> `0.14` +- Update `dusk-poseidon` `0.30` -> `0.31` +- Update `dusk-plonk` `0.14` -> `0.16` +- Update `dusk-bls12_381-sign` `0.4` -> `0.5` +- Update `dusk-jubjub` `0.12` -> `0.13` +- Update `poseidon-merkle` `0.2.1-rc.0` -> `0.3` +- Update `rusk-abi` `0.10.0-piecrust.0.6` -> `0.11` ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 48cedd9..8a20ff8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,17 +9,18 @@ license = "MPL-2.0" rand_core = "^0.6" rand_chacha = { version = "^0.3", default-features = false } sha2 = { version = "^0.10", default-features = false } -phoenix-core = { version = "0.20.0-rc.0", default-features = false, features = ["alloc", "rkyv-impl"] } -dusk-pki = { version = "0.12", default-features = false } +phoenix-core = { version = "0.21", default-features = false, features = ["alloc", "rkyv-impl"] } +dusk-pki = { version = "0.13", default-features = false } dusk-bytes = "^0.1" -dusk-schnorr = { version = "0.13", default-features = false } -dusk-jubjub = { version = "0.12", default-features = false } -dusk-poseidon = { version = "0.30", default-features = false } -poseidon-merkle = { version = "0.2.1-rc.0", features = ["rkyv-impl"] } -dusk-plonk = { version = "0.14", default-features = false } -rusk-abi = { version = "0.10.0-piecrust.0.6", default-features = false } -dusk-bls12_381-sign = { version = "0.4", default-features = false } +dusk-schnorr = { version = "0.14", default-features = false } +dusk-jubjub = { version = "0.13", default-features = false } +dusk-poseidon = { version = "0.31", default-features = false } +poseidon-merkle = { version = "0.3", features = ["rkyv-impl"] } +dusk-plonk = { version = "0.16", default-features = false } +rusk-abi = { version = "0.11", default-features = false } +dusk-bls12_381-sign = { version = "0.5", default-features = false } rkyv = { version = "0.7", default-features = false } +ff = { version = "0.13", default-features = false } [dev-dependencies] rand = "^0.8" diff --git a/src/ffi.rs b/src/ffi.rs index 9eeaf75..e9be31c 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -405,11 +405,15 @@ impl StateClient for FfiStateClient { return Err(r); } } - let scalar = BlsScalar::from_bytes(&scalar_buf).map_err( - Error::::from, - )?; - Ok(scalar) + let scalar: Option = + BlsScalar::from_bytes(&scalar_buf).into(); + scalar.ok_or( + Error::::from( + dusk_bytes::Error::InvalidData, + ) + .into(), + ) } fn fetch_existing_nullifiers( diff --git a/src/imp.rs b/src/imp.rs index 916ae4e..33bd45c 100644 --- a/src/imp.rs +++ b/src/imp.rs @@ -22,6 +22,7 @@ use dusk_pki::{ StealthAddress, }; use dusk_schnorr::Signature as SchnorrSignature; +use ff::Field; use phoenix_core::transaction::*; use phoenix_core::{Error as PhoenixError, Fee, Note, NoteType}; use rand_core::{CryptoRng, Error as RngError, RngCore}; @@ -301,7 +302,7 @@ where let mut outputs = vec![]; if change > 0 { - let nonce = BlsScalar::random(rng); + let nonce = BlsScalar::random(&mut *rng); let (change_note, change_blinder) = generate_obfuscated_note(rng, refund, change, nonce); @@ -649,7 +650,7 @@ where let withdraw_r = JubJubScalar::random(rng); let address = sender_psk.gen_stealth_address(&withdraw_r); - let nonce = BlsScalar::random(rng); + let nonce = BlsScalar::random(&mut *rng); let signature = withdraw_sign(&sk, &pk, stake.counter, address, nonce); diff --git a/tests/mock.rs b/tests/mock.rs index 1e5c8d8..730a8e2 100644 --- a/tests/mock.rs +++ b/tests/mock.rs @@ -15,6 +15,7 @@ use dusk_wallet_core::{ EnrichedNote, ProverClient, StakeInfo, StateClient, Store, Transaction, UnprovenTransaction, Wallet, POSEIDON_TREE_DEPTH, }; +use ff::Field; use phoenix_core::{Crossover, Fee, Note, NoteType}; use poseidon_merkle::{Item, Opening as PoseidonOpening, Tree}; use rand_core::{CryptoRng, RngCore}; @@ -45,7 +46,7 @@ pub fn mock_wallet( let psk = store.retrieve_ssk(0).unwrap().public_spend_key(); let notes = new_notes(rng, &psk, note_values); - let anchor = BlsScalar::random(rng); + let anchor = BlsScalar::random(&mut *rng); let opening = default_opening(); let state = TestStateClient::new(notes, anchor, opening); @@ -64,7 +65,7 @@ pub fn mock_canon_wallet( let psk = store.retrieve_ssk(0).unwrap().public_spend_key(); let notes = new_notes(rng, &psk, note_values); - let anchor = BlsScalar::random(rng); + let anchor = BlsScalar::random(&mut *rng); let opening = default_opening(); let state = TestStateClient::new(notes, anchor, opening); @@ -85,7 +86,7 @@ pub fn mock_serde_wallet( let psk = store.retrieve_ssk(0).unwrap().public_spend_key(); let notes = new_notes(rng, &psk, note_values); - let anchor = BlsScalar::random(rng); + let anchor = BlsScalar::random(&mut *rng); let opening = default_opening(); let state = TestStateClient::new(notes, anchor, opening); diff --git a/tests/wallet.rs b/tests/wallet.rs index 55ef628..0101e24 100644 --- a/tests/wallet.rs +++ b/tests/wallet.rs @@ -11,6 +11,7 @@ mod mock; use dusk_bytes::Serializable; use dusk_plonk::prelude::BlsScalar; use dusk_wallet_core::StakeInfo; +use ff::Field; use mock::{mock_canon_wallet, mock_serde_wallet, mock_wallet}; #[test]