Skip to content

Commit

Permalink
chore: bump minimum noir version
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Sep 27, 2024
1 parent b71c6cd commit e1d5875
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toolchain: [nightly, 0.32.0]
toolchain: [nightly, 0.34.0]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Install Nargo
uses: noir-lang/[email protected]
with:
toolchain: 0.32.0
toolchain: 0.34.0

- name: Run formatter
run: nargo fmt --check
2 changes: 1 addition & 1 deletion Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "json_parser"
type = "lib"
authors = [""]
compiler_version = ">=0.32.0"
compiler_version = ">=0.34.0"

[dependencies]
noir_sort = {tag = "v0.1.0", git = "https://github.com/noir-lang/noir_sort"}
4 changes: 1 addition & 3 deletions src/_table_generation/make_tables.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/**
* @file Contains methods used to generate tables in `json_tables.nr`. These table generation methods shouldn't be used inside of actual circuits.
**/
//! Contains methods used to generate tables in `json_tables.nr`. These table generation methods shouldn't be used inside of actual circuits.

mod CaptureMode {
global GRAMMAR_CAPTURE = 0;
Expand Down
22 changes: 12 additions & 10 deletions src/json.nr
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,18 @@ struct JSON<let NumBytes: u32, let NumPackedFields: u16, let MaxNumTokens: u16,
**/
impl<let NumBytes: u16, let NumPackedFields: u16, let MaxNumTokens: u16, let MaxNumValues: u16, let MaxKeyFields: u16> std::cmp::Eq for JSON<NumBytes, NumPackedFields, MaxNumTokens, MaxNumValues, MaxKeyFields> {
fn eq(self, other: Self) -> bool {
(self.json == other.json) & (self.raw_transcript == other.raw_transcript)
& (self.transcript == other.transcript)
& (self.transcript_length == other.transcript_length)
& (self.key_data == other.key_data)
& (self.key_hashes == other.key_hashes)
& (self.layer_type_of_root == other.layer_type_of_root)
& (self.root_id == other.root_id)
& (self.root_index_in_transcript == other.root_index_in_transcript)
& (self.json_entries_packed == other.json_entries_packed)
& (self.json_packed == other.json_packed)
(self.json == other.json)
& (self.raw_transcript == other.raw_transcript)
& (self.transcript == other.transcript)
& (self.transcript_length == other.transcript_length)
& (self.key_data == other.key_data)
& (self.key_hashes == other.key_hashes)
& (self.layer_type_of_root == other.layer_type_of_root)
& (self.root_id == other.root_id)
& (self.root_index_in_transcript
== other.root_index_in_transcript)
& (self.json_entries_packed == other.json_entries_packed)
& (self.json_packed == other.json_packed)
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/json_entry.nr
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,7 @@ impl std::cmp::Eq for JSONEntryPacked {
}

impl std::default::Default for JSONEntryPacked {
fn default() -> Self { JSONEntryPacked{ value: 0 }}
fn default() -> Self {
JSONEntryPacked { value: 0 }
}
}
74 changes: 49 additions & 25 deletions src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ mod JSON512b {
fn get_string_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> BoundedVec<u8, StringBytes> {
self.inner.get_string_from_array_unchecked(array_index)
}
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<BoundedVec<u8, StringBytes>>
{
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<BoundedVec<u8, StringBytes>> {
self.inner.get_string_from_path(keys)
}
fn get_value<let KeyBytes: u16, let StringBytes: u16>(self, key: [u8; KeyBytes]) -> Option<crate::JSONValue<StringBytes>> {
Expand All @@ -218,11 +220,13 @@ mod JSON512b {
fn get_value_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> crate::JSONValue<StringBytes> {
self.inner.get_value_from_array_unchecked(array_index)
}
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<crate::JSONValue<StringBytes>>
{
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<crate::JSONValue<StringBytes>> {
self.inner.get_value_from_path(keys)
}

fn key_exists<let KeyBytes: u16>(self, key: BoundedVec<u8, KeyBytes>) -> bool {
self.inner.key_exists(key)
}
Expand Down Expand Up @@ -355,8 +359,10 @@ mod JSON1kb {
fn get_string_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> BoundedVec<u8, StringBytes> {
self.inner.get_string_from_array_unchecked(array_index)
}
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<BoundedVec<u8, StringBytes>>
{
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<BoundedVec<u8, StringBytes>> {
self.inner.get_string_from_path(keys)
}
fn get_value<let KeyBytes: u16, let StringBytes: u16>(self, key: [u8; KeyBytes]) -> Option<crate::JSONValue<StringBytes>> {
Expand All @@ -377,8 +383,10 @@ mod JSON1kb {
fn get_value_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> crate::JSONValue<StringBytes> {
self.inner.get_value_from_array_unchecked(array_index)
}
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<crate::JSONValue<StringBytes>>
{
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<crate::JSONValue<StringBytes>> {
self.inner.get_value_from_path(keys)
}
fn key_exists<let KeyBytes: u16>(self, key: BoundedVec<u8, KeyBytes>) -> bool {
Expand Down Expand Up @@ -513,8 +521,10 @@ mod JSON2kb {
fn get_string_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> BoundedVec<u8, StringBytes> {
self.inner.get_string_from_array_unchecked(array_index)
}
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<BoundedVec<u8, StringBytes>>
{
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<BoundedVec<u8, StringBytes>> {
self.inner.get_string_from_path(keys)
}
fn get_value<let KeyBytes: u16, let StringBytes: u16>(self, key: [u8; KeyBytes]) -> Option<crate::JSONValue<StringBytes>> {
Expand All @@ -535,8 +545,10 @@ mod JSON2kb {
fn get_value_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> crate::JSONValue<StringBytes> {
self.inner.get_value_from_array_unchecked(array_index)
}
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<crate::JSONValue<StringBytes>>
{
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<crate::JSONValue<StringBytes>> {
self.inner.get_value_from_path(keys)
}
fn key_exists<let KeyBytes: u16>(self, key: BoundedVec<u8, KeyBytes>) -> bool {
Expand Down Expand Up @@ -671,8 +683,10 @@ mod JSON4kb {
fn get_string_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> BoundedVec<u8, StringBytes> {
self.inner.get_string_from_array_unchecked(array_index)
}
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<BoundedVec<u8, StringBytes>>
{
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<BoundedVec<u8, StringBytes>> {
self.inner.get_string_from_path(keys)
}
fn get_value<let KeyBytes: u16, let StringBytes: u16>(self, key: [u8; KeyBytes]) -> Option<crate::JSONValue<StringBytes>> {
Expand All @@ -693,8 +707,10 @@ mod JSON4kb {
fn get_value_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> crate::JSONValue<StringBytes> {
self.inner.get_value_from_array_unchecked(array_index)
}
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<crate::JSONValue<StringBytes>>
{
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<crate::JSONValue<StringBytes>> {
self.inner.get_value_from_path(keys)
}
fn key_exists<let KeyBytes: u16>(self, key: BoundedVec<u8, KeyBytes>) -> bool {
Expand Down Expand Up @@ -829,8 +845,10 @@ mod JSON8kb {
fn get_string_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> BoundedVec<u8, StringBytes> {
self.inner.get_string_from_array_unchecked(array_index)
}
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<BoundedVec<u8, StringBytes>>
{
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<BoundedVec<u8, StringBytes>> {
self.inner.get_string_from_path(keys)
}
fn get_value<let KeyBytes: u16, let StringBytes: u16>(self, key: [u8; KeyBytes]) -> Option<crate::JSONValue<StringBytes>> {
Expand All @@ -851,8 +869,10 @@ mod JSON8kb {
fn get_value_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> crate::JSONValue<StringBytes> {
self.inner.get_value_from_array_unchecked(array_index)
}
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<crate::JSONValue<StringBytes>>
{
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<crate::JSONValue<StringBytes>> {
self.inner.get_value_from_path(keys)
}
fn key_exists<let KeyBytes: u16>(self, key: BoundedVec<u8, KeyBytes>) -> bool {
Expand Down Expand Up @@ -987,8 +1007,10 @@ mod JSON16kb {
fn get_string_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> BoundedVec<u8, StringBytes> {
self.inner.get_string_from_array_unchecked(array_index)
}
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<BoundedVec<u8, StringBytes>>
{
fn get_string_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<BoundedVec<u8, StringBytes>> {
self.inner.get_string_from_path(keys)
}
fn get_value<let KeyBytes: u16, let StringBytes: u16>(self, key: [u8; KeyBytes]) -> Option<crate::JSONValue<StringBytes>> {
Expand All @@ -1009,8 +1031,10 @@ mod JSON16kb {
fn get_value_from_array_unchecked<let StringBytes: u16>(self, array_index: Field) -> crate::JSONValue<StringBytes> {
self.inner.get_value_from_array_unchecked(array_index)
}
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(self, keys: [BoundedVec<u8, KeyBytes>; PathDepth]) -> Option<crate::JSONValue<StringBytes>>
{
fn get_value_from_path<let KeyBytes: u16, let StringBytes: u16, let PathDepth: u16>(
self,
keys: [BoundedVec<u8, KeyBytes>; PathDepth]
) -> Option<crate::JSONValue<StringBytes>> {
self.inner.get_value_from_path(keys)
}
fn key_exists<let KeyBytes: u16>(self, key: BoundedVec<u8, KeyBytes>) -> bool {
Expand Down

0 comments on commit e1d5875

Please sign in to comment.