Skip to content

Commit

Permalink
Merge branch 'master' into gd/builtin-shift-left
Browse files Browse the repository at this point in the history
  • Loading branch information
guipublic authored Oct 27, 2023
2 parents 33651ac + dbb6cf0 commit c361231
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/recrawler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Algolia Recrawl
on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
algolia_recrawl:
name: Algolia Recrawl
runs-on: ubuntu-latest
steps:
- name: Algolia crawler creation and crawl
uses: algolia/[email protected]
id: algolia_crawler
with:
crawler-user-id: ${{ secrets.CRAWLER_USER_ID }}
crawler-api-key: ${{ secrets.CRAWLER_API_KEY }}
algolia-app-id: ${{ secrets.ALGOLIA_APP_ID }}
algolia-api-key: ${{ secrets.ALGOLIA_API_KEY }}
site-url: 'https://noir-lang.org/'
crawler-name: noir-lang
override-config: false
3 changes: 1 addition & 2 deletions noir_stdlib/src/ec/consts/te.nr
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ struct BabyJubjub {
suborder: Field,
}

#[field(bn254)]
pub fn baby_jubjub() -> BabyJubjub {
assert(compat::is_bn254());

BabyJubjub {
// Baby Jubjub (ERC-2494) parameters in affine representation
curve: TECurve::new(
Expand Down
1 change: 1 addition & 0 deletions noir_stdlib/src/hash.nr
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fn mimc<N>(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field {
global MIMC_BN254_ROUNDS = 91;

//mimc implementation with hardcoded parameters for BN254 curve.
#[field(bn254)]
pub fn mimc_bn254<N>(array: [Field; N]) -> Field {
//mimc parameters
let exponent = 7;
Expand Down
3 changes: 3 additions & 0 deletions noir_stdlib/src/hash/poseidon/bn254.nr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::hash::poseidon::apply_matrix;

// Optimised permutation for this particular field; uses hardcoded rf and rp values,
// which should agree with those in pos_conf.
#[field(bn254)]
pub fn permute<M,N,O>(
pos_conf: PoseidonConfig<M, N>,
mut state: [Field; O])
Expand Down Expand Up @@ -65,6 +66,7 @@ pub fn permute<M,N,O>(
}

// Corresponding absorption.
#[field(bn254)]
fn absorb<M,N,O,P>(
pos_conf: PoseidonConfig<M, N>,
mut state: [Field; O], // Initial state; usually [0; O]
Expand Down Expand Up @@ -98,6 +100,7 @@ fn absorb<M,N,O,P>(
}

// Variable-length Poseidon-128 sponge as suggested in second bullet point of §3 of https://eprint.iacr.org/2019/458.pdf
#[field(bn254)]
pub fn sponge<N>(msg: [Field; N]) -> Field {
absorb(consts::x5_5_config(), [0;5], 4, 1, msg)[1]
}
Expand Down
16 changes: 16 additions & 0 deletions noir_stdlib/src/hash/poseidon/bn254/perm.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::hash::poseidon::bn254::consts;
use crate::hash::poseidon::bn254::permute;
use crate::hash::poseidon::PoseidonConfig;

#[field(bn254)]
pub fn x5_2(mut state: [Field; 2]) -> [Field; 2] {
state = permute(
consts::x5_2_config(),
Expand All @@ -11,6 +12,7 @@ pub fn x5_2(mut state: [Field; 2]) -> [Field; 2] {
state
}

#[field(bn254)]
pub fn x5_3(mut state: [Field; 3]) -> [Field; 3] {
state = permute(
consts::x5_3_config(),
Expand All @@ -19,6 +21,7 @@ pub fn x5_3(mut state: [Field; 3]) -> [Field; 3] {
state
}

#[field(bn254)]
pub fn x5_4(mut state: [Field; 4]) -> [Field; 4] {
state = permute(
consts::x5_4_config(),
Expand All @@ -27,6 +30,7 @@ pub fn x5_4(mut state: [Field; 4]) -> [Field; 4] {
state
}

#[field(bn254)]
pub fn x5_5(mut state: [Field; 5]) -> [Field; 5] {
state = permute(
consts::x5_5_config(),
Expand All @@ -35,6 +39,7 @@ pub fn x5_5(mut state: [Field; 5]) -> [Field; 5] {
state
}

#[field(bn254)]
pub fn x5_6(mut state: [Field; 6]) -> [Field; 6] {
state = permute(
consts::x5_6_config(),
Expand All @@ -43,6 +48,7 @@ pub fn x5_6(mut state: [Field; 6]) -> [Field; 6] {
state
}

#[field(bn254)]
pub fn x5_7(mut state: [Field; 7]) -> [Field; 7] {
state = permute(
consts::x5_7_config(),
Expand All @@ -51,6 +57,7 @@ pub fn x5_7(mut state: [Field; 7]) -> [Field; 7] {
state
}

#[field(bn254)]
pub fn x5_8(mut state: [Field; 8]) -> [Field; 8] {
state = permute(
consts::x5_8_config(),
Expand All @@ -59,6 +66,7 @@ pub fn x5_8(mut state: [Field; 8]) -> [Field; 8] {
state
}

#[field(bn254)]
pub fn x5_9(mut state: [Field; 9]) -> [Field; 9] {
state = permute(
consts::x5_9_config(),
Expand All @@ -67,6 +75,7 @@ pub fn x5_9(mut state: [Field; 9]) -> [Field; 9] {
state
}

#[field(bn254)]
pub fn x5_10(mut state: [Field; 10]) -> [Field; 10] {
state = permute(
consts::x5_10_config(),
Expand All @@ -75,6 +84,7 @@ pub fn x5_10(mut state: [Field; 10]) -> [Field; 10] {
state
}

#[field(bn254)]
pub fn x5_11(mut state: [Field; 11]) -> [Field; 11] {
state = permute(
consts::x5_11_config(),
Expand All @@ -83,6 +93,7 @@ pub fn x5_11(mut state: [Field; 11]) -> [Field; 11] {
state
}

#[field(bn254)]
pub fn x5_12(mut state: [Field; 12]) -> [Field; 12] {
state = permute(
consts::x5_12_config(),
Expand All @@ -91,6 +102,7 @@ pub fn x5_12(mut state: [Field; 12]) -> [Field; 12] {
state
}

#[field(bn254)]
pub fn x5_13(mut state: [Field; 13]) -> [Field; 13] {
state = permute(
consts::x5_13_config(),
Expand All @@ -99,6 +111,7 @@ pub fn x5_13(mut state: [Field; 13]) -> [Field; 13] {
state
}

#[field(bn254)]
pub fn x5_14(mut state: [Field; 14]) -> [Field; 14] {
state = permute(
consts::x5_14_config(),
Expand All @@ -107,6 +120,7 @@ pub fn x5_14(mut state: [Field; 14]) -> [Field; 14] {
state
}

#[field(bn254)]
pub fn x5_15(mut state: [Field; 15]) -> [Field; 15] {
state = permute(
consts::x5_15_config(),
Expand All @@ -115,6 +129,7 @@ pub fn x5_15(mut state: [Field; 15]) -> [Field; 15] {
state
}

#[field(bn254)]
pub fn x5_16(mut state: [Field; 16]) -> [Field; 16] {
state = permute(
consts::x5_16_config(),
Expand All @@ -123,6 +138,7 @@ pub fn x5_16(mut state: [Field; 16]) -> [Field; 16] {
state
}

#[field(bn254)]
pub fn x5_17(mut state: [Field; 17]) -> [Field; 17] {
state = permute(
consts::x5_17_config(),
Expand Down
12 changes: 10 additions & 2 deletions tooling/noir_js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import * as acvm from '@noir-lang/acvm_js';
import * as abi from '@noir-lang/noirc_abi';

export { acvm, abi };

export { WitnessMap } from '@noir-lang/acvm_js';
export {
ecdsa_secp256r1_verify,
ecdsa_secp256k1_verify,
keccak256,
blake2s256,
sha256,
xor,
and,
} from '@noir-lang/acvm_js';
export { WitnessMap, ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@noir-lang/acvm_js';

export { Noir } from './program.js';

0 comments on commit c361231

Please sign in to comment.