Skip to content

Commit

Permalink
feat: Sync from noir (#5619)
Browse files Browse the repository at this point in the history
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
feat(nargo): Multiple circuits info for binary programs
(noir-lang/noir#4719)
chore: update condition for clearing warning comment on release PRs
(noir-lang/noir#4739)
chore(ci): fix cutting new versions of the docs
(noir-lang/noir#4737)
chore(ci): replace `yarn build:js:only` script
(noir-lang/noir#4735)
chore: update JS publish workflow to upload build artifacts correctly.
(noir-lang/noir#4734)
feat: add `remove_enable_side_effects` SSA pass
(noir-lang/noir#4224)
chore: update from vulnerable version of h2
(noir-lang/noir#4714)
chore(ci): stop updating version list before cutting new docs version
(noir-lang/noir#4726)
chore: remove `FunctionInput::dummy`
(noir-lang/noir#4723)
chore: remove docker CI flow
(noir-lang/noir#4724)
fix: unknown slice lengths coming from as_slice
(noir-lang/noir#4725)
chore: remove unused env vars from `Cross.toml`
(noir-lang/noir#4717)
feat: improve nargo check cli with --override flag and feedback for
existing files (noir-lang/noir#4575)
feat: Allow slices to brillig entry points
(noir-lang/noir#4713)
chore: simplify how `acvm_backend.wasm` is embedded
(noir-lang/noir#4703)
fix(acvm): Mark outputs of Opcode::Call solvable
(noir-lang/noir#4708)
fix: Field comparisons (noir-lang/noir#4704)
feat(acvm_js): Execute program
(noir-lang/noir#4694)
chore: simplify how blns is loaded into tests
(noir-lang/noir#4705)
fix(ssa): Do not use get_value_max_num_bits when we want pure type
information (noir-lang/noir#4700)
chore: remove conditional compilation around `acvm_js` package
(noir-lang/noir#4702)
feat(docs): Documenting noir codegen
(noir-lang/noir#4454)
chore: check for references to private functions during path resolution
(noir-lang/noir#4622)
chore: fix clippy errors (noir-lang/noir#4684)
fix: Last use analysis & make it an SSA pass
(noir-lang/noir#4686)
feat: improve SSA type-awareness in EQ and MUL instructions
(noir-lang/noir#4691)
feat: improve optimisations on range constraints
(noir-lang/noir#4690)
chore: remove last traces of nix
(noir-lang/noir#4679)
chore: Use is_entry_point helper on RuntimeType
(noir-lang/noir#4678)
END_COMMIT_OVERRIDE

---------

Co-authored-by: sirasistant <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: vezenovm <[email protected]>
  • Loading branch information
4 people authored Apr 9, 2024
1 parent 47e9c25 commit ff28080
Show file tree
Hide file tree
Showing 28 changed files with 385 additions and 938 deletions.
808 changes: 0 additions & 808 deletions noir/noir-repo/.github/workflows/docker-test-flow.yml

This file was deleted.

8 changes: 5 additions & 3 deletions noir/noir-repo/.github/workflows/docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ jobs:
run: |
npm i wasm-opt -g
- name: Query active docs versions
run: yarn workspace docs version::stables

- name: Build docs
run:
yarn workspaces foreach -Rpt --from docs run build
run: yarn workspaces foreach -Rpt --from docs run build

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -126,4 +128,4 @@ jobs:
with:
message: |
FYI @noir-lang/developerrelations on Noir doc changes.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion noir/noir-repo/.github/workflows/gates_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Compare gates reports
id: gates_diff
uses: TomAFrench/noir-gates-diff@e7cf131b7e7f044c01615f93f0b855f65ddc02d4
uses: TomAFrench/noir-gates-diff@df05f34e2ab275ddc4f2cac065df1c88f8a05e5d
with:
report: gates_report.json
summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%)
Expand Down
7 changes: 4 additions & 3 deletions noir/noir-repo/.github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
run: |
npm i wasm-opt -g
- name: Query active docs versions
run: yarn workspace docs version::stables

- name: Build docs for deploying
working-directory: docs
run:
yarn workspaces foreach -Rt run build
run: yarn workspaces foreach -Rpt --from docs run build

- name: Deploy to Netlify
uses: nwtgck/[email protected]
Expand Down
8 changes: 6 additions & 2 deletions noir/noir-repo/.github/workflows/publish-es-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm/outputs/out/noirc_abi_wasm
path: |
./tooling/noirc_abi_wasm/nodejs
./tooling/noirc_abi_wasm/web
retention-days: 10

build-noir_wasm:
Expand Down Expand Up @@ -113,7 +115,9 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: acvm-js
path: ./acvm-repo/acvm_js/outputs/out/acvm_js
path: |
./acvm-repo/acvm_js/nodejs
./acvm-repo/acvm_js/web
retention-days: 3

publish-es-packages:
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
# We need to specify the PR on which to make the comment as workflow is triggered by push.
number: ${{ fromJSON(needs.release-please.outputs.release-pr).number }}
# delete the comment in case failures have been fixed
delete: ${{ !env.FAIL }}
delete: ${{ env.FAIL == false }}
message: "The release workflow has not completed successfully. Releasing now will result in a broken release"

- name: Report overall success
Expand Down
4 changes: 2 additions & 2 deletions noir/noir-repo/Cargo.lock

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

30 changes: 0 additions & 30 deletions noir/noir-repo/Dockerfile.ci

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ pub struct FunctionInput {
pub num_bits: u32,
}

impl FunctionInput {
pub fn dummy() -> Self {
Self { witness: Witness(0), num_bits: 0 }
}
}

#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum BlackBoxFuncCall {
AND {
Expand Down
25 changes: 12 additions & 13 deletions noir/noir-repo/acvm-repo/acir/tests/test_program_serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,13 @@ fn nested_acir_call_circuit() {
id: 1,
inputs: vec![Witness(0), Witness(1)],
outputs: vec![Witness(2)],
predicate: Some(Expression::one()),
predicate: None,
};
let nested_call_two = Opcode::Call {
id: 1,
inputs: vec![Witness(0), Witness(1)],
outputs: vec![Witness(3)],
predicate: Some(Expression::one()),
predicate: None,
};

let assert_nested_call_results = Opcode::AssertZero(Expression {
Expand Down Expand Up @@ -422,7 +422,7 @@ fn nested_acir_call_circuit() {
id: 2,
inputs: vec![Witness(2), Witness(1)],
outputs: vec![Witness(3)],
predicate: Some(Expression::one()),
predicate: None,
};

let nested_call = Circuit {
Expand Down Expand Up @@ -455,16 +455,15 @@ fn nested_acir_call_circuit() {
let bytes = Program::serialize_program(&program);

let expected_serialization: Vec<u8> = vec![
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 83, 65, 14, 3, 33, 8, 68, 77, 246, 61, 32, 186,
139, 183, 126, 165, 166, 238, 255, 159, 208, 109, 74, 82, 229, 178, 135, 186, 77, 58, 201,
4, 195, 97, 128, 1, 3, 188, 17, 148, 47, 44, 7, 221, 65, 15, 31, 56, 37, 104, 222, 129,
193, 77, 35, 126, 7, 58, 43, 30, 174, 44, 222, 107, 250, 201, 218, 190, 211, 98, 92, 83,
106, 91, 108, 196, 116, 199, 88, 170, 100, 76, 185, 174, 66, 66, 89, 242, 35, 10, 115, 147,
36, 91, 169, 101, 195, 66, 137, 27, 237, 185, 240, 174, 98, 97, 94, 95, 8, 198, 80, 103,
226, 128, 0, 227, 102, 174, 50, 11, 38, 154, 229, 231, 245, 21, 23, 157, 213, 119, 115,
255, 244, 58, 237, 183, 176, 239, 0, 38, 233, 254, 108, 91, 14, 230, 158, 246, 153, 97, 3,
158, 188, 79, 135, 232, 14, 5, 0, 0,
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 146, 97, 10, 195, 32, 12, 133, 163, 66, 207, 147,
24, 173, 241, 223, 174, 50, 153, 189, 255, 17, 214, 177, 148, 89, 17, 250, 99, 14, 246,
224, 97, 144, 16, 146, 143, 231, 224, 45, 167, 126, 105, 217, 109, 118, 91, 248, 200, 168,
225, 248, 191, 106, 114, 208, 233, 104, 188, 233, 139, 223, 137, 108, 51, 139, 113, 13,
161, 38, 95, 137, 233, 142, 62, 23, 137, 24, 98, 89, 133, 132, 162, 196, 135, 23, 230, 42,
65, 82, 46, 57, 97, 166, 192, 149, 182, 152, 121, 211, 97, 110, 222, 94, 8, 13, 132, 182,
54, 48, 144, 235, 8, 254, 10, 22, 76, 132, 101, 231, 237, 229, 23, 189, 213, 54, 119, 15,
83, 212, 199, 172, 175, 79, 113, 51, 48, 198, 253, 207, 84, 13, 204, 141, 224, 21, 176,
147, 158, 66, 231, 43, 145, 6, 4, 0, 0,
];

assert_eq!(bytes, expected_serialization);
}
14 changes: 7 additions & 7 deletions noir/noir-repo/acvm-repo/acvm_js/test/shared/nested_acir_call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { WitnessMap, StackItem, WitnessStack } from '@noir-lang/acvm_js';

// See `nested_acir_call_circuit` integration test in `acir/tests/test_program_serialization.rs`.
export const bytecode = Uint8Array.from([
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 83, 65, 14, 3, 33, 8, 68, 77, 246, 61, 32, 186, 139, 183, 126, 165, 166, 238,
255, 159, 208, 109, 74, 82, 229, 178, 135, 186, 77, 58, 201, 4, 195, 97, 128, 1, 3, 188, 17, 148, 47, 44, 7, 221, 65,
15, 31, 56, 37, 104, 222, 129, 193, 77, 35, 126, 7, 58, 43, 30, 174, 44, 222, 107, 250, 201, 218, 190, 211, 98, 92,
83, 106, 91, 108, 196, 116, 199, 88, 170, 100, 76, 185, 174, 66, 66, 89, 242, 35, 10, 115, 147, 36, 91, 169, 101, 195,
66, 137, 27, 237, 185, 240, 174, 98, 97, 94, 95, 8, 198, 80, 103, 226, 128, 0, 227, 102, 174, 50, 11, 38, 154, 229,
231, 245, 21, 23, 157, 213, 119, 115, 255, 244, 58, 237, 183, 176, 239, 0, 38, 233, 254, 108, 91, 14, 230, 158, 246,
153, 97, 3, 158, 188, 79, 135, 232, 14, 5, 0, 0,
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 146, 97, 10, 195, 32, 12, 133, 163, 66, 207, 147, 24, 173, 241, 223, 174, 50,
153, 189, 255, 17, 214, 177, 148, 89, 17, 250, 99, 14, 246, 224, 97, 144, 16, 146, 143, 231, 224, 45, 167, 126, 105,
217, 109, 118, 91, 248, 200, 168, 225, 248, 191, 106, 114, 208, 233, 104, 188, 233, 139, 223, 137, 108, 51, 139, 113,
13, 161, 38, 95, 137, 233, 142, 62, 23, 137, 24, 98, 89, 133, 132, 162, 196, 135, 23, 230, 42, 65, 82, 46, 57, 97,
166, 192, 149, 182, 152, 121, 211, 97, 110, 222, 94, 8, 13, 132, 182, 54, 48, 144, 235, 8, 254, 10, 22, 76, 132, 101,
231, 237, 229, 23, 189, 213, 54, 119, 15, 83, 212, 199, 172, 175, 79, 113, 51, 48, 198, 253, 207, 84, 13, 204, 141,
224, 21, 176, 147, 158, 66, 231, 43, 145, 6, 4, 0, 0,
]);

export const initialWitnessMap: WitnessMap = new Map([
Expand Down
3 changes: 3 additions & 0 deletions noir/noir-repo/compiler/noirc_driver/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ pub struct ContractFunction {
pub bytecode: Program,

pub debug: DebugInfo,

/// Names of the functions in the program. These are used for more informative debugging and benchmarking.
pub names: Vec<String>,
}
21 changes: 18 additions & 3 deletions noir/noir-repo/compiler/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use noirc_abi::{AbiParameter, AbiType, AbiValue};
use noirc_errors::{CustomDiagnostic, FileDiagnostic};
use noirc_evaluator::create_program;
use noirc_evaluator::errors::RuntimeError;
use noirc_evaluator::ssa::SsaProgramArtifact;
use noirc_frontend::debug::build_debug_crate_file;
use noirc_frontend::graph::{CrateId, CrateName};
use noirc_frontend::hir::def_map::{Contract, CrateDefMap};
Expand Down Expand Up @@ -424,6 +425,7 @@ fn compile_contract_inner(
bytecode: function.program,
debug: function.debug,
is_unconstrained: modifiers.is_unconstrained,
names: function.names,
});
}

Expand Down Expand Up @@ -519,16 +521,28 @@ pub fn compile_no_check(
}
let visibility = program.return_visibility;

let (program, debug, warnings, input_witnesses, return_witnesses) = create_program(
let SsaProgramArtifact {
program,
debug,
warnings,
main_input_witnesses,
main_return_witnesses,
names,
} = create_program(
program,
options.show_ssa,
options.show_brillig,
options.force_brillig,
options.benchmark_codegen,
)?;

let abi =
abi_gen::gen_abi(context, &main_function, input_witnesses, return_witnesses, visibility);
let abi = abi_gen::gen_abi(
context,
&main_function,
main_input_witnesses,
main_return_witnesses,
visibility,
);
let file_map = filter_relevant_files(&debug, &context.file_manager);

Ok(CompiledProgram {
Expand All @@ -544,5 +558,6 @@ pub fn compile_no_check(
file_map,
noir_version: NOIR_ARTIFACT_VERSION_STRING.to_string(),
warnings,
names,
})
}
2 changes: 2 additions & 0 deletions noir/noir-repo/compiler/noirc_driver/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ pub struct CompiledProgram {
pub debug: DebugInfo,
pub file_map: BTreeMap<FileId, DebugFile>,
pub warnings: Vec<SsaReport>,
/// Names of the functions in the program. These are used for more informative debugging and benchmarking.
pub names: Vec<String>,
}
Loading

0 comments on commit ff28080

Please sign in to comment.