From ea27e05e277fcef442dda760977083b412bd9e74 Mon Sep 17 00:00:00 2001 From: Artem Storozhuk Date: Fri, 19 Jan 2024 15:44:32 +0200 Subject: [PATCH] chore: Use Bn256/Grumpkin curves by default in proof/tests/nova_tests_lem.rs --- src/coprocessor/trie/mod.rs | 6 +++++- src/proof/tests/nova_tests_lem.rs | 18 +++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/coprocessor/trie/mod.rs b/src/coprocessor/trie/mod.rs index 8db6e07a11..8fa4a69281 100644 --- a/src/coprocessor/trie/mod.rs +++ b/src/coprocessor/trie/mod.rs @@ -617,10 +617,14 @@ impl<'a, F: LurkField, const ARITY: usize, const HEIGHT: usize> Trie<'a, F, ARIT cs: &mut CS, key: &AllocatedNum, ) -> Result>, SynthesisError> { + let (arity_bits, bits_needed) = Self::path_bit_dimensions(); + let mut bits = key.to_bits_le_strict(&mut cs.namespace(|| "bits"))?; + for _ in 0..bits_needed - bits.len() { + bits.push(Boolean::Constant(false)); + } bits.reverse(); - let (arity_bits, bits_needed) = Self::path_bit_dimensions(); // each chunk is reversed due to little-endian encoding let path = bits[bits.len() - bits_needed..] .chunks(arity_bits) diff --git a/src/proof/tests/nova_tests_lem.rs b/src/proof/tests/nova_tests_lem.rs index dd4a8d39d2..afb7e8c98a 100644 --- a/src/proof/tests/nova_tests_lem.rs +++ b/src/proof/tests/nova_tests_lem.rs @@ -1,5 +1,5 @@ use expect_test::expect; -use pasta_curves::pallas::Scalar as Fr; +use halo2curves::bn256::Fr; use std::{cell::RefCell, rc::Rc, sync::Arc}; use crate::{ @@ -2473,12 +2473,12 @@ fn test_prove_char_num() { #[test] fn test_prove_char_coercion() { let s = &Store::::default(); - let expr = r#"(char (- 0 4294967200))"#; - let expr2 = r#"(char (- 0 4294967199))"#; + let expr = r#"(char (+ 4294967296 97))"#; + let expr2 = r#"(char (+ 4294967296 98))"#; let expected_a = s.read_with_default_state(r"#\a").unwrap(); let expected_b = s.read_with_default_state(r"#\b").unwrap(); let terminal = s.cont_terminal(); - test_aux::<_, Coproc<_>>( + test_aux::<_, Coproc>( s, expr, Some(expected_a), @@ -4188,7 +4188,7 @@ fn test_trie_lang() { let expr = s.read(state.clone(), expr).unwrap(); let res = s .read_with_default_state( - "0x1cc5b90039db85fd519af975afa1de9d2b92960a585a546637b653b115bc3b53", + "0x2bfc4f437d5ca652511d67e06201b4fdf95c314c85ea987988746a253071bed6", ) .unwrap(); nova_test_full_aux2::<_, TrieCoproc<_>>( @@ -4206,7 +4206,7 @@ fn test_trie_lang() { ); let expr2 = - "(.lurk.trie.lookup 0x1cc5b90039db85fd519af975afa1de9d2b92960a585a546637b653b115bc3b53 123)"; + "(.lurk.trie.lookup 0x2bfc4f437d5ca652511d67e06201b4fdf95c314c85ea987988746a253071bed6 123)"; let expr2 = s.read(state.clone(), expr2).unwrap(); let res2 = s.comm(Fr::zero()); nova_test_full_aux2::<_, TrieCoproc<_>>( @@ -4224,11 +4224,11 @@ fn test_trie_lang() { ); let expr3 = - "(.lurk.trie.insert 0x1cc5b90039db85fd519af975afa1de9d2b92960a585a546637b653b115bc3b53 123 456)"; + "(.lurk.trie.insert 0x2bfc4f437d5ca652511d67e06201b4fdf95c314c85ea987988746a253071bed6 123 456)"; let expr3 = s.read(state.clone(), expr3).unwrap(); let res3 = s .read_with_default_state( - "0x1b22dc5a394231c34e4529af674dc56a736fbd07508acfd1d12c0e67c8b4de27", + "0x21ad1dd339f26bb824ab861dbcf110c1bcb3b7658eea4b5e84780a3b4958bf95", ) .unwrap(); nova_test_full_aux2::<_, TrieCoproc<_>>( @@ -4246,7 +4246,7 @@ fn test_trie_lang() { ); let expr4 = - "(.lurk.trie.lookup 0x1b22dc5a394231c34e4529af674dc56a736fbd07508acfd1d12c0e67c8b4de27 123)"; + "(.lurk.trie.lookup 0x21ad1dd339f26bb824ab861dbcf110c1bcb3b7658eea4b5e84780a3b4958bf95 123)"; let expr4 = s.read(state.clone(), expr4).unwrap(); let res4 = s.comm(Fr::from(456)); nova_test_full_aux2::<_, TrieCoproc<_>>(