Skip to content

Commit

Permalink
Merge branch 'master' into tf/explore-re-adding-value-merger-change
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Dec 19, 2024
2 parents b084251 + 9108df3 commit 5046b24
Show file tree
Hide file tree
Showing 64 changed files with 638 additions and 348 deletions.
40 changes: 28 additions & 12 deletions .github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ jobs:
- name: Generate Compilation report
working-directory: ./test_programs
run: |
./compilation_report.sh
./compilation_report.sh 0 1
mv compilation_report.json ../compilation_report.json
- name: Generate Execution report
working-directory: ./test_programs
run: |
./execution_report.sh
./execution_report.sh 0 1
mv execution_report.json ../execution_report.json
- name: Upload compilation report
Expand Down Expand Up @@ -286,10 +286,10 @@ jobs:
matrix:
include:
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-contracts, is_library: true }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/parity-root }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-inner }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-tail }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-reset }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/parity-root, take_average: true }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-inner, take_average: true }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-tail, take_average: true }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-reset, take_average: true }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/rollup-base-private }
- project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/rollup-base-public }

Expand Down Expand Up @@ -330,20 +330,36 @@ jobs:
path: test-repo
ref: ${{ matrix.project.ref }}

- name: Generate compilation report
- name: Generate compilation report without averages
working-directory: ./test-repo/${{ matrix.project.path }}
if: ${{ !matrix.project.take_average }}
run: |
mv /home/runner/work/noir/noir/scripts/test_programs/compilation_report.sh ./compilation_report.sh
chmod +x ./compilation_report.sh
./compilation_report.sh 1
- name: Generate compilation report with averages
working-directory: ./test-repo/${{ matrix.project.path }}
if: ${{ matrix.project.take_average }}
run: |
mv /home/runner/work/noir/noir/scripts/test_programs/compilation_report.sh ./compilation_report.sh
chmod +x ./compilation_report.sh
./compilation_report.sh 1 1
- name: Generate execution report
- name: Generate execution report without averages
working-directory: ./test-repo/${{ matrix.project.path }}
if: ${{ !matrix.project.is_library }}
if: ${{ !matrix.project.is_library && !matrix.project.take_average }}
run: |
mv /home/runner/work/noir/noir/scripts/test_programs/execution_report.sh ./execution_report.sh
./execution_report.sh 1
- name: Generate execution report with averages
working-directory: ./test-repo/${{ matrix.project.path }}
if: ${{ !matrix.project.is_library && matrix.project.take_average }}
run: |
mv /home/runner/work/noir/noir/scripts/test_programs/execution_report.sh ./execution_report.sh
./execution_report.sh 1 1
- name: Move compilation report
id: compilation_report
shell: bash
Expand Down Expand Up @@ -409,7 +425,7 @@ jobs:
- name: Parse compilation report
id: compilation_report
uses: noir-lang/noir-bench-report@0d7464a8c39170523932d7846b6e6b458a294aea
uses: noir-lang/noir-bench-report@e408e131e96c3615b4f820d7d642360fb4d6e2f4
with:
report: compilation_report.json
header: |
Expand Down Expand Up @@ -522,7 +538,7 @@ jobs:
- name: Parse memory report
id: memory_report
uses: noir-lang/noir-bench-report@0d7464a8c39170523932d7846b6e6b458a294aea
uses: noir-lang/noir-bench-report@e408e131e96c3615b4f820d7d642360fb4d6e2f4
with:
report: memory_report.json
header: |
Expand Down Expand Up @@ -566,7 +582,7 @@ jobs:
- name: Parse execution report
id: execution_report
uses: noir-lang/noir-bench-report@0954121203ee55dcda5c7397b9c669c439a20922
uses: noir-lang/noir-bench-report@e408e131e96c3615b4f820d7d642360fb4d6e2f4
with:
report: execution_report.json
header: |
Expand Down
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions acvm-repo/acir/src/circuit/black_box_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ pub enum BlackBoxFunc {
/// https://tools.ietf.org/html/rfc7693
/// - inputs are a byte array, i.e a vector of (witness, 8)
/// - output is a byte array of length 32, i.e. an array of 32
/// (witness, 8), constrained to be the blake2s of the inputs.
/// (witness, 8), constrained to be the blake2s of the inputs.
Blake2s,

/// Computes the Blake3 hash of the inputs
/// - inputs are a byte array, i.e a vector of (witness, 8)
/// - output is a byte array of length 32, i.e an array of 32
/// (witness, 8), constrained to be the blake3 of the inputs.
/// (witness, 8), constrained to be the blake3 of the inputs.
Blake3,

/// Verifies a ECDSA signature over the secp256k1 curve.
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acir/src/circuit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl<F: for<'a> Deserialize<'a>> Program<F> {
where
D: Deserializer<'de>,
{
let bytecode_b64: String = serde::Deserialize::deserialize(deserializer)?;
let bytecode_b64: String = Deserialize::deserialize(deserializer)?;
let program_bytes = base64::engine::general_purpose::STANDARD
.decode(bytecode_b64)
.map_err(D::Error::custom)?;
Expand Down
1 change: 1 addition & 0 deletions acvm-repo/acir/src/circuit/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub enum Opcode<F> {
/// - **express a constraint** on witnesses; for instance to express that a
/// witness `w` is a boolean, you can add the opcode: `w*w-w=0`
/// - or, to **compute the value** of an arithmetic operation of some inputs.
///
/// For instance, to multiply two witnesses `x` and `y`, you would use the
/// opcode `z-x*y=0`, which would constrain `z` to be `x*y`.
///
Expand Down
9 changes: 5 additions & 4 deletions acvm-repo/acir/src/native_types/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl<F> Expression<F> {
///
/// - `mul_term` in an expression contains degree-2 terms
/// - `linear_combinations` contains degree-1 terms
///
/// Hence, it is sufficient to check that there are no `mul_terms`
///
/// Examples:
Expand All @@ -98,11 +99,11 @@ impl<F> Expression<F> {
/// Returns `true` if the expression can be seen as a degree-1 univariate polynomial
///
/// - `mul_terms` in an expression can be univariate, however unless the coefficient
/// is zero, it is always degree-2.
/// is zero, it is always degree-2.
/// - `linear_combinations` contains the sum of degree-1 terms, these terms do not
/// need to contain the same variable and so it can be multivariate. However, we
/// have thus far only checked if `linear_combinations` contains one term, so this
/// method will return false, if the `Expression` has not been simplified.
/// need to contain the same variable and so it can be multivariate. However, we
/// have thus far only checked if `linear_combinations` contains one term, so this
/// method will return false, if the `Expression` has not been simplified.
///
/// Hence, we check in the simplest case if an expression is a degree-1 univariate,
/// by checking if it contains no `mul_terms` and it contains one `linear_combination` term.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ mod tests {
],
q_c: FieldElement::zero(),
}),
Opcode::BlackBoxFuncCall(acir::circuit::opcodes::BlackBoxFuncCall::RANGE {
Opcode::BlackBoxFuncCall(BlackBoxFuncCall::RANGE {
input: FunctionInput::witness(Witness(3), 32),
}),
];
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm/src/pwg/blackbox/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::pwg::OpcodeResolutionError;

/// Resolve BigInt opcodes by storing BigInt values (and their moduli) by their ID in the BigIntSolver
/// - When it encounters a bigint operation opcode, it performs the operation on the stored values
/// and store the result using the provided ID.
/// and store the result using the provided ID.
/// - When it gets a to_bytes opcode, it simply looks up the value and resolves the output witness accordingly.
#[derive(Default)]
pub(crate) struct AcvmBigIntSolver {
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm/tests/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ fn poseidon2_permutation_zeroes() {
#[test]
fn sha256_compression_zeros() {
let results = solve_array_input_blackbox_call(
[(FieldElement::zero(), false); 24].try_into().unwrap(),
[(FieldElement::zero(), false); 24].into(),
8,
None,
sha256_compression_op,
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/blackbox_solver/src/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::BlackBoxResolutionError;

/// Resolve BigInt opcodes by storing BigInt values (and their moduli) by their ID in a HashMap:
/// - When it encounters a bigint operation opcode, it performs the operation on the stored values
/// and store the result using the provided ID.
/// and store the result using the provided ID.
/// - When it gets a to_bytes opcode, it simply looks up the value and resolves the output witness accordingly.
#[derive(Default, Debug, Clone, PartialEq, Eq)]

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_errors/src/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ pub fn report<'files>(
let color_choice =
if std::io::stderr().is_terminal() { ColorChoice::Auto } else { ColorChoice::Never };
let writer = StandardStream::stderr(color_choice);
let config = codespan_reporting::term::Config::default();
let config = term::Config::default();

let stack_trace = stack_trace(files, &custom_diagnostic.call_stack);
let diagnostic = convert_diagnostic(custom_diagnostic, file, stack_trace, deny_warnings);
Expand Down
1 change: 1 addition & 0 deletions compiler/noirc_evaluator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tracing.workspace = true
chrono = "0.4.37"
rayon.workspace = true
cfg-if.workspace = true
smallvec = { version = "1.13.2", features = ["serde"] }

[dev-dependencies]
proptest.workspace = true
Expand Down
1 change: 1 addition & 0 deletions compiler/noirc_evaluator/src/acir/acir_variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ impl<F: AcirField, B: BlackBoxFunctionSolver<F>> AcirContext<F, B> {
offset: AcirVar,
bits: u32,
) -> Result<(), RuntimeError> {
#[allow(unused_qualifications)]
const fn num_bits<T>() -> usize {
std::mem::size_of::<T>() * 8
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_evaluator/src/acir/generated_acir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl<F: AcirField> GeneratedAcir<F> {
/// This implies that either `y` or `t` or both is `0`.
/// - If `t == 0`, then by definition `t == 0`.
/// - If `y == 0`, this does not mean anything at this point in time, due to it having no
/// constraints.
/// constraints.
///
/// Naively, we could apply the following constraint: `y == 1 - t`.
/// This along with the previous `y * t == 0` constraint means that
Expand Down Expand Up @@ -604,7 +604,7 @@ impl<F: AcirField> GeneratedAcir<F> {
) {
// Check whether we have a call to this Brillig function already exists.
// This helps us optimize the Brillig metadata to only be stored once per Brillig entry point.
let inserted_func_before = self.brillig_locations.get(&brillig_function_index).is_some();
let inserted_func_before = self.brillig_locations.contains_key(&brillig_function_index);

let opcode =
AcirOpcode::BrilligCall { id: brillig_function_index, inputs, outputs, predicate };
Expand Down
Loading

0 comments on commit 5046b24

Please sign in to comment.