faest-sign / faest-rs

Initial Rust implementation of FAEST
MIT License
8 stars 1 forks source link

`cargo bench` failure #1

Open mmaker opened 1 year ago

mmaker commented 1 year ago
$ git clone https://github.com/faest-sign/faest-rs.git
Cloning into 'faest-rs'...
remote: Enumerating objects: 287, done.
remote: Counting objects: 100% (287/287), done.
remote: Compressing objects: 100% (106/106), done.
remote: Total 287 (delta 175), reused 287 (delta 175), pack-reused 0
Receiving objects: 100% (287/287), 107.27 KiB | 3.06 MiB/s, done.
Resolving deltas: 100% (175/175), done.
$ cd faest-rs/
$ cargo bench
    Updating crates.io index
  Downloaded bitflags v1.3.2
  Downloaded criterion v0.4.0
  Downloaded aes v0.8.3
  Downloaded hashbrown v0.12.3
  Downloaded lazy_static v1.4.0
  Downloaded arrayvec v0.7.4
  Downloaded virtue v0.0.13
  Downloaded ndarray v0.15.6
  Downloaded atty v0.2.14
  Downloaded tap v1.0.1
  Downloaded radium v0.7.0
  Downloaded bitvec v1.0.1
  Downloaded rawpointer v0.2.1
  Downloaded inout v0.1.3
  Downloaded cipher v0.4.4
  Downloaded wyz v0.5.1
  Downloaded os_str_bytes v6.5.1
  Downloaded constant_time_eq v0.3.0
  Downloaded clap v3.2.25
  Downloaded ff v0.13.0
  Downloaded bincode_derive v2.0.0-rc.3
  Downloaded bincode v2.0.0-rc.3
  Downloaded funty v2.0.0
  Downloaded arrayref v0.3.7
  Downloaded memchr v2.6.3
  Downloaded indexmap v1.9.3
  Downloaded clap_lex v0.2.4
  Downloaded blake3 v1.4.1
  Downloaded textwrap v0.16.0
  Downloaded num-complex v0.4.4
  Downloaded matrixmultiply v0.3.7
  Downloaded 31 crates (1.8 MB) in 0.39s
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.147
   Compiling typenum v1.16.0
   Compiling version_check v0.9.4
   Compiling proc-macro2 v1.0.66
   Compiling unicode-ident v1.0.11
   Compiling crossbeam-utils v0.8.16
   Compiling serde v1.0.188
   Compiling generic-array v0.14.7
   Compiling num-traits v0.2.16
   Compiling memoffset v0.9.0
   Compiling crossbeam-epoch v0.9.15
   Compiling radium v0.7.0
   Compiling quote v1.0.33
   Compiling syn v2.0.29
   Compiling getrandom v0.2.10
   Compiling scopeguard v1.2.0
   Compiling either v1.9.0
   Compiling rand_core v0.6.4
   Compiling cc v1.0.83
   Compiling indexmap v1.9.3
   Compiling matrixmultiply v0.3.7
   Compiling num-integer v0.1.45
   Compiling tap v1.0.1
   Compiling rayon-core v1.11.0
   Compiling subtle v2.5.0
   Compiling serde_json v1.0.105
   Compiling wyz v0.5.1
   Compiling crossbeam-deque v0.8.3
   Compiling crypto-common v0.1.6
   Compiling inout v0.1.3
   Compiling block-buffer v0.10.4
   Compiling itertools v0.10.5
   Compiling num_cpus v1.16.0
   Compiling crossbeam-channel v0.5.8
   Compiling funty v2.0.0
   Compiling rawpointer v0.2.1
   Compiling hashbrown v0.12.3
   Compiling ppv-lite86 v0.2.17
   Compiling blake3 v1.4.1
   Compiling regex-syntax v0.7.5
   Compiling half v1.8.2
   Compiling virtue v0.0.13
   Compiling plotters-backend v0.3.5
   Compiling os_str_bytes v6.5.1
   Compiling ryu v1.0.15
   Compiling ciborium-io v0.2.1
   Compiling itoa v1.0.9
   Compiling regex-automata v0.3.8
   Compiling ciborium-ll v0.2.1
   Compiling clap_lex v0.2.4
   Compiling bincode_derive v2.0.0-rc.3
   Compiling plotters-svg v0.3.5
   Compiling serde_derive v1.0.188
   Compiling rand_chacha v0.3.1
   Compiling bitvec v1.0.1
   Compiling digest v0.10.7
   Compiling cipher v0.4.4
   Compiling num-complex v0.4.4
   Compiling textwrap v0.16.0
   Compiling bitflags v1.3.2
   Compiling arrayvec v0.7.4
   Compiling same-file v1.0.6
   Compiling cast v0.3.0
   Compiling constant_time_eq v0.3.0
   Compiling cpufeatures v0.2.9
   Compiling arrayref v0.3.7
   Compiling ff v0.13.0
   Compiling aes v0.8.3
   Compiling criterion-plot v0.5.0
   Compiling walkdir v2.3.3
   Compiling clap v3.2.25
   Compiling ndarray v0.15.6
   Compiling regex v1.9.5
   Compiling rayon v1.7.0
   Compiling bincode v2.0.0-rc.3
   Compiling ciborium v0.2.1
   Compiling rand v0.8.5
   Compiling plotters v0.3.5
   Compiling tinytemplate v1.2.1
   Compiling atty v0.2.14
   Compiling oorandom v11.1.3
   Compiling lazy_static v1.4.0
   Compiling anes v0.1.6
   Compiling faest v0.1.0 (/home/maker/faest-rs)
   Compiling criterion v0.4.0
error[E0599]: no method named `skip_fixed_array_length` found for struct `Configuration` in the current scope
  --> src/fiat_shamir.rs:47:14
   |
44 |           let bincode_cfg = bincode::config::standard()
   |  ___________________________-
45 | |             .with_little_endian()
46 | |             .with_fixed_int_encoding()
47 | |             .skip_fixed_array_length();
   | |             -^^^^^^^^^^^^^^^^^^^^^^^ method not found in `Configuration<LittleEndian, Fixint>`
   | |_____________|
   | 

error[E0599]: no method named `skip_fixed_array_length` found for struct `Configuration` in the current scope
   --> src/fiat_shamir.rs:107:14
    |
104 |           let bincode_cfg = bincode::config::standard()
    |  ___________________________-
105 | |             .with_little_endian()
106 | |             .with_fixed_int_encoding()
107 | |             .skip_fixed_array_length();
    | |             -^^^^^^^^^^^^^^^^^^^^^^^ method not found in `Configuration<LittleEndian, Fixint>`
    | |_____________|
    | 

error[E0599]: no method named `skip_fixed_array_length` found for struct `Configuration` in the current scope
   --> src/fiat_shamir.rs:182:14
    |
179 |           let bincode_cfg = bincode::config::standard()
    |  ___________________________-
180 | |             .with_little_endian()
181 | |             .with_fixed_int_encoding()
182 | |             .skip_fixed_array_length();
    | |             -^^^^^^^^^^^^^^^^^^^^^^^ method not found in `Configuration<LittleEndian, Fixint>`
    | |_____________|
    | 

For more information about this error, try `rustc --explain E0599`.
error: could not compile `faest` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
mmaker commented 1 year ago

solve with


~/faest-rs$ git diff | tee
diff --git a/src/fiat_shamir.rs b/src/fiat_shamir.rs
index 41c35f8..75d8416 100644
--- a/src/fiat_shamir.rs
+++ b/src/fiat_shamir.rs
@@ -43,8 +43,8 @@ where
     pub fn to_bytes(&self) -> Vec<u8> {
         let bincode_cfg = bincode::config::standard()
             .with_little_endian()
-            .with_fixed_int_encoding()
-            .skip_fixed_array_length();
+            .with_fixed_int_encoding();
+            // .skip_fixed_array_length();
         bincode::encode_to_vec(self, bincode_cfg).unwrap()
     }
 }
@@ -103,8 +103,8 @@ where
     fn sign(mut self, message: &[u8]) -> Self::Signature {
         let bincode_cfg = bincode::config::standard()
             .with_little_endian()
-            .with_fixed_int_encoding()
-            .skip_fixed_array_length();
+            .with_fixed_int_encoding();
+            // .skip_fixed_array_length();

         let commitment = self.prover.commit();
         let h1 = {
@@ -178,8 +178,8 @@ where
     fn verify(mut self, signature: &Self::Signature, message: &[u8]) -> bool {
         let bincode_cfg = bincode::config::standard()
             .with_little_endian()
-            .with_fixed_int_encoding()
-            .skip_fixed_array_length();
+            .with_fixed_int_encoding();
+            // .skip_fixed_array_length();

         let Self::Signature {
             commitment,
diff --git a/src/voleith.rs b/src/voleith.rs
index 6a78771..9865ba5 100644
--- a/src/voleith.rs
+++ b/src/voleith.rs
@@ -215,13 +215,13 @@ impl<F: Clone, H: Digest> Clone for Response<F, H> {
     }
 }

-impl<F: bincode::Encode, H: Digest> bincode::Encode for Response<F, H> {
+impl<F: bincode::Encode + 'static, H: Digest> bincode::Encode for Response<F, H> {
     fn encode<E: bincode::enc::Encoder>(
         &self,
         encoder: &mut E,
     ) -> core::result::Result<(), bincode::error::EncodeError> {
         bincode::Encode::encode(&self.hash.as_slice(), encoder)?;
-        bincode::Encode::encode(&self.vector.as_slice(), encoder)?;
+        bincode::Encode::encode(&self.vector.as_slice(), encoder).unwrap();
         Ok(())
     }
 }```