w3f / schnorrkel

Schnorr VRFs and signatures on the Ristretto group
BSD 3-Clause "New" or "Revised" License
306 stars 92 forks source link

The code compile Error from_bits not found #88

Closed NoorahSmith closed 1 year ago

NoorahSmith commented 1 year ago

no function or associated item named from_bits found for struct Scalar in the current scope bits scaler error

koute commented 1 year ago

This is due to Scalar::from_bits being deprecated in curve25519-dalek v4.0.0-rc.3.

The following patch will make it compile:

diff --git a/Cargo.toml b/Cargo.toml
index c730127..aef27a4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,7 @@ aead = { version = "0.5.2", default-features = false, optional = true }
 arrayref = { version = "0.3.6", default-features = false }
 # needs to match parity-scale-code which is "=0.7.0"
 arrayvec = { version = "0.7.0", default-features = false }
-curve25519-dalek = { version = "4.0.0-rc.2", default-features = false, features = ["digest", "zeroize"] }
+curve25519-dalek = { version = "4.0.0-rc.3", default-features = false, features = ["digest", "zeroize", "precomputed-tables", "legacy_compatibility"] }
 subtle = { version = "2.5.0", default-features = false }
 merlin = { version = "3.0.0", default-features = false }
 rand_core = { version = "0.6.2", default-features = false }

although it'd be better to remove the use of Scalar::from_bits if possible.

NoorahSmith commented 1 year ago

..

NoorahSmith commented 1 year ago

okay. it compiled with the patch . but in order to remove Scaler from bits altogether , will need to implement something like compressedpoint. uncompress public key