Skip to content

Commit

Permalink
fix: update to support noir 0.34.0 (#6)
Browse files Browse the repository at this point in the history
* fix: update to support noir 0.34.0

* .
  • Loading branch information
TomAFrench authored Sep 13, 2024
1 parent e7a6a9e commit 367e2d4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/nightly-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
env:
CARGO_TERM_COLOR: always

permissions:
issues: write

jobs:
test:
name: Test on Nargo ${{matrix.toolchain}}
Expand Down
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
4 changes: 2 additions & 2 deletions Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name = "noir_base64"
type = "lib"
authors = [""]
compiler_version = ">=0.31.0"
compiler_version = ">=0.34.0"

[dependencies]
[dependencies]
8 changes: 4 additions & 4 deletions src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn base64_encode<let InputElements: u32, let OutputBytes: u32>(input: [u8; I
slice *= 64;
slice += encoded[i * BASE64_ELEMENTS_PER_CHUNK + j] as Field;
}
let slice_bytes: [u8; 30] = slice.to_be_bytes(30).as_array();
let slice_bytes: [u8; 30] = slice.to_be_bytes();
for j in 0..BYTES_PER_CHUNK {
result[i * BYTES_PER_CHUNK + j] = slice_bytes[j];
}
Expand All @@ -124,7 +124,7 @@ pub fn base64_encode<let InputElements: u32, let OutputBytes: u32>(input: [u8; I
slice *= 64;
}
// TODO: check is it cheaper to use a constant value in `to_be_bytes` or can we use `bytes_in_final_chunk`?
let slice_bytes: [u8; 30] = slice.to_be_bytes(30).as_array();
let slice_bytes: [u8; 30] = slice.to_be_bytes();
let num_bytes_in_final_chunk = OutputBytes - ((num_chunks - 1) * BYTES_PER_CHUNK);
for i in 0..num_bytes_in_final_chunk {
result[(num_chunks - 1) * BYTES_PER_CHUNK + i] = slice_bytes[i];
Expand Down Expand Up @@ -152,7 +152,7 @@ pub fn base64_decode<let InputBytes: u32, let OutputElements: u32>(input: [u8; I
slice += input[i * BYTES_PER_CHUNK + j] as Field;
}

let slice_base64_chunks: [u8; 40] = slice.to_be_radix(64, 40).as_array();
let slice_base64_chunks: [u8; 40] = slice.to_be_radix(64);
for j in 0..BASE64_ELEMENTS_PER_CHUNK {
result[i * BASE64_ELEMENTS_PER_CHUNK + j] = slice_base64_chunks[j];
}
Expand All @@ -170,7 +170,7 @@ pub fn base64_decode<let InputBytes: u32, let OutputElements: u32>(input: [u8; I
}

// TODO: check is it cheaper to use a constant value in `to_be_bytes` or can we use `bytes_in_final_chunk`?
let slice_base64_chunks: [u8; 40] = slice.to_be_radix(64, 40).as_array();
let slice_base64_chunks: [u8; 40] = slice.to_be_radix(64);

let num_elements_in_final_chunk = OutputElements - ((num_chunks - 1) * BASE64_ELEMENTS_PER_CHUNK);
for i in 0..num_elements_in_final_chunk {
Expand Down

0 comments on commit 367e2d4

Please sign in to comment.