From 052aee80ff3e1e4fd2ca45310d7bb8b980af126a Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 17 Oct 2024 18:11:33 +0100 Subject: [PATCH 1/9] fix: Reject invalid expression with in CLI parser (#6287) # Description ## Problem\* Resolves #5560 ## Summary\* Rejects an invalid `--expression-value` in the CLI, which would later cause a panic in `acvm::compiler::transformers::csat`. An example error message looks like: ```text error: invalid value '1' for '--expression-width ': minimum value is 3 ``` ## Additional Context The issue suggests that [CSatTransformer::new](https://github.com/noir-lang/noir/blob/ae87d287ab1fae0f999dfd0d1166fbddb927ba97/acvm-repo/acvm/src/compiler/transformers/csat.rs#L24-L27) should return a `Result` explaining the problem it has with `width`, rather than doing an `assert!` (without any message) and crashing the program. I agree, however looking at the chain of calls, none of the half-dozen functions we go through to reach this use `Result`, and the `CSatTransformer` is the only option we have. This suggests to me that this limitation is perhaps supposed to be well-known to the user, ie. it's not the case that one transformer has X limit and another has Y limit. For this reason I added a `pub const MIN_EXPRESSION_WIDTH: usize = 3;` to the `acvm::compiler` module and using that as a common value for the assertion as well as the validation in the CLI. Should the assumption of a single global value change, removing that will force us to update the validation logic as well. That said if you prefer going the `Result` route I'm not against it, it just seemed like an overkill for this single use case. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- acvm-repo/acvm/src/compiler/mod.rs | 2 +- acvm-repo/acvm/src/compiler/transformers/csat.rs | 9 +++++++-- acvm-repo/acvm/src/compiler/transformers/mod.rs | 1 + compiler/noirc_driver/src/lib.rs | 7 ++++++- tooling/nargo_cli/src/cli/mod.rs | 16 ++++++++++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/acvm-repo/acvm/src/compiler/mod.rs b/acvm-repo/acvm/src/compiler/mod.rs index 5ece3d19a6e..92e03cc90c2 100644 --- a/acvm-repo/acvm/src/compiler/mod.rs +++ b/acvm-repo/acvm/src/compiler/mod.rs @@ -11,8 +11,8 @@ mod transformers; pub use optimizers::optimize; use optimizers::optimize_internal; -pub use transformers::transform; use transformers::transform_internal; +pub use transformers::{transform, MIN_EXPRESSION_WIDTH}; /// This module moves and decomposes acir opcodes. The transformation map allows consumers of this module to map /// metadata they had about the opcodes to the new opcode structure generated after the transformation. diff --git a/acvm-repo/acvm/src/compiler/transformers/csat.rs b/acvm-repo/acvm/src/compiler/transformers/csat.rs index f258e0a8818..bdd6998835a 100644 --- a/acvm-repo/acvm/src/compiler/transformers/csat.rs +++ b/acvm-repo/acvm/src/compiler/transformers/csat.rs @@ -6,6 +6,9 @@ use acir::{ }; use indexmap::IndexMap; +/// Minimum width accepted by the `CSatTransformer`. +pub const MIN_EXPRESSION_WIDTH: usize = 3; + /// A transformer which processes any [`Expression`]s to break them up such that they /// fit within the [`ProofSystemCompiler`][crate::ProofSystemCompiler]'s width. /// @@ -22,9 +25,11 @@ pub(crate) struct CSatTransformer { } impl CSatTransformer { - // Configure the width for the optimizer + /// Create an optimizer with a given width. + /// + /// Panics if `width` is less than `MIN_EXPRESSION_WIDTH`. pub(crate) fn new(width: usize) -> CSatTransformer { - assert!(width > 2); + assert!(width >= MIN_EXPRESSION_WIDTH, "width has to be at least {MIN_EXPRESSION_WIDTH}"); CSatTransformer { width, solvable_witness: HashSet::new() } } diff --git a/acvm-repo/acvm/src/compiler/transformers/mod.rs b/acvm-repo/acvm/src/compiler/transformers/mod.rs index 4fd8ba7883f..4e29681cbed 100644 --- a/acvm-repo/acvm/src/compiler/transformers/mod.rs +++ b/acvm-repo/acvm/src/compiler/transformers/mod.rs @@ -8,6 +8,7 @@ use indexmap::IndexMap; mod csat; pub(crate) use csat::CSatTransformer; +pub use csat::MIN_EXPRESSION_WIDTH; use super::{transform_assert_messages, AcirTransformationMap}; diff --git a/compiler/noirc_driver/src/lib.rs b/compiler/noirc_driver/src/lib.rs index 2f0122524eb..f7270a6e4ed 100644 --- a/compiler/noirc_driver/src/lib.rs +++ b/compiler/noirc_driver/src/lib.rs @@ -5,6 +5,7 @@ use abi_gen::{abi_type_from_hir_type, value_from_hir_expression}; use acvm::acir::circuit::ExpressionWidth; +use acvm::compiler::MIN_EXPRESSION_WIDTH; use clap::Args; use fm::{FileId, FileManager}; use iter_extended::vecmap; @@ -134,7 +135,11 @@ pub fn parse_expression_width(input: &str) -> Result Ok(ExpressionWidth::Unbounded), - _ => Ok(ExpressionWidth::Bounded { width }), + w if w >= MIN_EXPRESSION_WIDTH => Ok(ExpressionWidth::Bounded { width }), + _ => Err(Error::new( + ErrorKind::InvalidInput, + format!("has to be 0 or at least {MIN_EXPRESSION_WIDTH}"), + )), } } diff --git a/tooling/nargo_cli/src/cli/mod.rs b/tooling/nargo_cli/src/cli/mod.rs index 10ec38ad1d5..9108815f05d 100644 --- a/tooling/nargo_cli/src/cli/mod.rs +++ b/tooling/nargo_cli/src/cli/mod.rs @@ -112,3 +112,19 @@ pub(crate) fn start_cli() -> eyre::Result<()> { println!("{markdown}"); Ok(()) } + +#[cfg(test)] +mod tests { + use clap::Parser; + #[test] + fn test_parse_invalid_expression_width() { + let cmd = "nargo --program-dir . compile --expression-width 1"; + let res = super::NargoCli::try_parse_from(cmd.split_ascii_whitespace()); + + let err = res.expect_err("should fail because of invalid width"); + assert!(err.to_string().contains("expression-width")); + assert!(err + .to_string() + .contains(acvm::compiler::MIN_EXPRESSION_WIDTH.to_string().as_str())); + } +} From 4d524bf34de98449419a025aa53d593bf42e70a7 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Fri, 18 Oct 2024 20:20:50 +0100 Subject: [PATCH 2/9] fix: Do not warn on unused self in traits (#6298) # Description ## Problem\* Resolves #6297 ## Summary\* Sets `warn_if_unused` to `false` for the `self` parameter of a function if it's for a trait implementation. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_frontend/src/elaborator/mod.rs | 3 ++- .../noirc_frontend/src/tests/unused_items.rs | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index 5067ac05c44..dafafe421eb 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -404,7 +404,8 @@ impl<'context> Elaborator<'context> { // so we need to reintroduce the same IDs into scope here. for parameter in &func_meta.parameter_idents { let name = self.interner.definition_name(parameter.id).to_owned(); - self.add_existing_variable_to_scope(name, parameter.clone(), true); + let warn_if_unused = !(func_meta.trait_impl.is_some() && name == "self"); + self.add_existing_variable_to_scope(name, parameter.clone(), warn_if_unused); } self.add_trait_constraints_to_scope(&func_meta); diff --git a/compiler/noirc_frontend/src/tests/unused_items.rs b/compiler/noirc_frontend/src/tests/unused_items.rs index 51bdf785688..86f77fc397a 100644 --- a/compiler/noirc_frontend/src/tests/unused_items.rs +++ b/compiler/noirc_frontend/src/tests/unused_items.rs @@ -274,3 +274,23 @@ fn no_warning_on_indirect_struct_if_it_has_an_abi_attribute() { "#; assert_no_errors(src); } + +#[test] +fn no_warning_on_self_in_trait_impl() { + let src = r#" + struct Bar {} + + trait Foo { + fn foo(self, a: u64); + } + + impl Foo for Bar { + fn foo(self, _a: u64) {} + } + + fn main() { + let _ = Bar {}; + } + "#; + assert_no_errors(src); +} From 4302e7e82e8981ef067ed5ec931511c8d031e631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Sat, 19 Oct 2024 11:55:37 +0100 Subject: [PATCH 3/9] chore(docs): refactoring guides and some other nits (#6175) This closes the remaining work for restoring some of the devex regression around noir and bb, and other docs improvements including homepage removal and redirects set-up. - [x] Made "Getting Started" E2E with `bbup` and `bb` as examples (closes #6222 and #6223) - [x] Removed BB specific documentation - [x] Updated docusaurus to latest - [x] Made homepage CTA open the docs in the same tab --------- Co-authored-by: Savio <72797635+Savio-Sou@users.noreply.github.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> --- .github/workflows/docs-pr.yml | 2 +- docs/.gitignore | 1 + docs/.markdownlint.json | 3 - docs/README.md | 8 +- docs/docs/getting_started/_category_.json | 5 - .../getting_started/backend/_category_.json | 6 - docs/docs/getting_started/backend/index.md | 31 - .../hello_noir/_category_.json | 5 - docs/docs/getting_started/hello_noir/index.md | 157 - .../installation/_category_.json | 6 - .../getting_started/installation/index.md | 46 - ...nstall_methods.md => noir_installation.md} | 10 +- .../{hello_noir => }/project_breakdown.md | 8 +- docs/docs/getting_started/quick_start.md | 124 + docs/docs/how_to/how-to-oracles.md | 2 +- docs/docs/how_to/how-to-solidity-verifier.md | 8 +- docs/docs/reference/noir_codegen.md | 6 +- docs/docs/tooling/debugger.md | 2 +- docs/docs/tutorials/noirjs_app.md | 12 +- docs/docusaurus.config.ts | 6 +- docs/package.json | 12 +- docs/src/pages/index.jsx | 2 +- yarn.lock | 2526 +++++++++++++++-- 23 files changed, 2463 insertions(+), 525 deletions(-) delete mode 100644 docs/.markdownlint.json delete mode 100644 docs/docs/getting_started/_category_.json delete mode 100644 docs/docs/getting_started/backend/_category_.json delete mode 100644 docs/docs/getting_started/backend/index.md delete mode 100644 docs/docs/getting_started/hello_noir/_category_.json delete mode 100644 docs/docs/getting_started/hello_noir/index.md delete mode 100644 docs/docs/getting_started/installation/_category_.json delete mode 100644 docs/docs/getting_started/installation/index.md rename docs/docs/getting_started/{installation/other_install_methods.md => noir_installation.md} (93%) rename docs/docs/getting_started/{hello_noir => }/project_breakdown.md (95%) create mode 100644 docs/docs/getting_started/quick_start.md diff --git a/.github/workflows/docs-pr.yml b/.github/workflows/docs-pr.yml index 9cb6775bfb7..78abb8252b3 100644 --- a/.github/workflows/docs-pr.yml +++ b/.github/workflows/docs-pr.yml @@ -80,7 +80,7 @@ jobs: - name: Build docs env: - MATOMO_ENV: staging # not really a secret, it will show in the footer anyway + ENV: staging # not really a secret, it will show in the footer anyway run: yarn workspaces foreach -Rpt --from docs run build - name: Upload artifact diff --git a/docs/.gitignore b/docs/.gitignore index 501e7e465ea..7ff8bd69a72 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -25,3 +25,4 @@ yarn-error.log* package-lock.json versions.json +.supermavenignore diff --git a/docs/.markdownlint.json b/docs/.markdownlint.json deleted file mode 100644 index 40896b4542f..00000000000 --- a/docs/.markdownlint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "no-missing-space-atx": false -} diff --git a/docs/README.md b/docs/README.md index c1d2bbd6d4e..d3554ae39f2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -28,7 +28,13 @@ yarn build ### Local Development ``` -yarn workspace docs start +yarn workspace docs version +``` + +This command fetches and compiles the list of documentation versions to build with. + +``` +yarn workspace docs dev ``` This command starts a local development server and opens up a browser window. Most changes are diff --git a/docs/docs/getting_started/_category_.json b/docs/docs/getting_started/_category_.json deleted file mode 100644 index 5d694210bbf..00000000000 --- a/docs/docs/getting_started/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "position": 0, - "collapsible": true, - "collapsed": true -} diff --git a/docs/docs/getting_started/backend/_category_.json b/docs/docs/getting_started/backend/_category_.json deleted file mode 100644 index b82e92beb0c..00000000000 --- a/docs/docs/getting_started/backend/_category_.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "position": 1, - "label": "Install Proving Backend", - "collapsible": true, - "collapsed": true -} diff --git a/docs/docs/getting_started/backend/index.md b/docs/docs/getting_started/backend/index.md deleted file mode 100644 index 7192d954877..00000000000 --- a/docs/docs/getting_started/backend/index.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Proving Backend Installation -description: Proving backends offer command line tools for proving and verifying Noir programs. This page describes how to install `bb` as an example. -keywords: [ - Proving - Backend - Barretenberg - bb - bbup - Installation - Terminal - Command - CLI - Version -] -pagination_next: getting_started/hello_noir/index ---- - -Proving backends each provide their own tools for working with Noir programs, providing functionality like proof generation, proof verification, and verifier smart contract generation. - -For the latest information on tooling provided by each proving backend, installation instructions, Noir version compatibility... you may refer to the proving backends' own documentation. - -You can find the full list of proving backends compatible with Noir in [Awesome Noir](https://github.com/noir-lang/awesome-noir/?tab=readme-ov-file#proving-backends). - -## Example: Installing `bb` - -`bb` is the CLI tool provided by the [Barretenberg proving backend](https://github.com/AztecProtocol/barretenberg) developed by Aztec Labs. - -You can find the instructions for installation in [`bb`'s documentation](https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/cpp/src/barretenberg/bb/readme.md#installation). - -Once installed, we are ready to start working on [our first Noir program](../hello_noir/index.md). diff --git a/docs/docs/getting_started/hello_noir/_category_.json b/docs/docs/getting_started/hello_noir/_category_.json deleted file mode 100644 index 976a2325de0..00000000000 --- a/docs/docs/getting_started/hello_noir/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "position": 2, - "collapsible": true, - "collapsed": true -} diff --git a/docs/docs/getting_started/hello_noir/index.md b/docs/docs/getting_started/hello_noir/index.md deleted file mode 100644 index 6760e54aad1..00000000000 --- a/docs/docs/getting_started/hello_noir/index.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: Creating a Project -description: - Learn how to create and verify your first Noir program using Nargo, a programming language for - zero-knowledge proofs. -keywords: - [ - Nargo, - Noir, - zero-knowledge proofs, - programming language, - create Noir program, - verify Noir program, - step-by-step guide, - ] -sidebar_position: 1 - ---- - -Now that we have installed Nargo and a proving backend, it is time to make our first hello world program! - -### 1. Create a new project directory - -Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home -directory to house our first Noir program. - -Create the directory and change directory into it by running: - -```sh -mkdir ~/projects -cd ~/projects -``` - -## Nargo - -Nargo provides the ability to initiate and execute Noir projects. Read the [Nargo installation](../installation/index.md) section to learn more about Nargo and how to install it. - -### 2. Create a new Noir project - -Now that we are in the projects directory, create a new Nargo project by running: - -```sh -nargo new hello_world -``` - -`hello_world` can be any arbitrary project name, we are simply using `hello_world` for demonstration. - -In production, it is common practice to name the project folder, `circuits`, for clarity amongst other folders in the codebase (like: `contracts`, `scripts`, and `test`). - -A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and -_Nargo.toml_ which contain the source code and environmental options of your Noir program -respectively. - -#### Intro to Noir Syntax - -Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: - -```rust -fn main(x : Field, y : pub Field) { - assert(x != y); -} -``` - -The first line of the program specifies the program's inputs: - -```rust -x : Field, y : pub Field -``` - -Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the -keyword `pub` (e.g. `y`). To learn more about private and public values, check the -[Data Types](../../noir/concepts/data_types/index.md) section. - -The next line of the program specifies its body: - -```rust -assert(x != y); -``` - -The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. - -For more Noir syntax, check the [Language Concepts](../../noir/concepts/comments.md) chapter. - -### 3. Build in/output files - -Change directory into _hello_world_ and build in/output files for your Noir program by running: - -```sh -cd hello_world -nargo check -``` - -A _Prover.toml_ file will be generated in your project directory, to allow specifying input values to the program. - -### 4. Execute the Noir program - -Now that the project is set up, we can execute our Noir program. - -Fill in input values for execution in the _Prover.toml_ file. For example: - -```toml -x = "1" -y = "2" -``` - -Execute your Noir program: - -```sh -nargo execute witness-name -``` - -The witness corresponding to this execution will then be written to the file `./target/witness-name.gz`. - -The command also automatically compiles your Noir program if it was not already / was edited, which you may notice the compiled artifacts being written to the file `./target/hello_world.json`. - -## Proving Backend - -Proving backends provide the ability to generate and verify proofs of executing Noir programs, following Noir's tooling that compiles and executes the programs. Read the [proving backend installation](../backend/index.md) section to learn more about proving backends and how to install them. - -Barretenberg is used as an example here to demonstrate how proving and verifying could be implemented and used. Read the [`bb` installation](../backend/index.md#example-installing-bb) section for how to install Barretenberg's CLI tool; refer to [`bb`'s documentation](https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/cpp/src/barretenberg/bb/readme.md) for full details about the tool. - -### 5. Prove an execution of the Noir program - -Using Barretenberg as an example, prove the valid execution of your Noir program running: - -```sh -bb prove -b ./target/hello_world.json -w ./target/witness-name.gz -o ./target/proof -``` - -The proof generated will then be written to the file `./target/proof`. - -:::tip -Since the params for `nargo` and `bb` often specify multiple filenames to read from or write to, remember to check each command is referring to the desired filenames. -Or for greater certainty, delete the target folder and go through each step again (compile, witness, prove, ...) to ensure files generated in past commands are being referenced in future ones. -::: - -### 6. Verify the execution proof - -Once a proof is generated, we can verify correct execution of our Noir program by verifying the proof file. - -Using Barretenberg as an example, compute the verification key for the Noir program by running: - -```sh -bb write_vk -b ./target/hello_world.json -o ./target/vk -``` - -And verify your proof by running: - -```sh -bb verify -k ./target/vk -p ./target/proof -``` - -If successful, the verification will complete in silence; if unsuccessful, the command will trigger logging of the corresponding error. - -Congratulations, you have now created and verified a proof for your very first Noir program! - -In the [next section](./project_breakdown.md), we will go into more detail on each step performed. diff --git a/docs/docs/getting_started/installation/_category_.json b/docs/docs/getting_started/installation/_category_.json deleted file mode 100644 index 0c02fb5d4d7..00000000000 --- a/docs/docs/getting_started/installation/_category_.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "position": 0, - "label": "Install Nargo", - "collapsible": true, - "collapsed": true -} diff --git a/docs/docs/getting_started/installation/index.md b/docs/docs/getting_started/installation/index.md deleted file mode 100644 index 53ea9c7891c..00000000000 --- a/docs/docs/getting_started/installation/index.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Nargo Installation -description: - nargo is a command line tool for interacting with Noir programs. This page is a quick guide on how to install Nargo through the most common and easy method, noirup -keywords: [ - Nargo - Noir - Rust - Cargo - Noirup - Installation - Terminal Commands - Version Check - Nightlies - Specific Versions - Branches - Noirup Repository -] -pagination_next: getting_started/hello_noir/index ---- - -`nargo` is a tool for working with Noir programs on the CLI, providing you with the ability to start new projects, compile, execute and test Noir programs from the terminal. - -The name is inspired by Rust's package manager `cargo`; and similar to Rust's `rustup`, Noir also has an easy installation script `noirup`. - -## Installing Noirup - -Open a terminal on your machine, and write: - -```bash -curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash -``` - -Close the terminal, open another one, and run - -```bash -noirup -``` - -Done. That's it. You should have the latest version working. You can check with `nargo --version`. - -You can also install nightlies, specific versions -or branches. Check out the [noirup repository](https://github.com/noir-lang/noirup) for more -information. - -Now we're ready to start working on [our first Noir program!](../hello_noir/index.md) diff --git a/docs/docs/getting_started/installation/other_install_methods.md b/docs/docs/getting_started/noir_installation.md similarity index 93% rename from docs/docs/getting_started/installation/other_install_methods.md rename to docs/docs/getting_started/noir_installation.md index 3634723562b..f92fd8dea38 100644 --- a/docs/docs/getting_started/installation/other_install_methods.md +++ b/docs/docs/getting_started/noir_installation.md @@ -1,5 +1,5 @@ --- -title: Alternative Installations +title: Standalone Noir Installation description: There are different ways to install Nargo, the one-stop shop and command-line tool for developing Noir programs. This guide explains how to specify which version to install when using noirup, and using WSL for windows. keywords: [ Installation @@ -14,11 +14,9 @@ keywords: [ Direnv Uninstalling Nargo ] -sidebar_position: 1 +sidebar_position: 2 --- -## Encouraged Installation Method: Noirup - Noirup is the endorsed method for installing Nargo, streamlining the process of fetching binaries or compiling from source. It supports a range of options to cater to your specific needs, from nightly builds and specific versions to compiling from various sources. ### Installing Noirup @@ -40,6 +38,7 @@ With `noirup`, you can easily switch between different Nargo versions, including ``` - **Specific Version**: Install a specific version of Nargo. + ```sh noirup --version ``` @@ -79,6 +78,7 @@ With `noirup`, you can easily switch between different Nargo versions, including ``` - **From Local Source**: Compile and install from a local directory. + ```sh noirup --path ./path/to/local/source ``` @@ -89,7 +89,7 @@ The default backend for Noir (Barretenberg) doesn't provide Windows binaries at Step 1: Follow the instructions [here](https://learn.microsoft.com/en-us/windows/wsl/install) to install and run WSL. -step 2: Follow the [Noirup instructions](#encouraged-installation-method-noirup). +step 2: Follow the [Noirup instructions](#installing-noirup). ## Uninstalling Nargo diff --git a/docs/docs/getting_started/hello_noir/project_breakdown.md b/docs/docs/getting_started/project_breakdown.md similarity index 95% rename from docs/docs/getting_started/hello_noir/project_breakdown.md rename to docs/docs/getting_started/project_breakdown.md index 96e653f6c08..e442e377040 100644 --- a/docs/docs/getting_started/hello_noir/project_breakdown.md +++ b/docs/docs/getting_started/project_breakdown.md @@ -5,7 +5,7 @@ description: file, and how to prove and verify your program. keywords: [Nargo, Nargo project, Prover.toml, proof verification, private asset transfer] -sidebar_position: 2 +sidebar_position: 1 --- This section breaks down our hello world program from the previous section. @@ -46,7 +46,7 @@ license = "MIT" ecrecover = {tag = "v0.9.0", git = "https://github.com/colinnielsen/ecrecover-noir.git"} ``` -Nargo.toml for a [workspace](../../noir/modules_packages_crates/workspaces.md) will look a bit different. For example: +Nargo.toml for a [workspace](../noir/modules_packages_crates/workspaces.md) will look a bit different. For example: ```toml [workspace] @@ -66,11 +66,11 @@ The package section defines a number of fields including: - `entry` (optional) - a relative filepath to use as the entry point into your package (overrides the default of `src/lib.nr` or `src/main.nr`) - `backend` (optional) - `license` (optional) -- `expression_width` (optional) - Sets the default backend expression width. This field will override the default backend expression width specified by the Noir compiler (currently set to width 4). +- `expression_width` (optional) - Sets the default backend expression width. This field will override the default backend expression width specified by the Noir compiler (currently set to width 4). #### Dependencies section -This is where you will specify any dependencies for your project. See the [Dependencies page](../../noir/modules_packages_crates/dependencies.md) for more info. +This is where you will specify any dependencies for your project. See the [Dependencies page](../noir/modules_packages_crates/dependencies.md) for more info. `./proofs/` and `./contract/` directories will not be immediately visible until you create a proof or verifier contract respectively. diff --git a/docs/docs/getting_started/quick_start.md b/docs/docs/getting_started/quick_start.md new file mode 100644 index 00000000000..4ce48409818 --- /dev/null +++ b/docs/docs/getting_started/quick_start.md @@ -0,0 +1,124 @@ +--- +title: Quick Start +tags: [] +sidebar_position: 0 +--- + +## Installation + +### Noir + +The easiest way to develop with Noir is using Nargo the CLI tool. It provides you the ability to start new projects, compile, execute and test Noir programs from the terminal. + +You can use `noirup` the installation script to quickly install and update Nargo: + +```bash +curl -L noirup.dev | bash +noirup +``` + +### Proving backend + +After installing Noir, we install a proving backend to work with our Noir programs. + +Proving backends provide you the abilities to generate proofs, verify proofs, generate smart contracts and more for your Noir programs. + +Different proving backends provide different tools for working with Noir programs, here we will use the [Barretenberg proving backend](https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg) developed by Aztec Labs as an example. + +You can use the `bbup` installation script to quickly install and update BB, Barretenberg's CLI tool: + +You can find the full list of proving backends compatible with Noir in Awesome Noir. + +```bash +curl -L bbup.dev | bash +bbup +``` + +For the full list of proving backends compatible with Noir, visit [Awesome Noir](https://github.com/noir-lang/awesome-noir/?tab=readme-ov-file#proving-backends). + +## Nargo + +Nargo provides the ability to initiate and execute Noir projects. Let's initialize the traditional `hello_world`: + +```sh +nargo new hello_world +``` + +Two files will be created. + +- `src/main.nr` contains a simple boilerplate circuit +- `Nargo.toml` contains environmental options, such as name, author, dependencies, and others. + +Glancing at _main.nr_ , we can see that inputs in Noir are private by default, but can be labeled public using the keyword `pub`. This means that we will _assert_ that we know a value `x` which is different from `y` without revealing `x`: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +To learn more about private and public values, check the [Data Types](../noir/concepts/data_types/index.md) section. + +### Compiling and executing + +We can now use `nargo` to generate a _Prover.toml_ file, where our input values will be specified: + +```sh +cd hello_world +nargo check + +Let's feed some valid values into this file: + +```toml +x = "1" +y = "2" +``` + +We're now ready to compile and execute our Noir program. By default the `nargo execute` command will do both, and generate the `witness` that we need to feed to our proving backend: + +```sh +nargo execute +``` + +The witness corresponding to this execution will then be written to the file _./target/witness-name.gz_. + +The command also automatically compiles your Noir program if it was not already / was edited, which you may notice the compiled artifacts being written to the file _./target/hello_world.json_. + +With circuit compiled and witness generated, we're ready to prove. + +## Proving backend + +Different proving backends may provide different tools and commands to work with Noir programs. Here Barretenberg's `bb` CLI tool is used as an example: + +```sh +bb prove -b ./target/hello_world.json -w ./target/hello_world.gz -o ./target/proof +``` + +:::tip + +Naming can be confusing, specially as you pass them to the `bb` commands. If unsure, it won't hurt to delete the target folder and start anew to make sure you're using the most recent versions of the compiled circuit and witness. + +::: + +The proof is now generated in the `target` folder. To verify it we first need to compute the verification key from the compiled circuit, and use it to verify: + +```sh +bb write_vk -b ./target/hello_world.json -o ./target/vk +bb verify -k ./target/vk -p ./target/proof +``` + +:::info + +Notice that in order to verify a proof, the verifier knows nothing but the circuit, which is compiled and used to generate the verification key. This is obviously quite important: private inputs remain private. + +As for the public inputs, you may have noticed they haven't been specified. This behavior varies with each particular backend, but barretenberg typically attaches them to the proof. You can see them by parsing and splitting it. For example for if your public inputs are 32 bytes: + +```bash +head -c 32 ./target/proof | od -An -v -t x1 | tr -d $' \n' +``` + +::: + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](./project_breakdown.md), we will go into more detail on each step performed. diff --git a/docs/docs/how_to/how-to-oracles.md b/docs/docs/how_to/how-to-oracles.md index 2f69902062c..dc49b192384 100644 --- a/docs/docs/how_to/how-to-oracles.md +++ b/docs/docs/how_to/how-to-oracles.md @@ -174,7 +174,7 @@ If the Oracle function is returning an array containing other arrays, such as `[ ## Step 3 - Usage with Nargo -Using the [`nargo` CLI tool](../getting_started/installation/index.md), you can use oracles in the `nargo test` and `nargo execute` commands by passing a value to `--oracle-resolver`. For example: +Using the [`nargo` CLI tool](../getting_started/noir_installation.md), you can use oracles in the `nargo test` and `nargo execute` commands by passing a value to `--oracle-resolver`. For example: ```bash nargo test --oracle-resolver http://localhost:5555 diff --git a/docs/docs/how_to/how-to-solidity-verifier.md b/docs/docs/how_to/how-to-solidity-verifier.md index a8169595b3d..2cc0f8e57ce 100644 --- a/docs/docs/how_to/how-to-solidity-verifier.md +++ b/docs/docs/how_to/how-to-solidity-verifier.md @@ -27,7 +27,7 @@ This allows for a powerful feature set, as one can make use of the conciseness a This guide shows you how to generate a Solidity Verifier and deploy it on the [Remix IDE](https://remix.ethereum.org/). It is assumed that: - You are comfortable with the Solidity programming language and understand how contracts are deployed on the Ethereum network -- You have Noir installed and you have a Noir program. If you don't, [get started](../getting_started/installation/index.md) with Nargo and the example Hello Noir circuit +- You have Noir installed and you have a Noir program. If you don't, [get started](../getting_started/quick_start.md) with Nargo and the example Hello Noir circuit - You are comfortable navigating RemixIDE. If you aren't or you need a refresher, you can find some video tutorials [here](https://www.youtube.com/channel/UCjTUPyFEr2xDGN6Cg8nKDaA) that could help you. ## Rundown @@ -57,7 +57,7 @@ bb contract replacing `` with the name of your Noir project. A new `contract` folder would then be generated in your project directory, containing the Solidity file `contract.sol`. It can be deployed to any EVM blockchain acting as a verifier smart contract. -You can find more information about `bb` and the default Noir proving backend on [this page](../getting_started/hello_noir/index.md#proving-backend). +You can find more information about `bb` and the default Noir proving backend on [this page](../getting_started/quick_start.md#proving-backend). :::info @@ -133,9 +133,9 @@ To verify a proof using the Solidity verifier contract, we call the `verify` fun function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) ``` -When using the default example in the [Hello Noir](../getting_started/hello_noir/index.md) guide, the easiest way to confirm that the verifier contract is doing its job is by calling the `verify` function via remix with the required parameters. Note that the public inputs must be passed in separately to the rest of the proof so we must split the proof as returned from `bb`. +When using the default example in the [Hello Noir](../getting_started/quick_start.md) guide, the easiest way to confirm that the verifier contract is doing its job is by calling the `verify` function via remix with the required parameters. Note that the public inputs must be passed in separately to the rest of the proof so we must split the proof as returned from `bb`. -First generate a proof with `bb` at the location `./proof` using the steps in [get started](../getting_started/hello_noir/index.md), this proof is in a binary format but we want to convert it into a hex string to pass into Remix, this can be done with the +First generate a proof with `bb` at the location `./proof` using the steps in [get started](../getting_started/quick_start.md), this proof is in a binary format but we want to convert it into a hex string to pass into Remix, this can be done with the ```bash # This value must be changed to match the number of public inputs (including return values!) in your program. diff --git a/docs/docs/reference/noir_codegen.md b/docs/docs/reference/noir_codegen.md index db8f07dc22e..e4c362f9610 100644 --- a/docs/docs/reference/noir_codegen.md +++ b/docs/docs/reference/noir_codegen.md @@ -7,7 +7,8 @@ sidebar_position: 3 When using TypeScript, it is extra work to interpret Noir program outputs in a type-safe way. Third party libraries may exist for popular Noir programs, but they are either hard to find or unmaintained. -Now you can generate TypeScript bindings for your Noir programs in two steps: +Now you can generate TypeScript bindings for your Noir programs in two steps: + 1. Exporting Noir functions using `nargo export` 2. Using the TypeScript module `noir_codegen` to generate TypeScript binding @@ -33,7 +34,8 @@ yarn add @noir-lang/noir_codegen -D ``` ### Nargo library -Make sure you have Nargo, v0.25.0 or greater, installed. If you don't, follow the [installation guide](../getting_started/installation/index.md). + +Make sure you have Nargo, v0.25.0 or greater, installed. If you don't, follow the [installation guide](../getting_started/noir_installation.md). If you're in a new project, make a `circuits` folder and create a new Noir library: diff --git a/docs/docs/tooling/debugger.md b/docs/docs/tooling/debugger.md index 9b7565ba9ff..200b5fc423a 100644 --- a/docs/docs/tooling/debugger.md +++ b/docs/docs/tooling/debugger.md @@ -12,7 +12,7 @@ There are currently two ways of debugging Noir programs: 1. From VS Code, via the [vscode-noir](https://github.com/noir-lang/vscode-noir) extension. You can install it via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir). 2. Via the REPL debugger, which ships with Nargo. -In order to use either version of the debugger, you will need to install recent enough versions of Noir, [Nargo](../getting_started/installation/index.md) and vscode-noir: +In order to use either version of the debugger, you will need to install recent enough versions of Noir, [Nargo](../getting_started/noir_installation.md) and vscode-noir: - Noir & Nargo ≥0.28.0 - Noir's VS Code extension ≥0.0.11 diff --git a/docs/docs/tutorials/noirjs_app.md b/docs/docs/tutorials/noirjs_app.md index eac28168445..6e69ea0bbed 100644 --- a/docs/docs/tutorials/noirjs_app.md +++ b/docs/docs/tutorials/noirjs_app.md @@ -24,13 +24,13 @@ Before we start, we want to make sure we have Node, Nargo and the Barretenberg p We start by opening a terminal and executing `node --version`. If we don't get an output like `v20.10.0`, that means node is not installed. Let's do that by following the handy [nvm guide](https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script). -As for `Nargo`, we can follow the [Nargo guide](../getting_started/installation/index.md) to install it. If you're lazy, just paste this on a terminal and run `noirup`: +As for `Nargo`, we can follow the [Nargo guide](../getting_started/quick_start.md) to install it. If you're lazy, just paste this on a terminal and run `noirup`: ```sh curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash ``` -Follow the instructions on [this page](https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg/cpp/src/barretenberg/bb#installation) to install `bb`. +Follow the instructions on [this page](https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg/cpp/src/barretenberg/bb#installation) to install `bb`. Version 0.41.0 is compatible with `nargo` version 0.31.0, which you can install with `bbup -v 0.41.0` once `bbup` is installed. Easy enough. Onwards! @@ -78,7 +78,7 @@ At this point in the tutorial, your folder structure should look like this: ### Node and Vite If you want to explore Nargo, feel free to go on a side-quest now and follow the steps in the -[getting started](../getting_started/hello_noir/index.md) guide. However, we want our app to run on the browser, so we need Vite. +[getting started](../getting_started/quick_start.md) guide. However, we want our app to run on the browser, so we need Vite. Vite is a powerful tool to generate static websites. While it provides all kinds of features, let's just go barebones with some good old vanilla JS. @@ -350,13 +350,17 @@ You should also check out the more advanced examples in the [noir-examples repo] ## UltraHonk Backend Barretenberg has recently exposed a new UltraHonk backend. We can use UltraHonk in NoirJS after version 0.33.0. Everything will be the same as the tutorial above, except that the class we need to import will change: + ```js import { UltraHonkBackend, UltraHonkVerifier as Verifier } from '@noir-lang/backend_barretenberg'; ``` + The backend will then be instantiated as such: + ```js const backend = new UltraHonkBackend(circuit); ``` + Then all the commands to prove and verify your circuit will be same. -The only feature currently unsupported with UltraHonk are [recursive proofs](../explainers/explainer-recursion.md). \ No newline at end of file +The only feature currently unsupported with UltraHonk are [recursive proofs](../explainers/explainer-recursion.md). diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 29f612b0109..c7af7e494d1 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -15,7 +15,7 @@ export default { url: 'https://noir-lang.org', baseUrl: '/', onBrokenLinks: 'throw', - onBrokenMarkdownLinks: 'throw', + onBrokenMarkdownLinks: process.env.ENV === 'dev' ? 'warn' : 'throw', i18n: { defaultLocale: 'en', locales: ['en'], @@ -26,7 +26,7 @@ export default { '@docusaurus/preset-classic', { docs: { - path: 'processed-docs', + path: process.env.ENV === 'dev' ? 'docs' : 'processed-docs', sidebarPath: './sidebars.js', routeBasePath: '/docs', remarkPlugins: [math], @@ -48,7 +48,7 @@ export default { ], ], customFields: { - MATOMO_ENV: process.env.MATOMO_ENV, + MATOMO_ENV: process.env.ENV, }, themeConfig: { colorMode: { diff --git a/docs/package.json b/docs/package.json index c81d0b7b24f..39807588eaa 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "preprocess": "yarn workspace @noir-lang/acvm_js build && ./scripts/codegen_nargo_reference.sh && yarn node ./scripts/preprocess/index.js", - "start": "yarn preprocess && MATOMO_ENV=dev docusaurus start", + "dev": "yarn preprocess && ENV=dev docusaurus start", "build": "yarn preprocess && docusaurus build", "clean": "rm -rf ./processed-docs ./processed-docs ./build", "version::stables": "ts-node ./scripts/setStable.ts", @@ -13,8 +13,8 @@ "version": "yarn version::stables && ./scripts/cut_version.sh" }, "dependencies": { - "@docusaurus/core": "^3.0.1", - "@docusaurus/preset-classic": "^3.0.1", + "@docusaurus/core": "^3.5.2", + "@docusaurus/preset-classic": "^3.5.2", "@easyops-cn/docusaurus-search-local": "^0.35.0", "@mdx-js/react": "^3.0.0", "@noir-lang/noir_js": "workspace:*", @@ -31,9 +31,9 @@ "remark-math": "^6.0.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.0.1", - "@docusaurus/tsconfig": "^3.0.1", - "@docusaurus/types": "^3.0.1", + "@docusaurus/module-type-aliases": "^3.5.2", + "@docusaurus/tsconfig": "^3.5.2", + "@docusaurus/types": "^3.5.2", "@types/prettier": "^3", "docusaurus-plugin-typedoc": "1.0.0-next.18", "eslint-plugin-prettier": "^5.1.3", diff --git a/docs/src/pages/index.jsx b/docs/src/pages/index.jsx index e6532b1db85..868df304233 100644 --- a/docs/src/pages/index.jsx +++ b/docs/src/pages/index.jsx @@ -31,7 +31,7 @@ export default function Landing() {
- +
diff --git a/yarn.lock b/yarn.lock index ae9251ac205..4e69184763a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -245,6 +245,16 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/code-frame@npm:7.24.7" + dependencies: + "@babel/highlight": ^7.24.7 + picocolors: ^1.0.0 + checksum: 830e62cd38775fdf84d612544251ce773d544a8e63df667728cc9e0126eeef14c6ebda79be0f0bc307e8318316b7f58c27ce86702e0a1f5c321d842eb38ffda4 + languageName: node + linkType: hard + "@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.22.9, @babel/compat-data@npm:^7.23.3, @babel/compat-data@npm:^7.23.5": version: 7.23.5 resolution: "@babel/compat-data@npm:7.23.5" @@ -252,6 +262,13 @@ __metadata: languageName: node linkType: hard +"@babel/compat-data@npm:^7.25.2, @babel/compat-data@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/compat-data@npm:7.25.4" + checksum: b12a91d27c3731a4b0bdc9312a50b1911f41f7f728aaf0d4b32486e2257fd2cb2d3ea1a295e98449600c48f2c7883a3196ca77cda1cef7d97a10c2e83d037974 + languageName: node + linkType: hard + "@babel/core@npm:7.12.9": version: 7.12.9 resolution: "@babel/core@npm:7.12.9" @@ -299,6 +316,29 @@ __metadata: languageName: node linkType: hard +"@babel/core@npm:^7.21.3": + version: 7.25.2 + resolution: "@babel/core@npm:7.25.2" + dependencies: + "@ampproject/remapping": ^2.2.0 + "@babel/code-frame": ^7.24.7 + "@babel/generator": ^7.25.0 + "@babel/helper-compilation-targets": ^7.25.2 + "@babel/helper-module-transforms": ^7.25.2 + "@babel/helpers": ^7.25.0 + "@babel/parser": ^7.25.0 + "@babel/template": ^7.25.0 + "@babel/traverse": ^7.25.2 + "@babel/types": ^7.25.2 + convert-source-map: ^2.0.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.2 + json5: ^2.2.3 + semver: ^6.3.1 + checksum: 9a1ef604a7eb62195f70f9370cec45472a08114e3934e3eaaedee8fd754edf0730e62347c7b4b5e67d743ce57b5bb8cf3b92459482ca94d06e06246ef021390a + languageName: node + linkType: hard + "@babel/generator@npm:^7.12.5, @babel/generator@npm:^7.18.7, @babel/generator@npm:^7.23.3, @babel/generator@npm:^7.23.5": version: 7.23.5 resolution: "@babel/generator@npm:7.23.5" @@ -311,6 +351,18 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.25.0, @babel/generator@npm:^7.25.6": + version: 7.25.6 + resolution: "@babel/generator@npm:7.25.6" + dependencies: + "@babel/types": ^7.25.6 + "@jridgewell/gen-mapping": ^0.3.5 + "@jridgewell/trace-mapping": ^0.3.25 + jsesc: ^2.5.1 + checksum: b55975cd664f5602304d868bb34f4ee3bed6f5c7ce8132cd92ff27a46a53a119def28a182d91992e86f75db904f63094a81247703c4dc96e4db0c03fd04bcd68 + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -320,6 +372,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-annotate-as-pure@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-annotate-as-pure@npm:7.24.7" + dependencies: + "@babel/types": ^7.24.7 + checksum: 6178566099a6a0657db7a7fa601a54fb4731ca0b8614fbdccfd8e523c210c13963649bc8fdfd53ce7dd14d05e3dda2fb22dea5b30113c488b9eb1a906d60212e + languageName: node + linkType: hard + "@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.22.15": version: 7.22.15 resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.22.15" @@ -329,6 +390,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.24.7" + dependencies: + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 71a6158a9fdebffb82fdc400d5555ba8f2e370cea81a0d578155877bdc4db7d5252b75c43b2fdf3f72b3f68348891f99bd35ae315542daad1b7ace8322b1abcb + languageName: node + linkType: hard + "@babel/helper-compilation-targets@npm:^7.22.15, @babel/helper-compilation-targets@npm:^7.22.6": version: 7.22.15 resolution: "@babel/helper-compilation-targets@npm:7.22.15" @@ -342,6 +413,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-compilation-targets@npm:^7.24.7, @babel/helper-compilation-targets@npm:^7.24.8, @babel/helper-compilation-targets@npm:^7.25.2": + version: 7.25.2 + resolution: "@babel/helper-compilation-targets@npm:7.25.2" + dependencies: + "@babel/compat-data": ^7.25.2 + "@babel/helper-validator-option": ^7.24.8 + browserslist: ^4.23.1 + lru-cache: ^5.1.1 + semver: ^6.3.1 + checksum: aed33c5496cb9db4b5e2d44e26bf8bc474074cc7f7bb5ebe1d4a20fdeb362cb3ba9e1596ca18c7484bcd6e5c3a155ab975e420d520c0ae60df81f9de04d0fd16 + languageName: node + linkType: hard + "@babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helper-create-class-features-plugin@npm:7.23.5" @@ -361,6 +445,23 @@ __metadata: languageName: node linkType: hard +"@babel/helper-create-class-features-plugin@npm:^7.24.7, @babel/helper-create-class-features-plugin@npm:^7.25.0, @babel/helper-create-class-features-plugin@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/helper-create-class-features-plugin@npm:7.25.4" + dependencies: + "@babel/helper-annotate-as-pure": ^7.24.7 + "@babel/helper-member-expression-to-functions": ^7.24.8 + "@babel/helper-optimise-call-expression": ^7.24.7 + "@babel/helper-replace-supers": ^7.25.0 + "@babel/helper-skip-transparent-expression-wrappers": ^7.24.7 + "@babel/traverse": ^7.25.4 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 4544ebda4516eb25efdebd47ca024bd7bdb1eb6e7cc3ad89688c8ef8e889734c2f4411ed78981899c641394f013f246f2af63d92a0e9270f6c453309b4cb89ba + languageName: node + linkType: hard + "@babel/helper-create-regexp-features-plugin@npm:^7.18.6, @babel/helper-create-regexp-features-plugin@npm:^7.22.15, @babel/helper-create-regexp-features-plugin@npm:^7.22.5": version: 7.22.15 resolution: "@babel/helper-create-regexp-features-plugin@npm:7.22.15" @@ -374,6 +475,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-create-regexp-features-plugin@npm:^7.24.7, @babel/helper-create-regexp-features-plugin@npm:^7.25.0, @babel/helper-create-regexp-features-plugin@npm:^7.25.2": + version: 7.25.2 + resolution: "@babel/helper-create-regexp-features-plugin@npm:7.25.2" + dependencies: + "@babel/helper-annotate-as-pure": ^7.24.7 + regexpu-core: ^5.3.1 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: df55fdc6a1f3090dd37d91347df52d9322d52affa239543808dc142f8fe35e6787e67d8612337668198fac85826fafa9e6772e6c28b7d249ec94e6fafae5da6e + languageName: node + linkType: hard + "@babel/helper-define-polyfill-provider@npm:^0.4.3": version: 0.4.3 resolution: "@babel/helper-define-polyfill-provider@npm:0.4.3" @@ -389,6 +503,21 @@ __metadata: languageName: node linkType: hard +"@babel/helper-define-polyfill-provider@npm:^0.6.2": + version: 0.6.2 + resolution: "@babel/helper-define-polyfill-provider@npm:0.6.2" + dependencies: + "@babel/helper-compilation-targets": ^7.22.6 + "@babel/helper-plugin-utils": ^7.22.5 + debug: ^4.1.1 + lodash.debounce: ^4.0.8 + resolve: ^1.14.2 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 2bba965ea9a4887ddf9c11d51d740ab473bd7597b787d042c325f6a45912dfe908c2d6bb1d837bf82f7e9fa51e6ad5150563c58131d2bb85515e63d971414a9c + languageName: node + linkType: hard + "@babel/helper-environment-visitor@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-environment-visitor@npm:7.22.20" @@ -424,6 +553,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-member-expression-to-functions@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-member-expression-to-functions@npm:7.24.8" + dependencies: + "@babel/traverse": ^7.24.8 + "@babel/types": ^7.24.8 + checksum: bf923d05d81b06857f4ca4fe9c528c9c447a58db5ea39595bb559eae2fce01a8266173db0fd6a2ec129d7bbbb9bb22f4e90008252f7c66b422c76630a878a4bc + languageName: node + linkType: hard + "@babel/helper-module-imports@npm:^7.22.15": version: 7.22.15 resolution: "@babel/helper-module-imports@npm:7.22.15" @@ -433,6 +572,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-module-imports@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-module-imports@npm:7.24.7" + dependencies: + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 8ac15d96d262b8940bc469052a048e06430bba1296369be695fabdf6799f201dd0b00151762b56012a218464e706bc033f27c07f6cec20c6f8f5fd6543c67054 + languageName: node + linkType: hard + "@babel/helper-module-transforms@npm:^7.12.1, @babel/helper-module-transforms@npm:^7.23.3": version: 7.23.3 resolution: "@babel/helper-module-transforms@npm:7.23.3" @@ -448,6 +597,20 @@ __metadata: languageName: node linkType: hard +"@babel/helper-module-transforms@npm:^7.24.7, @babel/helper-module-transforms@npm:^7.24.8, @babel/helper-module-transforms@npm:^7.25.0, @babel/helper-module-transforms@npm:^7.25.2": + version: 7.25.2 + resolution: "@babel/helper-module-transforms@npm:7.25.2" + dependencies: + "@babel/helper-module-imports": ^7.24.7 + "@babel/helper-simple-access": ^7.24.7 + "@babel/helper-validator-identifier": ^7.24.7 + "@babel/traverse": ^7.25.2 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 282d4e3308df6746289e46e9c39a0870819630af5f84d632559171e4fae6045684d771a65f62df3d569e88ccf81dc2def78b8338a449ae3a94bb421aa14fc367 + languageName: node + linkType: hard + "@babel/helper-optimise-call-expression@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-optimise-call-expression@npm:7.22.5" @@ -457,6 +620,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-optimise-call-expression@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-optimise-call-expression@npm:7.24.7" + dependencies: + "@babel/types": ^7.24.7 + checksum: 280654eaf90e92bf383d7eed49019573fb35a98c9e992668f701ad099957246721044be2068cf6840cb2299e0ad393705a1981c88c23a1048096a8d59e5f79a3 + languageName: node + linkType: hard + "@babel/helper-plugin-utils@npm:7.10.4": version: 7.10.4 resolution: "@babel/helper-plugin-utils@npm:7.10.4" @@ -471,6 +643,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-plugin-utils@npm:^7.24.7, @babel/helper-plugin-utils@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-plugin-utils@npm:7.24.8" + checksum: 73b1a83ba8bcee21dc94de2eb7323207391715e4369fd55844bb15cf13e3df6f3d13a40786d990e6370bf0f571d94fc31f70dec96c1d1002058258c35ca3767a + languageName: node + linkType: hard + "@babel/helper-remap-async-to-generator@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-remap-async-to-generator@npm:7.22.20" @@ -484,6 +663,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-remap-async-to-generator@npm:^7.24.7, @babel/helper-remap-async-to-generator@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/helper-remap-async-to-generator@npm:7.25.0" + dependencies: + "@babel/helper-annotate-as-pure": ^7.24.7 + "@babel/helper-wrap-function": ^7.25.0 + "@babel/traverse": ^7.25.0 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 47f3065e43fe9d6128ddb4291ffb9cf031935379265fd13de972b5f241943121f7583efb69cd2e1ecf39e3d0f76f047547d56c3fcc2c853b326fad5465da0bd7 + languageName: node + linkType: hard + "@babel/helper-replace-supers@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-replace-supers@npm:7.22.20" @@ -497,6 +689,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-replace-supers@npm:^7.24.7, @babel/helper-replace-supers@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/helper-replace-supers@npm:7.25.0" + dependencies: + "@babel/helper-member-expression-to-functions": ^7.24.8 + "@babel/helper-optimise-call-expression": ^7.24.7 + "@babel/traverse": ^7.25.0 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: f669fc2487c22d40b808f94b9c3ee41129484d5ef0ba689bdd70f216ff91e10b6b021d2f8cd37e7bdd700235a2a6ae6622526344f064528190383bf661ac65f8 + languageName: node + linkType: hard + "@babel/helper-simple-access@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-simple-access@npm:7.22.5" @@ -506,6 +711,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-simple-access@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-simple-access@npm:7.24.7" + dependencies: + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: ddbf55f9dea1900213f2a1a8500fabfd21c5a20f44dcfa957e4b0d8638c730f88751c77f678644f754f1a1dc73f4eb8b766c300deb45a9daad000e4247957819 + languageName: node + linkType: hard + "@babel/helper-skip-transparent-expression-wrappers@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.22.5" @@ -515,6 +730,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.24.7" + dependencies: + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 11b28fe534ce2b1a67c4d8e51a7b5711a2a0a0cae802f74614eee54cca58c744d9a62f6f60103c41759e81c537d270bfd665bf368a6bea214c6052f2094f8407 + languageName: node + linkType: hard + "@babel/helper-split-export-declaration@npm:^7.22.6": version: 7.22.6 resolution: "@babel/helper-split-export-declaration@npm:7.22.6" @@ -531,6 +756,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-string-parser@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-string-parser@npm:7.24.8" + checksum: 39b03c5119216883878655b149148dc4d2e284791e969b19467a9411fccaa33f7a713add98f4db5ed519535f70ad273cdadfd2eb54d47ebbdeac5083351328ce + languageName: node + linkType: hard + "@babel/helper-validator-identifier@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-validator-identifier@npm:7.22.20" @@ -538,6 +770,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-validator-identifier@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-validator-identifier@npm:7.24.7" + checksum: 6799ab117cefc0ecd35cd0b40ead320c621a298ecac88686a14cffceaac89d80cdb3c178f969861bf5fa5e4f766648f9161ea0752ecfe080d8e89e3147270257 + languageName: node + linkType: hard + "@babel/helper-validator-option@npm:^7.22.15, @babel/helper-validator-option@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helper-validator-option@npm:7.23.5" @@ -545,6 +784,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-validator-option@npm:^7.24.7, @babel/helper-validator-option@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-validator-option@npm:7.24.8" + checksum: a52442dfa74be6719c0608fee3225bd0493c4057459f3014681ea1a4643cd38b68ff477fe867c4b356da7330d085f247f0724d300582fa4ab9a02efaf34d107c + languageName: node + linkType: hard + "@babel/helper-wrap-function@npm:^7.22.20": version: 7.22.20 resolution: "@babel/helper-wrap-function@npm:7.22.20" @@ -556,6 +802,17 @@ __metadata: languageName: node linkType: hard +"@babel/helper-wrap-function@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/helper-wrap-function@npm:7.25.0" + dependencies: + "@babel/template": ^7.25.0 + "@babel/traverse": ^7.25.0 + "@babel/types": ^7.25.0 + checksum: 0095b4741704066d1687f9bbd5370bb88c733919e4275e49615f70c180208148ff5f24ab58d186ce92f8f5d28eab034ec6617e9264590cc4744c75302857629c + languageName: node + linkType: hard + "@babel/helpers@npm:^7.12.5, @babel/helpers@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helpers@npm:7.23.5" @@ -567,6 +824,16 @@ __metadata: languageName: node linkType: hard +"@babel/helpers@npm:^7.25.0": + version: 7.25.6 + resolution: "@babel/helpers@npm:7.25.6" + dependencies: + "@babel/template": ^7.25.0 + "@babel/types": ^7.25.6 + checksum: 5a548999db82049a5f7ac6de57576b4ed0d386ce07d058151698836ed411eae6230db12535487caeebb68a2ffc964491e8aead62364a5132ab0ae20e8b68e19f + languageName: node + linkType: hard + "@babel/highlight@npm:^7.23.4": version: 7.23.4 resolution: "@babel/highlight@npm:7.23.4" @@ -578,7 +845,19 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.12.7, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.23.5": +"@babel/highlight@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/highlight@npm:7.24.7" + dependencies: + "@babel/helper-validator-identifier": ^7.24.7 + chalk: ^2.4.2 + js-tokens: ^4.0.0 + picocolors: ^1.0.0 + checksum: 5cd3a89f143671c4ac129960024ba678b669e6fc673ce078030f5175002d1d3d52bc10b22c5b916a6faf644b5028e9a4bd2bb264d053d9b05b6a98690f1d46f1 + languageName: node + linkType: hard + +"@babel/parser@npm:^7.12.7, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.5": version: 7.23.5 resolution: "@babel/parser@npm:7.23.5" bin: @@ -587,6 +866,40 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.25.0, @babel/parser@npm:^7.25.6": + version: 7.25.6 + resolution: "@babel/parser@npm:7.25.6" + dependencies: + "@babel/types": ^7.25.6 + bin: + parser: ./bin/babel-parser.js + checksum: 85b237ded09ee43cc984493c35f3b1ff8a83e8dbbb8026b8132e692db6567acc5a1659ec928e4baa25499ddd840d7dae9dee3062be7108fe23ec5f94a8066b1e + languageName: node + linkType: hard + +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.25.3": + version: 7.25.3 + resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.25.3" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/traverse": ^7.25.3 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: d3dba60f360defe70eb43e35a1b17ea9dd4a99e734249e15be3d5c288019644f96f88d7ff51990118fda0845b4ad50f6d869e0382232b1d8b054d113d4eea7e2 + languageName: node + linkType: hard + +"@babel/plugin-bugfix-safari-class-field-initializer-scope@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/plugin-bugfix-safari-class-field-initializer-scope@npm:7.25.0" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: fd56d1e6435f2c008ca9050ea906ff7eedcbec43f532f2bf2e7e905d8bf75bf5e4295ea9593f060394e2c8e45737266ccbf718050bad2dd7be4e7613c60d1b5b + languageName: node + linkType: hard + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.23.3" @@ -598,6 +911,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.25.0" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 13ed301b108d85867d64226bbc4032b07dd1a23aab68e9e32452c4fe3930f2198bb65bdae9c262c4104bd5e45647bc1830d25d43d356ee9a137edd8d5fab8350 + languageName: node + linkType: hard + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:7.23.3" @@ -611,6 +935,19 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-skip-transparent-expression-wrappers": ^7.24.7 + "@babel/plugin-transform-optional-chaining": ^7.24.7 + peerDependencies: + "@babel/core": ^7.13.0 + checksum: 07b92878ac58a98ea1fdf6a8b4ec3413ba4fa66924e28b694d63ec5b84463123fbf4d7153b56cf3cedfef4a3482c082fe3243c04f8fb2c041b32b0e29b4a9e21 + languageName: node + linkType: hard + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:7.23.3" @@ -623,6 +960,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:7.25.0" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/traverse": ^7.25.0 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: c8d08b8d6cc71451ad2a50cf7db72ab5b41c1e5e2e4d56cf6837a25a61270abd682c6b8881ab025f11a552d2024b3780519bb051459ebb71c27aed13d9917663 + languageName: node + linkType: hard + "@babel/plugin-proposal-object-rest-spread@npm:7.12.1": version: 7.12.1 resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.12.1" @@ -711,6 +1060,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-syntax-import-assertions@npm:^7.24.7": + version: 7.25.6 + resolution: "@babel/plugin-syntax-import-assertions@npm:7.25.6" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b3b251ace9f184c2d6369cde686ff01581050cb0796f2ff00ff4021f31cf86270b347df09579f2c0996e999e37e1dddafacec42ed1ef6aae21a265aff947e792 + languageName: node + linkType: hard + "@babel/plugin-syntax-import-attributes@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-syntax-import-attributes@npm:7.23.3" @@ -722,6 +1082,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-syntax-import-attributes@npm:^7.24.7": + version: 7.25.6 + resolution: "@babel/plugin-syntax-import-attributes@npm:7.25.6" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3b0928e73e42346e8a65760a3ff853c87ad693cdf11bb335a23e895e0b5b1f0601118521b3aff2a6946488a580a63afb6a5b5686153a7678b4dff0e4e4604dd7 + languageName: node + linkType: hard + "@babel/plugin-syntax-import-meta@npm:^7.10.4": version: 7.10.4 resolution: "@babel/plugin-syntax-import-meta@npm:7.10.4" @@ -766,6 +1137,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-syntax-jsx@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-syntax-jsx@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 7a5ca629d8ca1e1ee78705a78e58c12920d07ed8006d7e7232b31296a384ff5e41d7b649bde5561196041037bbb9f9715be1d1c20975df87ca204f34ad15b965 + languageName: node + linkType: hard + "@babel/plugin-syntax-logical-assignment-operators@npm:^7.10.4": version: 7.10.4 resolution: "@babel/plugin-syntax-logical-assignment-operators@npm:7.10.4" @@ -865,6 +1247,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-syntax-typescript@npm:^7.24.7": + version: 7.25.4 + resolution: "@babel/plugin-syntax-typescript@npm:7.25.4" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 9b89b8930cd5983f64251d75c9fcdc17a8dc73837d6de12220ff972888ecff4054a6467cf0c423cad242aa96c0f0564a39a0823073728cc02239b80d13f02230 + languageName: node + linkType: hard + "@babel/plugin-syntax-unicode-sets-regex@npm:^7.18.6": version: 7.18.6 resolution: "@babel/plugin-syntax-unicode-sets-regex@npm:7.18.6" @@ -888,6 +1281,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-arrow-functions@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-arrow-functions@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 707c209b5331c7dc79bd326128c6a6640dbd62a78da1653c844db20c4f36bf7b68454f1bc4d2d051b3fde9136fa291f276ec03a071bb00ee653069ff82f91010 + languageName: node + linkType: hard + "@babel/plugin-transform-async-generator-functions@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-async-generator-functions@npm:7.23.4" @@ -902,6 +1306,20 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-async-generator-functions@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/plugin-transform-async-generator-functions@npm:7.25.4" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/helper-remap-async-to-generator": ^7.25.0 + "@babel/plugin-syntax-async-generators": ^7.8.4 + "@babel/traverse": ^7.25.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 4235444735a1946f8766fe56564a8134c2c36c73e6cf83b3f2ed5624ebc84ff5979506a6a5b39acdb23aa09d442a6af471710ed408ccce533a2c4d2990b9df6a + languageName: node + linkType: hard + "@babel/plugin-transform-async-to-generator@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-async-to-generator@npm:7.23.3" @@ -915,6 +1333,19 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-async-to-generator@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-async-to-generator@npm:7.24.7" + dependencies: + "@babel/helper-module-imports": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-remap-async-to-generator": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 13704fb3b83effc868db2b71bfb2c77b895c56cb891954fc362e95e200afd523313b0e7cf04ce02f45b05e76017c5b5fa8070c92613727a35131bb542c253a36 + languageName: node + linkType: hard + "@babel/plugin-transform-block-scoped-functions@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-block-scoped-functions@npm:7.23.3" @@ -926,6 +1357,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-block-scoped-functions@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-block-scoped-functions@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 249cdcbff4e778b177245f9652b014ea4f3cd245d83297f10a7bf6d97790074089aa62bcde8c08eb299c5e68f2faed346b587d3ebac44d625ba9a83a4ee27028 + languageName: node + linkType: hard + "@babel/plugin-transform-block-scoping@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-block-scoping@npm:7.23.4" @@ -937,6 +1379,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-block-scoping@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/plugin-transform-block-scoping@npm:7.25.0" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b1a8f932f69ad2a47ae3e02b4cedd2a876bfc2ac9cf72a503fd706cdc87272646fe9eed81e068c0fc639647033de29f7fa0c21cddd1da0026f83dbaac97316a8 + languageName: node + linkType: hard + "@babel/plugin-transform-class-properties@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-class-properties@npm:7.23.3" @@ -949,6 +1402,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-class-properties@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/plugin-transform-class-properties@npm:7.25.4" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.25.4 + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b73f7d968639c6c2dfc13f4c5a8fe45cefd260f0faa7890ae12e65d41211072544ff5e128c8b61a86887b29ffd3df8422dbdfbf61648488e71d4bb599c41f4a5 + languageName: node + linkType: hard + "@babel/plugin-transform-class-static-block@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-class-static-block@npm:7.23.4" @@ -962,6 +1427,19 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-class-static-block@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-class-static-block@npm:7.24.7" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-class-static-block": ^7.14.5 + peerDependencies: + "@babel/core": ^7.12.0 + checksum: 324049263504f18416f1c3e24033baebfafd05480fdd885c8ebe6f2b415b0fc8e0b98d719360f9e30743cc78ac387fabc0b3c6606d2b54135756ffb92963b382 + languageName: node + linkType: hard + "@babel/plugin-transform-classes@npm:^7.23.5": version: 7.23.5 resolution: "@babel/plugin-transform-classes@npm:7.23.5" @@ -981,6 +1459,22 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-classes@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/plugin-transform-classes@npm:7.25.4" + dependencies: + "@babel/helper-annotate-as-pure": ^7.24.7 + "@babel/helper-compilation-targets": ^7.25.2 + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/helper-replace-supers": ^7.25.0 + "@babel/traverse": ^7.25.4 + globals: ^11.1.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 0bf20e46eeb691bd60cee5d1b01950fc37accec88018ecace25099f7c8d8509c1ac54d11b8caf9f2157c6945969520642a3bc421159c1a14e80224dc9a7611de + languageName: node + linkType: hard + "@babel/plugin-transform-computed-properties@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-computed-properties@npm:7.23.3" @@ -993,6 +1487,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-computed-properties@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-computed-properties@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/template": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 0cf8c1b1e4ea57dec8d4612460d84fd4cdbf71a7499bb61ee34632cf89018a59eee818ffca88a8d99ee7057c20a4257044d7d463fda6daef9bf1db9fa81563cb + languageName: node + linkType: hard + "@babel/plugin-transform-destructuring@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-destructuring@npm:7.23.3" @@ -1004,6 +1510,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-destructuring@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/plugin-transform-destructuring@npm:7.24.8" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 0b4bd3d608979a1e5bd97d9d42acd5ad405c7fffa61efac4c7afd8e86ea6c2d91ab2d94b6a98d63919571363fe76e0b03c4ff161f0f60241b895842596e4a999 + languageName: node + linkType: hard + "@babel/plugin-transform-dotall-regex@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-dotall-regex@npm:7.23.3" @@ -1016,6 +1533,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-dotall-regex@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-dotall-regex@npm:7.24.7" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 67b10fc6abb1f61f0e765288eb4c6d63d1d0f9fc0660e69f6f2170c56fa16bc74e49857afc644beda112b41771cd90cf52df0940d11e97e52617c77c7dcff171 + languageName: node + linkType: hard + "@babel/plugin-transform-duplicate-keys@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-duplicate-keys@npm:7.23.3" @@ -1027,6 +1556,29 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-duplicate-keys@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-duplicate-keys@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: d1da2ff85ecb56a63f4ccfd9dc9ae69400d85f0dadf44ecddd9e71c6e5c7a9178e74e3a9637555f415a2bb14551e563f09f98534ab54f53d25e8439fdde6ba2d + languageName: node + linkType: hard + +"@babel/plugin-transform-duplicate-named-capturing-groups-regex@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/plugin-transform-duplicate-named-capturing-groups-regex@npm:7.25.0" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.25.0 + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 608d6b0e77341189508880fd1a9f605a38d0803dd6f678ea3920ab181b17b377f6d5221ae8cf0104c7a044d30d4ddb0366bd064447695671d78457a656bb264f + languageName: node + linkType: hard + "@babel/plugin-transform-dynamic-import@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-dynamic-import@npm:7.23.4" @@ -1039,6 +1591,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-dynamic-import@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-dynamic-import@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 776509ff62ab40c12be814a342fc56a5cc09b91fb63032b2633414b635875fd7da03734657be0f6db2891fe6e3033b75d5ddb6f2baabd1a02e4443754a785002 + languageName: node + linkType: hard + "@babel/plugin-transform-exponentiation-operator@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.23.3" @@ -1051,6 +1615,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-exponentiation-operator@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.24.7" + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 23c84a23eb56589fdd35a3540f9a1190615be069110a2270865223c03aee3ba4e0fc68fe14850800cf36f0712b26e4964d3026235261f58f0405a29fe8dac9b1 + languageName: node + linkType: hard + "@babel/plugin-transform-export-namespace-from@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-export-namespace-from@npm:7.23.4" @@ -1063,6 +1639,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-export-namespace-from@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-export-namespace-from@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-export-namespace-from": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3bd3a10038f10ae0dea1ee42137f3edcf7036b5e9e570a0d1cbd0865f03658990c6c2d84fa2475f87a754e7dc5b46766c16f7ce5c9b32c3040150b6a21233a80 + languageName: node + linkType: hard + "@babel/plugin-transform-for-of@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-for-of@npm:7.23.3" @@ -1074,6 +1662,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-for-of@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-for-of@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-skip-transparent-expression-wrappers": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: a53b42dc93ab4b7d1ebd3c695b52be22b3d592f6a3dbdb3dc2fea2c8e0a7e1508fe919864c455cde552aec44ce7518625fccbb70c7063373ca228d884f4f49ea + languageName: node + linkType: hard + "@babel/plugin-transform-function-name@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-function-name@npm:7.23.3" @@ -1087,6 +1687,19 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-function-name@npm:^7.25.1": + version: 7.25.1 + resolution: "@babel/plugin-transform-function-name@npm:7.25.1" + dependencies: + "@babel/helper-compilation-targets": ^7.24.8 + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/traverse": ^7.25.1 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 743f3ea03bbc5a90944849d5a880b6bd9243dddbde581a46952da76e53a0b74c1e2424133fe8129d7a152c1f8c872bcd27e0b6728d7caadabd1afa7bb892e1e0 + languageName: node + linkType: hard + "@babel/plugin-transform-json-strings@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-json-strings@npm:7.23.4" @@ -1099,6 +1712,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-json-strings@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-json-strings@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-json-strings": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 88874d0b7a1ddea66c097fc0abb68801ffae194468aa44b828dde9a0e20ac5d8647943793de86092eabaa2911c96f67a6b373793d4bb9c932ef81b2711c06c2e + languageName: node + linkType: hard + "@babel/plugin-transform-literals@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-literals@npm:7.23.3" @@ -1110,6 +1735,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-literals@npm:^7.25.2": + version: 7.25.2 + resolution: "@babel/plugin-transform-literals@npm:7.25.2" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 70c9bb40e377a306bd8f500899fb72127e527517914466e95dc6bb53fa7a0f51479db244a54a771b5780fc1eab488fedd706669bf11097b81a23c81ab7423eb1 + languageName: node + linkType: hard + "@babel/plugin-transform-logical-assignment-operators@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-logical-assignment-operators@npm:7.23.4" @@ -1122,6 +1758,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-logical-assignment-operators@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-logical-assignment-operators@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3367ce0be243704dc6fce23e86a592c4380f01998ee5dd9f94c54b1ef7b971ac6f8a002901eb51599ac6cbdc0d067af8d1a720224fca1c40fde8bb8aab804aac + languageName: node + linkType: hard + "@babel/plugin-transform-member-expression-literals@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-member-expression-literals@npm:7.23.3" @@ -1133,6 +1781,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-member-expression-literals@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-member-expression-literals@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 2720c57aa3bf70576146ba7d6ea03227f4611852122d76d237924f7b008dafc952e6ae61a19e5024f26c665f44384bbd378466f01b6bd1305b3564a3b7fb1a5d + languageName: node + linkType: hard + "@babel/plugin-transform-modules-amd@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-modules-amd@npm:7.23.3" @@ -1145,6 +1804,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-modules-amd@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-modules-amd@npm:7.24.7" + dependencies: + "@babel/helper-module-transforms": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: f1dd0fb2f46c0f8f21076b8c7ccd5b33a85ce6dcb31518ea4c648d9a5bb2474cd4bd87c9b1b752e68591e24b022e334ba0d07631fef2b6b4d8a4b85cf3d581f5 + languageName: node + linkType: hard + "@babel/plugin-transform-modules-commonjs@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-modules-commonjs@npm:7.23.3" @@ -1158,6 +1829,19 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-modules-commonjs@npm:^7.24.7, @babel/plugin-transform-modules-commonjs@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.24.8" + dependencies: + "@babel/helper-module-transforms": ^7.24.8 + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/helper-simple-access": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: a4cf95b1639c33382064b44558f73ee5fac023f2a94d16e549d2bb55ceebd5cbc10fcddd505d08cd5bc97f5a64af9fd155512358b7dcf7b1a0082e8945cf21c5 + languageName: node + linkType: hard + "@babel/plugin-transform-modules-systemjs@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-modules-systemjs@npm:7.23.3" @@ -1168,7 +1852,21 @@ __metadata: "@babel/helper-validator-identifier": ^7.22.20 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 0d2fdd993c785aecac9e0850cd5ed7f7d448f0fbb42992a950cc0590167144df25d82af5aac9a5c99ef913d2286782afa44e577af30c10901c5ee8984910fa1f + checksum: 0d2fdd993c785aecac9e0850cd5ed7f7d448f0fbb42992a950cc0590167144df25d82af5aac9a5c99ef913d2286782afa44e577af30c10901c5ee8984910fa1f + languageName: node + linkType: hard + +"@babel/plugin-transform-modules-systemjs@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/plugin-transform-modules-systemjs@npm:7.25.0" + dependencies: + "@babel/helper-module-transforms": ^7.25.0 + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/helper-validator-identifier": ^7.24.7 + "@babel/traverse": ^7.25.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: fe673bec08564e491847324bb80a1e6edfb229f5c37e58a094d51e95306e7b098e1d130fc43e992d22debd93b9beac74441ffc3f6ea5d78f6b2535896efa0728 languageName: node linkType: hard @@ -1184,6 +1882,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-modules-umd@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-modules-umd@npm:7.24.7" + dependencies: + "@babel/helper-module-transforms": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 9ff1c464892efe042952ba778468bda6131b196a2729615bdcc3f24cdc94014f016a4616ee5643c5845bade6ba698f386833e61056d7201314b13a7fd69fac88 + languageName: node + linkType: hard + "@babel/plugin-transform-named-capturing-groups-regex@npm:^7.22.5": version: 7.22.5 resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.22.5" @@ -1196,6 +1906,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-named-capturing-groups-regex@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.24.7" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: f1c6c7b5d60a86b6d7e4dd098798e1d393d55e993a0b57a73b53640c7a94985b601a96bdacee063f809a9a700bcea3a2ff18e98fa561554484ac56b761d774bd + languageName: node + linkType: hard + "@babel/plugin-transform-new-target@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-new-target@npm:7.23.3" @@ -1207,6 +1929,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-new-target@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-new-target@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3cb94cd1076b270f768f91fdcf9dd2f6d487f8dbfff3df7ca8d07b915900b86d02769a35ba1407d16fe49499012c8f055e1741299e2c880798b953d942a8fa1b + languageName: node + linkType: hard + "@babel/plugin-transform-nullish-coalescing-operator@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.23.4" @@ -1219,6 +1952,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-nullish-coalescing-operator@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 4a9221356401d87762afbc37a9e8e764afc2daf09c421117537820f8cfbed6876888372ad3a7bcfae2d45c95f026651f050ab4020b777be31d3ffb00908dbdd3 + languageName: node + linkType: hard + "@babel/plugin-transform-numeric-separator@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-numeric-separator@npm:7.23.4" @@ -1231,6 +1976,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-numeric-separator@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-numeric-separator@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-numeric-separator": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 561b5f1d08b2c3f92ce849f092751558b5e6cfeb7eb55c79e7375c34dd9c3066dce5e630bb439affef6adcf202b6cbcaaa23870070276fa5bb429c8f5b8c7514 + languageName: node + linkType: hard + "@babel/plugin-transform-object-rest-spread@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-object-rest-spread@npm:7.23.4" @@ -1246,6 +2003,20 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-object-rest-spread@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-object-rest-spread@npm:7.24.7" + dependencies: + "@babel/helper-compilation-targets": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-object-rest-spread": ^7.8.3 + "@babel/plugin-transform-parameters": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 169d257b9800c13e1feb4c37fb05dae84f702e58b342bb76e19e82e6692b7b5337c9923ee89e3916a97c0dd04a3375bdeca14f5e126f110bbacbeb46d1886ca2 + languageName: node + linkType: hard + "@babel/plugin-transform-object-super@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-object-super@npm:7.23.3" @@ -1258,6 +2029,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-object-super@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-object-super@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-replace-supers": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: f71e607a830ee50a22fa1a2686524d3339440cf9dea63032f6efbd865cfe4e35000e1e3f3492459e5c986f7c0c07dc36938bf3ce61fc9ba5f8ab732d0b64ab37 + languageName: node + linkType: hard + "@babel/plugin-transform-optional-catch-binding@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-optional-catch-binding@npm:7.23.4" @@ -1270,6 +2053,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-optional-catch-binding@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-optional-catch-binding@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 7229f3a5a4facaab40f4fdfc7faabc157dc38a67d66bed7936599f4bc509e0bff636f847ac2aa45294881fce9cf8a0a460b85d2a465b7b977de9739fce9b18f6 + languageName: node + linkType: hard + "@babel/plugin-transform-optional-chaining@npm:^7.23.3, @babel/plugin-transform-optional-chaining@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-optional-chaining@npm:7.23.4" @@ -1283,6 +2078,19 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-optional-chaining@npm:^7.24.7, @babel/plugin-transform-optional-chaining@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/plugin-transform-optional-chaining@npm:7.24.8" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/helper-skip-transparent-expression-wrappers": ^7.24.7 + "@babel/plugin-syntax-optional-chaining": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 45e55e3a2fffb89002d3f89aef59c141610f23b60eee41e047380bffc40290b59f64fc649aa7ec5281f73d41b2065410d788acc6afaad2a9f44cad6e8af04442 + languageName: node + linkType: hard + "@babel/plugin-transform-parameters@npm:^7.12.1, @babel/plugin-transform-parameters@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-parameters@npm:7.23.3" @@ -1294,6 +2102,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-parameters@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-parameters@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: ab534b03ac2eff94bc79342b8f39a4584666f5305a6c63c1964afda0b1b004e6b861e49d1683548030defe248e3590d3ff6338ee0552cb90c064f7e1479968c3 + languageName: node + linkType: hard + "@babel/plugin-transform-private-methods@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-private-methods@npm:7.23.3" @@ -1306,6 +2125,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-private-methods@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/plugin-transform-private-methods@npm:7.25.4" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.25.4 + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: cb1dabfc03e2977990263d65bc8f43a9037dffbb5d9a5f825c00d05447ff68015099408c1531d9dd88f18a41a90f5062dc48f3a1d52b415d2d2ee4827dedff09 + languageName: node + linkType: hard + "@babel/plugin-transform-private-property-in-object@npm:^7.23.4": version: 7.23.4 resolution: "@babel/plugin-transform-private-property-in-object@npm:7.23.4" @@ -1320,6 +2151,20 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-private-property-in-object@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-private-property-in-object@npm:7.24.7" + dependencies: + "@babel/helper-annotate-as-pure": ^7.24.7 + "@babel/helper-create-class-features-plugin": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-private-property-in-object": ^7.14.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 8cee9473095305cc787bb653fd681719b49363281feabf677db8a552e8e41c94441408055d7e5fd5c7d41b315e634fa70b145ad0c7c54456216049df4ed57350 + languageName: node + linkType: hard + "@babel/plugin-transform-property-literals@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-property-literals@npm:7.23.3" @@ -1331,6 +2176,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-property-literals@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-property-literals@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 9aeefc3aab6c6bf9d1fae1cf3a2d38c7d886fd3c6c81b7c608c477f5758aee2e7abf52f32724310fe861da61af934ee2508b78a5b5f234b9740c9134e1c14437 + languageName: node + linkType: hard + "@babel/plugin-transform-react-constant-elements@npm:^7.18.12": version: 7.23.3 resolution: "@babel/plugin-transform-react-constant-elements@npm:7.23.3" @@ -1342,6 +2198,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-react-constant-elements@npm:^7.21.3": + version: 7.25.1 + resolution: "@babel/plugin-transform-react-constant-elements@npm:7.25.1" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 6126abf8bc3980c1e27fd217f8b2f226b20cce9be300eaf9d30548556dd1e906b7daa4580d9ae1dae35eb5ed5c98e7222e0cb91efb0a232d05aae5875dcfe55c + languageName: node + linkType: hard + "@babel/plugin-transform-react-display-name@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-react-display-name@npm:7.23.3" @@ -1403,6 +2270,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-regenerator@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-regenerator@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + regenerator-transform: ^0.15.2 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 20c6c3fb6fc9f407829087316653388d311e8c1816b007609bb09aeef254092a7157adace8b3aaa8f34be752503717cb85c88a5fe482180a9b11bcbd676063be + languageName: node + linkType: hard + "@babel/plugin-transform-reserved-words@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-reserved-words@npm:7.23.3" @@ -1414,6 +2293,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-reserved-words@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-reserved-words@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3d5876954d5914d7270819479504f30c4bf5452a65c677f44e2dab2db50b3c9d4b47793c45dfad7abf4f377035dd79e4b3f554ae350df9f422201d370ce9f8dd + languageName: node + linkType: hard + "@babel/plugin-transform-runtime@npm:^7.18.6, @babel/plugin-transform-runtime@npm:^7.22.9": version: 7.23.4 resolution: "@babel/plugin-transform-runtime@npm:7.23.4" @@ -1441,6 +2331,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-shorthand-properties@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-shorthand-properties@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 7b524245814607188212b8eb86d8c850e5974203328455a30881b4a92c364b93353fae14bc2af5b614ef16300b75b8c1d3b8f3a08355985b4794a7feb240adc3 + languageName: node + linkType: hard + "@babel/plugin-transform-spread@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-spread@npm:7.23.3" @@ -1453,6 +2354,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-spread@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-spread@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-skip-transparent-expression-wrappers": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 4c4254c8b9cceb1a8f975fa9b92257ddb08380a35c0a3721b8f4b9e13a3d82e403af2e0fba577b9f2452dd8f06bc3dea71cc53b1e2c6af595af5db52a13429d6 + languageName: node + linkType: hard + "@babel/plugin-transform-sticky-regex@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-sticky-regex@npm:7.23.3" @@ -1464,6 +2377,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-sticky-regex@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-sticky-regex@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 118fc7a7ebf7c20411b670c8a030535fdfe4a88bc5643bb625a584dbc4c8a468da46430a20e6bf78914246962b0f18f1b9d6a62561a7762c4f34a038a5a77179 + languageName: node + linkType: hard + "@babel/plugin-transform-template-literals@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-template-literals@npm:7.23.3" @@ -1475,6 +2399,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-template-literals@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-template-literals@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: ad44e5826f5a98c1575832dbdbd033adfe683cdff195e178528ead62507564bf02f479b282976cfd3caebad8b06d5fd7349c1cdb880dec3c56daea4f1f179619 + languageName: node + linkType: hard + "@babel/plugin-transform-typeof-symbol@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-typeof-symbol@npm:7.23.3" @@ -1486,6 +2421,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-typeof-symbol@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/plugin-transform-typeof-symbol@npm:7.24.8" + dependencies: + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 8663a8e7347cedf181001d99c88cf794b6598c3d82f324098510fe8fb8bd22113995526a77aa35a3cc5d70ffd0617a59dd0d10311a9bf0e1a3a7d3e59b900c00 + languageName: node + linkType: hard + "@babel/plugin-transform-typescript@npm:^7.23.3": version: 7.23.5 resolution: "@babel/plugin-transform-typescript@npm:7.23.5" @@ -1500,6 +2446,21 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-typescript@npm:^7.24.7": + version: 7.25.2 + resolution: "@babel/plugin-transform-typescript@npm:7.25.2" + dependencies: + "@babel/helper-annotate-as-pure": ^7.24.7 + "@babel/helper-create-class-features-plugin": ^7.25.0 + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/helper-skip-transparent-expression-wrappers": ^7.24.7 + "@babel/plugin-syntax-typescript": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b0267128d93560a4350919f7230a3b497e20fb8611d9f04bb3560d6b38877305ccad4c40903160263361c6930a84dbcb5b21b8ea923531bda51f67bffdc2dd0b + languageName: node + linkType: hard + "@babel/plugin-transform-unicode-escapes@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-unicode-escapes@npm:7.23.3" @@ -1511,6 +2472,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-unicode-escapes@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-unicode-escapes@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 4af0a193e1ddea6ff82b2b15cc2501b872728050bd625740b813c8062fec917d32d530ff6b41de56c15e7296becdf3336a58db81f5ca8e7c445c1306c52f3e01 + languageName: node + linkType: hard + "@babel/plugin-transform-unicode-property-regex@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-unicode-property-regex@npm:7.23.3" @@ -1523,6 +2495,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-unicode-property-regex@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-unicode-property-regex@npm:7.24.7" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: aae13350c50973f5802ca7906d022a6a0cc0e3aebac9122d0450bbd51e78252d4c2032ad69385e2759fcbdd3aac5d571bd7e26258907f51f8e1a51b53be626c2 + languageName: node + linkType: hard + "@babel/plugin-transform-unicode-regex@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-unicode-regex@npm:7.23.3" @@ -1535,6 +2519,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-unicode-regex@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-unicode-regex@npm:7.24.7" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 1cb4e70678906e431da0a05ac3f8350025fee290304ad7482d9cfaa1ca67b2e898654de537c9268efbdad5b80d3ebadf42b4a88ea84609bd8a4cce7b11b48afd + languageName: node + linkType: hard + "@babel/plugin-transform-unicode-sets-regex@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-unicode-sets-regex@npm:7.23.3" @@ -1547,6 +2543,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-unicode-sets-regex@npm:^7.25.4": + version: 7.25.4 + resolution: "@babel/plugin-transform-unicode-sets-regex@npm:7.25.4" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.25.2 + "@babel/helper-plugin-utils": ^7.24.8 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 6d1a7e9fdde4ffc9a81c0e3f261b96a9a0dfe65da282ec96fe63b36c597a7389feac638f1df2a8a4f8c9128337bba8e984f934e9f19077930f33abf1926759ea + languageName: node + linkType: hard + "@babel/preset-env@npm:^7.18.6, @babel/preset-env@npm:^7.19.4, @babel/preset-env@npm:^7.22.9": version: 7.23.5 resolution: "@babel/preset-env@npm:7.23.5" @@ -1637,6 +2645,99 @@ __metadata: languageName: node linkType: hard +"@babel/preset-env@npm:^7.20.2": + version: 7.25.4 + resolution: "@babel/preset-env@npm:7.25.4" + dependencies: + "@babel/compat-data": ^7.25.4 + "@babel/helper-compilation-targets": ^7.25.2 + "@babel/helper-plugin-utils": ^7.24.8 + "@babel/helper-validator-option": ^7.24.8 + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": ^7.25.3 + "@babel/plugin-bugfix-safari-class-field-initializer-scope": ^7.25.0 + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ^7.25.0 + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.24.7 + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": ^7.25.0 + "@babel/plugin-proposal-private-property-in-object": 7.21.0-placeholder-for-preset-env.2 + "@babel/plugin-syntax-async-generators": ^7.8.4 + "@babel/plugin-syntax-class-properties": ^7.12.13 + "@babel/plugin-syntax-class-static-block": ^7.14.5 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + "@babel/plugin-syntax-export-namespace-from": ^7.8.3 + "@babel/plugin-syntax-import-assertions": ^7.24.7 + "@babel/plugin-syntax-import-attributes": ^7.24.7 + "@babel/plugin-syntax-import-meta": ^7.10.4 + "@babel/plugin-syntax-json-strings": ^7.8.3 + "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 + "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 + "@babel/plugin-syntax-numeric-separator": ^7.10.4 + "@babel/plugin-syntax-object-rest-spread": ^7.8.3 + "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 + "@babel/plugin-syntax-optional-chaining": ^7.8.3 + "@babel/plugin-syntax-private-property-in-object": ^7.14.5 + "@babel/plugin-syntax-top-level-await": ^7.14.5 + "@babel/plugin-syntax-unicode-sets-regex": ^7.18.6 + "@babel/plugin-transform-arrow-functions": ^7.24.7 + "@babel/plugin-transform-async-generator-functions": ^7.25.4 + "@babel/plugin-transform-async-to-generator": ^7.24.7 + "@babel/plugin-transform-block-scoped-functions": ^7.24.7 + "@babel/plugin-transform-block-scoping": ^7.25.0 + "@babel/plugin-transform-class-properties": ^7.25.4 + "@babel/plugin-transform-class-static-block": ^7.24.7 + "@babel/plugin-transform-classes": ^7.25.4 + "@babel/plugin-transform-computed-properties": ^7.24.7 + "@babel/plugin-transform-destructuring": ^7.24.8 + "@babel/plugin-transform-dotall-regex": ^7.24.7 + "@babel/plugin-transform-duplicate-keys": ^7.24.7 + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": ^7.25.0 + "@babel/plugin-transform-dynamic-import": ^7.24.7 + "@babel/plugin-transform-exponentiation-operator": ^7.24.7 + "@babel/plugin-transform-export-namespace-from": ^7.24.7 + "@babel/plugin-transform-for-of": ^7.24.7 + "@babel/plugin-transform-function-name": ^7.25.1 + "@babel/plugin-transform-json-strings": ^7.24.7 + "@babel/plugin-transform-literals": ^7.25.2 + "@babel/plugin-transform-logical-assignment-operators": ^7.24.7 + "@babel/plugin-transform-member-expression-literals": ^7.24.7 + "@babel/plugin-transform-modules-amd": ^7.24.7 + "@babel/plugin-transform-modules-commonjs": ^7.24.8 + "@babel/plugin-transform-modules-systemjs": ^7.25.0 + "@babel/plugin-transform-modules-umd": ^7.24.7 + "@babel/plugin-transform-named-capturing-groups-regex": ^7.24.7 + "@babel/plugin-transform-new-target": ^7.24.7 + "@babel/plugin-transform-nullish-coalescing-operator": ^7.24.7 + "@babel/plugin-transform-numeric-separator": ^7.24.7 + "@babel/plugin-transform-object-rest-spread": ^7.24.7 + "@babel/plugin-transform-object-super": ^7.24.7 + "@babel/plugin-transform-optional-catch-binding": ^7.24.7 + "@babel/plugin-transform-optional-chaining": ^7.24.8 + "@babel/plugin-transform-parameters": ^7.24.7 + "@babel/plugin-transform-private-methods": ^7.25.4 + "@babel/plugin-transform-private-property-in-object": ^7.24.7 + "@babel/plugin-transform-property-literals": ^7.24.7 + "@babel/plugin-transform-regenerator": ^7.24.7 + "@babel/plugin-transform-reserved-words": ^7.24.7 + "@babel/plugin-transform-shorthand-properties": ^7.24.7 + "@babel/plugin-transform-spread": ^7.24.7 + "@babel/plugin-transform-sticky-regex": ^7.24.7 + "@babel/plugin-transform-template-literals": ^7.24.7 + "@babel/plugin-transform-typeof-symbol": ^7.24.8 + "@babel/plugin-transform-unicode-escapes": ^7.24.7 + "@babel/plugin-transform-unicode-property-regex": ^7.24.7 + "@babel/plugin-transform-unicode-regex": ^7.24.7 + "@babel/plugin-transform-unicode-sets-regex": ^7.25.4 + "@babel/preset-modules": 0.1.6-no-external-plugins + babel-plugin-polyfill-corejs2: ^0.4.10 + babel-plugin-polyfill-corejs3: ^0.10.6 + babel-plugin-polyfill-regenerator: ^0.6.1 + core-js-compat: ^3.37.1 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 752be43f0b78a2eefe5007076aed3d21b505e1c09d134b61e7de8838f1bbb1e7af81023d39adb14b6eae23727fb5a9fd23f8115a44df043319be22319be17913 + languageName: node + linkType: hard + "@babel/preset-modules@npm:0.1.6-no-external-plugins": version: 0.1.6-no-external-plugins resolution: "@babel/preset-modules@npm:0.1.6-no-external-plugins" @@ -1681,6 +2782,21 @@ __metadata: languageName: node linkType: hard +"@babel/preset-typescript@npm:^7.21.0": + version: 7.24.7 + resolution: "@babel/preset-typescript@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-validator-option": ^7.24.7 + "@babel/plugin-syntax-jsx": ^7.24.7 + "@babel/plugin-transform-modules-commonjs": ^7.24.7 + "@babel/plugin-transform-typescript": ^7.24.7 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 12929b24757f3bd6548103475f86478eda4c872bc7cefd920b29591eee8f4a4f350561d888e133d632d0c9402b8615fdcec9138e5127a6567dcb22f804ff207f + languageName: node + linkType: hard + "@babel/regjsgen@npm:^0.8.0": version: 0.8.0 resolution: "@babel/regjsgen@npm:0.8.0" @@ -1718,6 +2834,17 @@ __metadata: languageName: node linkType: hard +"@babel/template@npm:^7.24.7, @babel/template@npm:^7.25.0": + version: 7.25.0 + resolution: "@babel/template@npm:7.25.0" + dependencies: + "@babel/code-frame": ^7.24.7 + "@babel/parser": ^7.25.0 + "@babel/types": ^7.25.0 + checksum: 3f2db568718756d0daf2a16927b78f00c425046b654cd30b450006f2e84bdccaf0cbe6dc04994aa1f5f6a4398da2f11f3640a4d3ee31722e43539c4c919c817b + languageName: node + linkType: hard + "@babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.18.8, @babel/traverse@npm:^7.22.8, @babel/traverse@npm:^7.23.5": version: 7.23.5 resolution: "@babel/traverse@npm:7.23.5" @@ -1736,6 +2863,21 @@ __metadata: languageName: node linkType: hard +"@babel/traverse@npm:^7.24.7, @babel/traverse@npm:^7.24.8, @babel/traverse@npm:^7.25.0, @babel/traverse@npm:^7.25.1, @babel/traverse@npm:^7.25.2, @babel/traverse@npm:^7.25.3, @babel/traverse@npm:^7.25.4": + version: 7.25.6 + resolution: "@babel/traverse@npm:7.25.6" + dependencies: + "@babel/code-frame": ^7.24.7 + "@babel/generator": ^7.25.6 + "@babel/parser": ^7.25.6 + "@babel/template": ^7.25.0 + "@babel/types": ^7.25.6 + debug: ^4.3.1 + globals: ^11.1.0 + checksum: 11ee47269aa4356f2d6633a05b9af73405b5ed72c09378daf644289b686ef852035a6ac9aa410f601991993c6bbf72006795b5478283b78eb1ca77874ada7737 + languageName: node + linkType: hard + "@babel/types@npm:^7.12.7, @babel/types@npm:^7.20.0, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.5, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.23.5 resolution: "@babel/types@npm:7.23.5" @@ -1747,6 +2889,17 @@ __metadata: languageName: node linkType: hard +"@babel/types@npm:^7.21.3, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.2, @babel/types@npm:^7.25.6": + version: 7.25.6 + resolution: "@babel/types@npm:7.25.6" + dependencies: + "@babel/helper-string-parser": ^7.24.8 + "@babel/helper-validator-identifier": ^7.24.7 + to-fast-properties: ^2.0.0 + checksum: 9b2f84ff3f874ad05b0b9bf06862c56f478b65781801f82296b4cc01bee39e79c20a7c0a06959fed0ee582c8267e1cb21638318655c5e070b0287242a844d1c9 + languageName: node + linkType: hard + "@colors/colors@npm:1.5.0": version: 1.5.0 resolution: "@colors/colors@npm:1.5.0" @@ -2343,9 +3496,9 @@ __metadata: languageName: node linkType: hard -"@docusaurus/core@npm:3.0.1, @docusaurus/core@npm:^3.0.1": - version: 3.0.1 - resolution: "@docusaurus/core@npm:3.0.1" +"@docusaurus/core@npm:3.5.2, @docusaurus/core@npm:^3.5.2": + version: 3.5.2 + resolution: "@docusaurus/core@npm:3.5.2" dependencies: "@babel/core": ^7.23.3 "@babel/generator": ^7.23.3 @@ -2357,15 +3510,12 @@ __metadata: "@babel/runtime": ^7.22.6 "@babel/runtime-corejs3": ^7.22.6 "@babel/traverse": ^7.22.8 - "@docusaurus/cssnano-preset": 3.0.1 - "@docusaurus/logger": 3.0.1 - "@docusaurus/mdx-loader": 3.0.1 - "@docusaurus/react-loadable": 5.5.2 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-common": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 - "@slorber/static-site-generator-webpack-plugin": ^4.0.7 - "@svgr/webpack": ^6.5.1 + "@docusaurus/cssnano-preset": 3.5.2 + "@docusaurus/logger": 3.5.2 + "@docusaurus/mdx-loader": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-common": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 autoprefixer: ^10.4.14 babel-loader: ^9.1.3 babel-plugin-dynamic-import-node: ^2.3.3 @@ -2379,12 +3529,13 @@ __metadata: copy-webpack-plugin: ^11.0.0 core-js: ^3.31.1 css-loader: ^6.8.1 - css-minimizer-webpack-plugin: ^4.2.2 - cssnano: ^5.1.15 + css-minimizer-webpack-plugin: ^5.0.1 + cssnano: ^6.1.2 del: ^6.1.1 detect-port: ^1.5.1 escape-html: ^1.0.3 eta: ^2.2.0 + eval: ^0.1.8 file-loader: ^6.2.0 fs-extra: ^11.1.1 html-minifier-terser: ^7.2.0 @@ -2393,12 +3544,13 @@ __metadata: leven: ^3.1.0 lodash: ^4.17.21 mini-css-extract-plugin: ^2.7.6 + p-map: ^4.0.0 postcss: ^8.4.26 postcss-loader: ^7.3.3 prompts: ^2.4.2 react-dev-utils: ^12.0.1 react-helmet-async: ^1.3.0 - react-loadable: "npm:@docusaurus/react-loadable@5.5.2" + react-loadable: "npm:@docusaurus/react-loadable@6.0.0" react-loadable-ssr-addon-v5-slorber: ^1.0.1 react-router: ^5.3.4 react-router-config: ^5.1.1 @@ -2417,11 +3569,12 @@ __metadata: webpack-merge: ^5.9.0 webpackbar: ^5.0.2 peerDependencies: + "@mdx-js/react": ^3.0.0 react: ^18.0.0 react-dom: ^18.0.0 bin: docusaurus: bin/docusaurus.mjs - checksum: 56767f7e629edce4d23c19403abf4039daeea25db20c695fb7c3a1ce04a90f182f14ea1f70286afb221b8c1593823ebb0d28cbc2ca5d9d38d707a0338d544f64 + checksum: 6c6282a75931f0f8f8f8768232b4436ff8679ae12b619f7bd01e0d83aa346e24ab0d9cecac034f9dc95c55059997efdd963d052d3e429583bfb8d3b54ab750d3 languageName: node linkType: hard @@ -2437,15 +3590,15 @@ __metadata: languageName: node linkType: hard -"@docusaurus/cssnano-preset@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/cssnano-preset@npm:3.0.1" +"@docusaurus/cssnano-preset@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/cssnano-preset@npm:3.5.2" dependencies: - cssnano-preset-advanced: ^5.3.10 - postcss: ^8.4.26 - postcss-sort-media-queries: ^4.4.1 + cssnano-preset-advanced: ^6.1.2 + postcss: ^8.4.38 + postcss-sort-media-queries: ^5.2.0 tslib: ^2.6.0 - checksum: 3a04606d362c84398a5af9a98de4995958e2705086af83388479feaa157cbe3164281006e64036f9337e96b0cec62bd1362fc0f910075e6eeec930f0a519801d + checksum: 4bb1fae3741e14cbbdb64c1b0707435970838bf219831234a70cf382e6811ffac1cadf733d5e1fe7c278e7b2a9e533bfa802a5212b22ec46edd703208cf49f92 languageName: node linkType: hard @@ -2459,13 +3612,13 @@ __metadata: languageName: node linkType: hard -"@docusaurus/logger@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/logger@npm:3.0.1" +"@docusaurus/logger@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/logger@npm:3.5.2" dependencies: chalk: ^4.1.2 tslib: ^2.6.0 - checksum: 4d4ffcd08f9c76c105d2d2b95974f5c33941e5346c5de1b19ee3f55a4f5011bb7db3875349e25da02750cea5fb357ba00be271ea24368c75b8e29189d04e9f7c + checksum: 7cbdcf54acd6e7787ca5a10b9c884be4b9e8fdae837862c66550a0bf3d02737f72c3188b2bddd61da6d8530eb2eb2b646ea599a79416e33c4998f1a87d2f6a8c languageName: node linkType: hard @@ -2497,15 +3650,13 @@ __metadata: languageName: node linkType: hard -"@docusaurus/mdx-loader@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/mdx-loader@npm:3.0.1" +"@docusaurus/mdx-loader@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/mdx-loader@npm:3.5.2" dependencies: - "@babel/parser": ^7.22.7 - "@babel/traverse": ^7.22.8 - "@docusaurus/logger": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 + "@docusaurus/logger": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 "@mdx-js/mdx": ^3.0.0 "@slorber/remark-comment": ^1.0.0 escape-html: ^1.0.3 @@ -2530,7 +3681,7 @@ __metadata: peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 8ba9774cd2cc7216f645d54a6f6f6cba34e39e371f0de09e56f60a27dde95a8e42ab92cf0a6f384dce01960c68a1e720868c56b6aa8929d23bafe9f523941151 + checksum: 36186c2f3487631757b24ba3a21575d2253ca1e6ada82d556bf323da7ae7637c0880eb388bf375e207bc5f26dcd8b58cc76d763e6c2caf6ed80f88748444ce8d languageName: node linkType: hard @@ -2553,37 +3704,37 @@ __metadata: languageName: node linkType: hard -"@docusaurus/module-type-aliases@npm:3.0.1, @docusaurus/module-type-aliases@npm:^3.0.1": - version: 3.0.1 - resolution: "@docusaurus/module-type-aliases@npm:3.0.1" +"@docusaurus/module-type-aliases@npm:3.5.2, @docusaurus/module-type-aliases@npm:^3.5.2": + version: 3.5.2 + resolution: "@docusaurus/module-type-aliases@npm:3.5.2" dependencies: - "@docusaurus/react-loadable": 5.5.2 - "@docusaurus/types": 3.0.1 + "@docusaurus/types": 3.5.2 "@types/history": ^4.7.11 "@types/react": "*" "@types/react-router-config": "*" "@types/react-router-dom": "*" react-helmet-async: "*" - react-loadable: "npm:@docusaurus/react-loadable@5.5.2" + react-loadable: "npm:@docusaurus/react-loadable@6.0.0" peerDependencies: react: "*" react-dom: "*" - checksum: 08895f8b100df772bb9c9a8fcf9cd3ee83f0deafeb76fb9b14efd5cdd3313abb4a02032868bd458cb3a5f345942fd9f4c44833ce5042279b2241d462a1bf4cc2 + checksum: 0161db859d459bb25ac162f0c509fb1316dfb403a9e89f325a9bc7d9f35ae1825b9703a435777903ba93de827d4413b189bbd0c03018ac13d66b50633302ea80 languageName: node linkType: hard -"@docusaurus/plugin-content-blog@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-content-blog@npm:3.0.1" - dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/logger": 3.0.1 - "@docusaurus/mdx-loader": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-common": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 - cheerio: ^1.0.0-rc.12 +"@docusaurus/plugin-content-blog@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-content-blog@npm:3.5.2" + dependencies: + "@docusaurus/core": 3.5.2 + "@docusaurus/logger": 3.5.2 + "@docusaurus/mdx-loader": 3.5.2 + "@docusaurus/theme-common": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-common": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 + cheerio: 1.0.0-rc.12 feed: ^4.2.2 fs-extra: ^11.1.1 lodash: ^4.17.21 @@ -2594,23 +3745,26 @@ __metadata: utility-types: ^3.10.0 webpack: ^5.88.1 peerDependencies: + "@docusaurus/plugin-content-docs": "*" react: ^18.0.0 react-dom: ^18.0.0 - checksum: 20985fac48d2f77d560483d06d8fc21ea8c3a009be8d040da76bd4363279ad7fe8f98353bc6a50504403be3315508344faa62123ac3691912d27710fe3c6ec90 + checksum: c5997b9d86ccf939998f9d56e65491ecf9e677d8425e95a79b3b428041d4dfc4ecb03a18ef595777c3ad5bd65f4a2dd30d99cb6f1b411161bf7cd32027ecc6d5 languageName: node linkType: hard -"@docusaurus/plugin-content-docs@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-content-docs@npm:3.0.1" - dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/logger": 3.0.1 - "@docusaurus/mdx-loader": 3.0.1 - "@docusaurus/module-type-aliases": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 +"@docusaurus/plugin-content-docs@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-content-docs@npm:3.5.2" + dependencies: + "@docusaurus/core": 3.5.2 + "@docusaurus/logger": 3.5.2 + "@docusaurus/mdx-loader": 3.5.2 + "@docusaurus/module-type-aliases": 3.5.2 + "@docusaurus/theme-common": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-common": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 "@types/react-router-config": ^5.0.7 combine-promises: ^1.1.0 fs-extra: ^11.1.1 @@ -2622,7 +3776,7 @@ __metadata: peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: ee3a12a49df2db112798e8d080365c9cc2afc4959f28772abe03eb9c806b919a9837669354b04a1ff99bf473cab1aa3b8b6ad740947a440a6b9cae09823ef6b2 + checksum: fb7ba7f8a6741b14bbe8db0bf1b12ff7a24d12c40d8276f32b9b393881d74bfed3bed4f1e5b0756cac0e43c4bd8106094d5cf6a3c527400e9713283fc3832dab languageName: node linkType: hard @@ -2653,129 +3807,129 @@ __metadata: languageName: node linkType: hard -"@docusaurus/plugin-content-pages@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-content-pages@npm:3.0.1" +"@docusaurus/plugin-content-pages@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-content-pages@npm:3.5.2" dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/mdx-loader": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 + "@docusaurus/core": 3.5.2 + "@docusaurus/mdx-loader": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 fs-extra: ^11.1.1 tslib: ^2.6.0 webpack: ^5.88.1 peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 0a3bd568e4b9df11b5926c5be10f2ced08b241f1a6b8a08f556c57ce707ebb788b19937ec1d884474c4e275dc71affb91dd55a2965ad02a03545e3eae4976141 + checksum: 8b3f1040e8ec006c9431508e73ef3f61cd5759bece3770189f7d52609f91bd156c9b18d0608f9cb14c456a1d1823be6633c573d5eee7cf9bd142b0f978c7a745 languageName: node linkType: hard -"@docusaurus/plugin-debug@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-debug@npm:3.0.1" +"@docusaurus/plugin-debug@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-debug@npm:3.5.2" dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils": 3.0.1 + "@docusaurus/core": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils": 3.5.2 fs-extra: ^11.1.1 react-json-view-lite: ^1.2.0 tslib: ^2.6.0 peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 419f2bb61aceca70ffbba03e5e885303cea72055a41328d09d78fa2e40e7d5feb0ee4d66f056d54ac01f8d2361e890a072da6570da16f290c84746ced1582823 + checksum: a839e6c3a595ea202fdd7fbce638ab8df26ba73a8c7ead8c04d1bbb509ebe34e9633e7fe9eb54a7a733e93a03d74a60df4d9f6597b9621ff464280d4dd71db34 languageName: node linkType: hard -"@docusaurus/plugin-google-analytics@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-google-analytics@npm:3.0.1" +"@docusaurus/plugin-google-analytics@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-google-analytics@npm:3.5.2" dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 + "@docusaurus/core": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 tslib: ^2.6.0 peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 850930ed0860411142fe058562040f0b3a776be755670790273f48bfa37c7ee904d9107ec23d2ce210904610b72769ce0996a558c89414ac3687bd38bb50edf4 + checksum: 0b8c4d21333d40c2509d6ef807caaf69f085010c5deac514ab34f53b5486fd76766c90213dc98976a6c4d66fdfa14bf6b05594e51e8a53ec60c2a3fa08fd9a83 languageName: node linkType: hard -"@docusaurus/plugin-google-gtag@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-google-gtag@npm:3.0.1" +"@docusaurus/plugin-google-gtag@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-google-gtag@npm:3.5.2" dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 + "@docusaurus/core": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 "@types/gtag.js": ^0.0.12 tslib: ^2.6.0 peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 579a19a6dad3940801a170efc7e5c763c7f90b68d5ecdb2707b61311af321122e84cd0bb5ceb45669e76df712ea1747d6d30fa5a0574b69a7f337dd66b346a04 + checksum: 5d53c2483c8c7e3a8e842bd091a774d4041f0e165d216b3c02f031a224a77258c9456e8b2acd0500b4a0eff474a83c1b82803628db9d4b132514409936c68ac4 languageName: node linkType: hard -"@docusaurus/plugin-google-tag-manager@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-google-tag-manager@npm:3.0.1" +"@docusaurus/plugin-google-tag-manager@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-google-tag-manager@npm:3.5.2" dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 + "@docusaurus/core": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 tslib: ^2.6.0 peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 1e3faf9496f75d43a81a5ff2921e783c87ef13d852cf678b54275fa0f79d70efdc127df6ae9c90ddce58b81384f39ec62de75d7e64e34ae96ea938cf234268c0 + checksum: 9a6fc2ca54ea677c6edfd78f4f392d7d9ae86afd085fcda96d5ac41efa441352c25a2519595d9d15fb9b838e2ae39837f0daf02e2406c5cd56199ae237bd7b7a languageName: node linkType: hard -"@docusaurus/plugin-sitemap@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/plugin-sitemap@npm:3.0.1" - dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/logger": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-common": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 +"@docusaurus/plugin-sitemap@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/plugin-sitemap@npm:3.5.2" + dependencies: + "@docusaurus/core": 3.5.2 + "@docusaurus/logger": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-common": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 fs-extra: ^11.1.1 sitemap: ^7.1.1 tslib: ^2.6.0 peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 464359fa44143f3e686d02cd70f86741cdd4a74f29f212b83767617fc1dacbfddfa4321c16e0c253849ff41a75078fabbfdf8637d7a141fb1a0354360db2b2bb + checksum: 26b6bceb7ab87fe7f6f666742d1e81de32cdacc5aaa3d45d91002c7d64e3258f3d0aac87c6b0d442eaf34ede2af4b7521b50737f2e8e2718daff6fce10230213 languageName: node linkType: hard -"@docusaurus/preset-classic@npm:^3.0.1": - version: 3.0.1 - resolution: "@docusaurus/preset-classic@npm:3.0.1" - dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/plugin-content-blog": 3.0.1 - "@docusaurus/plugin-content-docs": 3.0.1 - "@docusaurus/plugin-content-pages": 3.0.1 - "@docusaurus/plugin-debug": 3.0.1 - "@docusaurus/plugin-google-analytics": 3.0.1 - "@docusaurus/plugin-google-gtag": 3.0.1 - "@docusaurus/plugin-google-tag-manager": 3.0.1 - "@docusaurus/plugin-sitemap": 3.0.1 - "@docusaurus/theme-classic": 3.0.1 - "@docusaurus/theme-common": 3.0.1 - "@docusaurus/theme-search-algolia": 3.0.1 - "@docusaurus/types": 3.0.1 +"@docusaurus/preset-classic@npm:^3.5.2": + version: 3.5.2 + resolution: "@docusaurus/preset-classic@npm:3.5.2" + dependencies: + "@docusaurus/core": 3.5.2 + "@docusaurus/plugin-content-blog": 3.5.2 + "@docusaurus/plugin-content-docs": 3.5.2 + "@docusaurus/plugin-content-pages": 3.5.2 + "@docusaurus/plugin-debug": 3.5.2 + "@docusaurus/plugin-google-analytics": 3.5.2 + "@docusaurus/plugin-google-gtag": 3.5.2 + "@docusaurus/plugin-google-tag-manager": 3.5.2 + "@docusaurus/plugin-sitemap": 3.5.2 + "@docusaurus/theme-classic": 3.5.2 + "@docusaurus/theme-common": 3.5.2 + "@docusaurus/theme-search-algolia": 3.5.2 + "@docusaurus/types": 3.5.2 peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 03e75324c92a70aea9980f29a993e79967e5ca85d2db1b18bcb00e6c3d8711fec1a1728f92247d4d35a119ae5c3fb5b5d728ea33591f36e8bd43fa6acb1c791c + checksum: ec578e62b3b13b1874b14235a448a913c2d2358ea9b9d9c60bb250be468ab62387c88ec44e1ee82ad5b3d7243306e31919888a80eae62e5e8eab0ae12194bf69 languageName: node linkType: hard @@ -2791,26 +3945,26 @@ __metadata: languageName: node linkType: hard -"@docusaurus/theme-classic@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/theme-classic@npm:3.0.1" - dependencies: - "@docusaurus/core": 3.0.1 - "@docusaurus/mdx-loader": 3.0.1 - "@docusaurus/module-type-aliases": 3.0.1 - "@docusaurus/plugin-content-blog": 3.0.1 - "@docusaurus/plugin-content-docs": 3.0.1 - "@docusaurus/plugin-content-pages": 3.0.1 - "@docusaurus/theme-common": 3.0.1 - "@docusaurus/theme-translations": 3.0.1 - "@docusaurus/types": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-common": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 +"@docusaurus/theme-classic@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/theme-classic@npm:3.5.2" + dependencies: + "@docusaurus/core": 3.5.2 + "@docusaurus/mdx-loader": 3.5.2 + "@docusaurus/module-type-aliases": 3.5.2 + "@docusaurus/plugin-content-blog": 3.5.2 + "@docusaurus/plugin-content-docs": 3.5.2 + "@docusaurus/plugin-content-pages": 3.5.2 + "@docusaurus/theme-common": 3.5.2 + "@docusaurus/theme-translations": 3.5.2 + "@docusaurus/types": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-common": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 "@mdx-js/react": ^3.0.0 clsx: ^2.0.0 copy-text-to-clipboard: ^3.2.0 - infima: 0.2.0-alpha.43 + infima: 0.2.0-alpha.44 lodash: ^4.17.21 nprogress: ^0.2.0 postcss: ^8.4.26 @@ -2823,21 +3977,18 @@ __metadata: peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 86cef28b5f93d01f15cb134283b8d1006466d661cc39c09c585e56a6a98b09816f8e7cef24b164e8a378b6deb4ed8984fdc329d09fdcbe83fa51529091ccfad8 + checksum: 6c415b01ad24bb43eb166e2b780a84356ff14a627627f6a541c2803832d56c4f9409a5636048693d2d24804f59c2cc7bda925d9ef999a8276fe125477d2b2e1e languageName: node linkType: hard -"@docusaurus/theme-common@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/theme-common@npm:3.0.1" - dependencies: - "@docusaurus/mdx-loader": 3.0.1 - "@docusaurus/module-type-aliases": 3.0.1 - "@docusaurus/plugin-content-blog": 3.0.1 - "@docusaurus/plugin-content-docs": 3.0.1 - "@docusaurus/plugin-content-pages": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-common": 3.0.1 +"@docusaurus/theme-common@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/theme-common@npm:3.5.2" + dependencies: + "@docusaurus/mdx-loader": 3.5.2 + "@docusaurus/module-type-aliases": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-common": 3.5.2 "@types/history": ^4.7.11 "@types/react": "*" "@types/react-router-config": "*" @@ -2847,24 +3998,25 @@ __metadata: tslib: ^2.6.0 utility-types: ^3.10.0 peerDependencies: + "@docusaurus/plugin-content-docs": "*" react: ^18.0.0 react-dom: ^18.0.0 - checksum: 99fb138fd2fb499d53ee81ae717768b5cb6556ddd337b6d1a399815cb428eed2c04d2823e2040fd4db27bc79681f6333ac1ea78d760ff7fc4475d16d1790552a + checksum: c78ec7f6035abc920a2a0bc1ad78920178a5452538a3a70794eca8d4b976725f6ccc464ee3092afd31ca59b4e061ad4c21cdce7f5e10b06567075814b2fc2002 languageName: node linkType: hard -"@docusaurus/theme-search-algolia@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/theme-search-algolia@npm:3.0.1" +"@docusaurus/theme-search-algolia@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/theme-search-algolia@npm:3.5.2" dependencies: "@docsearch/react": ^3.5.2 - "@docusaurus/core": 3.0.1 - "@docusaurus/logger": 3.0.1 - "@docusaurus/plugin-content-docs": 3.0.1 - "@docusaurus/theme-common": 3.0.1 - "@docusaurus/theme-translations": 3.0.1 - "@docusaurus/utils": 3.0.1 - "@docusaurus/utils-validation": 3.0.1 + "@docusaurus/core": 3.5.2 + "@docusaurus/logger": 3.5.2 + "@docusaurus/plugin-content-docs": 3.5.2 + "@docusaurus/theme-common": 3.5.2 + "@docusaurus/theme-translations": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-validation": 3.5.2 algoliasearch: ^4.18.0 algoliasearch-helper: ^3.13.3 clsx: ^2.0.0 @@ -2876,17 +4028,17 @@ __metadata: peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 24a38dbd7085ea78c412e50c94dda7e0ecb80046dd18c1fdb515d81b21be5cdbc706705a5155600510b0814698abb234885a576d90e0db9cf3c5983d0bf51462 + checksum: e945e3001996477597bfad074eaef074cf4c5365ed3076c3109130a2252b266e4e2fac46904a0626eedeff23b9ac11e7b985cc71f5485ede52d3ddf379b7959b languageName: node linkType: hard -"@docusaurus/theme-translations@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/theme-translations@npm:3.0.1" +"@docusaurus/theme-translations@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/theme-translations@npm:3.5.2" dependencies: fs-extra: ^11.1.1 tslib: ^2.6.0 - checksum: a1df314ddaeb7f453867c5ee5424b36d31c6d6541f86b3927881b77333e997b87e720c0285f3be507283cb851537ff154ce0ddbd5e771c184c8aa10af721d7c2 + checksum: dc523c74a13fb8552c03e547c6de1c21881d899cc74bf088a2bed716e0ef1a4ceba2726c43656d87fff60413ca191f5ea946b182e4ae4129c14da832b5194d82 languageName: node linkType: hard @@ -2900,10 +4052,10 @@ __metadata: languageName: node linkType: hard -"@docusaurus/tsconfig@npm:^3.0.1": - version: 3.0.1 - resolution: "@docusaurus/tsconfig@npm:3.0.1" - checksum: a191e527740ea09cc4783ab45f106989f692d100e83768a4398fc08d3d41f0645afdce83aa89a1b251d5899544105af09e795af4d0db54247403a180f3c43098 +"@docusaurus/tsconfig@npm:^3.5.2": + version: 3.5.2 + resolution: "@docusaurus/tsconfig@npm:3.5.2" + checksum: 808a17eaf422ae9a948c6558dd1e92d4700b067ead3a63a84049c6845bf94f84e311cd0e4d517047fe9ea057efe393bb22c2d5c92d727d06c9f895e971f2c3ea languageName: node linkType: hard @@ -2926,10 +4078,11 @@ __metadata: languageName: node linkType: hard -"@docusaurus/types@npm:3.0.1, @docusaurus/types@npm:^3.0.1": - version: 3.0.1 - resolution: "@docusaurus/types@npm:3.0.1" +"@docusaurus/types@npm:3.5.2, @docusaurus/types@npm:^3.5.2": + version: 3.5.2 + resolution: "@docusaurus/types@npm:3.5.2" dependencies: + "@mdx-js/mdx": ^3.0.0 "@types/history": ^4.7.11 "@types/react": "*" commander: ^5.1.0 @@ -2941,7 +4094,7 @@ __metadata: peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 - checksum: 1874e66435e986262ad06639b812d49aa5c81a29815b27d31370d055335cebdad77ee0276504497b1765c489e5c5faf9795df97e52649af931d1cf381c4afa77 + checksum: e39451b7b08673ad5e1551ee6e4286f90f2554cf9ba245abfa56670550f48afca9c57b01c10ffa21dacb734c0fcd067150eeb2b1c1ebb1692f1f538b1eed0029 languageName: node linkType: hard @@ -2959,9 +4112,9 @@ __metadata: languageName: node linkType: hard -"@docusaurus/utils-common@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/utils-common@npm:3.0.1" +"@docusaurus/utils-common@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/utils-common@npm:3.5.2" dependencies: tslib: ^2.6.0 peerDependencies: @@ -2969,7 +4122,7 @@ __metadata: peerDependenciesMeta: "@docusaurus/types": optional: true - checksum: 7d4eb39258539d594cf1432d07be0325de5a02c2a00418e022b0cd2d4374788a7cc5dd3febad6f34744e5a1e76646ae909ffbdf2024284f31c579d1f1ff055d8 + checksum: 9d550c89663d4271456ae0832c82a1691207ccc95e21df3a05a4bd6bbd2624bb9e3ab7327d939c04b2023378987bcf99321b2c37be1af214852832f65d6db14a languageName: node linkType: hard @@ -2986,16 +4139,19 @@ __metadata: languageName: node linkType: hard -"@docusaurus/utils-validation@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/utils-validation@npm:3.0.1" +"@docusaurus/utils-validation@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/utils-validation@npm:3.5.2" dependencies: - "@docusaurus/logger": 3.0.1 - "@docusaurus/utils": 3.0.1 + "@docusaurus/logger": 3.5.2 + "@docusaurus/utils": 3.5.2 + "@docusaurus/utils-common": 3.5.2 + fs-extra: ^11.2.0 joi: ^17.9.2 js-yaml: ^4.1.0 + lodash: ^4.17.21 tslib: ^2.6.0 - checksum: c52edd61906ee004cea95ca33f81ec10a40276cad29f1aef505220cea4b922c1734b765d9c55b0889822351876ea545a73f7f3a4fbbb574f625fe455f8387033 + checksum: 5966e6d0e8f26292c629899f13b545501b53b345b0e2291bb47aaa80d7c9c5cf155e15a4ecd073a4095ee7c83c6db3612e0a34f81a8187fd20410b1aeb92d731 languageName: node linkType: hard @@ -3028,12 +4184,13 @@ __metadata: languageName: node linkType: hard -"@docusaurus/utils@npm:3.0.1": - version: 3.0.1 - resolution: "@docusaurus/utils@npm:3.0.1" +"@docusaurus/utils@npm:3.5.2": + version: 3.5.2 + resolution: "@docusaurus/utils@npm:3.5.2" dependencies: - "@docusaurus/logger": 3.0.1 - "@svgr/webpack": ^6.5.1 + "@docusaurus/logger": 3.5.2 + "@docusaurus/utils-common": 3.5.2 + "@svgr/webpack": ^8.1.0 escape-string-regexp: ^4.0.0 file-loader: ^6.2.0 fs-extra: ^11.1.1 @@ -3044,17 +4201,19 @@ __metadata: js-yaml: ^4.1.0 lodash: ^4.17.21 micromatch: ^4.0.5 + prompts: ^2.4.2 resolve-pathname: ^3.0.0 shelljs: ^0.8.5 tslib: ^2.6.0 url-loader: ^4.1.1 + utility-types: ^3.10.0 webpack: ^5.88.1 peerDependencies: "@docusaurus/types": "*" peerDependenciesMeta: "@docusaurus/types": optional: true - checksum: 5a8c5d8dd9cf1ad9ed1cecff3be3cbe041ebf8f51e2744af8aa006df67367f24d0888181566ed9ab2837b931a4fb135d943eadfde99708468f90f18795d413b5 + checksum: 0e0f4fc65ed076d4e4b551ecb61447b7c2468060d1655afff314515844ae34dc0546f467f53bff535f3144afc109e974da27fadb7c678a5d19966bed9e7a27c4 languageName: node linkType: hard @@ -3771,6 +4930,17 @@ __metadata: languageName: node linkType: hard +"@jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.5 + resolution: "@jridgewell/gen-mapping@npm:0.3.5" + dependencies: + "@jridgewell/set-array": ^1.2.1 + "@jridgewell/sourcemap-codec": ^1.4.10 + "@jridgewell/trace-mapping": ^0.3.24 + checksum: ff7a1764ebd76a5e129c8890aa3e2f46045109dabde62b0b6c6a250152227647178ff2069ea234753a690d8f3c4ac8b5e7b267bbee272bffb7f3b0a370ab6e52 + languageName: node + linkType: hard + "@jridgewell/resolve-uri@npm:^3.0.3, @jridgewell/resolve-uri@npm:^3.1.0": version: 3.1.1 resolution: "@jridgewell/resolve-uri@npm:3.1.1" @@ -3785,6 +4955,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/set-array@npm:^1.2.1": + version: 1.2.1 + resolution: "@jridgewell/set-array@npm:1.2.1" + checksum: 832e513a85a588f8ed4f27d1279420d8547743cc37fcad5a5a76fc74bb895b013dfe614d0eed9cb860048e6546b798f8f2652020b4b2ba0561b05caa8c654b10 + languageName: node + linkType: hard + "@jridgewell/source-map@npm:^0.3.3": version: 0.3.5 resolution: "@jridgewell/source-map@npm:0.3.5" @@ -3822,6 +4999,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": + version: 0.3.25 + resolution: "@jridgewell/trace-mapping@npm:0.3.25" + dependencies: + "@jridgewell/resolve-uri": ^3.1.0 + "@jridgewell/sourcemap-codec": ^1.4.14 + checksum: 9d3c40d225e139987b50c48988f8717a54a8c994d8a948ee42e1412e08988761d0754d7d10b803061cc3aebf35f92a5dbbab493bd0e1a9ef9e89a2130e83ba34 + languageName: node + linkType: hard + "@jridgewell/trace-mapping@npm:^0.3.20": version: 0.3.22 resolution: "@jridgewell/trace-mapping@npm:0.3.22" @@ -5024,6 +6211,15 @@ __metadata: languageName: node linkType: hard +"@svgr/babel-plugin-add-jsx-attribute@npm:8.0.0": + version: 8.0.0 + resolution: "@svgr/babel-plugin-add-jsx-attribute@npm:8.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3fc8e35d16f5abe0af5efe5851f27581225ac405d6a1ca44cda0df064cddfcc29a428c48c2e4bef6cebf627c9ac2f652a096030edb02cf5a120ce28d3c234710 + languageName: node + linkType: hard + "@svgr/babel-plugin-add-jsx-attribute@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/babel-plugin-add-jsx-attribute@npm:6.5.1" @@ -5033,7 +6229,7 @@ __metadata: languageName: node linkType: hard -"@svgr/babel-plugin-remove-jsx-attribute@npm:*": +"@svgr/babel-plugin-remove-jsx-attribute@npm:*, @svgr/babel-plugin-remove-jsx-attribute@npm:8.0.0": version: 8.0.0 resolution: "@svgr/babel-plugin-remove-jsx-attribute@npm:8.0.0" peerDependencies: @@ -5042,7 +6238,7 @@ __metadata: languageName: node linkType: hard -"@svgr/babel-plugin-remove-jsx-empty-expression@npm:*": +"@svgr/babel-plugin-remove-jsx-empty-expression@npm:*, @svgr/babel-plugin-remove-jsx-empty-expression@npm:8.0.0": version: 8.0.0 resolution: "@svgr/babel-plugin-remove-jsx-empty-expression@npm:8.0.0" peerDependencies: @@ -5051,6 +6247,15 @@ __metadata: languageName: node linkType: hard +"@svgr/babel-plugin-replace-jsx-attribute-value@npm:8.0.0": + version: 8.0.0 + resolution: "@svgr/babel-plugin-replace-jsx-attribute-value@npm:8.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 1edda65ef4f4dd8f021143c8ec276a08f6baa6f733b8e8ee2e7775597bf6b97afb47fdeefd579d6ae6c959fe2e634f55cd61d99377631212228c8cfb351b8921 + languageName: node + linkType: hard + "@svgr/babel-plugin-replace-jsx-attribute-value@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/babel-plugin-replace-jsx-attribute-value@npm:6.5.1" @@ -5060,6 +6265,15 @@ __metadata: languageName: node linkType: hard +"@svgr/babel-plugin-svg-dynamic-title@npm:8.0.0": + version: 8.0.0 + resolution: "@svgr/babel-plugin-svg-dynamic-title@npm:8.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 876cec891488992e6a9aebb8155e2bea4ec461b4718c51de36e988e00e271c6d9d01ef6be17b9effd44b2b3d7db0b41c161a5904a46ae6f38b26b387ad7f3709 + languageName: node + linkType: hard + "@svgr/babel-plugin-svg-dynamic-title@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/babel-plugin-svg-dynamic-title@npm:6.5.1" @@ -5069,6 +6283,15 @@ __metadata: languageName: node linkType: hard +"@svgr/babel-plugin-svg-em-dimensions@npm:8.0.0": + version: 8.0.0 + resolution: "@svgr/babel-plugin-svg-em-dimensions@npm:8.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: be0e2d391164428327d9ec469a52cea7d93189c6b0e2c290999e048f597d777852f701c64dca44cd45b31ed14a7f859520326e2e4ad7c3a4545d0aa235bc7e9a + languageName: node + linkType: hard + "@svgr/babel-plugin-svg-em-dimensions@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/babel-plugin-svg-em-dimensions@npm:6.5.1" @@ -5078,6 +6301,15 @@ __metadata: languageName: node linkType: hard +"@svgr/babel-plugin-transform-react-native-svg@npm:8.1.0": + version: 8.1.0 + resolution: "@svgr/babel-plugin-transform-react-native-svg@npm:8.1.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 85b434a57572f53bd2b9f0606f253e1fcf57b4a8c554ec3f2d43ed17f50d8cae200cb3aaf1ec9d626e1456e8b135dce530ae047eb0bed6d4bf98a752d6640459 + languageName: node + linkType: hard + "@svgr/babel-plugin-transform-react-native-svg@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/babel-plugin-transform-react-native-svg@npm:6.5.1" @@ -5087,6 +6319,15 @@ __metadata: languageName: node linkType: hard +"@svgr/babel-plugin-transform-svg-component@npm:8.0.0": + version: 8.0.0 + resolution: "@svgr/babel-plugin-transform-svg-component@npm:8.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 04e2023d75693eeb0890341c40e449881184663056c249be7e5c80168e4aabb0fadd255e8d5d2dbf54b8c2a6e700efba994377135bfa4060dc4a2e860116ef8c + languageName: node + linkType: hard + "@svgr/babel-plugin-transform-svg-component@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/babel-plugin-transform-svg-component@npm:6.5.1" @@ -5096,6 +6337,24 @@ __metadata: languageName: node linkType: hard +"@svgr/babel-preset@npm:8.1.0": + version: 8.1.0 + resolution: "@svgr/babel-preset@npm:8.1.0" + dependencies: + "@svgr/babel-plugin-add-jsx-attribute": 8.0.0 + "@svgr/babel-plugin-remove-jsx-attribute": 8.0.0 + "@svgr/babel-plugin-remove-jsx-empty-expression": 8.0.0 + "@svgr/babel-plugin-replace-jsx-attribute-value": 8.0.0 + "@svgr/babel-plugin-svg-dynamic-title": 8.0.0 + "@svgr/babel-plugin-svg-em-dimensions": 8.0.0 + "@svgr/babel-plugin-transform-react-native-svg": 8.1.0 + "@svgr/babel-plugin-transform-svg-component": 8.0.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3a67930f080b8891e1e8e2595716b879c944d253112bae763dce59807ba23454d162216c8d66a0a0e3d4f38a649ecd6c387e545d1e1261dd69a68e9a3392ee08 + languageName: node + linkType: hard + "@svgr/babel-preset@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/babel-preset@npm:6.5.1" @@ -5114,6 +6373,19 @@ __metadata: languageName: node linkType: hard +"@svgr/core@npm:8.1.0": + version: 8.1.0 + resolution: "@svgr/core@npm:8.1.0" + dependencies: + "@babel/core": ^7.21.3 + "@svgr/babel-preset": 8.1.0 + camelcase: ^6.2.0 + cosmiconfig: ^8.1.3 + snake-case: ^3.0.4 + checksum: da4a12865c7dc59829d58df8bd232d6c85b7115fda40da0d2f844a1a51886e2e945560596ecfc0345d37837ac457de86a931e8b8d8550e729e0c688c02250d8a + languageName: node + linkType: hard + "@svgr/core@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/core@npm:6.5.1" @@ -5127,6 +6399,16 @@ __metadata: languageName: node linkType: hard +"@svgr/hast-util-to-babel-ast@npm:8.0.0": + version: 8.0.0 + resolution: "@svgr/hast-util-to-babel-ast@npm:8.0.0" + dependencies: + "@babel/types": ^7.21.3 + entities: ^4.4.0 + checksum: 88401281a38bbc7527e65ff5437970414391a86158ef4b4046c89764c156d2d39ecd7cce77be8a51994c9fb3249170cb1eb8b9128b62faaa81743ef6ed3534ab + languageName: node + linkType: hard + "@svgr/hast-util-to-babel-ast@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/hast-util-to-babel-ast@npm:6.5.1" @@ -5137,6 +6419,20 @@ __metadata: languageName: node linkType: hard +"@svgr/plugin-jsx@npm:8.1.0": + version: 8.1.0 + resolution: "@svgr/plugin-jsx@npm:8.1.0" + dependencies: + "@babel/core": ^7.21.3 + "@svgr/babel-preset": 8.1.0 + "@svgr/hast-util-to-babel-ast": 8.0.0 + svg-parser: ^2.0.4 + peerDependencies: + "@svgr/core": "*" + checksum: 0418a9780753d3544912ee2dad5d2cf8d12e1ba74df8053651b3886aeda54d5f0f7d2dece0af5e0d838332c4f139a57f0dabaa3ca1afa4d1a765efce6a7656f2 + languageName: node + linkType: hard + "@svgr/plugin-jsx@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/plugin-jsx@npm:6.5.1" @@ -5151,6 +6447,19 @@ __metadata: languageName: node linkType: hard +"@svgr/plugin-svgo@npm:8.1.0": + version: 8.1.0 + resolution: "@svgr/plugin-svgo@npm:8.1.0" + dependencies: + cosmiconfig: ^8.1.3 + deepmerge: ^4.3.1 + svgo: ^3.0.2 + peerDependencies: + "@svgr/core": "*" + checksum: 59d9d214cebaacca9ca71a561f463d8b7e5a68ca9443e4792a42d903acd52259b1790c0680bc6afecc3f00a255a6cbd7ea278a9f625bac443620ea58a590c2d0 + languageName: node + linkType: hard + "@svgr/plugin-svgo@npm:^6.5.1": version: 6.5.1 resolution: "@svgr/plugin-svgo@npm:6.5.1" @@ -5164,7 +6473,7 @@ __metadata: languageName: node linkType: hard -"@svgr/webpack@npm:^6.2.1, @svgr/webpack@npm:^6.5.1": +"@svgr/webpack@npm:^6.2.1": version: 6.5.1 resolution: "@svgr/webpack@npm:6.5.1" dependencies: @@ -5180,6 +6489,22 @@ __metadata: languageName: node linkType: hard +"@svgr/webpack@npm:^8.1.0": + version: 8.1.0 + resolution: "@svgr/webpack@npm:8.1.0" + dependencies: + "@babel/core": ^7.21.3 + "@babel/plugin-transform-react-constant-elements": ^7.21.3 + "@babel/preset-env": ^7.20.2 + "@babel/preset-react": ^7.18.6 + "@babel/preset-typescript": ^7.21.0 + "@svgr/core": 8.1.0 + "@svgr/plugin-jsx": 8.1.0 + "@svgr/plugin-svgo": 8.1.0 + checksum: c6eec5b0cf2fb2ecd3a7a362d272eda35330b17c76802a3481f499b5d07ff8f87b31d2571043bff399b051a1767b1e2e499dbf186104d1c06d76f9f1535fac01 + languageName: node + linkType: hard + "@szmarczak/http-timer@npm:^1.1.2": version: 1.1.2 resolution: "@szmarczak/http-timer@npm:1.1.2" @@ -7155,6 +8480,24 @@ __metadata: languageName: node linkType: hard +"autoprefixer@npm:^10.4.19": + version: 10.4.20 + resolution: "autoprefixer@npm:10.4.20" + dependencies: + browserslist: ^4.23.3 + caniuse-lite: ^1.0.30001646 + fraction.js: ^4.3.7 + normalize-range: ^0.1.2 + picocolors: ^1.0.1 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.1.0 + bin: + autoprefixer: bin/autoprefixer + checksum: 187cec2ec356631932b212f76dc64f4419c117fdb2fb9eeeb40867d38ba5ca5ba734e6ceefc9e3af4eec8258e60accdf5cbf2b7708798598fde35cdc3de562d6 + languageName: node + linkType: hard + "available-typed-arrays@npm:^1.0.5": version: 1.0.5 resolution: "available-typed-arrays@npm:1.0.5" @@ -7247,6 +8590,19 @@ __metadata: languageName: node linkType: hard +"babel-plugin-polyfill-corejs2@npm:^0.4.10": + version: 0.4.11 + resolution: "babel-plugin-polyfill-corejs2@npm:0.4.11" + dependencies: + "@babel/compat-data": ^7.22.6 + "@babel/helper-define-polyfill-provider": ^0.6.2 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: f098353ce7c7dde1a1d2710858e01b471e85689110c9e37813e009072347eb8c55d5f84d20d3bf1cab31755f20078ba90f8855fdc4686a9daa826a95ff280bd7 + languageName: node + linkType: hard + "babel-plugin-polyfill-corejs2@npm:^0.4.6": version: 0.4.6 resolution: "babel-plugin-polyfill-corejs2@npm:0.4.6" @@ -7260,6 +8616,18 @@ __metadata: languageName: node linkType: hard +"babel-plugin-polyfill-corejs3@npm:^0.10.6": + version: 0.10.6 + resolution: "babel-plugin-polyfill-corejs3@npm:0.10.6" + dependencies: + "@babel/helper-define-polyfill-provider": ^0.6.2 + core-js-compat: ^3.38.0 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: f762f29f7acca576897c63149c850f0a72babd3fb9ea436a2e36f0c339161c4b912a77828541d8188ce8a91e50965c6687120cf36071eabb1b7aa92f279e2164 + languageName: node + linkType: hard + "babel-plugin-polyfill-corejs3@npm:^0.8.5": version: 0.8.6 resolution: "babel-plugin-polyfill-corejs3@npm:0.8.6" @@ -7283,6 +8651,17 @@ __metadata: languageName: node linkType: hard +"babel-plugin-polyfill-regenerator@npm:^0.6.1": + version: 0.6.2 + resolution: "babel-plugin-polyfill-regenerator@npm:0.6.2" + dependencies: + "@babel/helper-define-polyfill-provider": ^0.6.2 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 150233571072b6b3dfe946242da39cba8587b7f908d1c006f7545fc88b0e3c3018d445739beb61e7a75835f0c2751dbe884a94ff9b245ec42369d9267e0e1b3f + languageName: node + linkType: hard + "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -7607,6 +8986,20 @@ __metadata: languageName: node linkType: hard +"browserslist@npm:^4.23.0, browserslist@npm:^4.23.1, browserslist@npm:^4.23.3": + version: 4.24.0 + resolution: "browserslist@npm:4.24.0" + dependencies: + caniuse-lite: ^1.0.30001663 + electron-to-chromium: ^1.5.28 + node-releases: ^2.0.18 + update-browserslist-db: ^1.1.0 + bin: + browserslist: cli.js + checksum: de200d3eb8d6ed819dad99719099a28fb6ebeb88016a5ac42fbdc11607e910c236a84ca1b0bbf232477d4b88ab64e8ab6aa67557cdd40a73ca9c2834f92ccce0 + languageName: node + linkType: hard + "bs58@npm:^4.0.0": version: 4.0.1 resolution: "bs58@npm:4.0.1" @@ -7833,6 +9226,13 @@ __metadata: languageName: node linkType: hard +"caniuse-lite@npm:^1.0.30001646, caniuse-lite@npm:^1.0.30001663": + version: 1.0.30001664 + resolution: "caniuse-lite@npm:1.0.30001664" + checksum: cee25b4ea8a84779b7c9a60c1f9e304f6d99b79ef622b25fbc7873b4e55e8722a1091dd6c8b77bd7723e9f26a84b4a820a50a864989dd477e7ee51dc30461dca + languageName: node + linkType: hard + "ccount@npm:^1.0.0": version: 1.1.0 resolution: "ccount@npm:1.1.0" @@ -8005,7 +9405,7 @@ __metadata: languageName: node linkType: hard -"cheerio@npm:^1.0.0-rc.12, cheerio@npm:^1.0.0-rc.3": +"cheerio@npm:1.0.0-rc.12, cheerio@npm:^1.0.0-rc.3": version: 1.0.0-rc.12 resolution: "cheerio@npm:1.0.0-rc.12" dependencies: @@ -8330,7 +9730,7 @@ __metadata: languageName: node linkType: hard -"colord@npm:^2.9.1": +"colord@npm:^2.9.1, colord@npm:^2.9.3": version: 2.9.3 resolution: "colord@npm:2.9.3" checksum: 95d909bfbcfd8d5605cbb5af56f2d1ce2b323990258fd7c0d2eb0e6d3bb177254d7fb8213758db56bb4ede708964f78c6b992b326615f81a18a6aaf11d64c650 @@ -8703,6 +10103,15 @@ __metadata: languageName: node linkType: hard +"core-js-compat@npm:^3.37.1, core-js-compat@npm:^3.38.0": + version: 3.38.1 + resolution: "core-js-compat@npm:3.38.1" + dependencies: + browserslist: ^4.23.3 + checksum: a0a5673bcd59f588f0cd0b59cdacd4712b82909738a87406d334dd412eb3d273ae72b275bdd8e8fef63fca9ef12b42ed651be139c7c44c8a1acb423c8906992e + languageName: node + linkType: hard + "core-js-pure@npm:^3.30.2": version: 3.34.0 resolution: "core-js-pure@npm:3.34.0" @@ -8750,7 +10159,7 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^8.2.0": +"cosmiconfig@npm:^8.1.3, cosmiconfig@npm:^8.2.0": version: 8.3.6 resolution: "cosmiconfig@npm:8.3.6" dependencies: @@ -8981,6 +10390,15 @@ __metadata: languageName: node linkType: hard +"css-declaration-sorter@npm:^7.2.0": + version: 7.2.0 + resolution: "css-declaration-sorter@npm:7.2.0" + peerDependencies: + postcss: ^8.0.9 + checksum: 69b2f63a1c7c593123fabcbb353618ed01eb75f6404da9321328fbb30d603d89c47195129fadf1dc316e1406a0881400b324c2bded9438c47196e1c96ec726dd + languageName: node + linkType: hard + "css-loader@npm:^6.7.1, css-loader@npm:^6.8.1": version: 6.8.1 resolution: "css-loader@npm:6.8.1" @@ -8999,7 +10417,7 @@ __metadata: languageName: node linkType: hard -"css-minimizer-webpack-plugin@npm:^4.0.0, css-minimizer-webpack-plugin@npm:^4.2.2": +"css-minimizer-webpack-plugin@npm:^4.0.0": version: 4.2.2 resolution: "css-minimizer-webpack-plugin@npm:4.2.2" dependencies: @@ -9028,6 +10446,35 @@ __metadata: languageName: node linkType: hard +"css-minimizer-webpack-plugin@npm:^5.0.1": + version: 5.0.1 + resolution: "css-minimizer-webpack-plugin@npm:5.0.1" + dependencies: + "@jridgewell/trace-mapping": ^0.3.18 + cssnano: ^6.0.1 + jest-worker: ^29.4.3 + postcss: ^8.4.24 + schema-utils: ^4.0.1 + serialize-javascript: ^6.0.1 + peerDependencies: + webpack: ^5.0.0 + peerDependenciesMeta: + "@parcel/css": + optional: true + "@swc/css": + optional: true + clean-css: + optional: true + csso: + optional: true + esbuild: + optional: true + lightningcss: + optional: true + checksum: 10055802c61d1ae72584eac03b6bd221ecbefde11d337be44a5459d8de075b38f91b80949f95cd0c3a10295615ee013f82130bfac5fe9b5b3e8e75531f232680 + languageName: node + linkType: hard + "css-select@npm:^4.1.3": version: 4.3.0 resolution: "css-select@npm:4.3.0" @@ -9064,6 +10511,26 @@ __metadata: languageName: node linkType: hard +"css-tree@npm:^2.3.1": + version: 2.3.1 + resolution: "css-tree@npm:2.3.1" + dependencies: + mdn-data: 2.0.30 + source-map-js: ^1.0.1 + checksum: 493cc24b5c22b05ee5314b8a0d72d8a5869491c1458017ae5ed75aeb6c3596637dbe1b11dac2548974624adec9f7a1f3a6cf40593dc1f9185eb0e8279543fbc0 + languageName: node + linkType: hard + +"css-tree@npm:~2.2.0": + version: 2.2.1 + resolution: "css-tree@npm:2.2.1" + dependencies: + mdn-data: 2.0.28 + source-map-js: ^1.0.1 + checksum: b94aa8cc2f09e6f66c91548411fcf74badcbad3e150345074715012d16333ce573596ff5dfca03c2a87edf1924716db765120f94247e919d72753628ba3aba27 + languageName: node + linkType: hard + "css-what@npm:^6.0.1, css-what@npm:^6.1.0": version: 6.1.0 resolution: "css-what@npm:6.1.0" @@ -9080,7 +10547,7 @@ __metadata: languageName: node linkType: hard -"cssnano-preset-advanced@npm:^5.3.10, cssnano-preset-advanced@npm:^5.3.8": +"cssnano-preset-advanced@npm:^5.3.8": version: 5.3.10 resolution: "cssnano-preset-advanced@npm:5.3.10" dependencies: @@ -9096,6 +10563,23 @@ __metadata: languageName: node linkType: hard +"cssnano-preset-advanced@npm:^6.1.2": + version: 6.1.2 + resolution: "cssnano-preset-advanced@npm:6.1.2" + dependencies: + autoprefixer: ^10.4.19 + browserslist: ^4.23.0 + cssnano-preset-default: ^6.1.2 + postcss-discard-unused: ^6.0.5 + postcss-merge-idents: ^6.0.3 + postcss-reduce-idents: ^6.0.3 + postcss-zindex: ^6.0.2 + peerDependencies: + postcss: ^8.4.31 + checksum: cf70e27915947412730abb3075587efb66bcea58d7f1b906a7225bb4a40c9ca40150251a2ac33363d4f55bbdeb9ba000c242fa6244ee36cba2477ac07fbbe791 + languageName: node + linkType: hard + "cssnano-preset-default@npm:^5.2.14": version: 5.2.14 resolution: "cssnano-preset-default@npm:5.2.14" @@ -9135,6 +10619,46 @@ __metadata: languageName: node linkType: hard +"cssnano-preset-default@npm:^6.1.2": + version: 6.1.2 + resolution: "cssnano-preset-default@npm:6.1.2" + dependencies: + browserslist: ^4.23.0 + css-declaration-sorter: ^7.2.0 + cssnano-utils: ^4.0.2 + postcss-calc: ^9.0.1 + postcss-colormin: ^6.1.0 + postcss-convert-values: ^6.1.0 + postcss-discard-comments: ^6.0.2 + postcss-discard-duplicates: ^6.0.3 + postcss-discard-empty: ^6.0.3 + postcss-discard-overridden: ^6.0.2 + postcss-merge-longhand: ^6.0.5 + postcss-merge-rules: ^6.1.1 + postcss-minify-font-values: ^6.1.0 + postcss-minify-gradients: ^6.0.3 + postcss-minify-params: ^6.1.0 + postcss-minify-selectors: ^6.0.4 + postcss-normalize-charset: ^6.0.2 + postcss-normalize-display-values: ^6.0.2 + postcss-normalize-positions: ^6.0.2 + postcss-normalize-repeat-style: ^6.0.2 + postcss-normalize-string: ^6.0.2 + postcss-normalize-timing-functions: ^6.0.2 + postcss-normalize-unicode: ^6.1.0 + postcss-normalize-url: ^6.0.2 + postcss-normalize-whitespace: ^6.0.2 + postcss-ordered-values: ^6.0.2 + postcss-reduce-initial: ^6.1.0 + postcss-reduce-transforms: ^6.0.2 + postcss-svgo: ^6.0.3 + postcss-unique-selectors: ^6.0.4 + peerDependencies: + postcss: ^8.4.31 + checksum: 51d93e52df7141143947dc4695b5087c04b41ea153e4f4c0282ac012b62c7457c6aca244f604ae94fa3b4840903a30a1e7df38f8610e0b304d05e3065375ee56 + languageName: node + linkType: hard + "cssnano-utils@npm:^3.1.0": version: 3.1.0 resolution: "cssnano-utils@npm:3.1.0" @@ -9144,7 +10668,16 @@ __metadata: languageName: node linkType: hard -"cssnano@npm:^5.1.12, cssnano@npm:^5.1.15, cssnano@npm:^5.1.8": +"cssnano-utils@npm:^4.0.2": + version: 4.0.2 + resolution: "cssnano-utils@npm:4.0.2" + peerDependencies: + postcss: ^8.4.31 + checksum: f04c6854e75d847c7a43aff835e003d5bc7387ddfc476f0ad3a2d63663d0cec41047d46604c1717bf6b5a8e24e54bb519e465ff78d62c7e073c7cbe2279bebaf + languageName: node + linkType: hard + +"cssnano@npm:^5.1.12, cssnano@npm:^5.1.8": version: 5.1.15 resolution: "cssnano@npm:5.1.15" dependencies: @@ -9157,6 +10690,18 @@ __metadata: languageName: node linkType: hard +"cssnano@npm:^6.0.1, cssnano@npm:^6.1.2": + version: 6.1.2 + resolution: "cssnano@npm:6.1.2" + dependencies: + cssnano-preset-default: ^6.1.2 + lilconfig: ^3.1.1 + peerDependencies: + postcss: ^8.4.31 + checksum: 65aad92c5ee0089ffd4cd933c18c65edbf7634f7c3cd833a499dc948aa7e4168be22130dfe83bde07fcdc87f7c45a02d09040b7f439498208bc90b8d5a9abcc8 + languageName: node + linkType: hard + "csso@npm:^4.2.0": version: 4.2.0 resolution: "csso@npm:4.2.0" @@ -9166,6 +10711,15 @@ __metadata: languageName: node linkType: hard +"csso@npm:^5.0.5": + version: 5.0.5 + resolution: "csso@npm:5.0.5" + dependencies: + css-tree: ~2.2.0 + checksum: 0ad858d36bf5012ed243e9ec69962a867509061986d2ee07cc040a4b26e4d062c00d4c07e5ba8d430706ceb02dd87edd30a52b5937fd45b1b6f2119c4993d59a + languageName: node + linkType: hard + "csstype@npm:^3.0.2": version: 3.1.3 resolution: "csstype@npm:3.1.3" @@ -9281,7 +10835,7 @@ __metadata: languageName: node linkType: hard -"deepmerge@npm:^4.2.2": +"deepmerge@npm:^4.2.2, deepmerge@npm:^4.3.1": version: 4.3.1 resolution: "deepmerge@npm:4.3.1" checksum: 2024c6a980a1b7128084170c4cf56b0fd58a63f2da1660dcfe977415f27b17dbe5888668b59d0b063753f3220719d5e400b7f113609489c90160bb9a5518d052 @@ -9557,11 +11111,11 @@ __metadata: version: 0.0.0-use.local resolution: "docs@workspace:docs" dependencies: - "@docusaurus/core": ^3.0.1 - "@docusaurus/module-type-aliases": ^3.0.1 - "@docusaurus/preset-classic": ^3.0.1 - "@docusaurus/tsconfig": ^3.0.1 - "@docusaurus/types": ^3.0.1 + "@docusaurus/core": ^3.5.2 + "@docusaurus/module-type-aliases": ^3.5.2 + "@docusaurus/preset-classic": ^3.5.2 + "@docusaurus/tsconfig": ^3.5.2 + "@docusaurus/types": ^3.5.2 "@easyops-cn/docusaurus-search-local": ^0.35.0 "@mdx-js/react": ^3.0.0 "@noir-lang/noir_js": "workspace:*" @@ -9751,6 +11305,13 @@ __metadata: languageName: node linkType: hard +"electron-to-chromium@npm:^1.5.28": + version: 1.5.29 + resolution: "electron-to-chromium@npm:1.5.29" + checksum: c1de62aaea88c9b3ba32f8f2703b9d77a81633099a8f61365eaf9855d36e72189dcd99b9c3b8b2804afa403ac2ce0b00c23affa6f19d17b04ce0076f66a546b6 + languageName: node + linkType: hard + "elliptic@npm:6.5.4, elliptic@npm:^6.5.2, elliptic@npm:^6.5.4": version: 6.5.4 resolution: "elliptic@npm:6.5.4" @@ -10085,6 +11646,13 @@ __metadata: languageName: node linkType: hard +"escalade@npm:^3.2.0": + version: 3.2.0 + resolution: "escalade@npm:3.2.0" + checksum: 47b029c83de01b0d17ad99ed766347b974b0d628e848de404018f3abee728e987da0d2d370ad4574aa3d5b5bfc368754fd085d69a30f8e75903486ec4b5b709e + languageName: node + linkType: hard + "escape-goat@npm:^2.0.0": version: 2.1.1 resolution: "escape-goat@npm:2.1.1" @@ -11032,7 +12600,7 @@ __metadata: languageName: node linkType: hard -"fraction.js@npm:^4.3.6": +"fraction.js@npm:^4.3.6, fraction.js@npm:^4.3.7": version: 4.3.7 resolution: "fraction.js@npm:4.3.7" checksum: e1553ae3f08e3ba0e8c06e43a3ab20b319966dfb7ddb96fd9b5d0ee11a66571af7f993229c88ebbb0d4a816eb813a24ed48207b140d442a8f76f33763b8d1f3f @@ -11057,7 +12625,7 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:^11.1.1": +"fs-extra@npm:^11.1.1, fs-extra@npm:^11.2.0": version: 11.2.0 resolution: "fs-extra@npm:11.2.0" dependencies: @@ -12494,10 +14062,10 @@ __metadata: languageName: node linkType: hard -"infima@npm:0.2.0-alpha.43": - version: 0.2.0-alpha.43 - resolution: "infima@npm:0.2.0-alpha.43" - checksum: fc5f79240e940eddd750439511767092ccb4051e5e91d253ec7630a9e7ce691812da3aa0f05e46b4c0a95dbfadeae5714fd0073f8d2df12e5aaff0697a1d6aa2 +"infima@npm:0.2.0-alpha.44": + version: 0.2.0-alpha.44 + resolution: "infima@npm:0.2.0-alpha.44" + checksum: e9871f4056c0c8b311fcd32e2864d23a8f6807af5ff32d3c4d8271ad9971b5a7ea5016787a6b215893bb3e9f5f14326816bc05151d576dd375b0d79279cdfa8b languageName: node linkType: hard @@ -13230,7 +14798,7 @@ __metadata: languageName: node linkType: hard -"jest-worker@npm:^29.1.2": +"jest-worker@npm:^29.1.2, jest-worker@npm:^29.4.3": version: 29.7.0 resolution: "jest-worker@npm:29.7.0" dependencies: @@ -13748,6 +15316,13 @@ __metadata: languageName: node linkType: hard +"lilconfig@npm:^3.1.1": + version: 3.1.2 + resolution: "lilconfig@npm:3.1.2" + checksum: 4e8b83ddd1d0ad722600994e6ba5d858ddca14f0587aa6b9c8185e17548149b5e13d4d583d811e9e9323157fa8c6a527e827739794c7502b59243c58e210b8c3 + languageName: node + linkType: hard + "lines-and-columns@npm:^1.1.6": version: 1.2.4 resolution: "lines-and-columns@npm:1.2.4" @@ -14450,6 +16025,20 @@ __metadata: languageName: node linkType: hard +"mdn-data@npm:2.0.28": + version: 2.0.28 + resolution: "mdn-data@npm:2.0.28" + checksum: f51d587a6ebe8e426c3376c74ea6df3e19ec8241ed8e2466c9c8a3904d5d04397199ea4f15b8d34d14524b5de926d8724ae85207984be47e165817c26e49e0aa + languageName: node + linkType: hard + +"mdn-data@npm:2.0.30": + version: 2.0.30 + resolution: "mdn-data@npm:2.0.30" + checksum: d6ac5ac7439a1607df44b22738ecf83f48e66a0874e4482d6424a61c52da5cde5750f1d1229b6f5fa1b80a492be89465390da685b11f97d62b8adcc6e88189aa + languageName: node + linkType: hard + "mdurl@npm:^1.0.0": version: 1.0.1 resolution: "mdurl@npm:1.0.1" @@ -15537,6 +17126,13 @@ __metadata: languageName: node linkType: hard +"node-releases@npm:^2.0.18": + version: 2.0.18 + resolution: "node-releases@npm:2.0.18" + checksum: ef55a3d853e1269a6d6279b7692cd6ff3e40bc74947945101138745bfdc9a5edabfe72cb19a31a8e45752e1910c4c65c77d931866af6357f242b172b7283f5b3 + languageName: node + linkType: hard + "nopt@npm:^7.0.0": version: 7.2.0 resolution: "nopt@npm:7.2.0" @@ -16265,6 +17861,13 @@ __metadata: languageName: node linkType: hard +"picocolors@npm:^1.0.1, picocolors@npm:^1.1.0": + version: 1.1.0 + resolution: "picocolors@npm:1.1.0" + checksum: a64d653d3a188119ff45781dfcdaeedd7625583f45280aea33fcb032c7a0d3959f2368f9b192ad5e8aade75b74dbd954ffe3106c158509a45e4c18ab379a2acd + languageName: node + linkType: hard + "picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.2, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -16346,17 +17949,43 @@ __metadata: languageName: node linkType: hard +"postcss-calc@npm:^9.0.1": + version: 9.0.1 + resolution: "postcss-calc@npm:9.0.1" + dependencies: + postcss-selector-parser: ^6.0.11 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.2 + checksum: 7327ed83bfec544ab8b3e38353baa72ff6d04378b856db4ad82dbd68ce0b73668867ef182b5d4025f9dd9aa9c64aacc50cd1bd9db8d8b51ccc4cb97866b9d72b + languageName: node + linkType: hard + "postcss-colormin@npm:^5.3.1": version: 5.3.1 resolution: "postcss-colormin@npm:5.3.1" dependencies: - browserslist: ^4.21.4 + browserslist: ^4.21.4 + caniuse-api: ^3.0.0 + colord: ^2.9.1 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: e5778baab30877cd1f51e7dc9d2242a162aeca6360a52956acd7f668c5bc235c2ccb7e4df0370a804d65ebe00c5642366f061db53aa823f9ed99972cebd16024 + languageName: node + linkType: hard + +"postcss-colormin@npm:^6.1.0": + version: 6.1.0 + resolution: "postcss-colormin@npm:6.1.0" + dependencies: + browserslist: ^4.23.0 caniuse-api: ^3.0.0 - colord: ^2.9.1 + colord: ^2.9.3 postcss-value-parser: ^4.2.0 peerDependencies: - postcss: ^8.2.15 - checksum: e5778baab30877cd1f51e7dc9d2242a162aeca6360a52956acd7f668c5bc235c2ccb7e4df0370a804d65ebe00c5642366f061db53aa823f9ed99972cebd16024 + postcss: ^8.4.31 + checksum: 55a1525de345d953bc7f32ecaa5ee6275ef0277c27d1f97ff06a1bd1a2fedf7f254e36dc1500621f1df20c25a6d2485a74a0b527d8ff74eb90726c76efe2ac8e languageName: node linkType: hard @@ -16372,6 +18001,18 @@ __metadata: languageName: node linkType: hard +"postcss-convert-values@npm:^6.1.0": + version: 6.1.0 + resolution: "postcss-convert-values@npm:6.1.0" + dependencies: + browserslist: ^4.23.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 43e9f66af9bdec3c76695f9dde36885abc01f662c370c490b45d895459caab2c5792f906f3ddad107129133e41485a65634da7f699eef916a636e47f6a37a299 + languageName: node + linkType: hard + "postcss-discard-comments@npm:^5.1.2": version: 5.1.2 resolution: "postcss-discard-comments@npm:5.1.2" @@ -16381,6 +18022,15 @@ __metadata: languageName: node linkType: hard +"postcss-discard-comments@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-discard-comments@npm:6.0.2" + peerDependencies: + postcss: ^8.4.31 + checksum: c1731ccc8d1e3d910412a61395988d3033365e6532d9e5432ad7c74add8c9dcb0af0c03d4e901bf0d2b59ea4e7297a0c77a547ff2ed1b1cc065559cc0de43b4e + languageName: node + linkType: hard + "postcss-discard-duplicates@npm:^5.1.0": version: 5.1.0 resolution: "postcss-discard-duplicates@npm:5.1.0" @@ -16390,6 +18040,15 @@ __metadata: languageName: node linkType: hard +"postcss-discard-duplicates@npm:^6.0.3": + version: 6.0.3 + resolution: "postcss-discard-duplicates@npm:6.0.3" + peerDependencies: + postcss: ^8.4.31 + checksum: 308e3fb84c35e4703532de1efa5d6e8444cc5f167d0e40f42d7ea3fa3a37d9d636fd10729847d078e0c303eee16f8548d14b6f88a3fce4e38a2b452648465175 + languageName: node + linkType: hard + "postcss-discard-empty@npm:^5.1.1": version: 5.1.1 resolution: "postcss-discard-empty@npm:5.1.1" @@ -16399,6 +18058,15 @@ __metadata: languageName: node linkType: hard +"postcss-discard-empty@npm:^6.0.3": + version: 6.0.3 + resolution: "postcss-discard-empty@npm:6.0.3" + peerDependencies: + postcss: ^8.4.31 + checksum: bad305572faa066026a295faab37e718cee096589ab827b19c990c55620b2b2a1ce9f0145212651737a66086db01b2676c1927bbb8408c5f9cb42686d5959f00 + languageName: node + linkType: hard + "postcss-discard-overridden@npm:^5.1.0": version: 5.1.0 resolution: "postcss-discard-overridden@npm:5.1.0" @@ -16408,6 +18076,15 @@ __metadata: languageName: node linkType: hard +"postcss-discard-overridden@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-discard-overridden@npm:6.0.2" + peerDependencies: + postcss: ^8.4.31 + checksum: a38e0fe7a36f83cb9b73c1ba9ee2a48cf93c69ec0ea5753935824ffb71e958e58ae0393171c0f3d0014a397469d09bbb0d56bb5ab80f0280722967e2e273aebb + languageName: node + linkType: hard + "postcss-discard-unused@npm:^5.1.0": version: 5.1.0 resolution: "postcss-discard-unused@npm:5.1.0" @@ -16419,6 +18096,17 @@ __metadata: languageName: node linkType: hard +"postcss-discard-unused@npm:^6.0.5": + version: 6.0.5 + resolution: "postcss-discard-unused@npm:6.0.5" + dependencies: + postcss-selector-parser: ^6.0.16 + peerDependencies: + postcss: ^8.4.31 + checksum: 7962640773240186de38125f142a6555b7f9b2493c4968e0f0b11c6629b2bf43ac70b9fc4ee78aa732d82670ad8bf802b2febc9a9864b022eb68530eded26836 + languageName: node + linkType: hard + "postcss-loader@npm:^7.0.0, postcss-loader@npm:^7.3.3": version: 7.3.3 resolution: "postcss-loader@npm:7.3.3" @@ -16445,6 +18133,18 @@ __metadata: languageName: node linkType: hard +"postcss-merge-idents@npm:^6.0.3": + version: 6.0.3 + resolution: "postcss-merge-idents@npm:6.0.3" + dependencies: + cssnano-utils: ^4.0.2 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: b45780d6d103b8e45a580032747ee6e1842f81863672341a6b4961397e243ca896217bf1f3ee732376a766207d5f610ba8924cf08cf6d5bbd4b093133fd05d70 + languageName: node + linkType: hard + "postcss-merge-longhand@npm:^5.1.7": version: 5.1.7 resolution: "postcss-merge-longhand@npm:5.1.7" @@ -16457,6 +18157,18 @@ __metadata: languageName: node linkType: hard +"postcss-merge-longhand@npm:^6.0.5": + version: 6.0.5 + resolution: "postcss-merge-longhand@npm:6.0.5" + dependencies: + postcss-value-parser: ^4.2.0 + stylehacks: ^6.1.1 + peerDependencies: + postcss: ^8.4.31 + checksum: 9ae5acf47dc0c1f494684ae55672d55bba7f5ee11c9c0f266aabd7c798e9f7394c6096363cd95685fd21ef088740389121a317772cf523ca22c915009bca2617 + languageName: node + linkType: hard + "postcss-merge-rules@npm:^5.1.4": version: 5.1.4 resolution: "postcss-merge-rules@npm:5.1.4" @@ -16471,6 +18183,20 @@ __metadata: languageName: node linkType: hard +"postcss-merge-rules@npm:^6.1.1": + version: 6.1.1 + resolution: "postcss-merge-rules@npm:6.1.1" + dependencies: + browserslist: ^4.23.0 + caniuse-api: ^3.0.0 + cssnano-utils: ^4.0.2 + postcss-selector-parser: ^6.0.16 + peerDependencies: + postcss: ^8.4.31 + checksum: 43f60a1c88806491cf752ae7871676de0e7a2a9d6d2fc6bc894068cc35a910a63d30f7c7d79545e0926c8b3a9ec583e5e8357203c40b5bad5ff58133b0c900f6 + languageName: node + linkType: hard + "postcss-minify-font-values@npm:^5.1.0": version: 5.1.0 resolution: "postcss-minify-font-values@npm:5.1.0" @@ -16482,6 +18208,17 @@ __metadata: languageName: node linkType: hard +"postcss-minify-font-values@npm:^6.1.0": + version: 6.1.0 + resolution: "postcss-minify-font-values@npm:6.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 985e4dd2f89220a4442a822aad7dff016ab58a9dbb7bbca9d01c2d07d5a1e7d8c02e1c6e836abb4c9b4e825b4b80d99ee1f5899e74bf0d969095037738e6e452 + languageName: node + linkType: hard + "postcss-minify-gradients@npm:^5.1.1": version: 5.1.1 resolution: "postcss-minify-gradients@npm:5.1.1" @@ -16495,6 +18232,19 @@ __metadata: languageName: node linkType: hard +"postcss-minify-gradients@npm:^6.0.3": + version: 6.0.3 + resolution: "postcss-minify-gradients@npm:6.0.3" + dependencies: + colord: ^2.9.3 + cssnano-utils: ^4.0.2 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 89b95088c3830f829f6d4636d1be4d4f13300bf9f1577c48c25169c81e11ec0026760b9abb32112b95d2c622f09d3b737f4d2975a7842927ccb567e1002ef7b3 + languageName: node + linkType: hard + "postcss-minify-params@npm:^5.1.4": version: 5.1.4 resolution: "postcss-minify-params@npm:5.1.4" @@ -16508,6 +18258,19 @@ __metadata: languageName: node linkType: hard +"postcss-minify-params@npm:^6.1.0": + version: 6.1.0 + resolution: "postcss-minify-params@npm:6.1.0" + dependencies: + browserslist: ^4.23.0 + cssnano-utils: ^4.0.2 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 1e1cc3057d9bcc532c70e40628e96e3aea0081d8072dffe983a270a8cd59c03ac585e57d036b70e43d4ee725f274a05a6a8efac5a715f448284e115c13f82a46 + languageName: node + linkType: hard + "postcss-minify-selectors@npm:^5.2.1": version: 5.2.1 resolution: "postcss-minify-selectors@npm:5.2.1" @@ -16519,6 +18282,17 @@ __metadata: languageName: node linkType: hard +"postcss-minify-selectors@npm:^6.0.4": + version: 6.0.4 + resolution: "postcss-minify-selectors@npm:6.0.4" + dependencies: + postcss-selector-parser: ^6.0.16 + peerDependencies: + postcss: ^8.4.31 + checksum: 150221a84422ca7627c67ee691ee51e0fe2c3583c8108801e9fc93d3be8b538c2eb04fcfdc908270d7eeaeaf01594a20b81311690a873efccb8a23aeafe1c354 + languageName: node + linkType: hard + "postcss-modules-extract-imports@npm:^3.0.0": version: 3.0.0 resolution: "postcss-modules-extract-imports@npm:3.0.0" @@ -16572,6 +18346,15 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-charset@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-charset@npm:6.0.2" + peerDependencies: + postcss: ^8.4.31 + checksum: 5b8aeb17d61578a8656571cd5d5eefa8d4ee7126a99a41fdd322078002a06f2ae96f649197b9c01067a5f3e38a2e4b03e0e3fda5a0ec9e3d7ad056211ce86156 + languageName: node + linkType: hard + "postcss-normalize-display-values@npm:^5.1.0": version: 5.1.0 resolution: "postcss-normalize-display-values@npm:5.1.0" @@ -16583,6 +18366,17 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-display-values@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-display-values@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: da30a9394b0e4a269ccad8d240693a6cd564bcc60e24db67caee00f70ddfbc070ad76faed64c32e6eec9ed02e92565488b7879d4fd6c40d877c290eadbb0bb28 + languageName: node + linkType: hard + "postcss-normalize-positions@npm:^5.1.1": version: 5.1.1 resolution: "postcss-normalize-positions@npm:5.1.1" @@ -16594,6 +18388,17 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-positions@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-positions@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 44fb77583fae4d71b76e38226cf770570876bcf5af6940dc9aeac7a7e2252896b361e0249044766cff8dad445f925378f06a005d6541597573c20e599a62b516 + languageName: node + linkType: hard + "postcss-normalize-repeat-style@npm:^5.1.1": version: 5.1.1 resolution: "postcss-normalize-repeat-style@npm:5.1.1" @@ -16605,6 +18410,17 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-repeat-style@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-repeat-style@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: bebdac63bec6777ead3e265fc12527b261cf8d0da1b7f0abb12bda86fd53b7058e4afe392210ac74dac012e413bb1c2a46a1138c89f82b8bf70b81711f620f8c + languageName: node + linkType: hard + "postcss-normalize-string@npm:^5.1.0": version: 5.1.0 resolution: "postcss-normalize-string@npm:5.1.0" @@ -16616,6 +18432,17 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-string@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-string@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 5e8e253c528b542accafc142846fb33643c342a787c86e5b68c6287c7d8f63c5ae7d4d3fc28e3daf80821cc26a91add135e58bdd62ff9c735fca65d994898c7d + languageName: node + linkType: hard + "postcss-normalize-timing-functions@npm:^5.1.0": version: 5.1.0 resolution: "postcss-normalize-timing-functions@npm:5.1.0" @@ -16627,6 +18454,17 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-timing-functions@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-timing-functions@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 1970f5aad04be11f99d51c59e27debb6fd7b49d0fa4a8879062b42c82113f8e520a284448727add3b54de85deefb8bd5fe554f618406586e9ad8fc9d060609f1 + languageName: node + linkType: hard + "postcss-normalize-unicode@npm:^5.1.1": version: 5.1.1 resolution: "postcss-normalize-unicode@npm:5.1.1" @@ -16639,6 +18477,18 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-unicode@npm:^6.1.0": + version: 6.1.0 + resolution: "postcss-normalize-unicode@npm:6.1.0" + dependencies: + browserslist: ^4.23.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 69ef35d06242061f0c504c128b83752e0f8daa30ebb26734de7d090460910be0b2efd8b17b1d64c3c85b95831a041faad9ad0aaba80e239406a79cfad3d63568 + languageName: node + linkType: hard + "postcss-normalize-url@npm:^5.1.0": version: 5.1.0 resolution: "postcss-normalize-url@npm:5.1.0" @@ -16651,6 +18501,17 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-url@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-url@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: bef51a18bbfee4fbf0381fec3c91e6c0dace36fca053bbd5f228e653d2732b6df3985525d79c4f7fc89f840ed07eb6d226e9d7503ecdc6f16d6d80cacae9df33 + languageName: node + linkType: hard + "postcss-normalize-whitespace@npm:^5.1.1": version: 5.1.1 resolution: "postcss-normalize-whitespace@npm:5.1.1" @@ -16662,6 +18523,17 @@ __metadata: languageName: node linkType: hard +"postcss-normalize-whitespace@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-normalize-whitespace@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 6081eb3a4b305749eec02c00a95c2d236336a77ee636bb1d939f18d5dfa5ba82b7cf7fa072e83f9133d0bc984276596af3fe468bdd67c742ce69e9c63dbc218d + languageName: node + linkType: hard + "postcss-ordered-values@npm:^5.1.3": version: 5.1.3 resolution: "postcss-ordered-values@npm:5.1.3" @@ -16674,6 +18546,18 @@ __metadata: languageName: node linkType: hard +"postcss-ordered-values@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-ordered-values@npm:6.0.2" + dependencies: + cssnano-utils: ^4.0.2 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: c3d96177b4ffa43754e835e30c40043cc75ab1e95eb6c55ac8723eb48c13a12e986250e63d96619bbbd1a098876a1c0c1b3b7a8e1de1108a009cf7aa0beac834 + languageName: node + linkType: hard + "postcss-reduce-idents@npm:^5.2.0": version: 5.2.0 resolution: "postcss-reduce-idents@npm:5.2.0" @@ -16685,6 +18569,17 @@ __metadata: languageName: node linkType: hard +"postcss-reduce-idents@npm:^6.0.3": + version: 6.0.3 + resolution: "postcss-reduce-idents@npm:6.0.3" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 1feff316838f947386c908f50807cf1b9589fd09b8e8df633a01f2640af5492833cc892448938ceba10ab96826c44767b8f2e1569d587579423f2db81202f7c7 + languageName: node + linkType: hard + "postcss-reduce-initial@npm:^5.1.2": version: 5.1.2 resolution: "postcss-reduce-initial@npm:5.1.2" @@ -16697,6 +18592,18 @@ __metadata: languageName: node linkType: hard +"postcss-reduce-initial@npm:^6.1.0": + version: 6.1.0 + resolution: "postcss-reduce-initial@npm:6.1.0" + dependencies: + browserslist: ^4.23.0 + caniuse-api: ^3.0.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 39e4034ffbf62a041b66944c5cebc4b17f656e76b97568f7f6230b0b886479e5c75b02ae4ba48c472cb0bde47489f9ed1fe6110ae8cff0d7b7165f53c2d64a12 + languageName: node + linkType: hard + "postcss-reduce-transforms@npm:^5.1.0": version: 5.1.0 resolution: "postcss-reduce-transforms@npm:5.1.0" @@ -16708,6 +18615,27 @@ __metadata: languageName: node linkType: hard +"postcss-reduce-transforms@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-reduce-transforms@npm:6.0.2" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: c424cc554eb5d253b7687b64925a13fc16759f058795d223854f5a20d9bca641b5f25d0559d03287e63f07a4629c24ac78156adcf604483fcad3c51721da0a08 + languageName: node + linkType: hard + +"postcss-selector-parser@npm:^6.0.11, postcss-selector-parser@npm:^6.0.16": + version: 6.1.2 + resolution: "postcss-selector-parser@npm:6.1.2" + dependencies: + cssesc: ^3.0.0 + util-deprecate: ^1.0.2 + checksum: ce9440fc42a5419d103f4c7c1847cb75488f3ac9cbe81093b408ee9701193a509f664b4d10a2b4d82c694ee7495e022f8f482d254f92b7ffd9ed9dea696c6f84 + languageName: node + linkType: hard + "postcss-selector-parser@npm:^6.0.2, postcss-selector-parser@npm:^6.0.4, postcss-selector-parser@npm:^6.0.5, postcss-selector-parser@npm:^6.0.9": version: 6.0.13 resolution: "postcss-selector-parser@npm:6.0.13" @@ -16718,7 +18646,7 @@ __metadata: languageName: node linkType: hard -"postcss-sort-media-queries@npm:^4.2.1, postcss-sort-media-queries@npm:^4.4.1": +"postcss-sort-media-queries@npm:^4.2.1": version: 4.4.1 resolution: "postcss-sort-media-queries@npm:4.4.1" dependencies: @@ -16729,6 +18657,17 @@ __metadata: languageName: node linkType: hard +"postcss-sort-media-queries@npm:^5.2.0": + version: 5.2.0 + resolution: "postcss-sort-media-queries@npm:5.2.0" + dependencies: + sort-css-media-queries: 2.2.0 + peerDependencies: + postcss: ^8.4.23 + checksum: d4a976a64b53234762cc35c06ce97c1684bd7a64ead17e84c2047676c7307945be7c005235e6aac7c4620e1f835d6ba1a7dcf018ab7fe0a47657c62c96ad9f35 + languageName: node + linkType: hard + "postcss-svgo@npm:^5.1.0": version: 5.1.0 resolution: "postcss-svgo@npm:5.1.0" @@ -16741,6 +18680,18 @@ __metadata: languageName: node linkType: hard +"postcss-svgo@npm:^6.0.3": + version: 6.0.3 + resolution: "postcss-svgo@npm:6.0.3" + dependencies: + postcss-value-parser: ^4.2.0 + svgo: ^3.2.0 + peerDependencies: + postcss: ^8.4.31 + checksum: 1a7d1c8dea555884a7791e28ec2c22ea92331731067584ff5a23042a0e615f88fefde04e1140f11c262a728ef9fab6851423b40b9c47f9ae05353bd3c0ff051a + languageName: node + linkType: hard + "postcss-unique-selectors@npm:^5.1.1": version: 5.1.1 resolution: "postcss-unique-selectors@npm:5.1.1" @@ -16752,6 +18703,17 @@ __metadata: languageName: node linkType: hard +"postcss-unique-selectors@npm:^6.0.4": + version: 6.0.4 + resolution: "postcss-unique-selectors@npm:6.0.4" + dependencies: + postcss-selector-parser: ^6.0.16 + peerDependencies: + postcss: ^8.4.31 + checksum: b09df9943b4e858e88b30f3d279ce867a0490df806f1f947d286b0a4e95ba923f1229c385e5bf365f4f124f1edccda41ec18ccad4ba8798d829279d6dc971203 + languageName: node + linkType: hard + "postcss-value-parser@npm:^4.1.0, postcss-value-parser@npm:^4.2.0": version: 4.2.0 resolution: "postcss-value-parser@npm:4.2.0" @@ -16768,6 +18730,15 @@ __metadata: languageName: node linkType: hard +"postcss-zindex@npm:^6.0.2": + version: 6.0.2 + resolution: "postcss-zindex@npm:6.0.2" + peerDependencies: + postcss: ^8.4.31 + checksum: 394119e47b0fb098dc53d1bcf71b5500ab29605fe106526b2e81290bff179174ee00a82a4d4be5a42d4ef4138e8a3d6aabeef3b06cf7cb15b851848c8585d53b + languageName: node + linkType: hard + "postcss@npm:^8.4.14, postcss@npm:^8.4.17, postcss@npm:^8.4.21, postcss@npm:^8.4.26": version: 8.4.32 resolution: "postcss@npm:8.4.32" @@ -16779,6 +18750,17 @@ __metadata: languageName: node linkType: hard +"postcss@npm:^8.4.24, postcss@npm:^8.4.38": + version: 8.4.47 + resolution: "postcss@npm:8.4.47" + dependencies: + nanoid: ^3.3.7 + picocolors: ^1.1.0 + source-map-js: ^1.2.1 + checksum: f78440a9d8f97431dd2ab1ab8e1de64f12f3eff38a3d8d4a33919b96c381046a314658d2de213a5fa5eb296b656de76a3ec269fdea27f16d5ab465b916a0f52c + languageName: node + linkType: hard + "prelude-ls@npm:^1.2.1": version: 1.2.1 resolution: "prelude-ls@npm:1.2.1" @@ -17266,6 +19248,17 @@ __metadata: languageName: node linkType: hard +"react-loadable@npm:@docusaurus/react-loadable@6.0.0": + version: 6.0.0 + resolution: "@docusaurus/react-loadable@npm:6.0.0" + dependencies: + "@types/react": "*" + peerDependencies: + react: "*" + checksum: 4c32061b2fc10689d5d8ba11ead71b69e4c8a55fcfeafb551a6747b1a7b496c4f2d8dbb5d023f5cafc2a9aea9d14582bdb324d11e6f9b8c3049d45b74439203f + languageName: node + linkType: hard + "react-router-config@npm:^5.1.1": version: 5.1.1 resolution: "react-router-config@npm:5.1.1" @@ -18175,7 +20168,7 @@ __metadata: languageName: node linkType: hard -"schema-utils@npm:^4.0.0, schema-utils@npm:^4.2.0": +"schema-utils@npm:^4.0.0, schema-utils@npm:^4.0.1, schema-utils@npm:^4.2.0": version: 4.2.0 resolution: "schema-utils@npm:4.2.0" dependencies: @@ -18647,6 +20640,16 @@ __metadata: languageName: node linkType: hard +"snake-case@npm:^3.0.4": + version: 3.0.4 + resolution: "snake-case@npm:3.0.4" + dependencies: + dot-case: ^3.0.4 + tslib: ^2.0.3 + checksum: 0a7a79900bbb36f8aaa922cf111702a3647ac6165736d5dc96d3ef367efc50465cac70c53cd172c382b022dac72ec91710608e5393de71f76d7142e6fd80e8a3 + languageName: node + linkType: hard + "sockjs@npm:^0.3.24": version: 0.3.24 resolution: "sockjs@npm:0.3.24" @@ -18703,6 +20706,20 @@ __metadata: languageName: node linkType: hard +"sort-css-media-queries@npm:2.2.0": + version: 2.2.0 + resolution: "sort-css-media-queries@npm:2.2.0" + checksum: c090c9a27be40f3e50f5f9bc9d85a8af0e2c5152565eca34bdb028d952749bce169bc5abef21a5a385ca6221a0869640c9faf58f082ac46de9085ebdb506291f + languageName: node + linkType: hard + +"source-map-js@npm:^1.0.1, source-map-js@npm:^1.2.1": + version: 1.2.1 + resolution: "source-map-js@npm:1.2.1" + checksum: 4eb0cd997cdf228bc253bcaff9340afeb706176e64868ecd20efbe6efea931465f43955612346d6b7318789e5265bdc419bc7669c1cebe3db0eb255f57efa76b + languageName: node + linkType: hard + "source-map-js@npm:^1.0.2": version: 1.0.2 resolution: "source-map-js@npm:1.0.2" @@ -19072,6 +21089,18 @@ __metadata: languageName: node linkType: hard +"stylehacks@npm:^6.1.1": + version: 6.1.1 + resolution: "stylehacks@npm:6.1.1" + dependencies: + browserslist: ^4.23.0 + postcss-selector-parser: ^6.0.16 + peerDependencies: + postcss: ^8.4.31 + checksum: 7bef69822280a23817caa43969de76d77ba34042e9f1f7baaeda8f22b1d8c20f1f839ad028552c169e158e387830f176feccd0324b07ef6ec657cba1dd0b2466 + languageName: node + linkType: hard + "superstruct@npm:^1.0.3": version: 1.0.3 resolution: "superstruct@npm:1.0.3" @@ -19137,6 +21166,23 @@ __metadata: languageName: node linkType: hard +"svgo@npm:^3.0.2, svgo@npm:^3.2.0": + version: 3.3.2 + resolution: "svgo@npm:3.3.2" + dependencies: + "@trysound/sax": 0.2.0 + commander: ^7.2.0 + css-select: ^5.1.0 + css-tree: ^2.3.1 + css-what: ^6.1.0 + csso: ^5.0.5 + picocolors: ^1.0.0 + bin: + svgo: ./bin/svgo + checksum: a3f8aad597dec13ab24e679c4c218147048dc1414fe04e99447c5f42a6e077b33d712d306df84674b5253b98c9b84dfbfb41fdd08552443b04946e43d03e054e + languageName: node + linkType: hard + "synckit@npm:^0.8.6": version: 0.8.8 resolution: "synckit@npm:0.8.8" @@ -20155,6 +22201,20 @@ __metadata: languageName: node linkType: hard +"update-browserslist-db@npm:^1.1.0": + version: 1.1.1 + resolution: "update-browserslist-db@npm:1.1.1" + dependencies: + escalade: ^3.2.0 + picocolors: ^1.1.0 + peerDependencies: + browserslist: ">= 4.21.0" + bin: + update-browserslist-db: cli.js + checksum: 2ea11bd2562122162c3e438d83a1f9125238c0844b6d16d366e3276d0c0acac6036822dc7df65fc5a89c699cdf9f174acf439c39bedf3f9a2f3983976e4b4c3e + languageName: node + linkType: hard + "update-check@npm:1.5.4": version: 1.5.4 resolution: "update-check@npm:1.5.4" From 67ac0d60c3e8b450a9e871f3edb29322ac5045d2 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Sat, 19 Oct 2024 20:26:30 +0100 Subject: [PATCH 4/9] feat: Warn about private types leaking in public functions and struct fields (#6296) # Description ## Problem\* Resolves #6248 ## Summary\* Issue warnings in more cases when a public item refers to private types: * public fields of a public struct fields using private types * a public function taking or returning private types ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_frontend/src/elaborator/mod.rs | 107 +++++++-- .../noirc_frontend/src/tests/visibility.rs | 203 +++++++++++++++--- .../arithmetic_generics/src/main.nr | 4 +- .../comptime_function_definition/src/main.nr | 2 +- .../comptime_module/src/main.nr | 2 +- .../regression_6077/src/main.nr | 2 +- 6 files changed, 270 insertions(+), 50 deletions(-) diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index dafafe421eb..aef0771c486 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -3,7 +3,9 @@ use std::{ rc::Rc, }; -use crate::{ast::ItemVisibility, hir_def::traits::ResolvedTraitBound, StructField, TypeBindings}; +use crate::{ + ast::ItemVisibility, hir_def::traits::ResolvedTraitBound, StructField, StructType, TypeBindings, +}; use crate::{ ast::{ BlockExpression, FunctionKind, GenericTypeArgs, Ident, NoirFunction, NoirStruct, Param, @@ -53,7 +55,7 @@ mod unquote; use fm::FileId; use iter_extended::vecmap; -use noirc_errors::{Location, Span}; +use noirc_errors::{Location, Span, Spanned}; use types::bind_ordered_generics; use self::traits::check_trait_impl_method_matches_declaration; @@ -398,6 +400,28 @@ impl<'context> Elaborator<'context> { self.run_function_lints(&func_meta, &modifiers); + // Check arg and return-value visibility of standalone functions. + if self.should_check_function_visibility(&func_meta, &modifiers) { + let name = Ident(Spanned::from( + func_meta.name.location.span, + self.interner.definition_name(func_meta.name.id).to_string(), + )); + for (_, typ, _) in func_meta.parameters.iter() { + self.check_type_is_not_more_private_then_item( + &name, + modifiers.visibility, + typ, + name.span(), + ); + } + self.check_type_is_not_more_private_then_item( + &name, + modifiers.visibility, + func_meta.return_type(), + name.span(), + ); + } + self.introduce_generics_into_scope(func_meta.all_generics.clone()); // The DefinitionIds for each parameter were already created in define_function_meta @@ -1280,14 +1304,49 @@ impl<'context> Elaborator<'context> { let typ = self.resolve_type(alias.type_alias_def.typ); if visibility != ItemVisibility::Private { - self.check_aliased_type_is_not_more_private(name, visibility, &typ, span); + self.check_type_is_not_more_private_then_item(name, visibility, &typ, span); } self.interner.set_type_alias(alias_id, typ, generics); self.generics.clear(); } - fn check_aliased_type_is_not_more_private( + /// Find the struct in the parent module so we can know its visibility + fn find_struct_visibility(&self, struct_type: &StructType) -> Option { + let parent_module_id = struct_type.id.parent_module_id(self.def_maps); + let parent_module_data = self.get_module(parent_module_id); + let per_ns = parent_module_data.find_name(&struct_type.name); + per_ns.types.map(|(_, vis, _)| vis) + } + + /// Check whether a functions return value and args should be checked for private type visibility. + fn should_check_function_visibility( + &self, + func_meta: &FuncMeta, + modifiers: &FunctionModifiers, + ) -> bool { + // Private functions don't leak anything. + if modifiers.visibility == ItemVisibility::Private { + return false; + } + // Implementing public traits on private types is okay, they can't be used unless the type itself is accessible. + if func_meta.trait_impl.is_some() { + return false; + } + // Public struct functions should not expose private types. + if let Some(struct_visibility) = func_meta.struct_id.and_then(|id| { + let struct_def = self.get_struct(id); + let struct_def = struct_def.borrow(); + self.find_struct_visibility(&struct_def) + }) { + return struct_visibility != ItemVisibility::Private; + } + // Standalone functions should be checked + true + } + + /// Check that an item such as a struct field or type alias is not more visible than the type it refers to. + fn check_type_is_not_more_private_then_item( &mut self, name: &Ident, visibility: ItemVisibility, @@ -1303,11 +1362,7 @@ impl<'context> Elaborator<'context> { // then it's either accessible (all good) or it's not, in which case a different // error will happen somewhere else, but no need to error again here. if struct_module_id.krate == self.crate_id { - // Find the struct in the parent module so we can know its visibility - let parent_module_id = struct_type.id.parent_module_id(self.def_maps); - let parent_module_data = self.get_module(parent_module_id); - let per_ns = parent_module_data.find_name(&struct_type.name); - if let Some((_, aliased_visibility, _)) = per_ns.types { + if let Some(aliased_visibility) = self.find_struct_visibility(&struct_type) { if aliased_visibility < visibility { self.push_err(ResolverError::TypeIsMorePrivateThenItem { typ: struct_type.name.to_string(), @@ -1319,16 +1374,16 @@ impl<'context> Elaborator<'context> { } for generic in generics { - self.check_aliased_type_is_not_more_private(name, visibility, generic, span); + self.check_type_is_not_more_private_then_item(name, visibility, generic, span); } } Type::Tuple(types) => { for typ in types { - self.check_aliased_type_is_not_more_private(name, visibility, typ, span); + self.check_type_is_not_more_private_then_item(name, visibility, typ, span); } } Type::Alias(alias_type, generics) => { - self.check_aliased_type_is_not_more_private( + self.check_type_is_not_more_private_then_item( name, visibility, &alias_type.borrow().get_type(generics), @@ -1337,17 +1392,17 @@ impl<'context> Elaborator<'context> { } Type::Function(args, return_type, env, _) => { for arg in args { - self.check_aliased_type_is_not_more_private(name, visibility, arg, span); + self.check_type_is_not_more_private_then_item(name, visibility, arg, span); } - self.check_aliased_type_is_not_more_private(name, visibility, return_type, span); - self.check_aliased_type_is_not_more_private(name, visibility, env, span); + self.check_type_is_not_more_private_then_item(name, visibility, return_type, span); + self.check_type_is_not_more_private_then_item(name, visibility, env, span); } Type::MutableReference(typ) | Type::Array(_, typ) | Type::Slice(typ) => { - self.check_aliased_type_is_not_more_private(name, visibility, typ, span); + self.check_type_is_not_more_private_then_item(name, visibility, typ, span); } Type::InfixExpr(left, _op, right) => { - self.check_aliased_type_is_not_more_private(name, visibility, left, span); - self.check_aliased_type_is_not_more_private(name, visibility, right, span); + self.check_type_is_not_more_private_then_item(name, visibility, left, span); + self.check_type_is_not_more_private_then_item(name, visibility, right, span); } Type::FieldElement | Type::Integer(..) @@ -1384,6 +1439,22 @@ impl<'context> Elaborator<'context> { } } + // Check that the a public struct doesn't have a private type as a public field. + if typ.struct_def.visibility != ItemVisibility::Private { + for field in &fields { + let ident = Ident(Spanned::from( + field.name.span(), + format!("{}::{}", typ.struct_def.name, field.name), + )); + self.check_type_is_not_more_private_then_item( + &ident, + field.visibility, + &field.typ, + field.name.span(), + ); + } + } + let fields_len = fields.len(); self.interner.update_struct(*type_id, |struct_def| { struct_def.set_fields(fields); diff --git a/compiler/noirc_frontend/src/tests/visibility.rs b/compiler/noirc_frontend/src/tests/visibility.rs index f02771b3760..7cfec32062d 100644 --- a/compiler/noirc_frontend/src/tests/visibility.rs +++ b/compiler/noirc_frontend/src/tests/visibility.rs @@ -28,29 +28,38 @@ fn errors_once_on_unused_import_that_is_not_accessible() { )) )); } + +fn assert_type_is_more_private_than_item_error(src: &str, private_typ: &str, public_item: &str) { + let errors = get_program_errors(src); + + assert!(!errors.is_empty(), "expected visibility error, got nothing"); + for (error, _) in &errors { + let CompilationError::ResolverError(ResolverError::TypeIsMorePrivateThenItem { + typ, + item, + .. + }) = error + else { + panic!("Expected a type vs item visibility error, got {}", error); + }; + + assert_eq!(typ, private_typ); + assert_eq!(item, public_item); + } + assert_eq!(errors.len(), 1, "only expected one error"); +} + #[test] fn errors_if_type_alias_aliases_more_private_type() { let src = r#" struct Foo {} pub type Bar = Foo; - pub fn no_unused_warnings(_b: Bar) { - let _ = Foo {}; + pub fn no_unused_warnings() { + let _: Bar = Foo {}; } fn main() {} "#; - - let errors = get_program_errors(src); - assert_eq!(errors.len(), 1); - - let CompilationError::ResolverError(ResolverError::TypeIsMorePrivateThenItem { - typ, item, .. - }) = &errors[0].0 - else { - panic!("Expected an unused item error"); - }; - - assert_eq!(typ, "Foo"); - assert_eq!(item, "Bar"); + assert_type_is_more_private_than_item_error(src, "Foo", "Bar"); } #[test] @@ -59,25 +68,165 @@ fn errors_if_type_alias_aliases_more_private_type_in_generic() { pub struct Generic { value: T } struct Foo {} pub type Bar = Generic; - pub fn no_unused_warnings(_b: Bar) { + pub fn no_unused_warnings() { let _ = Foo {}; - let _ = Generic { value: 1 }; + let _: Bar = Generic { value: Foo {} }; } fn main() {} "#; + assert_type_is_more_private_than_item_error(src, "Foo", "Bar"); +} - let errors = get_program_errors(src); - assert_eq!(errors.len(), 1); +#[test] +fn errors_if_pub_type_alias_leaks_private_type_in_generic() { + let src = r#" + pub mod moo { + struct Bar {} + pub struct Foo { pub value: T } + pub type FooBar = Foo; - let CompilationError::ResolverError(ResolverError::TypeIsMorePrivateThenItem { - typ, item, .. - }) = &errors[0].0 - else { - panic!("Expected an unused item error"); - }; + pub fn no_unused_warnings() { + let _: FooBar = Foo { value: Bar {} }; + } + } + fn main() {} + "#; + assert_type_is_more_private_than_item_error(src, "Bar", "FooBar"); +} - assert_eq!(typ, "Foo"); - assert_eq!(item, "Bar"); +#[test] +fn errors_if_pub_struct_field_leaks_private_type_in_generic() { + let src = r#" + pub mod moo { + struct Bar {} + pub struct Foo { pub value: T } + pub struct FooBar { pub value: Foo } + + pub fn no_unused_warnings() { + let _ = FooBar { value: Foo { value: Bar {} } }; + } + } + fn main() {} + "#; + assert_type_is_more_private_than_item_error(src, "Bar", "FooBar::value"); +} + +#[test] +fn errors_if_pub_function_leaks_private_type_in_return() { + let src = r#" + pub mod moo { + struct Bar {} + + pub fn bar() -> Bar { + Bar {} + } + } + fn main() {} + "#; + assert_type_is_more_private_than_item_error(src, "Bar", "bar"); +} + +#[test] +fn errors_if_pub_function_leaks_private_type_in_arg() { + let src = r#" + pub mod moo { + struct Bar {} + pub fn bar(_bar: Bar) {} + + pub fn no_unused_warnings() { + let _ = Bar {}; + } + } + fn main() {} + "#; + assert_type_is_more_private_than_item_error(src, "Bar", "bar"); +} + +#[test] +fn does_not_error_if_pub_function_is_on_private_struct() { + let src = r#" + pub mod moo { + struct Bar {} + + impl Bar { + pub fn bar() -> Bar { + Bar {} + } + } + + pub fn no_unused_warnings() { + let _ = Bar {}; + } + } + fn main() {} + "#; + assert_no_errors(src); +} + +#[test] +fn errors_if_pub_function_on_pub_struct_returns_private() { + let src = r#" + pub mod moo { + struct Bar {} + pub struct Foo {} + + impl Foo { + pub fn bar() -> Bar { + Bar {} + } + } + + pub fn no_unused_warnings() { + let _ = Foo {}; + } + } + fn main() {} + "#; + assert_type_is_more_private_than_item_error(src, "Bar", "bar"); +} + +#[test] +fn does_not_error_if_pub_trait_is_defined_on_private_struct() { + let src = r#" + pub mod moo { + struct Bar {} + + pub trait Foo { + fn foo() -> Self; + } + + impl Foo for Bar { + fn foo() -> Self { + Bar {} + } + } + + pub fn no_unused_warnings() { + let _ = Bar {}; + } + } + fn main() {} + "#; + assert_no_errors(src); +} + +#[test] +fn errors_if_pub_trait_returns_private_struct() { + let src = r#" + pub mod moo { + struct Bar {} + + pub trait Foo { + fn foo() -> Bar; + } + + pub fn no_unused_warnings() { + let _ = Bar {}; + } + } + fn main() {} + "#; + assert_type_is_more_private_than_item_error(src, "Bar", "foo"); } #[test] diff --git a/test_programs/compile_success_empty/arithmetic_generics/src/main.nr b/test_programs/compile_success_empty/arithmetic_generics/src/main.nr index 4a057a75e43..fba85bbbae2 100644 --- a/test_programs/compile_success_empty/arithmetic_generics/src/main.nr +++ b/test_programs/compile_success_empty/arithmetic_generics/src/main.nr @@ -52,9 +52,9 @@ fn push_multiple(array: [Field; N]) -> [Field; N + 2] { // The rest of this file is setup for demo_proof // ********************************************* -struct W { } +pub struct W { } -struct Equiv { +pub struct Equiv { // TODO(https://github.com/noir-lang/noir/issues/5644): // Bug with struct_obj.field_thats_a_fn(x) diff --git a/test_programs/compile_success_empty/comptime_function_definition/src/main.nr b/test_programs/compile_success_empty/comptime_function_definition/src/main.nr index 4266d3734f9..f41642dde79 100644 --- a/test_programs/compile_success_empty/comptime_function_definition/src/main.nr +++ b/test_programs/compile_success_empty/comptime_function_definition/src/main.nr @@ -1,6 +1,6 @@ use std::meta::type_of; -struct Foo { x: Field, field: Field } +pub struct Foo { x: Field, field: Field } #[function_attr] pub fn foo(w: i32, y: Field, Foo { x, field: some_field }: Foo, mut a: bool, (b, c): (i32, i32)) -> i32 { diff --git a/test_programs/compile_success_empty/comptime_module/src/main.nr b/test_programs/compile_success_empty/comptime_module/src/main.nr index 09b1e98744d..3062d765814 100644 --- a/test_programs/compile_success_empty/comptime_module/src/main.nr +++ b/test_programs/compile_success_empty/comptime_module/src/main.nr @@ -47,7 +47,7 @@ comptime fn outer_attribute_separate_module(m: Module) { increment_counter(); } -struct Foo {} +pub struct Foo {} #[add_function] mod add_to_me { diff --git a/test_programs/compile_success_empty/regression_6077/src/main.nr b/test_programs/compile_success_empty/regression_6077/src/main.nr index fe067177e77..429468b90df 100644 --- a/test_programs/compile_success_empty/regression_6077/src/main.nr +++ b/test_programs/compile_success_empty/regression_6077/src/main.nr @@ -1,4 +1,4 @@ -struct WeirdStruct { +pub struct WeirdStruct { a: T, b: U, } From 53252fd521ce7818a1d97824be30466590d879f5 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 21 Oct 2024 08:51:57 +0100 Subject: [PATCH 5/9] fix: enforce correctness of decompositions performed at compile time (#6278) # Description ## Problem\* Resolves https://github.com/noir-lang/noir/issues/6244 ## Summary\* We were not checking that a radix decomposition simplification performed at compile time was valid, resulting in a truncation to fit the result array. This PR prevents the simplification in this case so we can instead error at runtime. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- .../src/ssa/ir/instruction/call.rs | 32 ++++++++++--------- .../Nargo.toml | 7 ++++ .../src/main.nr | 5 +++ .../Nargo.toml | 7 ++++ .../src/main.nr | 4 +++ 5 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 test_programs/execution_failure/invalid_comptime_bits_decomposition/Nargo.toml create mode 100644 test_programs/execution_failure/invalid_comptime_bits_decomposition/src/main.nr create mode 100644 test_programs/execution_failure/invalid_comptime_bytes_decomposition/Nargo.toml create mode 100644 test_programs/execution_failure/invalid_comptime_bytes_decomposition/src/main.nr diff --git a/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs b/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs index 3b202b38b11..8b540d45664 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs @@ -60,9 +60,7 @@ pub(super) fn simplify_call( } else { unreachable!("ICE: Intrinsic::ToRadix return type must be array") }; - let result_array = constant_to_radix(endian, field, 2, limb_count, dfg); - - SimplifyResult::SimplifiedTo(result_array) + constant_to_radix(endian, field, 2, limb_count, dfg) } else { SimplifyResult::None } @@ -79,10 +77,7 @@ pub(super) fn simplify_call( } else { unreachable!("ICE: Intrinsic::ToRadix return type must be array") }; - - let result_array = constant_to_radix(endian, field, radix, limb_count, dfg); - - SimplifyResult::SimplifiedTo(result_array) + constant_to_radix(endian, field, radix, limb_count, dfg) } else { SimplifyResult::None } @@ -611,7 +606,7 @@ fn constant_to_radix( radix: u32, limb_count: u32, dfg: &mut DataFlowGraph, -) -> ValueId { +) -> SimplifyResult { let bit_size = u32::BITS - (radix - 1).leading_zeros(); let radix_big = BigUint::from(radix); assert_eq!(BigUint::from(2u128).pow(bit_size), radix_big, "ICE: Radix must be a power of 2"); @@ -619,14 +614,21 @@ fn constant_to_radix( // Decompose the integer into its radix digits in little endian form. let decomposed_integer = big_integer.to_radix_le(radix); - let mut limbs = vecmap(0..limb_count, |i| match decomposed_integer.get(i as usize) { - Some(digit) => FieldElement::from_be_bytes_reduce(&[*digit]), - None => FieldElement::zero(), - }); - if endian == Endian::Big { - limbs.reverse(); + if limb_count < decomposed_integer.len() as u32 { + // `field` cannot be represented as `limb_count` bits. + // defer error to acir_gen. + SimplifyResult::None + } else { + let mut limbs = vecmap(0..limb_count, |i| match decomposed_integer.get(i as usize) { + Some(digit) => FieldElement::from_be_bytes_reduce(&[*digit]), + None => FieldElement::zero(), + }); + if endian == Endian::Big { + limbs.reverse(); + } + let result_array = make_constant_array(dfg, limbs, Type::unsigned(bit_size)); + SimplifyResult::SimplifiedTo(result_array) } - make_constant_array(dfg, limbs, Type::unsigned(bit_size)) } fn to_u8_vec(dfg: &DataFlowGraph, values: im::Vector>) -> Vec { diff --git a/test_programs/execution_failure/invalid_comptime_bits_decomposition/Nargo.toml b/test_programs/execution_failure/invalid_comptime_bits_decomposition/Nargo.toml new file mode 100644 index 00000000000..c4efe5b4bb4 --- /dev/null +++ b/test_programs/execution_failure/invalid_comptime_bits_decomposition/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "invalid_comptime_bits_decomposition" +type = "bin" +authors = [""] +compiler_version = ">=0.30.0" + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_failure/invalid_comptime_bits_decomposition/src/main.nr b/test_programs/execution_failure/invalid_comptime_bits_decomposition/src/main.nr new file mode 100644 index 00000000000..a9ac06c42c6 --- /dev/null +++ b/test_programs/execution_failure/invalid_comptime_bits_decomposition/src/main.nr @@ -0,0 +1,5 @@ +fn main() -> pub [u1; 1] { + let large_number: Field = 2; + + large_number.to_be_bits() +} diff --git a/test_programs/execution_failure/invalid_comptime_bytes_decomposition/Nargo.toml b/test_programs/execution_failure/invalid_comptime_bytes_decomposition/Nargo.toml new file mode 100644 index 00000000000..7ec63576af3 --- /dev/null +++ b/test_programs/execution_failure/invalid_comptime_bytes_decomposition/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "invalid_comptime_bytes_decomposition" +type = "bin" +authors = [""] +compiler_version = ">=0.30.0" + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_failure/invalid_comptime_bytes_decomposition/src/main.nr b/test_programs/execution_failure/invalid_comptime_bytes_decomposition/src/main.nr new file mode 100644 index 00000000000..29be8508575 --- /dev/null +++ b/test_programs/execution_failure/invalid_comptime_bytes_decomposition/src/main.nr @@ -0,0 +1,4 @@ +fn main() -> pub [u8; 1] { + let large_number: Field = 256; + large_number.to_be_bytes() +} From d8767b364f4db9a52c823e7f39f36feac3c90fcd Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Mon, 21 Oct 2024 10:27:58 -0400 Subject: [PATCH 6/9] feat(interpreter): Comptime derive generators (#6303) # Description ## Problem\* Request made by the aztec team for their macros work. ## Summary\* This PR adds handling for the `derive_pedersen_generators` compiler builtin. ## Additional Context ## Documentation\* Check one: - [X] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: jfecher --- .../noirc_frontend/src/hir/comptime/errors.rs | 11 +++- .../src/hir/comptime/interpreter/builtin.rs | 56 ++++++++++++++++++ .../comptime_derive_generators/Nargo.toml | 7 +++ .../comptime_derive_generators/src/main.nr | 58 +++++++++++++++++++ 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 test_programs/compile_success_empty/comptime_derive_generators/Nargo.toml create mode 100644 test_programs/compile_success_empty/comptime_derive_generators/src/main.nr diff --git a/compiler/noirc_frontend/src/hir/comptime/errors.rs b/compiler/noirc_frontend/src/hir/comptime/errors.rs index 5217bbd1e71..dfd328f85f0 100644 --- a/compiler/noirc_frontend/src/hir/comptime/errors.rs +++ b/compiler/noirc_frontend/src/hir/comptime/errors.rs @@ -226,6 +226,10 @@ pub enum InterpreterError { location: Location, expression: String, }, + UnknownArrayLength { + length: Type, + location: Location, + }, // These cases are not errors, they are just used to prevent us from running more code // until the loop can be resumed properly. These cases will never be displayed to users. @@ -299,7 +303,8 @@ impl InterpreterError { | InterpreterError::DuplicateGeneric { duplicate_location: location, .. } | InterpreterError::TypeAnnotationsNeededForMethodCall { location } | InterpreterError::CannotResolveExpression { location, .. } - | InterpreterError::CannotSetFunctionBody { location, .. } => *location, + | InterpreterError::CannotSetFunctionBody { location, .. } + | InterpreterError::UnknownArrayLength { location, .. } => *location, InterpreterError::FailedToParseMacro { error, file, .. } => { Location::new(error.span(), *file) @@ -635,6 +640,10 @@ impl<'a> From<&'a InterpreterError> for CustomDiagnostic { let msg = format!("`{expression}` is not a valid function body"); CustomDiagnostic::simple_error(msg, String::new(), location.span) } + InterpreterError::UnknownArrayLength { length, location } => { + let msg = format!("Could not determine array length `{length}`"); + CustomDiagnostic::simple_error(msg, String::new(), location.span) + } } } } diff --git a/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs b/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs index aca0a6dd6ca..1011d71be16 100644 --- a/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs +++ b/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs @@ -63,6 +63,9 @@ impl<'local, 'context> Interpreter<'local, 'context> { "as_slice" => as_slice(interner, arguments, location), "ctstring_eq" => ctstring_eq(arguments, location), "ctstring_hash" => ctstring_hash(arguments, location), + "derive_pedersen_generators" => { + derive_generators(interner, arguments, return_type, location) + } "expr_as_array" => expr_as_array(interner, arguments, return_type, location), "expr_as_assert" => expr_as_assert(interner, arguments, return_type, location), "expr_as_assert_eq" => expr_as_assert_eq(interner, arguments, return_type, location), @@ -2770,3 +2773,56 @@ fn ctstring_eq(arguments: Vec<(Value, Location)>, location: Location) -> IResult fn ctstring_hash(arguments: Vec<(Value, Location)>, location: Location) -> IResult { hash_item(arguments, location, get_ctstring) } + +fn derive_generators( + interner: &mut NodeInterner, + arguments: Vec<(Value, Location)>, + return_type: Type, + location: Location, +) -> IResult { + let (domain_separator_string, starting_index) = check_two_arguments(arguments, location)?; + + let domain_separator_location = domain_separator_string.1; + let (domain_separator_string, _) = get_array(interner, domain_separator_string)?; + let starting_index = get_u32(starting_index)?; + + let domain_separator_string = + try_vecmap(domain_separator_string, |byte| get_u8((byte, domain_separator_location)))?; + + let (size, elements) = match return_type.clone() { + Type::Array(size, elements) => (size, elements), + _ => panic!("ICE: Should only have an array return type"), + }; + + let Some(num_generators) = size.evaluate_to_u32() else { + return Err(InterpreterError::UnknownArrayLength { length: *size, location }); + }; + + let generators = bn254_blackbox_solver::derive_generators( + &domain_separator_string, + num_generators, + starting_index, + ); + + let is_infinite = FieldElement::zero(); + let x_field_name: Rc = Rc::new("x".to_owned()); + let y_field_name: Rc = Rc::new("y".to_owned()); + let is_infinite_field_name: Rc = Rc::new("is_infinite".to_owned()); + let mut results = Vector::new(); + for gen in generators { + let x_big: BigUint = gen.x.into(); + let x = FieldElement::from_be_bytes_reduce(&x_big.to_bytes_be()); + let y_big: BigUint = gen.y.into(); + let y = FieldElement::from_be_bytes_reduce(&y_big.to_bytes_be()); + let mut embedded_curve_point_fields = HashMap::default(); + embedded_curve_point_fields.insert(x_field_name.clone(), Value::Field(x)); + embedded_curve_point_fields.insert(y_field_name.clone(), Value::Field(y)); + embedded_curve_point_fields + .insert(is_infinite_field_name.clone(), Value::Field(is_infinite)); + let embedded_curve_point_struct = + Value::Struct(embedded_curve_point_fields, *elements.clone()); + results.push_back(embedded_curve_point_struct); + } + + Ok(Value::Array(results, return_type)) +} diff --git a/test_programs/compile_success_empty/comptime_derive_generators/Nargo.toml b/test_programs/compile_success_empty/comptime_derive_generators/Nargo.toml new file mode 100644 index 00000000000..0bf7ca9d0f2 --- /dev/null +++ b/test_programs/compile_success_empty/comptime_derive_generators/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "comptime_derive_generators" +type = "bin" +authors = [""] +compiler_version = ">=0.35.0" + +[dependencies] \ No newline at end of file diff --git a/test_programs/compile_success_empty/comptime_derive_generators/src/main.nr b/test_programs/compile_success_empty/comptime_derive_generators/src/main.nr new file mode 100644 index 00000000000..c42fac8d187 --- /dev/null +++ b/test_programs/compile_success_empty/comptime_derive_generators/src/main.nr @@ -0,0 +1,58 @@ +use std::embedded_curve_ops::EmbeddedCurvePoint; + +fn main() { + comptime + { + // Result computed from executing `derive_generators` with non-comptime Noir + let result = [ + EmbeddedCurvePoint { + x: 0x0224a8abc6c8b8d50373d64cd2a1ab1567bf372b3b1f7b861d7f01257052d383, + y: 0x2358629b90eafb299d6650a311e79914b0215eb0a790810b26da5a826726d711, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x0f106f6d46bc904a5290542490b2f238775ff3c445b2f8f704c466655f460a2a, + y: 0x29ab84d472f1d33f42fe09c47b8f7710f01920d6155250126731e486877bcf27, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x0298f2e42249f0519c8a8abd91567ebe016e480f219b8c19461d6a595cc33696, + y: 0x035bec4b8520a4ece27bd5aafabee3dfe1390d7439c419a8c55aceb207aac83b, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x2c9628479de4181ea77e7b0913ccf41d2a74155b1d9c82eaa220c218781f6f3b, + y: 0x278f86b8fd95520b5da23bee1a5e354dc5dcb0cb43d6b76e628ddbffb101d776, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x0be1916f382e3532aa53a766fe74b1a983784caab90290aea7bf616bc371fb41, + y: 0x0f65545005e896f14249956344faf9addd762b7573a487b58f805a361d920a20, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x29ff8437ae5bec89981441b23036a22b7fd5bee9eff0e83c0dd5b87bfb5bd60e, + y: 0x1fd247352b77e2676b22db23cf7cd482474f543e3480b5a39c42f839a306be10, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x2f3bd4e98f8c8458cd58888749f0f5e582a43565767398e08e50e94b9b19a4d9, + y: 0x1f534906d1aa8b4ba74ad9e3f85ae3f8295e51eaafd15b5d116801b96360205b, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x27759098f425b76447c2c52728576803a1ac5de37bba875ac47cdcff539ab931, + y: 0x0aa47ee64d12d856cfb81b595c1d60ceecb693f0fdae644746ff333e39f61db7, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x015ca8d68616fde86c9108e3db04f588e0f308e60d367e963b7d460fe9a65e6c, + y: 0x2cf918009dda942ac9d59903cd2d0294d8738f938b1394170d892a027d0f347b, + is_infinite: false + }, EmbeddedCurvePoint { + x: 0x0d1783d5b256765515f3c9988df9f1ba7e6f5fb0248c8971fbc503ffd5187714, + y: 0x2ebb434ff4857fc3621f3bc3c6b8002b17d02d9c204e75f19b8f0b99ea68402c, + is_infinite: false + } + ]; + + let generators: [EmbeddedCurvePoint; 10] = std::hash::derive_generators("DEFAULT_DOMAIN_SEPARATOR".as_bytes(), 5); + + for i in 0..10 { + assert(generators[i].x == result[i].x); + assert(generators[i].y == result[i].y); + } + } +} From 33a1e7d2246bdea48dd6fe925d427c7be8c4659d Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Mon, 21 Oct 2024 16:45:57 +0100 Subject: [PATCH 7/9] fix: Display function name and body when inlining recursion limit hit (#6291) # Description ## Problem\* Resolves #4828 ## Summary\* Given a program like this: ``` fn main() { main(); } ``` Changed this panic message: ``` Attempted to recur more than 1000 times during function inlining. ``` Into this: ``` Attempted to recur more than 1000 times during inlining function 'main': acir(inline) fn main f0 { b0(): call f0() return } ``` I included the ACIR to help figure out which function is the culprit, in case the name is not enough. ## Additional Context I added a test to show that there is no compilation error or warning for the example program. It would be nice to issue a warning about unconditional recursion like Rust does. I'll try to do that in a followup PR. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- .../noirc_evaluator/src/ssa/opt/inlining.rs | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/opt/inlining.rs b/compiler/noirc_evaluator/src/ssa/opt/inlining.rs index 7843c55da65..0c11a8bee9a 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/inlining.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/inlining.rs @@ -291,13 +291,14 @@ impl InlineContext { ) -> Vec { self.recursion_level += 1; + let source_function = &ssa.functions[&id]; + if self.recursion_level > RECURSION_LIMIT { panic!( - "Attempted to recur more than {RECURSION_LIMIT} times during function inlining." + "Attempted to recur more than {RECURSION_LIMIT} times during inlining function '{}': {}", source_function.name(), source_function ); } - let source_function = &ssa.functions[&id]; let mut context = PerFunctionContext::new(self, source_function); let parameters = source_function.parameters(); @@ -967,4 +968,28 @@ mod test { let main = ssa.main(); assert_eq!(main.reachable_blocks().len(), 4); } + + #[test] + #[should_panic( + expected = "Attempted to recur more than 1000 times during inlining function 'main': acir(inline) fn main f0 {" + )] + fn unconditional_recursion() { + // fn main f1 { + // b0(): + // call f1() + // return + // } + let main_id = Id::test_new(0); + let mut builder = FunctionBuilder::new("main".into(), main_id); + + let main = builder.import_function(main_id); + let results = builder.insert_call(main, Vec::new(), vec![]).to_vec(); + builder.terminate_with_return(results); + + let ssa = builder.finish(); + assert_eq!(ssa.functions.len(), 1); + + let inlined = ssa.inline_functions(); + assert_eq!(inlined.functions.len(), 0); + } } From 51ae1b324cd73fdb4fe3695b5d483a44b4aff4a9 Mon Sep 17 00:00:00 2001 From: jfecher Date: Mon, 21 Oct 2024 14:19:38 -0500 Subject: [PATCH 8/9] fix: Allow array map on empty arrays (#6305) # Description ## Problem\* Resolves a private issue sent to me on slack ## Summary\* Array map is a fairly old method written before we had `std::mem::zeroed`. Now that we have zeroed, we can allow mapping empty arrays since we can use `zeroed` to get the filler `U` value for the starting elements. ## Additional Context While I was at it I included a small clarification to `reduce`'s docs that it requires a non-empty array ## Documentation\* Check one: - [ ] No documentation needed. - [x] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- docs/docs/noir/concepts/data_types/arrays.md | 2 ++ noir_stdlib/src/array/mod.nr | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/docs/noir/concepts/data_types/arrays.md b/docs/docs/noir/concepts/data_types/arrays.md index bb68e60fe53..289145a8c4d 100644 --- a/docs/docs/noir/concepts/data_types/arrays.md +++ b/docs/docs/noir/concepts/data_types/arrays.md @@ -203,6 +203,8 @@ fn main() { Same as fold, but uses the first element as the starting element. +Requires `self` to be non-empty. + ```rust fn reduce(self, f: fn(T, T) -> T) -> T ``` diff --git a/noir_stdlib/src/array/mod.nr b/noir_stdlib/src/array/mod.nr index 46acf619dd2..f5089de1877 100644 --- a/noir_stdlib/src/array/mod.nr +++ b/noir_stdlib/src/array/mod.nr @@ -43,10 +43,10 @@ impl [T; N] { /// assert_eq(b, [2, 4, 6]); /// ``` pub fn map(self, f: fn[Env](T) -> U) -> [U; N] { - let first_elem = f(self[0]); - let mut ret = [first_elem; N]; + let uninitialized = crate::mem::zeroed(); + let mut ret = [uninitialized; N]; - for i in 1..self.len() { + for i in 0..self.len() { ret[i] = f(self[i]); } @@ -79,6 +79,8 @@ impl [T; N] { } /// Same as fold, but uses the first element as the starting element. + /// + /// Requires the input array to be non-empty. /// /// Example: /// @@ -217,3 +219,10 @@ impl From> for [u8; N] { s.as_bytes() } } + +mod test { + #[test] + fn map_empty() { + assert_eq([].map(|x| x + 1), []); + } +} From 70dcf4a25dcad10daeb427f0887d3a0bf10c9916 Mon Sep 17 00:00:00 2001 From: Aztec Bot <49558828+AztecBot@users.noreply.github.com> Date: Tue, 22 Oct 2024 07:15:30 -0400 Subject: [PATCH 9/9] feat: Sync from aztec-packages (#6301) Automated pull of Noir development from [aztec-packages](https://github.com/AztecProtocol/aztec-packages). BEGIN_COMMIT_OVERRIDE feat: Sync from noir (https://github.com/AztecProtocol/aztec-packages/pull/9275) chore!: remove pedersen commitment (https://github.com/AztecProtocol/aztec-packages/pull/9107) fix: remove need for duplicate attributes on each function (https://github.com/AztecProtocol/aztec-packages/pull/9244) chore!: remove pedersen hash opcode (https://github.com/AztecProtocol/aztec-packages/pull/9245) feat!: Brillig and AVM default all uninitialized memory cells to Field 0 (https://github.com/AztecProtocol/aztec-packages/pull/9057) feat: Sync from noir (https://github.com/AztecProtocol/aztec-packages/pull/9099) chore: swap `pub` and `unconstrained` in function signatures (https://github.com/AztecProtocol/aztec-packages/pull/9237) chore!: remove keccak256 opcode from ACIR/Brillig (https://github.com/AztecProtocol/aztec-packages/pull/9104) feat!: Brillig with a stack and conditional inlining (https://github.com/AztecProtocol/aztec-packages/pull/8989) feat: Integrate databus in the private kernels (https://github.com/AztecProtocol/aztec-packages/pull/9028) feat: Sync from noir (https://github.com/AztecProtocol/aztec-packages/pull/9034) chore: prove_then_verify_ultra_honk on all existing acir tests (https://github.com/AztecProtocol/aztec-packages/pull/9042) refactor(avm)!: remove CMOV opcode (https://github.com/AztecProtocol/aztec-packages/pull/9030) feat: Sync from noir (https://github.com/AztecProtocol/aztec-packages/pull/8934) END_COMMIT_OVERRIDE --------- Co-authored-by: TomAFrench --- .aztec-sync-commit | 2 +- Cargo.lock | 1 - acvm-repo/acir/codegen/acir.cpp | 462 ++++-------------- .../acir/src/circuit/black_box_functions.rs | 15 - .../opcodes/black_box_function_call.rs | 44 +- acvm-repo/acir/src/lib.rs | 3 +- .../acir/tests/test_program_serialization.rs | 94 ++-- acvm-repo/acvm/src/pwg/blackbox/hash.rs | 2 +- acvm-repo/acvm/src/pwg/blackbox/mod.rs | 20 +- acvm-repo/acvm/src/pwg/blackbox/pedersen.rs | 47 -- acvm-repo/acvm/tests/solver.rs | 170 ++----- acvm-repo/acvm_js/src/black_box_solvers.rs | 6 - acvm-repo/acvm_js/src/lib.rs | 3 +- .../test/browser/black_box_solvers.test.ts | 11 - .../test/node/black_box_solvers.test.ts | 23 - .../test/shared/complex_foreign_call.ts | 16 +- acvm-repo/acvm_js/test/shared/foreign_call.ts | 10 +- .../acvm_js/test/shared/multi_scalar_mul.ts | 6 +- acvm-repo/blackbox_solver/Cargo.toml | 1 - .../src/curve_specific_solver.rs | 25 - acvm-repo/blackbox_solver/src/hash.rs | 6 - acvm-repo/blackbox_solver/src/lib.rs | 4 +- acvm-repo/bn254_blackbox_solver/src/lib.rs | 28 -- acvm-repo/brillig/src/black_box.rs | 17 - acvm-repo/brillig/src/opcodes.rs | 53 +- acvm-repo/brillig_vm/src/black_box.rs | 48 +- acvm-repo/brillig_vm/src/lib.rs | 405 ++++++++------- acvm-repo/brillig_vm/src/memory.rs | 43 +- compiler/noirc_driver/src/lib.rs | 17 +- .../src/brillig/brillig_gen.rs | 2 + .../brillig/brillig_gen/brillig_black_box.rs | 67 +-- .../src/brillig/brillig_gen/brillig_block.rs | 57 +-- .../brillig/brillig_gen/brillig_directive.rs | 48 +- .../brillig/brillig_gen/brillig_slice_ops.rs | 3 +- .../brillig/brillig_gen/variable_liveness.rs | 7 +- .../noirc_evaluator/src/brillig/brillig_ir.rs | 47 +- .../src/brillig/brillig_ir/codegen_calls.rs | 141 +++--- .../brillig_ir/codegen_control_flow.rs | 31 +- .../src/brillig/brillig_ir/codegen_stack.rs | 98 +++- .../src/brillig/brillig_ir/debug_show.rs | 48 +- .../src/brillig/brillig_ir/entry_point.rs | 23 +- .../src/brillig/brillig_ir/instructions.rs | 19 - .../brillig_ir/procedures/array_copy.rs | 12 +- .../brillig_ir/procedures/array_reverse.rs | 8 +- .../procedures/check_max_stack_depth.rs | 30 ++ .../brillig/brillig_ir/procedures/mem_copy.rs | 15 +- .../src/brillig/brillig_ir/procedures/mod.rs | 6 + .../procedures/prepare_vector_insert.rs | 20 +- .../procedures/prepare_vector_push.rs | 16 +- .../brillig_ir/procedures/vector_copy.rs | 8 +- .../brillig_ir/procedures/vector_pop.rs | 16 +- .../brillig_ir/procedures/vector_remove.rs | 16 +- .../src/brillig/brillig_ir/registers.rs | 111 +++-- compiler/noirc_evaluator/src/brillig/mod.rs | 4 +- compiler/noirc_evaluator/src/ssa.rs | 16 +- .../src/ssa/acir_gen/acir_ir/acir_variable.rs | 25 - .../ssa/acir_gen/acir_ir/generated_acir.rs | 32 +- .../noirc_evaluator/src/ssa/acir_gen/mod.rs | 32 +- .../check_for_underconstrained_values.rs | 8 +- .../src/ssa/function_builder/mod.rs | 9 +- .../noirc_evaluator/src/ssa/ir/function.rs | 24 +- .../src/ssa/ir/instruction/call.rs | 7 +- .../src/ssa/ir/instruction/call/blackbox.rs | 14 +- .../noirc_evaluator/src/ssa/opt/array_set.rs | 6 +- .../src/ssa/opt/flatten_cfg.rs | 4 +- .../noirc_evaluator/src/ssa/opt/inlining.rs | 368 +++++++++++--- compiler/noirc_evaluator/src/ssa/opt/rc.rs | 4 +- .../src/ssa/opt/remove_bit_shifts.rs | 2 +- .../src/ssa/opt/remove_enable_side_effects.rs | 2 +- .../src/ssa/opt/remove_if_else.rs | 3 +- .../src/ssa/opt/resolve_is_unconstrained.rs | 2 +- .../src/ssa/opt/runtime_separation.rs | 19 +- .../noirc_evaluator/src/ssa/opt/unrolling.rs | 2 +- .../src/ssa/ssa_gen/context.rs | 2 +- .../noirc_evaluator/src/ssa/ssa_gen/mod.rs | 2 +- .../src/ssa/ssa_gen/program.rs | 2 +- compiler/noirc_frontend/src/ast/function.rs | 1 + .../src/hir/comptime/interpreter/builtin.rs | 25 +- compiler/noirc_frontend/src/lexer/token.rs | 12 + .../src/monomorphization/ast.rs | 7 +- compiler/noirc_frontend/src/tests.rs | 12 +- noir_stdlib/src/collections/umap.nr | 16 +- noir_stdlib/src/field/bn254.nr | 8 +- noir_stdlib/src/field/mod.nr | 21 +- noir_stdlib/src/hash/mod.nr | 37 +- noir_stdlib/src/lib.nr | 4 +- noir_stdlib/src/meta/function_def.nr | 3 + noir_stdlib/src/uint128.nr | 4 +- scripts/install_bb.sh | 2 +- .../check_large_field_bits/src/main.nr | 2 +- .../inline_never_basic/Nargo.toml | 7 + .../inline_never_basic/Prover.toml | 2 + .../inline_never_basic/src/main.nr | 8 + .../unsafe_range_constraint/src/main.nr | 4 +- .../noir_test_success/bounded_vec/src/main.nr | 12 +- tooling/debugger/src/context.rs | 30 +- tooling/debugger/src/repl.rs | 9 +- .../lsp/src/requests/completion/builtins.rs | 4 +- tooling/lsp/src/solver.rs | 16 - tooling/nargo_fmt/tests/input/fn.nr | 6 +- tooling/noir_js/src/index.ts | 2 +- .../noir_js_backend_barretenberg/package.json | 2 +- tooling/profiler/src/opcode_formatter.rs | 6 - yarn.lock | 10 +- 104 files changed, 1455 insertions(+), 1837 deletions(-) delete mode 100644 acvm-repo/acvm/src/pwg/blackbox/pedersen.rs create mode 100644 compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/check_max_stack_depth.rs create mode 100644 test_programs/execution_success/inline_never_basic/Nargo.toml create mode 100644 test_programs/execution_success/inline_never_basic/Prover.toml create mode 100644 test_programs/execution_success/inline_never_basic/src/main.nr diff --git a/.aztec-sync-commit b/.aztec-sync-commit index 258eb260471..b47eb7bdaec 100644 --- a/.aztec-sync-commit +++ b/.aztec-sync-commit @@ -1 +1 @@ -670af8a158633d106a3f1df82dbd28ef9a9e4ceb +ab0c80d7493e6bdbc58dcd517b248de6ddd6fd67 diff --git a/Cargo.lock b/Cargo.lock index 8be1d274678..a24908fd2e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,7 +71,6 @@ dependencies = [ "p256", "proptest", "sha2", - "sha3", "thiserror", ] diff --git a/acvm-repo/acir/codegen/acir.cpp b/acvm-repo/acir/codegen/acir.cpp index 70ad596a93a..637ac2ce201 100644 --- a/acvm-repo/acir/codegen/acir.cpp +++ b/acvm-repo/acir/codegen/acir.cpp @@ -145,12 +145,6 @@ namespace Program { struct IntegerBitSize { - struct U0 { - friend bool operator==(const U0&, const U0&); - std::vector bincodeSerialize() const; - static U0 bincodeDeserialize(std::vector); - }; - struct U1 { friend bool operator==(const U1&, const U1&); std::vector bincodeSerialize() const; @@ -187,7 +181,7 @@ namespace Program { static U128 bincodeDeserialize(std::vector); }; - std::variant value; + std::variant value; friend bool operator==(const IntegerBitSize&, const IntegerBitSize&); std::vector bincodeSerialize() const; @@ -218,7 +212,24 @@ namespace Program { }; struct MemoryAddress { - uint64_t value; + + struct Direct { + uint64_t value; + + friend bool operator==(const Direct&, const Direct&); + std::vector bincodeSerialize() const; + static Direct bincodeDeserialize(std::vector); + }; + + struct Relative { + uint64_t value; + + friend bool operator==(const Relative&, const Relative&); + std::vector bincodeSerialize() const; + static Relative bincodeDeserialize(std::vector); + }; + + std::variant value; friend bool operator==(const MemoryAddress&, const MemoryAddress&); std::vector bincodeSerialize() const; @@ -274,15 +285,6 @@ namespace Program { static Blake3 bincodeDeserialize(std::vector); }; - struct Keccak256 { - Program::HeapVector message; - Program::HeapArray output; - - friend bool operator==(const Keccak256&, const Keccak256&); - std::vector bincodeSerialize() const; - static Keccak256 bincodeDeserialize(std::vector); - }; - struct Keccakf1600 { Program::HeapVector message; Program::HeapArray output; @@ -328,26 +330,6 @@ namespace Program { static SchnorrVerify bincodeDeserialize(std::vector); }; - struct PedersenCommitment { - Program::HeapVector inputs; - Program::MemoryAddress domain_separator; - Program::HeapArray output; - - friend bool operator==(const PedersenCommitment&, const PedersenCommitment&); - std::vector bincodeSerialize() const; - static PedersenCommitment bincodeDeserialize(std::vector); - }; - - struct PedersenHash { - Program::HeapVector inputs; - Program::MemoryAddress domain_separator; - Program::MemoryAddress output; - - friend bool operator==(const PedersenHash&, const PedersenHash&); - std::vector bincodeSerialize() const; - static PedersenHash bincodeDeserialize(std::vector); - }; - struct MultiScalarMul { Program::HeapVector points; Program::HeapVector scalars; @@ -462,7 +444,7 @@ namespace Program { static ToRadix bincodeDeserialize(std::vector); }; - std::variant value; + std::variant value; friend bool operator==(const BlackBoxOp&, const BlackBoxOp&); std::vector bincodeSerialize() const; @@ -848,26 +830,6 @@ namespace Program { static SchnorrVerify bincodeDeserialize(std::vector); }; - struct PedersenCommitment { - std::vector inputs; - uint32_t domain_separator; - std::array outputs; - - friend bool operator==(const PedersenCommitment&, const PedersenCommitment&); - std::vector bincodeSerialize() const; - static PedersenCommitment bincodeDeserialize(std::vector); - }; - - struct PedersenHash { - std::vector inputs; - uint32_t domain_separator; - Program::Witness output; - - friend bool operator==(const PedersenHash&, const PedersenHash&); - std::vector bincodeSerialize() const; - static PedersenHash bincodeDeserialize(std::vector); - }; - struct EcdsaSecp256k1 { std::array public_key_x; std::array public_key_y; @@ -912,16 +874,6 @@ namespace Program { static EmbeddedCurveAdd bincodeDeserialize(std::vector); }; - struct Keccak256 { - std::vector inputs; - Program::FunctionInput var_message_size; - std::array outputs; - - friend bool operator==(const Keccak256&, const Keccak256&); - std::vector bincodeSerialize() const; - static Keccak256 bincodeDeserialize(std::vector); - }; - struct Keccakf1600 { std::array inputs; std::array outputs; @@ -1022,7 +974,7 @@ namespace Program { static Sha256Compression bincodeDeserialize(std::vector); }; - std::variant value; + std::variant value; friend bool operator==(const BlackBoxFuncCall&, const BlackBoxFuncCall&); std::vector bincodeSerialize() const; @@ -2744,94 +2696,6 @@ Program::BlackBoxFuncCall::SchnorrVerify serde::Deserializable BlackBoxFuncCall::PedersenCommitment::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxFuncCall::PedersenCommitment BlackBoxFuncCall::PedersenCommitment::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Program - -template <> -template -void serde::Serializable::serialize(const Program::BlackBoxFuncCall::PedersenCommitment &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.inputs, serializer); - serde::Serializable::serialize(obj.domain_separator, serializer); - serde::Serializable::serialize(obj.outputs, serializer); -} - -template <> -template -Program::BlackBoxFuncCall::PedersenCommitment serde::Deserializable::deserialize(Deserializer &deserializer) { - Program::BlackBoxFuncCall::PedersenCommitment obj; - obj.inputs = serde::Deserializable::deserialize(deserializer); - obj.domain_separator = serde::Deserializable::deserialize(deserializer); - obj.outputs = serde::Deserializable::deserialize(deserializer); - return obj; -} - -namespace Program { - - inline bool operator==(const BlackBoxFuncCall::PedersenHash &lhs, const BlackBoxFuncCall::PedersenHash &rhs) { - if (!(lhs.inputs == rhs.inputs)) { return false; } - if (!(lhs.domain_separator == rhs.domain_separator)) { return false; } - if (!(lhs.output == rhs.output)) { return false; } - return true; - } - - inline std::vector BlackBoxFuncCall::PedersenHash::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxFuncCall::PedersenHash BlackBoxFuncCall::PedersenHash::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Program - -template <> -template -void serde::Serializable::serialize(const Program::BlackBoxFuncCall::PedersenHash &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.inputs, serializer); - serde::Serializable::serialize(obj.domain_separator, serializer); - serde::Serializable::serialize(obj.output, serializer); -} - -template <> -template -Program::BlackBoxFuncCall::PedersenHash serde::Deserializable::deserialize(Deserializer &deserializer) { - Program::BlackBoxFuncCall::PedersenHash obj; - obj.inputs = serde::Deserializable::deserialize(deserializer); - obj.domain_separator = serde::Deserializable::deserialize(deserializer); - obj.output = serde::Deserializable::deserialize(deserializer); - return obj; -} - namespace Program { inline bool operator==(const BlackBoxFuncCall::EcdsaSecp256k1 &lhs, const BlackBoxFuncCall::EcdsaSecp256k1 &rhs) { @@ -3020,50 +2884,6 @@ Program::BlackBoxFuncCall::EmbeddedCurveAdd serde::Deserializable BlackBoxFuncCall::Keccak256::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxFuncCall::Keccak256 BlackBoxFuncCall::Keccak256::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Program - -template <> -template -void serde::Serializable::serialize(const Program::BlackBoxFuncCall::Keccak256 &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.inputs, serializer); - serde::Serializable::serialize(obj.var_message_size, serializer); - serde::Serializable::serialize(obj.outputs, serializer); -} - -template <> -template -Program::BlackBoxFuncCall::Keccak256 serde::Deserializable::deserialize(Deserializer &deserializer) { - Program::BlackBoxFuncCall::Keccak256 obj; - obj.inputs = serde::Deserializable::deserialize(deserializer); - obj.var_message_size = serde::Deserializable::deserialize(deserializer); - obj.outputs = serde::Deserializable::deserialize(deserializer); - return obj; -} - namespace Program { inline bool operator==(const BlackBoxFuncCall::Keccakf1600 &lhs, const BlackBoxFuncCall::Keccakf1600 &rhs) { @@ -3675,47 +3495,6 @@ Program::BlackBoxOp::Blake3 serde::Deserializable:: return obj; } -namespace Program { - - inline bool operator==(const BlackBoxOp::Keccak256 &lhs, const BlackBoxOp::Keccak256 &rhs) { - if (!(lhs.message == rhs.message)) { return false; } - if (!(lhs.output == rhs.output)) { return false; } - return true; - } - - inline std::vector BlackBoxOp::Keccak256::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxOp::Keccak256 BlackBoxOp::Keccak256::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Program - -template <> -template -void serde::Serializable::serialize(const Program::BlackBoxOp::Keccak256 &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.message, serializer); - serde::Serializable::serialize(obj.output, serializer); -} - -template <> -template -Program::BlackBoxOp::Keccak256 serde::Deserializable::deserialize(Deserializer &deserializer) { - Program::BlackBoxOp::Keccak256 obj; - obj.message = serde::Deserializable::deserialize(deserializer); - obj.output = serde::Deserializable::deserialize(deserializer); - return obj; -} - namespace Program { inline bool operator==(const BlackBoxOp::Keccakf1600 &lhs, const BlackBoxOp::Keccakf1600 &rhs) { @@ -3907,94 +3686,6 @@ Program::BlackBoxOp::SchnorrVerify serde::Deserializable BlackBoxOp::PedersenCommitment::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxOp::PedersenCommitment BlackBoxOp::PedersenCommitment::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Program - -template <> -template -void serde::Serializable::serialize(const Program::BlackBoxOp::PedersenCommitment &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.inputs, serializer); - serde::Serializable::serialize(obj.domain_separator, serializer); - serde::Serializable::serialize(obj.output, serializer); -} - -template <> -template -Program::BlackBoxOp::PedersenCommitment serde::Deserializable::deserialize(Deserializer &deserializer) { - Program::BlackBoxOp::PedersenCommitment obj; - obj.inputs = serde::Deserializable::deserialize(deserializer); - obj.domain_separator = serde::Deserializable::deserialize(deserializer); - obj.output = serde::Deserializable::deserialize(deserializer); - return obj; -} - -namespace Program { - - inline bool operator==(const BlackBoxOp::PedersenHash &lhs, const BlackBoxOp::PedersenHash &rhs) { - if (!(lhs.inputs == rhs.inputs)) { return false; } - if (!(lhs.domain_separator == rhs.domain_separator)) { return false; } - if (!(lhs.output == rhs.output)) { return false; } - return true; - } - - inline std::vector BlackBoxOp::PedersenHash::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxOp::PedersenHash BlackBoxOp::PedersenHash::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Program - -template <> -template -void serde::Serializable::serialize(const Program::BlackBoxOp::PedersenHash &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.inputs, serializer); - serde::Serializable::serialize(obj.domain_separator, serializer); - serde::Serializable::serialize(obj.output, serializer); -} - -template <> -template -Program::BlackBoxOp::PedersenHash serde::Deserializable::deserialize(Deserializer &deserializer) { - Program::BlackBoxOp::PedersenHash obj; - obj.inputs = serde::Deserializable::deserialize(deserializer); - obj.domain_separator = serde::Deserializable::deserialize(deserializer); - obj.output = serde::Deserializable::deserialize(deserializer); - return obj; -} - namespace Program { inline bool operator==(const BlackBoxOp::MultiScalarMul &lhs, const BlackBoxOp::MultiScalarMul &rhs) { @@ -6772,41 +6463,6 @@ Program::IntegerBitSize serde::Deserializable::deserial return obj; } -namespace Program { - - inline bool operator==(const IntegerBitSize::U0 &lhs, const IntegerBitSize::U0 &rhs) { - return true; - } - - inline std::vector IntegerBitSize::U0::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline IntegerBitSize::U0 IntegerBitSize::U0::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Program - -template <> -template -void serde::Serializable::serialize(const Program::IntegerBitSize::U0 &obj, Serializer &serializer) { -} - -template <> -template -Program::IntegerBitSize::U0 serde::Deserializable::deserialize(Deserializer &deserializer) { - Program::IntegerBitSize::U0 obj; - return obj; -} - namespace Program { inline bool operator==(const IntegerBitSize::U1 &lhs, const IntegerBitSize::U1 &rhs) { @@ -7107,6 +6763,82 @@ Program::MemoryAddress serde::Deserializable::deserializ return obj; } +namespace Program { + + inline bool operator==(const MemoryAddress::Direct &lhs, const MemoryAddress::Direct &rhs) { + if (!(lhs.value == rhs.value)) { return false; } + return true; + } + + inline std::vector MemoryAddress::Direct::bincodeSerialize() const { + auto serializer = serde::BincodeSerializer(); + serde::Serializable::serialize(*this, serializer); + return std::move(serializer).bytes(); + } + + inline MemoryAddress::Direct MemoryAddress::Direct::bincodeDeserialize(std::vector input) { + auto deserializer = serde::BincodeDeserializer(input); + auto value = serde::Deserializable::deserialize(deserializer); + if (deserializer.get_buffer_offset() < input.size()) { + throw serde::deserialization_error("Some input bytes were not read"); + } + return value; + } + +} // end of namespace Program + +template <> +template +void serde::Serializable::serialize(const Program::MemoryAddress::Direct &obj, Serializer &serializer) { + serde::Serializable::serialize(obj.value, serializer); +} + +template <> +template +Program::MemoryAddress::Direct serde::Deserializable::deserialize(Deserializer &deserializer) { + Program::MemoryAddress::Direct obj; + obj.value = serde::Deserializable::deserialize(deserializer); + return obj; +} + +namespace Program { + + inline bool operator==(const MemoryAddress::Relative &lhs, const MemoryAddress::Relative &rhs) { + if (!(lhs.value == rhs.value)) { return false; } + return true; + } + + inline std::vector MemoryAddress::Relative::bincodeSerialize() const { + auto serializer = serde::BincodeSerializer(); + serde::Serializable::serialize(*this, serializer); + return std::move(serializer).bytes(); + } + + inline MemoryAddress::Relative MemoryAddress::Relative::bincodeDeserialize(std::vector input) { + auto deserializer = serde::BincodeDeserializer(input); + auto value = serde::Deserializable::deserialize(deserializer); + if (deserializer.get_buffer_offset() < input.size()) { + throw serde::deserialization_error("Some input bytes were not read"); + } + return value; + } + +} // end of namespace Program + +template <> +template +void serde::Serializable::serialize(const Program::MemoryAddress::Relative &obj, Serializer &serializer) { + serde::Serializable::serialize(obj.value, serializer); +} + +template <> +template +Program::MemoryAddress::Relative serde::Deserializable::deserialize(Deserializer &deserializer) { + Program::MemoryAddress::Relative obj; + obj.value = serde::Deserializable::deserialize(deserializer); + return obj; +} + namespace Program { inline bool operator==(const Opcode &lhs, const Opcode &rhs) { diff --git a/acvm-repo/acir/src/circuit/black_box_functions.rs b/acvm-repo/acir/src/circuit/black_box_functions.rs index 5c07a61af7e..2e5a94f1c50 100644 --- a/acvm-repo/acir/src/circuit/black_box_functions.rs +++ b/acvm-repo/acir/src/circuit/black_box_functions.rs @@ -76,10 +76,6 @@ pub enum BlackBoxFunc { /// /// [grumpkin]: https://hackmd.io/@aztec-network/ByzgNxBfd#2-Grumpkin---A-curve-on-top-of-BN-254-for-SNARK-efficient-group-operations SchnorrVerify, - /// Will be deprecated - PedersenCommitment, - /// Will be deprecated - PedersenHash, /// Verifies a ECDSA signature over the secp256k1 curve. /// - inputs: /// - x coordinate of public key as 32 bytes @@ -117,11 +113,6 @@ pub enum BlackBoxFunc { /// scalar $a$: `a=low+high*2^{128}`, with `low, high < 2^{128}` MultiScalarMul, - /// Computes the Keccak-256 (Ethereum version) of the inputs. - /// - inputs: Vector of bytes (witness, 8) - /// - outputs: Array of 32 bytes (witness, 8) - Keccak256, - /// Keccak Permutation function of width 1600 /// - inputs: An array of 25 64-bit Keccak lanes that represent a keccak sponge of 1600 bits /// - outputs: The result of a keccak f1600 permutation on the input state. Also an array of 25 Keccak lanes. @@ -216,7 +207,6 @@ impl BlackBoxFunc { BlackBoxFunc::AND => "and", BlackBoxFunc::XOR => "xor", BlackBoxFunc::RANGE => "range", - BlackBoxFunc::Keccak256 => "keccak256", BlackBoxFunc::Keccakf1600 => "keccakf1600", BlackBoxFunc::RecursiveAggregation => "recursive_aggregation", BlackBoxFunc::EcdsaSecp256r1 => "ecdsa_secp256r1", @@ -228,8 +218,6 @@ impl BlackBoxFunc { BlackBoxFunc::BigIntToLeBytes => "bigint_to_le_bytes", BlackBoxFunc::Poseidon2Permutation => "poseidon2_permutation", BlackBoxFunc::Sha256Compression => "sha256_compression", - BlackBoxFunc::PedersenCommitment => "pedersen_commitment", - BlackBoxFunc::PedersenHash => "pedersen_hash", } } @@ -246,7 +234,6 @@ impl BlackBoxFunc { "and" => Some(BlackBoxFunc::AND), "xor" => Some(BlackBoxFunc::XOR), "range" => Some(BlackBoxFunc::RANGE), - "keccak256" => Some(BlackBoxFunc::Keccak256), "keccakf1600" => Some(BlackBoxFunc::Keccakf1600), "recursive_aggregation" => Some(BlackBoxFunc::RecursiveAggregation), "bigint_add" => Some(BlackBoxFunc::BigIntAdd), @@ -257,8 +244,6 @@ impl BlackBoxFunc { "bigint_to_le_bytes" => Some(BlackBoxFunc::BigIntToLeBytes), "poseidon2_permutation" => Some(BlackBoxFunc::Poseidon2Permutation), "sha256_compression" => Some(BlackBoxFunc::Sha256Compression), - "pedersen_commitment" => Some(BlackBoxFunc::PedersenCommitment), - "pedersen_hash" => Some(BlackBoxFunc::PedersenHash), _ => None, } } diff --git a/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs b/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs index 8bb9a680ea9..e06286d179e 100644 --- a/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs +++ b/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs @@ -117,18 +117,6 @@ pub enum BlackBoxFuncCall { message: Vec>, output: Witness, }, - /// Will be deprecated - PedersenCommitment { - inputs: Vec>, - domain_separator: u32, - outputs: (Witness, Witness), - }, - /// Will be deprecated - PedersenHash { - inputs: Vec>, - domain_separator: u32, - output: Witness, - }, EcdsaSecp256k1 { public_key_x: Box<[FunctionInput; 32]>, public_key_y: Box<[FunctionInput; 32]>, @@ -161,15 +149,6 @@ pub enum BlackBoxFuncCall { input2: Box<[FunctionInput; 3]>, outputs: (Witness, Witness, Witness), }, - Keccak256 { - inputs: Vec>, - /// This is the number of bytes to take - /// from the input. Note: if `var_message_size` - /// is more than the number of bytes in the input, - /// then an error is returned. - var_message_size: FunctionInput, - outputs: Box<[Witness; 32]>, - }, Keccakf1600 { inputs: Box<[FunctionInput; 25]>, outputs: Box<[Witness; 25]>, @@ -258,7 +237,6 @@ impl BlackBoxFuncCall { BlackBoxFuncCall::EcdsaSecp256r1 { .. } => BlackBoxFunc::EcdsaSecp256r1, BlackBoxFuncCall::MultiScalarMul { .. } => BlackBoxFunc::MultiScalarMul, BlackBoxFuncCall::EmbeddedCurveAdd { .. } => BlackBoxFunc::EmbeddedCurveAdd, - BlackBoxFuncCall::Keccak256 { .. } => BlackBoxFunc::Keccak256, BlackBoxFuncCall::Keccakf1600 { .. } => BlackBoxFunc::Keccakf1600, BlackBoxFuncCall::RecursiveAggregation { .. } => BlackBoxFunc::RecursiveAggregation, BlackBoxFuncCall::BigIntAdd { .. } => BlackBoxFunc::BigIntAdd, @@ -269,8 +247,6 @@ impl BlackBoxFuncCall { BlackBoxFuncCall::BigIntToLeBytes { .. } => BlackBoxFunc::BigIntToLeBytes, BlackBoxFuncCall::Poseidon2Permutation { .. } => BlackBoxFunc::Poseidon2Permutation, BlackBoxFuncCall::Sha256Compression { .. } => BlackBoxFunc::Sha256Compression, - BlackBoxFuncCall::PedersenCommitment { .. } => BlackBoxFunc::PedersenCommitment, - BlackBoxFuncCall::PedersenHash { .. } => BlackBoxFunc::PedersenHash, } } @@ -284,8 +260,6 @@ impl BlackBoxFuncCall { | BlackBoxFuncCall::Blake2s { inputs, .. } | BlackBoxFuncCall::Blake3 { inputs, .. } | BlackBoxFuncCall::BigIntFromLeBytes { inputs, .. } - | BlackBoxFuncCall::PedersenCommitment { inputs, .. } - | BlackBoxFuncCall::PedersenHash { inputs, .. } | BlackBoxFuncCall::Poseidon2Permutation { inputs, .. } => inputs.to_vec(), BlackBoxFuncCall::Keccakf1600 { inputs, .. } => inputs.to_vec(), @@ -365,11 +339,6 @@ impl BlackBoxFuncCall { inputs.extend(hashed_message.iter().copied()); inputs } - BlackBoxFuncCall::Keccak256 { inputs, var_message_size, .. } => { - let mut inputs = inputs.clone(); - inputs.push(*var_message_size); - inputs - } BlackBoxFuncCall::RecursiveAggregation { verification_key: key, proof, @@ -390,8 +359,7 @@ impl BlackBoxFuncCall { pub fn get_outputs_vec(&self) -> Vec { match self { BlackBoxFuncCall::Blake2s { outputs, .. } - | BlackBoxFuncCall::Blake3 { outputs, .. } - | BlackBoxFuncCall::Keccak256 { outputs, .. } => outputs.to_vec(), + | BlackBoxFuncCall::Blake3 { outputs, .. } => outputs.to_vec(), BlackBoxFuncCall::Keccakf1600 { outputs, .. } => outputs.to_vec(), @@ -404,9 +372,7 @@ impl BlackBoxFuncCall { | BlackBoxFuncCall::XOR { output, .. } | BlackBoxFuncCall::SchnorrVerify { output, .. } | BlackBoxFuncCall::EcdsaSecp256k1 { output, .. } - | BlackBoxFuncCall::PedersenHash { output, .. } | BlackBoxFuncCall::EcdsaSecp256r1 { output, .. } => vec![*output], - BlackBoxFuncCall::PedersenCommitment { outputs, .. } => vec![outputs.0, outputs.1], BlackBoxFuncCall::MultiScalarMul { outputs, .. } | BlackBoxFuncCall::EmbeddedCurveAdd { outputs, .. } => { vec![outputs.0, outputs.1, outputs.2] @@ -479,14 +445,6 @@ fn get_outputs_string(outputs: &[Witness]) -> String { impl std::fmt::Display for BlackBoxFuncCall { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - BlackBoxFuncCall::PedersenCommitment { .. } => { - return write!(f, "BLACKBOX::Deprecated") - } - BlackBoxFuncCall::PedersenHash { .. } => return write!(f, "BLACKBOX::Deprecated"), - _ => (), - } - let uppercase_name = self.name().to_uppercase(); write!(f, "BLACKBOX::{uppercase_name} ")?; // INPUTS diff --git a/acvm-repo/acir/src/lib.rs b/acvm-repo/acir/src/lib.rs index 36331427b9f..f8a31439127 100644 --- a/acvm-repo/acir/src/lib.rs +++ b/acvm-repo/acir/src/lib.rs @@ -35,7 +35,7 @@ mod reflection { use acir_field::FieldElement; use brillig::{ BinaryFieldOp, BinaryIntOp, BitSize, BlackBoxOp, HeapValueType, IntegerBitSize, - Opcode as BrilligOpcode, ValueOrArray, + MemoryAddress, Opcode as BrilligOpcode, ValueOrArray, }; use serde_reflection::{Tracer, TracerConfig}; @@ -84,6 +84,7 @@ mod reflection { tracer.trace_simple_type::>().unwrap(); tracer.trace_simple_type::().unwrap(); tracer.trace_simple_type::().unwrap(); + tracer.trace_simple_type::().unwrap(); let registry = tracer.registry().unwrap(); diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index 6bf5afe52d9..a915cb95d07 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -91,10 +91,10 @@ fn multi_scalar_mul_circuit() { let bytes = Program::serialize_program(&program); let expected_serialization: Vec = vec![ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 141, 11, 10, 0, 32, 8, 67, 43, 181, 15, 221, 255, - 186, 145, 210, 130, 149, 240, 112, 234, 212, 156, 78, 12, 39, 67, 71, 158, 142, 80, 29, 44, - 228, 66, 90, 168, 119, 189, 74, 115, 131, 174, 78, 115, 58, 124, 70, 254, 130, 59, 74, 253, - 68, 255, 255, 221, 39, 54, 29, 134, 27, 102, 193, 0, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 77, 9, 14, 0, 32, 8, 202, 171, 227, 255, 255, 109, + 217, 162, 141, 114, 99, 2, 162, 74, 57, 53, 18, 2, 46, 208, 70, 122, 99, 162, 43, 113, 35, + 239, 102, 157, 230, 1, 94, 19, 45, 209, 145, 11, 202, 43, 238, 56, 249, 133, 254, 255, 187, + 79, 45, 204, 84, 220, 246, 193, 0, 0, 0, ]; assert_eq!(bytes, expected_serialization) @@ -165,25 +165,25 @@ fn simple_brillig_foreign_call() { let brillig_bytecode = BrilligBytecode { bytecode: vec![ brillig::Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(1_usize), }, brillig::Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0_usize), }, brillig::Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, brillig::Opcode::ForeignCall { function: "invert".into(), - destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))], + destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(0))], destination_value_types: vec![HeapValueType::field()], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(0))], input_value_types: vec![HeapValueType::field()], }, brillig::Opcode::Stop { return_data_offset: 0, return_data_size: 1 }, @@ -214,12 +214,12 @@ fn simple_brillig_foreign_call() { let bytes = Program::serialize_program(&program); let expected_serialization: Vec = vec![ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 81, 73, 10, 192, 48, 8, 140, 165, 91, 160, 183, - 126, 196, 254, 160, 159, 233, 161, 151, 30, 74, 200, 251, 19, 136, 130, 132, 196, 75, 28, - 16, 199, 17, 212, 65, 112, 5, 123, 14, 32, 190, 80, 230, 90, 130, 181, 155, 50, 142, 225, - 2, 187, 89, 40, 239, 157, 106, 2, 82, 116, 138, 51, 118, 239, 171, 222, 108, 232, 218, 139, - 125, 198, 179, 113, 83, 188, 29, 57, 86, 226, 239, 23, 159, 63, 104, 63, 238, 213, 45, 237, - 108, 244, 18, 195, 174, 252, 193, 92, 2, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 79, 73, 10, 128, 48, 12, 204, 40, 46, 5, 111, 126, + 36, 254, 192, 207, 120, 240, 226, 65, 196, 247, 91, 48, 129, 80, 218, 122, 48, 3, 33, 147, + 9, 89, 6, 244, 98, 140, 1, 225, 157, 100, 173, 45, 84, 91, 37, 243, 63, 44, 240, 219, 197, + 246, 223, 38, 37, 176, 34, 85, 156, 169, 251, 144, 233, 183, 142, 206, 67, 114, 215, 121, + 63, 15, 84, 135, 222, 157, 98, 244, 194, 247, 227, 222, 206, 11, 31, 19, 165, 186, 164, + 207, 153, 222, 3, 91, 101, 84, 220, 120, 2, 0, 0, ]; assert_eq!(bytes, expected_serialization) @@ -242,55 +242,61 @@ fn complex_brillig_foreign_call() { let brillig_bytecode = BrilligBytecode { bytecode: vec![ brillig::Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(3_usize), }, brillig::Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0_usize), }, brillig::Opcode::CalldataCopy { - destination_address: MemoryAddress(32), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(32), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, brillig::Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), value: FieldElement::from(32_usize), bit_size: BitSize::Integer(IntegerBitSize::U32), }, brillig::Opcode::Const { - destination: MemoryAddress(3), + destination: MemoryAddress::direct(3), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(1_usize), }, brillig::Opcode::Const { - destination: MemoryAddress(4), + destination: MemoryAddress::direct(4), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(3_usize), }, brillig::Opcode::CalldataCopy { - destination_address: MemoryAddress(1), - size_address: MemoryAddress(3), - offset_address: MemoryAddress(4), + destination_address: MemoryAddress::direct(1), + size_address: MemoryAddress::direct(3), + offset_address: MemoryAddress::direct(4), }, // Oracles are named 'foreign calls' in brillig brillig::Opcode::ForeignCall { function: "complex".into(), inputs: vec![ - ValueOrArray::HeapArray(HeapArray { pointer: 0.into(), size: 3 }), - ValueOrArray::MemoryAddress(MemoryAddress::from(1)), + ValueOrArray::HeapArray(HeapArray { + pointer: MemoryAddress::direct(0), + size: 3, + }), + ValueOrArray::MemoryAddress(MemoryAddress::direct(1)), ], input_value_types: vec![ HeapValueType::Array { size: 3, value_types: vec![HeapValueType::field()] }, HeapValueType::field(), ], destinations: vec![ - ValueOrArray::HeapArray(HeapArray { pointer: 0.into(), size: 3 }), - ValueOrArray::MemoryAddress(MemoryAddress::from(35)), - ValueOrArray::MemoryAddress(MemoryAddress::from(36)), + ValueOrArray::HeapArray(HeapArray { + pointer: MemoryAddress::direct(0), + size: 3, + }), + ValueOrArray::MemoryAddress(MemoryAddress::direct(35)), + ValueOrArray::MemoryAddress(MemoryAddress::direct(36)), ], destination_value_types: vec![ HeapValueType::Array { size: 3, value_types: vec![HeapValueType::field()] }, @@ -338,17 +344,17 @@ fn complex_brillig_foreign_call() { let bytes = Program::serialize_program(&program); let expected_serialization: Vec = vec![ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 81, 14, 194, 48, 8, 133, 118, 186, 53, 241, - 207, 11, 152, 232, 1, 58, 189, 128, 119, 49, 254, 105, 244, 211, 227, 59, 50, 154, 49, 214, - 100, 31, 163, 201, 246, 146, 133, 174, 5, 10, 15, 72, 17, 122, 52, 221, 135, 188, 222, 177, - 116, 44, 105, 223, 195, 24, 73, 247, 206, 50, 46, 67, 139, 118, 190, 98, 169, 24, 221, 6, - 98, 244, 5, 98, 4, 81, 255, 21, 214, 219, 178, 46, 166, 252, 249, 204, 252, 84, 208, 207, - 215, 158, 255, 107, 150, 141, 38, 154, 140, 28, 76, 7, 111, 132, 212, 61, 65, 201, 116, 86, - 217, 101, 115, 11, 226, 62, 99, 223, 145, 88, 56, 205, 228, 102, 127, 239, 53, 6, 69, 184, - 97, 78, 109, 96, 127, 37, 106, 81, 11, 126, 100, 103, 17, 14, 48, 116, 213, 227, 243, 254, - 190, 158, 63, 175, 40, 149, 102, 132, 179, 88, 95, 212, 57, 42, 59, 109, 43, 33, 31, 140, - 156, 46, 102, 244, 230, 124, 31, 97, 104, 141, 244, 48, 253, 1, 180, 46, 168, 159, 181, 6, - 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 93, 10, 194, 48, 12, 78, 155, 233, 54, 240, + 205, 11, 8, 122, 128, 76, 47, 176, 187, 136, 111, 138, 62, 122, 124, 45, 75, 88, 23, 139, + 19, 76, 64, 63, 24, 89, 75, 242, 229, 159, 6, 24, 208, 60, 191, 192, 255, 11, 150, 145, + 101, 186, 71, 152, 66, 116, 123, 150, 244, 29, 186, 96, 199, 69, 94, 49, 198, 63, 136, 17, + 29, 98, 132, 172, 255, 63, 216, 111, 203, 190, 152, 214, 15, 11, 251, 83, 193, 176, 95, 75, + 62, 215, 44, 27, 93, 232, 100, 20, 225, 117, 241, 38, 144, 233, 105, 149, 4, 229, 185, 183, + 201, 232, 208, 42, 191, 198, 252, 36, 213, 216, 192, 103, 249, 250, 228, 185, 39, 225, 71, + 23, 126, 234, 132, 191, 114, 234, 83, 173, 234, 149, 231, 146, 251, 93, 193, 56, 129, 199, + 235, 229, 118, 62, 221, 177, 96, 170, 205, 19, 182, 234, 188, 43, 148, 108, 142, 67, 144, + 63, 52, 239, 244, 67, 65, 127, 206, 102, 13, 227, 56, 201, 195, 246, 0, 155, 0, 46, 128, + 245, 6, 0, 0, ]; assert_eq!(bytes, expected_serialization) diff --git a/acvm-repo/acvm/src/pwg/blackbox/hash.rs b/acvm-repo/acvm/src/pwg/blackbox/hash.rs index f177cd071d0..7476b0dc2dc 100644 --- a/acvm-repo/acvm/src/pwg/blackbox/hash.rs +++ b/acvm-repo/acvm/src/pwg/blackbox/hash.rs @@ -49,7 +49,7 @@ fn get_hash_input( // in the message, then we error. if num_bytes_to_take > message_input.len() { return Err(OpcodeResolutionError::BlackBoxFunctionFailed( - acir::BlackBoxFunc::Keccak256, + acir::BlackBoxFunc::Blake2s, format!("the number of bytes to take from the message is more than the number of bytes in the message. {} > {}", num_bytes_to_take, message_input.len()), )); } diff --git a/acvm-repo/acvm/src/pwg/blackbox/mod.rs b/acvm-repo/acvm/src/pwg/blackbox/mod.rs index 1cca14cc680..c3b1627ba65 100644 --- a/acvm-repo/acvm/src/pwg/blackbox/mod.rs +++ b/acvm-repo/acvm/src/pwg/blackbox/mod.rs @@ -3,7 +3,7 @@ use acir::{ native_types::{Witness, WitnessMap}, AcirField, }; -use acvm_blackbox_solver::{blake2s, blake3, keccak256, keccakf1600}; +use acvm_blackbox_solver::{blake2s, blake3, keccakf1600}; use self::{ aes128::solve_aes128_encryption_opcode, bigint::AcvmBigIntSolver, @@ -18,7 +18,6 @@ pub(crate) mod bigint; mod embedded_curve_ops; mod hash; mod logic; -mod pedersen; mod range; mod signature; pub(crate) mod utils; @@ -27,7 +26,6 @@ use embedded_curve_ops::{embedded_curve_add, multi_scalar_mul}; // Hash functions should eventually be exposed for external consumers. use hash::{solve_generic_256_hash_opcode, solve_sha_256_permutation_opcode}; use logic::{and, xor}; -use pedersen::{pedersen, pedersen_hash}; pub(crate) use range::solve_range_opcode; use signature::{ ecdsa::{secp256k1_prehashed, secp256r1_prehashed}, @@ -90,16 +88,6 @@ pub(crate) fn solve( BlackBoxFuncCall::Blake3 { inputs, outputs } => { solve_generic_256_hash_opcode(initial_witness, inputs, None, outputs, blake3) } - - BlackBoxFuncCall::Keccak256 { inputs, var_message_size, outputs } => { - solve_generic_256_hash_opcode( - initial_witness, - inputs, - Some(var_message_size), - outputs, - keccak256, - ) - } BlackBoxFuncCall::Keccakf1600 { inputs, outputs } => { let mut state = [0; 25]; for (it, input) in state.iter_mut().zip(inputs.as_ref()) { @@ -130,12 +118,6 @@ pub(crate) fn solve( message, *output, ), - BlackBoxFuncCall::PedersenCommitment { inputs, domain_separator, outputs } => { - pedersen(backend, initial_witness, inputs, *domain_separator, *outputs) - } - BlackBoxFuncCall::PedersenHash { inputs, domain_separator, output } => { - pedersen_hash(backend, initial_witness, inputs, *domain_separator, *output) - } BlackBoxFuncCall::EcdsaSecp256k1 { public_key_x, public_key_y, diff --git a/acvm-repo/acvm/src/pwg/blackbox/pedersen.rs b/acvm-repo/acvm/src/pwg/blackbox/pedersen.rs deleted file mode 100644 index 654814bf92d..00000000000 --- a/acvm-repo/acvm/src/pwg/blackbox/pedersen.rs +++ /dev/null @@ -1,47 +0,0 @@ -use acir::{ - circuit::opcodes::FunctionInput, - native_types::{Witness, WitnessMap}, - AcirField, -}; - -use crate::{ - pwg::{input_to_value, insert_value, OpcodeResolutionError}, - BlackBoxFunctionSolver, -}; - -pub(super) fn pedersen( - backend: &impl BlackBoxFunctionSolver, - initial_witness: &mut WitnessMap, - inputs: &[FunctionInput], - domain_separator: u32, - outputs: (Witness, Witness), -) -> Result<(), OpcodeResolutionError> { - let scalars: Result, _> = - inputs.iter().map(|input| input_to_value(initial_witness, *input, false)).collect(); - let scalars: Vec<_> = scalars?.into_iter().collect(); - - let (res_x, res_y) = backend.pedersen_commitment(&scalars, domain_separator)?; - - insert_value(&outputs.0, res_x, initial_witness)?; - insert_value(&outputs.1, res_y, initial_witness)?; - - Ok(()) -} - -pub(super) fn pedersen_hash( - backend: &impl BlackBoxFunctionSolver, - initial_witness: &mut WitnessMap, - inputs: &[FunctionInput], - domain_separator: u32, - output: Witness, -) -> Result<(), OpcodeResolutionError> { - let scalars: Result, _> = - inputs.iter().map(|input| input_to_value(initial_witness, *input, false)).collect(); - let scalars: Vec<_> = scalars?.into_iter().collect(); - - let res = backend.pedersen_hash(&scalars, domain_separator)?; - - insert_value(&output, res, initial_witness)?; - - Ok(()) -} diff --git a/acvm-repo/acvm/tests/solver.rs b/acvm-repo/acvm/tests/solver.rs index 6ad52999820..efa8de289e5 100644 --- a/acvm-repo/acvm/tests/solver.rs +++ b/acvm-repo/acvm/tests/solver.rs @@ -79,9 +79,9 @@ fn inversion_brillig_oracle_equivalence() { let equal_opcode = BrilligOpcode::BinaryFieldOp { op: BinaryFieldOp::Equals, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(2), }; let opcodes = vec![ @@ -125,27 +125,27 @@ fn inversion_brillig_oracle_equivalence() { let brillig_bytecode = BrilligBytecode { bytecode: vec![ BrilligOpcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(2u64), }, BrilligOpcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, equal_opcode, // Oracles are named 'foreign calls' in brillig BrilligOpcode::ForeignCall { function: "invert".into(), - destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(1))], + destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(1))], destination_value_types: vec![HeapValueType::field()], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(0))], input_value_types: vec![HeapValueType::field()], }, BrilligOpcode::Stop { return_data_offset: 0, return_data_size: 3 }, @@ -218,9 +218,9 @@ fn double_inversion_brillig_oracle() { let equal_opcode = BrilligOpcode::BinaryFieldOp { op: BinaryFieldOp::Equals, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(4), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(4), }; let opcodes = vec![ @@ -271,34 +271,34 @@ fn double_inversion_brillig_oracle() { let brillig_bytecode = BrilligBytecode { bytecode: vec![ BrilligOpcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(3u64), }, BrilligOpcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, equal_opcode, // Oracles are named 'foreign calls' in brillig BrilligOpcode::ForeignCall { function: "invert".into(), - destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(1))], + destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(1))], destination_value_types: vec![HeapValueType::field()], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(0))], input_value_types: vec![HeapValueType::field()], }, BrilligOpcode::ForeignCall { function: "invert".into(), - destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(3))], + destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(3))], destination_value_types: vec![HeapValueType::field()], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(2))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(2))], input_value_types: vec![HeapValueType::field()], }, BrilligOpcode::Stop { return_data_offset: 0, return_data_size: 5 }, @@ -389,32 +389,32 @@ fn oracle_dependent_execution() { let brillig_bytecode = BrilligBytecode { bytecode: vec![ BrilligOpcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(3u64), }, BrilligOpcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, // Oracles are named 'foreign calls' in brillig BrilligOpcode::ForeignCall { function: "invert".into(), - destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(1))], + destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(1))], destination_value_types: vec![HeapValueType::field()], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(0))], input_value_types: vec![HeapValueType::field()], }, BrilligOpcode::ForeignCall { function: "invert".into(), - destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(3))], + destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(3))], destination_value_types: vec![HeapValueType::field()], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(2))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(2))], input_value_types: vec![HeapValueType::field()], }, BrilligOpcode::Stop { return_data_offset: 0, return_data_size: 4 }, @@ -522,35 +522,35 @@ fn brillig_oracle_predicate() { let equal_opcode = BrilligOpcode::BinaryFieldOp { op: BinaryFieldOp::Equals, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(2), }; let brillig_bytecode = BrilligBytecode { bytecode: vec![ BrilligOpcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(2u64), }, BrilligOpcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, equal_opcode, // Oracles are named 'foreign calls' in brillig BrilligOpcode::ForeignCall { function: "invert".into(), - destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(1))], + destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(1))], destination_value_types: vec![HeapValueType::field()], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(0))], input_value_types: vec![HeapValueType::field()], }, ], @@ -649,23 +649,23 @@ fn unsatisfied_opcode_resolved_brillig() { let w_result = Witness(6); let calldata_copy_opcode = BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }; let equal_opcode = BrilligOpcode::BinaryFieldOp { op: BinaryFieldOp::Equals, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(2), }; // Jump pass the trap if the values are equal, else // jump to the trap let location_of_stop = 3; let jmp_if_opcode = - BrilligOpcode::JumpIf { condition: MemoryAddress::from(2), location: location_of_stop }; + BrilligOpcode::JumpIf { condition: MemoryAddress::direct(2), location: location_of_stop }; let trap_opcode = BrilligOpcode::Trap { revert_data: HeapArray::default() }; let stop_opcode = BrilligOpcode::Stop { return_data_offset: 0, return_data_size: 0 }; @@ -673,12 +673,12 @@ fn unsatisfied_opcode_resolved_brillig() { let brillig_bytecode = BrilligBytecode { bytecode: vec![ BrilligOpcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(2u64), }, BrilligOpcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, @@ -1099,45 +1099,6 @@ fn blake3_op( }) } -// variable inputs -// 32 outputs -fn keccak256_op( - function_inputs_and_outputs: (Vec>, Vec), -) -> Result, OpcodeResolutionError> { - let (function_inputs, outputs) = function_inputs_and_outputs; - let function_inputs_len = function_inputs.len(); - Ok(BlackBoxFuncCall::Keccak256 { - inputs: function_inputs, - var_message_size: FunctionInput::constant( - function_inputs_len.into(), - FieldElement::max_num_bits(), - )?, - outputs: outputs.try_into().expect("Keccak256 returns 32 outputs"), - }) -} - -// var_message_size is the number of bytes to take -// from the input. Note: if `var_message_size` -// is more than the number of bytes in the input, -// then an error is returned. -// -// variable inputs -// 32 outputs -fn keccak256_invalid_message_size_op( - function_inputs_and_outputs: (Vec>, Vec), -) -> Result, OpcodeResolutionError> { - let (function_inputs, outputs) = function_inputs_and_outputs; - let function_inputs_len = function_inputs.len(); - Ok(BlackBoxFuncCall::Keccak256 { - inputs: function_inputs, - var_message_size: FunctionInput::constant( - (function_inputs_len - 1).into(), - FieldElement::max_num_bits(), - )?, - outputs: outputs.try_into().expect("Keccak256 returns 32 outputs"), - }) -} - // 25 inputs // 25 outputs fn keccakf1600_op( @@ -1489,19 +1450,6 @@ fn blake3_zeros() { assert_eq!(results, Ok(expected_results)); } -#[test] -fn keccak256_zeros() { - let results = solve_array_input_blackbox_call(vec![], 32, None, keccak256_op); - let expected_results: Vec<_> = vec![ - 197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, - 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112, - ] - .into_iter() - .map(|x: u128| FieldElement::from(x)) - .collect(); - assert_eq!(results, Ok(expected_results)); -} - #[test] fn keccakf1600_zeros() { let results = solve_array_input_blackbox_call( @@ -1642,24 +1590,6 @@ proptest! { prop_assert!(result, "{}", message); } - #[test] - fn keccak256_injective(inputs_distinct_inputs in any_distinct_inputs(Some(8), 0, 32)) { - let (inputs, distinct_inputs) = inputs_distinct_inputs; - let (result, message) = prop_assert_injective(inputs, distinct_inputs, 32, Some(8), keccak256_op); - prop_assert!(result, "{}", message); - } - - // TODO(https://github.com/noir-lang/noir/issues/5689): doesn't fail with a user error - // The test failing with "not injective" demonstrates that it returns constant output instead - // of failing with a user error. - #[test] - #[should_panic(expected = "Test failed: not injective")] - fn keccak256_invalid_message_size_fails(inputs_distinct_inputs in any_distinct_inputs(Some(8), 0, 32)) { - let (inputs, distinct_inputs) = inputs_distinct_inputs; - let (result, message) = prop_assert_injective(inputs, distinct_inputs, 32, Some(8), keccak256_invalid_message_size_op); - prop_assert!(result, "{}", message); - } - #[test] fn keccakf1600_injective(inputs_distinct_inputs in any_distinct_inputs(Some(8), 25, 25)) { let (inputs, distinct_inputs) = inputs_distinct_inputs; diff --git a/acvm-repo/acvm_js/src/black_box_solvers.rs b/acvm-repo/acvm_js/src/black_box_solvers.rs index 6046d52943c..0e35851ee78 100644 --- a/acvm-repo/acvm_js/src/black_box_solvers.rs +++ b/acvm-repo/acvm_js/src/black_box_solvers.rs @@ -37,12 +37,6 @@ pub fn blake2s256(inputs: &[u8]) -> Vec { acvm::blackbox_solver::blake2s(inputs).unwrap().into() } -/// Calculates the Keccak256 hash of the input bytes -#[wasm_bindgen] -pub fn keccak256(inputs: &[u8]) -> Vec { - acvm::blackbox_solver::keccak256(inputs).unwrap().into() -} - /// Verifies a ECDSA signature over the secp256k1 curve. #[wasm_bindgen] pub fn ecdsa_secp256k1_verify( diff --git a/acvm-repo/acvm_js/src/lib.rs b/acvm-repo/acvm_js/src/lib.rs index 8fe64afbba9..e2468e6d939 100644 --- a/acvm-repo/acvm_js/src/lib.rs +++ b/acvm-repo/acvm_js/src/lib.rs @@ -17,8 +17,7 @@ mod logging; mod public_witness; pub use black_box_solvers::{ - and, blake2s256, ecdsa_secp256k1_verify, ecdsa_secp256r1_verify, keccak256, sha256_compression, - xor, + and, blake2s256, ecdsa_secp256k1_verify, ecdsa_secp256r1_verify, sha256_compression, xor, }; pub use build_info::build_info; pub use compression::{ diff --git a/acvm-repo/acvm_js/test/browser/black_box_solvers.test.ts b/acvm-repo/acvm_js/test/browser/black_box_solvers.test.ts index 9dc5be2c682..b99fe9e3d88 100644 --- a/acvm-repo/acvm_js/test/browser/black_box_solvers.test.ts +++ b/acvm-repo/acvm_js/test/browser/black_box_solvers.test.ts @@ -4,7 +4,6 @@ import initACVM, { blake2s256, ecdsa_secp256k1_verify, ecdsa_secp256r1_verify, - keccak256, sha256_compression, xor, } from '@noir-lang/acvm_js'; @@ -51,16 +50,6 @@ it('successfully calculates the blake2s256 hash', async () => { } }); -it('successfully calculates the keccak256 hash', async () => { - const { keccak256_test_cases } = await import('../shared/black_box_solvers'); - - for (const testCase of keccak256_test_cases) { - const [preimage, expectedResult] = testCase; - const hash = keccak256(preimage); - hash.forEach((value, index) => expect(value).to.be.eq(expectedResult.at(index))); - } -}); - it('successfully verifies secp256k1 ECDSA signatures', async () => { const { ecdsa_secp256k1_test_cases } = await import('../shared/black_box_solvers'); diff --git a/acvm-repo/acvm_js/test/node/black_box_solvers.test.ts b/acvm-repo/acvm_js/test/node/black_box_solvers.test.ts index fc998ced5a5..74553f6b692 100644 --- a/acvm-repo/acvm_js/test/node/black_box_solvers.test.ts +++ b/acvm-repo/acvm_js/test/node/black_box_solvers.test.ts @@ -4,7 +4,6 @@ import { blake2s256, ecdsa_secp256k1_verify, ecdsa_secp256r1_verify, - keccak256, sha256_compression, xor, } from '@noir-lang/acvm_js'; @@ -47,28 +46,6 @@ it('successfully calculates the blake2s256 hash', async () => { } }); -it('successfully calculates the keccak256 hash', async () => { - const { keccak256_test_cases } = await import('../shared/black_box_solvers'); - - for (const testCase of keccak256_test_cases) { - const [preimage, expectedResult] = testCase; - const hash = keccak256(preimage); - hash.forEach((value, index) => expect(value).to.be.eq(expectedResult.at(index))); - } -}); - -// it("successfully calculates the hash_to_field_128_security field", async () => { -// const { hash_to_field_128_security_test_cases } = await import( -// "../shared/black_box_solvers" -// ); - -// for (const testCase of hash_to_field_128_security_test_cases) { -// const [preimage, expectedResult] = testCase; -// const hashField = hash_to_field_128_security(preimage); -// expect(hashField).to.be.eq(expectedResult); -// } -// }); - it('successfully verifies secp256k1 ECDSA signatures', async () => { const { ecdsa_secp256k1_test_cases } = await import('../shared/black_box_solvers'); diff --git a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts index 60e4c8d5829..8eb7b7d5059 100644 --- a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts @@ -2,14 +2,14 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `complex_brillig_foreign_call` 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, 85, 81, 14, 194, 48, 8, 133, 118, 186, 53, 241, 207, 11, 152, 232, 1, 58, 189, - 128, 119, 49, 254, 105, 244, 211, 227, 59, 50, 154, 49, 214, 100, 31, 163, 201, 246, 146, 133, 174, 5, 10, 15, 72, 17, - 122, 52, 221, 135, 188, 222, 177, 116, 44, 105, 223, 195, 24, 73, 247, 206, 50, 46, 67, 139, 118, 190, 98, 169, 24, - 221, 6, 98, 244, 5, 98, 4, 81, 255, 21, 214, 219, 178, 46, 166, 252, 249, 204, 252, 84, 208, 207, 215, 158, 255, 107, - 150, 141, 38, 154, 140, 28, 76, 7, 111, 132, 212, 61, 65, 201, 116, 86, 217, 101, 115, 11, 226, 62, 99, 223, 145, 88, - 56, 205, 228, 102, 127, 239, 53, 6, 69, 184, 97, 78, 109, 96, 127, 37, 106, 81, 11, 126, 100, 103, 17, 14, 48, 116, - 213, 227, 243, 254, 190, 158, 63, 175, 40, 149, 102, 132, 179, 88, 95, 212, 57, 42, 59, 109, 43, 33, 31, 140, 156, 46, - 102, 244, 230, 124, 31, 97, 104, 141, 244, 48, 253, 1, 180, 46, 168, 159, 181, 6, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 93, 10, 194, 48, 12, 78, 155, 233, 54, 240, 205, 11, 8, 122, 128, 76, 47, + 176, 187, 136, 111, 138, 62, 122, 124, 45, 75, 88, 23, 139, 19, 76, 64, 63, 24, 89, 75, 242, 229, 159, 6, 24, 208, 60, + 191, 192, 255, 11, 150, 145, 101, 186, 71, 152, 66, 116, 123, 150, 244, 29, 186, 96, 199, 69, 94, 49, 198, 63, 136, + 17, 29, 98, 132, 172, 255, 63, 216, 111, 203, 190, 152, 214, 15, 11, 251, 83, 193, 176, 95, 75, 62, 215, 44, 27, 93, + 232, 100, 20, 225, 117, 241, 38, 144, 233, 105, 149, 4, 229, 185, 183, 201, 232, 208, 42, 191, 198, 252, 36, 213, 216, + 192, 103, 249, 250, 228, 185, 39, 225, 71, 23, 126, 234, 132, 191, 114, 234, 83, 173, 234, 149, 231, 146, 251, 93, + 193, 56, 129, 199, 235, 229, 118, 62, 221, 177, 96, 170, 205, 19, 182, 234, 188, 43, 148, 108, 142, 67, 144, 63, 52, + 239, 244, 67, 65, 127, 206, 102, 13, 227, 56, 201, 195, 246, 0, 155, 0, 46, 128, 245, 6, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/foreign_call.ts b/acvm-repo/acvm_js/test/shared/foreign_call.ts index 9bf57535c87..dc3c6f23f6f 100644 --- a/acvm-repo/acvm_js/test/shared/foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/foreign_call.ts @@ -2,11 +2,11 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `simple_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 81, 73, 10, 192, 48, 8, 140, 165, 91, 160, 183, 126, 196, 254, 160, 159, 233, - 161, 151, 30, 74, 200, 251, 19, 136, 130, 132, 196, 75, 28, 16, 199, 17, 212, 65, 112, 5, 123, 14, 32, 190, 80, 230, - 90, 130, 181, 155, 50, 142, 225, 2, 187, 89, 40, 239, 157, 106, 2, 82, 116, 138, 51, 118, 239, 171, 222, 108, 232, - 218, 139, 125, 198, 179, 113, 83, 188, 29, 57, 86, 226, 239, 23, 159, 63, 104, 63, 238, 213, 45, 237, 108, 244, 18, - 195, 174, 252, 193, 92, 2, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 79, 73, 10, 128, 48, 12, 204, 40, 46, 5, 111, 126, 36, 254, 192, 207, 120, + 240, 226, 65, 196, 247, 91, 48, 129, 80, 218, 122, 48, 3, 33, 147, 9, 89, 6, 244, 98, 140, 1, 225, 157, 100, 173, 45, + 84, 91, 37, 243, 63, 44, 240, 219, 197, 246, 223, 38, 37, 176, 34, 85, 156, 169, 251, 144, 233, 183, 142, 206, 67, + 114, 215, 121, 63, 15, 84, 135, 222, 157, 98, 244, 194, 247, 227, 222, 206, 11, 31, 19, 165, 186, 164, 207, 153, 222, + 3, 91, 101, 84, 220, 120, 2, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000005'], diff --git a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts index f23847a75fc..239d5473606 100644 --- a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts +++ b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts @@ -1,8 +1,8 @@ // See `multi_scalar_mul_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, 93, 141, 11, 10, 0, 32, 8, 67, 43, 181, 15, 221, 255, 186, 145, 210, 130, 149, 240, - 112, 234, 212, 156, 78, 12, 39, 67, 71, 158, 142, 80, 29, 44, 228, 66, 90, 168, 119, 189, 74, 115, 131, 174, 78, 115, - 58, 124, 70, 254, 130, 59, 74, 253, 68, 255, 255, 221, 39, 54, 29, 134, 27, 102, 193, 0, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 77, 9, 14, 0, 32, 8, 202, 171, 227, 255, 255, 109, 217, 162, 141, 114, 99, 2, + 162, 74, 57, 53, 18, 2, 46, 208, 70, 122, 99, 162, 43, 113, 35, 239, 102, 157, 230, 1, 94, 19, 45, 209, 145, 11, 202, + 43, 238, 56, 249, 133, 254, 255, 187, 79, 45, 204, 84, 220, 246, 193, 0, 0, 0, ]); export const initialWitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/blackbox_solver/Cargo.toml b/acvm-repo/blackbox_solver/Cargo.toml index b57c9356198..d99240c5a24 100644 --- a/acvm-repo/blackbox_solver/Cargo.toml +++ b/acvm-repo/blackbox_solver/Cargo.toml @@ -23,7 +23,6 @@ num-bigint = "0.4" blake2 = "0.10.6" blake3 = "1.5.0" sha2.workspace = true -sha3.workspace = true keccak = "0.1.4" k256 = { version = "0.11.0", features = [ "ecdsa", diff --git a/acvm-repo/blackbox_solver/src/curve_specific_solver.rs b/acvm-repo/blackbox_solver/src/curve_specific_solver.rs index f729a5033fb..869017f52ee 100644 --- a/acvm-repo/blackbox_solver/src/curve_specific_solver.rs +++ b/acvm-repo/blackbox_solver/src/curve_specific_solver.rs @@ -14,16 +14,6 @@ pub trait BlackBoxFunctionSolver { signature: &[u8; 64], message: &[u8], ) -> Result; - fn pedersen_commitment( - &self, - inputs: &[F], - domain_separator: u32, - ) -> Result<(F, F), BlackBoxResolutionError>; - fn pedersen_hash( - &self, - inputs: &[F], - domain_separator: u32, - ) -> Result; fn multi_scalar_mul( &self, points: &[F], @@ -67,21 +57,6 @@ impl BlackBoxFunctionSolver for StubbedBlackBoxSolver { ) -> Result { Err(Self::fail(BlackBoxFunc::SchnorrVerify)) } - fn pedersen_commitment( - &self, - _inputs: &[F], - _domain_separator: u32, - ) -> Result<(F, F), BlackBoxResolutionError> { - Err(Self::fail(BlackBoxFunc::PedersenCommitment)) - } - fn pedersen_hash( - &self, - _inputs: &[F], - _domain_separator: u32, - ) -> Result { - Err(Self::fail(BlackBoxFunc::PedersenHash)) - } - fn multi_scalar_mul( &self, _points: &[F], diff --git a/acvm-repo/blackbox_solver/src/hash.rs b/acvm-repo/blackbox_solver/src/hash.rs index af503117466..660a1fb0e5d 100644 --- a/acvm-repo/blackbox_solver/src/hash.rs +++ b/acvm-repo/blackbox_solver/src/hash.rs @@ -1,7 +1,6 @@ use acir::BlackBoxFunc; use blake2::digest::generic_array::GenericArray; use blake2::{Blake2s256, Digest}; -use sha3::Keccak256; use crate::BlackBoxResolutionError; @@ -22,11 +21,6 @@ pub fn blake3(inputs: &[u8]) -> Result<[u8; 32], BlackBoxResolutionError> { Ok(blake3::hash(inputs).into()) } -pub fn keccak256(inputs: &[u8]) -> Result<[u8; 32], BlackBoxResolutionError> { - generic_hash_256::(inputs) - .map_err(|err| BlackBoxResolutionError::Failed(BlackBoxFunc::Keccak256, err)) -} - pub fn sha256_compression(state: &mut [u32; 8], msg_blocks: &[u32; 16]) { let mut blocks = [0_u8; 64]; for (i, block) in msg_blocks.iter().enumerate() { diff --git a/acvm-repo/blackbox_solver/src/lib.rs b/acvm-repo/blackbox_solver/src/lib.rs index 87ca539f435..d8f926fcb4b 100644 --- a/acvm-repo/blackbox_solver/src/lib.rs +++ b/acvm-repo/blackbox_solver/src/lib.rs @@ -5,7 +5,7 @@ //! This crate provides the implementation of BlackBox functions of ACIR and Brillig. //! For functions that are backend-dependent, it provides a Trait [BlackBoxFunctionSolver] that must be implemented by the backend. -//! For functions that have a reference implementation, such as [keccak256], this crate exports the reference implementation directly. +//! For functions that have a reference implementation, such as [keccakf1600], this crate exports the reference implementation directly. use acir::BlackBoxFunc; use thiserror::Error; @@ -21,7 +21,7 @@ pub use aes128::aes128_encrypt; pub use bigint::BigIntSolver; pub use curve_specific_solver::{BlackBoxFunctionSolver, StubbedBlackBoxSolver}; pub use ecdsa::{ecdsa_secp256k1_verify, ecdsa_secp256r1_verify}; -pub use hash::{blake2s, blake3, keccak256, keccakf1600, sha256_compression}; +pub use hash::{blake2s, blake3, keccakf1600, sha256_compression}; pub use logic::{bit_and, bit_xor}; #[derive(Clone, PartialEq, Eq, Debug, Error)] diff --git a/acvm-repo/bn254_blackbox_solver/src/lib.rs b/acvm-repo/bn254_blackbox_solver/src/lib.rs index 952c4498d84..d74c17a52b5 100644 --- a/acvm-repo/bn254_blackbox_solver/src/lib.rs +++ b/acvm-repo/bn254_blackbox_solver/src/lib.rs @@ -10,7 +10,6 @@ mod pedersen; mod poseidon2; mod schnorr; -use ark_ec::AffineRepr; pub use embedded_curve_ops::{embedded_curve_add, multi_scalar_mul}; pub use generator::generators::derive_generators; pub use poseidon2::{ @@ -44,33 +43,6 @@ impl BlackBoxFunctionSolver for Bn254BlackBoxSolver { )) } - fn pedersen_commitment( - &self, - inputs: &[FieldElement], - domain_separator: u32, - ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { - let inputs: Vec = inputs.iter().map(|input| input.into_repr()).collect(); - let result = pedersen::commitment::commit_native_with_index(&inputs, domain_separator); - let result = if let Some((x, y)) = result.xy() { - (FieldElement::from_repr(*x), FieldElement::from_repr(*y)) - } else { - (FieldElement::from(0_u128), FieldElement::from(0_u128)) - }; - - Ok(result) - } - - fn pedersen_hash( - &self, - inputs: &[FieldElement], - domain_separator: u32, - ) -> Result { - let inputs: Vec = inputs.iter().map(|input| input.into_repr()).collect(); - let result = pedersen::hash::hash_with_index(&inputs, domain_separator); - let result = FieldElement::from_repr(result); - Ok(result) - } - fn multi_scalar_mul( &self, points: &[FieldElement], diff --git a/acvm-repo/brillig/src/black_box.rs b/acvm-repo/brillig/src/black_box.rs index 534ef7d318e..b61c2272587 100644 --- a/acvm-repo/brillig/src/black_box.rs +++ b/acvm-repo/brillig/src/black_box.rs @@ -22,11 +22,6 @@ pub enum BlackBoxOp { message: HeapVector, output: HeapArray, }, - /// Calculates the Keccak256 hash of the inputs. - Keccak256 { - message: HeapVector, - output: HeapArray, - }, /// Keccak Permutation function of 1600 width Keccakf1600 { message: HeapVector, @@ -56,18 +51,6 @@ pub enum BlackBoxOp { signature: HeapVector, result: MemoryAddress, }, - /// Will be deprecated - PedersenCommitment { - inputs: HeapVector, - domain_separator: MemoryAddress, - output: HeapArray, - }, - /// Will be deprecated - PedersenHash { - inputs: HeapVector, - domain_separator: MemoryAddress, - output: MemoryAddress, - }, /// Performs multi scalar multiplication over the embedded curve. MultiScalarMul { points: HeapVector, diff --git a/acvm-repo/brillig/src/opcodes.rs b/acvm-repo/brillig/src/opcodes.rs index 45df2aca2d8..69ca9ed379a 100644 --- a/acvm-repo/brillig/src/opcodes.rs +++ b/acvm-repo/brillig/src/opcodes.rs @@ -5,18 +5,53 @@ use serde::{Deserialize, Serialize}; pub type Label = usize; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] -pub struct MemoryAddress(pub usize); +pub enum MemoryAddress { + Direct(usize), + Relative(usize), +} /// `MemoryAddress` refers to the index in VM memory. impl MemoryAddress { + pub fn direct(address: usize) -> Self { + MemoryAddress::Direct(address) + } + pub fn relative(offset: usize) -> Self { + MemoryAddress::Relative(offset) + } + + pub fn unwrap_direct(self) -> usize { + match self { + MemoryAddress::Direct(address) => address, + MemoryAddress::Relative(_) => panic!("Expected direct memory address"), + } + } + + pub fn unwrap_relative(self) -> usize { + match self { + MemoryAddress::Direct(_) => panic!("Expected relative memory address"), + MemoryAddress::Relative(offset) => offset, + } + } + pub fn to_usize(self) -> usize { - self.0 + match self { + MemoryAddress::Direct(address) => address, + MemoryAddress::Relative(offset) => offset, + } + } + + pub fn is_relative(&self) -> bool { + match self { + MemoryAddress::Relative(_) => true, + MemoryAddress::Direct(_) => false, + } } -} -impl From for MemoryAddress { - fn from(value: usize) -> Self { - MemoryAddress(value) + pub fn offset(&self, amount: usize) -> Self { + match self { + MemoryAddress::Direct(address) => MemoryAddress::Direct(address + amount), + MemoryAddress::Relative(offset) => MemoryAddress::Relative(offset + amount), + } } } @@ -54,7 +89,7 @@ pub struct HeapArray { impl Default for HeapArray { fn default() -> Self { - Self { pointer: MemoryAddress(0), size: 0 } + Self { pointer: MemoryAddress::direct(0), size: 0 } } } @@ -67,7 +102,6 @@ pub struct HeapVector { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Copy, PartialOrd, Ord)] pub enum IntegerBitSize { - U0, // Uninitialized U1, U8, U16, @@ -79,7 +113,6 @@ pub enum IntegerBitSize { impl From for u32 { fn from(bit_size: IntegerBitSize) -> u32 { match bit_size { - IntegerBitSize::U0 => 0, IntegerBitSize::U1 => 1, IntegerBitSize::U8 => 8, IntegerBitSize::U16 => 16, @@ -95,7 +128,6 @@ impl TryFrom for IntegerBitSize { fn try_from(value: u32) -> Result { match value { - 0 => Ok(IntegerBitSize::U0), 1 => Ok(IntegerBitSize::U1), 8 => Ok(IntegerBitSize::U8), 16 => Ok(IntegerBitSize::U16), @@ -110,7 +142,6 @@ impl TryFrom for IntegerBitSize { impl std::fmt::Display for IntegerBitSize { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - IntegerBitSize::U0 => write!(f, "null"), IntegerBitSize::U1 => write!(f, "bool"), IntegerBitSize::U8 => write!(f, "u8"), IntegerBitSize::U16 => write!(f, "u16"), diff --git a/acvm-repo/brillig_vm/src/black_box.rs b/acvm-repo/brillig_vm/src/black_box.rs index 56f715c13a9..4201d2ddba2 100644 --- a/acvm-repo/brillig_vm/src/black_box.rs +++ b/acvm-repo/brillig_vm/src/black_box.rs @@ -2,8 +2,8 @@ use acir::brillig::{BlackBoxOp, HeapArray, HeapVector, IntegerBitSize}; use acir::{AcirField, BlackBoxFunc}; use acvm_blackbox_solver::BigIntSolver; use acvm_blackbox_solver::{ - aes128_encrypt, blake2s, blake3, ecdsa_secp256k1_verify, ecdsa_secp256r1_verify, keccak256, - keccakf1600, sha256_compression, BlackBoxFunctionSolver, BlackBoxResolutionError, + aes128_encrypt, blake2s, blake3, ecdsa_secp256k1_verify, ecdsa_secp256r1_verify, keccakf1600, + sha256_compression, BlackBoxFunctionSolver, BlackBoxResolutionError, }; use num_bigint::BigUint; use num_traits::Zero; @@ -77,12 +77,6 @@ pub(crate) fn evaluate_black_box memory.write_slice(memory.read_ref(output.pointer), &to_value_vec(&bytes)); Ok(()) } - BlackBoxOp::Keccak256 { message, output } => { - let message = to_u8_vec(read_heap_vector(memory, message)); - let bytes = keccak256(message.as_slice())?; - memory.write_slice(memory.read_ref(output.pointer), &to_value_vec(&bytes)); - Ok(()) - } BlackBoxOp::Keccakf1600 { message, output } => { let state_vec: Vec = read_heap_vector(memory, message) .iter() @@ -227,41 +221,6 @@ pub(crate) fn evaluate_black_box ); Ok(()) } - BlackBoxOp::PedersenCommitment { inputs, domain_separator, output } => { - let inputs: Vec = read_heap_vector(memory, inputs) - .iter() - .map(|x| *x.extract_field().unwrap()) - .collect(); - let domain_separator: u32 = - memory.read(*domain_separator).try_into().map_err(|_| { - BlackBoxResolutionError::Failed( - BlackBoxFunc::PedersenCommitment, - "Invalid separator length".to_string(), - ) - })?; - let (x, y) = solver.pedersen_commitment(&inputs, domain_separator)?; - memory.write_slice( - memory.read_ref(output.pointer), - &[MemoryValue::new_field(x), MemoryValue::new_field(y)], - ); - Ok(()) - } - BlackBoxOp::PedersenHash { inputs, domain_separator, output } => { - let inputs: Vec = read_heap_vector(memory, inputs) - .iter() - .map(|x| *x.extract_field().unwrap()) - .collect(); - let domain_separator: u32 = - memory.read(*domain_separator).try_into().map_err(|_| { - BlackBoxResolutionError::Failed( - BlackBoxFunc::PedersenCommitment, - "Invalid separator length".to_string(), - ) - })?; - let hash = solver.pedersen_hash(&inputs, domain_separator)?; - memory.write(*output, MemoryValue::new_field(hash)); - Ok(()) - } BlackBoxOp::BigIntAdd { lhs, rhs, output } => { let lhs = memory.read(*lhs).try_into().unwrap(); let rhs = memory.read(*rhs).try_into().unwrap(); @@ -447,7 +406,6 @@ fn black_box_function_from_op(op: &BlackBoxOp) -> BlackBoxFunc { BlackBoxOp::AES128Encrypt { .. } => BlackBoxFunc::AES128Encrypt, BlackBoxOp::Blake2s { .. } => BlackBoxFunc::Blake2s, BlackBoxOp::Blake3 { .. } => BlackBoxFunc::Blake3, - BlackBoxOp::Keccak256 { .. } => BlackBoxFunc::Keccak256, BlackBoxOp::Keccakf1600 { .. } => BlackBoxFunc::Keccakf1600, BlackBoxOp::EcdsaSecp256k1 { .. } => BlackBoxFunc::EcdsaSecp256k1, BlackBoxOp::EcdsaSecp256r1 { .. } => BlackBoxFunc::EcdsaSecp256r1, @@ -463,7 +421,5 @@ fn black_box_function_from_op(op: &BlackBoxOp) -> BlackBoxFunc { BlackBoxOp::Poseidon2Permutation { .. } => BlackBoxFunc::Poseidon2Permutation, BlackBoxOp::Sha256Compression { .. } => BlackBoxFunc::Sha256Compression, BlackBoxOp::ToRadix { .. } => unreachable!("ToRadix is not an ACIR BlackBoxFunc"), - BlackBoxOp::PedersenCommitment { .. } => BlackBoxFunc::PedersenCommitment, - BlackBoxOp::PedersenHash { .. } => BlackBoxFunc::PedersenHash, } } diff --git a/acvm-repo/brillig_vm/src/lib.rs b/acvm-repo/brillig_vm/src/lib.rs index 07d0ea02ad4..1e5ad84eb8f 100644 --- a/acvm-repo/brillig_vm/src/lib.rs +++ b/acvm-repo/brillig_vm/src/lib.rs @@ -185,7 +185,7 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver> VM<'a, F, B> { } pub fn write_memory_at(&mut self, ptr: usize, value: MemoryValue) { - self.memory.write(MemoryAddress(ptr), value); + self.memory.write(MemoryAddress::direct(ptr), value); } /// Returns the VM's current call stack, including the actual program @@ -315,7 +315,10 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver> VM<'a, F, B> { } Opcode::Trap { revert_data } => { if revert_data.size > 0 { - self.trap(self.memory.read_ref(revert_data.pointer).0, revert_data.size) + self.trap( + self.memory.read_ref(revert_data.pointer).unwrap_direct(), + revert_data.size, + ) } else { self.trap(0, 0) } @@ -437,6 +440,7 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver> VM<'a, F, B> { size: usize, value_types: &[HeapValueType], ) -> Vec> { + assert!(!start.is_relative(), "read_slice_of_values_from_memory requires direct addresses"); if HeapValueType::all_simple(value_types) { self.memory.read_slice(start, size).to_vec() } else { @@ -449,20 +453,25 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver> VM<'a, F, B> { (0..size) .zip(value_types.iter().cycle()) .flat_map(|(i, value_type)| { - let value_address: MemoryAddress = (start.to_usize() + i).into(); + let value_address = start.offset(i); match value_type { HeapValueType::Simple(_) => { vec![self.memory.read(value_address)] } HeapValueType::Array { value_types, size } => { let array_address = self.memory.read_ref(value_address); - let items_start = MemoryAddress(array_address.to_usize() + 1); - self.read_slice_of_values_from_memory(items_start, *size, value_types) + + self.read_slice_of_values_from_memory( + array_address.offset(1), + *size, + value_types, + ) } HeapValueType::Vector { value_types } => { let vector_address = self.memory.read_ref(value_address); - let size_address = MemoryAddress(vector_address.to_usize() + 1); - let items_start = MemoryAddress(vector_address.to_usize() + 2); + let size_address = + MemoryAddress::direct(vector_address.unwrap_direct() + 1); + let items_start = vector_address.offset(2); let vector_size = self.memory.read(size_address).to_usize(); self.read_slice_of_values_from_memory( items_start, @@ -630,13 +639,17 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver> VM<'a, F, B> { values: &Vec, values_idx: &mut usize, value_type: &HeapValueType, - ) -> Result { + ) -> Result<(), String> { + assert!( + !destination.is_relative(), + "write_slice_of_values_to_memory requires direct addresses" + ); let mut current_pointer = destination; match value_type { HeapValueType::Simple(bit_size) => { self.write_value_to_memory(destination, &values[*values_idx], *bit_size)?; *values_idx += 1; - Ok(MemoryAddress(destination.to_usize() + 1)) + Ok(()) } HeapValueType::Array { value_types, size } => { for _ in 0..*size { @@ -649,18 +662,17 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver> VM<'a, F, B> { *len, )?; *values_idx += 1; - current_pointer = MemoryAddress(current_pointer.to_usize() + 1); + current_pointer = current_pointer.offset(1); } HeapValueType::Array { .. } => { - let destination = - MemoryAddress(self.memory.read_ref(current_pointer).0 + 1); + let destination = self.memory.read_ref(current_pointer).offset(1); self.write_slice_of_values_to_memory( destination, values, values_idx, typ, )?; - current_pointer = MemoryAddress(current_pointer.to_usize() + 1); + current_pointer = current_pointer.offset(1); } HeapValueType::Vector { .. } => { return Err(format!( @@ -671,7 +683,7 @@ impl<'a, F: AcirField, B: BlackBoxFunctionSolver> VM<'a, F, B> { } } } - Ok(current_pointer) + Ok(()) } HeapValueType::Vector { .. } => { Err(format!("Unsupported returned type in foreign calls {:?}", value_type)) @@ -795,7 +807,7 @@ mod tests { let calldata = vec![]; let opcodes = [Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(27u128), }]; @@ -809,7 +821,7 @@ mod tests { // The address at index `2` should have the value of 3 since we had an // add opcode let VM { memory, .. } = vm; - let output_value = memory.read(MemoryAddress::from(0)); + let output_value = memory.read(MemoryAddress::direct(0)); assert_eq!(output_value.to_field(), FieldElement::from(27u128)); } @@ -820,31 +832,31 @@ mod tests { let lhs = { calldata.push(2u128.into()); - MemoryAddress::from(calldata.len() - 1) + MemoryAddress::direct(calldata.len() - 1) }; let rhs = { calldata.push(2u128.into()); - MemoryAddress::from(calldata.len() - 1) + MemoryAddress::direct(calldata.len() - 1) }; - let destination = MemoryAddress::from(calldata.len()); + let destination = MemoryAddress::direct(calldata.len()); let opcodes = vec![ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(2u64), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, Opcode::BinaryFieldOp { destination, op: BinaryFieldOp::Equals, lhs, rhs }, Opcode::Jump { location: 5 }, @@ -878,34 +890,34 @@ mod tests { let opcodes = vec![ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(2u64), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, Opcode::Jump { location: 5 }, Opcode::Trap { revert_data: HeapArray::default() }, Opcode::BinaryFieldOp { op: BinaryFieldOp::Equals, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(2), }, - Opcode::JumpIfNot { condition: MemoryAddress::from(2), location: 4 }, + Opcode::JumpIfNot { condition: MemoryAddress::direct(2), location: 4 }, Opcode::BinaryFieldOp { op: BinaryFieldOp::Add, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(2), }, ]; @@ -922,7 +934,7 @@ mod tests { let status = vm.process_opcode(); assert_eq!(status, VMStatus::InProgress); - let output_cmp_value = vm.memory.read(MemoryAddress::from(2)); + let output_cmp_value = vm.memory.read(MemoryAddress::direct(2)); assert_eq!(output_cmp_value.to_field(), false.into()); let status = vm.process_opcode(); @@ -939,7 +951,7 @@ mod tests { // The address at index `2` should have not changed as we jumped over the add opcode let VM { memory, .. } = vm; - let output_value = memory.read(MemoryAddress::from(2)); + let output_value = memory.read(MemoryAddress::direct(2)); assert_eq!(output_value.to_field(), false.into()); } @@ -949,23 +961,23 @@ mod tests { let opcodes = &[ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(1u64), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, Opcode::Cast { - destination: MemoryAddress::from(1), - source: MemoryAddress::from(0), + destination: MemoryAddress::direct(1), + source: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U8), }, Opcode::Stop { return_data_offset: 1, return_data_size: 1 }, @@ -985,7 +997,7 @@ mod tests { let VM { memory, .. } = vm; - let casted_value = memory.read(MemoryAddress::from(1)); + let casted_value = memory.read(MemoryAddress::direct(1)); assert_eq!(casted_value.to_field(), (2_u128.pow(8) - 1).into()); } @@ -995,28 +1007,28 @@ mod tests { let opcodes = &[ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(1u64), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, Opcode::Cast { - destination: MemoryAddress::from(1), - source: MemoryAddress::from(0), + destination: MemoryAddress::direct(1), + source: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U128), }, Opcode::Not { - destination: MemoryAddress::from(1), - source: MemoryAddress::from(1), + destination: MemoryAddress::direct(1), + source: MemoryAddress::direct(1), bit_size: IntegerBitSize::U128, }, Opcode::Stop { return_data_offset: 1, return_data_size: 1 }, @@ -1039,7 +1051,7 @@ mod tests { let VM { memory, .. } = vm; let (negated_value, _) = memory - .read(MemoryAddress::from(1)) + .read(MemoryAddress::direct(1)) .extract_integer() .expect("Expected integer as the output of Not"); assert_eq!(negated_value, !1_u128); @@ -1051,21 +1063,21 @@ mod tests { let opcodes = &[ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(3u64), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, - Opcode::Mov { destination: MemoryAddress::from(2), source: MemoryAddress::from(0) }, + Opcode::Mov { destination: MemoryAddress::direct(2), source: MemoryAddress::direct(0) }, ]; let mut vm = VM::new(calldata, opcodes, vec![], &StubbedBlackBoxSolver); @@ -1081,10 +1093,10 @@ mod tests { let VM { memory, .. } = vm; - let destination_value = memory.read(MemoryAddress::from(2)); + let destination_value = memory.read(MemoryAddress::direct(2)); assert_eq!(destination_value.to_field(), (1u128).into()); - let source_value = memory.read(MemoryAddress::from(0)); + let source_value = memory.read(MemoryAddress::direct(0)); assert_eq!(source_value.to_field(), (1u128).into()); } @@ -1095,41 +1107,41 @@ mod tests { let opcodes = &[ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(4u64), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, Opcode::Cast { - destination: MemoryAddress::from(0), - source: MemoryAddress::from(0), + destination: MemoryAddress::direct(0), + source: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U1), }, Opcode::Cast { - destination: MemoryAddress::from(1), - source: MemoryAddress::from(1), + destination: MemoryAddress::direct(1), + source: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U1), }, Opcode::ConditionalMov { - destination: MemoryAddress(4), // Sets 3_u128 to memory address 4 - source_a: MemoryAddress(2), - source_b: MemoryAddress(3), - condition: MemoryAddress(0), + destination: MemoryAddress::direct(4), // Sets 3_u128 to memory address 4 + source_a: MemoryAddress::direct(2), + source_b: MemoryAddress::direct(3), + condition: MemoryAddress::direct(0), }, Opcode::ConditionalMov { - destination: MemoryAddress(5), // Sets 2_u128 to memory address 5 - source_a: MemoryAddress(2), - source_b: MemoryAddress(3), - condition: MemoryAddress(1), + destination: MemoryAddress::direct(5), // Sets 2_u128 to memory address 5 + source_a: MemoryAddress::direct(2), + source_b: MemoryAddress::direct(3), + condition: MemoryAddress::direct(1), }, ]; let mut vm = VM::new(calldata, opcodes, vec![], &StubbedBlackBoxSolver); @@ -1151,10 +1163,10 @@ mod tests { let VM { memory, .. } = vm; - let destination_value = memory.read(MemoryAddress::from(4)); + let destination_value = memory.read(MemoryAddress::direct(4)); assert_eq!(destination_value.to_field(), (3_u128).into()); - let source_value = memory.read(MemoryAddress::from(5)); + let source_value = memory.read(MemoryAddress::direct(5)); assert_eq!(source_value.to_field(), (2_u128).into()); } @@ -1167,26 +1179,26 @@ mod tests { let calldata_copy_opcodes = vec![ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(5u64), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, ]; let cast_opcodes: Vec<_> = (0..calldata_size) .map(|index| Opcode::Cast { - destination: MemoryAddress::from(index), - source: MemoryAddress::from(index), + destination: MemoryAddress::direct(index), + source: MemoryAddress::direct(index), bit_size: BitSize::Integer(bit_size), }) .collect(); @@ -1194,33 +1206,33 @@ mod tests { let equal_opcode = Opcode::BinaryIntOp { bit_size, op: BinaryIntOp::Equals, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(2), }; let not_equal_opcode = Opcode::BinaryIntOp { bit_size, op: BinaryIntOp::Equals, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(3), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(3), + destination: MemoryAddress::direct(2), }; let less_than_opcode = Opcode::BinaryIntOp { bit_size, op: BinaryIntOp::LessThan, - lhs: MemoryAddress::from(3), - rhs: MemoryAddress::from(4), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(3), + rhs: MemoryAddress::direct(4), + destination: MemoryAddress::direct(2), }; let less_than_equal_opcode = Opcode::BinaryIntOp { bit_size, op: BinaryIntOp::LessThanEquals, - lhs: MemoryAddress::from(3), - rhs: MemoryAddress::from(4), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(3), + rhs: MemoryAddress::direct(4), + destination: MemoryAddress::direct(2), }; let opcodes: Vec<_> = calldata_copy_opcodes @@ -1247,25 +1259,25 @@ mod tests { let status = vm.process_opcode(); assert_eq!(status, VMStatus::InProgress); - let output_eq_value = vm.memory.read(MemoryAddress::from(2)); + let output_eq_value = vm.memory.read(MemoryAddress::direct(2)); assert_eq!(output_eq_value, true.into()); let status = vm.process_opcode(); assert_eq!(status, VMStatus::InProgress); - let output_neq_value = vm.memory.read(MemoryAddress::from(2)); + let output_neq_value = vm.memory.read(MemoryAddress::direct(2)); assert_eq!(output_neq_value, false.into()); let status = vm.process_opcode(); assert_eq!(status, VMStatus::InProgress); - let lt_value = vm.memory.read(MemoryAddress::from(2)); + let lt_value = vm.memory.read(MemoryAddress::direct(2)); assert_eq!(lt_value, true.into()); let status = vm.process_opcode(); assert_eq!(status, VMStatus::Finished { return_data_offset: 0, return_data_size: 0 }); - let lte_value = vm.memory.read(MemoryAddress::from(2)); + let lte_value = vm.memory.read(MemoryAddress::direct(2)); assert_eq!(lte_value, true.into()); } @@ -1281,10 +1293,10 @@ mod tests { fn brillig_write_memory(item_count: usize) -> Vec> { let integer_bit_size = MEMORY_ADDRESSING_BIT_SIZE; let bit_size = BitSize::Integer(integer_bit_size); - let r_i = MemoryAddress::from(0); - let r_len = MemoryAddress::from(1); - let r_tmp = MemoryAddress::from(2); - let r_pointer = MemoryAddress::from(3); + let r_i = MemoryAddress::direct(0); + let r_len = MemoryAddress::direct(1); + let r_tmp = MemoryAddress::direct(2); + let r_pointer = MemoryAddress::direct(3); let start: [Opcode; 3] = [ // i = 0 @@ -1346,12 +1358,12 @@ mod tests { fn iconst_opcode() { let opcodes = &[ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(MEMORY_ADDRESSING_BIT_SIZE), value: FieldElement::from(8_usize), }, Opcode::IndirectConst { - destination_pointer: MemoryAddress(0), + destination_pointer: MemoryAddress::direct(0), bit_size: BitSize::Integer(MEMORY_ADDRESSING_BIT_SIZE), value: FieldElement::from(27_usize), }, @@ -1366,7 +1378,7 @@ mod tests { let VM { memory, .. } = vm; - let destination_value = memory.read(MemoryAddress::from(8)); + let destination_value = memory.read(MemoryAddress::direct(8)); assert_eq!(destination_value.to_field(), (27_usize).into()); } @@ -1382,11 +1394,11 @@ mod tests { /// } fn brillig_sum_memory(memory: Vec) -> FieldElement { let bit_size = IntegerBitSize::U32; - let r_i = MemoryAddress::from(0); - let r_len = MemoryAddress::from(1); - let r_sum = MemoryAddress::from(2); - let r_tmp = MemoryAddress::from(3); - let r_pointer = MemoryAddress::from(4); + let r_i = MemoryAddress::direct(0); + let r_len = MemoryAddress::direct(1); + let r_sum = MemoryAddress::direct(2); + let r_tmp = MemoryAddress::direct(3); + let r_pointer = MemoryAddress::direct(4); let start = [ // sum = 0 @@ -1410,19 +1422,19 @@ mod tests { bit_size: BitSize::Integer(bit_size), }, Opcode::Const { - destination: MemoryAddress(100), + destination: MemoryAddress::direct(100), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(memory.len() as u32), }, Opcode::Const { - destination: MemoryAddress(101), + destination: MemoryAddress::direct(101), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(5), - size_address: MemoryAddress(100), - offset_address: MemoryAddress(101), + destination_address: MemoryAddress::direct(5), + size_address: MemoryAddress::direct(100), + offset_address: MemoryAddress::direct(101), }, ]; let loop_body = [ @@ -1501,10 +1513,10 @@ mod tests { fn brillig_recursive_write_memory(size: usize) -> Vec> { let integer_bit_size = MEMORY_ADDRESSING_BIT_SIZE; let bit_size = BitSize::Integer(integer_bit_size); - let r_i = MemoryAddress::from(0); - let r_len = MemoryAddress::from(1); - let r_tmp = MemoryAddress::from(2); - let r_pointer = MemoryAddress::from(3); + let r_i = MemoryAddress::direct(0); + let r_len = MemoryAddress::direct(1); + let r_tmp = MemoryAddress::direct(2); + let r_pointer = MemoryAddress::direct(3); let start: [Opcode; 5] = [ // i = 0 @@ -1598,8 +1610,8 @@ mod tests { #[test] fn foreign_call_opcode_simple_result() { - let r_input = MemoryAddress::from(0); - let r_result = MemoryAddress::from(1); + let r_input = MemoryAddress::direct(0); + let r_result = MemoryAddress::direct(1); let double_program = vec![ // Load input address with value 5 @@ -1654,8 +1666,8 @@ mod tests { #[test] fn foreign_call_opcode_memory_result() { - let r_input = MemoryAddress::from(0); - let r_output = MemoryAddress::from(1); + let r_input = MemoryAddress::direct(0); + let r_output = MemoryAddress::direct(1); // Define a simple 2x2 matrix in memory let initial_matrix: Vec = @@ -1667,19 +1679,19 @@ mod tests { let invert_program = vec![ Opcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(initial_matrix.len() as u32), }, Opcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(2), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(2), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, // input = 0 Opcode::Const { @@ -1736,7 +1748,7 @@ mod tests { assert_eq!(vm.status, VMStatus::Finished { return_data_offset: 0, return_data_size: 0 }); // Check result in memory - let result_values = vm.memory.read_slice(MemoryAddress(2), 4).to_vec(); + let result_values = vm.memory.read_slice(MemoryAddress::direct(2), 4).to_vec(); assert_eq!( result_values.into_iter().map(|mem_value| mem_value.to_field()).collect::>(), expected_result @@ -1749,11 +1761,11 @@ mod tests { /// Calling a simple foreign call function that takes any string input, concatenates it with itself, and reverses the concatenation #[test] fn foreign_call_opcode_vector_input_and_output() { - let r_input_pointer = MemoryAddress::from(0); - let r_input_size = MemoryAddress::from(1); + let r_input_pointer = MemoryAddress::direct(0); + let r_input_size = MemoryAddress::direct(1); // We need to pass a location of appropriate size - let r_output_pointer = MemoryAddress::from(2); - let r_output_size = MemoryAddress::from(3); + let r_output_pointer = MemoryAddress::direct(2); + let r_output_size = MemoryAddress::direct(3); // Our first string to use the identity function with let input_string: Vec = @@ -1767,19 +1779,19 @@ mod tests { // First call: let string_double_program = vec![ Opcode::Const { - destination: MemoryAddress(100), + destination: MemoryAddress::direct(100), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(input_string.len() as u32), }, Opcode::Const { - destination: MemoryAddress(101), + destination: MemoryAddress::direct(101), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(4), - size_address: MemoryAddress(100), - offset_address: MemoryAddress(101), + destination_address: MemoryAddress::direct(4), + size_address: MemoryAddress::direct(100), + offset_address: MemoryAddress::direct(101), }, // input_pointer = 4 Opcode::Const { @@ -1850,7 +1862,7 @@ mod tests { // Check result in memory let result_values: Vec<_> = vm .memory - .read_slice(MemoryAddress(4 + input_string.len()), output_string.len()) + .read_slice(MemoryAddress::direct(4 + input_string.len()), output_string.len()) .iter() .map(|mem_val| mem_val.clone().to_field()) .collect(); @@ -1862,8 +1874,8 @@ mod tests { #[test] fn foreign_call_opcode_memory_alloc_result() { - let r_input = MemoryAddress::from(0); - let r_output = MemoryAddress::from(1); + let r_input = MemoryAddress::direct(0); + let r_output = MemoryAddress::direct(1); // Define a simple 2x2 matrix in memory let initial_matrix: Vec = @@ -1875,19 +1887,19 @@ mod tests { let invert_program = vec![ Opcode::Const { - destination: MemoryAddress(100), + destination: MemoryAddress::direct(100), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(initial_matrix.len() as u32), }, Opcode::Const { - destination: MemoryAddress(101), + destination: MemoryAddress::direct(101), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(2), - size_address: MemoryAddress(100), - offset_address: MemoryAddress(101), + destination_address: MemoryAddress::direct(2), + size_address: MemoryAddress::direct(100), + offset_address: MemoryAddress::direct(101), }, // input = 0 Opcode::Const { @@ -1946,7 +1958,7 @@ mod tests { // Check initial memory still in place let initial_values: Vec<_> = vm .memory - .read_slice(MemoryAddress(2), 4) + .read_slice(MemoryAddress::direct(2), 4) .iter() .map(|mem_val| mem_val.clone().to_field()) .collect(); @@ -1955,7 +1967,7 @@ mod tests { // Check result in memory let result_values: Vec<_> = vm .memory - .read_slice(MemoryAddress(6), 4) + .read_slice(MemoryAddress::direct(6), 4) .iter() .map(|mem_val| mem_val.clone().to_field()) .collect(); @@ -1967,9 +1979,9 @@ mod tests { #[test] fn foreign_call_opcode_multiple_array_inputs_result() { - let r_input_a = MemoryAddress::from(0); - let r_input_b = MemoryAddress::from(1); - let r_output = MemoryAddress::from(2); + let r_input_a = MemoryAddress::direct(0); + let r_input_b = MemoryAddress::direct(1); + let r_output = MemoryAddress::direct(2); // Define a simple 2x2 matrix in memory let matrix_a: Vec = @@ -1984,19 +1996,19 @@ mod tests { let matrix_mul_program = vec![ Opcode::Const { - destination: MemoryAddress(100), + destination: MemoryAddress::direct(100), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(matrix_a.len() + matrix_b.len()), }, Opcode::Const { - destination: MemoryAddress(101), + destination: MemoryAddress::direct(101), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(3), - size_address: MemoryAddress(100), - offset_address: MemoryAddress(101), + destination_address: MemoryAddress::direct(3), + size_address: MemoryAddress::direct(100), + offset_address: MemoryAddress::direct(101), }, // input = 3 Opcode::Const { @@ -2068,7 +2080,7 @@ mod tests { // Check result in memory let result_values: Vec<_> = vm .memory - .read_slice(MemoryAddress(0), 4) + .read_slice(MemoryAddress::direct(0), 4) .iter() .map(|mem_val| mem_val.clone().to_field()) .collect(); @@ -2135,30 +2147,30 @@ mod tests { // memory address of the end of the above data structures let r_ptr = memory.len(); - let r_input = MemoryAddress::from(r_ptr); - let r_output = MemoryAddress::from(r_ptr + 1); + let r_input = MemoryAddress::direct(r_ptr); + let r_output = MemoryAddress::direct(r_ptr + 1); let program: Vec<_> = vec![ Opcode::Const { - destination: MemoryAddress(100), + destination: MemoryAddress::direct(100), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(memory.len()), }, Opcode::Const { - destination: MemoryAddress(101), + destination: MemoryAddress::direct(101), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, Opcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(100), - offset_address: MemoryAddress(101), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(100), + offset_address: MemoryAddress::direct(101), }, ] .into_iter() .chain(memory.iter().enumerate().map(|(index, mem_value)| Opcode::Cast { - destination: MemoryAddress(index), - source: MemoryAddress(index), + destination: MemoryAddress::direct(index), + source: MemoryAddress::direct(index), bit_size: mem_value.bit_size(), })) .chain(vec![ @@ -2227,4 +2239,49 @@ mod tests { // Ensure the foreign call counter has been incremented assert_eq!(vm.foreign_call_counter, 1); } + + #[test] + fn relative_addressing() { + let calldata = vec![]; + let bit_size = BitSize::Integer(IntegerBitSize::U32); + let value = FieldElement::from(3u128); + + let opcodes = [ + Opcode::Const { + destination: MemoryAddress::direct(0), + bit_size, + value: FieldElement::from(27u128), + }, + Opcode::Const { + destination: MemoryAddress::relative(1), // Resolved address 28 value 3 + bit_size, + value, + }, + Opcode::Const { + destination: MemoryAddress::direct(1), // Address 1 value 3 + bit_size, + value, + }, + Opcode::BinaryIntOp { + destination: MemoryAddress::direct(1), + op: BinaryIntOp::Equals, + bit_size: IntegerBitSize::U32, + lhs: MemoryAddress::direct(1), + rhs: MemoryAddress::direct(28), + }, + ]; + + let mut vm = VM::new(calldata, &opcodes, vec![], &StubbedBlackBoxSolver); + + vm.process_opcode(); + vm.process_opcode(); + vm.process_opcode(); + let status = vm.process_opcode(); + assert_eq!(status, VMStatus::Finished { return_data_offset: 0, return_data_size: 0 }); + + let VM { memory, .. } = vm; + let output_value = memory.read(MemoryAddress::direct(1)); + + assert_eq!(output_value.to_field(), FieldElement::from(1u128)); + } } diff --git a/acvm-repo/brillig_vm/src/memory.rs b/acvm-repo/brillig_vm/src/memory.rs index ef1e0301387..2bf45f77b54 100644 --- a/acvm-repo/brillig_vm/src/memory.rs +++ b/acvm-repo/brillig_vm/src/memory.rs @@ -136,7 +136,7 @@ impl std::fmt::Display for MemoryValue { impl Default for MemoryValue { fn default() -> Self { - MemoryValue::new_integer(0, IntegerBitSize::U0) + MemoryValue::new_field(F::zero()) } } @@ -233,13 +233,25 @@ pub struct Memory { } impl Memory { - /// Gets the value at pointer - pub fn read(&self, ptr: MemoryAddress) -> MemoryValue { - self.inner.get(ptr.to_usize()).copied().unwrap_or_default() + fn get_stack_pointer(&self) -> usize { + self.read(MemoryAddress::Direct(0)).to_usize() + } + + fn resolve(&self, address: MemoryAddress) -> usize { + match address { + MemoryAddress::Direct(address) => address, + MemoryAddress::Relative(offset) => self.get_stack_pointer() + offset, + } + } + + /// Gets the value at address + pub fn read(&self, address: MemoryAddress) -> MemoryValue { + let resolved_addr = self.resolve(address); + self.inner.get(resolved_addr).copied().unwrap_or_default() } pub fn read_ref(&self, ptr: MemoryAddress) -> MemoryAddress { - MemoryAddress(self.read(ptr).to_usize()) + MemoryAddress::direct(self.read(ptr).to_usize()) } pub fn read_slice(&self, addr: MemoryAddress, len: usize) -> &[MemoryValue] { @@ -249,13 +261,15 @@ impl Memory { if len == 0 { return &[]; } - &self.inner[addr.to_usize()..(addr.to_usize() + len)] + let resolved_addr = self.resolve(addr); + &self.inner[resolved_addr..(resolved_addr + len)] } - /// Sets the value at pointer `ptr` to `value` - pub fn write(&mut self, ptr: MemoryAddress, value: MemoryValue) { - self.resize_to_fit(ptr.to_usize() + 1); - self.inner[ptr.to_usize()] = value; + /// Sets the value at `address` to `value` + pub fn write(&mut self, address: MemoryAddress, value: MemoryValue) { + let resolved_ptr = self.resolve(address); + self.resize_to_fit(resolved_ptr + 1); + self.inner[resolved_ptr] = value; } fn resize_to_fit(&mut self, size: usize) { @@ -265,10 +279,11 @@ impl Memory { self.inner.resize(new_size, MemoryValue::default()); } - /// Sets the values after pointer `ptr` to `values` - pub fn write_slice(&mut self, ptr: MemoryAddress, values: &[MemoryValue]) { - self.resize_to_fit(ptr.to_usize() + values.len()); - self.inner[ptr.to_usize()..(ptr.to_usize() + values.len())].copy_from_slice(values); + /// Sets the values after `address` to `values` + pub fn write_slice(&mut self, address: MemoryAddress, values: &[MemoryValue]) { + let resolved_address = self.resolve(address); + self.resize_to_fit(resolved_address + values.len()); + self.inner[resolved_address..(resolved_address + values.len())].copy_from_slice(values); } /// Returns the values of the memory diff --git a/compiler/noirc_driver/src/lib.rs b/compiler/noirc_driver/src/lib.rs index f7270a6e4ed..c4e2491a5fe 100644 --- a/compiler/noirc_driver/src/lib.rs +++ b/compiler/noirc_driver/src/lib.rs @@ -125,6 +125,12 @@ pub struct CompileOptions { /// This check should always be run on production code. #[arg(long)] pub skip_underconstrained_check: bool, + + /// Setting to decide on an inlining strategy for brillig functions. + /// A more aggressive inliner should generate larger programs but more optimized + /// A less aggressive inliner should generate smaller programs + #[arg(long, hide = true, allow_hyphen_values = true, default_value_t = i64::MAX)] + pub inliner_aggressiveness: i64, } pub fn parse_expression_width(input: &str) -> Result { @@ -449,14 +455,12 @@ fn compile_contract_inner( .attributes .secondary .iter() - .filter_map(|attr| { - if let SecondaryAttribute::Tag(attribute) = attr { - Some(&attribute.contents) - } else { - None + .filter_map(|attr| match attr { + SecondaryAttribute::Tag(attribute) | SecondaryAttribute::Meta(attribute) => { + Some(attribute.contents.clone()) } + _ => None, }) - .cloned() .collect(); functions.push(ContractFunction { @@ -585,6 +589,7 @@ pub fn compile_no_check( }, emit_ssa: if options.emit_ssa { Some(context.package_build_path.clone()) } else { None }, skip_underconstrained_check: options.skip_underconstrained_check, + inliner_aggressiveness: options.inliner_aggressiveness, }; let SsaProgramArtifact { program, debug, warnings, names, brillig_names, error_types, .. } = diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen.rs index 628ec9657f2..313fd65a197 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen.rs @@ -27,6 +27,8 @@ pub(crate) fn convert_ssa_function( brillig_context.enter_context(Label::function(func.id())); + brillig_context.call_check_max_stack_depth_procedure(); + for block in function_context.blocks.clone() { BrilligBlock::compile(&mut function_context, &mut brillig_context, block, &func.dfg); } diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs index 889af07fbef..10c0e8b8e8c 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs @@ -7,9 +7,7 @@ use acvm::{ }; use crate::brillig::brillig_ir::{ - brillig_variable::{BrilligVariable, SingleAddrVariable}, - debug_show::DebugToString, - registers::RegisterAllocator, + brillig_variable::BrilligVariable, debug_show::DebugToString, registers::RegisterAllocator, BrilligBinaryOp, BrilligContext, }; @@ -61,33 +59,6 @@ pub(crate) fn convert_black_box_call { - if let ( - [message, BrilligVariable::SingleAddr(message_size)], - [BrilligVariable::BrilligArray(result_array)], - ) = (function_arguments, function_results) - { - let message_vector = convert_array_or_vector(brillig_context, *message, bb_func); - let output_heap_array = - brillig_context.codegen_brillig_array_to_heap_array(*result_array); - - // Message_size is not usize - brillig_context.cast_instruction( - SingleAddrVariable::new_usize(message_vector.size), - *message_size, - ); - - brillig_context.black_box_op_instruction(BlackBoxOp::Keccak256 { - message: message_vector, - output: output_heap_array, - }); - - brillig_context.deallocate_heap_vector(message_vector); - brillig_context.deallocate_heap_array(output_heap_array); - } else { - unreachable!("ICE: Keccak256 expects message, message size and result array") - } - } BlackBoxFunc::Keccakf1600 => { if let ([message], [BrilligVariable::BrilligArray(result_array)]) = (function_arguments, function_results) @@ -170,42 +141,6 @@ pub(crate) fn convert_black_box_call { - if let ( - [message, BrilligVariable::SingleAddr(domain_separator)], - [BrilligVariable::BrilligArray(result_array)], - ) = (function_arguments, function_results) - { - let inputs = convert_array_or_vector(brillig_context, *message, bb_func); - let output = brillig_context.codegen_brillig_array_to_heap_array(*result_array); - brillig_context.black_box_op_instruction(BlackBoxOp::PedersenCommitment { - inputs, - domain_separator: domain_separator.address, - output, - }); - brillig_context.deallocate_heap_vector(inputs); - brillig_context.deallocate_heap_array(output); - } else { - unreachable!("ICE: Pedersen expects one array argument, a register for the domain separator, and one array result") - } - } - BlackBoxFunc::PedersenHash => { - if let ( - [message, BrilligVariable::SingleAddr(domain_separator)], - [BrilligVariable::SingleAddr(result)], - ) = (function_arguments, function_results) - { - let inputs = convert_array_or_vector(brillig_context, *message, bb_func); - brillig_context.black_box_op_instruction(BlackBoxOp::PedersenHash { - inputs, - domain_separator: domain_separator.address, - output: result.address, - }); - brillig_context.deallocate_heap_vector(inputs); - } else { - unreachable!("ICE: Pedersen hash expects one array argument, a register for the domain separator, and one register result") - } - } BlackBoxFunc::SchnorrVerify => { if let ( [BrilligVariable::SingleAddr(public_key_x), BrilligVariable::SingleAddr(public_key_y), signature, message], diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs index e764c81b023..deaae6a05cc 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs @@ -783,26 +783,9 @@ impl<'block> BrilligBlock<'block> { dfg: &DataFlowGraph, result_ids: &[ValueId], ) { - // Convert the arguments to registers casting those to the types of the receiving function - let argument_registers: Vec = arguments - .iter() - .map(|argument_id| self.convert_ssa_value(*argument_id, dfg).extract_register()) - .collect(); - - let variables_to_save = self.variables.get_available_variables(self.function_context); - - let saved_registers = self - .brillig_context - .codegen_pre_call_save_registers_prep_args(&argument_registers, &variables_to_save); - - // Call instruction, which will interpret above registers 0..num args - self.brillig_context.add_external_call_instruction(func_id); - - // Important: resolve after pre_call_save_registers_prep_args - // This ensures we don't save the results to registers unnecessarily. - - // Allocate the registers for the variables where we are assigning the returns - let variables_assigned_to = vecmap(result_ids, |result_id| { + let argument_variables = + vecmap(arguments, |argument_id| self.convert_ssa_value(*argument_id, dfg)); + let return_variables = vecmap(result_ids, |result_id| { self.variables.define_variable( self.function_context, self.brillig_context, @@ -810,26 +793,7 @@ impl<'block> BrilligBlock<'block> { dfg, ) }); - - // Collect the registers that should have been returned - let returned_registers: Vec = variables_assigned_to - .iter() - .map(|returned_variable| returned_variable.extract_register()) - .collect(); - - assert!( - !saved_registers.iter().any(|x| returned_registers.contains(x)), - "should not save registers used as function results" - ); - - // puts the returns into the returned_registers and restores saved_registers - self.brillig_context - .codegen_post_call_prep_returns_load_registers(&returned_registers, &saved_registers); - - // Reset the register state to the one needed to hold the current available variables - let variables = self.variables.get_available_variables(self.function_context); - let registers = variables.into_iter().map(|variable| variable.extract_register()).collect(); - self.brillig_context.set_allocated_registers(registers); + self.brillig_context.codegen_call(func_id, &argument_variables, &return_variables); } fn validate_array_index( @@ -1310,12 +1274,13 @@ impl<'block> BrilligBlock<'block> { self.brillig_context.binary_instruction(zero, num, twos_complement, BrilligBinaryOp::Sub); // absolute_value = result_is_negative ? twos_complement : num - self.brillig_context.conditional_mov_instruction( - absolute_value.address, - result_is_negative.address, - twos_complement.address, - num.address, - ); + self.brillig_context.codegen_branch(result_is_negative.address, |ctx, is_negative| { + if is_negative { + ctx.mov_instruction(absolute_value.address, twos_complement.address); + } else { + ctx.mov_instruction(absolute_value.address, num.address); + } + }); self.brillig_context.deallocate_single_addr(zero); self.brillig_context.deallocate_single_addr(max_positive); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs index faf4242a9ca..f066d967e0d 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs @@ -14,29 +14,29 @@ pub(crate) fn directive_invert() -> GeneratedBrillig { // The input argument, ie the value that will be inverted. // We store the result in this register too. - let input = MemoryAddress::from(0); - let one_const = MemoryAddress::from(1); - let zero_const = MemoryAddress::from(2); - let input_is_zero = MemoryAddress::from(3); + let input = MemoryAddress::direct(0); + let one_const = MemoryAddress::direct(1); + let zero_const = MemoryAddress::direct(2); + let input_is_zero = MemoryAddress::direct(3); // Location of the stop opcode let stop_location = 8; GeneratedBrillig { byte_code: vec![ BrilligOpcode::Const { - destination: MemoryAddress(20), + destination: MemoryAddress::direct(20), bit_size: BitSize::Integer(IntegerBitSize::U32), value: F::from(1_usize), }, BrilligOpcode::Const { - destination: MemoryAddress::from(21), + destination: MemoryAddress::direct(21), bit_size: BitSize::Integer(IntegerBitSize::U32), value: F::from(0_usize), }, BrilligOpcode::CalldataCopy { destination_address: input, - size_address: MemoryAddress::from(20), - offset_address: MemoryAddress::from(21), + size_address: MemoryAddress::direct(20), + offset_address: MemoryAddress::direct(21), }, // Put value zero in register (2) BrilligOpcode::Const { @@ -89,46 +89,46 @@ pub(crate) fn directive_quotient() -> GeneratedBrillig { GeneratedBrillig { byte_code: vec![ BrilligOpcode::Const { - destination: MemoryAddress::from(10), + destination: MemoryAddress::direct(10), bit_size: BitSize::Integer(IntegerBitSize::U32), value: F::from(2_usize), }, BrilligOpcode::Const { - destination: MemoryAddress::from(11), + destination: MemoryAddress::direct(11), bit_size: BitSize::Integer(IntegerBitSize::U32), value: F::from(0_usize), }, BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress::from(0), - size_address: MemoryAddress::from(10), - offset_address: MemoryAddress::from(11), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(10), + offset_address: MemoryAddress::direct(11), }, // No cast, since calldata is typed as field by default //q = a/b is set into register (2) BrilligOpcode::BinaryFieldOp { op: BinaryFieldOp::IntegerDiv, // We want integer division, not field division! - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(2), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(2), }, //(1)= q*b BrilligOpcode::BinaryFieldOp { op: BinaryFieldOp::Mul, - lhs: MemoryAddress::from(2), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(1), + lhs: MemoryAddress::direct(2), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(1), }, //(1) = a-q*b BrilligOpcode::BinaryFieldOp { op: BinaryFieldOp::Sub, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), - destination: MemoryAddress::from(1), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), + destination: MemoryAddress::direct(1), }, //(0) = q BrilligOpcode::Mov { - destination: MemoryAddress::from(0), - source: MemoryAddress::from(2), + destination: MemoryAddress::direct(0), + source: MemoryAddress::direct(2), }, BrilligOpcode::Stop { return_data_offset: 0, return_data_size: 2 }, ], diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_slice_ops.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_slice_ops.rs index 85db1bd8b96..76e35395dd6 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_slice_ops.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_slice_ops.rs @@ -162,6 +162,7 @@ mod tests { use std::vec; use acvm::FieldElement; + use noirc_frontend::monomorphization::ast::InlineType; use crate::brillig::brillig_gen::brillig_block::BrilligBlock; use crate::brillig::brillig_gen::brillig_block_variables::BlockVariables; @@ -182,7 +183,7 @@ mod tests { fn create_test_environment() -> (Ssa, FunctionContext, BrilligContext) { let mut builder = FunctionBuilder::new("main".to_string(), Id::test_new(0)); - builder.set_runtime(RuntimeType::Brillig); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); let ssa = builder.finish(); let mut brillig_context = create_context(ssa.main_id); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs index 92595292bf0..a18461bc0cd 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs @@ -341,6 +341,7 @@ impl VariableLiveness { #[cfg(test)] mod test { use fxhash::FxHashSet; + use noirc_frontend::monomorphization::ast::InlineType; use crate::brillig::brillig_gen::constant_allocation::ConstantAllocation; use crate::brillig::brillig_gen::variable_liveness::VariableLiveness; @@ -373,7 +374,7 @@ mod test { let main_id = Id::test_new(1); let mut builder = FunctionBuilder::new("main".into(), main_id); - builder.set_runtime(RuntimeType::Brillig); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); let b1 = builder.insert_block(); let b2 = builder.insert_block(); @@ -483,7 +484,7 @@ mod test { let main_id = Id::test_new(1); let mut builder = FunctionBuilder::new("main".into(), main_id); - builder.set_runtime(RuntimeType::Brillig); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); let b1 = builder.insert_block(); let b2 = builder.insert_block(); @@ -622,7 +623,7 @@ mod test { let main_id = Id::test_new(1); let mut builder = FunctionBuilder::new("main".into(), main_id); - builder.set_runtime(RuntimeType::Brillig); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); let v0 = builder.add_parameter(Type::bool()); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir.rs index d8065294b0c..4964ff27f60 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir.rs @@ -43,19 +43,17 @@ pub(crate) const BRILLIG_MEMORY_ADDRESSING_BIT_SIZE: u32 = 32; // Registers reserved in runtime for special purposes. pub(crate) enum ReservedRegisters { + /// This register stores the stack pointer. All relative memory addresses are relative to this pointer. + StackPointer = 0, /// This register stores the free memory pointer. Allocations must be done after this pointer. - FreeMemoryPointer = 0, - /// This register stores the previous stack pointer. The registers of the caller are stored here. - PreviousStackPointer = 1, + FreeMemoryPointer = 1, /// This register stores a 1_usize constant. UsizeOne = 2, } impl ReservedRegisters { - /// The number of reserved registers. - /// - /// This is used to offset the general registers - /// which should not overwrite the special register + /// The number of reserved registers. These are allocated in the first memory positions. + /// The stack should start after the reserved registers. const NUM_RESERVED_REGISTERS: usize = 3; /// Returns the length of the reserved registers @@ -63,19 +61,16 @@ impl ReservedRegisters { Self::NUM_RESERVED_REGISTERS } - /// Returns the free memory pointer register. This will get used to allocate memory in runtime. - pub(crate) fn free_memory_pointer() -> MemoryAddress { - MemoryAddress::from(ReservedRegisters::FreeMemoryPointer as usize) + pub(crate) fn stack_pointer() -> MemoryAddress { + MemoryAddress::direct(ReservedRegisters::StackPointer as usize) } - /// Returns the previous stack pointer register. This will be used to restore the registers after a fn call. - pub(crate) fn previous_stack_pointer() -> MemoryAddress { - MemoryAddress::from(ReservedRegisters::PreviousStackPointer as usize) + pub(crate) fn free_memory_pointer() -> MemoryAddress { + MemoryAddress::direct(ReservedRegisters::FreeMemoryPointer as usize) } - /// Returns the usize one register. This will be used to perform arithmetic operations. pub(crate) fn usize_one() -> MemoryAddress { - MemoryAddress::from(ReservedRegisters::UsizeOne as usize) + MemoryAddress::direct(ReservedRegisters::UsizeOne as usize) } } @@ -178,20 +173,6 @@ pub(crate) mod tests { ) -> Result { Ok(true) } - fn pedersen_commitment( - &self, - _inputs: &[FieldElement], - _domain_separator: u32, - ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { - Ok((2_u128.into(), 3_u128.into())) - } - fn pedersen_hash( - &self, - _inputs: &[FieldElement], - _domain_separator: u32, - ) -> Result { - Ok(6_u128.into()) - } fn multi_scalar_mul( &self, _points: &[FieldElement], @@ -279,10 +260,10 @@ pub(crate) mod tests { let r_stack = ReservedRegisters::free_memory_pointer(); // Start stack pointer at 0 context.usize_const_instruction(r_stack, FieldElement::from(ReservedRegisters::len() + 3)); - let r_input_size = MemoryAddress::from(ReservedRegisters::len()); - let r_array_ptr = MemoryAddress::from(ReservedRegisters::len() + 1); - let r_output_size = MemoryAddress::from(ReservedRegisters::len() + 2); - let r_equality = MemoryAddress::from(ReservedRegisters::len() + 3); + let r_input_size = MemoryAddress::direct(ReservedRegisters::len()); + let r_array_ptr = MemoryAddress::direct(ReservedRegisters::len() + 1); + let r_output_size = MemoryAddress::direct(ReservedRegisters::len() + 2); + let r_equality = MemoryAddress::direct(ReservedRegisters::len() + 3); context.usize_const_instruction(r_input_size, FieldElement::from(12_usize)); // copy our stack frame to r_array_ptr context.mov_instruction(r_array_ptr, r_stack); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_calls.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_calls.rs index 185a6a08a04..777acfc4da3 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_calls.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_calls.rs @@ -1,105 +1,78 @@ use acvm::{acir::brillig::MemoryAddress, AcirField}; +use crate::ssa::ir::function::FunctionId; + use super::{ - brillig_variable::BrilligVariable, debug_show::DebugToString, registers::RegisterAllocator, + brillig_variable::{BrilligVariable, SingleAddrVariable}, + debug_show::DebugToString, + registers::{RegisterAllocator, Stack}, BrilligBinaryOp, BrilligContext, ReservedRegisters, }; -impl BrilligContext { - /// Saves all of the registers that have been used up until this point. - fn codegen_save_registers_of_vars(&mut self, vars: &[BrilligVariable]) -> Vec { - // Save all of the used registers at this point in memory - // because the function call will/may overwrite them. - // - // Note that here it is important that the stack pointer register is at register 0, - // as after the first register save we add to the pointer. - let mut used_registers: Vec<_> = vars.iter().map(|var| var.extract_register()).collect(); - - // Also dump the previous stack pointer - used_registers.push(ReservedRegisters::previous_stack_pointer()); - for register in used_registers.iter() { - self.store_instruction(ReservedRegisters::free_memory_pointer(), *register); - // Add one to our stack pointer - self.codegen_usize_op_in_place( - ReservedRegisters::free_memory_pointer(), - BrilligBinaryOp::Add, - 1, +impl BrilligContext { + pub(crate) fn codegen_call( + &mut self, + func_id: FunctionId, + arguments: &[BrilligVariable], + returns: &[BrilligVariable], + ) { + let stack_size_register = SingleAddrVariable::new_usize(self.allocate_register()); + let previous_stack_pointer = self.registers.empty_stack_start(); + let stack_size = previous_stack_pointer.unwrap_relative(); + // Write the stack size + self.const_instruction(stack_size_register, stack_size.into()); + // Pass the previous stack pointer + self.mov_instruction(previous_stack_pointer, ReservedRegisters::stack_pointer()); + // Pass the arguments + let mut current_argument_location = stack_size + 1; + for item in arguments { + self.mov_instruction( + MemoryAddress::relative(current_argument_location), + item.extract_register(), ); + current_argument_location += 1; } - - // Store the location of our registers in the previous stack pointer - self.mov_instruction( - ReservedRegisters::previous_stack_pointer(), - ReservedRegisters::free_memory_pointer(), + // Increment the stack pointer + self.memory_op_instruction( + ReservedRegisters::stack_pointer(), + stack_size_register.address, + ReservedRegisters::stack_pointer(), + BrilligBinaryOp::Add, ); - used_registers - } - /// Loads all of the registers that have been save by save_all_used_registers. - fn codegen_load_all_saved_registers(&mut self, used_registers: &[MemoryAddress]) { - // Load all of the used registers that we saved. - // We do all the reverse operations of save_all_used_registers. - // Iterate our registers in reverse - let iterator_register = self.allocate_register(); - self.mov_instruction(iterator_register, ReservedRegisters::previous_stack_pointer()); + self.add_external_call_instruction(func_id); + + // Restore the stack pointer + self.mov_instruction(ReservedRegisters::stack_pointer(), MemoryAddress::relative(0)); - for register in used_registers.iter().rev() { - // Subtract one from our stack pointer - self.codegen_usize_op_in_place(iterator_register, BrilligBinaryOp::Sub, 1); - self.load_instruction(*register, iterator_register); + // Move the return values back + let mut current_return_location = stack_size + 1; + for item in returns { + self.mov_instruction( + item.extract_register(), + MemoryAddress::relative(current_return_location), + ); + current_return_location += 1; } + self.deallocate_single_addr(stack_size_register); } - // Used before a call instruction. - // Save all the registers we have used to the stack. - // Move argument values to the front of the register indices. - pub(crate) fn codegen_pre_call_save_registers_prep_args( - &mut self, - arguments: &[MemoryAddress], - variables_to_save: &[BrilligVariable], - ) -> Vec { - // Save all the registers we have used to the stack. - let saved_registers = self.codegen_save_registers_of_vars(variables_to_save); + /// Codegens a return from the current function. + pub(crate) fn codegen_return(&mut self, return_registers: &[MemoryAddress]) { + let mut sources = Vec::with_capacity(return_registers.len()); + let mut destinations = Vec::with_capacity(return_registers.len()); - // Move argument values to the front of the registers - // - // This means that the arguments will be in the first `n` registers after - // the number of reserved registers. - let (sources, destinations): (Vec<_>, Vec<_>) = arguments - .iter() - .enumerate() - .map(|(i, argument)| (*argument, self.stack_register(i))) - .unzip(); + for (destination_index, return_register) in return_registers.iter().enumerate() { + // In case we have fewer return registers than indices to write to, ensure we've allocated this register + let destination_register = MemoryAddress::relative(Stack::start() + destination_index); + self.registers.ensure_register_is_allocated(destination_register); + sources.push(*return_register); + destinations.push(destination_register); + } destinations .iter() .for_each(|destination| self.registers.ensure_register_is_allocated(*destination)); self.codegen_mov_registers_to_registers(sources, destinations); - saved_registers - } - - // Used after a call instruction. - // Move return values to the front of the register indices. - // Load all the registers we have previous saved in save_registers_prep_args. - pub(crate) fn codegen_post_call_prep_returns_load_registers( - &mut self, - result_registers: &[MemoryAddress], - saved_registers: &[MemoryAddress], - ) { - // Allocate our result registers and write into them - // We assume the return values of our call are held in 0..num results register indices - let (sources, destinations): (Vec<_>, Vec<_>) = result_registers - .iter() - .enumerate() - .map(|(i, result_register)| (self.stack_register(i), *result_register)) - .unzip(); - sources.iter().for_each(|source| self.registers.ensure_register_is_allocated(*source)); - self.codegen_mov_registers_to_registers(sources, destinations); - - // Restore all the same registers we have, in exact reverse order. - // Note that we have allocated some registers above, which we will not be handling here, - // only restoring registers that were used prior to the call finishing. - // After the call instruction, the stack frame pointer should be back to where we left off, - // so we do our instructions in reverse order. - self.codegen_load_all_saved_registers(saved_registers); + self.stop_instruction(); } } diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_control_flow.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_control_flow.rs index e5b57293d1e..c305d8c78f3 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_control_flow.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_control_flow.rs @@ -7,7 +7,7 @@ use super::{ artifact::BrilligParameter, brillig_variable::{BrilligArray, BrilligVariable, SingleAddrVariable}, debug_show::DebugToString, - registers::{RegisterAllocator, Stack}, + registers::RegisterAllocator, BrilligBinaryOp, BrilligContext, ReservedRegisters, }; @@ -349,32 +349,3 @@ impl BrilligContext< } } } - -impl BrilligContext { - /// Codegens a return from the current function. - /// - /// For Brillig, the return is implicit, since there is no explicit return instruction. - /// The caller will take `N` values from the Register starting at register index 0. - /// `N` indicates the number of return values expected. - /// - /// Brillig does not have an explicit return instruction, so this - /// method will move all register values to the first `N` values in - /// the VM. - pub(crate) fn codegen_return(&mut self, return_registers: &[MemoryAddress]) { - let mut sources = Vec::with_capacity(return_registers.len()); - let mut destinations = Vec::with_capacity(return_registers.len()); - - for (destination_index, return_register) in return_registers.iter().enumerate() { - // In case we have fewer return registers than indices to write to, ensure we've allocated this register - let destination_register = MemoryAddress(Stack::start() + destination_index); - self.registers.ensure_register_is_allocated(destination_register); - sources.push(*return_register); - destinations.push(destination_register); - } - destinations - .iter() - .for_each(|destination| self.registers.ensure_register_is_allocated(*destination)); - self.codegen_mov_registers_to_registers(sources, destinations); - self.stop_instruction(); - } -} diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_stack.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_stack.rs index b7b25c6db49..a0e2a500e20 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_stack.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/codegen_stack.rs @@ -140,7 +140,9 @@ mod tests { movements: Vec<(usize, usize)>, ) -> HashMap> { movements.into_iter().fold(HashMap::default(), |mut map, (source, destination)| { - map.entry(MemoryAddress(source)).or_default().insert(MemoryAddress(destination)); + map.entry(MemoryAddress::relative(source)) + .or_default() + .insert(MemoryAddress::relative(destination)); map }) } @@ -190,9 +192,12 @@ mod tests { fn movements_to_source_and_destinations( movements: Vec<(usize, usize)>, ) -> (Vec, Vec) { - let sources = movements.iter().map(|(source, _)| MemoryAddress::from(*source)).collect(); - let destinations = - movements.iter().map(|(_, destination)| MemoryAddress::from(*destination)).collect(); + let sources = + movements.iter().map(|(source, _)| MemoryAddress::relative(*source)).collect(); + let destinations = movements + .iter() + .map(|(_, destination)| MemoryAddress::relative(*destination)) + .collect(); (sources, destinations) } @@ -223,10 +228,22 @@ mod tests { assert_eq!( opcodes, vec![ - Opcode::Mov { destination: MemoryAddress(14), source: MemoryAddress(13) }, - Opcode::Mov { destination: MemoryAddress(13), source: MemoryAddress(12) }, - Opcode::Mov { destination: MemoryAddress(12), source: MemoryAddress(11) }, - Opcode::Mov { destination: MemoryAddress(11), source: MemoryAddress(10) }, + Opcode::Mov { + destination: MemoryAddress::relative(14), + source: MemoryAddress::relative(13) + }, + Opcode::Mov { + destination: MemoryAddress::relative(13), + source: MemoryAddress::relative(12) + }, + Opcode::Mov { + destination: MemoryAddress::relative(12), + source: MemoryAddress::relative(11) + }, + Opcode::Mov { + destination: MemoryAddress::relative(11), + source: MemoryAddress::relative(10) + }, ] ); } @@ -241,8 +258,14 @@ mod tests { assert_eq!( opcodes, vec![ - Opcode::Mov { destination: MemoryAddress(12), source: MemoryAddress(11) }, - Opcode::Mov { destination: MemoryAddress(11), source: MemoryAddress(10) }, + Opcode::Mov { + destination: MemoryAddress::relative(12), + source: MemoryAddress::relative(11) + }, + Opcode::Mov { + destination: MemoryAddress::relative(11), + source: MemoryAddress::relative(10) + }, ] ); } @@ -258,11 +281,26 @@ mod tests { assert_eq!( opcodes, vec![ - Opcode::Mov { destination: MemoryAddress(3), source: MemoryAddress(10) }, - Opcode::Mov { destination: MemoryAddress(10), source: MemoryAddress(13) }, - Opcode::Mov { destination: MemoryAddress(13), source: MemoryAddress(12) }, - Opcode::Mov { destination: MemoryAddress(12), source: MemoryAddress(11) }, - Opcode::Mov { destination: MemoryAddress(11), source: MemoryAddress(3) } + Opcode::Mov { + destination: MemoryAddress::relative(1), + source: MemoryAddress::relative(10) + }, + Opcode::Mov { + destination: MemoryAddress::relative(10), + source: MemoryAddress::relative(13) + }, + Opcode::Mov { + destination: MemoryAddress::relative(13), + source: MemoryAddress::relative(12) + }, + Opcode::Mov { + destination: MemoryAddress::relative(12), + source: MemoryAddress::relative(11) + }, + Opcode::Mov { + destination: MemoryAddress::relative(11), + source: MemoryAddress::relative(1) + } ] ); } @@ -278,12 +316,30 @@ mod tests { assert_eq!( opcodes, vec![ - Opcode::Mov { destination: MemoryAddress(3), source: MemoryAddress(10) }, // Temporary - Opcode::Mov { destination: MemoryAddress(14), source: MemoryAddress(13) }, // Branch - Opcode::Mov { destination: MemoryAddress(10), source: MemoryAddress(12) }, // Loop - Opcode::Mov { destination: MemoryAddress(12), source: MemoryAddress(11) }, // Loop - Opcode::Mov { destination: MemoryAddress(13), source: MemoryAddress(3) }, // Finish branch - Opcode::Mov { destination: MemoryAddress(11), source: MemoryAddress(3) } // Finish loop + Opcode::Mov { + destination: MemoryAddress::relative(1), + source: MemoryAddress::relative(10) + }, // Temporary + Opcode::Mov { + destination: MemoryAddress::relative(10), + source: MemoryAddress::relative(12) + }, // Branch + Opcode::Mov { + destination: MemoryAddress::relative(12), + source: MemoryAddress::relative(11) + }, // Loop + Opcode::Mov { + destination: MemoryAddress::relative(14), + source: MemoryAddress::relative(13) + }, // Loop + Opcode::Mov { + destination: MemoryAddress::relative(11), + source: MemoryAddress::relative(1) + }, // Finish branch + Opcode::Mov { + destination: MemoryAddress::relative(13), + source: MemoryAddress::relative(1) + } // Finish loop ] ); } diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs index 08e6c18182b..7597da2be05 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs @@ -28,10 +28,13 @@ impl DebugToString for MemoryAddress { fn debug_to_string(&self) -> String { if *self == ReservedRegisters::free_memory_pointer() { "FreeMem".into() - } else if *self == ReservedRegisters::previous_stack_pointer() { - "PrevStack".into() + } else if *self == ReservedRegisters::stack_pointer() { + "StackPointer".into() } else { - format!("R{}", self.to_usize()) + match self { + MemoryAddress::Direct(address) => format!("M{}", address), + MemoryAddress::Relative(offset) => format!("S{}", offset), + } } } } @@ -123,24 +126,6 @@ impl DebugShow { debug_println!(self.enable_debug_trace, " MOV {}, {}", destination, source); } - /// Emits a conditional `mov` instruction. - pub(crate) fn conditional_mov_instruction( - &self, - destination: MemoryAddress, - condition: MemoryAddress, - source_a: MemoryAddress, - source_b: MemoryAddress, - ) { - debug_println!( - self.enable_debug_trace, - " CMOV {} = {}? {} : {}", - destination, - condition, - source_a, - source_b - ); - } - /// Emits a `cast` instruction. pub(crate) fn cast_instruction( &self, @@ -285,9 +270,6 @@ impl DebugShow { outputs ); } - BlackBoxOp::Keccak256 { message, output } => { - debug_println!(self.enable_debug_trace, " KECCAK256 {} -> {}", message, output); - } BlackBoxOp::Keccakf1600 { message, output } => { debug_println!(self.enable_debug_trace, " KECCAKF1600 {} -> {}", message, output); } @@ -353,24 +335,6 @@ impl DebugShow { result ); } - BlackBoxOp::PedersenCommitment { inputs, domain_separator, output } => { - debug_println!( - self.enable_debug_trace, - " PEDERSEN {} {} -> {}", - inputs, - domain_separator, - output - ); - } - BlackBoxOp::PedersenHash { inputs, domain_separator, output } => { - debug_println!( - self.enable_debug_trace, - " PEDERSEN_HASH {} {} -> {}", - inputs, - domain_separator, - output - ); - } BlackBoxOp::SchnorrVerify { public_key_x, public_key_y, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/entry_point.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/entry_point.rs index ff9b5ea67eb..75d91716c23 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/entry_point.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/entry_point.rs @@ -9,7 +9,8 @@ use super::{ }; use acvm::acir::{brillig::MemoryAddress, AcirField}; -pub(crate) const MAX_STACK_SIZE: usize = 2048; +pub(crate) const MAX_STACK_SIZE: usize = 16 * MAX_STACK_FRAME_SIZE; +pub(crate) const MAX_STACK_FRAME_SIZE: usize = 2048; pub(crate) const MAX_SCRATCH_SPACE: usize = 64; impl BrilligContext { @@ -57,12 +58,18 @@ impl BrilligContext { 1_usize.into(), ); - // Set initial value of stack pointer: calldata_start_offset + calldata_size + return_data_size + // Set initial value of free memory pointer: calldata_start_offset + calldata_size + return_data_size self.const_instruction( SingleAddrVariable::new_usize(ReservedRegisters::free_memory_pointer()), (Self::calldata_start_offset() + calldata_size + return_data_size).into(), ); + // Set initial value of stack pointer: ReservedRegisters.len() + self.const_instruction( + SingleAddrVariable::new_usize(ReservedRegisters::stack_pointer()), + ReservedRegisters::len().into(), + ); + // Copy calldata self.copy_and_cast_calldata(arguments); @@ -74,7 +81,7 @@ impl BrilligContext { (BrilligVariable::SingleAddr(single_address), BrilligParameter::SingleAddr(_)) => { self.mov_instruction( single_address.address, - MemoryAddress(current_calldata_pointer), + MemoryAddress::direct(current_calldata_pointer), ); current_calldata_pointer += 1; } @@ -142,7 +149,7 @@ impl BrilligContext { fn copy_and_cast_calldata(&mut self, arguments: &[BrilligParameter]) { let calldata_size = Self::flattened_tuple_size(arguments); self.calldata_copy_instruction( - MemoryAddress(Self::calldata_start_offset()), + MemoryAddress::direct(Self::calldata_start_offset()), calldata_size, 0, ); @@ -162,10 +169,12 @@ impl BrilligContext { if bit_size < F::max_num_bits() { self.cast_instruction( SingleAddrVariable::new( - MemoryAddress(Self::calldata_start_offset() + i), + MemoryAddress::direct(Self::calldata_start_offset() + i), bit_size, ), - SingleAddrVariable::new_field(MemoryAddress(Self::calldata_start_offset() + i)), + SingleAddrVariable::new_field(MemoryAddress::direct( + Self::calldata_start_offset() + i, + )), ); } } @@ -325,7 +334,7 @@ impl BrilligContext { match return_param { BrilligParameter::SingleAddr(_) => { self.mov_instruction( - MemoryAddress(return_data_index), + MemoryAddress::direct(return_data_index), returned_variable.extract_single_addr().address, ); return_data_index += 1; diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/instructions.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/instructions.rs index f196552b768..1ac672687f3 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/instructions.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/instructions.rs @@ -327,25 +327,6 @@ impl BrilligContext< self.push_opcode(BrilligOpcode::Mov { destination, source }); } - /// Emits a conditional `mov` instruction. - /// - /// Copies the value at `source` into `destination` - pub(crate) fn conditional_mov_instruction( - &mut self, - destination: MemoryAddress, - condition: MemoryAddress, - source_a: MemoryAddress, - source_b: MemoryAddress, - ) { - self.debug_show.conditional_mov_instruction(destination, condition, source_a, source_b); - self.push_opcode(BrilligOpcode::ConditionalMov { - destination, - source_a, - source_b, - condition, - }); - } - /// Cast truncates the value to the given bit size and converts the type of the value in memory to that bit size. pub(crate) fn cast_instruction( &mut self, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_copy.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_copy.rs index 5b97bbc8f7a..67f7cf2dc34 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_copy.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_copy.rs @@ -18,9 +18,9 @@ impl BrilligContext< source_array: BrilligArray, destination_array: BrilligArray, ) { - let source_array_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let source_array_memory_size_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let new_array_pointer_return = MemoryAddress::from(ScratchSpace::start() + 2); + let source_array_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let source_array_memory_size_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let new_array_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 2); self.mov_instruction(source_array_pointer_arg, source_array.pointer); self.usize_const_instruction(source_array_memory_size_arg, (source_array.size + 1).into()); @@ -34,9 +34,9 @@ impl BrilligContext< pub(super) fn compile_array_copy_procedure( brillig_context: &mut BrilligContext, ) { - let source_array_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let source_array_memory_size_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let new_array_pointer_return = MemoryAddress::from(ScratchSpace::start() + 2); + let source_array_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let source_array_memory_size_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let new_array_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 2); brillig_context.set_allocated_registers(vec![ source_array_pointer_arg, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_reverse.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_reverse.rs index 0d98599bf96..a5a11d61bef 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_reverse.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/array_reverse.rs @@ -15,8 +15,8 @@ impl BrilligContext< pointer: MemoryAddress, size: MemoryAddress, ) { - let source_pointer = MemoryAddress::from(ScratchSpace::start()); - let size_register = MemoryAddress::from(ScratchSpace::start() + 1); + let source_pointer = MemoryAddress::direct(ScratchSpace::start()); + let size_register = MemoryAddress::direct(ScratchSpace::start() + 1); self.mov_instruction(source_pointer, pointer); self.mov_instruction(size_register, size); @@ -28,8 +28,8 @@ impl BrilligContext< pub(super) fn compile_array_reverse_procedure( brillig_context: &mut BrilligContext, ) { - let source_pointer = MemoryAddress::from(ScratchSpace::start()); - let size_register = MemoryAddress::from(ScratchSpace::start() + 1); + let source_pointer = MemoryAddress::direct(ScratchSpace::start()); + let size_register = MemoryAddress::direct(ScratchSpace::start() + 1); brillig_context.set_allocated_registers(vec![source_pointer, size_register]); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/check_max_stack_depth.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/check_max_stack_depth.rs new file mode 100644 index 00000000000..4d5abe93420 --- /dev/null +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/check_max_stack_depth.rs @@ -0,0 +1,30 @@ +use acvm::AcirField; + +use super::ProcedureId; +use crate::brillig::brillig_ir::{ + brillig_variable::SingleAddrVariable, + debug_show::DebugToString, + entry_point::{MAX_STACK_FRAME_SIZE, MAX_STACK_SIZE}, + registers::{RegisterAllocator, ScratchSpace}, + BrilligBinaryOp, BrilligContext, ReservedRegisters, +}; + +impl BrilligContext { + pub(crate) fn call_check_max_stack_depth_procedure(&mut self) { + self.add_procedure_call_instruction(ProcedureId::CheckMaxStackDepth); + } +} + +pub(super) fn compile_check_max_stack_depth_procedure( + brillig_context: &mut BrilligContext, +) { + let in_range = SingleAddrVariable::new(brillig_context.allocate_register(), 1); + brillig_context.codegen_usize_op( + ReservedRegisters::stack_pointer(), + in_range.address, + BrilligBinaryOp::LessThan, + MAX_STACK_SIZE - MAX_STACK_FRAME_SIZE, + ); + brillig_context.codegen_constrain(in_range, Some("Stack too deep".to_string())); + brillig_context.deallocate_single_addr(in_range); +} diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mem_copy.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mem_copy.rs index b4e1d37af38..cdd99542483 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mem_copy.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mem_copy.rs @@ -17,9 +17,12 @@ impl BrilligContext< destination_pointer: MemoryAddress, num_elements_variable: MemoryAddress, ) { - self.mov_instruction(MemoryAddress::from(ScratchSpace::start()), source_pointer); - self.mov_instruction(MemoryAddress::from(ScratchSpace::start() + 1), destination_pointer); - self.mov_instruction(MemoryAddress::from(ScratchSpace::start() + 2), num_elements_variable); + self.mov_instruction(MemoryAddress::direct(ScratchSpace::start()), source_pointer); + self.mov_instruction(MemoryAddress::direct(ScratchSpace::start() + 1), destination_pointer); + self.mov_instruction( + MemoryAddress::direct(ScratchSpace::start() + 2), + num_elements_variable, + ); self.add_procedure_call_instruction(ProcedureId::MemCopy); } } @@ -27,9 +30,9 @@ impl BrilligContext< pub(super) fn compile_mem_copy_procedure( brillig_context: &mut BrilligContext, ) { - let source_pointer = MemoryAddress::from(ScratchSpace::start()); - let destination_pointer = MemoryAddress::from(ScratchSpace::start() + 1); - let num_elements_variable = MemoryAddress::from(ScratchSpace::start() + 2); + let source_pointer = MemoryAddress::direct(ScratchSpace::start()); + let destination_pointer = MemoryAddress::direct(ScratchSpace::start() + 1); + let num_elements_variable = MemoryAddress::direct(ScratchSpace::start() + 2); brillig_context.set_allocated_registers(vec![ source_pointer, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mod.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mod.rs index 32fe6725e56..0ee6fe49435 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mod.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/mod.rs @@ -1,5 +1,6 @@ mod array_copy; mod array_reverse; +mod check_max_stack_depth; mod mem_copy; mod prepare_vector_insert; mod prepare_vector_push; @@ -9,6 +10,7 @@ mod vector_remove; use array_copy::compile_array_copy_procedure; use array_reverse::compile_array_reverse_procedure; +use check_max_stack_depth::compile_check_max_stack_depth_procedure; use mem_copy::compile_mem_copy_procedure; use prepare_vector_insert::compile_prepare_vector_insert_procedure; use prepare_vector_push::compile_prepare_vector_push_procedure; @@ -37,6 +39,7 @@ pub(crate) enum ProcedureId { VectorPop(bool), PrepareVectorInsert, VectorRemove, + CheckMaxStackDepth, } pub(crate) fn compile_procedure( @@ -60,6 +63,9 @@ pub(crate) fn compile_procedure( compile_prepare_vector_insert_procedure(&mut brillig_context); } ProcedureId::VectorRemove => compile_vector_remove_procedure(&mut brillig_context), + ProcedureId::CheckMaxStackDepth => { + compile_check_max_stack_depth_procedure(&mut brillig_context); + } }; brillig_context.stop_instruction(); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_insert.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_insert.rs index d3a6855fa0f..8dbbf80782c 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_insert.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_insert.rs @@ -20,11 +20,11 @@ impl BrilligContext< write_pointer: MemoryAddress, item_count: usize, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let index_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let item_count_arg = MemoryAddress::from(ScratchSpace::start() + 2); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); - let write_pointer_return = MemoryAddress::from(ScratchSpace::start() + 4); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let index_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let item_count_arg = MemoryAddress::direct(ScratchSpace::start() + 2); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); + let write_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 4); self.mov_instruction(source_vector_pointer_arg, source_vector.pointer); self.mov_instruction(index_arg, index.address); @@ -40,11 +40,11 @@ impl BrilligContext< pub(super) fn compile_prepare_vector_insert_procedure( brillig_context: &mut BrilligContext, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let index_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let item_count_arg = MemoryAddress::from(ScratchSpace::start() + 2); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); - let write_pointer_return = MemoryAddress::from(ScratchSpace::start() + 4); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let index_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let item_count_arg = MemoryAddress::direct(ScratchSpace::start() + 2); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); + let write_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 4); brillig_context.set_allocated_registers(vec![ source_vector_pointer_arg, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_push.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_push.rs index 8af75712374..00a339ef714 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_push.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/prepare_vector_push.rs @@ -21,10 +21,10 @@ impl BrilligContext< item_push_count: usize, back: bool, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let item_push_count_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 2); - let write_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let item_push_count_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 2); + let write_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); self.mov_instruction(source_vector_pointer_arg, source_vector.pointer); self.usize_const_instruction(item_push_count_arg, item_push_count.into()); @@ -40,10 +40,10 @@ pub(super) fn compile_prepare_vector_push_procedure, push_back: bool, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let item_push_count_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 2); - let write_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let item_push_count_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 2); + let write_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); brillig_context.set_allocated_registers(vec![ source_vector_pointer_arg, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_copy.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_copy.rs index 87895a975f8..7695e840c0b 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_copy.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_copy.rs @@ -18,8 +18,8 @@ impl BrilligContext< source_vector: BrilligVector, destination_vector: BrilligVector, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 1); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 1); self.mov_instruction(source_vector_pointer_arg, source_vector.pointer); @@ -32,8 +32,8 @@ impl BrilligContext< pub(super) fn compile_vector_copy_procedure( brillig_context: &mut BrilligContext, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 1); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 1); brillig_context .set_allocated_registers(vec![source_vector_pointer_arg, new_vector_pointer_return]); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_pop.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_pop.rs index bb14ffac6be..8fcfebb2360 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_pop.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_pop.rs @@ -20,10 +20,10 @@ impl BrilligContext< item_pop_count: usize, back: bool, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let item_pop_count_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 2); - let read_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let item_pop_count_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 2); + let read_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); self.mov_instruction(source_vector_pointer_arg, source_vector.pointer); self.usize_const_instruction(item_pop_count_arg, item_pop_count.into()); @@ -39,10 +39,10 @@ pub(super) fn compile_vector_pop_procedure( brillig_context: &mut BrilligContext, pop_back: bool, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let item_pop_count_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 2); - let read_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let item_pop_count_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 2); + let read_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); brillig_context.set_allocated_registers(vec![ source_vector_pointer_arg, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_remove.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_remove.rs index d4a7217677f..b7b54f970fa 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_remove.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/procedures/vector_remove.rs @@ -19,10 +19,10 @@ impl BrilligContext< index: SingleAddrVariable, item_count: usize, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let index_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let item_count_arg = MemoryAddress::from(ScratchSpace::start() + 2); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let index_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let item_count_arg = MemoryAddress::direct(ScratchSpace::start() + 2); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); self.mov_instruction(source_vector_pointer_arg, source_vector.pointer); self.mov_instruction(index_arg, index.address); @@ -37,10 +37,10 @@ impl BrilligContext< pub(super) fn compile_vector_remove_procedure( brillig_context: &mut BrilligContext, ) { - let source_vector_pointer_arg = MemoryAddress::from(ScratchSpace::start()); - let index_arg = MemoryAddress::from(ScratchSpace::start() + 1); - let item_count_arg = MemoryAddress::from(ScratchSpace::start() + 2); - let new_vector_pointer_return = MemoryAddress::from(ScratchSpace::start() + 3); + let source_vector_pointer_arg = MemoryAddress::direct(ScratchSpace::start()); + let index_arg = MemoryAddress::direct(ScratchSpace::start() + 1); + let item_count_arg = MemoryAddress::direct(ScratchSpace::start() + 2); + let new_vector_pointer_return = MemoryAddress::direct(ScratchSpace::start() + 3); brillig_context.set_allocated_registers(vec![ source_vector_pointer_arg, diff --git a/compiler/noirc_evaluator/src/brillig/brillig_ir/registers.rs b/compiler/noirc_evaluator/src/brillig/brillig_ir/registers.rs index 75fb60fc9f2..dd7766f40aa 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_ir/registers.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_ir/registers.rs @@ -1,10 +1,14 @@ +use std::collections::BTreeSet; + use acvm::acir::brillig::{HeapArray, HeapVector, MemoryAddress}; +use iter_extended::vecmap; use crate::brillig::brillig_ir::entry_point::MAX_STACK_SIZE; use super::{ - brillig_variable::SingleAddrVariable, entry_point::MAX_SCRATCH_SPACE, BrilligContext, - ReservedRegisters, + brillig_variable::SingleAddrVariable, + entry_point::{MAX_SCRATCH_SPACE, MAX_STACK_FRAME_SIZE}, + BrilligContext, ReservedRegisters, }; pub(crate) trait RegisterAllocator { @@ -34,33 +38,37 @@ impl Stack { } fn is_within_bounds(register: MemoryAddress) -> bool { - let index = register.to_usize(); - index >= Self::start() && index < Self::end() + let offset = register.unwrap_relative(); + offset >= Self::start() && offset < Self::end() + } + + pub(crate) fn empty_stack_start(&self) -> MemoryAddress { + MemoryAddress::relative(self.storage.empty_registers_start(Self::start())) } } impl RegisterAllocator for Stack { fn start() -> usize { - ReservedRegisters::len() + 1 // Previous stack pointer is the first stack item } fn end() -> usize { - ReservedRegisters::len() + MAX_STACK_SIZE + MAX_STACK_FRAME_SIZE } fn ensure_register_is_allocated(&mut self, register: MemoryAddress) { assert!(Self::is_within_bounds(register), "Register out of stack bounds"); - self.storage.ensure_register_is_allocated(register); + self.storage.ensure_register_is_allocated(register.unwrap_relative()); } fn allocate_register(&mut self) -> MemoryAddress { - let allocated = self.storage.allocate_register(); - assert!(Self::is_within_bounds(allocated), "Stack too deep"); + let allocated = MemoryAddress::relative(self.storage.allocate_register()); + assert!(Self::is_within_bounds(allocated), "Stack frame too deep"); allocated } fn deallocate_register(&mut self, register_index: MemoryAddress) { - self.storage.deallocate_register(register_index); + self.storage.deallocate_register(register_index.unwrap_relative()); } fn from_preallocated_registers(preallocated_registers: Vec) -> Self { @@ -71,7 +79,7 @@ impl RegisterAllocator for Stack { Self { storage: DeallocationListAllocator::from_preallocated_registers( Self::start(), - preallocated_registers, + vecmap(preallocated_registers, |r| r.unwrap_relative()), ), } } @@ -90,7 +98,7 @@ impl ScratchSpace { } fn is_within_bounds(register: MemoryAddress) -> bool { - let index = register.to_usize(); + let index = register.unwrap_direct(); index >= Self::start() && index < Self::end() } } @@ -106,17 +114,17 @@ impl RegisterAllocator for ScratchSpace { fn ensure_register_is_allocated(&mut self, register: MemoryAddress) { assert!(Self::is_within_bounds(register), "Register out of scratch space bounds"); - self.storage.ensure_register_is_allocated(register); + self.storage.ensure_register_is_allocated(register.unwrap_direct()); } fn allocate_register(&mut self) -> MemoryAddress { - let allocated = self.storage.allocate_register(); + let allocated = MemoryAddress::direct(self.storage.allocate_register()); assert!(Self::is_within_bounds(allocated), "Scratch space too deep"); allocated } fn deallocate_register(&mut self, register_index: MemoryAddress) { - self.storage.deallocate_register(register_index); + self.storage.deallocate_register(register_index.unwrap_direct()); } fn from_preallocated_registers(preallocated_registers: Vec) -> Self { @@ -127,7 +135,7 @@ impl RegisterAllocator for ScratchSpace { Self { storage: DeallocationListAllocator::from_preallocated_registers( Self::start(), - preallocated_registers, + vecmap(preallocated_registers, |r| r.unwrap_direct()), ), } } @@ -135,75 +143,77 @@ impl RegisterAllocator for ScratchSpace { struct DeallocationListAllocator { /// A free-list of registers that have been deallocated and can be used again. - deallocated_registers: Vec, + deallocated_registers: BTreeSet, /// A usize indicating the next un-used register. next_free_register_index: usize, } impl DeallocationListAllocator { fn new(start: usize) -> Self { - Self { deallocated_registers: Vec::new(), next_free_register_index: start } + Self { deallocated_registers: BTreeSet::new(), next_free_register_index: start } } - fn ensure_register_is_allocated(&mut self, register: MemoryAddress) { - let index = register.to_usize(); + fn ensure_register_is_allocated(&mut self, index: usize) { if index < self.next_free_register_index { // If it could be allocated, check if it's in the deallocated list and remove it from there - self.deallocated_registers.retain(|&r| r != register); + self.deallocated_registers.retain(|&r| r != index); } else { // If it couldn't yet be, expand the register space. self.next_free_register_index = index + 1; } } - fn allocate_register(&mut self) -> MemoryAddress { + fn allocate_register(&mut self) -> usize { // If we have a register in our free list of deallocated registers, // consume it first. This prioritizes reuse. - if let Some(register) = self.deallocated_registers.pop() { + if let Some(register) = self.deallocated_registers.pop_first() { return register; } // Otherwise, move to our latest register. - let register = MemoryAddress::from(self.next_free_register_index); + let register = self.next_free_register_index; self.next_free_register_index += 1; register } - fn deallocate_register(&mut self, register_index: MemoryAddress) { + fn deallocate_register(&mut self, register_index: usize) { assert!(!self.deallocated_registers.contains(®ister_index)); - self.deallocated_registers.push(register_index); + self.deallocated_registers.insert(register_index); } - fn from_preallocated_registers( - start: usize, - preallocated_registers: Vec, - ) -> Self { + fn from_preallocated_registers(start: usize, preallocated_registers: Vec) -> Self { let next_free_register_index = preallocated_registers.iter().fold( start, - |free_register_index, preallocated_register| { - if preallocated_register.to_usize() < free_register_index { + |free_register_index, &preallocated_register| { + if preallocated_register < free_register_index { free_register_index } else { - preallocated_register.to_usize() + 1 + preallocated_register + 1 } }, ); - let mut deallocated_registers = Vec::new(); + let mut deallocated_registers = BTreeSet::new(); for i in start..next_free_register_index { - if !preallocated_registers.contains(&MemoryAddress::from(i)) { - deallocated_registers.push(MemoryAddress::from(i)); + if !preallocated_registers.contains(&i) { + deallocated_registers.insert(i); } } Self { deallocated_registers, next_free_register_index } } -} -impl BrilligContext { - /// Returns the i'th register after the reserved ones - pub(crate) fn stack_register(&self, i: usize) -> MemoryAddress { - MemoryAddress::from(ReservedRegisters::NUM_RESERVED_REGISTERS + i) + fn empty_registers_start(&self, start: usize) -> usize { + let mut first_free = self.next_free_register_index; + while first_free > start { + if !self.deallocated_registers.contains(&(first_free - 1)) { + break; + } + first_free -= 1; + } + first_free } +} +impl BrilligContext { /// Allocates an unused register. pub(crate) fn allocate_register(&mut self) -> MemoryAddress { self.registers.allocate_register() @@ -232,3 +242,22 @@ impl BrilligContext { self.deallocate_register(vec.size); } } + +#[cfg(test)] +mod tests { + use crate::brillig::brillig_ir::registers::{RegisterAllocator, Stack}; + + #[test] + fn stack_should_prioritize_returning_low_registers() { + let mut stack = Stack::new(); + let one = stack.allocate_register(); + let _two = stack.allocate_register(); + let three = stack.allocate_register(); + + stack.deallocate_register(three); + stack.deallocate_register(one); + + let one_again = stack.allocate_register(); + assert_eq!(one, one_again); + } +} diff --git a/compiler/noirc_evaluator/src/brillig/mod.rs b/compiler/noirc_evaluator/src/brillig/mod.rs index 45b84f5311e..f1da76669cd 100644 --- a/compiler/noirc_evaluator/src/brillig/mod.rs +++ b/compiler/noirc_evaluator/src/brillig/mod.rs @@ -65,7 +65,9 @@ impl Ssa { let brillig_reachable_function_ids = self .functions .iter() - .filter_map(|(id, func)| (func.runtime() == RuntimeType::Brillig).then_some(*id)) + .filter_map(|(id, func)| { + matches!(func.runtime(), RuntimeType::Brillig(_)).then_some(*id) + }) .collect::>(); let mut brillig = Brillig::default(); diff --git a/compiler/noirc_evaluator/src/ssa.rs b/compiler/noirc_evaluator/src/ssa.rs index efc7c6018c1..ea41b0cfb32 100644 --- a/compiler/noirc_evaluator/src/ssa.rs +++ b/compiler/noirc_evaluator/src/ssa.rs @@ -67,6 +67,9 @@ pub struct SsaEvaluatorOptions { /// Skip the check for under constrained values pub skip_underconstrained_check: bool, + + /// The higher the value, the more inlined brillig functions will be. + pub inliner_aggressiveness: i64, } pub(crate) struct ArtifactsAndWarnings(Artifacts, Vec); @@ -94,9 +97,10 @@ pub(crate) fn optimize_into_acir( .run_pass(Ssa::remove_paired_rc, "After Removing Paired rc_inc & rc_decs:") .run_pass(Ssa::separate_runtime, "After Runtime Separation:") .run_pass(Ssa::resolve_is_unconstrained, "After Resolving IsUnconstrained:") - .run_pass(Ssa::inline_functions, "After Inlining:") + .run_pass(|ssa| ssa.inline_functions(options.inliner_aggressiveness), "After Inlining:") // Run mem2reg with the CFG separated into blocks .run_pass(Ssa::mem2reg, "After Mem2Reg:") + .run_pass(Ssa::simplify_cfg, "After Simplifying:") .run_pass(Ssa::as_slice_optimization, "After `as_slice` optimization") .try_run_pass( Ssa::evaluate_static_assert_and_assert_constant, @@ -112,7 +116,10 @@ pub(crate) fn optimize_into_acir( // Before flattening is run, we treat functions marked with the `InlineType::NoPredicates` as an entry point. // This pass must come immediately following `mem2reg` as the succeeding passes // may create an SSA which inlining fails to handle. - .run_pass(Ssa::inline_functions_with_no_predicates, "After Inlining:") + .run_pass( + |ssa| ssa.inline_functions_with_no_predicates(options.inliner_aggressiveness), + "After Inlining:", + ) .run_pass(Ssa::remove_if_else, "After Remove IfElse:") .run_pass(Ssa::fold_constants, "After Constant Folding:") .run_pass(Ssa::remove_enable_side_effects, "After EnableSideEffectsIf removal:") @@ -405,7 +412,10 @@ impl SsaBuilder { } /// Runs the given SSA pass and prints the SSA afterward if `print_ssa_passes` is true. - fn run_pass(mut self, pass: fn(Ssa) -> Ssa, msg: &str) -> Self { + fn run_pass(mut self, pass: F, msg: &str) -> Self + where + F: FnOnce(Ssa) -> Ssa, + { self.ssa = time(msg, self.print_codegen_timings, || pass(self.ssa)); self.print(msg) } diff --git a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs index 1069416b7b8..db08b906185 100644 --- a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs +++ b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs @@ -1286,31 +1286,6 @@ impl AcirContext { ) -> Result, RuntimeError> { // Separate out any arguments that should be constants let (constant_inputs, constant_outputs) = match name { - BlackBoxFunc::PedersenCommitment | BlackBoxFunc::PedersenHash => { - // The last argument of pedersen is the domain separator, which must be a constant - let domain_var = match inputs.pop() { - Some(domain_var) => domain_var.into_var()?, - None => { - return Err(RuntimeError::InternalError(InternalError::MissingArg { - name: "pedersen call".to_string(), - arg: "domain separator".to_string(), - call_stack: self.get_call_stack(), - })) - } - }; - - let domain_constant = match self.vars[&domain_var].as_constant() { - Some(domain_constant) => domain_constant, - None => { - return Err(RuntimeError::InternalError(InternalError::NotAConstant { - name: "domain separator".to_string(), - call_stack: self.get_call_stack(), - })) - } - }; - - (vec![*domain_constant], Vec::new()) - } BlackBoxFunc::Poseidon2Permutation => { // The last argument is the state length, which must be a constant let state_len = match inputs.pop() { diff --git a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs index 21d4dfb60b8..01fcaef9042 100644 --- a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs +++ b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs @@ -225,16 +225,6 @@ impl GeneratedAcir { output: outputs[0], } } - BlackBoxFunc::PedersenCommitment => BlackBoxFuncCall::PedersenCommitment { - inputs: inputs[0].clone(), - outputs: (outputs[0], outputs[1]), - domain_separator: constant_inputs[0].to_u128() as u32, - }, - BlackBoxFunc::PedersenHash => BlackBoxFuncCall::PedersenHash { - inputs: inputs[0].clone(), - output: outputs[0], - domain_separator: constant_inputs[0].to_u128() as u32, - }, BlackBoxFunc::EcdsaSecp256k1 => { BlackBoxFuncCall::EcdsaSecp256k1 { // 32 bytes for each public key co-ordinate @@ -294,9 +284,6 @@ impl GeneratedAcir { input2: Box::new([inputs[3][0], inputs[4][0], inputs[5][0]]), outputs: (outputs[0], outputs[1], outputs[2]), }, - BlackBoxFunc::Keccak256 => { - unreachable!("unexpected BlackBox {}", func_name.to_string()) - } BlackBoxFunc::Keccakf1600 => BlackBoxFuncCall::Keccakf1600 { inputs: inputs[0] .clone() @@ -475,7 +462,7 @@ impl GeneratedAcir { /// /// This equation however falls short when `t != 0` because then `t` /// may not be `1`. If `t` is non-zero, then `y` is also non-zero due to - /// `y == 1 - t` and the equation `y * t == 0` fails. + /// `y == 1 - t` and the equation `y * t == 0` fails. /// /// To fix, we introduce another free variable called `z` and apply the following /// constraint instead: `y == 1 - t * z`. @@ -485,7 +472,7 @@ impl GeneratedAcir { /// /// We now arrive at the conclusion that when `t == 0`, `y` is `1` and when /// `t != 0`, then `y` is `0`. - /// + /// /// Bringing it all together, We introduce two variables `y` and `z`, /// With the following equations: /// - `y == 1 - tz` (`z` is a value that is chosen to be the inverse of `t` by the prover) @@ -643,12 +630,7 @@ fn black_box_func_expected_input_size(name: BlackBoxFunc) -> Option { // All of the hash/cipher methods will take in a // variable number of inputs. - BlackBoxFunc::AES128Encrypt - | BlackBoxFunc::Keccak256 - | BlackBoxFunc::Blake2s - | BlackBoxFunc::Blake3 - | BlackBoxFunc::PedersenCommitment - | BlackBoxFunc::PedersenHash => None, + BlackBoxFunc::AES128Encrypt | BlackBoxFunc::Blake2s | BlackBoxFunc::Blake3 => None, BlackBoxFunc::Keccakf1600 => Some(25), // The permutation takes a fixed number of inputs, but the inputs length depends on the proving system implementation. @@ -696,7 +678,7 @@ fn black_box_expected_output_size(name: BlackBoxFunc) -> Option { BlackBoxFunc::AND | BlackBoxFunc::XOR => Some(1), // 32 byte hash algorithms - BlackBoxFunc::Keccak256 | BlackBoxFunc::Blake2s | BlackBoxFunc::Blake3 => Some(32), + BlackBoxFunc::Blake2s | BlackBoxFunc::Blake3 => Some(32), BlackBoxFunc::Keccakf1600 => Some(25), // The permutation returns a fixed number of outputs, equals to the inputs length which depends on the proving system implementation. @@ -704,12 +686,6 @@ fn black_box_expected_output_size(name: BlackBoxFunc) -> Option { BlackBoxFunc::Sha256Compression => Some(8), - // Pedersen commitment returns a point - BlackBoxFunc::PedersenCommitment => Some(2), - - // Pedersen hash returns a field - BlackBoxFunc::PedersenHash => Some(1), - // Can only apply a range constraint to one // witness at a time. BlackBoxFunc::RANGE => Some(0), diff --git a/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs index b560fafd337..a5c51392114 100644 --- a/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs @@ -377,7 +377,7 @@ impl<'a> Context<'a> { match function.runtime() { RuntimeType::Acir(inline_type) => { match inline_type { - InlineType::Inline => { + InlineType::Inline | InlineType::InlineAlways => { if function.id() != ssa.main_id { panic!("ACIR function should have been inlined earlier if not marked otherwise"); } @@ -390,7 +390,7 @@ impl<'a> Context<'a> { // We only want to convert entry point functions. This being `main` and those marked with `InlineType::Fold` Ok(Some(self.convert_acir_main(function, ssa, brillig)?)) } - RuntimeType::Brillig => { + RuntimeType::Brillig(_) => { if function.id() == ssa.main_id { Ok(Some(self.convert_brillig_main(function, brillig)?)) } else { @@ -816,7 +816,7 @@ impl<'a> Context<'a> { self.handle_ssa_call_outputs(result_ids, output_values, dfg)?; } - RuntimeType::Brillig => { + RuntimeType::Brillig(_) => { // Check that we are not attempting to return a slice from // an unconstrained runtime to a constrained runtime for result_id in result_ids { @@ -2939,8 +2939,8 @@ mod test { fn build_basic_foo_with_return( builder: &mut FunctionBuilder, foo_id: FunctionId, - // `InlineType` can only exist on ACIR functions, so if the option is `None` we should generate a Brillig function - inline_type: Option, + brillig: bool, + inline_type: InlineType, ) { // fn foo f1 { // b0(v0: Field, v1: Field): @@ -2948,10 +2948,10 @@ mod test { // constrain v2 == u1 0 // return v0 // } - if let Some(inline_type) = inline_type { - builder.new_function("foo".into(), foo_id, inline_type); + if brillig { + builder.new_brillig_function("foo".into(), foo_id, inline_type); } else { - builder.new_brillig_function("foo".into(), foo_id); + builder.new_function("foo".into(), foo_id, inline_type); } // Set a call stack for testing whether `brillig_locations` in the `GeneratedAcir` was accurately set. builder.set_call_stack(vector![Location::dummy(), Location::dummy()]); @@ -3015,7 +3015,7 @@ mod test { builder.insert_constrain(main_call1_results[0], main_call2_results[0], None); builder.terminate_with_return(vec![]); - build_basic_foo_with_return(&mut builder, foo_id, Some(inline_type)); + build_basic_foo_with_return(&mut builder, foo_id, false, inline_type); let ssa = builder.finish(); @@ -3120,7 +3120,7 @@ mod test { builder.insert_constrain(main_call1_results[0], main_call2_results[0], None); builder.terminate_with_return(vec![]); - build_basic_foo_with_return(&mut builder, foo_id, Some(inline_type)); + build_basic_foo_with_return(&mut builder, foo_id, false, inline_type); let ssa = builder.finish(); @@ -3220,7 +3220,7 @@ mod test { .to_vec(); builder.terminate_with_return(vec![foo_call[0]]); - build_basic_foo_with_return(&mut builder, foo_id, Some(inline_type)); + build_basic_foo_with_return(&mut builder, foo_id, false, inline_type); let ssa = builder.finish(); @@ -3342,8 +3342,8 @@ mod test { builder.insert_call(bar, vec![main_v0, main_v1], vec![Type::field()]).to_vec(); builder.terminate_with_return(vec![]); - build_basic_foo_with_return(&mut builder, foo_id, None); - build_basic_foo_with_return(&mut builder, bar_id, None); + build_basic_foo_with_return(&mut builder, foo_id, true, InlineType::default()); + build_basic_foo_with_return(&mut builder, bar_id, true, InlineType::default()); let ssa = builder.finish(); let brillig = ssa.to_brillig(false); @@ -3479,7 +3479,7 @@ mod test { builder.terminate_with_return(vec![]); - build_basic_foo_with_return(&mut builder, foo_id, None); + build_basic_foo_with_return(&mut builder, foo_id, true, InlineType::default()); let ssa = builder.finish(); // We need to generate Brillig artifacts for the regular Brillig function and pass them to the ACIR generation pass. @@ -3565,9 +3565,9 @@ mod test { builder.terminate_with_return(vec![]); // Build a Brillig function - build_basic_foo_with_return(&mut builder, foo_id, None); + build_basic_foo_with_return(&mut builder, foo_id, true, InlineType::default()); // Build an ACIR function which has the same logic as the Brillig function above - build_basic_foo_with_return(&mut builder, bar_id, Some(InlineType::Fold)); + build_basic_foo_with_return(&mut builder, bar_id, false, InlineType::Fold); let ssa = builder.finish(); // We need to generate Brillig artifacts for the regular Brillig function and pass them to the ACIR generation pass. diff --git a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs index aa5f4c8df95..7bee18d24a0 100644 --- a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs +++ b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs @@ -27,7 +27,7 @@ impl Ssa { function_to_process, &self.functions, ), - RuntimeType::Brillig => Vec::new(), + RuntimeType::Brillig(_) => Vec::new(), } }) .collect() @@ -223,7 +223,7 @@ impl Context { } }, Value::Function(callee) => match all_functions[&callee].runtime() { - RuntimeType::Brillig => { + RuntimeType::Brillig(_) => { // For calls to brillig functions we memorize the mapping of results to argument ValueId's and InstructionId's // The latter are needed to produce the callstack later for result in @@ -351,6 +351,8 @@ impl Context { } #[cfg(test)] mod test { + use noirc_frontend::monomorphization::ast::InlineType; + use crate::ssa::{ function_builder::FunctionBuilder, ir::{instruction::BinaryOp, map::Id, types::Type}, @@ -419,7 +421,7 @@ mod test { builder.insert_constrain(v5, one, None); builder.terminate_with_return(vec![]); - builder.new_brillig_function("br".into(), br_function_id); + builder.new_brillig_function("br".into(), br_function_id, InlineType::default()); let v0 = builder.add_parameter(Type::field()); let v1 = builder.add_parameter(Type::field()); let v2 = builder.insert_binary(v0, BinaryOp::Add, v1); diff --git a/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs b/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs index 04d4e893bf8..f810b65d105 100644 --- a/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/function_builder/mod.rs @@ -95,8 +95,13 @@ impl FunctionBuilder { } /// Finish the current function and create a new unconstrained function. - pub(crate) fn new_brillig_function(&mut self, name: String, function_id: FunctionId) { - self.new_function_with_type(name, function_id, RuntimeType::Brillig); + pub(crate) fn new_brillig_function( + &mut self, + name: String, + function_id: FunctionId, + inline_type: InlineType, + ) { + self.new_function_with_type(name, function_id, RuntimeType::Brillig(inline_type)); } /// Consume the FunctionBuilder returning all the functions it has generated. diff --git a/compiler/noirc_evaluator/src/ssa/ir/function.rs b/compiler/noirc_evaluator/src/ssa/ir/function.rs index 1466f2e5d44..e8245ff6036 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/function.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/function.rs @@ -16,7 +16,7 @@ pub(crate) enum RuntimeType { // A noir function, to be compiled in ACIR and executed by ACVM Acir(InlineType), // Unconstrained function, to be compiled to brillig and executed by the Brillig VM - Brillig, + Brillig(InlineType), } impl RuntimeType { @@ -27,9 +27,25 @@ impl RuntimeType { pub(crate) fn is_entry_point(&self) -> bool { match self { RuntimeType::Acir(inline_type) => inline_type.is_entry_point(), - RuntimeType::Brillig => true, + RuntimeType::Brillig(_) => true, } } + + pub(crate) fn is_inline_always(&self) -> bool { + matches!( + self, + RuntimeType::Acir(InlineType::InlineAlways) + | RuntimeType::Brillig(InlineType::InlineAlways) + ) + } + + pub(crate) fn is_no_predicates(&self) -> bool { + matches!( + self, + RuntimeType::Acir(InlineType::NoPredicates) + | RuntimeType::Brillig(InlineType::NoPredicates) + ) + } } /// A function holds a list of instructions. @@ -103,7 +119,7 @@ impl Function { pub(crate) fn is_no_predicates(&self) -> bool { match self.runtime() { RuntimeType::Acir(inline_type) => matches!(inline_type, InlineType::NoPredicates), - RuntimeType::Brillig => false, + RuntimeType::Brillig(_) => false, } } @@ -177,7 +193,7 @@ impl std::fmt::Display for RuntimeType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { RuntimeType::Acir(inline_type) => write!(f, "acir({inline_type})"), - RuntimeType::Brillig => write!(f, "brillig"), + RuntimeType::Brillig(inline_type) => write!(f, "brillig({inline_type})"), } } } diff --git a/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs b/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs index 8b540d45664..0bf7fe6a146 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs @@ -533,9 +533,6 @@ fn simplify_black_box_func( SimplifyResult::None } } - BlackBoxFunc::Keccak256 => { - unreachable!("Keccak256 should have been replaced by calls to Keccakf1600") - } BlackBoxFunc::Poseidon2Permutation => { blackbox::simplify_poseidon2_permutation(dfg, solver, arguments) } @@ -550,9 +547,7 @@ fn simplify_black_box_func( acvm::blackbox_solver::ecdsa_secp256r1_verify, ), - BlackBoxFunc::PedersenCommitment - | BlackBoxFunc::PedersenHash - | BlackBoxFunc::MultiScalarMul => SimplifyResult::None, + BlackBoxFunc::MultiScalarMul => SimplifyResult::None, BlackBoxFunc::EmbeddedCurveAdd => blackbox::simplify_ec_add(dfg, solver, arguments), BlackBoxFunc::SchnorrVerify => blackbox::simplify_schnorr_verify(dfg, solver, arguments), diff --git a/compiler/noirc_evaluator/src/ssa/ir/instruction/call/blackbox.rs b/compiler/noirc_evaluator/src/ssa/ir/instruction/call/blackbox.rs index 7789b212e58..3881646d5e4 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/instruction/call/blackbox.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/instruction/call/blackbox.rs @@ -1,5 +1,3 @@ -use std::sync::Arc; - use acvm::{acir::AcirField, BlackBoxFunctionSolver, BlackBoxResolutionError, FieldElement}; use iter_extended::vecmap; @@ -41,13 +39,11 @@ pub(super) fn simplify_ec_add( return SimplifyResult::None; }; - let result_x = dfg.make_constant(result_x, Type::field()); - let result_y = dfg.make_constant(result_y, Type::field()); - let result_is_infinity = dfg.make_constant(result_is_infinity, Type::bool()); - - let typ = Type::Array(Arc::new(vec![Type::field()]), 3); - let result_array = - dfg.make_array(im::vector![result_x, result_y, result_is_infinity], typ); + let result_array = make_constant_array( + dfg, + vec![result_x, result_y, result_is_infinity], + Type::field(), + ); SimplifyResult::SimplifiedTo(result_array) } diff --git a/compiler/noirc_evaluator/src/ssa/opt/array_set.rs b/compiler/noirc_evaluator/src/ssa/opt/array_set.rs index b2fe137c8bc..6ae13bc085a 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/array_set.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/array_set.rs @@ -34,7 +34,8 @@ impl Function { assert_eq!(reachable_blocks.len(), 1, "Expected there to be 1 block remaining in Acir function for array_set optimization"); } - let mut context = Context::new(&self.dfg, matches!(self.runtime(), RuntimeType::Brillig)); + let mut context = + Context::new(&self.dfg, matches!(self.runtime(), RuntimeType::Brillig(_))); for block in reachable_blocks.iter() { context.analyze_last_uses(*block); @@ -180,6 +181,7 @@ mod tests { use std::sync::Arc; use im::vector; + use noirc_frontend::monomorphization::ast::InlineType; use crate::ssa::{ function_builder::FunctionBuilder, @@ -227,7 +229,7 @@ mod tests { // } let main_id = Id::test_new(0); let mut builder = FunctionBuilder::new("main".into(), main_id); - builder.set_runtime(RuntimeType::Brillig); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); let array_type = Type::Array(Arc::new(vec![Type::field()]), 5); let zero = builder.field_constant(0u128); diff --git a/compiler/noirc_evaluator/src/ssa/opt/flatten_cfg.rs b/compiler/noirc_evaluator/src/ssa/opt/flatten_cfg.rs index cb455507985..984f639df00 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/flatten_cfg.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/flatten_cfg.rs @@ -142,7 +142,7 @@ use crate::ssa::{ basic_block::BasicBlockId, cfg::ControlFlowGraph, dfg::{CallStack, InsertInstructionResult}, - function::{Function, FunctionId}, + function::{Function, FunctionId, RuntimeType}, function_inserter::FunctionInserter, instruction::{BinaryOp, Instruction, InstructionId, Intrinsic, TerminatorInstruction}, types::Type, @@ -254,7 +254,7 @@ fn flatten_function_cfg(function: &mut Function, no_predicates: &HashMap Ssa { - Self::inline_functions_inner(self, false) + pub(crate) fn inline_functions(self, aggressiveness: i64) -> Ssa { + Self::inline_functions_inner(self, aggressiveness, false) } // Run the inlining pass where functions marked with `InlineType::NoPredicates` as not entry points - pub(crate) fn inline_functions_with_no_predicates(self) -> Ssa { - Self::inline_functions_inner(self, true) - } - - fn inline_functions_inner(mut self, inline_no_predicates_functions: bool) -> Ssa { - let recursive_functions = find_all_recursive_functions(&self); - self.functions = btree_map( - get_functions_to_inline_into(&self, inline_no_predicates_functions), - |entry_point| { - let new_function = InlineContext::new( - &self, - entry_point, - inline_no_predicates_functions, - recursive_functions.clone(), - ) - .inline_all(&self); - (entry_point, new_function) - }, - ); + pub(crate) fn inline_functions_with_no_predicates(self, aggressiveness: i64) -> Ssa { + Self::inline_functions_inner(self, aggressiveness, true) + } + + fn inline_functions_inner( + mut self, + aggressiveness: i64, + inline_no_predicates_functions: bool, + ) -> Ssa { + let inline_sources = + get_functions_to_inline_into(&self, inline_no_predicates_functions, aggressiveness); + self.functions = btree_map(&inline_sources, |entry_point| { + let new_function = InlineContext::new( + &self, + *entry_point, + inline_no_predicates_functions, + inline_sources.clone(), + ) + .inline_all(&self); + (*entry_point, new_function) + }); self } } @@ -93,8 +95,8 @@ struct InlineContext { /// the control flow graph has been flattened. inline_no_predicates_functions: bool, - // We keep track of the recursive functions in the SSA to avoid inlining them in a brillig context. - recursive_functions: BTreeSet, + // These are the functions of the program that we shouldn't inline. + functions_not_to_inline: BTreeSet, } /// The per-function inlining context contains information that is only valid for one function. @@ -129,8 +131,8 @@ struct PerFunctionContext<'function> { } /// Utility function to find out the direct calls of a function. -fn called_functions(func: &Function) -> BTreeSet { - let mut called_function_ids = BTreeSet::default(); +fn called_functions_vec(func: &Function) -> Vec { + let mut called_function_ids = Vec::new(); for block_id in func.reachable_blocks() { for instruction_id in func.dfg[block_id].instructions() { let Instruction::Call { func: called_value_id, .. } = &func.dfg[*instruction_id] else { @@ -138,7 +140,7 @@ fn called_functions(func: &Function) -> BTreeSet { }; if let Value::Function(function_id) = func.dfg[*called_value_id] { - called_function_ids.insert(function_id); + called_function_ids.push(function_id); } } } @@ -146,52 +148,32 @@ fn called_functions(func: &Function) -> BTreeSet { called_function_ids } -// Recursively explore the SSA to find the functions that end up calling themselves -fn find_recursive_functions( - ssa: &Ssa, - current_function: FunctionId, - mut explored_functions: im::HashSet, - recursive_functions: &mut BTreeSet, -) { - if explored_functions.contains(¤t_function) { - recursive_functions.insert(current_function); - return; - } - - let called_functions = called_functions(&ssa.functions[¤t_function]); - - explored_functions.insert(current_function); - - for called_function in called_functions { - find_recursive_functions( - ssa, - called_function, - explored_functions.clone(), - recursive_functions, - ); - } -} - -fn find_all_recursive_functions(ssa: &Ssa) -> BTreeSet { - let mut recursive_functions = BTreeSet::default(); - find_recursive_functions(ssa, ssa.main_id, im::HashSet::default(), &mut recursive_functions); - recursive_functions +/// Utility function to find out the deduplicated direct calls of a function. +fn called_functions(func: &Function) -> BTreeSet { + called_functions_vec(func).into_iter().collect() } /// The functions we should inline into (and that should be left in the final program) are: /// - main /// - Any Brillig function called from Acir -/// - Any Brillig recursive function (Acir recursive functions will be inlined into the main function) +/// - Some Brillig functions depending on aggressiveness and some metrics /// - Any Acir functions with a [fold inline type][InlineType::Fold], fn get_functions_to_inline_into( ssa: &Ssa, inline_no_predicates_functions: bool, + aggressiveness: i64, ) -> BTreeSet { let mut brillig_entry_points = BTreeSet::default(); let mut acir_entry_points = BTreeSet::default(); + if matches!(ssa.main().runtime(), RuntimeType::Brillig(_)) { + brillig_entry_points.insert(ssa.main_id); + } else { + acir_entry_points.insert(ssa.main_id); + } + for (func_id, function) in ssa.functions.iter() { - if function.runtime() == RuntimeType::Brillig { + if matches!(function.runtime(), RuntimeType::Brillig(_)) { continue; } @@ -203,27 +185,167 @@ fn get_functions_to_inline_into( } for called_function_id in called_functions(function) { - if ssa.functions[&called_function_id].runtime() == RuntimeType::Brillig { + if matches!(ssa.functions[&called_function_id].runtime(), RuntimeType::Brillig(_)) { brillig_entry_points.insert(called_function_id); } } } - let brillig_recursive_functions: BTreeSet<_> = find_all_recursive_functions(ssa) + let times_called = compute_times_called(ssa); + + let brillig_functions_to_retain: BTreeSet<_> = compute_functions_to_retain( + ssa, + &brillig_entry_points, + ×_called, + inline_no_predicates_functions, + aggressiveness, + ); + + acir_entry_points .into_iter() - .filter(|recursive_function_id| { - let function = &ssa.functions[&recursive_function_id]; - function.runtime() == RuntimeType::Brillig + .chain(brillig_entry_points) + .chain(brillig_functions_to_retain) + .collect() +} + +fn compute_times_called(ssa: &Ssa) -> HashMap { + ssa.functions + .iter() + .flat_map(|(_caller_id, function)| { + let called_functions_vec = called_functions_vec(function); + called_functions_vec.into_iter() }) - .collect(); + .chain(std::iter::once(ssa.main_id)) + .fold(HashMap::default(), |mut map, func_id| { + *map.entry(func_id).or_insert(0) += 1; + map + }) +} - std::iter::once(ssa.main_id) - .chain(acir_entry_points) - .chain(brillig_entry_points) - .chain(brillig_recursive_functions) +fn should_retain_recursive( + ssa: &Ssa, + func: FunctionId, + times_called: &HashMap, + should_retain_function: &mut HashMap, + mut explored_functions: im::HashSet, + inline_no_predicates_functions: bool, + aggressiveness: i64, +) { + // We have already decided on this function + if should_retain_function.get(&func).is_some() { + return; + } + // Recursive, this function won't be inlined + if explored_functions.contains(&func) { + should_retain_function.insert(func, (true, 0)); + return; + } + explored_functions.insert(func); + + // Decide on dependencies first + let called_functions = called_functions(&ssa.functions[&func]); + for function in called_functions.iter() { + should_retain_recursive( + ssa, + *function, + times_called, + should_retain_function, + explored_functions.clone(), + inline_no_predicates_functions, + aggressiveness, + ); + } + // We could have decided on this function while deciding on dependencies + // If the function is recursive + if should_retain_function.get(&func).is_some() { + return; + } + + // We'll use some heuristics to decide whether to inline or not. + // We compute the weight (roughly the number of instructions) of the function after inlining + // And the interface cost of the function (the inherent cost at the callsite, roughly the number of args and returns) + // We then can compute an approximation of the cost of inlining vs the cost of retaining the function + // We do this computation using saturating i64s to avoid overflows + let inlined_function_weights: i64 = called_functions.iter().fold(0, |acc, called_function| { + let (should_retain, weight) = should_retain_function[called_function]; + if should_retain { + acc + } else { + acc.saturating_add(weight) + } + }); + + let this_function_weight = inlined_function_weights + .saturating_add(compute_function_own_weight(&ssa.functions[&func]) as i64); + + let interface_cost = compute_function_interface_cost(&ssa.functions[&func]) as i64; + + let times_called = times_called[&func] as i64; + + let inline_cost = times_called.saturating_mul(this_function_weight); + let retain_cost = times_called.saturating_mul(interface_cost) + this_function_weight; + + let runtime = ssa.functions[&func].runtime(); + // We inline if the aggressiveness is higher than inline cost minus the retain cost + // If aggressiveness is infinite, we'll always inline + // If aggressiveness is 0, we'll inline when the inline cost is lower than the retain cost + // If aggressiveness is minus infinity, we'll never inline (other than in the mandatory cases) + let should_inline = ((inline_cost.saturating_sub(retain_cost)) < aggressiveness) + || runtime.is_inline_always() + || (runtime.is_no_predicates() && inline_no_predicates_functions); + + should_retain_function.insert(func, (!should_inline, this_function_weight)); +} + +fn compute_functions_to_retain( + ssa: &Ssa, + entry_points: &BTreeSet, + times_called: &HashMap, + inline_no_predicates_functions: bool, + aggressiveness: i64, +) -> BTreeSet { + let mut should_retain_function = HashMap::default(); + + for entry_point in entry_points.iter() { + should_retain_recursive( + ssa, + *entry_point, + times_called, + &mut should_retain_function, + im::HashSet::default(), + inline_no_predicates_functions, + aggressiveness, + ); + } + + should_retain_function + .into_iter() + .filter_map( + |(func_id, (should_retain, _))| { + if should_retain { + Some(func_id) + } else { + None + } + }, + ) .collect() } +fn compute_function_own_weight(func: &Function) -> usize { + let mut weight = 0; + for block_id in func.reachable_blocks() { + weight += func.dfg[block_id].instructions().len() + 1; // We add one for the terminator + } + // We use an approximation of the average increase in instruction ratio from SSA to Brillig + // In order to get the actual weight we'd need to codegen this function to brillig. + weight +} + +fn compute_function_interface_cost(func: &Function) -> usize { + func.parameters().len() + func.returns().len() +} + impl InlineContext { /// Create a new context object for the function inlining pass. /// This starts off with an empty mapping of instructions for main's parameters. @@ -234,7 +356,7 @@ impl InlineContext { ssa: &Ssa, entry_point: FunctionId, inline_no_predicates_functions: bool, - recursive_functions: BTreeSet, + functions_not_to_inline: BTreeSet, ) -> InlineContext { let source = &ssa.functions[&entry_point]; let mut builder = FunctionBuilder::new(source.name().to_owned(), entry_point); @@ -245,7 +367,7 @@ impl InlineContext { entry_point, call_stack: CallStack::new(), inline_no_predicates_functions, - recursive_functions, + functions_not_to_inline, } } @@ -526,8 +648,8 @@ impl<'function> PerFunctionContext<'function> { !inline_type.is_entry_point() && !preserve_function } else { // If the called function is brillig, we inline only if it's into brillig and the function is not recursive - ssa.functions[&self.context.entry_point].runtime() == RuntimeType::Brillig - && !self.context.recursive_functions.contains(&called_func_id) + matches!(ssa.functions[&self.context.entry_point].runtime(), RuntimeType::Brillig(_)) + && !self.context.functions_not_to_inline.contains(&called_func_id) } } @@ -696,9 +818,10 @@ mod test { function_builder::FunctionBuilder, ir::{ basic_block::BasicBlockId, + function::RuntimeType, instruction::{BinaryOp, Intrinsic, TerminatorInstruction}, map::Id, - types::Type, + types::{NumericType, Type}, }, }; @@ -729,7 +852,7 @@ mod test { let ssa = builder.finish(); assert_eq!(ssa.functions.len(), 2); - let inlined = ssa.inline_functions(); + let inlined = ssa.inline_functions(i64::MAX); assert_eq!(inlined.functions.len(), 1); } @@ -795,7 +918,7 @@ mod test { let ssa = builder.finish(); assert_eq!(ssa.functions.len(), 4); - let inlined = ssa.inline_functions(); + let inlined = ssa.inline_functions(i64::MAX); assert_eq!(inlined.functions.len(), 1); } @@ -869,7 +992,7 @@ mod test { // b6(): // return Field 120 // } - let inlined = ssa.inline_functions(); + let inlined = ssa.inline_functions(i64::MAX); assert_eq!(inlined.functions.len(), 1); let main = inlined.main(); @@ -952,7 +1075,7 @@ mod test { builder.switch_to_block(join_block); builder.terminate_with_return(vec![join_param]); - let ssa = builder.finish().inline_functions(); + let ssa = builder.finish().inline_functions(i64::MAX); // Expected result: // fn main f3 { // b0(v0: u1): @@ -989,7 +1112,96 @@ mod test { let ssa = builder.finish(); assert_eq!(ssa.functions.len(), 1); - let inlined = ssa.inline_functions(); + let inlined = ssa.inline_functions(i64::MAX); assert_eq!(inlined.functions.len(), 0); } + + #[test] + fn inliner_disabled() { + // brillig fn foo { + // b0(): + // v0 = call bar() + // return v0 + // } + // brillig fn bar { + // b0(): + // return 72 + // } + let foo_id = Id::test_new(0); + let mut builder = FunctionBuilder::new("foo".into(), foo_id); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); + + let bar_id = Id::test_new(1); + let bar = builder.import_function(bar_id); + let results = builder.insert_call(bar, Vec::new(), vec![Type::field()]).to_vec(); + builder.terminate_with_return(results); + + builder.new_brillig_function("bar".into(), bar_id, InlineType::default()); + let expected_return = 72u128; + let seventy_two = builder.field_constant(expected_return); + builder.terminate_with_return(vec![seventy_two]); + + let ssa = builder.finish(); + assert_eq!(ssa.functions.len(), 2); + + let inlined = ssa.inline_functions(i64::MIN); + // No inlining has happened + assert_eq!(inlined.functions.len(), 2); + } + + #[test] + fn conditional_inlining() { + // In this example we call a larger brillig function 3 times so the inliner refuses to inline the function. + // brillig fn foo { + // b0(): + // v0 = call bar() + // v1 = call bar() + // v2 = call bar() + // return v0 + // } + // brillig fn bar { + // b0(): + // jmpif 1 then: b1, else: b2 + // b1(): + // jmp b3(Field 1) + // b3(v3: Field): + // return v3 + // b2(): + // jmp b3(Field 2) + // } + let foo_id = Id::test_new(0); + let mut builder = FunctionBuilder::new("foo".into(), foo_id); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); + + let bar_id = Id::test_new(1); + let bar = builder.import_function(bar_id); + let v0 = builder.insert_call(bar, Vec::new(), vec![Type::field()]).to_vec(); + let _v1 = builder.insert_call(bar, Vec::new(), vec![Type::field()]).to_vec(); + let _v2 = builder.insert_call(bar, Vec::new(), vec![Type::field()]).to_vec(); + builder.terminate_with_return(v0); + + builder.new_brillig_function("bar".into(), bar_id, InlineType::default()); + let bar_v0 = + builder.numeric_constant(1_usize, Type::Numeric(NumericType::Unsigned { bit_size: 1 })); + let then_block = builder.insert_block(); + let else_block = builder.insert_block(); + let join_block = builder.insert_block(); + builder.terminate_with_jmpif(bar_v0, then_block, else_block); + builder.switch_to_block(then_block); + let one = builder.numeric_constant(FieldElement::one(), Type::field()); + builder.terminate_with_jmp(join_block, vec![one]); + builder.switch_to_block(else_block); + let two = builder.numeric_constant(FieldElement::from(2_u128), Type::field()); + builder.terminate_with_jmp(join_block, vec![two]); + let join_param = builder.add_block_parameter(join_block, Type::field()); + builder.switch_to_block(join_block); + builder.terminate_with_return(vec![join_param]); + + let ssa = builder.finish(); + assert_eq!(ssa.functions.len(), 2); + + let inlined = ssa.inline_functions(0); + // No inlining has happened + assert_eq!(inlined.functions.len(), 2); + } } diff --git a/compiler/noirc_evaluator/src/ssa/opt/rc.rs b/compiler/noirc_evaluator/src/ssa/opt/rc.rs index c879f6c8fff..c3606ac4311 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/rc.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/rc.rs @@ -155,6 +155,8 @@ fn remove_instructions(to_remove: HashSet, function: &mut Functio mod test { use std::sync::Arc; + use noirc_frontend::monomorphization::ast::InlineType; + use crate::ssa::{ function_builder::FunctionBuilder, ir::{ @@ -199,7 +201,7 @@ mod test { // } let main_id = Id::test_new(0); let mut builder = FunctionBuilder::new("foo".into(), main_id); - builder.set_runtime(RuntimeType::Brillig); + builder.set_runtime(RuntimeType::Brillig(InlineType::default())); let inner_array_type = Type::Array(Arc::new(vec![Type::field()]), 2); let v0 = builder.add_parameter(inner_array_type.clone()); diff --git a/compiler/noirc_evaluator/src/ssa/opt/remove_bit_shifts.rs b/compiler/noirc_evaluator/src/ssa/opt/remove_bit_shifts.rs index 4b2d753f072..6f3f2fa14b7 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/remove_bit_shifts.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/remove_bit_shifts.rs @@ -31,7 +31,7 @@ impl Function { /// The structure of this pass is simple: /// Go through each block and re-insert all instructions. pub(crate) fn remove_bit_shifts(&mut self) { - if let RuntimeType::Brillig = self.runtime() { + if matches!(self.runtime(), RuntimeType::Brillig(_)) { return; } diff --git a/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs b/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs index daae2cb08ce..222ae0aaf29 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/remove_enable_side_effects.rs @@ -37,7 +37,7 @@ impl Ssa { impl Function { pub(crate) fn remove_enable_side_effects(&mut self) { - if matches!(self.runtime(), RuntimeType::Brillig) { + if matches!(self.runtime(), RuntimeType::Brillig(_)) { // Brillig functions do not make use of the `EnableSideEffects` instruction so are unaffected by this pass. return; } diff --git a/compiler/noirc_evaluator/src/ssa/opt/remove_if_else.rs b/compiler/noirc_evaluator/src/ssa/opt/remove_if_else.rs index 299669b9564..bfcfada2d94 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/remove_if_else.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/remove_if_else.rs @@ -3,6 +3,7 @@ use std::collections::hash_map::Entry; use acvm::{acir::AcirField, FieldElement}; use fxhash::FxHashMap as HashMap; +use crate::ssa::ir::function::RuntimeType; use crate::ssa::ir::value::ValueId; use crate::ssa::{ ir::{ @@ -37,7 +38,7 @@ impl Ssa { impl Function { pub(crate) fn remove_if_else(&mut self) { // This should match the check in flatten_cfg - if let crate::ssa::ir::function::RuntimeType::Brillig = self.runtime() { + if matches!(self.runtime(), RuntimeType::Brillig(_)) { // skip } else { Context::default().remove_if_else(self); diff --git a/compiler/noirc_evaluator/src/ssa/opt/resolve_is_unconstrained.rs b/compiler/noirc_evaluator/src/ssa/opt/resolve_is_unconstrained.rs index 1768cbddec3..3d40c88d704 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/resolve_is_unconstrained.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/resolve_is_unconstrained.rs @@ -48,7 +48,7 @@ impl Function { self.dfg.replace_result(instruction_id, original_return_id); let is_within_unconstrained = self.dfg.make_constant( - FieldElement::from(matches!(self.runtime(), RuntimeType::Brillig)), + FieldElement::from(matches!(self.runtime(), RuntimeType::Brillig(_))), Type::bool(), ); // Replace all uses of the original return value with the constant diff --git a/compiler/noirc_evaluator/src/ssa/opt/runtime_separation.rs b/compiler/noirc_evaluator/src/ssa/opt/runtime_separation.rs index c0c9c0a1372..5628e12b9ae 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/runtime_separation.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/runtime_separation.rs @@ -70,7 +70,7 @@ impl RuntimeSeparatorContext { processed_functions.insert((within_brillig, current_func_id)); let func = &ssa.functions[¤t_func_id]; - if func.runtime() == RuntimeType::Brillig { + if matches!(func.runtime(), RuntimeType::Brillig(_)) { within_brillig = true; } @@ -97,17 +97,20 @@ impl RuntimeSeparatorContext { fn convert_acir_functions_called_from_brillig_to_brillig(&mut self, ssa: &mut Ssa) { for acir_func_id in self.acir_functions_called_from_brillig.iter() { + let RuntimeType::Acir(inline_type) = ssa.functions[acir_func_id].runtime() else { + unreachable!("Function to transform to brillig should be ACIR") + }; let cloned_id = ssa.clone_fn(*acir_func_id); let new_func = ssa.functions.get_mut(&cloned_id).expect("Cloned function should exist in SSA"); - new_func.set_runtime(RuntimeType::Brillig); + new_func.set_runtime(RuntimeType::Brillig(inline_type)); self.mapped_functions.insert(*acir_func_id, cloned_id); } } fn replace_calls_to_mapped_functions(&self, ssa: &mut Ssa) { for (_function_id, func) in ssa.functions.iter_mut() { - if func.runtime() == RuntimeType::Brillig { + if matches!(func.runtime(), RuntimeType::Brillig(_)) { for called_func_value_id in called_functions_values(func).iter() { let Value::Function(called_func_id) = &func.dfg[*called_func_value_id] else { unreachable!("Value should be a function") @@ -207,7 +210,7 @@ mod test { // } let foo_id = Id::test_new(0); let mut builder = FunctionBuilder::new("foo".into(), foo_id); - builder.current_function.set_runtime(RuntimeType::Brillig); + builder.current_function.set_runtime(RuntimeType::Brillig(InlineType::default())); let bar_id = Id::test_new(1); let bar = builder.import_function(bar_id); @@ -239,7 +242,7 @@ mod test { // All functions should be brillig now for func in separated.functions.values() { - assert_eq!(func.runtime(), RuntimeType::Brillig); + assert_eq!(func.runtime(), RuntimeType::Brillig(InlineType::default())); } } @@ -289,7 +292,7 @@ mod test { let v1 = builder.insert_call(baz, Vec::new(), vec![Type::field()]).to_vec(); builder.terminate_with_return(vec![v0[0], v1[0]]); - builder.new_brillig_function("bar".into(), bar_id); + builder.new_brillig_function("bar".into(), bar_id, InlineType::default()); let baz = builder.import_function(baz_id); let v0 = builder.insert_call(baz, Vec::new(), vec![Type::field()]).to_vec(); builder.terminate_with_return(v0); @@ -337,12 +340,12 @@ mod test { let baz_acir = find_func_by_name(&separated, &main_calls, "baz"); assert_eq!(baz_acir.runtime(), RuntimeType::Acir(InlineType::Inline)); - assert_eq!(bar.runtime(), RuntimeType::Brillig); + assert_eq!(bar.runtime(), RuntimeType::Brillig(InlineType::default())); let bar_calls = called_functions(bar); assert_eq!(bar_calls.len(), 1); let baz_brillig = find_func_by_name(&separated, &bar_calls, "baz"); - assert_eq!(baz_brillig.runtime(), RuntimeType::Brillig); + assert_eq!(baz_brillig.runtime(), RuntimeType::Brillig(InlineType::default())); } } diff --git a/compiler/noirc_evaluator/src/ssa/opt/unrolling.rs b/compiler/noirc_evaluator/src/ssa/opt/unrolling.rs index d6ed11ddf0e..5fe0d00c2b9 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/unrolling.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/unrolling.rs @@ -114,7 +114,7 @@ impl Function { // Loop unrolling in brillig can lead to a code explosion currently. This can // also be true for ACIR, but we have no alternative to unrolling in ACIR. // Brillig also generally prefers smaller code rather than faster code. - if self.runtime() != RuntimeType::Brillig { + if !matches!(self.runtime(), RuntimeType::Brillig(_)) { errors.extend(find_all_loops(self).unroll_each_loop(self)); } } diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs index c71c3a33edf..0c6041029da 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs @@ -128,7 +128,7 @@ impl<'a> FunctionContext<'a> { ) { self.definitions.clear(); if func.unconstrained || (force_brillig_runtime && func.inline_type != InlineType::Inline) { - self.builder.new_brillig_function(func.name.clone(), id); + self.builder.new_brillig_function(func.name.clone(), id, func.inline_type); } else { self.builder.new_function(func.name.clone(), id, func.inline_type); } diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs index 2318fea8960..8bf3a740b3a 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs @@ -58,7 +58,7 @@ pub(crate) fn generate_ssa( main.name.clone(), &main.parameters, if force_brillig_runtime || main.unconstrained { - RuntimeType::Brillig + RuntimeType::Brillig(main.inline_type) } else { RuntimeType::Acir(main.inline_type) }, diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/program.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/program.rs index fe786da16ca..3dba6dc0a98 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/program.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/program.rs @@ -54,7 +54,7 @@ impl Ssa { let runtime = func.runtime(); match func.runtime() { RuntimeType::Acir(_) => runtime.is_entry_point() || func.id() == main_id, - RuntimeType::Brillig => false, + RuntimeType::Brillig(_) => false, } }) .enumerate(), diff --git a/compiler/noirc_frontend/src/ast/function.rs b/compiler/noirc_frontend/src/ast/function.rs index 4f55e4c2c76..70d2b3dbb39 100644 --- a/compiler/noirc_frontend/src/ast/function.rs +++ b/compiler/noirc_frontend/src/ast/function.rs @@ -117,6 +117,7 @@ impl From for NoirFunction { Some(FunctionAttribute::Recursive) => FunctionKind::Recursive, Some(FunctionAttribute::Fold) => FunctionKind::Normal, Some(FunctionAttribute::NoPredicates) => FunctionKind::Normal, + Some(FunctionAttribute::InlineAlways) => FunctionKind::Normal, None => FunctionKind::Normal, }; diff --git a/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs b/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs index 1011d71be16..273f34a8a5e 100644 --- a/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs +++ b/compiler/noirc_frontend/src/hir/comptime/interpreter/builtin.rs @@ -134,6 +134,9 @@ impl<'local, 'context> Interpreter<'local, 'context> { "function_def_set_return_public" => { function_def_set_return_public(self, arguments, location) } + "function_def_set_return_data" => { + function_def_set_return_data(self, arguments, location) + } "function_def_set_unconstrained" => { function_def_set_unconstrained(self, arguments, location) } @@ -2252,7 +2255,10 @@ fn function_def_add_attribute( } } - if let Attribute::Secondary(SecondaryAttribute::Tag(attribute)) = attribute { + if let Attribute::Secondary( + SecondaryAttribute::Tag(attribute) | SecondaryAttribute::Meta(attribute), + ) = attribute + { let func_meta = interpreter.elaborator.interner.function_meta_mut(&func_id); func_meta.custom_attributes.push(attribute); } @@ -2525,6 +2531,23 @@ fn function_def_set_return_public( Ok(Value::Unit) } +// fn set_return_data(self) +fn function_def_set_return_data( + interpreter: &mut Interpreter, + arguments: Vec<(Value, Location)>, + location: Location, +) -> IResult { + let self_argument = check_one_argument(arguments, location)?; + + let func_id = get_function_def(self_argument)?; + check_function_not_yet_resolved(interpreter, func_id, location)?; + + let func_meta = interpreter.elaborator.interner.function_meta_mut(&func_id); + func_meta.return_visibility = Visibility::ReturnData; + + Ok(Value::Unit) +} + // fn set_unconstrained(self, value: bool) fn function_def_set_unconstrained( interpreter: &mut Interpreter, diff --git a/compiler/noirc_frontend/src/lexer/token.rs b/compiler/noirc_frontend/src/lexer/token.rs index 4037135a889..a8e463fb93b 100644 --- a/compiler/noirc_frontend/src/lexer/token.rs +++ b/compiler/noirc_frontend/src/lexer/token.rs @@ -796,6 +796,7 @@ impl Attribute { ["recursive"] => Attribute::Function(FunctionAttribute::Recursive), ["fold"] => Attribute::Function(FunctionAttribute::Fold), ["no_predicates"] => Attribute::Function(FunctionAttribute::NoPredicates), + ["inline_always"] => Attribute::Function(FunctionAttribute::InlineAlways), ["test", name] => { validate(name)?; let malformed_scope = @@ -856,6 +857,7 @@ pub enum FunctionAttribute { Recursive, Fold, NoPredicates, + InlineAlways, } impl FunctionAttribute { @@ -903,6 +905,13 @@ impl FunctionAttribute { matches!(self, FunctionAttribute::NoPredicates) } + /// Check whether we have an `inline_always` attribute + /// This is used to indicate that a function should always be inlined + /// regardless of the target runtime. + pub fn is_inline_always(&self) -> bool { + matches!(self, FunctionAttribute::InlineAlways) + } + pub fn name(&self) -> &'static str { match self { FunctionAttribute::Foreign(_) => "foreign", @@ -912,6 +921,7 @@ impl FunctionAttribute { FunctionAttribute::Recursive => "recursive", FunctionAttribute::Fold => "fold", FunctionAttribute::NoPredicates => "no_predicates", + FunctionAttribute::InlineAlways => "inline_always", } } } @@ -926,6 +936,7 @@ impl fmt::Display for FunctionAttribute { FunctionAttribute::Recursive => write!(f, "#[recursive]"), FunctionAttribute::Fold => write!(f, "#[fold]"), FunctionAttribute::NoPredicates => write!(f, "#[no_predicates]"), + FunctionAttribute::InlineAlways => write!(f, "#[inline_always]"), } } } @@ -1052,6 +1063,7 @@ impl AsRef for FunctionAttribute { FunctionAttribute::Recursive => "", FunctionAttribute::Fold => "", FunctionAttribute::NoPredicates => "", + FunctionAttribute::InlineAlways => "", } } } diff --git a/compiler/noirc_frontend/src/monomorphization/ast.rs b/compiler/noirc_frontend/src/monomorphization/ast.rs index eb6b4bf7bd4..1b4bafd9d78 100644 --- a/compiler/noirc_frontend/src/monomorphization/ast.rs +++ b/compiler/noirc_frontend/src/monomorphization/ast.rs @@ -222,6 +222,8 @@ pub enum InlineType { /// All function calls are expected to be inlined into a single ACIR. #[default] Inline, + /// Functions marked as inline always will always be inlined, even in brillig contexts. + InlineAlways, /// Functions marked as foldable will not be inlined and compiled separately into ACIR Fold, /// Functions marked to have no predicates will not be inlined in the default inlining pass @@ -239,6 +241,7 @@ impl From<&Attributes> for InlineType { match func_attribute { FunctionAttribute::Fold => InlineType::Fold, FunctionAttribute::NoPredicates => InlineType::NoPredicates, + FunctionAttribute::InlineAlways => InlineType::InlineAlways, _ => InlineType::default(), } }) @@ -249,6 +252,7 @@ impl InlineType { pub fn is_entry_point(&self) -> bool { match self { InlineType::Inline => false, + InlineType::InlineAlways => false, InlineType::Fold => true, InlineType::NoPredicates => false, } @@ -259,6 +263,7 @@ impl std::fmt::Display for InlineType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { InlineType::Inline => write!(f, "inline"), + InlineType::InlineAlways => write!(f, "inline_always"), InlineType::Fold => write!(f, "fold"), InlineType::NoPredicates => write!(f, "no_predicates"), } @@ -320,7 +325,7 @@ pub struct Program { pub main_function_signature: FunctionSignature, pub return_location: Option, pub return_visibility: Visibility, - /// Indicates to a backend whether a SNARK-friendly prover should be used. + /// Indicates to a backend whether a SNARK-friendly prover should be used. pub recursive: bool, pub debug_variables: DebugVariables, pub debug_functions: DebugFunctions, diff --git a/compiler/noirc_frontend/src/tests.rs b/compiler/noirc_frontend/src/tests.rs index b2800717d90..17acd17dcc9 100644 --- a/compiler/noirc_frontend/src/tests.rs +++ b/compiler/noirc_frontend/src/tests.rs @@ -195,7 +195,7 @@ fn check_trait_implementation_duplicate_method() { x + 2 * y } } - + fn main() { let _ = Foo { bar: 1, array: [2, 3] }; // silence Foo never constructed warning }"; @@ -644,7 +644,7 @@ fn check_impl_struct_not_trait() { Self { bar: x, array: [x,y] } } } - + fn main() { let _ = Default { x: 1, z: 1 }; // silence Default never constructed warning } @@ -1572,7 +1572,7 @@ fn struct_numeric_generic_in_function() { inner: u64 } - pub fn bar() { + pub fn bar() { let _ = Foo { inner: 1 }; // silence Foo never constructed warning } "#; @@ -2156,7 +2156,7 @@ fn numeric_generics_type_kind_mismatch() { } global M: u16 = 3; - + fn main() { let _ = bar::(); } @@ -2194,7 +2194,7 @@ fn numeric_generics_value_kind_mismatch_u32_u64() { } impl BoundedVec { - pub fn extend_from_bounded_vec(&mut self, _vec: BoundedVec) { + pub fn extend_from_bounded_vec(&mut self, _vec: BoundedVec) { // We do this to avoid an unused variable warning on `self` let _ = self.len; for _ in 0..Len { } @@ -2485,7 +2485,7 @@ fn trait_impl_where_clause_stricter_pass() { fn bad_foo() where A: OtherTrait { } } - + fn main() { let _ = Option { inner: 1 }; // silence Option never constructed warning } diff --git a/noir_stdlib/src/collections/umap.nr b/noir_stdlib/src/collections/umap.nr index 8a7e6f81103..33010e75560 100644 --- a/noir_stdlib/src/collections/umap.nr +++ b/noir_stdlib/src/collections/umap.nr @@ -21,7 +21,7 @@ pub struct UHashMap { } // Data unit in the UHashMap table. -// In case Noir adds support for enums in the future, this +// In case Noir adds support for enums in the future, this // should be refactored to have three states: // 1. (key, value) // 2. (empty) @@ -60,7 +60,7 @@ impl Slot { } // Shall not override `_key_value` with Option::none(), - // because we must be able to differentiate empty + // because we must be able to differentiate empty // and deleted slots for lookup. fn mark_deleted(&mut self) { self._is_deleted = true; @@ -68,7 +68,7 @@ impl Slot { } // While conducting lookup, we iterate attempt from 0 to N - 1 due to heuristic, -// that if we have went that far without finding desired, +// that if we have went that far without finding desired, // it is very unlikely to be after - performance will be heavily degraded. impl UHashMap { // Creates a new instance of UHashMap with specified BuildHasher. @@ -213,7 +213,7 @@ impl UHashMap { pub unconstrained fn iter_keys_mut( &mut self, f: fn(K) -> K - ) + ) where K: Eq + Hash, B: BuildHasher, @@ -307,7 +307,7 @@ impl UHashMap { result } - // Insert key-value entry. In case key was already present, value is overridden. + // Insert key-value entry. In case key was already present, value is overridden. // docs:start:insert pub unconstrained fn insert( &mut self, @@ -407,14 +407,14 @@ impl UHashMap { // Probing scheme: quadratic function. // We use 0.5 constant near variadic attempt and attempt^2 monomials. // This ensures good uniformity of distribution for table sizes - // equal to prime numbers or powers of two. + // equal to prime numbers or powers of two. fn quadratic_probe(self: Self, hash: u32, attempt: u32) -> u32 { (hash + (attempt + attempt * attempt) / 2) % self._table.len() } } -// Equality class on UHashMap has to test that they have -// equal sets of key-value entries, +// Equality class on UHashMap has to test that they have +// equal sets of key-value entries, // thus one is a subset of the other and vice versa. // docs:start:eq impl Eq for UHashMap diff --git a/noir_stdlib/src/field/bn254.nr b/noir_stdlib/src/field/bn254.nr index 532fcd59a62..9349e67aed3 100644 --- a/noir_stdlib/src/field/bn254.nr +++ b/noir_stdlib/src/field/bn254.nr @@ -70,8 +70,8 @@ fn assert_gt_limbs(a: (Field, Field), b: (Field, Field)) { let rlo = alo - blo - 1 + (borrow as Field) * TWO_POW_128; let rhi = ahi - bhi - (borrow as Field); - rlo.assert_max_bit_size(128); - rhi.assert_max_bit_size(128); + rlo.assert_max_bit_size::<128>(); + rhi.assert_max_bit_size::<128>(); } } @@ -85,8 +85,8 @@ pub fn decompose(x: Field) -> (Field, Field) { let (xlo, xhi) = decompose_hint(x); // Range check the limbs - xlo.assert_max_bit_size(128); - xhi.assert_max_bit_size(128); + xlo.assert_max_bit_size::<128>(); + xhi.assert_max_bit_size::<128>(); // Check that the decomposition is correct assert_eq(x, xlo + TWO_POW_128 * xhi); diff --git a/noir_stdlib/src/field/mod.nr b/noir_stdlib/src/field/mod.nr index 35f95541354..4a329aaeb59 100644 --- a/noir_stdlib/src/field/mod.nr +++ b/noir_stdlib/src/field/mod.nr @@ -8,11 +8,10 @@ impl Field { /// # Failures /// Causes a constraint failure for `Field` values exceeding `2^{bit_size}`. // docs:start:assert_max_bit_size - pub fn assert_max_bit_size(self, bit_size: u32) { + pub fn assert_max_bit_size(self) { // docs:end:assert_max_bit_size - crate::assert_constant(bit_size); - assert(bit_size < modulus_num_bits() as u32); - self.__assert_max_bit_size(bit_size); + assert(BIT_SIZE < modulus_num_bits() as u32); + self.__assert_max_bit_size(BIT_SIZE); } #[builtin(apply_range_constraint)] @@ -20,7 +19,7 @@ impl Field { /// Decomposes `self` into its little endian bit decomposition as a `[u1; N]` array. /// This slice will be zero padded should not all bits be necessary to represent `self`. - /// + /// /// # Failures /// Causes a constraint failure for `Field` values exceeding `2^N` as the resulting slice will not /// be able to represent the original `Field`. @@ -36,7 +35,7 @@ impl Field { /// Decomposes `self` into its big endian bit decomposition as a `[u1; N]` array. /// This array will be zero padded should not all bits be necessary to represent `self`. - /// + /// /// # Failures /// Causes a constraint failure for `Field` values exceeding `2^N` as the resulting slice will not /// be able to represent the original `Field`. @@ -118,14 +117,20 @@ impl Field { // docs:start:to_le_radix pub fn to_le_radix(self: Self, radix: u32) -> [u8; N] { - crate::assert_constant(radix); + // Brillig does not need an immediate radix + if !crate::runtime::is_unconstrained() { + crate::assert_constant(radix); + } self.__to_le_radix(radix) } // docs:end:to_le_radix // docs:start:to_be_radix pub fn to_be_radix(self: Self, radix: u32) -> [u8; N] { - crate::assert_constant(radix); + // Brillig does not need an immediate radix + if !crate::runtime::is_unconstrained() { + crate::assert_constant(radix); + } self.__to_be_radix(radix) } // docs:end:to_be_radix diff --git a/noir_stdlib/src/hash/mod.nr b/noir_stdlib/src/hash/mod.nr index e8c0ce81a16..7cd4b8e292e 100644 --- a/noir_stdlib/src/hash/mod.nr +++ b/noir_stdlib/src/hash/mod.nr @@ -32,21 +32,8 @@ pub fn pedersen_commitment(input: [Field; N]) -> EmbeddedCurvePoint pedersen_commitment_with_separator(input, 0) } -pub fn pedersen_hash_with_separator(input: [Field; N], separator: u32) -> Field { - pedersen_hash_with_separator_noir(input, separator) -} - +#[inline_always] pub fn pedersen_commitment_with_separator(input: [Field; N], separator: u32) -> EmbeddedCurvePoint { - let value = __pedersen_commitment_with_separator(input, separator); - if (value[0] == 0) & (value[1] == 0) { - EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true } - } else { - EmbeddedCurvePoint { x: value[0], y: value[1], is_infinite: false } - } -} - -#[no_predicates] -fn pedersen_commitment_with_separator_noir(input: [Field; N], separator: u32) -> EmbeddedCurvePoint { let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N]; for i in 0..N { // we use the unsafe version because the multi_scalar_mul will constrain the scalars. @@ -56,8 +43,15 @@ fn pedersen_commitment_with_separator_noir(input: [Field; N], separa multi_scalar_mul(generators, points) } +// docs:start:pedersen_hash +pub fn pedersen_hash(input: [Field; N]) -> Field +// docs:end:pedersen_hash +{ + pedersen_hash_with_separator(input, 0) +} + #[no_predicates] -fn pedersen_hash_with_separator_noir(input: [Field; N], separator: u32) -> Field { +pub fn pedersen_hash_with_separator(input: [Field; N], separator: u32) -> Field { let mut scalars: Vec = Vec::from_slice([EmbeddedCurveScalar { lo: 0, hi: 0 }; N].as_slice()); //Vec::new(); for i in 0..N { @@ -74,19 +68,6 @@ fn pedersen_hash_with_separator_noir(input: [Field; N], separator: u multi_scalar_mul_slice(vec_generators.slice, scalars.slice)[0] } -// docs:start:pedersen_hash -pub fn pedersen_hash(input: [Field; N]) -> Field -// docs:end:pedersen_hash -{ - pedersen_hash_with_separator_noir(input, 0) -} - -#[foreign(pedersen_hash)] -fn __pedersen_hash_with_separator(input: [Field; N], separator: u32) -> Field {} - -#[foreign(pedersen_commitment)] -fn __pedersen_commitment_with_separator(input: [Field; N], separator: u32) -> [Field; 2] {} - #[field(bn254)] pub fn derive_generators(domain_separator_bytes: [u8; M], starting_index: u32) -> [EmbeddedCurvePoint; N] { crate::assert_constant(domain_separator_bytes); diff --git a/noir_stdlib/src/lib.nr b/noir_stdlib/src/lib.nr index 3d1dd3e90eb..f1ef6aca83c 100644 --- a/noir_stdlib/src/lib.nr +++ b/noir_stdlib/src/lib.nr @@ -67,7 +67,9 @@ pub fn verify_proof_with_type( key_hash: Field, proof_type: u32 ) { - crate::assert_constant(proof_type); + if !crate::runtime::is_unconstrained() { + crate::assert_constant(proof_type); + } verify_proof_internal(verification_key, proof, public_inputs, key_hash, proof_type); } diff --git a/noir_stdlib/src/meta/function_def.nr b/noir_stdlib/src/meta/function_def.nr index 3c29d57e20c..11dc169b188 100644 --- a/noir_stdlib/src/meta/function_def.nr +++ b/noir_stdlib/src/meta/function_def.nr @@ -59,6 +59,9 @@ impl FunctionDefinition { pub comptime fn set_return_public(self, public: bool) {} // docs:end:set_return_public + #[builtin(function_def_set_return_data)] + comptime fn set_return_data(self) {} + #[builtin(function_def_set_unconstrained)] // docs:start:set_unconstrained pub comptime fn set_unconstrained(self, value: bool) {} diff --git a/noir_stdlib/src/uint128.nr b/noir_stdlib/src/uint128.nr index 4a035ef91ef..e4a4342c3d1 100644 --- a/noir_stdlib/src/uint128.nr +++ b/noir_stdlib/src/uint128.nr @@ -111,7 +111,7 @@ impl U128 { }) as Field } - // TODO: Replace with a faster version. + // TODO: Replace with a faster version. // A circuit that uses this function can be slow to compute // (we're doing up to 127 calls to compute the quotient) unconstrained fn unconstrained_div(self: Self, b: U128) -> (U128, U128) { @@ -141,7 +141,7 @@ impl U128 { pub fn from_integer(i: T) -> U128 { let f = crate::as_field(i); // Reject values which would overflow a u128 - f.assert_max_bit_size(128); + f.assert_max_bit_size::<128>(); let lo = f as u64 as Field; let hi = (f - lo) / pow64; U128 { lo, hi } diff --git a/scripts/install_bb.sh b/scripts/install_bb.sh index c94a1b7dff0..596f0a54ba4 100755 --- a/scripts/install_bb.sh +++ b/scripts/install_bb.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="0.56.0" +VERSION="0.58.0" BBUP_PATH=~/.bb/bbup diff --git a/test_programs/execution_success/check_large_field_bits/src/main.nr b/test_programs/execution_success/check_large_field_bits/src/main.nr index 1d65b342966..542a06ecb6f 100644 --- a/test_programs/execution_success/check_large_field_bits/src/main.nr +++ b/test_programs/execution_success/check_large_field_bits/src/main.nr @@ -23,7 +23,7 @@ fn main() { // 8589934594 has 34 bits assert(size == 34); - C.assert_max_bit_size(34); + C.assert_max_bit_size::<34>(); assert( C.to_be_bits() == [ diff --git a/test_programs/execution_success/inline_never_basic/Nargo.toml b/test_programs/execution_success/inline_never_basic/Nargo.toml new file mode 100644 index 00000000000..16691770d76 --- /dev/null +++ b/test_programs/execution_success/inline_never_basic/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "inline_never_basic" +type = "bin" +authors = [""] +compiler_version = ">=0.27.0" + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_success/inline_never_basic/Prover.toml b/test_programs/execution_success/inline_never_basic/Prover.toml new file mode 100644 index 00000000000..fbe96700abe --- /dev/null +++ b/test_programs/execution_success/inline_never_basic/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" \ No newline at end of file diff --git a/test_programs/execution_success/inline_never_basic/src/main.nr b/test_programs/execution_success/inline_never_basic/src/main.nr new file mode 100644 index 00000000000..505a1641c76 --- /dev/null +++ b/test_programs/execution_success/inline_never_basic/src/main.nr @@ -0,0 +1,8 @@ +fn main(x: Field, y: pub Field) { + basic_check(x, y); +} + +#['inline(never)] +fn basic_check(x: Field, y: Field) { + assert(x != y); +} diff --git a/test_programs/execution_success/unsafe_range_constraint/src/main.nr b/test_programs/execution_success/unsafe_range_constraint/src/main.nr index ead5613bcce..ed846ec20b4 100644 --- a/test_programs/execution_success/unsafe_range_constraint/src/main.nr +++ b/test_programs/execution_success/unsafe_range_constraint/src/main.nr @@ -1,5 +1,5 @@ -// Test that we can apply a range constraint to a field using +// Test that we can apply a range constraint to a field using // a builtin. fn main(x: Field) { - x.assert_max_bit_size(48); + x.assert_max_bit_size::<48>(); } diff --git a/test_programs/noir_test_success/bounded_vec/src/main.nr b/test_programs/noir_test_success/bounded_vec/src/main.nr index 0ad5840ba32..fa2c55e6934 100644 --- a/test_programs/noir_test_success/bounded_vec/src/main.nr +++ b/test_programs/noir_test_success/bounded_vec/src/main.nr @@ -79,7 +79,7 @@ fn set_unchecked_example() { // We've now written past the end of `vec`. // As this index is still within the maximum potential length of `v`, - // it won't cause a constraint failure. + // it won't cause a constraint failure. vec.set_unchecked(2, 42); println(vec); @@ -189,13 +189,13 @@ fn test_vec_extend_from_bounded_vec() { // docs:end:bounded-vec-extend-from-bounded-vec-example } -#[test(should_fail_with="extend_from_array out of bounds")] +#[test(should_fail_with = "extend_from_array out of bounds")] fn test_vec_extend_from_array_out_of_bound() { let mut vec: BoundedVec = BoundedVec::new(); vec.extend_from_array([2, 4, 6]); } -#[test(should_fail_with="extend_from_array out of bounds")] +#[test(should_fail_with = "extend_from_array out of bounds")] fn test_vec_extend_from_array_twice_out_of_bound() { let mut vec: BoundedVec = BoundedVec::new(); vec.extend_from_array([2]); @@ -223,14 +223,14 @@ fn test_vec_get_uninitialized() { let _x = vec.get(0); } -#[test(should_fail_with="push out of bounds")] +#[test(should_fail_with = "push out of bounds")] fn test_vec_push_out_of_bound() { let mut vec: BoundedVec = BoundedVec::new(); vec.push(1); vec.push(2); } -#[test(should_fail_with="extend_from_bounded_vec out of bounds")] +#[test(should_fail_with = "extend_from_bounded_vec out of bounds")] fn test_vec_extend_from_bounded_vec_out_of_bound() { let mut vec: BoundedVec = BoundedVec::new(); @@ -240,7 +240,7 @@ fn test_vec_extend_from_bounded_vec_out_of_bound() { vec.extend_from_bounded_vec(another_vec); } -#[test(should_fail_with="extend_from_bounded_vec out of bounds")] +#[test(should_fail_with = "extend_from_bounded_vec out of bounds")] fn test_vec_extend_from_bounded_vec_twice_out_of_bound() { let mut vec: BoundedVec = BoundedVec::new(); vec.extend_from_array([1, 2]); diff --git a/tooling/debugger/src/context.rs b/tooling/debugger/src/context.rs index dde3fe84d88..3f64fc1acdb 100644 --- a/tooling/debugger/src/context.rs +++ b/tooling/debugger/src/context.rs @@ -977,22 +977,22 @@ mod tests { let brillig_bytecode = BrilligBytecode { bytecode: vec![ BrilligOpcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(1u64), }, BrilligOpcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, BrilligOpcode::Const { - destination: MemoryAddress::from(1), + destination: MemoryAddress::direct(1), value: fe_0, bit_size: BitSize::Integer(IntegerBitSize::U32), }, @@ -1000,7 +1000,7 @@ mod tests { function: "clear_mock".into(), destinations: vec![], destination_value_types: vec![], - inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))], + inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::direct(0))], input_value_types: vec![HeapValueType::field()], }, BrilligOpcode::Stop { return_data_offset: 0, return_data_size: 0 }, @@ -1136,25 +1136,25 @@ mod tests { let brillig_bytecode = BrilligBytecode { bytecode: vec![ BrilligOpcode::Const { - destination: MemoryAddress(0), + destination: MemoryAddress::direct(0), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(2u64), }, BrilligOpcode::Const { - destination: MemoryAddress(1), + destination: MemoryAddress::direct(1), bit_size: BitSize::Integer(IntegerBitSize::U32), value: FieldElement::from(0u64), }, BrilligOpcode::CalldataCopy { - destination_address: MemoryAddress(0), - size_address: MemoryAddress(0), - offset_address: MemoryAddress(1), + destination_address: MemoryAddress::direct(0), + size_address: MemoryAddress::direct(0), + offset_address: MemoryAddress::direct(1), }, BrilligOpcode::BinaryFieldOp { - destination: MemoryAddress::from(0), + destination: MemoryAddress::direct(0), op: BinaryFieldOp::Add, - lhs: MemoryAddress::from(0), - rhs: MemoryAddress::from(1), + lhs: MemoryAddress::direct(0), + rhs: MemoryAddress::direct(1), }, BrilligOpcode::Stop { return_data_offset: 0, return_data_size: 1 }, ], diff --git a/tooling/debugger/src/repl.rs b/tooling/debugger/src/repl.rs index 1a7c2d6c7a8..012af0e88e8 100644 --- a/tooling/debugger/src/repl.rs +++ b/tooling/debugger/src/repl.rs @@ -1,11 +1,10 @@ use crate::context::{DebugCommandResult, DebugContext, DebugLocation}; -use acvm::acir::brillig::{BitSize, IntegerBitSize}; +use acvm::acir::brillig::BitSize; use acvm::acir::circuit::brillig::{BrilligBytecode, BrilligFunctionId}; use acvm::acir::circuit::{Circuit, Opcode, OpcodeLocation}; use acvm::acir::native_types::{Witness, WitnessMap, WitnessStack}; use acvm::brillig_vm::brillig::Opcode as BrilligOpcode; -use acvm::brillig_vm::MemoryValue; use acvm::{BlackBoxFunctionSolver, FieldElement}; use nargo::NargoError; use noirc_driver::CompiledProgram; @@ -369,11 +368,7 @@ impl<'a, B: BlackBoxFunctionSolver> ReplDebugger<'a, B> { return; }; - for (index, value) in memory - .iter() - .enumerate() - .filter(|(_, value)| !matches!(value, MemoryValue::Integer(_, IntegerBitSize::U0))) - { + for (index, value) in memory.iter().enumerate() { println!("{index} = {}", value); } } diff --git a/tooling/lsp/src/requests/completion/builtins.rs b/tooling/lsp/src/requests/completion/builtins.rs index cf2af4036f7..078e2faf036 100644 --- a/tooling/lsp/src/requests/completion/builtins.rs +++ b/tooling/lsp/src/requests/completion/builtins.rs @@ -109,9 +109,9 @@ impl<'a> NodeFinder<'a> { if name_matches("test", prefix) || name_matches("should_fail_with", prefix) { self.completion_items.push(snippet_completion_item( - "test(should_fail_with=\"...\")", + "test(should_fail_with = \"...\")", CompletionItemKind::METHOD, - "test(should_fail_with=\"${1:message}\")", + "test(should_fail_with = \"${1:message}\")", None, )); } diff --git a/tooling/lsp/src/solver.rs b/tooling/lsp/src/solver.rs index 9d1185e3a79..3c2d7499880 100644 --- a/tooling/lsp/src/solver.rs +++ b/tooling/lsp/src/solver.rs @@ -16,22 +16,6 @@ impl BlackBoxFunctionSolver for WrapperSolver { self.0.schnorr_verify(public_key_x, public_key_y, signature, message) } - fn pedersen_commitment( - &self, - inputs: &[acvm::FieldElement], - domain_separator: u32, - ) -> Result<(acvm::FieldElement, acvm::FieldElement), acvm::BlackBoxResolutionError> { - self.0.pedersen_commitment(inputs, domain_separator) - } - - fn pedersen_hash( - &self, - inputs: &[acvm::FieldElement], - domain_separator: u32, - ) -> Result { - self.0.pedersen_hash(inputs, domain_separator) - } - fn multi_scalar_mul( &self, points: &[acvm::FieldElement], diff --git a/tooling/nargo_fmt/tests/input/fn.nr b/tooling/nargo_fmt/tests/input/fn.nr index 8ed2c565bc4..9e19222decb 100644 --- a/tooling/nargo_fmt/tests/input/fn.nr +++ b/tooling/nargo_fmt/tests/input/fn.nr @@ -47,12 +47,12 @@ pub fn from_baz(x: [Field; crate::foo::MAGIC_NUMBER]) {} fn id< T , let I : Field > ( x : [ Field ; I ] ) -> [Field; I ] { } -fn id_two(x: [Field ; I]) -> [ Field; I] {} fn whitespace_before_generics < T > (foo: T) {} -fn more_whitespace_before_generics < +fn more_whitespace_before_generics < T > (foo: T) {} fn with_unconstrained(x: unconstrained fn() -> ()) {} @@ -70,6 +70,6 @@ unconstrained pub comptime fn two() {} // comment fn four() {} -#[test(should_fail_with="oops")] +#[test(should_fail_with = "oops")] fn five() {} diff --git a/tooling/noir_js/src/index.ts b/tooling/noir_js/src/index.ts index f3016efd032..ed0999a960c 100644 --- a/tooling/noir_js/src/index.ts +++ b/tooling/noir_js/src/index.ts @@ -2,7 +2,7 @@ import * as acvm from '@noir-lang/acvm_js'; import * as abi from '@noir-lang/noirc_abi'; import { CompiledCircuit } from '@noir-lang/types'; -export { ecdsa_secp256r1_verify, ecdsa_secp256k1_verify, keccak256, blake2s256, xor, and } from '@noir-lang/acvm_js'; +export { ecdsa_secp256r1_verify, ecdsa_secp256k1_verify, blake2s256, xor, and } from '@noir-lang/acvm_js'; export { InputMap } from '@noir-lang/noirc_abi'; export { WitnessMap, ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@noir-lang/acvm_js'; diff --git a/tooling/noir_js_backend_barretenberg/package.json b/tooling/noir_js_backend_barretenberg/package.json index 0c96f7d213c..560f91ffdc3 100644 --- a/tooling/noir_js_backend_barretenberg/package.json +++ b/tooling/noir_js_backend_barretenberg/package.json @@ -41,7 +41,7 @@ "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" }, "dependencies": { - "@aztec/bb.js": "0.56.0", + "@aztec/bb.js": "0.58.0", "@noir-lang/types": "workspace:*", "fflate": "^0.8.0" }, diff --git a/tooling/profiler/src/opcode_formatter.rs b/tooling/profiler/src/opcode_formatter.rs index f367360b189..68057b6d86f 100644 --- a/tooling/profiler/src/opcode_formatter.rs +++ b/tooling/profiler/src/opcode_formatter.rs @@ -17,13 +17,10 @@ fn format_blackbox_function(call: &BlackBoxFuncCall) -> String { BlackBoxFuncCall::Blake2s { .. } => "blake2s".to_string(), BlackBoxFuncCall::Blake3 { .. } => "blake3".to_string(), BlackBoxFuncCall::SchnorrVerify { .. } => "schnorr_verify".to_string(), - BlackBoxFuncCall::PedersenCommitment { .. } => "pedersen_commitment".to_string(), - BlackBoxFuncCall::PedersenHash { .. } => "pedersen_hash".to_string(), BlackBoxFuncCall::EcdsaSecp256k1 { .. } => "ecdsa_secp256k1".to_string(), BlackBoxFuncCall::EcdsaSecp256r1 { .. } => "ecdsa_secp256r1".to_string(), BlackBoxFuncCall::MultiScalarMul { .. } => "multi_scalar_mul".to_string(), BlackBoxFuncCall::EmbeddedCurveAdd { .. } => "embedded_curve_add".to_string(), - BlackBoxFuncCall::Keccak256 { .. } => "keccak256".to_string(), BlackBoxFuncCall::Keccakf1600 { .. } => "keccakf1600".to_string(), BlackBoxFuncCall::RecursiveAggregation { .. } => "recursive_aggregation".to_string(), BlackBoxFuncCall::BigIntAdd { .. } => "big_int_add".to_string(), @@ -43,13 +40,10 @@ fn format_blackbox_op(call: &BlackBoxOp) -> String { BlackBoxOp::Blake2s { .. } => "blake2s".to_string(), BlackBoxOp::Blake3 { .. } => "blake3".to_string(), BlackBoxOp::SchnorrVerify { .. } => "schnorr_verify".to_string(), - BlackBoxOp::PedersenCommitment { .. } => "pedersen_commitment".to_string(), - BlackBoxOp::PedersenHash { .. } => "pedersen_hash".to_string(), BlackBoxOp::EcdsaSecp256k1 { .. } => "ecdsa_secp256k1".to_string(), BlackBoxOp::EcdsaSecp256r1 { .. } => "ecdsa_secp256r1".to_string(), BlackBoxOp::MultiScalarMul { .. } => "multi_scalar_mul".to_string(), BlackBoxOp::EmbeddedCurveAdd { .. } => "embedded_curve_add".to_string(), - BlackBoxOp::Keccak256 { .. } => "keccak256".to_string(), BlackBoxOp::Keccakf1600 { .. } => "keccakf1600".to_string(), BlackBoxOp::BigIntAdd { .. } => "big_int_add".to_string(), BlackBoxOp::BigIntSub { .. } => "big_int_sub".to_string(), diff --git a/yarn.lock b/yarn.lock index 4e69184763a..c0f6c0e75f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -221,9 +221,9 @@ __metadata: languageName: node linkType: hard -"@aztec/bb.js@npm:0.56.0": - version: 0.56.0 - resolution: "@aztec/bb.js@npm:0.56.0" +"@aztec/bb.js@npm:0.58.0": + version: 0.58.0 + resolution: "@aztec/bb.js@npm:0.58.0" dependencies: comlink: ^4.4.1 commander: ^10.0.1 @@ -231,7 +231,7 @@ __metadata: tslib: ^2.4.0 bin: bb.js: dest/node/main.js - checksum: 199a1e6c408e4c1399b69169e1a0a48bac92688299312a7dd6eca242e4970808bc370808d2fe4194f17e0d1fe7f5d09676709a05e3ad6ed569ac5553134be34a + checksum: b4e882a6668df737fab6e2223ee6b20ff499e8a0b67c18dcab8109efec47e674c6d8276e8c3b6662289d69f56b6e1d94d3312673fd0ace9909e33ebce7f10cbb languageName: node linkType: hard @@ -5348,7 +5348,7 @@ __metadata: version: 0.0.0-use.local resolution: "@noir-lang/backend_barretenberg@workspace:tooling/noir_js_backend_barretenberg" dependencies: - "@aztec/bb.js": 0.56.0 + "@aztec/bb.js": 0.58.0 "@noir-lang/types": "workspace:*" "@types/node": ^20.6.2 "@types/prettier": ^3