diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/getting_started/noir_installation.md b/docs/versioned_docs/version-v1.0.0-beta.0/getting_started/noir_installation.md index 05f036d4f6d..a5c7e649278 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/getting_started/noir_installation.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/getting_started/noir_installation.md @@ -93,7 +93,7 @@ step 2: Follow the [Noirup instructions](#installing-noirup). ## Setting up shell completions -Once `nargo` is installed, you can [set up shell completions for it](setting_up_shell_completions.md). +Once `nargo` is installed, you can [set up shell completions for it](setting_up_shell_completions). ## Uninstalling Nargo diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_the_repl.md b/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_the_repl.md index 1d64dae3f37..09e5bae68ad 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_the_repl.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_the_repl.md @@ -1,7 +1,7 @@ --- title: Using the REPL Debugger description: - Step-by-step guide on how to debug your Noir circuits with the REPL Debugger. + Step by step guide on how to debug your Noir circuits with the REPL Debugger. keywords: [ Nargo, diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_vs_code.md b/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_vs_code.md index 8bda93324f5..a5858c1a5eb 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_vs_code.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/how_to/debugger/debugging_with_vs_code.md @@ -1,7 +1,7 @@ --- title: Using the VS Code Debugger description: - Step-by-step guide on how to debug your Noir circuits with the VS Code Debugger configuration and features. + Step by step guide on how to debug your Noir circuits with the VS Code Debugger configuration and features. keywords: [ Nargo, @@ -65,4 +65,4 @@ We just need to click the to the right of the line number 18. Once the breakpoin Now we are debugging the `keccak256` function, notice the _Call Stack pane_ at the lower right. This lets us inspect the current call stack of our process. -That covers most of the current debugger functionalities. Check out [the reference](../../reference/debugger/debugger_vscode.md) for more details on how to configure the debugger. +That covers most of the current debugger functionalities. Check out [the reference](../../reference/debugger/debugger_vscode.md) for more details on how to configure the debugger. \ No newline at end of file diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/how-to-solidity-verifier.md b/docs/versioned_docs/version-v1.0.0-beta.0/how_to/how-to-solidity-verifier.md index 9a7db11ea5c..2cc0f8e57ce 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/how-to-solidity-verifier.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/how_to/how-to-solidity-verifier.md @@ -20,21 +20,19 @@ sidebar_position: 0 pagination_next: tutorials/noirjs_app --- -Noir is universal. The witness and the compiled program can be fed into a proving backend such as Aztec's [Barretenberg](https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg), which can then generate a verifier contract for deployment on blockchains. +Noir has the ability to generate a verifier contract in Solidity, which can be deployed in many EVM-compatible blockchains such as Ethereum. This allows for a powerful feature set, as one can make use of the conciseness and the privacy provided by Noir in an immutable ledger. Applications can range from simple P2P guessing games, to complex private DeFi interactions. -Although not strictly in the domain of Noir itself, this guide shows how to generate a Solidity Verifier with Barretenberg and deploy it on the [Remix IDE](https://remix.ethereum.org/). It is assumed that: +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 will be using Barretenberg as your proving backend -- You will be using an EVM blockchain to verify your proof - 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/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 -Generating a Solidity Verifier with Barretenberg contract is actually a one-command process. However, compiling it and deploying it can have some caveats. Here's the rundown of this guide: +Generating a Solidity Verifier contract is actually a one-command process. However, compiling it and deploying it can have some caveats. Here's the rundown of this guide: 1. How to generate a solidity smart contract 2. How to compile the smart contract in the RemixIDE @@ -48,22 +46,24 @@ This is by far the most straightforward step. Just run: nargo compile ``` -This will compile your source code into a Noir build artifact to be stored in the `./target` directory. From here on, it's Barretenberg's work. You can generate the smart contract using the commands: +This will compile your source code into a Noir build artifact to be stored in the `./target` directory, you can then generate the smart contract using the commands: ```sh -# using Barretenberg's UltraHonk here -bb write_vk_ultra_keccak_honk -b ./target/.json -bb contract_ultra_honk -b ./target/.json -o ./target/Verifier.sol +# Here we pass the path to the newly generated Noir artifact. +bb write_vk -b ./target/.json +bb contract ``` -replacing `` with the name of your Noir project. A `Verifier.sol` contract is now in the target folder and can be deployed to any EVM blockchain acting as a verifier smart 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/quick_start.md#proving-backend). -:::tip[Why UltraHonk?] +:::info -UltraHonk is faster and more efficient, however the verifier contracts are more expensive. If gas cost is a concern, try UltraPlonk instead! +It is possible to generate verifier contracts of Noir programs for other smart contract platforms as long as the proving backend supplies an implementation. +Barretenberg, the default proving backend for Nargo, supports generation of verifier contracts, for the time being these are only in Solidity. ::: ## Step 2 - Compiling @@ -85,11 +85,17 @@ To compile our the verifier, we can navigate to the compilation tab: ![Compilation Tab](@site/static/img/how-tos/solidity_verifier_2.png) -Remix should automatically match a suitable compiler version. However, hitting the "Compile" button will most likely tell you the contract is too big to deploy on mainnet: +Remix should automatically match a suitable compiler version. However, hitting the "Compile" button will most likely generate a "Stack too deep" error: -![Stack too deep](@site/static/img/how-tos/solidity_verifier_6.png) +![Stack too deep](@site/static/img/how-tos/solidity_verifier_3.png) -If you care about that, you can just use some optimization. To do this, open the "Advanced Configurations" tab and enable optimization. The default 200 runs will suffice. +This is due to the verify function needing to put many variables on the stack, but enabling the optimizer resolves the issue. To do this, let's open the "Advanced Configurations" tab and enable optimization. The default 200 runs will suffice. + +:::info + +This time we will see a warning about an unused function parameter. This is expected, as the `verify` function doesn't use the `_proof` parameter inside a solidity block, it is loaded from calldata and used in assembly. + +::: ![Compilation success](@site/static/img/how-tos/solidity_verifier_4.png) @@ -97,36 +103,55 @@ If you care about that, you can just use some optimization. To do this, open the At this point we should have a compiled contract ready to deploy. If we navigate to the deploy section in Remix, we will see many different environments we can deploy to. The steps to deploy on each environment would be out-of-scope for this guide, so we will just use the default Remix VM. -Looking closely, we will notice that our "Solidity Verifier" is composed on multiple contracts working together. Remix will take care of the dependencies for us so we can simply deploy the HonkVerifier contract by selecting it and hitting "deploy": +Looking closely, we will notice that our "Solidity Verifier" is actually three contracts working together: + +- An `UltraVerificationKey` library which simply stores the verification key for our circuit. +- An abstract contract `BaseUltraVerifier` containing most of the verifying logic. +- A main `UltraVerifier` contract that inherits from the Base and uses the Key contract. + +Remix will take care of the dependencies for us so we can simply deploy the UltraVerifier contract by selecting it and hitting "deploy": + +![Deploying UltraVerifier](@site/static/img/how-tos/solidity_verifier_5.png) + +A contract will show up in the "Deployed Contracts" section, where we can retrieve the Verification Key Hash. This is particularly useful for double-checking that the deployer contract is the correct one. -![Deploying HonkVerifier](@site/static/img/how-tos/solidity_verifier_7.png) +:::note -A contract will show up in the "Deployed Contracts" section. +Why "UltraVerifier"? + +To be precise, the Noir compiler (`nargo`) doesn't generate the verifier contract directly. It compiles the Noir code into an intermediate language (ACIR), which is then executed by the backend. So it is the backend that returns the verifier smart contract, not Noir. + +In this case, the Barretenberg Backend uses the UltraPlonk proving system, hence the "UltraVerifier" name. + +::: ## Step 4 - Verifying -To verify a proof using the Solidity verifier contract, we call the `verify` function: +To verify a proof using the Solidity verifier contract, we call the `verify` function in this extended contract: ```solidity function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) ``` -First generate a proof with `bb`. We will first execute the circuit with `nargo` and then use the proving backend to prove. For UltraHonk, the `keccak` version is needed: +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/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 -nargo execute -bb prove_ultra_keccak_honk -b ./target/.json -w ./target/ -o ./target/proof -``` +# This value must be changed to match the number of public inputs (including return values!) in your program. +NUM_PUBLIC_INPUTS=1 +PUBLIC_INPUT_BYTES=32*NUM_PUBLIC_INPUTS +HEX_PUBLIC_INPUTS=$(head -c $PUBLIC_INPUT_BYTES ./proof | od -An -v -t x1 | tr -d $' \n') +HEX_PROOF=$(tail -c +$(($PUBLIC_INPUT_BYTES + 1)) ./proof | od -An -v -t x1 | tr -d $' \n') -Barretenberg attaches the public inputs to the proof, which in this case it's not very useful. If you're up for some JS, `bb.js` has [a method for it](https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/ts/src/proof/index.ts), but in the CLI you can use this ugly snippet: +echo "Public inputs:" +echo $HEX_PUBLIC_INPUTS -```bash -cat ./target/proof | od -An -v -t x1 | tr -d $' \n' | sed 's/^.\{8\}//' | (read hex; echo "${hex:0:192}${hex:256}") +echo "Proof:" +echo "0x$HEX_PROOF" ``` -Beautiful. This assumes a circuit with one public input (32 bytes, for Barretenberg). For more inputs, you can just increment `hex:256` with 32 more bytes for each public input. - -Anyway, Remix expects that the public inputs will be split into an array of `bytes32` values so `HEX_PUBLIC_INPUTS` needs to be split up into 32 byte chunks which are prefixed with `0x` accordingly. +Remix expects that the public inputs will be split into an array of `bytes32` values so `HEX_PUBLIC_INPUTS` needs to be split up into 32 byte chunks which are prefixed with `0x` accordingly. A programmatic example of how the `verify` function is called can be seen in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): @@ -163,7 +188,7 @@ the `verify` function will expect the public inputs array (second function param Passing only two inputs will result in an error such as `PUBLIC_INPUT_COUNT_INVALID(3, 2)`. -In this case, the inputs parameter to `verify` would be an array ordered as `[pubkey_x, pubkey_y, return]`. +In this case, the inputs parameter to `verify` would be an array ordered as `[pubkey_x, pubkey_y, return`. ::: diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/how-to-solidity-verifier.mdx b/docs/versioned_docs/version-v1.0.0-beta.0/how_to/how-to-solidity-verifier.mdx deleted file mode 100644 index f64a40cad43..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/how_to/how-to-solidity-verifier.mdx +++ /dev/null @@ -1,261 +0,0 @@ ---- -title: Generate a Solidity Verifier -description: - Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier - contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart - contract. Read more to find out -keywords: - [ - solidity verifier, - smart contract, - blockchain, - compiler, - plonk_vk.sol, - EVM blockchain, - verifying Noir programs, - proving backend, - Barretenberg, - ] -sidebar_position: 0 -pagination_next: tutorials/noirjs_app ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -Noir is universal. The witness and the compiled program can be fed into a proving backend such as Aztec's [Barretenberg](https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg), which can then generate a verifier contract for deployment on blockchains. - -This allows for a powerful feature set, as one can make use of the conciseness and the privacy provided by Noir in an immutable ledger. Applications can range from simple P2P guessing games, to complex private DeFi interactions. - -Although not strictly in the domain of Noir itself, this guide shows how to generate a Solidity Verifier with Barretenberg and deploy it on the [Remix IDE](https://remix.ethereum.org/). It is assumed that: - -- You will be using Barretenberg as your proving backend -- You will be using an EVM blockchain to verify your proof -- 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/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 - -Generating a Solidity Verifier with Barretenberg contract is actually a one-command process. However, compiling it and deploying it can have some caveats. Here's the rundown of this guide: - -1. How to generate a solidity smart contract -2. How to compile the smart contract in the RemixIDE -3. How to deploy it to a testnet - -:::info[Which proving system to use?] - -Barretenberg currently provides two provers: `UltraPlonk` and `UltraHonk`. In a nutshell, `UltraHonk` is faster and uses less RAM, but its verifier contract is much more expensive. `UltraPlonk` is optimized for on-chain verification, but proving is more expensive. - -In any case, we provide instructions for both. Choose your poison ☠️ - -::: - -## Step 1 - Generate a contract - -This is by far the most straightforward step. Just run: - -```sh -nargo compile -``` - -This will compile your source code into a Noir build artifact to be stored in the `./target` directory. From here on, it's Barretenberg's work. You can generate the smart contract using the commands: - - - - -```sh -# using Barretenberg's UltraHonk here -bb write_vk_ultra_keccak_honk -b ./target/.json -bb contract_ultra_honk -``` - - - - -```sh -# using Barretenberg's UltraPlonk here -bb write_vk -b ./target/.json -bb contract -``` - - - - -replacing `` with the name of your Noir project. A `Verifier.sol` contract is now in the target folder and 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/quick_start.md#proving-backend). - - -## Step 2 - Compiling - -We will mostly skip the details of RemixIDE, as the UI can change from version to version. For now, we can just open -Remix and create a blank workspace. - -![Create Workspace](@site/static/img/how-tos/solidity_verifier_1.png) - -We will create a new file to contain the contract Nargo generated, and copy-paste its content. - -:::warning - -You'll likely see a warning advising you to not trust pasted code. While it is an important warning, it is irrelevant in the context of this guide and can be ignored. We will not be deploying anywhere near a mainnet. - -::: - -To compile our the verifier, we can navigate to the compilation tab: - -![Compilation Tab](@site/static/img/how-tos/solidity_verifier_2.png) - -Remix should automatically match a suitable compiler version. However, hitting the "Compile" button will most likely tell you the contract is too big to deploy on mainnet: - -![Stack too deep](@site/static/img/how-tos/solidity_verifier_6.png) - -If you care about that, you can just use some optimization. To do this, open the "Advanced Configurations" tab and enable optimization. The default 200 runs will suffice. - -![Compilation success](@site/static/img/how-tos/solidity_verifier_4.png) - -## Step 3 - Deploying - -At this point we should have a compiled contract ready to deploy. If we navigate to the deploy section in Remix, we will see many different environments we can deploy to. The steps to deploy on each environment would be out-of-scope for this guide, so we will just use the default Remix VM. - -Looking closely, we will notice that our "Solidity Verifier" is composed on multiple contracts working together. Remix will take care of the dependencies for us so we can simply deploy the HonkVerifier contract by selecting it and hitting "deploy": - -![Deploying HonkVerifier](@site/static/img/how-tos/solidity_verifier_7.png) - -A contract will show up in the "Deployed Contracts" section. - -## Step 4 - Verifying - -To verify a proof using the Solidity verifier contract, we call the `verify` function: - -```solidity -function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) -``` - -First generate a proof with `bb`. We need a `Prover.toml` file for our inputs. Run: - -```bash -nargo check -``` - -This will generate a `Prover.toml` you can fill with the values you want to prove. We can now execute the circuit with `nargo` and then use the proving backend to prove. For UltraHonk, the `keccak` version is needed: - -```bash -nargo execute -bb prove_ultra_keccak_honk -b ./target/.json -w ./target/ -o ./target/proof -``` - -Barretenberg attaches the public inputs to the proof, which in this case it's not very useful. If you're up for some JS, `bb.js` has [a method for it](https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/ts/src/proof/index.ts), but in the CLI you can use this ugly snippet: - -```bash -cat ./target/proof | od -An -v -t x1 | tr -d $' \n' | sed 's/^.\{8\}//' | (read hex; echo "${hex:0:192}${hex:256}") -``` - -Beautiful. This assumes a circuit with one public input (32 bytes, for Barretenberg). For more inputs, you can just increment `hex:256` with 32 more bytes for each public input. - -Anyway, Remix expects that the public inputs will be split into an array of `bytes32` values so `HEX_PUBLIC_INPUTS` needs to be split up into 32 byte chunks which are prefixed with `0x` accordingly. - -A programmatic example of how the `verify` function is called can be seen in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): - -```solidity -function castVote(bytes calldata proof, uint proposalId, uint vote, bytes32 nullifierHash) public returns (bool) { - // ... - bytes32[] memory publicInputs = new bytes32[](4); - publicInputs[0] = merkleRoot; - publicInputs[1] = bytes32(proposalId); - publicInputs[2] = bytes32(vote); - publicInputs[3] = nullifierHash; - require(verifier.verify(proof, publicInputs), "Invalid proof"); -``` - -:::info[Return Values] - -A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in Noir. - -Under the hood, the return value is passed as an input to the circuit and is checked at the end of the circuit program. - -For example, if you have Noir program like this: - -```rust -fn main( - // Public inputs - pubkey_x: pub Field, - pubkey_y: pub Field, - // Private inputs - priv_key: Field, -) -> pub Field -``` - -the `verify` function will expect the public inputs array (second function parameter) to be of length 3, the two inputs and the return value. - -Passing only two inputs will result in an error such as `PUBLIC_INPUT_COUNT_INVALID(3, 2)`. - -In this case, the inputs parameter to `verify` would be an array ordered as `[pubkey_x, pubkey_y, return]`. - -::: - -:::tip[Structs] - -You can pass structs to the verifier contract. They will be flattened so that the array of inputs is 1-dimensional array. - -For example, consider the following program: - -```rust -struct Type1 { - val1: Field, - val2: Field, -} - -struct Nested { - t1: Type1, - is_true: bool, -} - -fn main(x: pub Field, nested: pub Nested, y: pub Field) { - //... -} -``` - -The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` - -::: - -The other function you can call is our entrypoint `verify` function, as defined above. - -:::tip - -It's worth noticing that the `verify` function is actually a `view` function. A `view` function does not alter the blockchain state, so it doesn't need to be distributed (i.e. it will run only on the executing node), and therefore doesn't cost any gas. - -This can be particularly useful in some situations. If Alice generated a proof and wants Bob to verify its correctness, Bob doesn't need to run Nargo, NoirJS, or any Noir specific infrastructure. He can simply make a call to the blockchain with the proof and verify it is correct without paying any gas. - -It would be incorrect to say that a Noir proof verification costs any gas at all. However, most of the time the result of `verify` is used to modify state (for example, to update a balance, a game state, etc). In that case the whole network needs to execute it, which does incur gas costs (calldata and execution, but not storage). - -::: - -## A Note on EVM chains - -Noir proof verification requires the ecMul, ecAdd and ecPairing precompiles. Not all EVM chains support EC Pairings, notably some of the ZK-EVMs. This means that you won't be able to use the verifier contract in all of them. You can find an incomplete list of which EVM chains support these precompiles [here](https://www.evmdiff.com/features?feature=precompiles). - -For example, chains like `zkSync ERA` and `Polygon zkEVM` do not currently support these precompiles, so proof verification via Solidity verifier contracts won't work. Here's a quick list of EVM chains that have been tested and are known to work: - -- Optimism -- Arbitrum -- Polygon PoS -- Scroll -- Celo -- BSC -- Blast L2 -- Avalanche C-Chain -- Mode -- Linea -- Moonbeam - -If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. - -## What's next - -Now that you know how to call a Noir Solidity Verifier on a smart contract using Remix, you should be comfortable with using it with some programmatic frameworks, such as [hardhat](https://github.com/noir-lang/noir-starter/tree/main/vite-hardhat) and [foundry](https://github.com/noir-lang/noir-starter/tree/main/with-foundry). - -You can find other tools, examples, boilerplates and libraries in the [awesome-noir](https://github.com/noir-lang/awesome-noir) repository. - -You should also be ready to write and deploy your first NoirJS app and start generating proofs on websites, phones, and NodeJS environments! Head on to the [NoirJS tutorial](../tutorials/noirjs_app.md) to learn how to do that. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/index.mdx b/docs/versioned_docs/version-v1.0.0-beta.0/index.mdx index 5c116a73b3f..a6bd306f91d 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/index.mdx +++ b/docs/versioned_docs/version-v1.0.0-beta.0/index.mdx @@ -21,17 +21,8 @@ sidebar_position: 0 import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import ThemedImage from '@theme/ThemedImage'; -import useBaseUrl from '@docusaurus/useBaseUrl'; - - + +Noir Logo Noir is an open-source Domain-Specific Language for safe and seamless construction of privacy-preserving Zero-Knowledge programs, requiring no previous knowledge on the underlying mathematics or cryptography. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/comptime.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/comptime.md index edf4c3f88e0..2ceb030c7e1 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/comptime.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/comptime.md @@ -41,7 +41,7 @@ Note that while in a `comptime` context, any runtime variables _local to the cur Evaluation rules of `comptime` follows the normal unconstrained evaluation rules for other Noir code. There are a few things to note though: - Certain built-in functions may not be available, although more may be added over time. -- Evaluation order of `comptime {}` blocks within global items is currently unspecified. For example, given the following two functions we can't guarantee +- Evaluation order of global items is currently unspecified. For example, given the following two functions we can't guarantee which `println` will execute first. The ordering of the two printouts will be arbitrary, but should be stable across multiple compilations with the same `nargo` version as long as the program is also unchanged. ```rust @@ -56,14 +56,11 @@ fn two() { - Since evaluation order is unspecified, care should be taken when using mutable globals so that they do not rely on a particular ordering. For example, using globals to generate unique ids should be fine but relying on certain ids always being produced (especially after edits to the program) should be avoided. -- Although the ordering of comptime code is usually unspecified, there are cases where it is: +- Although most ordering of globals is unspecified, two are: - Dependencies of a crate will always be evaluated before the dependent crate. - - Any attributes on a function will be run before the function body is resolved. This is to allow the attribute to modify the function if necessary. Note that if the + - Any annotations on a function will be run before the function itself is resolved. This is to allow the annotation to modify the function if necessary. Note that if the function itself was called at compile-time previously, it will already be resolved and cannot be modified. To prevent accidentally calling functions you wish to modify - at compile-time, it may be helpful to sort your `comptime` annotation functions into a different submodule crate along with any dependencies they require. - - Unlike raw `comptime {}` blocks, attributes on top-level items in the program do have a set evaluation order. Attributes within a module are evaluated top-down, and attributes - in different modules are evaluated submodule-first. Sibling modules to the same parent module are evaluated in order of the module declarations (`mod foo; mod bar;`) in their - parent module. + at compile-time, it may be helpful to sort your `comptime` annotation functions into a different crate along with any dependencies they require. ### Lowering @@ -92,7 +89,7 @@ fn main() { } ``` -Not all types of values can be lowered. For example, references, `Type`s, and `TypeDefinition`s (among other types) cannot be lowered at all. +Not all types of values can be lowered. For example, `Type`s and `TypeDefinition`s (among other types) cannot be lowered at all. ```rust fn main() { @@ -103,19 +100,6 @@ fn main() { comptime fn get_type() -> Type { ... } ``` -Values of certain types may also change type when they are lowered. For example, a comptime format string will already be -formatted, and thus lowers into a runtime string instead: - -```rust -fn main() { - let foo = comptime { - let i = 2; - f"i = {i}" - }; - assert_eq(foo, "i = 2"); -} -``` - --- ## (Quasi) Quote @@ -159,21 +143,6 @@ comptime fn quote_one() -> Quoted { For those familiar with quoting from other languages (primarily lisps), Noir's `quote` is actually a _quasiquote_. This means we can escape the quoting by using the unquote operator to splice values in the middle of quoted code. -In addition to curly braces, you can also use square braces for the quote operator: - -```rust -comptime { - let q1 = quote { 1 }; - let q2 = quote [ 2 ]; - assert_eq(q1, q2); - - // Square braces can be used to quote mismatched curly braces if needed - let _ = quote[}]; -} -``` - ---- - ## Unquote The unquote operator `$` is usable within a `quote` expression. @@ -202,7 +171,7 @@ If it is an expression (even a parenthesized one), it will do nothing. Most like Unquoting can also be avoided by escaping the `$` with a backslash: -```rust +``` comptime { let x = quote { 1 + 2 }; @@ -211,83 +180,26 @@ comptime { } ``` -### Combining Tokens - -Note that `Quoted` is internally a series of separate tokens, and that all unquoting does is combine these token vectors. -This means that code which appears to append like a string actually appends like a vector internally: - -```rust -comptime { - let x = 3; - let q = quote { foo$x }; // This is [foo, 3], not [foo3] - - // Spaces are ignored in general, they're never part of a token - assert_eq(q, quote { foo 3 }); -} -``` - -If you do want string semantics, you can use format strings then convert back to a `Quoted` value with `.quoted_contents()`. -Note that formatting a quoted value with multiple tokens will always insert a space between each token. If this is -undesired, you'll need to only operate on quoted values containing a single token. To do this, you can iterate -over each token of a larger quoted value with `.tokens()`: - -```rust title="concatenate-example" showLineNumbers -comptime fn concatenate(q1: Quoted, q2: Quoted) -> Quoted { - assert(q1.tokens().len() <= 1); - assert(q2.tokens().len() <= 1); - - f"{q1}{q2}".quoted_contents() - } - - // The CtString type is also useful for a compile-time string of unbounded size - // so that you can append to it in a loop. - comptime fn double_spaced(q: Quoted) -> CtString { - let mut result = "".as_ctstring(); - - for token in q.tokens() { - if result != "".as_ctstring() { - result = result.append_str(" "); - } - result = result.append_fmtstr(f"{token}"); - } - - result - } - - #[test] - fn concatenate_test() { - comptime { - let result = concatenate(quote {foo}, quote {bar}); - assert_eq(result, quote {foobar}); - - let result = double_spaced(quote {foo bar 3}).as_quoted_str!(); - assert_eq(result, "foo bar 3"); - } - } -``` -> Source code: noir_stdlib/src/meta/mod.nr#L255-L288 - - --- -## Attributes +## Annotations -Attributes provide a way to run a `comptime` function on an item in the program. -When you use an attribute, the function with the same name will be called with that item as an argument: +Annotations provide a way to run a `comptime` function on an item in the program. +When you use an annotation, the function with the same name will be called with that item as an argument: ```rust -#[my_struct_attribute] +#[my_struct_annotation] struct Foo {} -comptime fn my_struct_attribute(s: StructDefinition) { - println("Called my_struct_attribute!"); +comptime fn my_struct_annotation(s: StructDefinition) { + println("Called my_struct_annotation!"); } -#[my_function_attribute] +#[my_function_annotation] fn foo() {} -comptime fn my_function_attribute(f: FunctionDefinition) { - println("Called my_function_attribute!"); +comptime fn my_function_annotation(f: FunctionDefinition) { + println("Called my_function_annotation!"); } ``` @@ -324,8 +236,8 @@ trait FieldCount { ### Calling annotations with additional arguments -Arguments may optionally be given to attributes. -When this is done, these additional arguments are passed to the attribute function after the item argument. +Arguments may optionally be given to annotations. +When this is done, these additional arguments are passed to the annotation function after the item argument. ```rust title="annotation-arguments-example" showLineNumbers #[assert_field_is_type(quote { i32 }.as_type())] @@ -342,7 +254,7 @@ When this is done, these additional arguments are passed to the attribute functi > Source code: noir_stdlib/src/meta/mod.nr#L166-L177 -We can also take any number of arguments by adding the `varargs` attribute: +We can also take any number of arguments by adding the `varargs` annotation: ```rust title="annotation-varargs-example" showLineNumbers #[assert_three_args(1, 2, 3)] @@ -358,38 +270,6 @@ We can also take any number of arguments by adding the `varargs` attribute: > Source code: noir_stdlib/src/meta/mod.nr#L179-L189 -### Attribute Evaluation Order - -Unlike the evaluation order of stray `comptime {}` blocks within functions, attributes have a well-defined evaluation -order. Within a module, attributes are evaluated top to bottom. Between modules, attributes in child modules are evaluated -first. Attributes in sibling modules are resolved following the `mod foo; mod bar;` declaration order within their parent -modules. - -```rust -mod foo; // attributes in foo are run first -mod bar; // followed by attributes in bar - -// followed by any attributes in the parent module -#[derive(Eq)] -struct Baz {} -``` - -Note that because of this evaluation order, you may get an error trying to derive a trait for a struct whose fields -have not yet had the trait derived already: - -```rust -// Error! `Bar` field of `Foo` does not (yet) implement Eq! -#[derive(Eq)] -struct Foo { - bar: Bar -} - -#[derive(Eq)] -struct Bar {} -``` - -In this case, the issue can be resolved by rearranging the structs. - --- ## Comptime API diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/data_types/integers.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/data_types/integers.md index 41a823646dd..a1d59bf3166 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/data_types/integers.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/concepts/data_types/integers.md @@ -47,17 +47,6 @@ fn main() { The bit size determines the maximum and minimum range of value the integer type can store. For example, an `i8` variable can store a value in the range of -128 to 127 (i.e. $\\-2^{7}\\$ to $\\2^{7}-1\\$). - -```rust -fn main(x: i16, y: i16) { - // modulo - let c = x % y; - let c = x % -13; -} -``` - -Modulo operation is defined for negative integers thanks to integer division, so that the equality `x = (x/y)*y + (x%y)` holds. - ## 128 bits Unsigned Integers The built-in structure `U128` allows you to use 128-bit unsigned integers almost like a native integer type. However, there are some differences to keep in mind: @@ -79,7 +68,7 @@ fn main() { You can construct a U128 from its limbs: ```rust fn main(x: u64, y: u64) { - let z = U128::from_u64s_be(x,y); + let x = U128::from_u64s_be(x,y); assert(z.hi == x as Field); assert(z.lo == y as Field); } diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/dependencies.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/dependencies.md index 22186b22598..24e02de08fe 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/dependencies.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/dependencies.md @@ -81,10 +81,12 @@ use std::hash::sha256; use std::scalar_mul::fixed_base_embedded_curve; ``` -Lastly, You can import multiple items in the same line by enclosing them in curly braces: +Lastly, as demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives.md#examples), you +can import multiple items in the same line by enclosing them in curly braces: ```rust -use std::hash::{keccak256, sha256}; +use std::ec::tecurve::affine::{Curve, Point}; ``` We don't have a way to consume libraries from inside a [workspace](./workspaces.md) as external dependencies right now. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/workspaces.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/workspaces.md index 2fbf10aec52..513497f12bf 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/workspaces.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/modules_packages_crates/workspaces.md @@ -33,14 +33,10 @@ members = ["crates/a", "crates/b"] default-member = "crates/a" ``` -`members` indicates which packages are included in the workspace. As such, all member packages of a workspace will be processed when the `--workspace` flag is used with various commands or if a `default-member` is not specified. The `--package` option can be used to limit -the scope of some commands to a specific member of the workspace; otherwise these commands run on the package nearest on the path to the -current directory where `nargo` was invoked. +`members` indicates which packages are included in the workspace. As such, all member packages of a workspace will be processed when the `--workspace` flag is used with various commands or if a `default-member` is not specified. `default-member` indicates which package various commands process by default. Libraries can be defined in a workspace. Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. - -Please note that nesting regular packages is not supported: certain commands work on the workspace level and will use the topmost Nargo.toml file they can find on the path; unless this is a workspace configuration with `members`, the command might run on some unintended package. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/black_box_fns.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/black_box_fns.md index e9392b20a92..d6079ab182c 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/black_box_fns.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/black_box_fns.md @@ -14,6 +14,7 @@ Here is a list of the current black box functions: - [AES128](./cryptographic_primitives/ciphers.mdx#aes128) - [SHA256](./cryptographic_primitives/hashes.mdx#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr.mdx) - [Blake2s](./cryptographic_primitives/hashes.mdx#blake2s) - [Blake3](./cryptographic_primitives/hashes.mdx#blake3) - [Pedersen Hash](./cryptographic_primitives/hashes.mdx#pedersen_hash) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/boundedvec.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/boundedvec.md index 1453a99e86e..509b214bf3a 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/boundedvec.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/boundedvec.md @@ -380,66 +380,6 @@ Example: let bounded_vec: BoundedVec = BoundedVec::from_array([1, 2, 3]) ``` -### from_parts - -```rust -pub fn from_parts(mut array: [T; MaxLen], len: u32) -> Self -``` - -Creates a new BoundedVec from the given array and length. -The given length must be less than or equal to the length of the array. - -This function will zero out any elements at or past index `len` of `array`. -This incurs an extra runtime cost of O(MaxLen). If you are sure your array is -zeroed after that index, you can use `from_parts_unchecked` to remove the extra loop. - -Example: - -```rust title="from-parts" showLineNumbers -let vec: BoundedVec = BoundedVec::from_parts([1, 2, 3, 0], 3); - assert_eq(vec.len(), 3); - - // Any elements past the given length are zeroed out, so these - // two BoundedVecs will be completely equal - let vec1: BoundedVec = BoundedVec::from_parts([1, 2, 3, 1], 3); - let vec2: BoundedVec = BoundedVec::from_parts([1, 2, 3, 2], 3); - assert_eq(vec1, vec2); -``` -> Source code: noir_stdlib/src/collections/bounded_vec.nr#L663-L672 - - -### from_parts_unchecked - -```rust -pub fn from_parts_unchecked(array: [T; MaxLen], len: u32) -> Self -``` - -Creates a new BoundedVec from the given array and length. -The given length must be less than or equal to the length of the array. - -This function is unsafe because it expects all elements past the `len` index -of `array` to be zeroed, but does not check for this internally. Use `from_parts` -for a safe version of this function which does zero out any indices past the -given length. Invalidating this assumption can notably cause `BoundedVec::eq` -to give incorrect results since it will check even elements past `len`. - -Example: - -```rust title="from-parts-unchecked" showLineNumbers -let vec: BoundedVec = BoundedVec::from_parts_unchecked([1, 2, 3, 0], 3); - assert_eq(vec.len(), 3); - - // invalid use! - let vec1: BoundedVec = BoundedVec::from_parts_unchecked([1, 2, 3, 1], 3); - let vec2: BoundedVec = BoundedVec::from_parts_unchecked([1, 2, 3, 2], 3); - - // both vecs have length 3 so we'd expect them to be equal, but this - // fails because elements past the length are still checked in eq - assert(vec1 != vec2); -``` -> Source code: noir_stdlib/src/collections/bounded_vec.nr#L677-L688 - - ### map ```rust @@ -454,7 +394,7 @@ Example: let vec: BoundedVec = BoundedVec::from_array([1, 2, 3, 4]); let result = vec.map(|value| value * 2); ``` -> Source code: noir_stdlib/src/collections/bounded_vec.nr#L551-L554 +> Source code: noir_stdlib/src/collections/bounded_vec.nr#L495-L498 ### any diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/hashmap.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/hashmap.md index 810baad16ba..395cc312705 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/hashmap.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/containers/hashmap.md @@ -45,7 +45,7 @@ where /// ``` fn default() -> Self { ``` -> Source code: noir_stdlib/src/collections/map.nr#L688-L703 +> Source code: noir_stdlib/src/collections/map.nr#L681-L696 Creates a fresh, empty HashMap. @@ -61,7 +61,7 @@ Example: let hashmap: HashMap> = HashMap::default(); assert(hashmap.is_empty()); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L208-L211 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L207-L210 Because `HashMap` has so many generic arguments that are likely to be the same throughout @@ -70,7 +70,7 @@ your program, it may be helpful to create a type alias: ```rust title="type_alias" showLineNumbers type MyMap = HashMap>; ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L202-L204 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L201-L203 ### with_hasher @@ -95,7 +95,7 @@ let my_hasher: BuildHasherDefault = Default::default(); HashMap::with_hasher(my_hasher); assert(hashmap.is_empty()); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L212-L217 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L211-L216 ### get @@ -108,7 +108,7 @@ pub fn get(self, key: K) -> Option H: Hasher, { ``` -> Source code: noir_stdlib/src/collections/map.nr#L472-L479 +> Source code: noir_stdlib/src/collections/map.nr#L465-L472 Retrieves a value from the hashmap, returning `Option::none()` if it was not found. @@ -124,7 +124,7 @@ fn get_example(map: HashMap } } ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L297-L305 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L296-L304 ### insert @@ -137,7 +137,7 @@ pub fn insert(&mut self, key: K, value: V) H: Hasher, { ``` -> Source code: noir_stdlib/src/collections/map.nr#L514-L521 +> Source code: noir_stdlib/src/collections/map.nr#L507-L514 Inserts a new key-value pair into the map. If the key was already in the map, its @@ -150,7 +150,7 @@ let mut map: HashMap> = Has map.insert(12, 42); assert(map.len() == 1); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L218-L222 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L217-L221 ### remove @@ -163,7 +163,7 @@ pub fn remove(&mut self, key: K) H: Hasher, { ``` -> Source code: noir_stdlib/src/collections/map.nr#L570-L577 +> Source code: noir_stdlib/src/collections/map.nr#L563-L570 Removes the given key-value pair from the map. If the key was not already present @@ -179,7 +179,7 @@ map.remove(12); map.remove(12); assert(map.is_empty()); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L225-L232 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L224-L231 ### is_empty @@ -203,7 +203,7 @@ assert(map.is_empty()); map.remove(1); assert(map.is_empty()); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L233-L241 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L232-L240 ### len @@ -211,7 +211,7 @@ assert(map.is_empty()); ```rust title="len" showLineNumbers pub fn len(self) -> u32 { ``` -> Source code: noir_stdlib/src/collections/map.nr#L431-L433 +> Source code: noir_stdlib/src/collections/map.nr#L424-L426 Returns the current length of this hash map. @@ -234,7 +234,7 @@ Example: map.remove(1); assert(map.len() == 2); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L242-L257 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L241-L256 ### capacity @@ -242,7 +242,7 @@ Example: ```rust title="capacity" showLineNumbers pub fn capacity(_self: Self) -> u32 { ``` -> Source code: noir_stdlib/src/collections/map.nr#L453-L455 +> Source code: noir_stdlib/src/collections/map.nr#L446-L448 Returns the maximum capacity of this hashmap. This is always equal to the capacity @@ -262,7 +262,7 @@ let empty_map: HashMap> = assert(empty_map.len() == 0); assert(empty_map.capacity() == 42); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L258-L263 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L257-L262 ### clear @@ -282,7 +282,7 @@ assert(!map.is_empty()); map.clear(); assert(map.is_empty()); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L264-L268 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L263-L267 ### contains_key @@ -311,7 +311,7 @@ if map.contains_key(7) { println("No value for key 7!"); } ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L269-L276 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L268-L275 ### entries @@ -340,7 +340,7 @@ let entries = map.entries(); } } ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L308-L319 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L307-L318 ### keys @@ -348,7 +348,7 @@ let entries = map.entries(); ```rust title="keys" showLineNumbers pub fn keys(self) -> BoundedVec { ``` -> Source code: noir_stdlib/src/collections/map.nr#L230-L232 +> Source code: noir_stdlib/src/collections/map.nr#L227-L229 Returns a vector of each key present in the hashmap. @@ -368,7 +368,7 @@ let keys = map.keys(); } } ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L320-L330 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L319-L329 ### values @@ -376,7 +376,7 @@ let keys = map.keys(); ```rust title="values" showLineNumbers pub fn values(self) -> BoundedVec { ``` -> Source code: noir_stdlib/src/collections/map.nr#L267-L269 +> Source code: noir_stdlib/src/collections/map.nr#L262-L264 Returns a vector of each value present in the hashmap. @@ -395,7 +395,7 @@ let values = map.values(); } } ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L331-L340 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L330-L339 ### iter_mut @@ -408,7 +408,7 @@ pub fn iter_mut(&mut self, f: fn(K, V) -> (K, V)) H: Hasher, { ``` -> Source code: noir_stdlib/src/collections/map.nr#L304-L311 +> Source code: noir_stdlib/src/collections/map.nr#L297-L304 Iterates through each key-value pair of the HashMap, setting each key-value pair to the @@ -427,7 +427,7 @@ Example: // Add 1 to each key in the map, and double the value associated with that key. map.iter_mut(|k, v| (k + 1, v * 2)); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L344-L347 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L343-L346 ### iter_keys_mut @@ -440,7 +440,7 @@ pub fn iter_keys_mut(&mut self, f: fn(K) -> K) H: Hasher, { ``` -> Source code: noir_stdlib/src/collections/map.nr#L342-L349 +> Source code: noir_stdlib/src/collections/map.nr#L335-L342 Iterates through the HashMap, mutating each key to the result returned from @@ -459,7 +459,7 @@ Example: // Double each key, leaving the value associated with that key untouched map.iter_keys_mut(|k| k * 2); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L348-L351 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L347-L350 ### iter_values_mut @@ -467,7 +467,7 @@ Example: ```rust title="iter_values_mut" showLineNumbers pub fn iter_values_mut(&mut self, f: fn(V) -> V) { ``` -> Source code: noir_stdlib/src/collections/map.nr#L374-L376 +> Source code: noir_stdlib/src/collections/map.nr#L367-L369 Iterates through the HashMap, applying the given function to each value and mutating the @@ -480,7 +480,7 @@ Example: // Halve each value map.iter_values_mut(|v| v / 2); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L352-L355 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L351-L354 ### retain @@ -488,7 +488,7 @@ Example: ```rust title="retain" showLineNumbers pub fn retain(&mut self, f: fn(K, V) -> bool) { ``` -> Source code: noir_stdlib/src/collections/map.nr#L395-L397 +> Source code: noir_stdlib/src/collections/map.nr#L388-L390 Retains only the key-value pairs for which the given function returns true. @@ -499,7 +499,7 @@ Example: ```rust title="retain_example" showLineNumbers map.retain(|k, v| (k != 0) & (v != 0)); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L280-L282 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L279-L281 ## Trait Implementations @@ -522,7 +522,7 @@ where /// ``` fn default() -> Self { ``` -> Source code: noir_stdlib/src/collections/map.nr#L688-L703 +> Source code: noir_stdlib/src/collections/map.nr#L681-L696 Constructs an empty HashMap. @@ -533,7 +533,7 @@ Example: let hashmap: HashMap> = HashMap::default(); assert(hashmap.is_empty()); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L208-L211 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L207-L210 ### eq @@ -564,7 +564,7 @@ where /// ``` fn eq(self, other: HashMap) -> bool { ``` -> Source code: noir_stdlib/src/collections/map.nr#L636-L661 +> Source code: noir_stdlib/src/collections/map.nr#L629-L654 Checks if two HashMaps are equal. @@ -583,5 +583,5 @@ let mut map1: HashMap> = Hash assert(map1 == map2); ``` -> Source code: test_programs/execution_success/hashmap/src/main.nr#L283-L294 +> Source code: test_programs/execution_success/hashmap/src/main.nr#L282-L293 diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/ec_primitives.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/ec_primitives.md index f262d8160d6..00b8071487e 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/ec_primitives.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/ec_primitives.md @@ -97,6 +97,5 @@ fn bjj_pub_key(priv_key: Field) -> Point This would come in handy in a Merkle proof. - EdDSA signature verification: This is a matter of combining these primitives with a suitable hash - function. See - [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for - the case of Baby Jubjub and the Poseidon hash function. + function. See the [eddsa](https://github.com/noir-lang/eddsa) library an example of eddsa signature verification + over the Baby Jubjub curve. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/eddsa.mdx b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/eddsa.mdx deleted file mode 100644 index b283de693c8..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/eddsa.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: EdDSA Verification -description: Learn about the cryptographic primitives regarding EdDSA -keywords: [cryptographic primitives, Noir project, eddsa, signatures] -sidebar_position: 5 ---- - -import BlackBoxInfo from '@site/src/components/Notes/_blackbox'; - -## eddsa::eddsa_poseidon_verify - -Verifier for EdDSA signatures - -```rust -fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool -``` - -It is also possible to specify the hash algorithm used for the signature by using the `eddsa_verify` function by passing a type implementing the Hasher trait with the turbofish operator. -For instance, if you want to use Poseidon2 instead, you can do the following: -```rust -use std::hash::poseidon2::Poseidon2Hasher; - -eddsa_verify::(pub_key_a.x, pub_key_a.y, s_a, r8_a.x, r8_a.y, msg); -``` - - - -## eddsa::eddsa_to_pub - -Private to public key conversion. - -Returns `(pub_key_x, pub_key_y)` - -```rust -fn eddsa_to_pub(secret : Field) -> (Field, Field) -``` - diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/schnorr.mdx b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/schnorr.mdx index 0058c0c0c98..030452645c5 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/schnorr.mdx +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/cryptographic_primitives/schnorr.mdx @@ -17,7 +17,7 @@ pub fn verify_signature( public_key_x: Field, public_key_y: Field, signature: [u8; 64], - message: [u8; N] + message: [u8; N], ) -> bool ``` > Source code: noir_stdlib/src/schnorr.nr#L4-L11 @@ -55,7 +55,7 @@ pub fn verify_signature_slice( public_key_x: Field, public_key_y: Field, signature: [u8; 64], - message: [u8] + message: [u8], ) -> bool ``` > Source code: noir_stdlib/src/schnorr.nr#L15-L22 diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/mem.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/mem.md index 1e9102b32dc..3619550273e 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/mem.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/mem.md @@ -42,7 +42,7 @@ fn checked_transmute(value: T) -> U Transmutes a value of one type into the same value but with a new type `U`. This function is safe to use since both types are asserted to be equal later during compilation after the concrete values for generic types become known. -This function is useful for cases where the compiler may fail a type check that is expected to pass where +This function is useful for cases where the compiler may fails a type check that is expected to pass where a user knows the two types to be equal. For example, when using arithmetic generics there are cases the compiler does not see as equal, such as `[Field; N*(A + B)]` and `[Field; N*A + N*B]`, which users may know to be equal. In these cases, `checked_transmute` can be used to cast the value to the desired type while also preserving safety diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/index.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/index.md index 4cacafbe345..14544c07442 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/index.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/index.md @@ -178,7 +178,7 @@ way to write your derive handler. The arguments are as follows: - `for_each_field`: An operation to be performed on each field. E.g. `|name| quote { (self.$name == other.$name) }`. - `join_fields_with`: A separator to join each result of `for_each_field` with. E.g. `quote { & }`. You can also use an empty `quote {}` for no separator. -- `body`: The result of the field operations is passed into this function for any final processing. +- `body`: The result of the field operations are passed into this function for any final processing. This is the place to insert any setup/teardown code the trait requires. If the trait doesn't require any such code, you can return the body as-is: `|body| body`. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/op.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/op.md index b53208d6507..03ea49ad8ec 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/op.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/op.md @@ -218,10 +218,10 @@ pub fn is_shift_right(self) -> bool { #### is_shift_left -```rust title="is_shift_left" showLineNumbers -pub fn is_shift_left(self) -> bool { +```rust title="is_shift_right" showLineNumbers +pub fn is_shift_right(self) -> bool { ``` -> Source code: noir_stdlib/src/meta/op.nr#L170-L172 +> Source code: noir_stdlib/src/meta/op.nr#L164-L166 `true` if this operator is `<<` diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/typ.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/typ.md index 3a85a739a4c..90222c222f5 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/typ.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/meta/typ.md @@ -180,7 +180,7 @@ pub comptime fn get_trait_impl(self, constraint: TraitConstraint) -> Option - -## Example usage - -```rust - -fn main( - verification_key : [Field; 114], - proof : [Field; 93], - public_inputs : [Field; 1], - key_hash : Field, - proof_b : [Field; 93], -) { - std::verify_proof( - verification_key, - proof, - public_inputs, - key_hash - ); - - std::verify_proof( - verification_key, - proof_b, - public_inputs, - key_hash - ); -} -``` - -You can see a full example of recursive proofs in [this example recursion demo repo](https://github.com/noir-lang/noir-examples/tree/master/recursion). - -## Parameters - -### `verification_key` - -The verification key for the zk program that is being verified. - -### `proof` - -The proof for the zk program that is being verified. - -### `public_inputs` - -These represent the public inputs of the proof we are verifying. - -### `key_hash` - -A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/zeroed.md b/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/zeroed.md deleted file mode 100644 index f450fecdd36..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/noir/standard_library/zeroed.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Zeroed Function -description: - The zeroed function returns a zeroed value of any type. -keywords: - [ - zeroed - ] ---- - -Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. - -You can access the function at `std::unsafe::zeroed`. - -This function currently supports the following types: - -- Field -- Bool -- Uint -- Array -- Slice -- String -- Tuple -- Function - -Using it on other types could result in unexpected behavior. diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/.nojekyll b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/.nojekyll deleted file mode 100644 index e2ac6616add..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/BarretenbergBackend.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/BarretenbergBackend.md deleted file mode 100644 index bf84a5851e4..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/BarretenbergBackend.md +++ /dev/null @@ -1,158 +0,0 @@ -# BarretenbergBackend - -## Implements - -- [`Backend`](../interfaces/Backend.md) -- `VerifierBackend` - -## Constructors - -### new BarretenbergBackend(acirCircuit, options) - -```ts -new BarretenbergBackend(acirCircuit, options): BarretenbergBackend -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `acirCircuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | -| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | - -#### Returns - -[`BarretenbergBackend`](BarretenbergBackend.md) - -## Properties - -| Property | Type | Description | -| :------ | :------ | :------ | -| `backend` | `UltraPlonkBackend` | - | - -## Methods - -### destroy() - -```ts -destroy(): Promise -``` - -#### Returns - -`Promise`\<`void`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`destroy`](../interfaces/Backend.md#destroy) - -#### Description - -Destroys the backend - -*** - -### generateProof() - -```ts -generateProof(compressedWitness): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `compressedWitness` | `Uint8Array` | - -#### Returns - -`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`generateProof`](../interfaces/Backend.md#generateproof) - -#### Description - -Generates a proof - -*** - -### generateRecursiveProofArtifacts() - -```ts -generateRecursiveProofArtifacts(proofData, numOfPublicInputs): Promise -``` - -Generates artifacts that will be passed to a circuit that will verify this proof. - -Instead of passing the proof and verification key as a byte array, we pass them -as fields which makes it cheaper to verify in a circuit. - -The proof that is passed here will have been created using a circuit -that has the #[recursive] attribute on its `main` method. - -The number of public inputs denotes how many public inputs are in the inner proof. - -#### Parameters - -| Parameter | Type | Default value | -| :------ | :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | `undefined` | -| `numOfPublicInputs` | `number` | `0` | - -#### Returns - -`Promise`\<`object`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`generateRecursiveProofArtifacts`](../interfaces/Backend.md#generaterecursiveproofartifacts) - -#### Example - -```typescript -const artifacts = await backend.generateRecursiveProofArtifacts(proof, numOfPublicInputs); -``` - -*** - -### getVerificationKey() - -```ts -getVerificationKey(): Promise -``` - -#### Returns - -`Promise`\<`Uint8Array`\> - -*** - -### verifyProof() - -```ts -verifyProof(proofData): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | - -#### Returns - -`Promise`\<`boolean`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`verifyProof`](../interfaces/Backend.md#verifyproof) - -#### Description - -Verifies a proof - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/BarretenbergVerifier.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/BarretenbergVerifier.md deleted file mode 100644 index 3d8634ecc71..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/BarretenbergVerifier.md +++ /dev/null @@ -1,58 +0,0 @@ -# BarretenbergVerifier - -## Constructors - -### new BarretenbergVerifier(options) - -```ts -new BarretenbergVerifier(options): BarretenbergVerifier -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | - -#### Returns - -[`BarretenbergVerifier`](BarretenbergVerifier.md) - -## Methods - -### destroy() - -```ts -destroy(): Promise -``` - -#### Returns - -`Promise`\<`void`\> - -*** - -### verifyProof() - -```ts -verifyProof(proofData, verificationKey): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | -| `verificationKey` | `Uint8Array` | - -#### Returns - -`Promise`\<`boolean`\> - -#### Description - -Verifies a proof - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/UltraHonkBackend.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/UltraHonkBackend.md deleted file mode 100644 index a3a42c71740..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/UltraHonkBackend.md +++ /dev/null @@ -1,146 +0,0 @@ -# UltraHonkBackend - -## Implements - -- [`Backend`](../interfaces/Backend.md) -- `VerifierBackend` - -## Constructors - -### new UltraHonkBackend(acirCircuit, options) - -```ts -new UltraHonkBackend(acirCircuit, options): UltraHonkBackend -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `acirCircuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | -| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | - -#### Returns - -[`UltraHonkBackend`](UltraHonkBackend.md) - -## Properties - -| Property | Type | Description | -| :------ | :------ | :------ | -| `backend` | `UltraHonkBackend` | - | - -## Methods - -### destroy() - -```ts -destroy(): Promise -``` - -#### Returns - -`Promise`\<`void`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`destroy`](../interfaces/Backend.md#destroy) - -#### Description - -Destroys the backend - -*** - -### generateProof() - -```ts -generateProof(compressedWitness): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `compressedWitness` | `Uint8Array` | - -#### Returns - -`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`generateProof`](../interfaces/Backend.md#generateproof) - -#### Description - -Generates a proof - -*** - -### generateRecursiveProofArtifacts() - -```ts -generateRecursiveProofArtifacts(proofData, numOfPublicInputs): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | -| `numOfPublicInputs` | `number` | - -#### Returns - -`Promise`\<`object`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`generateRecursiveProofArtifacts`](../interfaces/Backend.md#generaterecursiveproofartifacts) - -#### Description - -Retrieves the artifacts from a proof in the Field format - -*** - -### getVerificationKey() - -```ts -getVerificationKey(): Promise -``` - -#### Returns - -`Promise`\<`Uint8Array`\> - -*** - -### verifyProof() - -```ts -verifyProof(proofData): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | - -#### Returns - -`Promise`\<`boolean`\> - -#### Implementation of - -[`Backend`](../interfaces/Backend.md).[`verifyProof`](../interfaces/Backend.md#verifyproof) - -#### Description - -Verifies a proof - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/UltraHonkVerifier.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/UltraHonkVerifier.md deleted file mode 100644 index 318557965af..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/classes/UltraHonkVerifier.md +++ /dev/null @@ -1,58 +0,0 @@ -# UltraHonkVerifier - -## Constructors - -### new UltraHonkVerifier(options) - -```ts -new UltraHonkVerifier(options): UltraHonkVerifier -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | - -#### Returns - -[`UltraHonkVerifier`](UltraHonkVerifier.md) - -## Methods - -### destroy() - -```ts -destroy(): Promise -``` - -#### Returns - -`Promise`\<`void`\> - -*** - -### verifyProof() - -```ts -verifyProof(proofData, verificationKey): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | -| `verificationKey` | `Uint8Array` | - -#### Returns - -`Promise`\<`boolean`\> - -#### Description - -Verifies a proof - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/index.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/index.md deleted file mode 100644 index ac0e28182b6..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/index.md +++ /dev/null @@ -1,30 +0,0 @@ -# backend_barretenberg - -## Exports - -### Classes - -| Class | Description | -| :------ | :------ | -| [BarretenbergBackend](classes/BarretenbergBackend.md) | - | -| [BarretenbergVerifier](classes/BarretenbergVerifier.md) | - | -| [UltraHonkBackend](classes/UltraHonkBackend.md) | - | -| [UltraHonkVerifier](classes/UltraHonkVerifier.md) | - | - -### Interfaces - -| Interface | Description | -| :------ | :------ | -| [Backend](interfaces/Backend.md) | - | - -### Type Aliases - -| Type alias | Description | -| :------ | :------ | -| [BackendOptions](type-aliases/BackendOptions.md) | - | -| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | -| [ProofData](type-aliases/ProofData.md) | - | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/interfaces/Backend.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/interfaces/Backend.md deleted file mode 100644 index fe1d688d52c..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/interfaces/Backend.md +++ /dev/null @@ -1,100 +0,0 @@ -# Backend - -## Extends - -- `VerifierBackend` - -## Methods - -### destroy() - -```ts -destroy(): Promise -``` - -#### Returns - -`Promise`\<`void`\> - -#### Inherited from - -VerifierBackend.destroy - -#### Description - -Destroys the backend - -*** - -### generateProof() - -```ts -generateProof(decompressedWitness): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `decompressedWitness` | `Uint8Array` | - -#### Returns - -`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> - -#### Description - -Generates a proof - -*** - -### generateRecursiveProofArtifacts() - -```ts -generateRecursiveProofArtifacts(proofData, numOfPublicInputs): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | -| `numOfPublicInputs` | `number` | - -#### Returns - -`Promise`\<`object`\> - -#### Description - -Retrieves the artifacts from a proof in the Field format - -*** - -### verifyProof() - -```ts -verifyProof(proofData): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | - -#### Returns - -`Promise`\<`boolean`\> - -#### Inherited from - -VerifierBackend.verifyProof - -#### Description - -Verifies a proof - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/BackendOptions.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/BackendOptions.md deleted file mode 100644 index 99ade2ce6f7..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/BackendOptions.md +++ /dev/null @@ -1,18 +0,0 @@ -# BackendOptions - -```ts -type BackendOptions: object; -``` - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `memory` | `object` | - | -| `memory.initial` | `number` | - | -| `memory.maximum` | `number` | - | -| `threads` | `number` | - | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/CompiledCircuit.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/CompiledCircuit.md deleted file mode 100644 index 34e0dd04205..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/CompiledCircuit.md +++ /dev/null @@ -1,20 +0,0 @@ -# CompiledCircuit - -```ts -type CompiledCircuit: object; -``` - -## Description - -The representation of a compiled circuit - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `abi` | `Abi` | **Description**

ABI representation of the circuit | -| `bytecode` | `string` | **Description**

The bytecode of the circuit | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/ProofData.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/ProofData.md deleted file mode 100644 index 05cebbc4e94..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/type-aliases/ProofData.md +++ /dev/null @@ -1,20 +0,0 @@ -# ProofData - -```ts -type ProofData: object; -``` - -## Description - -The representation of a proof - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | -| `publicInputs` | `string`[] | **Description**

Public inputs of a proof | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/typedoc-sidebar.cjs b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/typedoc-sidebar.cjs deleted file mode 100644 index 14d240c8158..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/backend_barretenberg/typedoc-sidebar.cjs +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-check -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"reference/NoirJS/backend_barretenberg/classes/BarretenbergBackend","label":"BarretenbergBackend"},{"type":"doc","id":"reference/NoirJS/backend_barretenberg/classes/BarretenbergVerifier","label":"BarretenbergVerifier"},{"type":"doc","id":"reference/NoirJS/backend_barretenberg/classes/UltraHonkBackend","label":"UltraHonkBackend"},{"type":"doc","id":"reference/NoirJS/backend_barretenberg/classes/UltraHonkVerifier","label":"UltraHonkVerifier"}]},{"type":"category","label":"Interfaces","items":[{"type":"doc","id":"reference/NoirJS/backend_barretenberg/interfaces/Backend","label":"Backend"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"reference/NoirJS/backend_barretenberg/type-aliases/BackendOptions","label":"BackendOptions"},{"type":"doc","id":"reference/NoirJS/backend_barretenberg/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"reference/NoirJS/backend_barretenberg/type-aliases/ProofData","label":"ProofData"}]}]}; -module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/.nojekyll b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/.nojekyll deleted file mode 100644 index e2ac6616add..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/classes/Noir.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/classes/Noir.md deleted file mode 100644 index 226e591ac04..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/classes/Noir.md +++ /dev/null @@ -1,52 +0,0 @@ -# Noir - -## Constructors - -### new Noir(circuit) - -```ts -new Noir(circuit): Noir -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `circuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | - -#### Returns - -[`Noir`](Noir.md) - -## Methods - -### execute() - -```ts -execute(inputs, foreignCallHandler?): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `inputs` | [`InputMap`](../type-aliases/InputMap.md) | -| `foreignCallHandler`? | [`ForeignCallHandler`](../type-aliases/ForeignCallHandler.md) | - -#### Returns - -`Promise`\<`object`\> - -#### Description - -Allows to execute a circuit to get its witness and return value. - -#### Example - -```typescript -async execute(inputs) -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/and.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/and.md deleted file mode 100644 index c783283e396..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/and.md +++ /dev/null @@ -1,22 +0,0 @@ -# and() - -```ts -and(lhs, rhs): string -``` - -Performs a bitwise AND operation between `lhs` and `rhs` - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `lhs` | `string` | | -| `rhs` | `string` | | - -## Returns - -`string` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/blake2s256.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/blake2s256.md deleted file mode 100644 index a6358fd3e21..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/blake2s256.md +++ /dev/null @@ -1,21 +0,0 @@ -# blake2s256() - -```ts -blake2s256(inputs): Uint8Array -``` - -Calculates the Blake2s256 hash of the input bytes - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `inputs` | `Uint8Array`\<`ArrayBufferLike`\> | | - -## Returns - -`Uint8Array` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/ecdsa_secp256k1_verify.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/ecdsa_secp256k1_verify.md deleted file mode 100644 index bffdedd8c69..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/ecdsa_secp256k1_verify.md +++ /dev/null @@ -1,28 +0,0 @@ -# ecdsa\_secp256k1\_verify() - -```ts -ecdsa_secp256k1_verify( - hashed_msg, - public_key_x_bytes, - public_key_y_bytes, - signature): boolean -``` - -Verifies a ECDSA signature over the secp256k1 curve. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `hashed_msg` | `Uint8Array`\<`ArrayBufferLike`\> | | -| `public_key_x_bytes` | `Uint8Array`\<`ArrayBufferLike`\> | | -| `public_key_y_bytes` | `Uint8Array`\<`ArrayBufferLike`\> | | -| `signature` | `Uint8Array`\<`ArrayBufferLike`\> | | - -## Returns - -`boolean` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/ecdsa_secp256r1_verify.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/ecdsa_secp256r1_verify.md deleted file mode 100644 index 79e2a87fda7..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/ecdsa_secp256r1_verify.md +++ /dev/null @@ -1,28 +0,0 @@ -# ecdsa\_secp256r1\_verify() - -```ts -ecdsa_secp256r1_verify( - hashed_msg, - public_key_x_bytes, - public_key_y_bytes, - signature): boolean -``` - -Verifies a ECDSA signature over the secp256r1 curve. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `hashed_msg` | `Uint8Array`\<`ArrayBufferLike`\> | | -| `public_key_x_bytes` | `Uint8Array`\<`ArrayBufferLike`\> | | -| `public_key_y_bytes` | `Uint8Array`\<`ArrayBufferLike`\> | | -| `signature` | `Uint8Array`\<`ArrayBufferLike`\> | | - -## Returns - -`boolean` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/xor.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/xor.md deleted file mode 100644 index 8d762b895d3..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/functions/xor.md +++ /dev/null @@ -1,22 +0,0 @@ -# xor() - -```ts -xor(lhs, rhs): string -``` - -Performs a bitwise XOR operation between `lhs` and `rhs` - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `lhs` | `string` | | -| `rhs` | `string` | | - -## Returns - -`string` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/index.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/index.md deleted file mode 100644 index d0190f6d416..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/index.md +++ /dev/null @@ -1,35 +0,0 @@ -# noir_js - -## Exports - -### Classes - -| Class | Description | -| :------ | :------ | -| [Noir](classes/Noir.md) | - | - -### Type Aliases - -| Type alias | Description | -| :------ | :------ | -| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | -| [ErrorWithPayload](type-aliases/ErrorWithPayload.md) | - | -| [ForeignCallHandler](type-aliases/ForeignCallHandler.md) | - | -| [ForeignCallInput](type-aliases/ForeignCallInput.md) | - | -| [ForeignCallOutput](type-aliases/ForeignCallOutput.md) | - | -| [InputMap](type-aliases/InputMap.md) | - | -| [WitnessMap](type-aliases/WitnessMap.md) | - | - -### Functions - -| Function | Description | -| :------ | :------ | -| [and](functions/and.md) | Performs a bitwise AND operation between `lhs` and `rhs` | -| [blake2s256](functions/blake2s256.md) | Calculates the Blake2s256 hash of the input bytes | -| [ecdsa\_secp256k1\_verify](functions/ecdsa_secp256k1_verify.md) | Verifies a ECDSA signature over the secp256k1 curve. | -| [ecdsa\_secp256r1\_verify](functions/ecdsa_secp256r1_verify.md) | Verifies a ECDSA signature over the secp256r1 curve. | -| [xor](functions/xor.md) | Performs a bitwise XOR operation between `lhs` and `rhs` | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/CompiledCircuit.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/CompiledCircuit.md deleted file mode 100644 index 34e0dd04205..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/CompiledCircuit.md +++ /dev/null @@ -1,20 +0,0 @@ -# CompiledCircuit - -```ts -type CompiledCircuit: object; -``` - -## Description - -The representation of a compiled circuit - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `abi` | `Abi` | **Description**

ABI representation of the circuit | -| `bytecode` | `string` | **Description**

The bytecode of the circuit | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ErrorWithPayload.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ErrorWithPayload.md deleted file mode 100644 index e8c2f4aef3d..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ErrorWithPayload.md +++ /dev/null @@ -1,15 +0,0 @@ -# ErrorWithPayload - -```ts -type ErrorWithPayload: ExecutionError & object; -``` - -## Type declaration - -| Member | Type | Description | -| :------ | :------ | :------ | -| `decodedAssertionPayload` | `any` | - | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallHandler.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallHandler.md deleted file mode 100644 index 5243e6524bf..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallHandler.md +++ /dev/null @@ -1,22 +0,0 @@ -# ForeignCallHandler - -```ts -type ForeignCallHandler: (name, inputs) => Promise; -``` - -A callback which performs an foreign call and returns the response. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `name` | `string` | The identifier for the type of foreign call being performed. | -| `inputs` | [`ForeignCallInput`](ForeignCallInput.md)[] | An array of hex encoded inputs to the foreign call. | - -## Returns - -`Promise`\<[`ForeignCallOutput`](ForeignCallOutput.md)[]\> - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallInput.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallInput.md deleted file mode 100644 index dd95809186a..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallInput.md +++ /dev/null @@ -1,9 +0,0 @@ -# ForeignCallInput - -```ts -type ForeignCallInput: string[]; -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallOutput.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallOutput.md deleted file mode 100644 index b71fb78a946..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/ForeignCallOutput.md +++ /dev/null @@ -1,9 +0,0 @@ -# ForeignCallOutput - -```ts -type ForeignCallOutput: string | string[]; -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/InputMap.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/InputMap.md deleted file mode 100644 index c714e999d93..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/InputMap.md +++ /dev/null @@ -1,13 +0,0 @@ -# InputMap - -```ts -type InputMap: object; -``` - -## Index signature - - \[`key`: `string`\]: `InputValue` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/WitnessMap.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/WitnessMap.md deleted file mode 100644 index 258c46f9d0c..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/type-aliases/WitnessMap.md +++ /dev/null @@ -1,9 +0,0 @@ -# WitnessMap - -```ts -type WitnessMap: Map; -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/typedoc-sidebar.cjs b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/typedoc-sidebar.cjs deleted file mode 100644 index 809670a27db..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_js/typedoc-sidebar.cjs +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-check -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"reference/NoirJS/noir_js/classes/Noir","label":"Noir"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"reference/NoirJS/noir_js/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"reference/NoirJS/noir_js/type-aliases/ErrorWithPayload","label":"ErrorWithPayload"},{"type":"doc","id":"reference/NoirJS/noir_js/type-aliases/ForeignCallHandler","label":"ForeignCallHandler"},{"type":"doc","id":"reference/NoirJS/noir_js/type-aliases/ForeignCallInput","label":"ForeignCallInput"},{"type":"doc","id":"reference/NoirJS/noir_js/type-aliases/ForeignCallOutput","label":"ForeignCallOutput"},{"type":"doc","id":"reference/NoirJS/noir_js/type-aliases/InputMap","label":"InputMap"},{"type":"doc","id":"reference/NoirJS/noir_js/type-aliases/WitnessMap","label":"WitnessMap"}]},{"type":"category","label":"Functions","items":[{"type":"doc","id":"reference/NoirJS/noir_js/functions/and","label":"and"},{"type":"doc","id":"reference/NoirJS/noir_js/functions/blake2s256","label":"blake2s256"},{"type":"doc","id":"reference/NoirJS/noir_js/functions/ecdsa_secp256k1_verify","label":"ecdsa_secp256k1_verify"},{"type":"doc","id":"reference/NoirJS/noir_js/functions/ecdsa_secp256r1_verify","label":"ecdsa_secp256r1_verify"},{"type":"doc","id":"reference/NoirJS/noir_js/functions/xor","label":"xor"}]}]}; -module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/.nojekyll b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/.nojekyll deleted file mode 100644 index e2ac6616add..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/compile.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/compile.md deleted file mode 100644 index 6faf763b37f..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/compile.md +++ /dev/null @@ -1,51 +0,0 @@ -# compile() - -```ts -compile( - fileManager, - projectPath?, - logFn?, -debugLogFn?): Promise -``` - -Compiles a Noir project - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `fileManager` | `FileManager` | The file manager to use | -| `projectPath`? | `string` | The path to the project inside the file manager. Defaults to the root of the file manager | -| `logFn`? | `LogFn` | A logging function. If not provided, console.log will be used | -| `debugLogFn`? | `LogFn` | A debug logging function. If not provided, logFn will be used | - -## Returns - -`Promise`\<[`ProgramCompilationArtifacts`](../index.md#programcompilationartifacts)\> - -## Example - -```typescript -// Node.js - -import { compile_program, createFileManager } from '@noir-lang/noir_wasm'; - -const fm = createFileManager(myProjectPath); -const myCompiledCode = await compile_program(fm); -``` - -```typescript -// Browser - -import { compile_program, createFileManager } from '@noir-lang/noir_wasm'; - -const fm = createFileManager('/'); -for (const path of files) { - await fm.writeFile(path, await getFileAsStream(path)); -} -const myCompiledCode = await compile_program(fm); -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/compile_contract.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/compile_contract.md deleted file mode 100644 index 7d0b39a43ef..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/compile_contract.md +++ /dev/null @@ -1,51 +0,0 @@ -# compile\_contract() - -```ts -compile_contract( - fileManager, - projectPath?, - logFn?, -debugLogFn?): Promise -``` - -Compiles a Noir project - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `fileManager` | `FileManager` | The file manager to use | -| `projectPath`? | `string` | The path to the project inside the file manager. Defaults to the root of the file manager | -| `logFn`? | `LogFn` | A logging function. If not provided, console.log will be used | -| `debugLogFn`? | `LogFn` | A debug logging function. If not provided, logFn will be used | - -## Returns - -`Promise`\<[`ContractCompilationArtifacts`](../index.md#contractcompilationartifacts)\> - -## Example - -```typescript -// Node.js - -import { compile_contract, createFileManager } from '@noir-lang/noir_wasm'; - -const fm = createFileManager(myProjectPath); -const myCompiledCode = await compile_contract(fm); -``` - -```typescript -// Browser - -import { compile_contract, createFileManager } from '@noir-lang/noir_wasm'; - -const fm = createFileManager('/'); -for (const path of files) { - await fm.writeFile(path, await getFileAsStream(path)); -} -const myCompiledCode = await compile_contract(fm); -``` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/createFileManager.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/createFileManager.md deleted file mode 100644 index 7e65c1d69c7..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/createFileManager.md +++ /dev/null @@ -1,21 +0,0 @@ -# createFileManager() - -```ts -createFileManager(dataDir): FileManager -``` - -Creates a new FileManager instance based on fs in node and memfs in the browser (via webpack alias) - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `dataDir` | `string` | root of the file system | - -## Returns - -`FileManager` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/inflateDebugSymbols.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/inflateDebugSymbols.md deleted file mode 100644 index fcea9275341..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/functions/inflateDebugSymbols.md +++ /dev/null @@ -1,21 +0,0 @@ -# inflateDebugSymbols() - -```ts -inflateDebugSymbols(debugSymbols): any -``` - -Decompresses and decodes the debug symbols - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `debugSymbols` | `string` | The base64 encoded debug symbols | - -## Returns - -`any` - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/index.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/index.md deleted file mode 100644 index b6e0f9d1bc0..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/index.md +++ /dev/null @@ -1,49 +0,0 @@ -# noir_wasm - -## Exports - -### Functions - -| Function | Description | -| :------ | :------ | -| [compile](functions/compile.md) | Compiles a Noir project | -| [compile\_contract](functions/compile_contract.md) | Compiles a Noir project | -| [createFileManager](functions/createFileManager.md) | Creates a new FileManager instance based on fs in node and memfs in the browser (via webpack alias) | -| [inflateDebugSymbols](functions/inflateDebugSymbols.md) | Decompresses and decodes the debug symbols | - -## References - -### compile\_program - -Renames and re-exports [compile](functions/compile.md) - -## Interfaces - -### ContractCompilationArtifacts - -The compilation artifacts of a given contract. - -#### Properties - -| Property | Type | Description | -| :------ | :------ | :------ | -| `contract` | `ContractArtifact` | The compiled contract. | -| `warnings` | `unknown`[] | Compilation warnings. | - -*** - -### ProgramCompilationArtifacts - -The compilation artifacts of a given program. - -#### Properties - -| Property | Type | Description | -| :------ | :------ | :------ | -| `name` | `string` | not part of the compilation output, injected later | -| `program` | `ProgramArtifact` | The compiled contract. | -| `warnings` | `unknown`[] | Compilation warnings. | - -*** - -Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/typedoc-sidebar.cjs b/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/typedoc-sidebar.cjs deleted file mode 100644 index e0870710349..00000000000 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/NoirJS/noir_wasm/typedoc-sidebar.cjs +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-check -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const typedocSidebar = { items: [{"type":"doc","id":"reference/NoirJS/noir_wasm/index","label":"API"},{"type":"category","label":"Functions","items":[{"type":"doc","id":"reference/NoirJS/noir_wasm/functions/compile","label":"compile"},{"type":"doc","id":"reference/NoirJS/noir_wasm/functions/compile_contract","label":"compile_contract"},{"type":"doc","id":"reference/NoirJS/noir_wasm/functions/createFileManager","label":"createFileManager"},{"type":"doc","id":"reference/NoirJS/noir_wasm/functions/inflateDebugSymbols","label":"inflateDebugSymbols"}]}]}; -module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/docs/versioned_docs/version-v1.0.0-beta.0/reference/nargo_commands.md b/docs/versioned_docs/version-v1.0.0-beta.0/reference/nargo_commands.md index fd13ce7c0ea..8842fad6647 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.0/reference/nargo_commands.md +++ b/docs/versioned_docs/version-v1.0.0-beta.0/reference/nargo_commands.md @@ -71,8 +71,8 @@ Checks the constraint system for errors ###### **Options:** -* `--package ` — The name of the package to run the command on. By default run on the first one found moving up along the ancestors of the current directory -* `--workspace` — Run on all packages in the workspace +* `--package ` — The name of the package to check +* `--workspace` — Check all packages in the workspace Possible values: `true`, `false` @@ -108,10 +108,6 @@ Checks the constraint system for errors Possible values: `true`, `false` -* `--skip-brillig-constraints-check` — Flag to turn off the compiler check for missing Brillig call constrains. Warning: This can improve compilation speed but can also lead to correctness errors. This check should always be run on production code - - Possible values: `true`, `false` - @@ -127,11 +123,6 @@ Format the Noir files in a workspace Possible values: `true`, `false` -* `--package ` — The name of the package to run the command on. By default run on the first one found moving up along the ancestors of the current directory -* `--workspace` — Run on all packages in the workspace - - Possible values: `true`, `false` - @@ -143,8 +134,8 @@ Compile the program and its secret execution trace into ACIR format ###### **Options:** -* `--package ` — The name of the package to run the command on. By default run on the first one found moving up along the ancestors of the current directory -* `--workspace` — Run on all packages in the workspace +* `--package ` — The name of the package to compile +* `--workspace` — Compile all packages in the workspace Possible values: `true`, `false` @@ -176,10 +167,6 @@ Compile the program and its secret execution trace into ACIR format Possible values: `true`, `false` -* `--skip-brillig-constraints-check` — Flag to turn off the compiler check for missing Brillig call constrains. Warning: This can improve compilation speed but can also lead to correctness errors. This check should always be run on production code - - Possible values: `true`, `false` - @@ -252,8 +239,8 @@ Defaults to the name of the package being executed. * `-p`, `--prover-name ` — The name of the toml file which contains the inputs for the prover Default value: `Prover` -* `--package ` — The name of the package to run the command on. By default run on the first one found moving up along the ancestors of the current directory -* `--workspace` — Run on all packages in the workspace +* `--package ` — The name of the package to execute +* `--workspace` — Execute all packages in the workspace Possible values: `true`, `false` @@ -285,10 +272,6 @@ Defaults to the name of the package being executed. Possible values: `true`, `false` -* `--skip-brillig-constraints-check` — Flag to turn off the compiler check for missing Brillig call constrains. Warning: This can improve compilation speed but can also lead to correctness errors. This check should always be run on production code - - Possible values: `true`, `false` - * `--oracle-resolver ` — JSON RPC url to solve oracle calls @@ -337,10 +320,6 @@ Executes a circuit in debug mode Possible values: `true`, `false` -* `--skip-brillig-constraints-check` — Flag to turn off the compiler check for missing Brillig call constrains. Warning: This can improve compilation speed but can also lead to correctness errors. This check should always be run on production code - - Possible values: `true`, `false` - * `--acir-mode` — Force ACIR output (disabling instrumentation) Possible values: `true`, `false` @@ -372,8 +351,8 @@ Run the tests for this program Possible values: `true`, `false` -* `--package ` — The name of the package to run the command on. By default run on the first one found moving up along the ancestors of the current directory -* `--workspace` — Run on all packages in the workspace +* `--package ` — The name of the package to test +* `--workspace` — Test all packages in the workspace Possible values: `true`, `false` @@ -405,14 +384,7 @@ Run the tests for this program Possible values: `true`, `false` -* `--skip-brillig-constraints-check` — Flag to turn off the compiler check for missing Brillig call constrains. Warning: This can improve compilation speed but can also lead to correctness errors. This check should always be run on production code - - Possible values: `true`, `false` - * `--oracle-resolver ` — JSON RPC url to solve oracle calls -* `--test-threads ` — Number of threads used for running tests in parallel - - Default value: `8` @@ -426,8 +398,8 @@ Current information provided per circuit: 1. The number of ACIR opcodes 2. Count ###### **Options:** -* `--package ` — The name of the package to run the command on. By default run on the first one found moving up along the ancestors of the current directory -* `--workspace` — Run on all packages in the workspace +* `--package ` — The name of the package to detail +* `--workspace` — Detail all packages in the workspace Possible values: `true`, `false` @@ -466,10 +438,6 @@ Current information provided per circuit: 1. The number of ACIR opcodes 2. Count Possible values: `true`, `false` -* `--skip-brillig-constraints-check` — Flag to turn off the compiler check for missing Brillig call constrains. Warning: This can improve compilation speed but can also lead to correctness errors. This check should always be run on production code - - Possible values: `true`, `false` -