forked from visoftsolutions/noir_rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: sync Noir repo (AztecProtocol#4020)
subrepo: subdir: "noir" merged: "e7da1ab13" upstream: origin: "https://github.com/noir-lang/noir" branch: "aztec-packages" commit: "e7da1ab13" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "110b9eb"
- Loading branch information
1 parent
401eeee
commit 11712c2
Showing
27 changed files
with
285 additions
and
786 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,11 @@ jobs: | |
name: noirc_abi_wasm | ||
path: ./tooling/noirc_abi_wasm | ||
|
||
- name: Install wasm-pack | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: [email protected] | ||
|
||
- name: Install Yarn dependencies | ||
uses: ./.github/actions/setup | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
noir/acvm-repo/blackbox_solver/src/curve_specific_solver.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
use acir::{BlackBoxFunc, FieldElement}; | ||
|
||
use crate::BlackBoxResolutionError; | ||
|
||
/// This component will generate outputs for Blackbox function calls where the underlying [`acir::BlackBoxFunc`] | ||
/// doesn't have a canonical Rust implementation. | ||
/// | ||
/// Returns an [`BlackBoxResolutionError`] if the backend does not support the given [`acir::BlackBoxFunc`]. | ||
pub trait BlackBoxFunctionSolver { | ||
fn schnorr_verify( | ||
&self, | ||
public_key_x: &FieldElement, | ||
public_key_y: &FieldElement, | ||
signature: &[u8], | ||
message: &[u8], | ||
) -> Result<bool, BlackBoxResolutionError>; | ||
fn pedersen_commitment( | ||
&self, | ||
inputs: &[FieldElement], | ||
domain_separator: u32, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError>; | ||
fn pedersen_hash( | ||
&self, | ||
inputs: &[FieldElement], | ||
domain_separator: u32, | ||
) -> Result<FieldElement, BlackBoxResolutionError>; | ||
fn fixed_base_scalar_mul( | ||
&self, | ||
low: &FieldElement, | ||
high: &FieldElement, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError>; | ||
fn ec_add( | ||
&self, | ||
input1_x: &FieldElement, | ||
input1_y: &FieldElement, | ||
input2_x: &FieldElement, | ||
input2_y: &FieldElement, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError>; | ||
fn ec_double( | ||
&self, | ||
input_x: &FieldElement, | ||
input_x: &FieldElement, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError>; | ||
} | ||
|
||
pub struct StubbedBlackBoxSolver; | ||
|
||
impl StubbedBlackBoxSolver { | ||
fn fail(black_box_function: BlackBoxFunc) -> BlackBoxResolutionError { | ||
BlackBoxResolutionError::Failed( | ||
black_box_function, | ||
format!("{} is not supported", black_box_function.name()), | ||
) | ||
} | ||
} | ||
|
||
impl BlackBoxFunctionSolver for StubbedBlackBoxSolver { | ||
fn schnorr_verify( | ||
&self, | ||
_public_key_x: &FieldElement, | ||
_public_key_y: &FieldElement, | ||
_signature: &[u8], | ||
_message: &[u8], | ||
) -> Result<bool, BlackBoxResolutionError> { | ||
Err(Self::fail(BlackBoxFunc::SchnorrVerify)) | ||
} | ||
fn pedersen_commitment( | ||
&self, | ||
_inputs: &[FieldElement], | ||
_domain_separator: u32, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { | ||
Err(Self::fail(BlackBoxFunc::PedersenCommitment)) | ||
} | ||
fn pedersen_hash( | ||
&self, | ||
_inputs: &[FieldElement], | ||
_domain_separator: u32, | ||
) -> Result<FieldElement, BlackBoxResolutionError> { | ||
Err(Self::fail(BlackBoxFunc::PedersenHash)) | ||
} | ||
fn fixed_base_scalar_mul( | ||
&self, | ||
_low: &FieldElement, | ||
_high: &FieldElement, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { | ||
Err(Self::fail(BlackBoxFunc::FixedBaseScalarMul)) | ||
} | ||
fn ec_add( | ||
&self, | ||
_input1_x: &FieldElement, | ||
_input1_y: &FieldElement, | ||
_input2_x: &FieldElement, | ||
_input2_y: &FieldElement, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { | ||
Err(Self::fail(BlackBoxFunc::EmbeddedCurveAdd)) | ||
} | ||
fn ec_double( | ||
&self, | ||
_input_x: &FieldElement, | ||
_input_y: &FieldElement, | ||
) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { | ||
Err(Self::fail(BlackBoxFunc::EmbeddedCurveDouble)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.