Skip to content

Commit

Permalink
feat: Sync from noir (AztecProtocol/aztec-packages#5572)
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
fix: unknown slice lengths coming from as_slice
(#4725)
chore: remove unused env vars from `Cross.toml`
(#4717)
feat: improve nargo check cli with --override flag and feedback for
existing files (#4575)
feat: Allow slices to brillig entry points
(#4713)
chore: simplify how `acvm_backend.wasm` is embedded
(#4703)
fix(acvm): Mark outputs of Opcode::Call solvable
(#4708)
fix: Field comparisons (#4704)
feat(acvm_js): Execute program
(#4694)
chore: simplify how blns is loaded into tests
(#4705)
fix(ssa): Do not use get_value_max_num_bits when we want pure type
information (#4700)
chore: remove conditional compilation around `acvm_js` package
(#4702)
feat(docs): Documenting noir codegen
(#4454)
chore: check for references to private functions during path resolution
(#4622)
chore: fix clippy errors (#4684)
fix: Last use analysis & make it an SSA pass
(#4686)
feat: improve SSA type-awareness in EQ and MUL instructions
(#4691)
feat: improve optimisations on range constraints
(#4690)
chore: remove last traces of nix
(#4679)
chore: Use is_entry_point helper on RuntimeType
(#4678)
END_COMMIT_OVERRIDE

---------

Co-authored-by: ludamad <[email protected]>
Co-authored-by: sirasistant <[email protected]>
  • Loading branch information
3 people committed Apr 8, 2024
1 parent a0f7474 commit 7f1f532
Show file tree
Hide file tree
Showing 136 changed files with 2,091 additions and 1,657 deletions.
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bb719200034e3bc6db09fb56538dadca4203abf4
8b30b95fd2c1767ab5969bc47d15e157cd9a3f72
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ if [[ -z "${SKIP_NIX:-}" ]] && has nix; then
use nix
fi

fi
fi
2 changes: 0 additions & 2 deletions .github/Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
passthrough = [
"HOME",
"RUST_BACKTRACE",
"BARRETENBERG_BIN_DIR",
"BLNS_JSON_PATH"
]
volumes = [
"HOME",
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/acvm_js-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
set -eu

.github/scripts/wasm-bindgen-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/acvm_js build
1 change: 1 addition & 0 deletions .github/scripts/noir-wasm-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
set -eu

.github/scripts/wasm-pack-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/types build
yarn workspace @noir-lang/noir_wasm build
1 change: 1 addition & 0 deletions .github/scripts/noirc-abi-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
set -eu

.github/scripts/wasm-bindgen-install.sh
.github/scripts/wasm-opt-install.sh
yarn workspace @noir-lang/noirc_abi build
2 changes: 1 addition & 1 deletion .github/scripts/wasm-opt-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ cd $(dirname "$0")

./cargo-binstall-install.sh

cargo-binstall wasm-opt --version 0.116.0 -y
cargo-binstall wasm-opt --version 0.116.0 -y --force
17 changes: 6 additions & 11 deletions .github/workflows/test-js-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-opt
run: ./.github/scripts/wasm-opt-install.sh

- name: Build noirc_abi
run: ./.github/scripts/noirc-abi-build.sh

- name: Upload artifact
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


Expand All @@ -100,9 +99,6 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-opt
run: ./.github/scripts/wasm-opt-install.sh

- name: Build noir_js_types
run: yarn workspace @noir-lang/types build

Expand Down Expand Up @@ -138,17 +134,16 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-opt
run: ./.github/scripts/wasm-opt-install.sh

- name: Build acvm_js
run: ./.github/scripts/acvm_js-build.sh

- name: Upload artifact
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

test-acvm_js-node:
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ pkg/
# Noir.js
tooling/noir_js/lib

# Nix stuff
**/outputs
result
.envrc.local
.direnv/

# Nargo output
*.proof
*.acir
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"mkhl.direnv",
"jnoortheen.nix-ide",
"rust-lang.rust-analyzer",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
Expand Down
11 changes: 0 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
"direnv.restart.automatic": true,
"redhat.telemetry.enabled": false,
"yaml.recommendations.show": false,
"nix.serverPath": "nil",
"nix.enableLanguageServer": true,
"nix.serverSettings": {
"nil": {
"formatting": {
"command": [
"nixpkgs-fmt"
]
}
}
},
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "${workspaceRoot}/.github/workflows/*.yml"
},
Expand Down
48 changes: 16 additions & 32 deletions Cargo.lock

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

20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,6 @@ Concretely the following items are on the road map:

This crate's minimum supported rustc version is 1.73.0.

## Working on this project

This project uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. Please follow [our guidelines](https://noir-lang.org/docs/getting_started/installation/other_install_methods#option-3-compile-from-source) to setup your environment for working on the project.

### Building against a different local/remote version of Barretenberg

If you are working on this project and want a different version of Barretenberg (instead of the version this project is pinned against), you'll want to replace the lockfile version with your version. This can be done by running:

```sh
nix flake lock --override-input barretenberg /absolute/path/to/your/barretenberg
```

You can also point at a fork and/or branch on GitHub using:

```sh
nix flake lock --override-input barretenberg github:username/barretenberg/branch_name
```

__Note:__ You don't want to commit the updated lockfile, as it will fail in CI!

## License

Noir is free and open source. It is distributed under a dual license. (MIT/APACHE)
Expand Down
36 changes: 22 additions & 14 deletions acvm-repo/acir/src/circuit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,25 +216,33 @@ impl std::fmt::Display for Circuit {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "current witness index : {}", self.current_witness_index)?;

let write_public_inputs = |f: &mut std::fmt::Formatter<'_>,
public_inputs: &PublicInputs|
-> Result<(), std::fmt::Error> {
write!(f, "[")?;
let public_input_indices = public_inputs.indices();
for (index, public_input) in public_input_indices.iter().enumerate() {
write!(f, "{public_input}")?;
if index != public_input_indices.len() - 1 {
write!(f, ", ")?;
let write_witness_indices =
|f: &mut std::fmt::Formatter<'_>, indices: &[u32]| -> Result<(), std::fmt::Error> {
write!(f, "[")?;
for (index, witness_index) in indices.iter().enumerate() {
write!(f, "{witness_index}")?;
if index != indices.len() - 1 {
write!(f, ", ")?;
}
}
}
writeln!(f, "]")
};
writeln!(f, "]")
};

write!(f, "private parameters indices : ")?;
write_witness_indices(
f,
&self
.private_parameters
.iter()
.map(|witness| witness.witness_index())
.collect::<Vec<_>>(),
)?;

write!(f, "public parameters indices : ")?;
write_public_inputs(f, &self.public_parameters)?;
write_witness_indices(f, &self.public_parameters.indices())?;

write!(f, "return value indices : ")?;
write_public_inputs(f, &self.return_values)?;
write_witness_indices(f, &self.return_values.indices())?;

for opcode in &self.opcodes {
writeln!(f, "{opcode}")?;
Expand Down
6 changes: 5 additions & 1 deletion acvm-repo/acir/src/native_types/witness_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct WitnessStackError(#[from] SerializationError);
/// An ordered set of witness maps for separate circuits
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Default, Serialize, Deserialize)]
pub struct WitnessStack {
pub stack: Vec<StackItem>,
stack: Vec<StackItem>,
}

#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Default, Serialize, Deserialize)]
Expand All @@ -37,6 +37,10 @@ impl WitnessStack {
self.stack.push(StackItem { index, witness });
}

pub fn pop(&mut self) -> Option<StackItem> {
self.stack.pop()
}

pub fn peek(&self) -> Option<&StackItem> {
self.stack.last()
}
Expand Down
Loading

0 comments on commit 7f1f532

Please sign in to comment.