diff --git a/aztec-up/bin/aztec-up b/aztec-up/bin/aztec-up index 736307e1827..54199a7e68c 100755 --- a/aztec-up/bin/aztec-up +++ b/aztec-up/bin/aztec-up @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -euo pipefail +export VERSION=${1:-$VERSION} export SKIP_TITLE=1 -bash -i <(curl -s http://install.aztec.network) \ No newline at end of file +bash -i <(curl -s http://install.aztec.network) diff --git a/boxes/Dockerfile b/boxes/Dockerfile index 4793d5000b3..963e664c5db 100644 --- a/boxes/Dockerfile +++ b/boxes/Dockerfile @@ -1,11 +1,14 @@ # Builds the boxes (they were copied into yarn-project-base so the cli can unbox). # Produces a container that can be run to test a specific box. See docker-compose.yml. FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/aztec-sandbox AS aztec-sandbox +FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir as noir # We need yarn. Start fresh container. FROM node:18.19.0 COPY --from=aztec-sandbox /usr/src /usr/src +COPY --from=noir /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo WORKDIR /usr/src/boxes -ENV AZTEC_CLI=../../yarn-project/cli/aztec-cli-dest +ENV AZTEC_NARGO=/usr/src/noir/target/release/nargo +ENV AZTEC_CLI=/usr/src/yarn-project/cli/aztec-cli-dest RUN yarn && yarn build -ENTRYPOINT ["yarn", "workspace"] \ No newline at end of file +ENTRYPOINT ["yarn", "workspace"] diff --git a/boxes/blank-react/package.json b/boxes/blank-react/package.json index 83c08b00268..60691b242b6 100644 --- a/boxes/blank-react/package.json +++ b/boxes/blank-react/package.json @@ -5,13 +5,14 @@ "type": "module", "main": "./dest/index.js", "scripts": { - "build": "yarn clean && yarn compile && tsc -b && webpack", - "clean": "rm -rf ./dest .tsbuildinfo", + "build": "yarn clean && yarn compile && yarn codegen && tsc -b && webpack", + "clean": "rm -rf ./dest .tsbuildinfo ./src/artifacts ./src/contracts/target", "start": "serve -p 3000 ./dest", "start:dev": "webpack serve --mode=development", "formatting": "prettier --check ./src && eslint ./src", "formatting:fix": "prettier -w ./src", - "compile": "${AZTEC_CLI:-aztec-cli} compile src/contracts --outdir ../artifacts --typescript ../artifacts", + "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile", + "codegen": "${AZTEC_CLI:-aztec-cli} generate-typescript src/contracts/target --outdir src/artifacts", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand" }, "jest": { diff --git a/boxes/blank-react/tsconfig.json b/boxes/blank-react/tsconfig.json index 6a33a741e05..25932cb04b5 100644 --- a/boxes/blank-react/tsconfig.json +++ b/boxes/blank-react/tsconfig.json @@ -21,5 +21,5 @@ "skipLibCheck": true, "jsx": "react-jsx" }, - "include": ["src", "src/**/*.json"] + "include": ["src", "src/artifacts/Blank.json"] } diff --git a/boxes/blank/package.json b/boxes/blank/package.json index f3452252674..33f02d75393 100644 --- a/boxes/blank/package.json +++ b/boxes/blank/package.json @@ -5,13 +5,14 @@ "type": "module", "main": "./dest/index.js", "scripts": { - "build": "yarn clean && yarn compile && tsc -b && webpack", - "clean": "rm -rf ./dest .tsbuildinfo", + "build": "yarn clean && yarn compile && yarn codegen && tsc -b && webpack", + "clean": "rm -rf ./dest .tsbuildinfo ./src/artifacts ./src/contracts/target", "start": "serve -p 3000 ./dest", "start:dev": "webpack serve --mode=development", "formatting": "prettier --check ./src && eslint ./src", "formatting:fix": "prettier -w ./src", - "compile": "${AZTEC_CLI:-aztec-cli} compile src/contracts --outdir ../artifacts --typescript ../artifacts", + "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile", + "codegen": "${AZTEC_CLI:-aztec-cli} generate-typescript src/contracts/target --outdir src/artifacts", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand" }, "jest": { diff --git a/boxes/blank/tsconfig.json b/boxes/blank/tsconfig.json index 6a33a741e05..25932cb04b5 100644 --- a/boxes/blank/tsconfig.json +++ b/boxes/blank/tsconfig.json @@ -21,5 +21,5 @@ "skipLibCheck": true, "jsx": "react-jsx" }, - "include": ["src", "src/**/*.json"] + "include": ["src", "src/artifacts/Blank.json"] } diff --git a/boxes/token/package.json b/boxes/token/package.json index bd0192518fe..7d8f3e2b640 100644 --- a/boxes/token/package.json +++ b/boxes/token/package.json @@ -5,13 +5,14 @@ "type": "module", "main": "./dest/index.js", "scripts": { - "build": "yarn clean && yarn compile && tsc -b && webpack", - "clean": "rm -rf ./dest .tsbuildinfo", + "build": "yarn clean && yarn compile && yarn codegen && tsc -b && webpack", + "clean": "rm -rf ./dest .tsbuildinfo ./src/artifacts ./src/contracts/target", "start": "serve -p 3000 ./dest", "start:dev": "webpack serve --mode=development", "formatting": "prettier --check ./src && eslint ./src", "formatting:fix": "prettier -w ./src", - "compile": "${AZTEC_CLI:-aztec-cli} compile src/contracts --outdir ../artifacts --typescript ../artifacts", + "compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile", + "codegen": "${AZTEC_CLI:-aztec-cli} generate-typescript src/contracts/target --outdir src/artifacts", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand" }, "jest": { diff --git a/boxes/token/tsconfig.json b/boxes/token/tsconfig.json index 6a33a741e05..0c77d2196f9 100644 --- a/boxes/token/tsconfig.json +++ b/boxes/token/tsconfig.json @@ -21,5 +21,5 @@ "skipLibCheck": true, "jsx": "react-jsx" }, - "include": ["src", "src/**/*.json"] + "include": ["src", "src/artifacts/Token.json"] } diff --git a/build_manifest.yml b/build_manifest.yml index 8db6dd3e41c..17b2506a382 100644 --- a/build_manifest.yml +++ b/build_manifest.yml @@ -166,6 +166,7 @@ boxes: buildDir: boxes dependencies: - aztec-sandbox + - noir runDependencies: - aztec-sandbox diff --git a/docs/docs/concepts/foundation/accounts/keys.md b/docs/docs/concepts/foundation/accounts/keys.md index cd8744d0e62..21d0f240c81 100644 --- a/docs/docs/concepts/foundation/accounts/keys.md +++ b/docs/docs/concepts/foundation/accounts/keys.md @@ -12,7 +12,7 @@ Since Aztec implements full [signature abstraction](./main.md), signing keys dep This is a snippet of our Schnorr Account contract implementation, which uses Schnorr signatures for authentication: -#include_code entrypoint /yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/main.nr rust +#include_code entrypoint /yarn-project/noir-contracts/contracts/schnorr_account_contract/src/main.nr rust Still, different accounts may use different signing schemes, may require multi-factor authentication, or _may not even use signing keys_ and instead rely on other authentication mechanisms. Read [how to write an account contract](../../../dev_docs/wallets/writing_an_account_contract.md) for a full example of how to manage authentication. diff --git a/docs/docs/dev_docs/cli/cli-commands.md b/docs/docs/dev_docs/cli/cli-commands.md index 7efa13eef1f..7a7c9e38761 100644 --- a/docs/docs/dev_docs/cli/cli-commands.md +++ b/docs/docs/dev_docs/cli/cli-commands.md @@ -93,7 +93,7 @@ export ADDRESS2= ## Deploying a Token Contract -We will now deploy a token contract using the `deploy` command, and set an address of the admin via a constructor argument. You can find the contract we are deploying [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr) (or write it for yourself in [this tutorial!](../tutorials/writing_token_contract.md)) +We will now deploy a token contract using the `deploy` command, and set an address of the admin via a constructor argument. You can find the contract we are deploying [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr) (or write it for yourself in [this tutorial!](../tutorials/writing_token_contract.md)) Make sure to replace this address with one of the two you created earlier. #include_code deploy yarn-project/end-to-end/src/cli_docs_sandbox.test.ts bash @@ -123,7 +123,7 @@ The `send` command expect the function name as the first unnamed argument and th #include_code send yarn-project/end-to-end/src/cli_docs_sandbox.test.ts bash -We called the [`mint_public`](https://github.com/AztecProtocol/aztec-packages/blob/87fa621347e55f82e36c70515c1824161eee5282/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr#L157C10-L157C10) function and provided it with the 2 arguments it expects: the recipient's address and the amount to be minted. Make sure to replace all addresses in this command with yours. +We called the [`mint_public`](https://github.com/AztecProtocol/aztec-packages/blob/87fa621347e55f82e36c70515c1824161eee5282/yarn-project/noir-contracts/contracts/token_contract/src/main.nr#L157C10-L157C10) function and provided it with the 2 arguments it expects: the recipient's address and the amount to be minted. Make sure to replace all addresses in this command with yours. The command output tells us the details of the transaction such as its hash and status. We can use this hash to query the receipt of the transaction at a later time: diff --git a/docs/docs/dev_docs/cli/sandbox-reference.md b/docs/docs/dev_docs/cli/sandbox-reference.md index fa6d0087f98..bd22da35e4f 100644 --- a/docs/docs/dev_docs/cli/sandbox-reference.md +++ b/docs/docs/dev_docs/cli/sandbox-reference.md @@ -174,7 +174,7 @@ UniswapContractArtifact > Source code: /yarn-project/end-to-end/src/cli_docs_sandbox.test.ts#L95-L118 -You can see all of our example contracts in the monorepo [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +You can see all of our example contracts in the monorepo [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ## Boxes diff --git a/docs/docs/dev_docs/contracts/compiling.md b/docs/docs/dev_docs/contracts/compiling.md index e6c54e66b35..f6bb27dc535 100644 --- a/docs/docs/dev_docs/contracts/compiling.md +++ b/docs/docs/dev_docs/contracts/compiling.md @@ -42,7 +42,7 @@ You can also generate these interfaces from prebuilt artifacts using the `genera aztec-cli generate-typescript ./path/to/my_aztec_contract_project ``` -Below is typescript code generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr) contract: +Below is typescript code generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr) contract: ```ts showLineNumbers export class TokenContract extends ContractBase { @@ -145,7 +145,7 @@ You can also generate these interfaces from prebuilt artifacts using the `genera aztec-cli generate-noir-interface ./path/to/my_aztec_contract_project ``` -Below is an example interface, also generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr) contract: +Below is an example interface, also generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr) contract: ```rust impl TokenPrivateContextInterface { diff --git a/docs/docs/dev_docs/contracts/example-contract.md b/docs/docs/dev_docs/contracts/example-contract.md index 5b661cba970..58eb023c5c7 100644 --- a/docs/docs/dev_docs/contracts/example-contract.md +++ b/docs/docs/dev_docs/contracts/example-contract.md @@ -6,7 +6,7 @@ title: Example Aztec.nr Contract In keeping with the origins of blockchain, here's an example of a simple private token contract. Everyone's balances are private. -#include_code easy_private_token_contract /yarn-project/noir-contracts/src/contracts/easy_private_token_contract/src/main.nr rust +#include_code easy_private_token_contract /yarn-project/noir-contracts/contracts/easy_private_token_contract/src/main.nr rust :::info Disclaimer Please note that any example contract set out herein is provided solely for informational purposes only and does not constitute any inducement to use or deploy. Any implementation of any such contract with an interface or any other infrastructure should be used in accordance with applicable laws and regulations. diff --git a/docs/docs/dev_docs/contracts/portals/main.md b/docs/docs/dev_docs/contracts/portals/main.md index 63273257843..ab0654dba98 100644 --- a/docs/docs/dev_docs/contracts/portals/main.md +++ b/docs/docs/dev_docs/contracts/portals/main.md @@ -44,15 +44,15 @@ Note that while the `secret` and the `content` are both hashed, they are actuall #include_code context_consume_l1_to_l2_message /yarn-project/aztec-nr/aztec/src/context.nr rust -Computing the `content` must be done manually in its current form, as we are still adding a number of bytes utilities. A good example exists within the [Token bridge example](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/util.nr). +Computing the `content` must be done manually in its current form, as we are still adding a number of bytes utilities. A good example exists within the [Token bridge example](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_bridge_contract/src/util.nr). -#include_code claim_public /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code claim_public /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust :::info The `content_hash` is a sha256 truncated to a field element (~ 254 bits). In Aztec-nr, you can use our `sha256_to_field()` to do a sha256 hash which fits in one field element ::: -#include_code mint_public_content_hash_nr /yarn-project/noir-contracts/src/contracts/token_portal_content_hash_lib/src/lib.nr rust +#include_code mint_public_content_hash_nr /yarn-project/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr rust In Solidity, you can use our `Hash.sha256ToField()` method: @@ -88,7 +88,7 @@ Access control on the L1 portal contract is essential to prevent consumption of As earlier, we can use a token bridge as an example. In this case, we are burning tokens on L2 and sending a message to the portal to free them on L1. -#include_code exit_to_l1_private yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code exit_to_l1_private yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust When the transaction is included in a rollup block the message will be inserted into the `Outbox`, where the recipient portal can consume it from. When consuming, the `msg.sender` must match the `recipient` meaning that only portal can actually consume the message. @@ -202,4 +202,4 @@ Designated callers are enforced at the contract level for contracts that are not - Token bridge (Portal contract built for L1 -> L2, i.e., a non-native L2 asset) - [Portal contract](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/test/portals/TokenPortal.sol) - - [Aztec contract](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr) + - [Aztec contract](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr) diff --git a/docs/docs/dev_docs/contracts/resources/common_patterns/authwit.md b/docs/docs/dev_docs/contracts/resources/common_patterns/authwit.md index 4ec336a0282..54e5c3c8dd3 100644 --- a/docs/docs/dev_docs/contracts/resources/common_patterns/authwit.md +++ b/docs/docs/dev_docs/contracts/resources/common_patterns/authwit.md @@ -110,7 +110,7 @@ This function computes the message hash, and then forwards the call to the more #### Example -#include_code assert_current_call_valid_authwit /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code assert_current_call_valid_authwit /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### Utilities for public calls @@ -118,7 +118,7 @@ Very similar to the above, we have variations that work in the public domain. Th #### Example -#include_code assert_current_call_valid_authwit_public /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code assert_current_call_valid_authwit_public /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ## Usage @@ -136,7 +136,7 @@ authwit = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#includ Then you will be able to import it into your contracts as follows. -#include_code import_authwit /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code import_authwit /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### Private Functions @@ -144,7 +144,7 @@ Then you will be able to import it into your contracts as follows. Based on the diagram earlier on this page let's take a look at how we can implement the `transfer` function such that it checks if the tokens are to be transferred `from` the caller or needs to be authenticated with an authentication witness. -#include_code transfer /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code transfer /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust The first thing we see in the snippet above, is that if `from` is not the call we are calling the `assert_current_call_valid_authwit` function from [earlier](#private-functions). If the call is not throwing, we are all good and can continue with the transfer. @@ -162,7 +162,7 @@ With private functions covered, how can we use this in a public function? Well, #### Checking if the current call is authenticated -#include_code transfer_public /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code transfer_public /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### Authenticating an action in TypeScript @@ -178,13 +178,13 @@ We have cases where we need a non-wallet contract to approve an action to be exe To support this, we must implement the `is_valid_public` function as seen in the snippet below. -#include_code authwit_uniswap_get /yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust +#include_code authwit_uniswap_get /yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust It also needs a way to update those storage values. Since we want the updates to be trustless, we can compute the action based on the function inputs, and then have the contract compute the key at which it must add a `true` to approve the action. An example of this would be our Uniswap example which performs a cross chain swap on L1. In here, we both do private and public auth witnesses, where the public is set by the uniswap L2 contract itself. In the below snippet, you can see that we compute the action hash, and then update an `approved_action` mapping with the hash as key and `true` as value. When we then call the `token_bridge` to execute afterwards, it reads this value, burns the tokens, and consumes the authentication. -#include_code authwit_uniswap_set /yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust +#include_code authwit_uniswap_set /yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust Outlining more of the `swap` flow: this simplified diagram shows how it will look for contracts that are not wallets but also need to support authentication witnesses. diff --git a/docs/docs/dev_docs/contracts/resources/common_patterns/main.md b/docs/docs/dev_docs/contracts/resources/common_patterns/main.md index 9cbbf541f8d..0c69517fcb8 100644 --- a/docs/docs/dev_docs/contracts/resources/common_patterns/main.md +++ b/docs/docs/dev_docs/contracts/resources/common_patterns/main.md @@ -57,9 +57,9 @@ contract Bridge { amount: Field, ) -> Field { ... - #include_code call_assert_token_is_same /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr raw + #include_code call_assert_token_is_same /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr raw } - #include_code assert_token_is_same /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr raw + #include_code assert_token_is_same /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr raw } ``` :::danger @@ -102,11 +102,11 @@ Hence, it's necessary to add a "randomness" field to your note to prevent such a Currently, if you have storage defined, the compiler will error if you don't have a `compute_note_hash_and_nullifier()` defined. Without this, the PXE can't process encrypted events and discover your notes. If your contract doesn't have anything to do with notes (e.g. operates solely in the public domain), you can do the following: -#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust Otherwise, you need this method to help the PXE with processing your notes. In our [demo token contract](../../../tutorials/writing_token_contract.md#compute_note_hash_and_nullifier), we work with 2 kinds of notes: `ValueNote` and `TransparentNote`. Hence this method must define how to work with both: -#include_code compute_note_hash_and_nullifier /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### L1 -- L2 interactions Refer to [Token Portal tutorial on bridging tokens between L1 and L2](../../../tutorials/token_portal/main.md) and/or [Uniswap tutorial that shows how to swap on L1 using funds on L2](../../../tutorials/uniswap/main.md). Both examples show how to: diff --git a/docs/docs/dev_docs/contracts/syntax/events.md b/docs/docs/dev_docs/contracts/syntax/events.md index d2634d06ec0..2ccc3c0be38 100644 --- a/docs/docs/dev_docs/contracts/syntax/events.md +++ b/docs/docs/dev_docs/contracts/syntax/events.md @@ -85,7 +85,7 @@ If your contract works with storage (has Storage struct defined), you **MUST** i Every time a new note is successfully decrypted, the PXE will expect the existence of a `compute_note_hash_and_nullifier` function, which must teach it how to correctly process the new note. -#include_code compute_note_hash_and_nullifier /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ## Unencrypted Events @@ -100,11 +100,11 @@ They can be emitted by both public and private functions. To emit unencrypted logs first import the `emit_unencrypted_log` utility function inside your contract: -#include_code unencrypted_import /yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr rust +#include_code unencrypted_import /yarn-project/noir-contracts/contracts/test_contract/src/main.nr rust Then you can call the function: -#include_code emit_unencrypted /yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr rust +#include_code emit_unencrypted /yarn-project/noir-contracts/contracts/test_contract/src/main.nr rust Once emitted, unencrypted events are stored in AztecNode and can be queried by anyone: diff --git a/docs/docs/dev_docs/contracts/syntax/functions.md b/docs/docs/dev_docs/contracts/syntax/functions.md index 7c7cb620bcc..615c144c44f 100644 --- a/docs/docs/dev_docs/contracts/syntax/functions.md +++ b/docs/docs/dev_docs/contracts/syntax/functions.md @@ -55,11 +55,11 @@ While `staticcall` and `delegatecall` both have flags in the call context, they An example of a somewhat boring constructor is as follows: -#include_code empty-constructor /yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr rust +#include_code empty-constructor /yarn-project/noir-contracts/contracts/test_contract/src/main.nr rust Although you can have a constructor that does nothing, you might want to do something with it, such as setting the deployer as an owner. -#include_code constructor /yarn-project/noir-contracts/src/contracts/escrow_contract/src/main.nr rust +#include_code constructor /yarn-project/noir-contracts/contracts/escrow_contract/src/main.nr rust :::danger It is not possible to call public functions from within a constructor. Beware that the compiler will not throw an error if you do, but the execution will fail! @@ -71,13 +71,13 @@ A public function is executed by the sequencer and has access to a state model t To create a public function you can annotate it with the `#[aztec(public)]` attribute. This will make the [public context](./context.mdx#public-context) available within your current function's execution scope. -#include_code set_minter /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code set_minter /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ## `Private` Functions As alluded to earlier, a private function operates on private information, and is executed by the user. To tell the compiler that this is the kind of function we are creating annotate it with the `#[aztec(private)]` attribute. This will make the [private context](./context.mdx#private-context-broken-down) available within your current function's execution scope. -#include_code redeem_shield /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code redeem_shield /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ## `unconstrained` functions @@ -85,7 +85,7 @@ Unconstrained functions are an underlying part of Noir - a deeper explanation ca Beyond using them inside your other functions, they are convenient for providing an interface that reads storage, applies logic and returns values to a UI or test. Below is a snippet from exposing the `balance_of_private` function from a token implementation, which allows a user to easily read their balance, similar to the `balanceOf` function in the ERC20 standard. -#include_code balance_of_private /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code balance_of_private /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust :::info Note, that unconstrained functions can have access to both public and private data when executed on the user's device. This is possible since it is not actually part of the circuits that are executed in contract execution. @@ -186,13 +186,13 @@ With this intuition in place, lets see how we actually perform the call. To make Note that the function selector is computed using one of the oracles from earlier, and that the first `Field` is wrapped in parenthesis. Structs are outlined in tuple-form for selector computation, so they are wrapped in parenthesis--`AztecAddress` becomes `(Field)`. ::: -#include_code private_burn_interface /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/token_interface.nr rust +#include_code private_burn_interface /yarn-project/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr rust Using this interface, we can then call it as seen below. All the way down at the bottom we can see that we are calling the `burn` function from the `token_interface` struct. The following snippet is from a token bridge that is burning the underlying token and creating a message for L1 to mint some assets to the `recipient` on Ethereum. -#include_code exit_to_l1_private /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code exit_to_l1_private /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust ### Public -> Public @@ -207,8 +207,8 @@ The mental model for public execution carries many of the same idea as are carri Calling a public function from another public function is quite similar to what we saw for private to private, with the keyword private swapped for public. -#include_code public_burn_interface /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/token_interface.nr rust -#include_code exit_to_l1_public /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code public_burn_interface /yarn-project/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr rust +#include_code exit_to_l1_public /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust ### Private -> Public @@ -221,8 +221,8 @@ As a consequence a private function _CANNOT_ accept a return value from a public The code required to dispatch a public function call from a private function is actually quite similar to private to private calls. As an example, we will look at the token contract, where users can unshield assets from private to public domain, essentially a transfer from a private account to a public one (often used for depositing privately into DeFi etc). -#include_code unshield /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust -#include_code increase_public_balance /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code unshield /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust +#include_code increase_public_balance /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust As we can see above, the private to public transaction flow looks very similar to the others in snippets, with the practicality being a bit different behind the scenes. @@ -236,11 +236,11 @@ While we cannot directly call a private function, we can indirectly call it by a In the snippet below, we insert a custom note, the transparent note, into the commitments tree from public such that it can later be consumed in private. -#include_code shield /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code shield /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust If you recall the `redeem_shield` from back in the [private function section](#private-functions), you might remember it removing a `TransparentNote` from `pending_shields`. This is the note that we just inserted from public! -#include_code redeem_shield /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code redeem_shield /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust When the note is removed, it emits a nullifier so that it cannot be used again. This nullifier is then added to the note hash tree, and can be used to prove that the note was removed from the pending shields. Interestingly, we can generate the nullifier such that no-one who saw the public execution will know that it have been consumed. When sending messages between L1 and L2 in [portals](../portals/main.md) we are going to see this pattern again. @@ -264,18 +264,18 @@ To help illustrate how this interacts with the internals of Aztec and its kernel #### Before expansion -#include_code simple_macro_example /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code simple_macro_example /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust #### After expansion -#include_code simple_macro_example_expanded /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code simple_macro_example_expanded /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust #### The expansion broken down? Viewing the expanded noir contract uncovers a lot about how noir contracts interact with the [kernel](../../../concepts/advanced/circuits/kernels/private_kernel.md). To aid with developing intuition, we will break down each inserted line. **Receiving context from the kernel.** -#include_code context-example-inputs /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code context-example-inputs /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust Private function calls are able to interact with each other through orchestration from within the [kernel circuit](../../../concepts/advanced/circuits/kernels/private_kernel.md). The kernel circuit forwards information to each app circuit. This information then becomes part of the private context. For example, within each circuit we can access some global variables. To access them we can call `context.chain_id()`. The value of this chain ID comes from the values passed into the circuit from the kernel. @@ -283,7 +283,7 @@ For example, within each circuit we can access some global variables. To access The kernel can then check that all of the values passed to each circuit in a function call are the same. **Returning the context to the kernel.** -#include_code context-example-return /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code context-example-return /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust Just as the kernel passes information into the app circuits, the application must return information about the executed app back to the kernel. This is done through a rigid structure we call the `PrivateCircuitPublicInputs`. @@ -294,30 +294,30 @@ Just as the kernel passes information into the app circuits, the application mus This structure contains a host of information about the executed program. It will contain any newly created nullifiers, any messages to be sent to l2 and most importantly it will contain the actual return values of the function! **Hashing the function inputs.** -#include_code context-example-hasher /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code context-example-hasher /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust _What is the hasher and why is it needed?_ Inside the kernel circuits, the inputs to functions are reduced to a single value; the inputs hash. This prevents the need for multiple different kernel circuits; each supporting differing numbers of inputs. The hasher abstraction that allows us to create an array of all of the inputs that can be reduced to a single value. **Creating the function's context.** -#include_code context-example-context /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code context-example-context /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust Each Aztec function has access to a [context](./context.mdx) object. This object although ergonomically a global variable, is local. It is initialized from the inputs provided by the kernel, and a hash of the function's inputs. -#include_code context-example-context-return /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code context-example-context-return /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust As previously mentioned we use the kernel to pass information between circuits. This means that the return values of functions must also be passed to the kernel (where they can be later passed on to another function). We achieve this by pushing return values to the execution context, which we then pass to the kernel. **Making the contract's storage available** -#include_code storage-example-context /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code storage-example-context /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust When a [`Storage` struct](./storage/main.md) is declared within a contract, the `storage` keyword is made available. As shown in the macro expansion above, this calls the init function on the storage struct with the current function's context. Any state variables declared in the `Storage` struct can now be accessed as normal struct members. **Returning the function context to the kernel.** -#include_code context-example-finish /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code context-example-finish /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust This function takes the application context, and converts it into the `PrivateCircuitPublicInputs` structure. This structure is then passed to the kernel circuit. diff --git a/docs/docs/dev_docs/contracts/syntax/slow_updates_tree.md b/docs/docs/dev_docs/contracts/syntax/slow_updates_tree.md index e108e0cff23..cfe7d5905f9 100644 --- a/docs/docs/dev_docs/contracts/syntax/slow_updates_tree.md +++ b/docs/docs/dev_docs/contracts/syntax/slow_updates_tree.md @@ -23,13 +23,13 @@ This is the primary smart contract that will use the slow updates tree. In the e ## Interface -This interface of the slow updates tree contract allows your contract to interact with the Slow Updates Tree contract. It provides methods for reading and updating values in the tree in both public and private contexts. You can find it [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/interfaces.nr). +This interface of the slow updates tree contract allows your contract to interact with the Slow Updates Tree contract. It provides methods for reading and updating values in the tree in both public and private contexts. You can find it [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/interfaces.nr). ## SlowTree.nr contract This is a smart contract developed by Aztec that establishes and manages a slow updates tree structure. It allows developers to access and interact with the tree, such as reading and updating data. -You can find it [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts/slow_tree_contract). +You can find it [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts/slow_tree_contract). ## SlowMap type @@ -87,31 +87,31 @@ graph TD # How to integrate a slow updates tree -1. Copy the *SlowTree.nr* example and its dependencies, found [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts/slow_tree_contract). Replace the constants with whatever you like and deploy it to your sandbox -2. Copy the *SlowMap interface* for easy interaction with your deployed SlowTree. Find it [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/interfaces.nr) +1. Copy the *SlowTree.nr* example and its dependencies, found [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts/slow_tree_contract). Replace the constants with whatever you like and deploy it to your sandbox +2. Copy the *SlowMap interface* for easy interaction with your deployed SlowTree. Find it [here](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/interfaces.nr) 3. Import this interface into your contract -#include_code interface yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code interface yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust 5. Create a storage init function for the same value in both public and private storage -#include_code slow_updates_storage yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code slow_updates_storage yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust 6. Store the SlowTree address in private storage as a FieldNote -#include_code constructor yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code constructor yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust 7. Store the SlowTree address in public storage and initialize an instance of SlowMap using this address -#include_code write_slow_update_public yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code write_slow_update_public yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust 8. Now you can read and update from private functions: -#include_code get_and_update_private yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code get_and_update_private yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust 9. Or from public functions: -#include_code get_public yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code get_public yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust View the [reference](slow_updates_tree.md#reference) for more information. @@ -119,13 +119,13 @@ View the [reference](slow_updates_tree.md#reference) for more information. The `TokenBlacklist` contract is a token contract that does not allow blacklisted accounts to perform mints or transfers. In this section we will go through how this is achieved through the slow updates tree. -You can find the full code for the TokenBlacklist smart contract [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts/token_blacklist_contract). +You can find the full code for the TokenBlacklist smart contract [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts/token_blacklist_contract). ### Importing SlowMap The contract first imports the **`SlowMap`** interface: -#include_code interface yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code interface yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust This interface allows the contract to interact with its attached SlowTree. It abstracts these functions so they do not have to be implemented in the TokenBlacklist contract. @@ -133,7 +133,7 @@ This interface allows the contract to interact with its attached SlowTree. It ab The contract's constructor takes the address of the slow updates contract: -#include_code constructor yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code constructor yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust This initialization sets up the connection between the **`TokenBlacklist`** contract and a previously deployed SlowTree, allowing it to use the interface to directly interact with the SlowTree. @@ -141,7 +141,7 @@ This initialization sets up the connection between the **`TokenBlacklist`** cont In the private transfer function, the contract uses the interface to check if a user is blacklisted: -#include_code transfer_private yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code transfer_private yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust Here, the contract reads the roles of the sender and recipient from the SlowTree using the **`read_at`** function in the interface. It checks if either party is blacklisted, and if so, the transaction does not go ahead. @@ -178,7 +178,7 @@ Returns an instance of `SlowMap` at the specified address. **Example** -#include_code slowmap_at yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code slowmap_at yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust ### initialize @@ -198,7 +198,7 @@ Initializes the `SlowMap`. **Example** -#include_code slowmap_initialize yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code slowmap_initialize yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust ### read_at_pub @@ -219,7 +219,7 @@ Reads a value at a specified index from a public function. **Example** -#include_code read_at_pub yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code read_at_pub yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust ### read_at @@ -240,7 +240,7 @@ Reads a value at a specified index from a private function. **Example** -#include_code slowmap_read_at yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code slowmap_read_at yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust ### update_at_private @@ -256,7 +256,7 @@ Updates a value at a specified index from a private function. Does not return an **Example** -#include_code get_and_update_private yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code get_and_update_private yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust ## Updating from public @@ -264,5 +264,5 @@ This is not a method in the interface as it can be done using regular Aztec.nr p **Example** -#include_code write_slow_update_public yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rust +#include_code write_slow_update_public yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr rust diff --git a/docs/docs/dev_docs/contracts/syntax/storage/main.md b/docs/docs/dev_docs/contracts/syntax/storage/main.md index da66458882f..0be4049fadd 100644 --- a/docs/docs/dev_docs/contracts/syntax/storage/main.md +++ b/docs/docs/dev_docs/contracts/syntax/storage/main.md @@ -43,7 +43,7 @@ If your contract works with storage (has Storage struct defined), you **MUST** i If you don't yet have any private state variables defined put there a placeholder function: -#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust ::: Since Aztec.nr is written in Noir, which on its own is state-less, we need to specify how the storage struct should be initialized to read and write data correctly. This is done by specifying an `init` function that is run in functions that rely on reading or altering the state variables. This `init` function must declare the storage struct with an instantiation defining how variables are accessed and manipulated. The function MUST be called `init` for the Aztec.nr library to properly handle it (this will be relaxed in the future). @@ -89,11 +89,11 @@ When declaring a mapping in private storage, we have to specify which type of No In the Storage struct: -#include_code storage-map-singleton-declaration /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code storage-map-singleton-declaration /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust In the `Storage::init` function: -#include_code state_vars-MapSingleton /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code state_vars-MapSingleton /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust #### Public Example @@ -101,11 +101,11 @@ When declaring a public mapping in Storage, we have to specify that the type is In the Storage struct: -#include_code storage_minters /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_minters /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust In the `Storage::init` function: -#include_code storage_minters_init /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_minters_init /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### `at` @@ -113,7 +113,7 @@ When dealing with a map, we can access the value at a given key using the `::at` This function behaves similarly for both private and public maps. An example could be if we have a map with `minters`, which is mapping addresses to a flag for whether they are allowed to mint tokens or not. -#include_code read_minter /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code read_minter /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust Above, we are specifying that we want to get the storage in the Map `at` the `msg_sender()`, read the value stored and check that `msg_sender()` is indeed a minter. Doing a similar operation in Solidity code would look like: @@ -141,7 +141,7 @@ The British haven't surrendered fully to US spelling, so serialization is curren The Aztec.nr library provides serialization methods for various common types. :::info -An example using a larger struct can be found in the [lending example](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts/lending_contract)'s use of an [`Asset`](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts/lending_contract/src/asset.nr). +An example using a larger struct can be found in the [lending example](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts/lending_contract)'s use of an [`Asset`](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts/lending_contract/src/asset.nr). ::: ### `new` @@ -154,11 +154,11 @@ When declaring the storage for `T` as a persistent public storage variable, we u Say that we wish to add `admin` public state variable into our storage struct. In the struct we can define it as: -#include_code storage_admin /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_admin /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust And then when initializing it in the `Storage::init` function we can do: -#include_code storage_admin_init /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_admin_init /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust We have specified that we are storing a `Field` that should be placed in storage slot `1`. This is just a single value, and is similar to the following in solidity: @@ -174,11 +174,11 @@ We know its verbose, and are working on making it less so. Say we want to have a group of `minters` that are able to mint assets in our contract, and we want them in public storage, because [access control in private is quite cumbersome](../../../../concepts/foundation/communication/public_private_calls/main.md#a-note-on-l2-access-control). In the `Storage` struct we can add it as follows: -#include_code storage_minters /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_minters /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust And then when initializing it in the `Storage::init` function we can do it as follows: -#include_code storage_minters_init /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_minters_init /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust In this case, specifying that we are dealing with a map of Fields, and that it should be put at slot 2. @@ -196,13 +196,13 @@ On the `PublicState` structs we have a `read` method to read the value at the lo For our `admin` example from earlier, this could be used as follows to check that the stored value matches the `msg_sender()`. -#include_code read_admin /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code read_admin /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### Reading from our `minters` example As we saw in the Map earlier, a very similar operation can be done to perform a lookup in a map. -#include_code read_minter /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code read_minter /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### `write` @@ -210,11 +210,11 @@ We have a `write` method on the `PublicState` struct that takes the value to wri #### Writing to our `admin` example -#include_code write_admin /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code write_admin /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### Writing to our `minters` example -#include_code write_minter /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code write_minter /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ## Private State Variables @@ -276,13 +276,13 @@ Like for public state, we define the struct to have context, a storage slot and An example of singleton usage in the account contracts is keeping track of public keys. The `Singleton` is added to the `Storage` struct as follows: -#include_code storage-singleton-declaration /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code storage-singleton-declaration /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust ### `new` As part of the initialization of the `Storage` struct, the `Singleton` is created as follows, here at the specified storage slot and with the `NoteInterface` for `CardNote`. -#include_code start_vars_singleton /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust +#include_code start_vars_singleton /yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr rust ### `initialize` @@ -306,7 +306,7 @@ To update the value of a `Singleton`, we can use the `replace` method. The metho An example of this is seen in a example card game, where we create a new note (a `CardNote`) containing some new data, and replace the current note with it: -#include_code state_vars-SingletonReplace /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr rust +#include_code state_vars-SingletonReplace /yarn-project/noir-contracts/contracts/docs_example_contract/src/actions.nr rust If two people are trying to modify the Singleton at the same time, only one will succeed as we don't allow duplicate nullifiers! Developers should put in place appropriate access controls to avoid race conditions (unless a race is intended!). @@ -314,7 +314,7 @@ If two people are trying to modify the Singleton at the same time, only one will This function allows us to get the note of a Singleton, essentially reading the value. -#include_code state_vars-SingletonGet /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr rust +#include_code state_vars-SingletonGet /yarn-project/noir-contracts/contracts/docs_example_contract/src/actions.nr rust #### Nullifying Note reads @@ -334,7 +334,7 @@ ImmutableSingleton represents a unique private state variable that, as the name As part of the initialization of the `Storage` struct, the `Singleton` is created as follows, here at storage slot 1 and with the `NoteInterface` for `PublicKeyNote`. -#include_code storage_init /yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/main.nr rust +#include_code storage_init /yarn-project/noir-contracts/contracts/schnorr_account_contract/src/main.nr rust ### `initialize` @@ -342,7 +342,7 @@ When this function is invoked, it creates a nullifier for the storage slot, ensu Set the value of an ImmutableSingleton by calling the `initialize` method: -#include_code initialize /yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/main.nr rust +#include_code initialize /yarn-project/noir-contracts/contracts/schnorr_account_contract/src/main.nr rust Once initialized, an ImmutableSingleton's value remains unchangeable. This method can only be called once. @@ -356,7 +356,7 @@ Similar to the `Singleton`, we can use the `get_note` method to read the value o Use this method to retrieve the value of an initialized ImmutableSingleton. -#include_code get_note /yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/main.nr rust +#include_code get_note /yarn-project/noir-contracts/contracts/schnorr_account_contract/src/main.nr rust Unlike a `Singleton`, the `get_note` function for an ImmutableSingleton doesn't destroy the current note in the background. This means that multiple accounts can concurrently call this function to read the value. @@ -374,7 +374,7 @@ Set is used for managing a collection of notes. All notes in a set are of the sa And can be added to the `Storage` struct as follows. Here adding a set for a custom note, the TransparentNote (useful for [public -> private communication](../functions.md#public---private)). -#include_code storage_pending_shields /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_pending_shields /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### `new` @@ -382,7 +382,7 @@ The `new` method tells the contract how to operate on the underlying storage. We can initialize the set as follows: -#include_code storage_pending_shields_init /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_pending_shields_init /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### `insert` @@ -400,7 +400,7 @@ While we don't support private functions to directly alter public storage, the o The usage is rather straight-forward and very similar to using the `insert` method with the difference that this one is called in public functions. -#include_code insert_from_public /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code insert_from_public /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### `remove` @@ -500,11 +500,11 @@ This method sets the offset value, which determines where to start retrieving no The following code snippet creates an instance of `NoteGetterOptions`, which has been configured to find the cards that belong to `account_address`. The returned cards are sorted by their points in descending order, and the first `offset` cards with the highest points are skipped. -#include_code state_vars-NoteGetterOptionsSelectSortOffset /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr rust +#include_code state_vars-NoteGetterOptionsSelectSortOffset /yarn-project/noir-contracts/contracts/docs_example_contract/src/options.nr rust The first value of `.select` and `.sort` is the index of a field in a note type. For the note type `CardNote` that has the following fields: -#include_code state_vars-CardNote /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/card_note.nr rust +#include_code state_vars-CardNote /yarn-project/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr rust The indices are: 0 for `points`, 1 for `secret`, and 2 for `owner`. @@ -514,18 +514,18 @@ In the example, `.select(2, account_address)` matches the 2nd field of `CardNote There can be as many conditions as the number of fields a note type has. The following example finds cards whose fields match the three given values: -#include_code state_vars-NoteGetterOptionsMultiSelects /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr rust +#include_code state_vars-NoteGetterOptionsMultiSelects /yarn-project/noir-contracts/contracts/docs_example_contract/src/options.nr rust While `selects` lets us find notes with specific values, `filter` lets us find notes in a more dynamic way. The function below picks the cards whose points are at least `min_points`: -#include_code state_vars-OptionFilter /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr rust +#include_code state_vars-OptionFilter /yarn-project/noir-contracts/contracts/docs_example_contract/src/options.nr rust We can use it as a filter to further reduce the number of the final notes: -#include_code state_vars-NoteGetterOptionsFilter /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr rust +#include_code state_vars-NoteGetterOptionsFilter /yarn-project/noir-contracts/contracts/docs_example_contract/src/options.nr rust One thing to remember is, `filter` will be applied on the notes after they are picked from the database. Therefore, it's possible that the actual notes we end up getting are fewer than the limit. The limit is `MAX_READ_REQUESTS_PER_CALL` by default. But we can set it to any value **smaller** than that: -#include_code state_vars-NoteGetterOptionsPickOne /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr rust +#include_code state_vars-NoteGetterOptionsPickOne /yarn-project/noir-contracts/contracts/docs_example_contract/src/options.nr rust diff --git a/docs/docs/dev_docs/contracts/syntax/storage/storage_slots.md b/docs/docs/dev_docs/contracts/syntax/storage/storage_slots.md index 351b17bd100..dd8d1b01d18 100644 --- a/docs/docs/dev_docs/contracts/syntax/storage/storage_slots.md +++ b/docs/docs/dev_docs/contracts/syntax/storage/storage_slots.md @@ -6,7 +6,7 @@ From the description of [storage slot in concepts](./../../../../concepts/founda For the case of the example, we will look at what is inserted into the note hashes tree when adding a note in the Token contract. Specifically, we are looking at the last part of the `transfer` function: -#include_code increase_private_balance yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code increase_private_balance yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust This function is creating a new note and inserting it into the balance set of the recipient `to`. Recall that to ensure privacy, only the note commitment is really inserted into the note hashes tree. To share the contents of the note with `to` the contract can emit an encrypted log (which this one does), or it can require an out-of-band data transfer sharing the information. Below, we will walk through the steps of how the note commitment is computed and inserted into the tree. For this, we don't care about the encrypted log, so we are going to ignore that part of the function call for now. @@ -51,7 +51,7 @@ siloed_note_hash = H(contract_address, H(H(map_slot, to), H(amount, to, randomne Where the `map_slot` is the slot specified in `Storage::init`, recall: -#include_code storage_balances_init yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_balances_init yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust And `to` is the actor who receives the note, `amount` of the note and `randomness` is the randomness used to make the note hiding. Without the `randomness` the note could just as well be plaintext (computational cost of a preimage attack would be trivial in such a case). diff --git a/docs/docs/dev_docs/debugging/aztecnr-errors.md b/docs/docs/dev_docs/debugging/aztecnr-errors.md index 713ad48ab2c..bd4fe1e33aa 100644 --- a/docs/docs/dev_docs/debugging/aztecnr-errors.md +++ b/docs/docs/dev_docs/debugging/aztecnr-errors.md @@ -20,7 +20,7 @@ Any smart contract that works with storage must include a [`compute_note_hash_an This is an example of this function in the token contract: -#include_code compute_note_hash_and_nullifier yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust This error may also show if the `compute_note_hash_and_nullifier` function is not correct or sits outside of the contract. diff --git a/docs/docs/dev_docs/getting_started/aztecjs-getting-started.md b/docs/docs/dev_docs/getting_started/aztecjs-getting-started.md index 185c8bdaf15..1b07e71412d 100644 --- a/docs/docs/dev_docs/getting_started/aztecjs-getting-started.md +++ b/docs/docs/dev_docs/getting_started/aztecjs-getting-started.md @@ -161,7 +161,7 @@ If you want more accounts, you can find instructions in the [Account creation se ## Deploy a contract -Now that we have our accounts loaded, let's move on to deploy our pre-compiled token smart contract. You can find the full code for the contract [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts/token_contract/src). Add this to `index.ts` below the code you added earlier: +Now that we have our accounts loaded, let's move on to deploy our pre-compiled token smart contract. You can find the full code for the contract [here](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts/token_contract/src). Add this to `index.ts` below the code you added earlier: #include_code Deployment /yarn-project/end-to-end/src/e2e_sandbox_example.test.ts typescript diff --git a/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md b/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md index bdc5b5e433f..21fa6175cfb 100644 --- a/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md +++ b/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md @@ -72,7 +72,7 @@ We need to define some imports. Write this within your contract at the top -#include_code imports /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust +#include_code imports /yarn-project/noir-contracts/contracts/counter_contract/src/main.nr rust `context::{PrivateContext, Context}` @@ -96,11 +96,11 @@ This allows us to store our counter in a way that acts as an integer, abstractin In this step, we will initiate a `Storage` struct to store balances in a private way. The vast majority Aztec.nr smart contracts will need this. -#include_code storage_struct /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust +#include_code storage_struct /yarn-project/noir-contracts/contracts/counter_contract/src/main.nr rust We are only storing one variable - `counts` as a `Map` of `EasyPrivateUint`. This means our `count` will act as a private integer, and we can map it to an address. -#include_code storage_init /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust +#include_code storage_init /yarn-project/noir-contracts/contracts/counter_contract/src/main.nr rust This `init` method is creating and initializing a `Storage` instance. This instance includes a `Map` named `counters`. Each entry in this `Map` represents an account's counter. @@ -110,7 +110,7 @@ Now we’ve got a mechanism for storing our private state, we can start using it Let’s create a `constructor` method to run on deployment that assigns an initial supply of tokens to a specified owner. In the constructor we created in the first step, write this: -#include_code constructor /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust +#include_code constructor /yarn-project/noir-contracts/contracts/counter_contract/src/main.nr rust This function accesses the counts from storage. Then it assigns the passed initial counter to the `owner`'s counter privately using `at().add()`. @@ -120,7 +120,7 @@ We have annotated this and other functions with `#[aztec(private)]` which are AB Now let’s implement the `increment` function we defined in the first step. -#include_code increment /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust +#include_code increment /yarn-project/noir-contracts/contracts/counter_contract/src/main.nr rust The `increment` function works very similarly to the `constructor`, but instead directly adds 1 to the counter rather than passing in an initial count parameter. @@ -130,7 +130,7 @@ Because our counters are private, the network can't directly verify if a note wa Add a new function into your contract as shown below: -#include_code nullifier /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust +#include_code nullifier /yarn-project/noir-contracts/contracts/counter_contract/src/main.nr rust Here, we're computing both the note hash and the nullifier. The nullifier computation uses Aztec’s `compute_note_hash_and_nullifier` function, which takes details about the note's attributes eg contract address, nonce, storage slot, and preimage. @@ -138,7 +138,7 @@ Here, we're computing both the note hash and the nullifier. The nullifier comput The last thing we need to implement is the function in order to retrieve a counter. In the `getCounter` we defined in the first step, write this: -#include_code get_counter /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust +#include_code get_counter /yarn-project/noir-contracts/contracts/counter_contract/src/main.nr rust This function is `unconstrained` which allows us to fetch data from storage without a transaction. We retrieve a reference to the `owner`'s `counter` from the `counters` Map. The `get_balance` function then operates on the owner's counter. This yields a private counter that only the private key owner can decrypt. diff --git a/docs/docs/dev_docs/getting_started/core-concepts.md b/docs/docs/dev_docs/getting_started/core-concepts.md index e5087c624c1..cef4b5a6fa6 100644 --- a/docs/docs/dev_docs/getting_started/core-concepts.md +++ b/docs/docs/dev_docs/getting_started/core-concepts.md @@ -29,7 +29,7 @@ The PXE is unaware of the Public VM. And the Public VM is unaware of the PXE. Th You can call a public function from a private function by using `context.call_public_function`, like this: -#include_code call_public_function yarn-project/noir-contracts/src/contracts/card_game_contract/src/main.nr rust +#include_code call_public_function yarn-project/noir-contracts/contracts/card_game_contract/src/main.nr rust You cannot call a private function from a public function, but you can use a slow updates tree to read historical public state and stage writes to public state from a private function. @@ -54,11 +54,11 @@ Currently, when writing Aztec.nr smart contracts, you will need to define two th The storage struct looks like this: -#include_code storage_struct yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_struct yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust The storage impl block looks like this: -#include_code storage_init yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_init yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust The `init` function must declare the storage struct with an instantiation defining how variables are accessed and manipulated. Each variable must be given a storage slot, which can be anything except 0. diff --git a/docs/docs/dev_docs/tutorials/testing.md b/docs/docs/dev_docs/tutorials/testing.md index b0c3d553327..00d4359f419 100644 --- a/docs/docs/dev_docs/tutorials/testing.md +++ b/docs/docs/dev_docs/tutorials/testing.md @@ -12,7 +12,7 @@ Let's start with a simple example for a test using the [Sandbox](../cli/sandbox- #include_code sandbox-example /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript -This test sets up the environment by creating a client to the Private Execution Environment (PXE) running on the Sandbox on port 8080. It then creates two new accounts, dubbed `owner` and `recipient`. Last, it deploys an instance of the [Token contract](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr), minting an initial 100 tokens to the owner. +This test sets up the environment by creating a client to the Private Execution Environment (PXE) running on the Sandbox on port 8080. It then creates two new accounts, dubbed `owner` and `recipient`. Last, it deploys an instance of the [Token contract](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr), minting an initial 100 tokens to the owner. Once we have this setup, the test itself is simple. We check the balance of the `recipient` user to ensure it has no tokens, send and await a deployment transaction, and then check the balance again to ensure it was increased. Note that all numeric values are represented as [native bigints](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) to avoid loss of precision. @@ -120,7 +120,7 @@ We can have private transactions that work fine locally, but are dropped by the #### A public call fails locally -Public function calls can be caught failing locally similar to how we catch private function calls. For this example, we use a [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr) instead of a private one. +Public function calls can be caught failing locally similar to how we catch private function calls. For this example, we use a [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr) instead of a private one. :::info Keep in mind that public function calls behave as in EVM blockchains, in that they are executed by the sequencer and not locally. Local simulation helps alert the user of a potential failure, but the actual execution path of a public function call will depend on when it gets mined. @@ -164,7 +164,7 @@ We can query the Private eXecution Environment (PXE) for all notes encrypted for #### Querying public state -[Public state](../../concepts/foundation/state_model/main.md#public-state) behaves as a key-value store, much like in the EVM. This scenario is much more straightforward, in that we can directly query the target slot and get the result back as a buffer. Note that we use the [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr) in this example, which defines a mapping of public balances on slot 6. +[Public state](../../concepts/foundation/state_model/main.md#public-state) behaves as a key-value store, much like in the EVM. This scenario is much more straightforward, in that we can directly query the target slot and get the result back as a buffer. Note that we use the [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr) in this example, which defines a mapping of public balances on slot 6. #include_code public-storage /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript @@ -190,7 +190,7 @@ The [`CheatCodes`](./../testing/cheat_codes.md) class, which we used for [calcul The `warp` method sets the time for next execution, both on L1 and L2. We can test this using an `isTimeEqual` function in a `Test` contract defined like the following: -#include_code is-time-equal yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr rust +#include_code is-time-equal yarn-project/noir-contracts/contracts/test_contract/src/main.nr rust We can then call `warp` and rely on the `isTimeEqual` function to check that the timestamp was properly modified. diff --git a/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md b/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md index 9101322b633..c04563fc24a 100644 --- a/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md +++ b/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md @@ -8,23 +8,23 @@ In this step we will start writing our Aztec.nr bridge smart contract and write In our `token-bridge` Aztec project in `aztec-contracts`, under `src` there is an example `main.nr` file. Paste this to define imports and initialize the constructor: -#include_code token_bridge_imports /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code token_bridge_imports /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust -#include_code token_bridge_storage_and_constructor /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code token_bridge_storage_and_constructor /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust This imports Aztec-related dependencies and our helper file `token_interface.nr`. (The code above will give errors right now - this is because we haven't implemented util and token_interface yet.) In `token_interface.nr`, add this: -#include_code token_bridge_token_interface /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/token_interface.nr rust +#include_code token_bridge_token_interface /yarn-project/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr rust ## Consume the L1 message In the previous step, we have moved our funds to the portal and created a L1->L2 message. Upon building the next rollup, the sequencer asks the inbox for any incoming messages and adds them to Aztec’s L1->L2 message tree, so an application on L2 can prove that the message exists and consumes it. In `main.nr`, now paste this `claim_public` function: -#include_code claim_public /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code claim_public /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust The `claim_public` function enables anyone to consume the message on the user's behalf and mint tokens for them on L2. This is fine as the minting of tokens is done publicly anyway. @@ -43,9 +43,9 @@ The `claim_public` function enables anyone to consume the message on the user's Now we will create a function to mint the amount privately. Paste this into your `main.nr` -#include_code claim_private /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code claim_private /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust -#include_code call_mint_on_token /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code call_mint_on_token /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust The `get_mint_private_content_hash` function is imported from the `token_portal_content_hash_lib`. diff --git a/docs/docs/dev_docs/tutorials/token_portal/setup.md b/docs/docs/dev_docs/tutorials/token_portal/setup.md index 4b8076d412f..23f3b514507 100644 --- a/docs/docs/dev_docs/tutorials/token_portal/setup.md +++ b/docs/docs/dev_docs/tutorials/token_portal/setup.md @@ -62,7 +62,7 @@ type = "contract" [dependencies] aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" } -token_portal_content_hash_lib = { git="https://github.com/AztecProtocol/aztec-packages/", tag="aztec-packages-v0.16.9", directory="yarn-project/noir-contracts/src/contracts/token_portal_content_hash_lib" } +token_portal_content_hash_lib = { git="https://github.com/AztecProtocol/aztec-packages/", tag="aztec-packages-v0.16.9", directory="yarn-project/noir-contracts/contracts/token_portal_content_hash_lib" } protocol_types = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/noir-protocol-circuits/src/crates/types"} ``` diff --git a/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md b/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md index 1bd59d9a331..0dd42374501 100644 --- a/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md +++ b/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md @@ -33,7 +33,7 @@ In `utils.ts`, put: ```typescript import * as fs from "fs"; import { AztecAddress, EthAddress, TxStatus, Wallet } from "@aztec/aztec.js"; -import { TokenContract } from "@aztec/noir-contracts/types"; +import { TokenContract } from "@aztec/noir-contracts/Token"; import { Account, Chain, @@ -88,7 +88,8 @@ Open `cross_chain_messaging.test.ts` and paste the initial description of the te ```typescript import { expect, jest} from '@jest/globals' import { AccountWallet, AztecAddress, DebugLogger, EthAddress, Fr, computeAuthWitMessageHash, createDebugLogger, createPXEClient, getSandboxAccountsWallets, waitForSandbox } from '@aztec/aztec.js'; -import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; +import { TokenBridgeContract } from '@aztec/noir-contracts/TokenBridge'; import { CrossChainTestHarness } from './shared/cross_chain_test_harness.js'; import { delay } from './fixtures/utils.js'; diff --git a/docs/docs/dev_docs/tutorials/token_portal/withdrawing_to_l1.md b/docs/docs/dev_docs/tutorials/token_portal/withdrawing_to_l1.md index 99c4a67ea9e..d176e99a919 100644 --- a/docs/docs/dev_docs/tutorials/token_portal/withdrawing_to_l1.md +++ b/docs/docs/dev_docs/tutorials/token_portal/withdrawing_to_l1.md @@ -8,7 +8,7 @@ This is where we have tokens on Aztec and want to withdraw them back to L1 (i.e. Go back to your `main.nr` and paste this: -#include_code exit_to_l1_public /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code exit_to_l1_public /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust For this to work we import the `get_withdraw_content_hash` helper function from the `token_portal_content_hash_lib`. @@ -25,9 +25,9 @@ The `exit_to_l1_public` function enables anyone to withdraw their L2 tokens back This function works very similarly to the public version, except here we burn user’s private notes. Under the public function in your `main.nr`, paste this: -#include_code exit_to_l1_private /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code exit_to_l1_private /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust -#include_code assert_token_is_same /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code assert_token_is_same /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust Since this is a private method, it can't read what token is publicly stored. So instead the user passes a token address, and `_assert_token_is_same()` checks that this user provided address is same as the one in storage. @@ -55,11 +55,11 @@ Before we can compile and use the contract, we need to add two additional functi We need a function that let's us read the token value. -#include_code read_token /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code read_token /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust And the `compute_note_hash_and_nullifier` required on every contract. -#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust ## Compile code diff --git a/docs/docs/dev_docs/tutorials/uniswap/l2_contract_setup.md b/docs/docs/dev_docs/tutorials/uniswap/l2_contract_setup.md index 0e451114328..9bdec48ed59 100644 --- a/docs/docs/dev_docs/tutorials/uniswap/l2_contract_setup.md +++ b/docs/docs/dev_docs/tutorials/uniswap/l2_contract_setup.md @@ -8,7 +8,7 @@ In this step, we will set up the storage struct for our Uniswap contract and def Our main contract will live inside `uniswap/src/main.nr`. In `main.nr`, paste this initial setup code: -#include_code uniswap_setup yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust +#include_code uniswap_setup yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust **What’s happening here?** @@ -19,7 +19,7 @@ To ensure there are no collisions (i.e. when the contract wants to approve the b ## Building the approval flow Next, paste this function: -#include_code authwit_uniswap_get yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust +#include_code authwit_uniswap_get yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust In this function, the token contract calls the Uniswap contract to check if Uniswap has indeed done the approval. The token contract expects a `is_valid()` function to exit for private approvals and `is_valid_public()` for public approvals. If the action is indeed approved, it expects that the contract would return the function selector for `is_valid()`  in both cases. The Aztec.nr library exposes this constant for ease of use. The token contract also emits a nullifier for this message so that this approval (with the nonce) can’t be used again. @@ -27,7 +27,7 @@ This is similar to the [Authwit flow](../../contracts/resources/common_patterns/ However we don't have a function that actually creates the approved message and stores the action. This method should be responsible for creating the approval and then calling the token bridge to withdraw the funds to L1: -#include_code authwit_uniswap_set yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust +#include_code authwit_uniswap_set yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust Notice how the nonce also gets incremented. diff --git a/docs/docs/dev_docs/tutorials/uniswap/setup.md b/docs/docs/dev_docs/tutorials/uniswap/setup.md index fd35afb7403..6083c9bf9fa 100644 --- a/docs/docs/dev_docs/tutorials/uniswap/setup.md +++ b/docs/docs/dev_docs/tutorials/uniswap/setup.md @@ -64,7 +64,7 @@ cd uniswap/src && touch util.nr && touch interfaces.nr Inside `interfaces.nr` paste this: -#include_code interfaces yarn-project/noir-contracts/src/contracts/uniswap_contract/src/interfaces.nr rust +#include_code interfaces yarn-project/noir-contracts/contracts/uniswap_contract/src/interfaces.nr rust This creates interfaces for the `Token` contract and `TokenBridge` contract diff --git a/docs/docs/dev_docs/tutorials/uniswap/swap_privately.md b/docs/docs/dev_docs/tutorials/uniswap/swap_privately.md index a0fa6d52b43..cae2043165f 100644 --- a/docs/docs/dev_docs/tutorials/uniswap/swap_privately.md +++ b/docs/docs/dev_docs/tutorials/uniswap/swap_privately.md @@ -4,13 +4,13 @@ title: Swapping Privately In the `uniswap/src/main.nr` contract we created [previously](./l2_contract_setup.md) in `aztec-contracts/uniswap`, paste these functions: -#include_code swap_private yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust -#include_code assert_token_is_same yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust +#include_code swap_private yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust +#include_code assert_token_is_same yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust This uses a util function `compute_swap_private_content_hash()` - let's add that. In `util.nr`, add: -#include_code compute_swap_private_content_hash yarn-project/noir-contracts/src/contracts/uniswap_contract/src/util.nr rust +#include_code compute_swap_private_content_hash yarn-project/noir-contracts/contracts/uniswap_contract/src/util.nr rust This flow works similarly to the public flow with a few notable changes: diff --git a/docs/docs/dev_docs/tutorials/uniswap/swap_publicly.md b/docs/docs/dev_docs/tutorials/uniswap/swap_publicly.md index f5f1c984d7c..91f4864e65d 100644 --- a/docs/docs/dev_docs/tutorials/uniswap/swap_publicly.md +++ b/docs/docs/dev_docs/tutorials/uniswap/swap_publicly.md @@ -6,12 +6,12 @@ In this step we will create the flow for allowing a user to swap their tokens pu In `main.nr` paste this: -#include_code swap_public yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rust +#include_code swap_public yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr rust This uses a util function `compute_swap_public_content_hash()` - let's add that. In `util.nr`, add: -#include_code uniswap_public_content_hash yarn-project/noir-contracts/src/contracts/uniswap_contract/src/util.nr rust +#include_code uniswap_public_content_hash yarn-project/noir-contracts/contracts/uniswap_contract/src/util.nr rust **What’s happening here?** diff --git a/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md b/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md index 4bc580b5ffe..1d9df9dbc87 100644 --- a/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md +++ b/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md @@ -26,11 +26,11 @@ safe_math = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#incl Last, copy-paste the code from the `Token` contract into `contracts/token/main.nr`: -#include_code token_all yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code token_all yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### Helper files -The `Token` contract also requires some helper files. You can view the files [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/noir-contracts/src/contracts/token_contract/src). Copy the `types.nr` and the `types` folder into `contracts/token/src`. +The `Token` contract also requires some helper files. You can view the files [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/noir-contracts/contracts/token_contract/src). Copy the `types.nr` and the `types` folder into `contracts/token/src`. ## Compile your contract diff --git a/docs/docs/dev_docs/tutorials/writing_dapp/contract_interaction.md b/docs/docs/dev_docs/tutorials/writing_dapp/contract_interaction.md index 45f7ad4bf71..effaa050802 100644 --- a/docs/docs/dev_docs/tutorials/writing_dapp/contract_interaction.md +++ b/docs/docs/dev_docs/tutorials/writing_dapp/contract_interaction.md @@ -6,7 +6,7 @@ In this section, we'll write the logic in our app that will interact with the co Let's start by showing our user's private balance for the token across their accounts. To do this, we can leverage the `balance_of_private` unconstrained view function of the token contract: -#include_code balance_of_private yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code balance_of_private yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust :::info Note that this function will only return a valid response for accounts registered in the Private eXecution Environment (PXE), since it requires access to the [user's private state](../../wallets/main.md#private-state). In other words, you cannot query the private balance of another user for the token contract. diff --git a/docs/docs/dev_docs/tutorials/writing_dapp/testing.md b/docs/docs/dev_docs/tutorials/writing_dapp/testing.md index 2265bac5b2e..4fce0d11b1d 100644 --- a/docs/docs/dev_docs/tutorials/writing_dapp/testing.md +++ b/docs/docs/dev_docs/tutorials/writing_dapp/testing.md @@ -31,7 +31,7 @@ import { createPXEClient, waitForSandbox, } from "@aztec/aztec.js"; -import { TokenContractArtifact } from "@aztec/noir-contracts/artifacts"; +import { TokenContractArtifact } from "@aztec/noir-contracts/Token"; const { PXE_URL = "http://localhost:8080", diff --git a/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md b/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md index 19049c46357..8468927e715 100644 --- a/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md +++ b/docs/docs/dev_docs/tutorials/writing_private_voting_contract.md @@ -65,7 +65,7 @@ This defines a contract called `Voter`. Everything will sit inside this block. Inside this, paste these imports: -#include_code imports yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code imports yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust We are using various utils within the Aztec library: @@ -86,7 +86,7 @@ Under these imports, we need to set up our contract storage. This is done in two Define the storage struct like so: -#include_code storage_struct yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code storage_struct yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust In this contract, we will store three vars: 1. admin, as an Aztec address held in public state @@ -95,7 +95,7 @@ In this contract, we will store three vars: Under the struct, define the impl block like this: -#include_code storage_impl yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code storage_impl yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust The `impl` block must define one function `init` that explains how to access and manipulate our variables. We pass context, a storage slot, and serialization methods we imported earlier. @@ -109,7 +109,7 @@ All constructors must be private, and because the admin is in public storage, we Therefore our constructor must call a public function by using `context.call_public_function()`. Paste this under the `impl` storage block: -#include_code constructor yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code constructor yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust `context.call_public_function()` takes three arguments: 1. The contract address whose method we want to call @@ -118,7 +118,7 @@ Therefore our constructor must call a public function by using `context.call_pub We now need to write the `_initialize()` function: -#include_code initialize yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code initialize yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust This function takes the admin argument and writes it to the storage. We are also using this function to set the `voteEnded` boolean as false in the same way. @@ -135,7 +135,7 @@ To ensure someone only votes once, we will create a nullifier as part of the fun Create a private function called `cast_vote`: -#include_code cast_vote yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code cast_vote yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust In this function, we do not create a nullifier with the address directly. This would leak privacy as it would be easy to reverse-engineer. We must add some randomness or some form of secret, like [nullifier secrets](../../concepts/foundation/accounts/keys.md#nullifier-secrets). @@ -145,7 +145,7 @@ After pushing the nullifier, we update the `tally` to reflect this vote. As we k Create this new public function like this: -#include_code add_to_tally_public yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code add_to_tally_public yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust The first thing we do here is assert that the vote has not ended. @@ -157,7 +157,7 @@ The code after the assertion will only run if the assertion is true. In this sni We will create a function that anyone can call that will return the number of votes at a given vote Id. Paste this in your contract: -#include_code get_vote yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code get_vote yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust We set it as `unconstrained` and do not annotate it because it is only reading from state. You can read more about unconstrained functions [here](../../concepts/advanced/acir_simulator.md#unconstrained-functions). @@ -167,7 +167,7 @@ To ensure that only an admin can end a voting period, we can use another `assert Paste this function in your contract: -#include_code end_vote yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code end_vote yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust Here, we are asserting that the `msg_sender()` is equal to the admin stored in public state. We have to create an `AztecAddress` type from the `msg_sender()` in order to do a direct comparison. @@ -177,7 +177,7 @@ Every Aztec contract that has storage must have a `compute_note_hash_and_nullifi At the end of the contract, paste this: -#include_code compute_note_hash_and_nullifier yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr rust We can simply return `[0,0,0,0]` because we are not creating any notes in our contract. diff --git a/docs/docs/dev_docs/tutorials/writing_token_contract.md b/docs/docs/dev_docs/tutorials/writing_token_contract.md index cd93bcbdbeb..925d4fa3f34 100644 --- a/docs/docs/dev_docs/tutorials/writing_token_contract.md +++ b/docs/docs/dev_docs/tutorials/writing_token_contract.md @@ -14,7 +14,7 @@ In this tutorial you will learn how to: - Handle different private note types - Pass data between private and public state -We are going to start with a blank project and fill in the token contract source code defined on Github [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr), and explain what is being added as we go. +We are going to start with a blank project and fill in the token contract source code defined on Github [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/noir-contracts/contracts/token_contract/src/main.nr), and explain what is being added as we go. ## Requirements @@ -203,15 +203,15 @@ Before we can implement the functions, we need set up the contract storage, and :::info Copy required files -We will be going over the code in `main.nr` [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/noir-contracts/src/contracts/token_contract/src). If you are following along and want to compile `main.nr` yourself, you need to add the other files in the directory as they contain imports that are used in `main.nr`. +We will be going over the code in `main.nr` [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/noir-contracts/contracts/token_contract/src). If you are following along and want to compile `main.nr` yourself, you need to add the other files in the directory as they contain imports that are used in `main.nr`. ::: Just below the contract definition, add the following imports: -#include_code imports /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code imports /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust -We are importing the Option type, items from the `value_note` library to help manage private value storage, note utilities, context (for managing private and public execution contexts), `state_vars` for helping manage state, `types` for data manipulation and `oracle` for help passing data from the private to public execution context. We also import the `auth` [library](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/aztec-nr/aztec/src/auth.nr) to handle token authorizations from [Account Contracts](../../concepts/foundation/accounts/main). Check out the Account Contract with AuthWitness [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/src/main.nr). +We are importing the Option type, items from the `value_note` library to help manage private value storage, note utilities, context (for managing private and public execution contexts), `state_vars` for helping manage state, `types` for data manipulation and `oracle` for help passing data from the private to public execution context. We also import the `auth` [library](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/aztec-nr/aztec/src/auth.nr) to handle token authorizations from [Account Contracts](../../concepts/foundation/accounts/main). Check out the Account Contract with AuthWitness [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr). [SafeU120](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/aztec-nr/safe-math/src/safe_u120.nr) is a library to do safe math operations on unsigned integers that protects against overflows and underflows. @@ -219,7 +219,7 @@ For more detail on execution contexts, see [Contract Communication](../../concep ### Types files -We are also importing types from a `types.nr` file, which imports types from the `types` folder. You can view them [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/noir-contracts/src/contracts/token_contract/src). +We are also importing types from a `types.nr` file, which imports types from the `types` folder. You can view them [here](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/noir-contracts/contracts/token_contract/src). The main thing to note from this types folder is the `TransparentNote` definition. This defines how the contract moves value from the public domain into the private domain. It is similar to the `value_note` that we imported, but with some modifications namely, instead of a defined `owner`, it allows anyone that can produce the pre-image to the stored `secret_hash` to spend the note. @@ -233,7 +233,7 @@ Now that we have dependencies imported into our contract we can define the stora Below the dependencies, paste the following Storage struct: -#include_code storage_struct /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_struct /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust Reading through the storage variables: @@ -252,7 +252,7 @@ Once we have Storage defined, we need to specify how to initialize it. The `init Also, the public storage variables define the type that they store by passing the methods by which they are serialized. Because all `PublicState` in this contract is storing Field elements, each storage variable takes `FieldSerializationMethods`. -#include_code storage_init /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code storage_init /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ## Functions @@ -262,7 +262,7 @@ Copy and paste the body of each function into the appropriate place in your proj In the source code, the constructor logic is commented out due to some limitations of the current state of the development. -#include_code constructor /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code constructor /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust The constructor is a private function. There isn't any private state to set up in this function, but there is public state to set up. The `context` is a global variable that is available to private and public functions, but the available methods differ based on the context. You can see the implementation details [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/aztec-nr/aztec/src/context.nr). The `context.call_public_function` allows a private function to call a public function on any contract. In this case, the constructor is passing the `msg_sender` as the argument to the `_initialize` function, which is also defined in this contract. @@ -270,7 +270,7 @@ The constructor is a private function. There isn't any private state to set up i Public functions are declared with the `#[aztec(public)]` macro above the function name like so: -#include_code set_admin /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code set_admin /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust As described in the [execution contexts section above](#execution-contexts), public function logic and transaction information is transparent to the world. Public functions update public state, but can be used to prepare data to be used in a private context, as we will go over below (e.g. see the [shield](#shield) function). @@ -280,13 +280,13 @@ Storage is referenced as `storage.variable`. After storage is initialized, the contract checks that the `msg_sender` is the `admin`. If not, the transaction will fail. If it is, the `new_admin` is saved as the `admin`. -#include_code set_admin /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code set_admin /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `set_minter` This function allows the `admin` to add or a remove a `minter` from the public `minters` mapping. It checks that `msg_sender` is the `admin` and finally adds the `minter` to the `minters` mapping. -#include_code set_minter /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code set_minter /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `mint_public` @@ -296,15 +296,15 @@ First, storage is initialized. Then the function checks that the `msg_sender` is The function returns 1 to indicate successful execution. -#include_code mint_public /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code mint_public /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `mint_private` This public function allows an account approved in the public `minters` mapping to create new private tokens that can be claimed by anyone that has the pre-image to the `secret_hash`. -First, public storage is initialized. Then it checks that the `msg_sender` is an approved minter. Then a new `TransparentNote` is created with the specified `amount` and `secret_hash`. You can read the details of the `TransparentNote` in the `types.nr` file [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/noir-contracts/src/contracts/token_contract/src/types.nr#L61). The `amount` is added to the existing public `total_supply` and the storage value is updated. Then the new `TransparentNote` is added to the `pending_shields` using the `insert_from_public` function, which is accessible on the `Set` type. Then it's ready to be claimed by anyone with the `secret_hash` pre-image using the `redeem_shield` function. It returns `1` to indicate successful execution. +First, public storage is initialized. Then it checks that the `msg_sender` is an approved minter. Then a new `TransparentNote` is created with the specified `amount` and `secret_hash`. You can read the details of the `TransparentNote` in the `types.nr` file [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/yarn-project/noir-contracts/contracts/token_contract/src/types.nr#L61). The `amount` is added to the existing public `total_supply` and the storage value is updated. Then the new `TransparentNote` is added to the `pending_shields` using the `insert_from_public` function, which is accessible on the `Set` type. Then it's ready to be claimed by anyone with the `secret_hash` pre-image using the `redeem_shield` function. It returns `1` to indicate successful execution. -#include_code mint_private /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code mint_private /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `shield` @@ -320,7 +320,7 @@ If the `msg_sender` is the same as the account to debit tokens from, the authori It returns `1` to indicate successful execution. -#include_code shield /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code shield /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `transfer_public` @@ -328,7 +328,7 @@ This public function enables public transfers between Aztec accounts. The sender After storage is initialized, the [authorization flow specified above](#authorizing-token-spends) is checked. Then the sender and recipient's balances are updated and saved to storage using the `SafeU120` library. -#include_code transfer_public /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code transfer_public /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `burn_public` @@ -336,7 +336,7 @@ This public function enables public burning (destroying) of tokens from the send After storage is initialized, the [authorization flow specified above](#authorizing-token-spends) is checked. Then the sender's public balance and the `total_supply` are updated and saved to storage using the `SafeU120` library. -#include_code burn_public /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code burn_public /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### Private function implementations @@ -359,7 +359,7 @@ Going through the function logic, first the `secret_hash` is generated from the The function returns `1` to indicate successful execution. -#include_code redeem_shield /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code redeem_shield /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `unshield` @@ -369,7 +369,7 @@ After initializing storage, the function checks that the `msg_sender` is authori The function returns `1` to indicate successful execution. -#include_code unshield /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code unshield /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `transfer` @@ -377,7 +377,7 @@ This private function enables private token transfers between Aztec accounts. After initializing storage, the function checks that the `msg_sender` is authorized to spend tokens. See [the Authorizing token spends section](#authorizing-token-spends) above for more detail--the only difference being that `assert_valid_message_for` is modified to work specifically in the private context. After authorization, the function gets the current balances for the sender and recipient and decrements and increments them, respectively, using the `value_note` helper functions. -#include_code transfer /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code transfer /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `burn` @@ -385,7 +385,7 @@ This private function enables accounts to privately burn (destroy) tokens. After initializing storage, the function checks that the `msg_sender` is authorized to spend tokens. Then it gets the sender's current balance and decrements it. Finally it stages a public function call to [`_reduce_total_supply`](#_reduce_total_supply). -#include_code burn /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code burn /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### Internal function implementations @@ -397,19 +397,19 @@ This function is called via the [constructor](#constructor). This function sets the creator of the contract (passed as `msg_sender` from the constructor) as the admin and makes them a minter. -#include_code initialize /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code initialize /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `_increase_public_balance` This function is called from [`unshield`](#unshield). The account's private balance is decremented in `shield` and the public balance is increased in this function. -#include_code increase_public_balance /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code increase_public_balance /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `_reduce_total_supply` This function is called from [`burn`](#burn). The account's private balance is decremented in `burn` and the public `total_supply` is reduced in this function. -#include_code reduce_total_supply /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code reduce_total_supply /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust ### Unconstrained function implementations @@ -419,31 +419,31 @@ Unconstrained functions are similar to `view` functions in Solidity in that they A getter function for reading the public `admin` value. -#include_code admin /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code admin /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `is_minter` A getter function for checking the value of associated with a `minter` in the public `minters` mapping. -#include_code is_minter /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code is_minter /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `total_supply` A getter function for checking the token `total_supply`. -#include_code total_supply /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code total_supply /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `balance_of_private` A getter function for checking the private balance of the provided Aztec account. Note that the [Private Execution Environment (PXE)](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/yarn-project/pxe) must have access to the `owner`s decryption keys in order to decrypt their notes. -#include_code balance_of_private /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code balance_of_private /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `balance_of_public` A getter function for checking the public balance of the provided Aztec account. -#include_code balance_of_public /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code balance_of_public /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust #### `compute_note_hash_and_nullifier` @@ -451,13 +451,13 @@ A getter function to compute the note hash and nullifier for notes in the contra This must be included in every contract because it depends on the storage slots, which are defined when we set up storage. -#include_code compute_note_hash_and_nullifier /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier /yarn-project/noir-contracts/contracts/token_contract/src/main.nr rust :::danger If your contract works with storage (has Storage struct defined), you **MUST** include a `compute_note_hash_and_nullifier` function. If you don't yet have any private state variables defined put there a placeholder function: -#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rust +#include_code compute_note_hash_and_nullifier_placeholder /yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr rust ::: ## Compiling diff --git a/docs/docs/dev_docs/wallets/main.md b/docs/docs/dev_docs/wallets/main.md index 2c84a171114..898acb41c55 100644 --- a/docs/docs/dev_docs/wallets/main.md +++ b/docs/docs/dev_docs/wallets/main.md @@ -20,7 +20,7 @@ Note that users must be able to receive funds in Aztec before deploying their ac Every transaction in Aztec is broadcast to the network as a zero-knowledge proof of correct execution, in order to preserve privacy. This means that transaction proofs are generated on the wallet and not on a remote node. This is one of the biggest differences with regard to EVM chain wallets. -A wallet is responsible for **creating** an [_execution request_](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/types/src/tx_execution_request.ts) out of one or more [_function calls_](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/types/src/function_call.ts) requested by a dapp. For example, a dapp may request a wallet to "invoke the `transfer` function on the contract at `0x1234` with the following arguments", in response to a user action. The wallet [turns that into an execution request](../../concepts/foundation/accounts/main.md#execution-requests) with the signed instructions to execute that function call from the user's account contract. In an [ECDSA-based account](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/src/main.nr), for instance, this is an execution request that encodes the function call in the _entrypoint payload_, and includes its ECDSA signature with the account's signing private key. +A wallet is responsible for **creating** an [_execution request_](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/types/src/tx_execution_request.ts) out of one or more [_function calls_](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/types/src/function_call.ts) requested by a dapp. For example, a dapp may request a wallet to "invoke the `transfer` function on the contract at `0x1234` with the following arguments", in response to a user action. The wallet [turns that into an execution request](../../concepts/foundation/accounts/main.md#execution-requests) with the signed instructions to execute that function call from the user's account contract. In an [ECDSA-based account](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/ecdsa_account_contract/src/main.nr), for instance, this is an execution request that encodes the function call in the _entrypoint payload_, and includes its ECDSA signature with the account's signing private key. Once the _execution request_ is created, the wallet is responsible for **simulating** and **proving** the execution of its private functions. The simulation yields an execution trace, which can be used to provide the user with a list of side effects of the private execution of the transaction. During this simulation, the wallet is responsible of providing data to the virtual machine, such as private notes, encryption keys, or nullifier secrets. This execution trace is fed into the prover, which returns a zero-knowledge proof that guarantees correct execution and hides all private information. The output of this process is a [_transaction_](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/types/src/tx/tx.ts) object. diff --git a/docs/docs/dev_docs/wallets/writing_an_account_contract.md b/docs/docs/dev_docs/wallets/writing_an_account_contract.md index c7228301d14..c87eb8b4973 100644 --- a/docs/docs/dev_docs/wallets/writing_an_account_contract.md +++ b/docs/docs/dev_docs/wallets/writing_an_account_contract.md @@ -25,7 +25,7 @@ For the sake of simplicity, we will hardcode the signing public key into the con Let's start with the account contract itself in Aztec.nr. Create [a new Aztec.nr contract project](../contracts/main.md) that will contain a file with the code for the account contract, with a hardcoded public key: -#include_code contract yarn-project/noir-contracts/src/contracts/schnorr_hardcoded_account_contract/src/main.nr rust +#include_code contract yarn-project/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr rust :::info You can use [the Aztec CLI](../cli/main.md) to generate a new keypair if you want to use a different one: @@ -53,7 +53,7 @@ Using the `AccountActions` module and the `EntrypointPayload` struct is not mand The `AccountActions` module provides default implementations for most of the account contract methods needed, but it requires a function for validating an auth witness. In this function you will customize how your account validates an action: whether it is using a specific signature scheme, a multi-party approval, a password, etc. -#include_code is-valid yarn-project/noir-contracts/src/contracts/schnorr_hardcoded_account_contract/src/main.nr rust +#include_code is-valid yarn-project/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr rust For our account contract, we will take the hash of the action to authorize, request the corresponding auth witness from the oracle, and validate it against our hardcoded public key. If the signature is correct, we authorize the action. diff --git a/docs/src/components/GithubCode/index.js b/docs/src/components/GithubCode/index.js index 7cbb04d6629..27cef562bab 100644 --- a/docs/src/components/GithubCode/index.js +++ b/docs/src/components/GithubCode/index.js @@ -12,7 +12,7 @@ import github from "prism-react-renderer/themes/github"; * Inside a markdown file: * * import GithubCode from '../src/components/GithubCode'; - * + * */ const GithubCode = ({ diff --git a/noir/docs/docs/noir/modules_packages_crates/crates_and_packages.md b/noir/docs/docs/noir/modules_packages_crates/crates_and_packages.md index aae6795b229..760a463094c 100644 --- a/noir/docs/docs/noir/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/docs/noir/modules_packages_crates/crates_and_packages.md @@ -24,7 +24,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/docs/noir/modules_packages_crates/dependencies.md b/noir/docs/docs/noir/modules_packages_crates/dependencies.md index 57f0f9fd420..21286bb3f72 100644 --- a/noir/docs/docs/noir/modules_packages_crates/dependencies.md +++ b/noir/docs/docs/noir/modules_packages_crates/dependencies.md @@ -35,7 +35,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/crates_and_packages.md index aae6795b229..760a463094c 100644 --- a/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/crates_and_packages.md @@ -24,7 +24,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/dependencies.md index 57f0f9fd420..21286bb3f72 100644 --- a/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/dependencies.md +++ b/noir/docs/versioned_docs/version-v../noir/modules_packages_crates/dependencies.md @@ -35,7 +35,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/crates_and_packages.md index fb83a33d94e..744de72bb2c 100644 --- a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/crates_and_packages.md @@ -23,7 +23,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/dependencies.md index 75f95aaa305..fd7511a3423 100644 --- a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/dependencies.md +++ b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/dependencies.md @@ -34,7 +34,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/crates_and_packages.md index fb83a33d94e..744de72bb2c 100644 --- a/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/crates_and_packages.md @@ -23,7 +23,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/dependencies.md index 75f95aaa305..fd7511a3423 100644 --- a/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/dependencies.md +++ b/noir/docs/versioned_docs/version-v0.19.0/modules_packages_crates/dependencies.md @@ -34,7 +34,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/crates_and_packages.md index fb83a33d94e..744de72bb2c 100644 --- a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/crates_and_packages.md @@ -23,7 +23,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/dependencies.md index 75f95aaa305..fd7511a3423 100644 --- a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/dependencies.md +++ b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/dependencies.md @@ -34,7 +34,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/crates_and_packages.md index fb83a33d94e..744de72bb2c 100644 --- a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/crates_and_packages.md @@ -23,7 +23,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/dependencies.md index 75f95aaa305..fd7511a3423 100644 --- a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/dependencies.md +++ b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/dependencies.md @@ -34,7 +34,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/crates_and_packages.md index fb83a33d94e..744de72bb2c 100644 --- a/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/crates_and_packages.md @@ -23,7 +23,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/dependencies.md index 75f95aaa305..fd7511a3423 100644 --- a/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/dependencies.md +++ b/noir/docs/versioned_docs/version-v0.19.3/modules_packages_crates/dependencies.md @@ -34,7 +34,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/crates_and_packages.md index fb83a33d94e..744de72bb2c 100644 --- a/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/crates_and_packages.md +++ b/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/crates_and_packages.md @@ -23,7 +23,7 @@ _Library crates_ don't have a `main` function and they don't compile down to ACI #### Contracts -Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/contracts). ### Crate Root diff --git a/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/dependencies.md index 75f95aaa305..fd7511a3423 100644 --- a/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/dependencies.md +++ b/noir/docs/versioned_docs/version-v0.19.4/modules_packages_crates/dependencies.md @@ -34,7 +34,7 @@ If the module is in a subdirectory, you can define a subdirectory in your git re # Nargo.toml [dependencies] -easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/contracts/easy_private_token_contract"} ``` ## Specifying a local dependency diff --git a/yarn-project/.dockerignore b/yarn-project/.dockerignore index f913d69056b..d4f7820cd6a 100644 --- a/yarn-project/.dockerignore +++ b/yarn-project/.dockerignore @@ -11,6 +11,7 @@ **/Dockerfile* **/*.tsbuildinfo -noir-contracts/src/types -noir-contracts/src/artifacts +./aztec.js/src/account_contract/artifacts + +noir-contracts/src noir-contracts/target diff --git a/yarn-project/Dockerfile b/yarn-project/Dockerfile index 696c60fbe1c..324ea28a435 100644 --- a/yarn-project/Dockerfile +++ b/yarn-project/Dockerfile @@ -9,9 +9,13 @@ FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base as builder # Copy in the entire workspace. COPY . . -RUN yarn workspace @aztec/foundation build +# This is actually our code generation tool. Needed to build contract typescript wrappers. RUN yarn workspace @aztec/noir-compiler build -RUN yarn workspace @aztec/noir-contracts noir:build:all +# Builds noir contracts (TODO: move this stage pre yarn-project). Generates typescript wrappers. +RUN yarn workspace @aztec/noir-contracts build:contracts +# We need to build aztec.js as it needs to copy in account contracts from noir-contracts. +# TODO: Contracts should not be baked into aztec.js. +RUN yarn workspace @aztec/aztec.js build RUN yarn workspace @aztec/noir-protocol-circuits noir:build RUN yarn tsc -b diff --git a/yarn-project/acir-simulator/src/client/private_execution.test.ts b/yarn-project/acir-simulator/src/client/private_execution.test.ts index 52849aff210..2b9d4d66972 100644 --- a/yarn-project/acir-simulator/src/client/private_execution.test.ts +++ b/yarn-project/acir-simulator/src/client/private_execution.test.ts @@ -37,7 +37,7 @@ import { StatefulTestContractArtifact, TestContractArtifact, TokenContractArtifact, -} from '@aztec/noir-contracts/artifacts'; +} from '@aztec/noir-contracts'; import { Note, PackedArguments, TxExecutionRequest } from '@aztec/types'; import { jest } from '@jest/globals'; diff --git a/yarn-project/acir-simulator/src/client/simulator.test.ts b/yarn-project/acir-simulator/src/client/simulator.test.ts index ea4878704e2..3b04dee7e6a 100644 --- a/yarn-project/acir-simulator/src/client/simulator.test.ts +++ b/yarn-project/acir-simulator/src/client/simulator.test.ts @@ -4,7 +4,7 @@ import { ABIParameterVisibility } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { pedersenHash } from '@aztec/foundation/crypto'; import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; -import { TokenContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { TokenContractArtifact } from '@aztec/noir-contracts/Token'; import { Note } from '@aztec/types'; import { MockProxy, mock } from 'jest-mock-extended'; diff --git a/yarn-project/acir-simulator/src/client/unconstrained_execution.test.ts b/yarn-project/acir-simulator/src/client/unconstrained_execution.test.ts index 3db5f2e9f3d..456ba584f8b 100644 --- a/yarn-project/acir-simulator/src/client/unconstrained_execution.test.ts +++ b/yarn-project/acir-simulator/src/client/unconstrained_execution.test.ts @@ -2,7 +2,7 @@ import { BlockHeader, CompleteAddress, FunctionData } from '@aztec/circuits.js'; import { FunctionSelector, encodeArguments } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; -import { StatefulTestContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { StatefulTestContractArtifact } from '@aztec/noir-contracts/StatefulTest'; import { FunctionCall, Note } from '@aztec/types'; import { mock } from 'jest-mock-extended'; diff --git a/yarn-project/acir-simulator/src/public/index.test.ts b/yarn-project/acir-simulator/src/public/index.test.ts index 7522b1a41f1..59823b69d2b 100644 --- a/yarn-project/acir-simulator/src/public/index.test.ts +++ b/yarn-project/acir-simulator/src/public/index.test.ts @@ -4,12 +4,10 @@ import { AztecAddress } from '@aztec/foundation/aztec-address'; import { pedersenHash } from '@aztec/foundation/crypto'; import { EthAddress } from '@aztec/foundation/eth-address'; import { Fr } from '@aztec/foundation/fields'; -import { - ChildContractArtifact, - ParentContractArtifact, - TestContractArtifact, - TokenContractArtifact, -} from '@aztec/noir-contracts/artifacts'; +import { ChildContractArtifact } from '@aztec/noir-contracts/Child'; +import { ParentContractArtifact } from '@aztec/noir-contracts/Parent'; +import { TestContractArtifact } from '@aztec/noir-contracts/Test'; +import { TokenContractArtifact } from '@aztec/noir-contracts/Token'; import { MockProxy, mock } from 'jest-mock-extended'; import { type MemDown, default as memdown } from 'memdown'; diff --git a/yarn-project/aztec-sandbox/src/examples/token.ts b/yarn-project/aztec-sandbox/src/examples/token.ts index 14dbcef82e7..a9ec1d921d6 100644 --- a/yarn-project/aztec-sandbox/src/examples/token.ts +++ b/yarn-project/aztec-sandbox/src/examples/token.ts @@ -8,7 +8,7 @@ import { getUnsafeSchnorrAccount, } from '@aztec/aztec.js'; import { createDebugLogger } from '@aztec/foundation/log'; -import { TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import { ExtendedNote } from '@aztec/types'; const logger = createDebugLogger('aztec:http-rpc-client'); diff --git a/yarn-project/aztec.js/package.json b/yarn-project/aztec.js/package.json index 64e7ef03554..8e351451a8a 100644 --- a/yarn-project/aztec.js/package.json +++ b/yarn-project/aztec.js/package.json @@ -23,11 +23,12 @@ "tsconfig": "./tsconfig.json" }, "scripts": { - "build": "yarn clean && tsc -b && webpack", + "build": "yarn clean && yarn build:copy-contracts && tsc -b && webpack", + "build:copy-contracts": "mkdir ./src/account_contract/artifacts && cp ../noir-contracts/src/SchnorrAccount.json ../noir-contracts/src/EcdsaAccount.json ../noir-contracts/src/SchnorrSingleKeyAccount.json ./src/account_contract/artifacts", "build:web": "webpack", "build:dev": "tsc -b --watch", "build:ts": "tsc -b", - "clean": "rm -rf ./dest .tsbuildinfo", + "clean": "rm -rf ./dest .tsbuildinfo ./src/account_contract/artifacts", "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests" @@ -51,7 +52,6 @@ "@aztec/types": "workspace:^", "lodash.every": "^4.6.0", "lodash.partition": "^4.6.0", - "lodash.zip": "^4.2.0", "tslib": "^2.4.0" }, "devDependencies": { @@ -59,7 +59,6 @@ "@types/jest": "^29.5.0", "@types/lodash.every": "^4.6.7", "@types/lodash.partition": "^4.6.0", - "@types/lodash.zip": "^4.2.7", "@types/node": "^18.7.23", "buffer": "^6.0.3", "crypto-browserify": "^3.12.0", diff --git a/yarn-project/aztec.js/package.local.json b/yarn-project/aztec.js/package.local.json index bdabc013c57..db6bd6204c7 100644 --- a/yarn-project/aztec.js/package.local.json +++ b/yarn-project/aztec.js/package.local.json @@ -1,8 +1,9 @@ { "scripts": { - "build": "yarn clean && tsc -b && webpack", + "build": "yarn clean && yarn build:copy-contracts && tsc -b && webpack", "build:web": "webpack", "build:dev": "tsc -b --watch", - "build:ts": "tsc -b" + "build:ts": "tsc -b", + "clean": "rm -rf ./dest .tsbuildinfo ./src/account_contract/artifacts" } } diff --git a/yarn-project/aztec.js/src/account_contract/ecdsa_account_contract.ts b/yarn-project/aztec.js/src/account_contract/ecdsa_account_contract.ts index c7f344c3731..c6ce2b3b359 100644 --- a/yarn-project/aztec.js/src/account_contract/ecdsa_account_contract.ts +++ b/yarn-project/aztec.js/src/account_contract/ecdsa_account_contract.ts @@ -4,7 +4,7 @@ import { Fr } from '@aztec/foundation/fields'; import { AuthWitness, CompleteAddress } from '@aztec/types'; import { AuthWitnessProvider } from '../account/interface.js'; -import EcdsaAccountContractArtifact from './artifacts/ecdsa_account_contract.json' assert { type: 'json' }; +import EcdsaAccountContractArtifact from './artifacts/EcdsaAccount.json' assert { type: 'json' }; import { BaseAccountContract } from './base_account_contract.js'; /** diff --git a/yarn-project/aztec.js/src/account_contract/schnorr_account_contract.ts b/yarn-project/aztec.js/src/account_contract/schnorr_account_contract.ts index f70c5cf1461..41ba89f3302 100644 --- a/yarn-project/aztec.js/src/account_contract/schnorr_account_contract.ts +++ b/yarn-project/aztec.js/src/account_contract/schnorr_account_contract.ts @@ -4,7 +4,7 @@ import { Fr } from '@aztec/foundation/fields'; import { AuthWitness, CompleteAddress, GrumpkinPrivateKey } from '@aztec/types'; import { AuthWitnessProvider } from '../account/interface.js'; -import SchnorrAccountContractArtifact from './artifacts/schnorr_account_contract.json' assert { type: 'json' }; +import SchnorrAccountContractArtifact from './artifacts/SchnorrAccount.json' assert { type: 'json' }; import { BaseAccountContract } from './base_account_contract.js'; /** diff --git a/yarn-project/aztec.js/src/account_contract/single_key_account_contract.ts b/yarn-project/aztec.js/src/account_contract/single_key_account_contract.ts index 24a5c7178fa..ef18fc8264d 100644 --- a/yarn-project/aztec.js/src/account_contract/single_key_account_contract.ts +++ b/yarn-project/aztec.js/src/account_contract/single_key_account_contract.ts @@ -6,7 +6,7 @@ import { AuthWitness, CompleteAddress, GrumpkinPrivateKey } from '@aztec/types'; import { AuthWitnessProvider } from '../account/interface.js'; import { generatePublicKey } from '../utils/index.js'; -import SchnorrSingleKeyAccountContractArtifact from './artifacts/schnorr_single_key_account_contract.json' assert { type: 'json' }; +import SchnorrSingleKeyAccountContractArtifact from './artifacts/SchnorrSingleKeyAccount.json' assert { type: 'json' }; import { BaseAccountContract } from './base_account_contract.js'; /** diff --git a/yarn-project/aztec.js/src/sandbox/index.ts b/yarn-project/aztec.js/src/sandbox/index.ts index 8d3dfbdb162..79f9f068b1d 100644 --- a/yarn-project/aztec.js/src/sandbox/index.ts +++ b/yarn-project/aztec.js/src/sandbox/index.ts @@ -2,8 +2,6 @@ import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; import { sleep } from '@aztec/foundation/sleep'; import { PXE } from '@aztec/types'; -import zip from 'lodash.zip'; - import { getSchnorrAccount } from '../account_manager/index.js'; import { createPXEClient } from '../pxe_client.js'; import { AccountWalletWithPrivateKey } from '../wallet/index.js'; @@ -27,8 +25,8 @@ export const { PXE_URL = 'http://localhost:8080' } = process.env; */ export function getSandboxAccountsWallets(pxe: PXE): Promise { return Promise.all( - zip(INITIAL_SANDBOX_ENCRYPTION_KEYS, INITIAL_SANDBOX_SIGNING_KEYS, INITIAL_SANDBOX_SALTS).map( - ([encryptionKey, signingKey, salt]) => getSchnorrAccount(pxe, encryptionKey!, signingKey!, salt).getWallet(), + INITIAL_SANDBOX_ENCRYPTION_KEYS.map((encryptionKey, i) => + getSchnorrAccount(pxe, encryptionKey!, INITIAL_SANDBOX_SIGNING_KEYS[i]!, INITIAL_SANDBOX_SALTS[i]).getWallet(), ), ); } diff --git a/yarn-project/bootstrap.sh b/yarn-project/bootstrap.sh index fcdf30c7b43..a8837f38b74 100755 --- a/yarn-project/bootstrap.sh +++ b/yarn-project/bootstrap.sh @@ -26,31 +26,19 @@ if [ -n "$CMD" ]; then fi fi -# if [ "$(uname)" = "Darwin" ]; then -# # works around https://github.com/AztecProtocol/aztec3-packages/issues/158 -# echo "Note: not sourcing nvm on Mac, see github #158" -# else -# \. ~/.nvm/nvm.sh -# fi -# set +eu # nvm runs in our context - don't assume it's compatible with these flags -# nvm install -# set -eu - yarn install --immutable -# Build the necessary dependencies for Aztec.nr contracts typegen. -for package in "@aztec/foundation" "@aztec/noir-compiler"; do - echo "Building $package" - yarn workspace $package build -done - # Run remake constants before building Aztec.nr contracts or l1 contracts as they depend on files created by it. yarn workspace @aztec/circuits.js remake-constants +# This is actually our code generation tool. Needed to build contract typescript wrappers. +yarn workspace @aztec/noir-compiler build +# Builds noir contracts (TODO: move this stage pre yarn-project). Generates typescript wrappers. +yarn workspace @aztec/noir-contracts build:contracts +# TODO: Contracts should not be baked into aztec.js. +yarn workspace @aztec/aztec.js build:copy-contracts +# Build protocol circuits. TODO: move pre yarn-project. yarn workspace @aztec/noir-protocol-circuits noir:build -(cd noir-contracts && ./bootstrap.sh) - -# We do not need to build individual packages, yarn build will build the root tsconfig.json yarn build echo diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index e3a0dae1ced..10befd0fe2b 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -8,7 +8,8 @@ "./barretenberg": "./dest/barretenberg/index.js", "./factories": "./dest/tests/factories.js", "./utils": "./dest/utils/index.js", - "./types": "./dest/types/index.js" + "./types": "./dest/types/index.js", + "./constants": "./dest/constants.gen.js" }, "typedocOptions": { "entryPoints": [ diff --git a/yarn-project/cli/package.json b/yarn-project/cli/package.json index e7c2fb58805..8d686c93f8c 100644 --- a/yarn-project/cli/package.json +++ b/yarn-project/cli/package.json @@ -49,6 +49,7 @@ "lodash.startcase": "^4.4.0", "node-fetch": "^3.3.2", "semver": "^7.5.4", + "source-map-support": "^0.5.21", "tslib": "^2.4.0", "viem": "^1.2.5" }, @@ -58,6 +59,7 @@ "@types/lodash.startcase": "^4.4.7", "@types/node": "^18.7.23", "@types/semver": "^7.5.2", + "@types/source-map-support": "^0.5.10", "jest": "^29.5.0", "jest-mock-extended": "^3.0.5", "ts-jest": "^29.1.0", diff --git a/yarn-project/cli/src/bin/index.ts b/yarn-project/cli/src/bin/index.ts index 948d81f2940..4e1c4b1ad28 100644 --- a/yarn-project/cli/src/bin/index.ts +++ b/yarn-project/cli/src/bin/index.ts @@ -1,6 +1,8 @@ #!/usr/bin/env -S node --no-warnings import { createConsoleLogger, createDebugLogger } from '@aztec/foundation/log'; +import 'source-map-support/register.js'; + import { getProgram } from '../index.js'; const debugLogger = createDebugLogger('aztec:cli'); diff --git a/yarn-project/cli/src/index.ts b/yarn-project/cli/src/index.ts index aec3318dd3f..2027ae779ff 100644 --- a/yarn-project/cli/src/index.ts +++ b/yarn-project/cli/src/index.ts @@ -1,6 +1,9 @@ import { DebugLogger, LogFn } from '@aztec/foundation/log'; import { fileURLToPath } from '@aztec/foundation/url'; -import { addNoirCompilerCommanderActions } from '@aztec/noir-compiler/cli'; +import { + addGenerateNoirInterfaceCommanderAction, + addGenerateTypescriptCommanderAction, +} from '@aztec/noir-compiler/cli'; import { Command, Option } from 'commander'; import { lookup } from 'dns/promises'; @@ -490,7 +493,8 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { await update(projectPath, contract, rpcUrl, aztecVersion, log); }); - addNoirCompilerCommanderActions(program, log); + addGenerateTypescriptCommanderAction(program, log); + addGenerateNoirInterfaceCommanderAction(program, log); return program; } diff --git a/yarn-project/cli/src/utils.ts b/yarn-project/cli/src/utils.ts index 40867e8fbb0..5942460fc6f 100644 --- a/yarn-project/cli/src/utils.ts +++ b/yarn-project/cli/src/utils.ts @@ -90,9 +90,9 @@ export async function deployAztecContracts( * Gets all contracts available in \@aztec/noir-contracts. * @returns The contract ABIs. */ -export async function getExampleContractArtifacts() { - const artifacts: ArtifactsType = await import('@aztec/noir-contracts/artifacts'); - return artifacts; +export async function getExampleContractArtifacts(): Promise { + const imports: any = await import('@aztec/noir-contracts'); + return Object.fromEntries(Object.entries(imports).filter(([key]) => key.endsWith('Artifact'))) as any; } /** diff --git a/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts index 79038eb7021..45d27e5be80 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts @@ -1,6 +1,6 @@ import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node'; import { Fr, GrumpkinScalar, INITIAL_L2_BLOCK_NUM, elapsed, sleep } from '@aztec/aztec.js'; -import { BenchmarkingContract } from '@aztec/noir-contracts/types'; +import { BenchmarkingContract } from '@aztec/noir-contracts/Benchmarking'; import { SequencerClient } from '@aztec/sequencer-client'; import { BENCHMARK_HISTORY_BLOCK_SIZE, diff --git a/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts index 61b3359d250..3452687290c 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts @@ -1,6 +1,6 @@ import { AztecNodeService } from '@aztec/aztec-node'; import { Fr, GrumpkinScalar } from '@aztec/aztec.js'; -import { BenchmarkingContract } from '@aztec/noir-contracts/types'; +import { BenchmarkingContract } from '@aztec/noir-contracts/Benchmarking'; import { SequencerClient } from '@aztec/sequencer-client'; import { BENCHMARK_BLOCK_SIZES } from '@aztec/types/stats'; diff --git a/yarn-project/end-to-end/src/benchmarks/utils.ts b/yarn-project/end-to-end/src/benchmarks/utils.ts index 2a6c0a59655..616cf6b90d9 100644 --- a/yarn-project/end-to-end/src/benchmarks/utils.ts +++ b/yarn-project/end-to-end/src/benchmarks/utils.ts @@ -10,7 +10,7 @@ import { retryUntil, sleep, } from '@aztec/aztec.js'; -import { BenchmarkingContract } from '@aztec/noir-contracts/types'; +import { BenchmarkingContract } from '@aztec/noir-contracts/Benchmarking'; import { PXEService, createPXEService } from '@aztec/pxe'; import { mkdirpSync } from 'fs-extra'; diff --git a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts index 9543b801fdf..3a186cc178c 100644 --- a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts +++ b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts @@ -15,7 +15,7 @@ import { getUnsafeSchnorrAccount, retryUntil, } from '@aztec/aztec.js'; -import { ChildContract, TokenContract } from '@aztec/noir-contracts/types'; +import { ChildContract, TokenContract } from '@aztec/noir-contracts'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts index fcc6f9ea628..42999f59063 100644 --- a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts +++ b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts @@ -11,7 +11,7 @@ import { SingleKeyAccountContract, Wallet, } from '@aztec/aztec.js'; -import { ChildContract } from '@aztec/noir-contracts/types'; +import { ChildContract } from '@aztec/noir-contracts/Child'; import { randomBytes } from 'crypto'; diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract.test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract.test.ts index 1c1825c7d83..f5904fdce5b 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract.test.ts @@ -15,7 +15,7 @@ import { computeMessageSecretHash, } from '@aztec/aztec.js'; import { Pedersen, SparseTree, newTree } from '@aztec/merkle-tree'; -import { SlowTreeContract, TokenBlacklistContract, TokenContract } from '@aztec/noir-contracts/types'; +import { SlowTreeContract, TokenBlacklistContract, TokenContract } from '@aztec/noir-contracts'; import { jest } from '@jest/globals'; import levelup from 'levelup'; diff --git a/yarn-project/end-to-end/src/e2e_block_building.test.ts b/yarn-project/end-to-end/src/e2e_block_building.test.ts index caaac6a4804..699e634099e 100644 --- a/yarn-project/end-to-end/src/e2e_block_building.test.ts +++ b/yarn-project/end-to-end/src/e2e_block_building.test.ts @@ -13,8 +13,8 @@ import { isContractDeployed, } from '@aztec/aztec.js'; import { pedersenHash } from '@aztec/foundation/crypto'; -import { TestContractArtifact } from '@aztec/noir-contracts/artifacts'; -import { TestContract, TokenContract } from '@aztec/noir-contracts/types'; +import { TestContract, TestContractArtifact } from '@aztec/noir-contracts/Test'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import times from 'lodash.times'; diff --git a/yarn-project/end-to-end/src/e2e_card_game.test.ts b/yarn-project/end-to-end/src/e2e_card_game.test.ts index 3ba6082f7bc..ca254469a4d 100644 --- a/yarn-project/end-to-end/src/e2e_card_game.test.ts +++ b/yarn-project/end-to-end/src/e2e_card_game.test.ts @@ -7,7 +7,7 @@ import { deployInitialSandboxAccounts, getSandboxAccountsWallets, } from '@aztec/aztec.js'; -import { CardGameContract } from '@aztec/noir-contracts/types'; +import { CardGameContract } from '@aztec/noir-contracts/CardGame'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts index 6da6b9d5bc0..f83fd2cb22b 100644 --- a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts +++ b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts @@ -11,7 +11,7 @@ import { computeMessageSecretHash, } from '@aztec/aztec.js'; import { RollupAbi } from '@aztec/l1-artifacts'; -import { TestContract, TokenContract } from '@aztec/noir-contracts/types'; +import { TestContract, TokenContract } from '@aztec/noir-contracts'; import { Account, Chain, HttpTransport, PublicClient, WalletClient, getAddress, getContract, parseEther } from 'viem'; diff --git a/yarn-project/end-to-end/src/e2e_cross_chain_messaging.test.ts b/yarn-project/end-to-end/src/e2e_cross_chain_messaging.test.ts index c14fd6f8559..4f01c5b41e1 100644 --- a/yarn-project/end-to-end/src/e2e_cross_chain_messaging.test.ts +++ b/yarn-project/end-to-end/src/e2e_cross_chain_messaging.test.ts @@ -7,7 +7,7 @@ import { TxStatus, computeAuthWitMessageHash, } from '@aztec/aztec.js'; -import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts/types'; +import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts'; import { delay, setup } from './fixtures/utils.js'; import { CrossChainTestHarness } from './shared/cross_chain_test_harness.js'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts index dac1cbd909f..426ab8b4053 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts @@ -12,7 +12,8 @@ import { getContractDeploymentInfo, isContractDeployed, } from '@aztec/aztec.js'; -import { TestContractArtifact, TokenContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { TestContractArtifact } from '@aztec/noir-contracts/Test'; +import { TokenContractArtifact } from '@aztec/noir-contracts/Token'; import { SequencerClient } from '@aztec/sequencer-client'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts b/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts index 6e1361238bd..660cfd9b33a 100644 --- a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts @@ -16,8 +16,8 @@ import { generatePublicKey, getContractDeploymentInfo, } from '@aztec/aztec.js'; -import { EscrowContractArtifact } from '@aztec/noir-contracts/artifacts'; -import { EscrowContract, TokenContract } from '@aztec/noir-contracts/types'; +import { EscrowContract, EscrowContractArtifact } from '@aztec/noir-contracts/Escrow'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_inclusion_proofs_contract.test.ts b/yarn-project/end-to-end/src/e2e_inclusion_proofs_contract.test.ts index 9d5f750dc9a..a6f03ade521 100644 --- a/yarn-project/end-to-end/src/e2e_inclusion_proofs_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_inclusion_proofs_contract.test.ts @@ -11,7 +11,7 @@ import { } from '@aztec/aztec.js'; import { NewContractData } from '@aztec/circuits.js'; import { computeContractLeaf } from '@aztec/circuits.js/abis'; -import { InclusionProofsContract } from '@aztec/noir-contracts/types'; +import { InclusionProofsContract } from '@aztec/noir-contracts/InclusionProofs'; import { jest } from '@jest/globals'; import { type MemDown, default as memdown } from 'memdown'; diff --git a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts index 7c3f0ee627a..ad97dee72d2 100644 --- a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts @@ -11,7 +11,7 @@ import { computeAuthWitMessageHash, computeMessageSecretHash, } from '@aztec/aztec.js'; -import { LendingContract, PriceFeedContract, TokenContract } from '@aztec/noir-contracts/types'; +import { LendingContract, PriceFeedContract, TokenContract } from '@aztec/noir-contracts'; import { jest } from '@jest/globals'; @@ -89,7 +89,7 @@ describe('e2e_lending_contract', () => { lendingAccount = new LendingAccount(accounts[0].address, new Fr(42)); - // Also specified in `noir-contracts/src/contracts/lending_contract/src/main.nr` + // Also specified in `noir-contracts/contracts/lending_contract/src/main.nr` const rate = 1268391679n; lendingSim = new LendingSimulator( cc, diff --git a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts index 693d722eb30..a4e0f1ebfa7 100644 --- a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts +++ b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts @@ -15,7 +15,7 @@ import { getSandboxAccountsWallets, getSchnorrAccount, } from '@aztec/aztec.js'; -import { TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import { expectsNumOfEncryptedLogsInTheLastBlockToBe, setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_nested_contract.test.ts b/yarn-project/end-to-end/src/e2e_nested_contract.test.ts index 4d2b9c7209d..f1f4d29b3ae 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_nested_contract.test.ts @@ -1,6 +1,6 @@ import { AztecAddress, BatchCall, DebugLogger, Fr, PXE, Wallet, toBigIntBE } from '@aztec/aztec.js'; import { getTestData, isGenerateTestDataEnabled } from '@aztec/foundation/testing'; -import { ChildContract, ImportTestContract, ParentContract, TestContract } from '@aztec/noir-contracts/types'; +import { ChildContract, ImportTestContract, ParentContract, TestContract } from '@aztec/noir-contracts'; import { writeFileSync } from 'fs'; diff --git a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts index 64e987fba80..c1838f854d6 100644 --- a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts +++ b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts @@ -11,7 +11,7 @@ import { toBigInt, } from '@aztec/aztec.js'; import { siloNullifier } from '@aztec/circuits.js/abis'; -import { TestContract } from '@aztec/noir-contracts/types'; +import { TestContract } from '@aztec/noir-contracts/Test'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_ordering.test.ts b/yarn-project/end-to-end/src/e2e_ordering.test.ts index 452d17172d6..c7727867c76 100644 --- a/yarn-project/end-to-end/src/e2e_ordering.test.ts +++ b/yarn-project/end-to-end/src/e2e_ordering.test.ts @@ -1,6 +1,7 @@ // Test suite for testing proper ordering of side effects import { Fr, FunctionSelector, PXE, TxStatus, Wallet, toBigIntBE } from '@aztec/aztec.js'; -import { ChildContract, ParentContract } from '@aztec/noir-contracts/types'; +import { ChildContract } from '@aztec/noir-contracts/Child'; +import { ParentContract } from '@aztec/noir-contracts/Parent'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts index cf414d6df7f..5c2d746aa6a 100644 --- a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts @@ -13,7 +13,7 @@ import { getContractDeploymentInfo, isContractDeployed, } from '@aztec/aztec.js'; -import { TestContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { TestContractArtifact } from '@aztec/noir-contracts/Test'; import { BootstrapNode, P2PConfig, createLibP2PPeerId } from '@aztec/p2p'; import { ConstantKeyPair, PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe'; diff --git a/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts b/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts index 980ed63fb10..cb81ff66782 100644 --- a/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts @@ -1,5 +1,5 @@ import { AztecAddress, AztecNode, CompleteAddress, DebugLogger, Fr, TxStatus, Wallet } from '@aztec/aztec.js'; -import { PendingCommitmentsContract } from '@aztec/noir-contracts/types'; +import { PendingCommitmentsContract } from '@aztec/noir-contracts/PendingCommitments'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts b/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts index 2cad9e99629..a6975b6b0f8 100644 --- a/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts +++ b/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts @@ -8,7 +8,8 @@ import { computeAuthWitMessageHash, sleep, } from '@aztec/aztec.js'; -import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; +import { TokenBridgeContract } from '@aztec/noir-contracts/TokenBridge'; import { setup } from './fixtures/utils.js'; import { CrossChainTestHarness } from './shared/cross_chain_test_harness.js'; diff --git a/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts b/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts index 7961e042d5c..40df1a54182 100644 --- a/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts +++ b/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts @@ -12,7 +12,7 @@ import { getSchnorrAccount, waitForSandbox, } from '@aztec/aztec.js'; -import { TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import { format } from 'util'; diff --git a/yarn-project/end-to-end/src/e2e_slow_tree.test.ts b/yarn-project/end-to-end/src/e2e_slow_tree.test.ts index 87c267e5e82..6fc89230b02 100644 --- a/yarn-project/end-to-end/src/e2e_slow_tree.test.ts +++ b/yarn-project/end-to-end/src/e2e_slow_tree.test.ts @@ -1,7 +1,7 @@ /* eslint-disable camelcase */ import { CheatCodes, DebugLogger, Fr, Wallet } from '@aztec/aztec.js'; import { Pedersen, SparseTree, newTree } from '@aztec/merkle-tree'; -import { SlowTreeContract } from '@aztec/noir-contracts/types'; +import { SlowTreeContract } from '@aztec/noir-contracts/SlowTree'; import { default as levelup } from 'levelup'; import { type MemDown, default as memdown } from 'memdown'; diff --git a/yarn-project/end-to-end/src/e2e_token_contract.test.ts b/yarn-project/end-to-end/src/e2e_token_contract.test.ts index 95af7828e27..012bb273bed 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_token_contract.test.ts @@ -11,7 +11,7 @@ import { computeAuthWitMessageHash, computeMessageSecretHash, } from '@aztec/aztec.js'; -import { TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/guides/dapp_testing.test.ts b/yarn-project/end-to-end/src/guides/dapp_testing.test.ts index 2f0a34fd38b..5a5d5bda30a 100644 --- a/yarn-project/end-to-end/src/guides/dapp_testing.test.ts +++ b/yarn-project/end-to-end/src/guides/dapp_testing.test.ts @@ -12,7 +12,8 @@ import { getSandboxAccountsWallets, waitForSandbox, } from '@aztec/aztec.js'; -import { TestContract, TokenContract } from '@aztec/noir-contracts/types'; +import { TestContract } from '@aztec/noir-contracts/Test'; +import { TokenContract } from '@aztec/noir-contracts/Token'; const { PXE_URL = 'http://localhost:8080', ETHEREUM_HOST = 'http://localhost:8545' } = process.env; diff --git a/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts b/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts index ce67b832016..3889fac2c48 100644 --- a/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts +++ b/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts @@ -12,7 +12,8 @@ import { Schnorr, computeMessageSecretHash, } from '@aztec/aztec.js'; -import { SchnorrHardcodedAccountContractArtifact, TokenContract } from '@aztec/noir-contracts/types'; +import { SchnorrHardcodedAccountContractArtifact } from '@aztec/noir-contracts/SchnorrHardcodedAccount'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import { setup } from '../fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts b/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts index 9252a95e017..b546356c630 100644 --- a/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts +++ b/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts @@ -10,7 +10,7 @@ import { Wallet, computeMessageSecretHash, } from '@aztec/aztec.js'; -import { TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; import { open } from 'lmdb'; import { Chain, HttpTransport, PublicClient } from 'viem'; diff --git a/yarn-project/end-to-end/src/sample-dapp/contracts.mjs b/yarn-project/end-to-end/src/sample-dapp/contracts.mjs index 80edf95737a..bb02c811fb0 100644 --- a/yarn-project/end-to-end/src/sample-dapp/contracts.mjs +++ b/yarn-project/end-to-end/src/sample-dapp/contracts.mjs @@ -1,5 +1,5 @@ import { AztecAddress, Contract } from '@aztec/aztec.js'; -import { TokenContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { TokenContractArtifact } from '@aztec/noir-contracts/Token'; import { readFileSync } from 'fs'; diff --git a/yarn-project/end-to-end/src/sample-dapp/deploy.mjs b/yarn-project/end-to-end/src/sample-dapp/deploy.mjs index 8feacefb2d4..7b2dbeaa8c2 100644 --- a/yarn-project/end-to-end/src/sample-dapp/deploy.mjs +++ b/yarn-project/end-to-end/src/sample-dapp/deploy.mjs @@ -1,5 +1,5 @@ import { Contract, ContractDeployer, createPXEClient, getSandboxAccountsWallets } from '@aztec/aztec.js'; -import { TokenContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { TokenContractArtifact } from '@aztec/noir-contracts/Token'; import { writeFileSync } from 'fs'; import { fileURLToPath } from 'url'; diff --git a/yarn-project/end-to-end/src/sample-dapp/index.test.mjs b/yarn-project/end-to-end/src/sample-dapp/index.test.mjs index ad7282103da..7441e6ba7e6 100644 --- a/yarn-project/end-to-end/src/sample-dapp/index.test.mjs +++ b/yarn-project/end-to-end/src/sample-dapp/index.test.mjs @@ -9,7 +9,7 @@ import { createPXEClient, waitForSandbox, } from '@aztec/aztec.js'; -import { TokenContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { TokenContractArtifact } from '@aztec/noir-contracts/Token'; const { PXE_URL = 'http://localhost:8080', ETHEREUM_HOST = 'http://localhost:8545' } = process.env; diff --git a/yarn-project/end-to-end/src/shared/browser.ts b/yarn-project/end-to-end/src/shared/browser.ts index 0584ea9c222..4becaf5cd34 100644 --- a/yarn-project/end-to-end/src/shared/browser.ts +++ b/yarn-project/end-to-end/src/shared/browser.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ import * as AztecJs from '@aztec/aztec.js'; -import { TokenContractArtifact } from '@aztec/noir-contracts/artifacts'; +import { TokenContractArtifact } from '@aztec/noir-contracts/Token'; import { Server } from 'http'; import Koa from 'koa'; diff --git a/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts b/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts index 9bd5e60c296..5931be88bd5 100644 --- a/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts +++ b/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts @@ -21,7 +21,8 @@ import { TokenPortalAbi, TokenPortalBytecode, } from '@aztec/l1-artifacts'; -import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; +import { TokenBridgeContract } from '@aztec/noir-contracts/TokenBridge'; import { Account, Chain, HttpTransport, PublicClient, WalletClient, getContract, getFunctionSelector } from 'viem'; diff --git a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts index 1a1fcb33fc9..dc49414df4d 100644 --- a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts +++ b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts @@ -11,7 +11,7 @@ import { } from '@aztec/aztec.js'; import { deployL1Contract } from '@aztec/ethereum'; import { UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts'; -import { UniswapContract } from '@aztec/noir-contracts/types'; +import { UniswapContract } from '@aztec/noir-contracts/Uniswap'; import { jest } from '@jest/globals'; import { Chain, HttpTransport, PublicClient, getContract, parseEther } from 'viem'; diff --git a/yarn-project/end-to-end/src/simulators/lending_simulator.ts b/yarn-project/end-to-end/src/simulators/lending_simulator.ts index c5d6bdcf706..94abe466a4b 100644 --- a/yarn-project/end-to-end/src/simulators/lending_simulator.ts +++ b/yarn-project/end-to-end/src/simulators/lending_simulator.ts @@ -1,7 +1,7 @@ // Convenience struct to hold an account's address and secret that can easily be passed around. import { AztecAddress, CheatCodes, Fr } from '@aztec/aztec.js'; import { pedersenHash } from '@aztec/foundation/crypto'; -import { LendingContract } from '@aztec/noir-contracts/types'; +import { LendingContract } from '@aztec/noir-contracts/Lending'; import { TokenSimulator } from './token_simulator.js'; diff --git a/yarn-project/end-to-end/src/simulators/token_simulator.ts b/yarn-project/end-to-end/src/simulators/token_simulator.ts index 3701d02df5e..c1f9d81b73c 100644 --- a/yarn-project/end-to-end/src/simulators/token_simulator.ts +++ b/yarn-project/end-to-end/src/simulators/token_simulator.ts @@ -1,6 +1,6 @@ /* eslint-disable jsdoc/require-jsdoc */ import { AztecAddress, DebugLogger } from '@aztec/aztec.js'; -import { TokenContract } from '@aztec/noir-contracts/types'; +import { TokenContract } from '@aztec/noir-contracts/Token'; export class TokenSimulator { private balancesPrivate: Map = new Map(); diff --git a/yarn-project/foundation/src/abi/decoder.test.ts b/yarn-project/foundation/src/abi/decoder.test.ts index 827a2d94b93..ea8a853715c 100644 --- a/yarn-project/foundation/src/abi/decoder.test.ts +++ b/yarn-project/foundation/src/abi/decoder.test.ts @@ -2,7 +2,7 @@ import { ABIParameterVisibility, FunctionArtifact } from './abi.js'; import { decodeFunctionSignature, decodeFunctionSignatureWithParameterNames } from './decoder.js'; describe('abi/decoder', () => { - // Copied from yarn-project/noir-contracts/src/contracts/test_contract/target/Test.json + // Copied from yarn-project/noir-contracts/contracts/test_contract/target/Test.json const abi = { name: 'testCodeGen', parameters: [ diff --git a/yarn-project/key-store/tsconfig.json b/yarn-project/key-store/tsconfig.json index 76107a492b5..e934003361b 100644 --- a/yarn-project/key-store/tsconfig.json +++ b/yarn-project/key-store/tsconfig.json @@ -6,15 +6,15 @@ "tsBuildInfoFile": ".tsbuildinfo" }, "references": [ - { - "path": "../kv-store" - }, { "path": "../circuits.js" }, { "path": "../foundation" }, + { + "path": "../kv-store" + }, { "path": "../types" } diff --git a/yarn-project/noir-compiler/src/cli/add_noir_compiler_commander_actions.ts b/yarn-project/noir-compiler/src/cli/add_noir_compiler_commander_actions.ts index 31054b548b8..5f8fb49236d 100644 --- a/yarn-project/noir-compiler/src/cli/add_noir_compiler_commander_actions.ts +++ b/yarn-project/noir-compiler/src/cli/add_noir_compiler_commander_actions.ts @@ -1,6 +1,7 @@ import { LogFn } from '@aztec/foundation/log'; import { Command } from 'commander'; +import { dirname } from 'path'; /** * CLI options for configuring behavior @@ -20,6 +21,15 @@ interface Options { * */ export function addNoirCompilerCommanderActions(program: Command, log: LogFn = () => {}) { + // addCompileCommanderAction(program, log); + addGenerateTypescriptCommanderAction(program, log); + addGenerateNoirInterfaceCommanderAction(program, log); +} + +/** + * + */ +export function addCompileCommanderAction(program: Command, log: LogFn = () => {}) { program .command('compile') .argument('', 'Path to the bin or Aztec.nr project to compile') @@ -33,35 +43,35 @@ export function addNoirCompilerCommanderActions(program: Command, log: LogFn = ( const { compileNoir } = await import('./compile_noir.js'); await compileNoir(projectPath, options, log); }); +} +/** + * + */ +export function addGenerateTypescriptCommanderAction(program: Command, _: LogFn = () => {}) { program .command('generate-typescript') - .argument('', 'Path to the noir project') - .option('--artifacts ', 'Folder containing the compiled artifacts, relative to the project path', 'target') - .option( - '-o, --outdir ', - 'Output folder for the generated typescript interfaces, relative to the project path', - 'interfaces', - ) - .description('Generates typescript interfaces from the artifacts in the given project') - - .action(async (projectPath: string, options) => { + .argument('', 'Path to the Noir ABI or project dir.') + .option('-o, --outdir ', 'Output folder for the generated typescript.') + .option('-d, --debug', 'Include debug info.') + .description('Generates TypeScript interface from the given abi.') + .action(async (noirAbiPath: string, { debug, outdir }) => { const { generateTypescriptInterface } = await import('./generate_typescript_interface.js'); - await generateTypescriptInterface(projectPath, options, log); + generateTypescriptInterface(outdir || dirname(noirAbiPath), noirAbiPath, debug); }); +} +/** + * + */ +export function addGenerateNoirInterfaceCommanderAction(program: Command, _: LogFn = () => {}) { return program .command('generate-noir-interface') - .argument('', 'Path to the noir project') - .option('--artifacts ', 'Folder containing the compiled artifacts, relative to the project path', 'target') - .option( - '-o, --outdir ', - 'Output folder for the generated noir interfaces, relative to the project path', - 'interfaces', - ) + .argument('', 'Path to the Noir ABI or project dir.') + .option('-o, --outdir ', 'Output folder for the generated noir.') .description('Generates Noir interfaces from the artifacts in the given project') - .action(async (projectPath: string, options) => { + .action(async (noirAbiPath: string, { outdir }) => { const { generateNoirInterface } = await import('./generate_noir_interface.js'); - await generateNoirInterface(projectPath, options, log); + generateNoirInterface(outdir || dirname(noirAbiPath), noirAbiPath); }); } diff --git a/yarn-project/noir-compiler/src/cli/generate_noir_interface.ts b/yarn-project/noir-compiler/src/cli/generate_noir_interface.ts index 33f8926154a..268975ff034 100644 --- a/yarn-project/noir-compiler/src/cli/generate_noir_interface.ts +++ b/yarn-project/noir-compiler/src/cli/generate_noir_interface.ts @@ -1,47 +1,33 @@ -import { LogFn } from '@aztec/foundation/log'; +import { mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'fs'; +import path from 'path'; -import { mkdir, readFile, readdir, stat, writeFile } from 'fs/promises'; -import path, { resolve } from 'path'; - -import { generateNoirContractInterface } from '../index.js'; -import { isContractArtifact } from '../utils.js'; +import { generateContractArtifact } from '../contract-interface-gen/abi.js'; +import { generateNoirContractInterface } from '../contract-interface-gen/noir.js'; /** * */ -export async function generateNoirInterface( - projectPath: string, - options: { - // eslint-disable-next-line jsdoc/require-jsdoc - outdir: string; - // eslint-disable-next-line jsdoc/require-jsdoc - artifacts: string; - }, - log: LogFn, -) { - const { outdir, artifacts } = options; - if (typeof projectPath !== 'string') { - throw new Error(`Missing project path argument`); - } - const currentDir = process.cwd(); +export function generateNoirInterface(outputPath: string, fileOrDirPath: string) { + const stats = statSync(fileOrDirPath); - const artifactsDir = resolve(projectPath, artifacts); - for (const artifactsDirItem of await readdir(artifactsDir)) { - const artifactPath = resolve(artifactsDir, artifactsDirItem); - if ((await stat(artifactPath)).isFile() && artifactPath.endsWith('.json')) { - const contract = JSON.parse((await readFile(artifactPath)).toString()); - if (!isContractArtifact(contract)) { - continue; - } - const interfacePath = resolve(projectPath, outdir, `${contract.name}_interface.nr`); - log(`Writing ${contract.name} Noir external interface to ${path.relative(currentDir, interfacePath)}`); - try { - const noirInterface = generateNoirContractInterface(contract); - await mkdir(path.dirname(interfacePath), { recursive: true }); - await writeFile(interfacePath, noirInterface); - } catch (err) { - log(`Error generating interface for ${artifactPath}: ${err}`); - } + if (stats.isDirectory()) { + const files = readdirSync(fileOrDirPath).filter(file => file.endsWith('.json') && !file.startsWith('debug_')); + for (const file of files) { + const fullPath = path.join(fileOrDirPath, file); + generateNoirInterfaceFromNoirAbi(outputPath, fullPath); } + } else if (stats.isFile()) { + generateNoirInterfaceFromNoirAbi(outputPath, fileOrDirPath); } } + +/** + * + */ +export function generateNoirInterfaceFromNoirAbi(outputPath: string, noirAbiPath: string) { + const contract = JSON.parse(readFileSync(noirAbiPath, 'utf8')); + const aztecAbi = generateContractArtifact({ contract }); + const noirContract = generateNoirContractInterface(aztecAbi); + mkdirSync(outputPath, { recursive: true }); + writeFileSync(`${outputPath}/${aztecAbi.name}.nr`, noirContract); +} diff --git a/yarn-project/noir-compiler/src/cli/generate_typescript_interface.ts b/yarn-project/noir-compiler/src/cli/generate_typescript_interface.ts index b7f9f3e74c3..08da2c63d68 100644 --- a/yarn-project/noir-compiler/src/cli/generate_typescript_interface.ts +++ b/yarn-project/noir-compiler/src/cli/generate_typescript_interface.ts @@ -1,56 +1,46 @@ -import { LogFn } from '@aztec/foundation/log'; +import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'fs'; +import path from 'path'; -import { mkdir, readFile, readdir, stat, writeFile } from 'fs/promises'; -import path, { resolve } from 'path'; - -import { generateTypescriptContractInterface } from '../index.js'; -import { isContractArtifact } from '../utils.js'; +import { generateContractArtifact } from '../contract-interface-gen/abi.js'; +import { generateTypescriptContractInterface } from '../contract-interface-gen/contractTypescript.js'; /** - * Registers a 'typescript' command on the given commander program that generates typescript interface out of an ABI. - * @param program - Commander program. - * @param log - Optional logging function. - * @returns The program with the command registered. + * */ -export async function generateTypescriptInterface( - projectPath: string, - options: { - /* eslint-disable jsdoc/require-jsdoc */ - outdir: string; - /* eslint-disable jsdoc/require-jsdoc */ - artifacts: string; - }, - log: LogFn, -) { - const { outdir, artifacts } = options; - if (typeof projectPath !== 'string') { - throw new Error(`Missing project path argument`); - } - const currentDir = process.cwd(); +export function generateTypescriptInterface(outputPath: string, fileOrDirPath: string, includeDebug = false) { + const stats = statSync(fileOrDirPath); - const artifactsDir = resolve(projectPath, artifacts); - for (const artifactsDirItem of await readdir(artifactsDir)) { - const artifactPath = resolve(artifactsDir, artifactsDirItem); - if ((await stat(artifactPath)).isFile() && artifactPath.endsWith('.json')) { - const contract = JSON.parse((await readFile(artifactPath)).toString()); - if (!isContractArtifact(contract)) { - continue; - } - const tsPath = resolve(projectPath, outdir, `${contract.name}.ts`); - log(`Writing ${contract.name} typescript interface to ${path.relative(currentDir, tsPath)}`); - let relativeArtifactPath = path.relative(path.dirname(tsPath), artifactPath); - if (relativeArtifactPath === `${contract.name}.json`) { - // relative path edge case, prepending ./ for local import - the above logic just does - // `${contract.name}.json`, which is not a valid import for a file in the same directory - relativeArtifactPath = `./${contract.name}.json`; - } - try { - const tsWrapper = generateTypescriptContractInterface(contract, relativeArtifactPath); - await mkdir(path.dirname(tsPath), { recursive: true }); - await writeFile(tsPath, tsWrapper); - } catch (err) { - log(`Error generating interface for ${artifactPath}: ${err}`); - } + if (stats.isDirectory()) { + const files = readdirSync(fileOrDirPath).filter(file => file.endsWith('.json') && !file.startsWith('debug_')); + for (const file of files) { + const fullPath = path.join(fileOrDirPath, file); + generateTypescriptInterfaceFromNoirAbi(outputPath, fullPath, includeDebug); } + } else if (stats.isFile()) { + generateTypescriptInterfaceFromNoirAbi(outputPath, fileOrDirPath, includeDebug); } } + +/** + * + */ +function generateTypescriptInterfaceFromNoirAbi(outputPath: string, noirAbiPath: string, includeDebug: boolean) { + const contract = JSON.parse(readFileSync(noirAbiPath, 'utf8')); + const noirDebugPath = includeDebug ? getDebugFilePath(noirAbiPath) : undefined; + const debug = noirDebugPath ? JSON.parse(readFileSync(noirDebugPath, 'utf8')) : undefined; + const aztecAbi = generateContractArtifact({ contract, debug }); + const tsWrapper = generateTypescriptContractInterface(aztecAbi, `./${aztecAbi.name}.json`); + mkdirSync(outputPath, { recursive: true }); + writeFileSync(`${outputPath}/${aztecAbi.name}.ts`, tsWrapper); + writeFileSync(`${outputPath}/${aztecAbi.name}.json`, JSON.stringify(aztecAbi, undefined, 2)); +} + +/** + * + */ +function getDebugFilePath(filePath: string) { + const dirname = path.dirname(filePath); + const basename = path.basename(filePath); + const result = path.join(dirname, 'debug_' + basename); + return existsSync(result) ? result : undefined; +} diff --git a/yarn-project/noir-compiler/src/cli/index.ts b/yarn-project/noir-compiler/src/cli/index.ts index df1ae3d0880..4868340b60d 100644 --- a/yarn-project/noir-compiler/src/cli/index.ts +++ b/yarn-project/noir-compiler/src/cli/index.ts @@ -1 +1 @@ -export { addNoirCompilerCommanderActions } from './add_noir_compiler_commander_actions.js'; +export * from './add_noir_compiler_commander_actions.js'; diff --git a/yarn-project/noir-compiler/src/contract-interface-gen/abi.ts b/yarn-project/noir-compiler/src/contract-interface-gen/abi.ts index 8ff3a43bd29..47473cdefa8 100644 --- a/yarn-project/noir-compiler/src/contract-interface-gen/abi.ts +++ b/yarn-project/noir-compiler/src/contract-interface-gen/abi.ts @@ -1,4 +1,4 @@ -import { FUNCTION_TREE_HEIGHT } from '@aztec/circuits.js'; +import { FUNCTION_TREE_HEIGHT } from '@aztec/circuits.js/constants'; import { ContractArtifact, DebugMetadata, FunctionArtifact, FunctionType } from '@aztec/foundation/abi'; import { deflate } from 'pako'; diff --git a/yarn-project/noir-contracts/.gitignore b/yarn-project/noir-contracts/.gitignore index 983cade75af..bfb0e3cb9b9 100644 --- a/yarn-project/noir-contracts/.gitignore +++ b/yarn-project/noir-contracts/.gitignore @@ -1,6 +1,2 @@ -artifacts/ target/ -proofs/ -/src/types/ -Prover.toml -Verifier.toml \ No newline at end of file +src/ diff --git a/yarn-project/noir-contracts/.prettierignore b/yarn-project/noir-contracts/.prettierignore deleted file mode 100644 index d14508ac19a..00000000000 --- a/yarn-project/noir-contracts/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -src/artifacts -src/contracts diff --git a/yarn-project/noir-contracts/Nargo.toml b/yarn-project/noir-contracts/Nargo.toml index 609d4c37959..cd96b50eeb2 100644 --- a/yarn-project/noir-contracts/Nargo.toml +++ b/yarn-project/noir-contracts/Nargo.toml @@ -1,28 +1,28 @@ [workspace] members = [ - "src/contracts/benchmarking_contract", - "src/contracts/card_game_contract", - "src/contracts/child_contract", - "src/contracts/counter_contract", - "src/contracts/docs_example_contract", - "src/contracts/easy_private_token_contract", - "src/contracts/easy_private_voting_contract", - "src/contracts/ecdsa_account_contract", - "src/contracts/escrow_contract", - "src/contracts/import_test_contract", - "src/contracts/inclusion_proofs_contract", - "src/contracts/lending_contract", - "src/contracts/parent_contract", - "src/contracts/pending_commitments_contract", - "src/contracts/price_feed_contract", - "src/contracts/schnorr_account_contract", - "src/contracts/schnorr_hardcoded_account_contract", - "src/contracts/schnorr_single_key_account_contract", - "src/contracts/slow_tree_contract", - "src/contracts/stateful_test_contract", - "src/contracts/test_contract", - "src/contracts/token_contract", - "src/contracts/token_blacklist_contract", - "src/contracts/token_bridge_contract", - "src/contracts/uniswap_contract", + "contracts/benchmarking_contract", + "contracts/card_game_contract", + "contracts/child_contract", + "contracts/counter_contract", + "contracts/docs_example_contract", + "contracts/easy_private_token_contract", + "contracts/easy_private_voting_contract", + "contracts/ecdsa_account_contract", + "contracts/escrow_contract", + "contracts/import_test_contract", + "contracts/inclusion_proofs_contract", + "contracts/lending_contract", + "contracts/parent_contract", + "contracts/pending_commitments_contract", + "contracts/price_feed_contract", + "contracts/schnorr_account_contract", + "contracts/schnorr_hardcoded_account_contract", + "contracts/schnorr_single_key_account_contract", + "contracts/slow_tree_contract", + "contracts/stateful_test_contract", + "contracts/test_contract", + "contracts/token_contract", + "contracts/token_blacklist_contract", + "contracts/token_bridge_contract", + "contracts/uniswap_contract", ] diff --git a/yarn-project/noir-contracts/contracts/benchmarking_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/benchmarking_contract/Nargo.toml new file mode 100644 index 00000000000..c7c751b7c6e --- /dev/null +++ b/yarn-project/noir-contracts/contracts/benchmarking_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "benchmarking_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/benchmarking_contract/src/main.nr b/yarn-project/noir-contracts/contracts/benchmarking_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/benchmarking_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/benchmarking_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/card_game_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/card_game_contract/Nargo.toml new file mode 100644 index 00000000000..af822821e2f --- /dev/null +++ b/yarn-project/noir-contracts/contracts/card_game_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "card_game_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note"} +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/card_game_contract/src/cards.nr b/yarn-project/noir-contracts/contracts/card_game_contract/src/cards.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/card_game_contract/src/cards.nr rename to yarn-project/noir-contracts/contracts/card_game_contract/src/cards.nr diff --git a/yarn-project/noir-contracts/src/contracts/card_game_contract/src/game.nr b/yarn-project/noir-contracts/contracts/card_game_contract/src/game.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/card_game_contract/src/game.nr rename to yarn-project/noir-contracts/contracts/card_game_contract/src/game.nr diff --git a/yarn-project/noir-contracts/src/contracts/card_game_contract/src/main.nr b/yarn-project/noir-contracts/contracts/card_game_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/card_game_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/card_game_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/child_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/child_contract/Nargo.toml new file mode 100644 index 00000000000..007e868a485 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/child_contract/Nargo.toml @@ -0,0 +1,9 @@ +[package] +name = "child_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/child_contract/src/main.nr b/yarn-project/noir-contracts/contracts/child_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/child_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/child_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/counter_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/counter_contract/Nargo.toml new file mode 100644 index 00000000000..b0e31e855ad --- /dev/null +++ b/yarn-project/noir-contracts/contracts/counter_contract/Nargo.toml @@ -0,0 +1,11 @@ +[package] +name = "counter_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note" } +easy_private_state = { path = "../../../aztec-nr/easy-private-state"} +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr b/yarn-project/noir-contracts/contracts/counter_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/counter_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/docs_example_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/docs_example_contract/Nargo.toml new file mode 100644 index 00000000000..f6f38543c43 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/docs_example_contract/Nargo.toml @@ -0,0 +1,9 @@ +[package] +name = "docs_example_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/account_contract_interface.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/account_contract_interface.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/account_contract_interface.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/account_contract_interface.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/actions.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/actions.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/actions.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/options.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/options.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/options.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/types.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/types.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/card_note.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/card_note.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/profile_note.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/types/profile_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/profile_note.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/types/profile_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/queen.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/types/queen.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/queen.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/types/queen.nr diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/rules_note.nr b/yarn-project/noir-contracts/contracts/docs_example_contract/src/types/rules_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/docs_example_contract/src/types/rules_note.nr rename to yarn-project/noir-contracts/contracts/docs_example_contract/src/types/rules_note.nr diff --git a/yarn-project/noir-contracts/contracts/easy_private_token_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/easy_private_token_contract/Nargo.toml new file mode 100644 index 00000000000..6e0cb1a8064 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/easy_private_token_contract/Nargo.toml @@ -0,0 +1,11 @@ +[package] +name = "easy_private_token_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note"} +easy_private_state = { path = "../../../aztec-nr/easy-private-state"} +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/easy_private_token_contract/src/main.nr b/yarn-project/noir-contracts/contracts/easy_private_token_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/easy_private_token_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/easy_private_token_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/easy_private_voting_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/easy_private_voting_contract/Nargo.toml new file mode 100644 index 00000000000..eb6543e6be7 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/easy_private_voting_contract/Nargo.toml @@ -0,0 +1,9 @@ +[package] +name = "easy_private_voting_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr b/yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/easy_private_voting_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/ecdsa_account_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/ecdsa_account_contract/Nargo.toml new file mode 100644 index 00000000000..0893f3d6b56 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/ecdsa_account_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "ecdsa_account_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +authwit = { path = "../../../aztec-nr/authwit" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr b/yarn-project/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr rename to yarn-project/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/src/main.nr b/yarn-project/noir-contracts/contracts/ecdsa_account_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/ecdsa_account_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/escrow_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/escrow_contract/Nargo.toml new file mode 100644 index 00000000000..f3b1251bff9 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/escrow_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "escrow_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +address_note = { path = "../../../aztec-nr/address-note"} +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/escrow_contract/src/main.nr b/yarn-project/noir-contracts/contracts/escrow_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/escrow_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/escrow_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/import_test_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/import_test_contract/Nargo.toml new file mode 100644 index 00000000000..4de350b8f20 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/import_test_contract/Nargo.toml @@ -0,0 +1,9 @@ +[package] +name = "import_test_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/import_test_contract/src/main.nr b/yarn-project/noir-contracts/contracts/import_test_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/import_test_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/import_test_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/import_test_contract/src/test_contract_interface.nr b/yarn-project/noir-contracts/contracts/import_test_contract/src/test_contract_interface.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/import_test_contract/src/test_contract_interface.nr rename to yarn-project/noir-contracts/contracts/import_test_contract/src/test_contract_interface.nr diff --git a/yarn-project/noir-contracts/contracts/inclusion_proofs_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/inclusion_proofs_contract/Nargo.toml new file mode 100644 index 00000000000..470903576ca --- /dev/null +++ b/yarn-project/noir-contracts/contracts/inclusion_proofs_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "inclusion_proofs_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/src/main.nr b/yarn-project/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/lending_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/lending_contract/Nargo.toml new file mode 100644 index 00000000000..6cd91f3fdbc --- /dev/null +++ b/yarn-project/noir-contracts/contracts/lending_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "lending_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +safe_math = { path = "../../../aztec-nr/safe-math" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/src/asset.nr b/yarn-project/noir-contracts/contracts/lending_contract/src/asset.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/lending_contract/src/asset.nr rename to yarn-project/noir-contracts/contracts/lending_contract/src/asset.nr diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/src/helpers.nr b/yarn-project/noir-contracts/contracts/lending_contract/src/helpers.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/lending_contract/src/helpers.nr rename to yarn-project/noir-contracts/contracts/lending_contract/src/helpers.nr diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/src/interest_math.nr b/yarn-project/noir-contracts/contracts/lending_contract/src/interest_math.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/lending_contract/src/interest_math.nr rename to yarn-project/noir-contracts/contracts/lending_contract/src/interest_math.nr diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/src/interfaces.nr b/yarn-project/noir-contracts/contracts/lending_contract/src/interfaces.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/lending_contract/src/interfaces.nr rename to yarn-project/noir-contracts/contracts/lending_contract/src/interfaces.nr diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/src/main.nr b/yarn-project/noir-contracts/contracts/lending_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/lending_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/lending_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/parent_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/parent_contract/Nargo.toml new file mode 100644 index 00000000000..d76d2eb3471 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/parent_contract/Nargo.toml @@ -0,0 +1,9 @@ +[package] +name = "parent_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/parent_contract/src/main.nr b/yarn-project/noir-contracts/contracts/parent_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/parent_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/parent_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/pending_commitments_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/pending_commitments_contract/Nargo.toml new file mode 100644 index 00000000000..61f8d0dc7fa --- /dev/null +++ b/yarn-project/noir-contracts/contracts/pending_commitments_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "pending_commitments_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note"} +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/src/main.nr b/yarn-project/noir-contracts/contracts/pending_commitments_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/pending_commitments_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/pending_commitments_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/price_feed_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/price_feed_contract/Nargo.toml new file mode 100644 index 00000000000..95b4055a8ea --- /dev/null +++ b/yarn-project/noir-contracts/contracts/price_feed_contract/Nargo.toml @@ -0,0 +1,9 @@ +[package] +name = "price_feed_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/price_feed_contract/src/asset.nr b/yarn-project/noir-contracts/contracts/price_feed_contract/src/asset.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/price_feed_contract/src/asset.nr rename to yarn-project/noir-contracts/contracts/price_feed_contract/src/asset.nr diff --git a/yarn-project/noir-contracts/src/contracts/price_feed_contract/src/main.nr b/yarn-project/noir-contracts/contracts/price_feed_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/price_feed_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/price_feed_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/schnorr_account_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/schnorr_account_contract/Nargo.toml new file mode 100644 index 00000000000..91c398753ef --- /dev/null +++ b/yarn-project/noir-contracts/contracts/schnorr_account_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "schnorr_account_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +authwit = { path = "../../../aztec-nr/authwit" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/main.nr b/yarn-project/noir-contracts/contracts/schnorr_account_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/schnorr_account_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/public_key_note.nr b/yarn-project/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/schnorr_account_contract/src/public_key_note.nr rename to yarn-project/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_hardcoded_account_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/schnorr_hardcoded_account_contract/Nargo.toml similarity index 57% rename from yarn-project/noir-contracts/src/contracts/schnorr_hardcoded_account_contract/Nargo.toml rename to yarn-project/noir-contracts/contracts/schnorr_hardcoded_account_contract/Nargo.toml index d4afff933df..f8ec19a65a3 100644 --- a/yarn-project/noir-contracts/src/contracts/schnorr_hardcoded_account_contract/Nargo.toml +++ b/yarn-project/noir-contracts/contracts/schnorr_hardcoded_account_contract/Nargo.toml @@ -5,5 +5,5 @@ compiler_version = ">=0.18.0" type = "contract" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -authwit = { path = "../../../../aztec-nr/authwit" } \ No newline at end of file +aztec = { path = "../../../aztec-nr/aztec" } +authwit = { path = "../../../aztec-nr/authwit" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_hardcoded_account_contract/src/main.nr b/yarn-project/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/schnorr_hardcoded_account_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/Nargo.toml new file mode 100644 index 00000000000..c8864dad5f5 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "schnorr_single_key_account_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +authwit = { path = "../../../aztec-nr/authwit" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/src/auth_oracle.nr b/yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/src/auth_oracle.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/src/auth_oracle.nr rename to yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/src/auth_oracle.nr diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/src/main.nr b/yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/src/util.nr b/yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/src/util.nr rename to yarn-project/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr diff --git a/yarn-project/noir-contracts/contracts/slow_tree_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/slow_tree_contract/Nargo.toml new file mode 100644 index 00000000000..dc4118019ed --- /dev/null +++ b/yarn-project/noir-contracts/contracts/slow_tree_contract/Nargo.toml @@ -0,0 +1,11 @@ +[package] +name = "slow_tree_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note"} +slow_updates_tree = { path = "../../../aztec-nr/slow-updates-tree"} +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/slow_tree_contract/src/capsule.nr b/yarn-project/noir-contracts/contracts/slow_tree_contract/src/capsule.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/slow_tree_contract/src/capsule.nr rename to yarn-project/noir-contracts/contracts/slow_tree_contract/src/capsule.nr diff --git a/yarn-project/noir-contracts/src/contracts/slow_tree_contract/src/main.nr b/yarn-project/noir-contracts/contracts/slow_tree_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/slow_tree_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/slow_tree_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/slow_tree_contract/src/types.nr b/yarn-project/noir-contracts/contracts/slow_tree_contract/src/types.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/slow_tree_contract/src/types.nr rename to yarn-project/noir-contracts/contracts/slow_tree_contract/src/types.nr diff --git a/yarn-project/noir-contracts/contracts/stateful_test_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/stateful_test_contract/Nargo.toml new file mode 100644 index 00000000000..1a46f682f62 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/stateful_test_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "stateful_test_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +value_note = { path = "../../../aztec-nr/value-note"} +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/stateful_test_contract/src/main.nr b/yarn-project/noir-contracts/contracts/stateful_test_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/stateful_test_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/stateful_test_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/test_contract/Nargo.toml similarity index 50% rename from yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml rename to yarn-project/noir-contracts/contracts/test_contract/Nargo.toml index cc97a1ddeee..48eea69c7d7 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/Nargo.toml +++ b/yarn-project/noir-contracts/contracts/test_contract/Nargo.toml @@ -5,7 +5,7 @@ compiler_version = ">=0.18.0" type = "contract" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -field_note = { path = "../../../../aztec-nr/field-note" } +aztec = { path = "../../../aztec-nr/aztec" } +field_note = { path = "../../../aztec-nr/field-note" } token_portal_content_hash_lib = { path = "../token_portal_content_hash_lib" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr b/yarn-project/noir-contracts/contracts/test_contract/src/interface.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr rename to yarn-project/noir-contracts/contracts/test_contract/src/interface.nr index 9ff10a75a23..40d6de7b70a 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr +++ b/yarn-project/noir-contracts/contracts/test_contract/src/interface.nr @@ -8,26 +8,6 @@ use dep::protocol_types::{ constants::RETURN_VALUES_LENGTH, }; -struct CancellerConsumeMintPrivateMessageStruct { - inner: Field, -} - -struct ToConsumeMintPublicMessageStruct { - inner: Field, -} - -struct CancellerConsumeMintPublicMessageStruct { - inner: Field, -} - -struct AztecAddressGetPortalContractAddressStruct { - inner: Field, -} - -struct AddressGetPublicKeyStruct { - inner: Field, -} - struct AStructTestCodeGenStruct { amount: Field, secret_hash: Field, @@ -50,6 +30,26 @@ struct ManyNotesADeepStructTestCodeGenStruct { secret_hash: Field, } +struct AddressGetPublicKeyStruct { + inner: Field, +} + +struct AztecAddressGetPortalContractAddressStruct { + inner: Field, +} + +struct CancellerConsumeMintPrivateMessageStruct { + inner: Field, +} + +struct ToConsumeMintPublicMessageStruct { + inner: Field, +} + +struct CancellerConsumeMintPublicMessageStruct { + inner: Field, +} + // Interface for calling Test functions from a private context struct TestPrivateContextInterface { @@ -63,57 +63,48 @@ impl TestPrivateContextInterface { } } - pub fn consume_mint_private_message( + pub fn test_code_gen( self, context: &mut PrivateContext, - secret_hash_for_redeeming_minted_notes: Field, - amount: Field, - canceller: CancellerConsumeMintPrivateMessageStruct, - msg_key: Field, - secret_for_L1_to_L2_message_consumption: Field + a_field: Field, + a_bool: bool, + a_number: u32, + an_array: [Field;2], + a_struct: AStructTestCodeGenStruct, + a_deep_struct: ADeepStructTestCodeGenStruct ) -> [Field; RETURN_VALUES_LENGTH] { - let mut serialized_args = [0; 5]; - serialized_args[0] = secret_hash_for_redeeming_minted_notes; - serialized_args[1] = amount; - serialized_args[2] = canceller.inner; - serialized_args[3] = msg_key; - serialized_args[4] = secret_for_L1_to_L2_message_consumption; - - context.call_private_function(self.address, FunctionSelector::from_field(0x260712c7), serialized_args) - } - - - pub fn consume_mint_public_message( - self, - context: &mut PrivateContext, - to: ToConsumeMintPublicMessageStruct, - amount: Field, - canceller: CancellerConsumeMintPublicMessageStruct, - msg_key: Field, - secret: Field - ) { - let mut serialized_args = [0; 5]; - serialized_args[0] = to.inner; - serialized_args[1] = amount; - serialized_args[2] = canceller.inner; - serialized_args[3] = msg_key; - serialized_args[4] = secret; + let mut serialized_args = [0; 17]; + serialized_args[0] = a_field; + serialized_args[1] = a_bool as Field; + serialized_args[2] = a_number as Field; + serialized_args[3] = an_array[0]; + serialized_args[4] = an_array[1]; + serialized_args[5] = a_struct.amount; + serialized_args[6] = a_struct.secret_hash; + serialized_args[7] = a_deep_struct.a_field; + serialized_args[8] = a_deep_struct.a_bool as Field; + serialized_args[9] = a_deep_struct.a_note.amount; + serialized_args[10] = a_deep_struct.a_note.secret_hash; + serialized_args[11] = a_deep_struct.many_notes[0].amount; + serialized_args[12] = a_deep_struct.many_notes[0].secret_hash; + serialized_args[13] = a_deep_struct.many_notes[1].amount; + serialized_args[14] = a_deep_struct.many_notes[1].secret_hash; + serialized_args[15] = a_deep_struct.many_notes[2].amount; + serialized_args[16] = a_deep_struct.many_notes[2].secret_hash; - context.call_public_function(self.address, FunctionSelector::from_field(0x04ee3bb0), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0x0f054f9b), serialized_args) } - pub fn create_l2_to_l1_message_public( + pub fn get_public_key( self, context: &mut PrivateContext, - amount: Field, - secret_hash: Field - ) { - let mut serialized_args = [0; 2]; - serialized_args[0] = amount; - serialized_args[1] = secret_hash; + address: AddressGetPublicKeyStruct + ) -> [Field; RETURN_VALUES_LENGTH] { + let mut serialized_args = [0; 1]; + serialized_args[0] = address.inner; - context.call_public_function(self.address, FunctionSelector::from_field(0x9749ca06), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0x501e4f48), serialized_args) } @@ -141,15 +132,15 @@ impl TestPrivateContextInterface { } - pub fn emit_nullifier( + pub fn get_portal_contract_address( self, context: &mut PrivateContext, - nullifier: Field + aztec_address: AztecAddressGetPortalContractAddressStruct ) -> [Field; RETURN_VALUES_LENGTH] { let mut serialized_args = [0; 1]; - serialized_args[0] = nullifier; + serialized_args[0] = aztec_address.inner; - context.call_private_function(self.address, FunctionSelector::from_field(0x82a8b183), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0x30e5344b), serialized_args) } @@ -165,47 +156,23 @@ impl TestPrivateContextInterface { } - pub fn get_portal_contract_address( - self, - context: &mut PrivateContext, - aztec_address: AztecAddressGetPortalContractAddressStruct - ) -> [Field; RETURN_VALUES_LENGTH] { - let mut serialized_args = [0; 1]; - serialized_args[0] = aztec_address.inner; - - context.call_private_function(self.address, FunctionSelector::from_field(0x30e5344b), serialized_args) - } - - - pub fn get_public_key( - self, - context: &mut PrivateContext, - address: AddressGetPublicKeyStruct - ) -> [Field; RETURN_VALUES_LENGTH] { - let mut serialized_args = [0; 1]; - serialized_args[0] = address.inner; - - context.call_private_function(self.address, FunctionSelector::from_field(0x501e4f48), serialized_args) - } - - - pub fn get_this_address( + pub fn get_this_portal_address( self, context: &mut PrivateContext ) -> [Field; RETURN_VALUES_LENGTH] { let mut serialized_args = [0; 0]; - context.call_private_function(self.address, FunctionSelector::from_field(0x95a7b2ae), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0xc71384f5), serialized_args) } - pub fn get_this_portal_address( + pub fn get_this_address( self, context: &mut PrivateContext ) -> [Field; RETURN_VALUES_LENGTH] { let mut serialized_args = [0; 0]; - context.call_private_function(self.address, FunctionSelector::from_field(0xc71384f5), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0x95a7b2ae), serialized_args) } @@ -221,76 +188,61 @@ impl TestPrivateContextInterface { } - pub fn set_constant( + pub fn consume_mint_private_message( self, context: &mut PrivateContext, - value: Field + secret_hash_for_redeeming_minted_notes: Field, + amount: Field, + canceller: CancellerConsumeMintPrivateMessageStruct, + msg_key: Field, + secret_for_L1_to_L2_message_consumption: Field ) -> [Field; RETURN_VALUES_LENGTH] { - let mut serialized_args = [0; 1]; - serialized_args[0] = value; + let mut serialized_args = [0; 5]; + serialized_args[0] = secret_hash_for_redeeming_minted_notes; + serialized_args[1] = amount; + serialized_args[2] = canceller.inner; + serialized_args[3] = msg_key; + serialized_args[4] = secret_for_L1_to_L2_message_consumption; - context.call_private_function(self.address, FunctionSelector::from_field(0x1b3b9e18), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0x260712c7), serialized_args) } - pub fn test_code_gen( + pub fn emit_nullifier( self, context: &mut PrivateContext, - a_field: Field, - a_bool: bool, - a_number: u32, - an_array: [Field;2], - a_struct: AStructTestCodeGenStruct, - a_deep_struct: ADeepStructTestCodeGenStruct + nullifier: Field ) -> [Field; RETURN_VALUES_LENGTH] { - let mut serialized_args = [0; 17]; - serialized_args[0] = a_field; - serialized_args[1] = a_bool as Field; - serialized_args[2] = a_number as Field; - serialized_args[3] = an_array[0]; - serialized_args[4] = an_array[1]; - serialized_args[5] = a_struct.amount; - serialized_args[6] = a_struct.secret_hash; - serialized_args[7] = a_deep_struct.a_field; - serialized_args[8] = a_deep_struct.a_bool as Field; - serialized_args[9] = a_deep_struct.a_note.amount; - serialized_args[10] = a_deep_struct.a_note.secret_hash; - serialized_args[11] = a_deep_struct.many_notes[0].amount; - serialized_args[12] = a_deep_struct.many_notes[0].secret_hash; - serialized_args[13] = a_deep_struct.many_notes[1].amount; - serialized_args[14] = a_deep_struct.many_notes[1].secret_hash; - serialized_args[15] = a_deep_struct.many_notes[2].amount; - serialized_args[16] = a_deep_struct.many_notes[2].secret_hash; + let mut serialized_args = [0; 1]; + serialized_args[0] = nullifier; - context.call_private_function(self.address, FunctionSelector::from_field(0x0f054f9b), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0x82a8b183), serialized_args) } -} - - - -// Interface for calling Test functions from a public context -struct TestPublicContextInterface { - address: AztecAddress, -} + pub fn create_l2_to_l1_message_public( + self, + context: &mut PrivateContext, + amount: Field, + secret_hash: Field + ) { + let mut serialized_args = [0; 2]; + serialized_args[0] = amount; + serialized_args[1] = secret_hash; -impl TestPublicContextInterface { - pub fn at(address: AztecAddress) -> Self { - Self { - address, - } + context.call_public_function(self.address, FunctionSelector::from_field(0x9749ca06), serialized_args) } + pub fn consume_mint_public_message( self, - context: PublicContext, + context: &mut PrivateContext, to: ToConsumeMintPublicMessageStruct, amount: Field, canceller: CancellerConsumeMintPublicMessageStruct, msg_key: Field, secret: Field - ) -> [Field; RETURN_VALUES_LENGTH] { + ) { let mut serialized_args = [0; 5]; serialized_args[0] = to.inner; serialized_args[1] = amount; @@ -302,20 +254,34 @@ impl TestPublicContextInterface { } - pub fn create_l2_to_l1_message_public( + pub fn set_constant( self, - context: PublicContext, - amount: Field, - secret_hash: Field + context: &mut PrivateContext, + value: Field ) -> [Field; RETURN_VALUES_LENGTH] { - let mut serialized_args = [0; 2]; - serialized_args[0] = amount; - serialized_args[1] = secret_hash; + let mut serialized_args = [0; 1]; + serialized_args[0] = value; - context.call_public_function(self.address, FunctionSelector::from_field(0x9749ca06), serialized_args) + context.call_private_function(self.address, FunctionSelector::from_field(0x1b3b9e18), serialized_args) } +} + + + + +// Interface for calling Test functions from a public context +struct TestPublicContextInterface { + address: AztecAddress, +} +impl TestPublicContextInterface { + pub fn at(address: AztecAddress) -> Self { + Self { + address, + } + } + pub fn create_nullifier_public( self, context: PublicContext, @@ -353,6 +319,40 @@ impl TestPublicContextInterface { context.call_public_function(self.address, FunctionSelector::from_field(0x61fa2bda), serialized_args) } + + pub fn create_l2_to_l1_message_public( + self, + context: PublicContext, + amount: Field, + secret_hash: Field + ) -> [Field; RETURN_VALUES_LENGTH] { + let mut serialized_args = [0; 2]; + serialized_args[0] = amount; + serialized_args[1] = secret_hash; + + context.call_public_function(self.address, FunctionSelector::from_field(0x9749ca06), serialized_args) + } + + + pub fn consume_mint_public_message( + self, + context: PublicContext, + to: ToConsumeMintPublicMessageStruct, + amount: Field, + canceller: CancellerConsumeMintPublicMessageStruct, + msg_key: Field, + secret: Field + ) -> [Field; RETURN_VALUES_LENGTH] { + let mut serialized_args = [0; 5]; + serialized_args[0] = to.inner; + serialized_args[1] = amount; + serialized_args[2] = canceller.inner; + serialized_args[3] = msg_key; + serialized_args[4] = secret; + + context.call_public_function(self.address, FunctionSelector::from_field(0x04ee3bb0), serialized_args) + } + } diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr b/yarn-project/noir-contracts/contracts/test_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/test_contract/src/main.nr diff --git a/yarn-project/noir-contracts/contracts/token_blacklist_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/token_blacklist_contract/Nargo.toml new file mode 100644 index 00000000000..7b157482941 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/token_blacklist_contract/Nargo.toml @@ -0,0 +1,12 @@ +[package] +name = "token_blacklist_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +safe_math = { path = "../../../aztec-nr/safe-math" } +field_note = { path = "../../../aztec-nr/field-note" } +authwit = { path = "../../../aztec-nr/authwit" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/interfaces.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/interfaces.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/interfaces.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/interfaces.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balance_set.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/balance_set.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balance_set.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/balance_set.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balances_map.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/balances_map.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/roles.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/roles.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/safe_u120_serialization.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/safe_u120_serialization.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/safe_u120_serialization.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/safe_u120_serialization.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/token_note.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/token_note.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/transparent_note.nr b/yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_blacklist_contract/src/types/transparent_note.nr rename to yarn-project/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_bridge_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/token_bridge_contract/Nargo.toml similarity index 60% rename from yarn-project/noir-contracts/src/contracts/token_bridge_contract/Nargo.toml rename to yarn-project/noir-contracts/contracts/token_bridge_contract/Nargo.toml index 5c2f4106919..3e3658c42b6 100644 --- a/yarn-project/noir-contracts/src/contracts/token_bridge_contract/Nargo.toml +++ b/yarn-project/noir-contracts/contracts/token_bridge_contract/Nargo.toml @@ -5,6 +5,6 @@ compiler_version = ">=0.18.0" type = "contract" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } +aztec = { path = "../../../aztec-nr/aztec" } token_portal_content_hash_lib = { path = "../token_portal_content_hash_lib" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr b/yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/token_bridge_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/token_interface.nr b/yarn-project/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_bridge_contract/src/token_interface.nr rename to yarn-project/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr diff --git a/yarn-project/noir-contracts/contracts/token_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/token_contract/Nargo.toml new file mode 100644 index 00000000000..5b53b775456 --- /dev/null +++ b/yarn-project/noir-contracts/contracts/token_contract/Nargo.toml @@ -0,0 +1,11 @@ +[package] +name = "token_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +safe_math = { path = "../../../aztec-nr/safe-math" } +authwit = { path = "../../../aztec-nr/authwit" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr b/yarn-project/noir-contracts/contracts/token_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/token_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types.nr b/yarn-project/noir-contracts/contracts/token_contract/src/types.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_contract/src/types.nr rename to yarn-project/noir-contracts/contracts/token_contract/src/types.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/balance_set.nr b/yarn-project/noir-contracts/contracts/token_contract/src/types/balance_set.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_contract/src/types/balance_set.nr rename to yarn-project/noir-contracts/contracts/token_contract/src/types/balance_set.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/balances_map.nr b/yarn-project/noir-contracts/contracts/token_contract/src/types/balances_map.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_contract/src/types/balances_map.nr rename to yarn-project/noir-contracts/contracts/token_contract/src/types/balances_map.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/safe_u120_serialization.nr b/yarn-project/noir-contracts/contracts/token_contract/src/types/safe_u120_serialization.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_contract/src/types/safe_u120_serialization.nr rename to yarn-project/noir-contracts/contracts/token_contract/src/types/safe_u120_serialization.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/token_note.nr b/yarn-project/noir-contracts/contracts/token_contract/src/types/token_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_contract/src/types/token_note.nr rename to yarn-project/noir-contracts/contracts/token_contract/src/types/token_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/src/types/transparent_note.nr b/yarn-project/noir-contracts/contracts/token_contract/src/types/transparent_note.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_contract/src/types/transparent_note.nr rename to yarn-project/noir-contracts/contracts/token_contract/src/types/transparent_note.nr diff --git a/yarn-project/noir-contracts/src/contracts/token_portal_content_hash_lib/Nargo.toml b/yarn-project/noir-contracts/contracts/token_portal_content_hash_lib/Nargo.toml similarity index 50% rename from yarn-project/noir-contracts/src/contracts/token_portal_content_hash_lib/Nargo.toml rename to yarn-project/noir-contracts/contracts/token_portal_content_hash_lib/Nargo.toml index f3aa0548013..951be3ceac2 100644 --- a/yarn-project/noir-contracts/src/contracts/token_portal_content_hash_lib/Nargo.toml +++ b/yarn-project/noir-contracts/contracts/token_portal_content_hash_lib/Nargo.toml @@ -5,5 +5,5 @@ compiler_version = ">=0.18.0" type = "lib" [dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file +aztec = { path = "../../../aztec-nr/aztec" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_portal_content_hash_lib/src/lib.nr b/yarn-project/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/token_portal_content_hash_lib/src/lib.nr rename to yarn-project/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr diff --git a/yarn-project/noir-contracts/contracts/uniswap_contract/Nargo.toml b/yarn-project/noir-contracts/contracts/uniswap_contract/Nargo.toml new file mode 100644 index 00000000000..b711a082a7f --- /dev/null +++ b/yarn-project/noir-contracts/contracts/uniswap_contract/Nargo.toml @@ -0,0 +1,10 @@ +[package] +name = "uniswap_contract" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } +authwit = { path = "../../../aztec-nr/authwit" } +protocol_types = { path = "../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/uniswap_contract/src/interfaces.nr b/yarn-project/noir-contracts/contracts/uniswap_contract/src/interfaces.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/uniswap_contract/src/interfaces.nr rename to yarn-project/noir-contracts/contracts/uniswap_contract/src/interfaces.nr diff --git a/yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr b/yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/uniswap_contract/src/main.nr rename to yarn-project/noir-contracts/contracts/uniswap_contract/src/main.nr diff --git a/yarn-project/noir-contracts/src/contracts/uniswap_contract/src/util.nr b/yarn-project/noir-contracts/contracts/uniswap_contract/src/util.nr similarity index 100% rename from yarn-project/noir-contracts/src/contracts/uniswap_contract/src/util.nr rename to yarn-project/noir-contracts/contracts/uniswap_contract/src/util.nr diff --git a/yarn-project/noir-contracts/package.json b/yarn-project/noir-contracts/package.json index 445a0087198..cd81311cf34 100644 --- a/yarn-project/noir-contracts/package.json +++ b/yarn-project/noir-contracts/package.json @@ -3,23 +3,21 @@ "version": "0.1.0", "type": "module", "exports": { - "./artifacts": "./dest/artifacts/index.js", - "./types": "./dest/types/index.js" + ".": "./dest/index.js", + "./*": "./dest/*.js" }, "scripts": { - "build": "yarn clean && tsc -b", + "build": "yarn clean && yarn build:contracts && tsc -b", "build:dev": "tsc -b --watch", - "clean": "rm -rf ./dest .tsbuildinfo", + "clean": "rm -rf ./dest .tsbuildinfo ./src ./target", "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests", - "noir:clean": "rm -rf ./src/artifacts ./src/types ../aztec.js/src/account_contract/artifacts ./target/ && mkdir -p ../aztec.js/src/account_contract/artifacts", - "noir:build": "./src/scripts/compile.sh", - "noir:build:all": "yarn noir:clean && ./scripts/compile_all.sh && ./scripts/types_all.sh", - "noir:types:all": "./scripts/types_all.sh" + "build:contracts": "./scripts/compile.sh && ./scripts/generate-types.sh" }, "inherits": [ - "../package.common.json" + "../package.common.json", + "./package.local.json" ], "jest": { "preset": "ts-jest/presets/default-esm", @@ -31,23 +29,12 @@ }, "dependencies": { "@aztec/aztec.js": "workspace:^", - "@aztec/foundation": "workspace:^", - "lodash.omit": "^4.5.0", "tslib": "^2.4.0" }, "devDependencies": { - "@aztec/noir-compiler": "workspace:^", "@jest/globals": "^29.5.0", "@types/jest": "^29.5.0", - "@types/lodash.camelcase": "^4.3.7", - "@types/lodash.omit": "^4.5.7", - "@types/lodash.snakecase": "^4.1.7", - "@types/lodash.upperfirst": "^4.3.7", - "@types/node": "^18.7.23", "jest": "^29.5.0", - "lodash.camelcase": "^4.3.0", - "lodash.snakecase": "^4.1.1", - "lodash.upperfirst": "^4.3.1", "ts-jest": "^29.1.0", "ts-node": "^10.9.1", "typescript": "^5.0.4" diff --git a/yarn-project/noir-contracts/package.local.json b/yarn-project/noir-contracts/package.local.json new file mode 100644 index 00000000000..6fb912b0da8 --- /dev/null +++ b/yarn-project/noir-contracts/package.local.json @@ -0,0 +1,7 @@ +{ + "scripts": { + "build": "yarn clean && yarn build:contracts && tsc -b", + "build:contracts": "./scripts/compile.sh && ./scripts/generate-types.sh", + "clean": "rm -rf ./dest .tsbuildinfo ./src ./target" + } +} diff --git a/yarn-project/noir-contracts/scripts/catch.sh b/yarn-project/noir-contracts/scripts/catch.sh deleted file mode 100644 index 87b485eb3f3..00000000000 --- a/yarn-project/noir-contracts/scripts/catch.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -# Handler for SIGCHLD, cleanup if child exit with error, used by nargo_test.sh and compile.sh -handle_sigchld() { - for pid in "${pids[@]}"; do - # If process is no longer running - if ! kill -0 "$pid" 2>/dev/null; then - # Wait for the process and get exit status - wait "$pid" - status=$? - - # If exit status is error - if [ $status -ne 0 ]; then - # Create error file - touch "$error_file" - fi - fi - done -} \ No newline at end of file diff --git a/yarn-project/noir-contracts/scripts/compile.sh b/yarn-project/noir-contracts/scripts/compile.sh index 055485220e0..214e441409b 100755 --- a/yarn-project/noir-contracts/scripts/compile.sh +++ b/yarn-project/noir-contracts/scripts/compile.sh @@ -1,22 +1,6 @@ #!/usr/bin/env bash +# TODO: Move this compilation phase out of yarn-project to own job, and ingest abis. +set -euo pipefail -set -euo pipefail; - -# Compiles Aztec.nr contracts in parallel, bubbling any compilation errors - -export self_dir=$(dirname "$(realpath $0)") -export COMPILER="$self_dir/../../noir-compiler/dest/cli.js" - -build() { - CONTRACT_NAME=$1 - CONTRACT_FOLDER="$self_dir/../src/contracts/${CONTRACT_NAME}_contract" - echo "Compiling $CONTRACT_NAME..." - rm -rf ${CONTRACT_FOLDER}/target - - node --no-warnings "$COMPILER" compile "$CONTRACT_FOLDER" -} - -export -f build - -# run 4 builds at a time -echo "$@" | xargs -n 1 -P $(nproc) bash -c 'build "$0"' +echo "Compiling contracts..." +../../noir/target/release/nargo compile --silence-warnings diff --git a/yarn-project/noir-contracts/scripts/compile_all.sh b/yarn-project/noir-contracts/scripts/compile_all.sh deleted file mode 100755 index 7445dbbc854..00000000000 --- a/yarn-project/noir-contracts/scripts/compile_all.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -echo "Compiling all contracts" -./scripts/compile.sh $(./scripts/get_all_contracts.sh) diff --git a/yarn-project/noir-contracts/scripts/generate-types.sh b/yarn-project/noir-contracts/scripts/generate-types.sh new file mode 100755 index 00000000000..a2e0b64b1fa --- /dev/null +++ b/yarn-project/noir-contracts/scripts/generate-types.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +OUT_DIR="./src" +INDEX="$OUT_DIR/index.ts" + +rm -rf $OUT_DIR && mkdir -p $OUT_DIR + +# Generate index.ts header. +echo "// Auto generated module - do not edit!\n" > $INDEX + +for ABI in $(find target -maxdepth 1 -type f ! -name 'debug_*' -name '*.json'); do + CONTRACT=$(jq -r .name $ABI) + DEBUG_INFO="$(dirname $ABI)/debug_$(basename $ABI)" + + echo "Creating types for $CONTRACT in $ABI..." + node --no-warnings ../noir-compiler/dest/cli.js generate-typescript -o $OUT_DIR -d $ABI + + # Add contract import/export to index.ts. + echo "export * from './${CONTRACT}.js';" >> $INDEX +done + +echo "Formatting..." +yarn formatting:fix diff --git a/yarn-project/noir-contracts/scripts/get_all_contracts.sh b/yarn-project/noir-contracts/scripts/get_all_contracts.sh deleted file mode 100755 index 1311a4862a4..00000000000 --- a/yarn-project/noir-contracts/scripts/get_all_contracts.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -# Utility to get the names of all contracts -echo $(ls -d src/contracts/*_contract/Nargo.toml | sed -r "s/src\\/contracts\\/(.+)_contract\\/Nargo.toml/\\1/") \ No newline at end of file diff --git a/yarn-project/noir-contracts/scripts/get_all_libraries.sh b/yarn-project/noir-contracts/scripts/get_all_libraries.sh deleted file mode 100755 index 8fbe7bb1b19..00000000000 --- a/yarn-project/noir-contracts/scripts/get_all_libraries.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -# Utility to get the names of all noir libraries located in ../aztec-nr -echo $(ls -d ../aztec-nr/*/Nargo.toml | sed -r "s/..\\/aztec-nr\\/(.+)\\/Nargo.toml/\\1/") \ No newline at end of file diff --git a/yarn-project/noir-contracts/scripts/install_noir.sh b/yarn-project/noir-contracts/scripts/install_noir.sh deleted file mode 100755 index b1105d6ad46..00000000000 --- a/yarn-project/noir-contracts/scripts/install_noir.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# Script to install noirup and the latest aztec nargo -set -eu - -VERSION="${VERSION:-$(jq -r '.tag' ../noir-compiler/src/noir-version.json)}" - -# Install nargo -noirup -v $VERSION diff --git a/yarn-project/noir-contracts/scripts/install_noirup.sh b/yarn-project/noir-contracts/scripts/install_noirup.sh deleted file mode 100755 index 025237333cd..00000000000 --- a/yarn-project/noir-contracts/scripts/install_noirup.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# Script to install noirup and the latest nargo -set -eu - -SPECIFIED_HOME=${1:-$HOME} - -export NARGO_HOME="$SPECIFIED_HOME/.nargo" -NARGO_BIN_DIR="$NARGO_HOME/bin" -BIN_URL="https://raw.githubusercontent.com/noir-lang/noirup/master/noirup" -BIN_PATH="$NARGO_BIN_DIR/noirup" -NARGO_MAN_DIR="$NARGO_HOME/share/man/man1" - -# Clean -rm -rf $NARGO_HOME - -# Install noirup. -mkdir -p $NARGO_BIN_DIR -mkdir -p $NARGO_MAN_DIR - -curl -# -Ls $BIN_URL -o $BIN_PATH -chmod +x $BIN_PATH -export PATH=$NARGO_BIN_DIR:$PATH diff --git a/yarn-project/noir-contracts/scripts/nargo_check.sh b/yarn-project/noir-contracts/scripts/nargo_check.sh deleted file mode 100644 index 45209d4ee43..00000000000 --- a/yarn-project/noir-contracts/scripts/nargo_check.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# Check nargo version matches the expected one -nargo_check() { - echo "Using $(nargo --version)" - EXPECTED_VERSION=$(jq -r '.commit' ../noir-compiler/src/noir-version.json) - FOUND_VERSION=$(nargo --version | grep -o 'git version hash: [0-9a-f]*' | cut -d' ' -f4) - if [ "$EXPECTED_VERSION" != "$FOUND_VERSION" ]; then - echo "Expected nargo version $EXPECTED_VERSION but found version $FOUND_VERSION. Aborting." - - # Get the directory of the script and the parent directory, where its meant to be run - SCRIPT_DIR="$(dirname "$(realpath "$0")")" - PARENT_DIR="$(dirname "$SCRIPT_DIR")" - - # bootstrap.sh calls this non-interactively, so we can't just ask for confirmation to autorun this script. - echo "To fix the version issue, you can run the following command:" - echo "cd $PARENT_DIR && scripts/install_noir.sh" - exit 1 - fi -} diff --git a/yarn-project/noir-contracts/scripts/nargo_test.sh b/yarn-project/noir-contracts/scripts/nargo_test.sh deleted file mode 100755 index 0666714388d..00000000000 --- a/yarn-project/noir-contracts/scripts/nargo_test.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash - -# Tests noir contracts, if multiple are provided, then they are testing in parallel, bubbling any testing errors -# -# Usage: -# If testing a single contract: -# ./scripts/test.sh CONTRACT -# If testing multiple contracts: -# ./scripts/test.sh CONTRACT ... -# If testing a library: -# ./scripts/test.sh LIB -# If testing multiple libraries: -# ./scripts/test.sh LIB ... - -source ./scripts/catch.sh - -ROOT=$(pwd) - -# Get the project type from the first argument -PROJECT_TYPE=$1 -shift - -# Error flag file -error_file="/tmp/error.$$" -# Array of child PIDs -pids=() - -# Set SIGCHLD handler -trap handle_sigchld SIGCHLD # Trap any ERR signal and call the custom error handler - -test() { - PROJECT_NAME=$1 - - if [ "$PROJECT_TYPE" == "CONTRACT" ]; then - CONTRACT_FOLDER="${PROJECT_NAME}_contract" - echo "Testing contract $PROJECT_NAME..." - cd src/contracts/$CONTRACT_FOLDER - nargo test --package ${PROJECT_NAME}_contract - else - echo "Testing library $PROJECT_NAME..." - cd ../aztec-nr/$PROJECT_NAME - nargo test - fi -} - -echo "Using $(nargo --version)" - -# Build contracts -for PROJECT_NAME in "$@"; do - test $PROJECT_NAME & - pids+=($!) -done - -# Wait for all background processes to finish -wait - -# If error file exists, exit with error -if [ -f "$error_file" ]; then - rm "$error_file" - echo "Error occurred in one or more child processes. Exiting..." - exit 1 -fi diff --git a/yarn-project/noir-contracts/scripts/nargo_test_ci.sh b/yarn-project/noir-contracts/scripts/nargo_test_ci.sh deleted file mode 100755 index d835f972324..00000000000 --- a/yarn-project/noir-contracts/scripts/nargo_test_ci.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Runs tests scripts for all contracts, then for all libraries. -./scripts/nargo_test.sh CONTRACT $(./scripts/get_all_contracts.sh) -./scripts/nargo_test.sh LIB $(./scripts/get_all_libraries.sh) \ No newline at end of file diff --git a/yarn-project/noir-contracts/scripts/transform_json_abi.sh b/yarn-project/noir-contracts/scripts/transform_json_abi.sh new file mode 100755 index 00000000000..bc27163ee6f --- /dev/null +++ b/yarn-project/noir-contracts/scripts/transform_json_abi.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Sadly, yarn-project expects ABI files in a format different to what is output from nargo. +# This provides a tool to quickly do the transform with jq. +# It's not currently used as the transform is done in TypeScript when we generate the contract wrapper. +# TODO: Why don't our contract classes just work with noir abis? +# +# Lowercase function_type value. +# Camel case function_type and is_internal. +# Discard first parameter (input) if function is not unconstrained. +# Hoist parameters out of abi. +# Hoist return_type out of abi, make an array of 1 element, or empty array if function is secret. +# +jq ' + .functions |= map( + (.functionType = (.function_type | ascii_downcase)) | + (.isInternal = .is_internal) | + del(.function_type, .is_internal) | + (.parameters = if .functionType == "unconstrained" then .abi.parameters else .abi.parameters[1:] end) | + (.returnTypes = if .functionType == "secret" then [] else [ .abi.return_type.abi_type ] end) | + del(.abi) + ) +' $1 diff --git a/yarn-project/noir-contracts/scripts/types.sh b/yarn-project/noir-contracts/scripts/types.sh deleted file mode 100755 index 16c85577397..00000000000 --- a/yarn-project/noir-contracts/scripts/types.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env bash - -# Example: -# - this script will automatically be run when running `yarn noir:build` -# - it exists on its own to allow ci to compile and format in different contexts, as the noir compiler is not available in yarn project base ( by choice ) -# - you can run `yarn noir:types:all` to create all noir artifacts and types consumed by aztec packages. - -# Enable strict mode: -# Exit on error (set -e), treat unset variables as an error (set -u), -set -eu - -artifacts_dir="src/artifacts" -types_dir="src/types" - -# Create output directories -mkdir -p $types_dir -mkdir -p $artifacts_dir - -ROOT=$(pwd) - -write_import() { - CONTRACT_NAME=$1 - NAME=$(echo $CONTRACT_NAME | perl -pe 's/(^|_)(\w)/\U$2/g') - - echo "import ${NAME}Json from './${CONTRACT_NAME}_contract.json' assert { type: 'json' };" >>"$artifacts_dir/index.ts" -} - -write_export() { - CONTRACT_NAME=$1 - NAME=$(echo $CONTRACT_NAME | perl -pe 's/(^|_)(\w)/\U$2/g') - - # artifacts - echo "export const ${NAME}ContractArtifact = ${NAME}Json as ContractArtifact;" >>"$artifacts_dir/index.ts" - echo "Written typescript for $NAME" - - # types - echo "export * from './${CONTRACT_NAME}.js';" >>"$types_dir/index.ts" -} - -process() { - CONTRACT=$1 - - cd $ROOT - node --no-warnings --loader ts-node/esm src/scripts/copy_source.ts $CONTRACT_NAME - - echo "Creating types for $CONTRACT" - node --no-warnings --loader ts-node/esm src/scripts/copy_output.ts $CONTRACT_NAME -} - -format() { - echo "Formatting contract folders" - yarn run -T prettier -w ../aztec.js/src/account_contract/artifacts/*.json ./$types_dir/*.ts - echo -e "Done\n" -} - -# Make type files -for CONTRACT_NAME in "$@"; do - process $CONTRACT_NAME & -done - -# Wait for all background processes to finish -wait - -# Write the index ts stuff -# Remove the output file -rm -f $artifacts_dir/index.ts || true - -# Generate artifacts package index.ts -echo "// Auto generated module\n" >"$artifacts_dir/index.ts" -echo "import { ContractArtifact } from '@aztec/foundation/abi';" >>"$artifacts_dir/index.ts" - -# Generate types package index.ts -echo "// Auto generated module\n" >"$types_dir/index.ts" -for CONTRACT_NAME in "$@"; do - write_import $CONTRACT_NAME - write_export $CONTRACT_NAME -done - -# only run the rest when the full flag is set -format diff --git a/yarn-project/noir-contracts/scripts/types_all.sh b/yarn-project/noir-contracts/scripts/types_all.sh deleted file mode 100755 index 38081dc6efe..00000000000 --- a/yarn-project/noir-contracts/scripts/types_all.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -# Run the types script for all files -./scripts/types.sh $(./scripts/get_all_contracts.sh) diff --git a/yarn-project/noir-contracts/src/contracts/benchmarking_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/benchmarking_contract/Nargo.toml deleted file mode 100644 index 79a4fd9b875..00000000000 --- a/yarn-project/noir-contracts/src/contracts/benchmarking_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "benchmarking_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml deleted file mode 100644 index 32e7ab21040..00000000000 --- a/yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "card_game_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note"} -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/child_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/child_contract/Nargo.toml deleted file mode 100644 index 49678bc6a4d..00000000000 --- a/yarn-project/noir-contracts/src/contracts/child_contract/Nargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "child_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/counter_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/counter_contract/Nargo.toml deleted file mode 100644 index 23cb537fb80..00000000000 --- a/yarn-project/noir-contracts/src/contracts/counter_contract/Nargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "counter_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note" } -easy_private_state = { path = "../../../../aztec-nr/easy-private-state"} -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/docs_example_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/docs_example_contract/Nargo.toml deleted file mode 100644 index 5eccd21c042..00000000000 --- a/yarn-project/noir-contracts/src/contracts/docs_example_contract/Nargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "docs_example_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/easy_private_token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/easy_private_token_contract/Nargo.toml deleted file mode 100644 index 5feca12855d..00000000000 --- a/yarn-project/noir-contracts/src/contracts/easy_private_token_contract/Nargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "easy_private_token_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note"} -easy_private_state = { path = "../../../../aztec-nr/easy-private-state"} -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/Nargo.toml deleted file mode 100644 index 2e29971c5dc..00000000000 --- a/yarn-project/noir-contracts/src/contracts/easy_private_voting_contract/Nargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "easy_private_voting_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/Nargo.toml deleted file mode 100644 index 51ec4df865c..00000000000 --- a/yarn-project/noir-contracts/src/contracts/ecdsa_account_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "ecdsa_account_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -authwit = { path = "../../../../aztec-nr/authwit" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/escrow_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/escrow_contract/Nargo.toml deleted file mode 100644 index a78a27d1949..00000000000 --- a/yarn-project/noir-contracts/src/contracts/escrow_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "escrow_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -address_note = { path = "../../../../aztec-nr/address-note"} -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/import_test_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/import_test_contract/Nargo.toml deleted file mode 100644 index 9ef152ea1f6..00000000000 --- a/yarn-project/noir-contracts/src/contracts/import_test_contract/Nargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "import_test_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/Nargo.toml deleted file mode 100644 index 3f884034998..00000000000 --- a/yarn-project/noir-contracts/src/contracts/inclusion_proofs_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "inclusion_proofs_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml deleted file mode 100644 index ef3e9d65340..00000000000 --- a/yarn-project/noir-contracts/src/contracts/lending_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "lending_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -safe_math = { path = "../../../../aztec-nr/safe-math" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/parent_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/parent_contract/Nargo.toml deleted file mode 100644 index a17390a872f..00000000000 --- a/yarn-project/noir-contracts/src/contracts/parent_contract/Nargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "parent_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/Nargo.toml deleted file mode 100644 index 0cec95291e7..00000000000 --- a/yarn-project/noir-contracts/src/contracts/pending_commitments_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "pending_commitments_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note"} -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/price_feed_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/price_feed_contract/Nargo.toml deleted file mode 100644 index 53cac2aa68d..00000000000 --- a/yarn-project/noir-contracts/src/contracts/price_feed_contract/Nargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "price_feed_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_account_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/schnorr_account_contract/Nargo.toml deleted file mode 100644 index 456836c53b3..00000000000 --- a/yarn-project/noir-contracts/src/contracts/schnorr_account_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "schnorr_account_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -authwit = { path = "../../../../aztec-nr/authwit" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/Nargo.toml deleted file mode 100644 index b821d34c282..00000000000 --- a/yarn-project/noir-contracts/src/contracts/schnorr_single_key_account_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "schnorr_single_key_account_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -authwit = { path = "../../../../aztec-nr/authwit" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/slow_tree_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/slow_tree_contract/Nargo.toml deleted file mode 100644 index c211d2ac2c3..00000000000 --- a/yarn-project/noir-contracts/src/contracts/slow_tree_contract/Nargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "slow_tree_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note"} -slow_updates_tree = { path = "../../../../aztec-nr/slow-updates-tree"} -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/stateful_test_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/stateful_test_contract/Nargo.toml deleted file mode 100644 index 20f806b0511..00000000000 --- a/yarn-project/noir-contracts/src/contracts/stateful_test_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "stateful_test_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -value_note = { path = "../../../../aztec-nr/value-note"} -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/Nargo.toml deleted file mode 100644 index 15cff362a4b..00000000000 --- a/yarn-project/noir-contracts/src/contracts/token_blacklist_contract/Nargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "token_blacklist_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -safe_math = { path = "../../../../aztec-nr/safe-math" } -field_note = { path = "../../../../aztec-nr/field-note" } -authwit = { path = "../../../../aztec-nr/authwit" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/token_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/token_contract/Nargo.toml deleted file mode 100644 index 4fc1814f588..00000000000 --- a/yarn-project/noir-contracts/src/contracts/token_contract/Nargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "token_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -safe_math = { path = "../../../../aztec-nr/safe-math" } -authwit = { path = "../../../../aztec-nr/authwit" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/contracts/uniswap_contract/Nargo.toml b/yarn-project/noir-contracts/src/contracts/uniswap_contract/Nargo.toml deleted file mode 100644 index 46728c85fd4..00000000000 --- a/yarn-project/noir-contracts/src/contracts/uniswap_contract/Nargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "uniswap_contract" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -aztec = { path = "../../../../aztec-nr/aztec" } -authwit = { path = "../../../../aztec-nr/authwit" } -protocol_types = { path = "../../../../noir-protocol-circuits/src/crates/types" } diff --git a/yarn-project/noir-contracts/src/examples/escrow_contract.json b/yarn-project/noir-contracts/src/examples/escrow_contract.json deleted file mode 100644 index e9b10a61395..00000000000 --- a/yarn-project/noir-contracts/src/examples/escrow_contract.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "Escrow", - "functions": [ - { - "name": "constructor", - "functionType": "secret", - "parameters": [ - { - "name": "owner", - "type": { - "kind": "field" - }, - "visibility": "public" - } - ], - "returnTypes": [], - "bytecode": "H4sIAAAAAAAA/+2c93MTRxzFF7mASULovZje4dQsiWqKY8cEx4HQq4UlMMUGI5KQSkjvvZJC6iT/ZCb34u/BWaPAD/dO4zfjnbl5J2FWn8/u3d7qbkd/O+fuuJEywd8S/tZo+8HrpqrXzbYfLsHrdsu015bJlHKpUjKd7PNShWI+62WyxbZ8Mp/M5rP9qXw6Xcpn8rlCsZDzCslMupQsZwvpsjdSpofq8iKWODlniHDOFOGcJcI5W4RzjgjnXBHOeSKc80U4F4hwLhThXCTCuViEc4kIZ6sI51IRzmUinMtFOFeIcK4U4VwlwrlahHONCOdaEc51IpzrRTg3iHBuFOHcJMK5WYTTI3KCDfcYW62+af72j79Nt5xhOdNyluVsyzmWcy3nWc63XGC50HKR5WLLJZatlkstl1kut1xhudJyleVqyzWWay3XWa633GC50XKT5WZLL/R3SX9LudGF3Ydpp3GsZUQ4syKcbSKcORHOvAhnQYRziwjnVhHObSKc20U4d4hw7hThbBfh3OX4c96pVh/me5j7pS0zllnLNsucZd6yYLnFcqvlNsvtljssd1q2W+5y9+ecu/1tj6v9vL9We3rRSnKa47ZnUPaG9hstE6H3GiybY3ByVZ9T3Y5TarxH/fA4OmlvDPV2ON6JGZd3B7+PvHqdXAkXz8n1RGh//OSKWGfCGpRdb6cb2ycXvDv5fXTvQO0w5k7LLle/q1qXi+fEezK0P37iRayzyxqUXW+3G9snHry7+X10bzobHJDBLdyEJco+f3vKjS7sKfp+YltVO+03l30hpx5/e7rq72qVdiJT4iFt6EUr1Gl5XIxxzW56Q/uTLVvc/cF1Qui96n5odvT+TjWF6m0J1R98NgbeSW7kfEMZHKoMlG/uGS71VUr9PUOVUliu1lUjERJrqHoPH9hU9X/D4sG/TXSh0T/OEdWLWOo1Beh18Rydz4T2x6cAEevstQZl13vAje0pALwP8PsoFtZuY2VPE/5y/EscSgOZkzmdPEjsF2b71WtQJvqPGpSfDe2PD8oR6zxoDcqu95Ab24MyvA/x++iBj0O8aIXepv/HGbXuw3Vqz6icR0Q4j4pwHhPhPC7CeUKE86QI5ykyZxyT754YvE+L9M8ZEc6zIpx9IpxFEc5zIpz9IpwlEc6yCOd5Ec4LIpwDIpwXRTgviXBeFuG8IsI5KMI5JMJ5VYTzmgjnsAjndRHOigjnjZg4E1WcXrTy3xoUlvNzIs4JovPzIs4NROcXRJwbic43RZybiM4vijg3E51fEnHeTXR+WcT5MNH5FRHnI0TnV0WcjxKdXxNxPkZ0viXifJzo/LqI8wmi820R55NE5zdEnE8Rnd8UcT5NdH5LxPkM0fltEeezROd3RJz7iM7vijgXic7viTifIzq/L+LcT3T+QMS5RHT+UMS5THT+SMT5PNH5YxHnC0TnT0ScB4jOn4o4XyQ6fybifIno/LmI82Wi8xcizleIzl+KOA8Snb8ScR4iOn8t4nyV6PyNiPM1ovO3Is7DROfvRJyvE52/F3GuEJ3viDjfIDr/IOI8kej8o4jzJKLzTyLOLUTnn0WcJxOd74o4P0J0/kXE+VGi868izo8RnX8TcZ5CdP5dxPlxovMfIs5Tic5/Ep2D37ALfuMQ64+xHjf4DTzMpTC3wLUW1x6MxRibcK7i2EVfwg31BL+Mg/XlWG+N9cdYj4v1qVivifWLWM+H9W1Y73XL37Ae6La/Yb0I1k9gPQGer+N5M56/4nkkns/heRWe3+B5Bu7v43437v/ifijuD+J+Ge4f4X4K7i/g+za+f+L7GL6fYL6O+Svmc5jf4Hp/199wPcD4iPEC5w+OJ7Tvvx2I82izfQAA", - "verificationKey": "0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f" - }, - { - "name": "withdraw", - "functionType": "secret", - "parameters": [ - { - "name": "token", - "type": { - "kind": "field" - }, - "visibility": "public" - }, - { - "name": "amount", - "type": { - "kind": "field" - }, - "visibility": "public" - }, - { - "name": "recipient", - "type": { - "kind": "field" - }, - "visibility": "public" - } - ], - "returnTypes": [], - "bytecode": "H4sIAAAAAAAA/+2ddXRcRRTGJxtrgYa6K+7sZiMbNEWKQ3GXNElLaZuWkJbipbi7uzulhBAKFHd3d+qOa1vuTb93OnnN4Z+9L2e/czLn3PN7G7n7fTN3ZydvJsmgLOeWuBVNLl1MIgfXwePc0OM8XPsteFwOJuMlRUXVpYXViWSiIl5YNixVHC8qHlaSSqQSxaniqsJUMlmdKkqVlg0rK42XJYqS1YnhxWXJ4fEVrauXK55mi1JnNxKd3Ul09iDR2ZNEZy8Snb1JdPYh0dmXRGc/Ep39SXQOINE5kETnIBKda5HoXJtE5zokOtcl0bkeic71SXRuQKJzQxKdG5Ho3JhE5yYkOjcl0bkZic7NSXTGDXWqNr0nNhD5Okksk+gMdgG7gt3A7mAPsCfYC+wN9gH7gv3A/uAAcCA4CFwLXBtcB1wXXA9cH9wA3BDcCNwY3ATcFNwM3ByMe1+XkCh0zZv1GCYdR60VkegsJtFZQqKzlERnikRnGYnOLUh0bkmicysSnVuT6NyGROe2JDrLSXQOdvZr3o7Ip+s9XfslwSKwGCwBS8EUWAZuAW4JbgVuDW4DbguWg4PdyjXndhLbu+bNug93IBnrHUl0DiHRuROJzp1JdO5ConNXEp27kejcnUTnHiQ69yTRuReJzqEkOvcm0bkPic59SXTuR6JzfxKdB5DoPJBE50EkOg8m0XkIic5DSXQeRqLzcBKdR5DoPJJE51GGOsP70sF+dMw135feAdwRHALuBO4M7gLuCu4G7g7uAe4J7gUOBfcG9wH3BfcD9wcPAA8EDwIPBg8BDwUPAw8HjwCPBI9yK+8RVkgMc82b9RhWOo5aqyLRWU2icziJzhEkOo8m0TmSROcxJDpHkegcTaJzDInOGhKdY0l0jiPReayzX/N2RD5d7+narxKsAqvB4eAI8GhwJHgMOAocDY4Ba8Cx4DjwWLdyzVkrcZxr/nvTymzXvIX7NZ5eS3R29uNvrTFGoLGLs63PoNV51+09xlzzluddl9voSOrv9OeGntt5z10g0U6iAx6Pq6gcNbh2xPgx1TV1x/kmskOdnuUlyfaeIKeFjwVfF3wu3636hwXMRtG1INoqd62zmw3rDHONt/MYb+mvPvgDb9WXlpp9vRO866DgYi3URF4EnlzoecL9WOAiLvwoBmlCBHmPd3bFH5Xv4+3H6H+XV/H0mmmf5rlVly1RaO7koulbq3GrqqwqqkwmUlH2Qa2znwiVJbieKHGCxIkSJ0mcLHGKxKkSp0lMkjhdYrLEGRJnSpwlcbbEORLnSpwncb7EBRIXSlwkcbHEJRKXSlwmcbnEFRJXSlwlcbXENRLXSlwncb3EDRI3StwkcbPELRK3StwmcbvEHRJ3StwlcbfEPRL3Stwncb/EAxIPSjzkjUcB6K8+Yt7HwiuXVlp6xXXZle89pwtpK8Dz5pk+b7JEnys35C/8plPegnddBnbBdWXF6NFDa0dOqKirHjK+prJu5Ngav7SC9EGJZbdgL/zxHK8rgm7xV6bB9+V7jOy9MhZKbv2aPtFFN68Z5S18WHJMCcxrh+gHlnqPp7hVRyC8ok73jcawo5oMWQ3gFMMBjLrYTnKZX2yPSI6pfrE9Eiq2qS76YjPsqCZDVgM41fEU22ku84vtUclR7xfbo6Fiq3fRF5thRzUZshrAesdTbJNc5hfbY5KjwS+2x0LF1uCiL7ZJxoasBrDB8RTb6S7zi+1xydHoF9vjoWJrdNEXm2FHNRmyGsBGx1NsD7nML7YnJMc0v9ieCBXbNBd9sRl2VJMhqwGcFtEAWm9ZdDIci4mGuZ407L/W2rKw1Ozrfcq7btuySDPnk+hQ67xPu8zeslDfT9uPUaRbFtZ9GrRYSGe6uU8wzDXdoP+CbYnWmvimu2gmvme867aJL82c09Gh1nmfdZk98anvZ+3HKNKJz7pPg5bJB14mG+Z6zvGtHi01+3qf967bJtE0cz6HDrXO+4LL7ElUfb9gP0aRTqKWfdpak4DlbQNf74veddskkGbOaehQ67wvucyeBNT3S/ZjFOkkYNmnrTUJWG7B+Xpf9q7bJoE0c9ajQ63zvuIyexJQ36/Yj1Gkk4Bln7bWJGC5NerrfdW7bpsE0szZgA61zvuay+xJQH2/Zj9GkU4Cln3aWpOA5Za1r/d177ptEkgzZyM61DrvGy6zJwH1/Yb9GEU6CVj2qWrzfxFGd4H0d32ngFNBbW9KvAU/+j3Bq+BkfM0p4KlgPdgANoKTwTPAM8GzwLPBc8BzwfPA88ELwAvBi8CLwUvAS8HLwMvBK8ArwavAq8FrwGvB68DrwRvAG8GbwJvBW8BbwdvA28E7wDvBu8C7wXvAe8H7wPvBB8AHvTF6W+Idb4yCcZ2Ir3kTfNv7nncl3nPNW7hm062z913rvLbS1fkBic4PSXR+RKLzYxKdn5Do/JRE52ckOj8n0fkFic4vSXR+RaLzaxKd35Do/JZE53ckOr8n0fkDic4fSXTOINE5k0TnLBKds0l0ziHROZdE5zwSnfNJdC4g0bmQROciEp2LI9IZC+mMp9cSWYael5B4jhl6/onEc7ah559JPOcYev6FxHOuoedfSTznGXr+jcTzdoaefyfx/L6h5z9IPH9g6PlPEs8fGnr+i8TzR4ae/ybx/LGh539IPH9i6PlfEs+fGnpeSuL5M0PPy0g8f27oeTmJ5y8MPetNCAbPXxp6ziLx/JWh5xiJ568NPWeTeP7G0HMOiedvDT3nknj+ztBzHonndw0955N4/t7QczsSzz8Yem5P4vlHQ8+rkXieYeh5dRLPMw09r0HieZah5w4knmcbei4g8TzH0POaJJ7nGnruSOJ5nqHnTiSe5xt67kzieYGh5y4knhcaeu5K4nmRoeduJJ4XG3ruTuI539BzDxLP7Qw99yTx3N7Qcy8Sz6sZeu5N4nl1Q899SDyvYei5L4nnDoae+5F4LjD03J/E85qGngeQeO5o6Hmgoefgn4RmwbOeP9bzuHo+Vc9r6lpK1xb6XqvvPToX69ykr1WtXR1L9ab/mqSzW/FPR4O/l7JEQs9d6zlkPZer51T13KaeY9RzfXrOTc996TkoPRek52T03Iieo1gOUbrvrPuwui+p+3S6b6X7OLqvoff59b633gfW+6J6n1Dvm+l9JL2vovcZ9Odu/TlUfy7Tn1N03a7rWF3X6TpH3/f1fVDfF3Se1HlDX0daV9rP/wHiVpjjbL8AAA==", - "verificationKey": "0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f" - } - ] -} diff --git a/yarn-project/noir-contracts/src/examples/multi_transfer_contract.json b/yarn-project/noir-contracts/src/examples/multi_transfer_contract.json deleted file mode 100644 index 9c280a3c5d8..00000000000 --- a/yarn-project/noir-contracts/src/examples/multi_transfer_contract.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "name": "MultiTransfer", - "functions": [ - { - "name": "constructor", - "functionType": "secret", - "parameters": [], - "returnTypes": [], - "bytecode": "H4sIAAAAAAAA/9XaV0/jQBiF4ZAFthd6773PxHZib2XZ3ivbC2Q3/P+fQI5IJMQtJxfvSJbtm+g8UWLPfPP9K5VK+6WT0dU8ys2ju3Xdvu85c9/buj492ve7rXMSqmnaqFUaMYmHoVLU8yykWb2axzxmefa/kidJI0/zWlEvaqGIadKIR1mRHIWT0Xfqs8I5Rydz9kNyDkByDkJyDkFyDkNyjkByjkJyjkFyjkNyTkByTkJyTkFyTkNyzkByzkJyzkFyzkNyLkByLkJyLkFyLkNyrkByrkJyrkFyrkNybkBybkJybkFybkNy7kByBkjO2KGc5TM5w/lG7DKaKxBz2WhOIOYLRnMKMXcbzRnE3GM0VyHmXqO5BjH3Gc05xNxvNBcQ84DRfBtiHjSa70DMQ0bzXYh52Gi+BzGPGM33IeZRo/kBxDxmNO9CzONG80OIecJo3oOYJ43mRxDzlNH8GGKeNpqfQMwzRvNTiHnWaH4GMc8Zzc8h5nmj+QXEvGA0v4SYF43mVxDzktH8GmJeNprfQMwrRvNbiHnVaH4HMa8Zze8h5nWj+QPEvGE0f4SYN43mTxDzltH8GWLeNpr3IeYdo/kLxByM5q8QczSav0HMF43m7xDzJaP5B8R82Wj+CTFfMZp/QcxXjebfEPM1o/kPxHzdaP4LMd8wmg8g5ptG8yHEfMtornfAHFtn9YarV1q9w+qlVW+pei3Ve6hePPWmqVdLvUvq5VFvS7vXQ70Ae81De8XaO9VeovbWtNekvRftRag2r1q1areqZaq2p1qXaj+qhag2oLWy1o5aS2ltobm25p6ai2luone13l16luvZpv/6QfPQb0HfzTEa8Kz8bEUAAA==", - "verificationKey": "0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f" - }, - { - "name": "multiTransfer", - "functionType": "secret", - "parameters": [ - { - "name": "asset", - "type": { - "kind": "field" - }, - "visibility": "private" - }, - { - "name": "addresses", - "type": { - "kind": "array", - "length": 12, - "type": { - "kind": "struct", - "fields": [ - { - "name": "x", - "type": { - "kind": "field" - } - }, - { - "name": "y", - "type": { - "kind": "field" - } - } - ] - } - }, - "visibility": "private" - }, - { - "name": "amounts", - "type": { - "kind": "array", - "length": 12, - "type": { - "kind": "field" - } - }, - "visibility": "private" - }, - { - "name": "owner", - "type": { - "kind": "struct", - "fields": [ - { - "name": "x", - "type": { - "kind": "field" - } - }, - { - "name": "y", - "type": { - "kind": "field" - } - } - ] - }, - "visibility": "private" - }, - { - "name": "batchTransferFnSelector", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "returnTypes": [], - "bytecode": "H4sIAAAAAAAA/+2cB5AUVReFewZYQAEJktOSM2yERXJOkkUks8ASJGdRMkgUARUTqBgw55zIBkREREREzFnMOaH/feOZ2kfLb1k1903NqequOvX1wOybc9+9c/fNdO/bHfa84iJzhETmNC/Oo4/z+R4nWY/NefLfP+4VE/0pKg6WAM8ES4KlwNJgGbAsWA4sD1YAK4KVwMpgMlgFrApWA6uDNcCaYC2wNlgHrAvWA+uDDcCGYCMwxXpeU9FZ3slHCGwNpqc0zsjIaZKWk5qemp2S1nREVmZKRuaIxlmpWamZWZmj0rLS03OyMrKaNB3RtElK09SM9JzU0ZlN00en/H00s8ZKifFw6bM5ic8WJD5bkvhsReKzNYnPNiQ+25L4bEfisz2Jzw4kPjuS+OxE4rMzic8uJD67kvjsRuLzbBKf3Ul89iDx2ZPEZy8Sn71JfPZR9On/biPV+/szfhqYDmaAmWBjsAmYBTYDm4MtwJZgK7A12AZsC7YD24MdwI5gJ7Az2AXsCnYDzwa7gz3AnmAvsDfYx8v9bqOv6Bzv5EM7h/08jlo7l8RnfxKf55H4HEDicyCJz0EkPgeT+BxC4nMoic9hJD6Hk/jMJvE5wtNfSxbFeOYakVlT9QX7geeC/cHzwAHgQHAQOBgcAg4Fh4HDwWxwhJe7lhspGuWdfGjPYQ5JrkeT+BxD4nMsic9xJD7PJ/E5nsTnBBKfE0l8TiLxOZnE5xQSn1NJfE4j8TmdxOcMEp8zSXzOIvE5m8TnBSQ+5yj69F+v8F+H+H/3NP6/ezUreae+xzIHHA2OAceC48DzwfHgBHAiOAmcDE4Bp4LTwOngDHAmOAucDV4AzrHiu1B0kXfyoZ3DuR5Hrc0j8TmfxOcCEp8LSXwuIvG5mMTnEhKfS0l8XkzicxmJz+UkPleQ+FxJ4nOVp7/mjV5XMes9s/abC84D54MLwIXgInAxuARcCl4MLgOXgyvAleAqL3fNuVp0iZf7N1LROSzknXz45zUltiO1saeff22PTQg81iXwWI/AY30Cj8UJPJYg8HgmgcdKBB4rE3hMduDR0/WYErLGXGOdF7QY9r12kr6PkebvpvP5XtuzXruIqICoMB5PyR45vs20MTMn5kyaMd0OIg9oLyiigxSyXiCv7/l2oNH/y2+Nox1xqncK01pjr/b0VqFrFMe6VC/GlKRTJcfTfxdrerb9rrXOowUXPkVNJDmIyfO9jn8ei3iOC99FktY6GHedp1f8ruJep5+jf/1YmxLboTqnSV7uG8Wl52Iex9xmkfhc7ek3VcPGOF8vukx0uegK0QbRlaKrRFeLrhFdK9oo2iS6TnS96AbRZtGNoptEN4tuEW0R3Sq6TXS76A7RnaK7RHeL7hHdK7pPdL/oAdGDoodED4seET0qekz0uOgJ0ZOip0RPi7aKtom2i3aIdop2iXaLnhE9K3rOykcR0F7JhK1/86+C4rSMSzFLuPzWa3o+b0Xwukmqr5ve2LxWPl98/l9grU8Ru1lSlsD5yOwJE3pNGzcre0ZOx5mTRs4YN3mSXVrR4aMllucU4fn/Pa81FdFpsVe50Z/Lb9HZ792wb3Dt9/Tlnpveo+gx7XkZY080eDMh5h9OWI/3eP/MgH91HusvLcWJigSklcA9igl0XWxXeIlfbC/IGHvtYnvBV2x7PffFpjhRkYC0ErjX4ym2q73EL7YXZYx9drG96Cu2fZ77YlOcqEhAWgnc5/EU2zVe4hfbSzLGfrvYXvIV237PfbEpTlQkIK0E7vd4iu1aL/GL7WUZ44BdbC/7iu2A577YFCcqEpBWAg94PMX2nJf4xfaKjHHQLrZXfMV20HNfbIoTFQlIK4EHHSVQ+/JHMcVcrFcc61XF+YvX5Q9Nz7bfQ9Z5cPkjxjFfxYRqj/ual9iXP0zcr+nnyOlX39pzGj20m2iWos/LFMc67PE1UU3Ptt/XrfOgicY45mFMqPa4R7zEbqIm7iP6OXLaRLXnNHok8o04GxXHesPja6Kanm2/R63zoInGOOYbmFDtcd/0EruJmrjf1M+R0yaqOafxagKaX0HYfo9Z50ETiHHMg5hQ7XHf8hK7CZi439LPkdMmoDmn8WoCmpfzbL9vW+dBE4hxzH2YUO1x3/ESuwmYuN/Rz5HTJqA5p/FqApqXWW2/71rnQROIccz9mFDtcd/zErsJmLjf08+R0yagOafxagKal79tv+9b50ETiHHMA5hQ7XE/8BK7CZi4P9DPkdMmoDmnxpv9BzrmKpDZ+2EPuBc0x4eijxCP+Znou2ADnnMleBW4D9wPHgA3gpvA68DrwRvAzeCN4E3gzeAt4BbwVvA28HbwDvBO8C7wbvAe8F7wPvB+8AHwQfAh8GHwEfBR8DHwcfAJ8EnwKfBpcCu4DdwO7gB3grvA3eAz4LNWjj4WfWLlKJrX9XjOh+DH1s98KvrMO/nw12ysdfa556b5avs87sWnB8Tq8wsSn1+S+PyKxOfXJD6/IfH5LYnP70h8fk/i8wcSnz+S+PyJxOfPJD5/IfH5K4nP30h8/k7i8w8SnydIfP6p6DP62S8Z4/n3Tm8ANgQbgSXBUmBpsApYFawGfg4eB78AvwS/Ar8GvwG/Bb8Dvwd/AH8EfwJ/Bn8BfwV/A38H/wBPgFGZvfv+spPmKIehEEethUl85iHxmZfEZz4Sn0kkPvOT+CxA4rMgic/TSHyeTuKzEInPwiQ+i5D4PCOkv+YtivHMes+s/cyazDAM5gHzgvnAJDA/WAAsCJ4Gng4WAguDRcAzQrlrzqJyXiwU7J1+Ko8Me6c3IPDYkMBjIwKPJQk8liLwWJrAYxUCj1UJPFZz4NFT9mh/5VPcehDsne4R751eNKS3Ci2uOFYJxRVtvG7P1PRs+z3TehDcnhnjmCZJZkLVlz2Kxe8q7pIh9Rw5vT1Tc06DvdNP9smyd3pRB03VMLqxdSl5UFpURlRWVE5UXlRBVFFUSVRZlCyqIqoqqiaqLqohqimqJaotqiOqK6onqi9qIGooaiQyL27WUGmidFGGKFPUWNRElCVqKjpL1EzUXNRC1FLUysyBqI2oraidqL2og6ijqJOos6iLqKuom/U+D/ZOt49g7/T/cDjfO71MyE3vUfSYdrZ47B7ycj8WmH+wt0bsHvpnBrS3RlScqEhAWgnsrphA18VWlqDYeojHnnax9fAVW884FJviREUC0kpgT6Jiq0hQbL3EY2+72Hr5iq13HIpNcaIiAWklsDdRsVUiKLY+4rGvXWx9fMXWNw7FpjhRkYC0EtiXqNgqExTbOeKxn11s5/iKrV8cik1xoiIBaSWwH1GxdSMotnPFY3+72M71FVv/OBSb4kRFAtJKYH9HCUzkvdNLhfTGOk9x/uJ1+UPTs+13gPUguPwR45gmSQNC+uMOVCx+V3EPDKnnyOlX39pz6lmFrOlTc+/00ooxDyJsooMcNdHBQRPVTdJgB010SII3URP3ELImOoSkiWreiJOsONZQwiY61FETHRY0Ud0kDXPQRIcneBM1cQ8na6KacxqvJtDfURPIDpqAbpKyHTSBEQneBEzcI8iawAjCJtDbURMYGTQB3SSNdNAERiV4EzBxjyJrAqMIm0BfR00gJ2gCuknKcdAERid4EzBxjyZrAqMJm0A/R01gTNAEdJM0xkETGJvgTcDEPZasCWjOqfFm/4GOuQpk9n7oDvYM5e6xPU7Oz0eN2Hunl8NzyoMVwN5gX7AfmAxWAauC1cDqYA2wJlgLrA3WAeuC9cD6YAOwIdgITAFTwTQwHcwAM8HGYBMwC2wKngU2A5uDLcCWYCuwNdgGbAu2A9uDHcCOYCewM9gF7GrlaLycT7ByFM1rKTxnHDje+pmJcj7J1638NRtrnU3W+yWQ5tLnlFB8ekCsPqeS+JxG4nM6ic8ZJD5nkvicReJzNonPC0h8ziHxeSGJz4tIfM4l8TmPxOd8Ep8LSHwuJPG5iMTnYhKfS5S/JPu3vdNTwFQwDSwDlgXLgdXBGmBNcDI+Q04Bp4LTwOngDHAmOAucDV4AzgEvBC8C54LzwPngAnAhuAhcDC4J5e5juVTOL3b8GXcZSa0tJ/G5gsTnShKfq0h8ribxeQmJzzUkPi8l8bmWxOc6Ep/rSXxeRuLzchKfVzhY8xbFeEux9lsGLgdXgCvBVeBq8BJwDXgpuBZcB64HLwMvB6+w1pwb5PzKULB3+qk8MuydnkLgMZXAYxqBxzIEHssSeCxH4LE6gccaBB5rOvDo6XpMs7/yucp6EOyd7hHvnb4hpLcKvUpxrKsVV7Txuj1T07Pt9xrrQXB7ZoxjmiSZCdUe91rF4ncV97Uh9Rw5vT1Tc06DvdNP9smyd/oGB03VMLqx9UZ5sEl0neh60Q2izaIbRTeJbhbdItoiulV0m+h20R2iO0V3ie4W3SO6V3Sf6H7RA6IHRQ+JHhY9InpU9JjocdEToidFT4meFm0VbRNtF+0Q7RTtEu0WPSN6VvSc6HnRHtELor2iF0X7RC+J9oteFh2w3ufB3un2Eeyd/h8O53unXxdy03sUPaa9Ih4PhrzcjwXmH+ytEQ+G/pkB7a0RFScqEpBWAg8qJtB1sV1PUGyvisdDdrG96iu2Q3EoNsWJigSklcBDRMV2E0GxvSYeD9vF9pqv2A7HodgUJyoSkFYCDxMV280Exfa6eDxiF9vrvmI7EodiU5yoSEBaCTxCVGy3EBTbG+LxqF1sb/iK7Wgcik1xoiIBaSXwKFGxHSAotjfF4zG72N70FduxOBSb4kRFAtJK4DFHCUzkvdM3hvTGektx/uJ1+UPTs+33betBcPkjxjFNkt4O6Y/7jmLxu4r7nZB6jpx+9a09p55VyJo+NfdO36QY87uETfRdR030vaCJ6ibpPQdN9P0Eb6Im7vfJmuj7JE1U80acLYpjfUDYRD9w1EQ/DJqobpI+dNBEP0rwJmri/oisiWrOabyawDFHTeDjoAnoJuljB03gkwRvAibuT8iawCeETeCwoybwadAEdJP0qYMm8FmCNwET92dkTeAzwiZwxFET+DxoArpJ+txBEzie4E3AxH2crAkcJ2wCRx01gS+CJqCbpC8cNIEvE7wJmLi/JGsCmnNqvNl/oGOuApm9Hw6Ch0K5e2x/Jedfo0bsvdNvwHM2gzeCh8Ej4FFwC3greBt4O3gHeCd4F3g3eA94L3gfeD/4APgg+BD4MPgI+Cj4GPg4+AT4JPgU+DS4FdwGbgd3gDvBXeBu8BnwWfA58HlwD/gCuBd8EdwHvgTuB1+2cvSNnH9r5Sia1414zlfgN9bPfCfn3/u6lb9mY62zH/R+CaS79PljKD49IFafP5H4/JnE5y8kPn8l8fkbic/fSXz+QeLzBInPP0l8/kXi03zyYvAZIvEZJvGZh8RnXhKf+Uh8JpH4zE/is4Ciz+hnv2SM5987PR3MADPB8mAFsCJYC6wN1gF/wGfIH8GfwJ/BX8Bfwd/A38E/wBPgn+Bf0c+m4b8ZAsNgHjAvmA9MAvODBcK5+1gWlPPTwp7nMoenk9RaIRKfhUl8FiHxeQaJz6IkPouR+CxO4rMEic8zSXyWJPFZisRnaRKfZUh8lnWw5i2K8Qpi7Xc6WAgsDBYBzwCLgsXA4mAJ8EywJFgKLA2WActaa85ycl4+HOydfiqPDHunpxN4zCDwmEngsTyBxwoEHisSeKxF4LE2gcc6Djx6uh7T7dsaKoRzz4O90z3ivdPLhfVWoRUUx6qouKKN1+2Zmp5tv5Wst1Vwe2aMY5okmQnVHreyYvG7irtyWD1HTm/P1JzTYO/0k32y7J1ezkFTNYxubJ0s41cRVRVVE1UX1RDVFNUS1RbVEdUV1RPVFzUQNRQ1Epl95Mxm02midFGGKFPUWNRElCVqKjpL1EzUXNRC1FLUysQmaiNqK2onai/qIOoo6iTqLOoi6irqJjpb1F3UQ9RT1EvUW9RH1Fd0jqif9T4P9k63j2Dv9P9wON87vWrYTe9R9Jh2rnjsH50IQ/MP9taI/cP/zID21oiKExUJSCuB/RUT6LrYqhEU23nicYBdbOf5im1AHIpNcaIiAWklcABRsdUiKLaB4nGQXWwDfcU2KA7FpjhRkYC0EjiIqNhqExTbYPE4xC62wb5iGxKHYlOcqEhAWgkcQlRsdQiKbah4HGYX21BfsQ2LQ7EpTlQkIK0EDiMqtn4ExTZcPGbbxTbcV2zZcSg2xYmKBKSVwGxHCUzkvdOTw3pjjVCcv3hd/tD0bPsdGc49Dy5/xDimSdLIsP64oxSL31Xco8LqOXL61bf2nHpWIWv61Nw7vYpizDmETTTHURMdHTRR3SSNdtBExyR4EzVxjyFrotpz6lmFrOlT80acuopjjSVsomMdNdFxQRPVTdI4B030/ARvoibu88maqOacxqsJZDtqAuODJqCbpPEOmsCEBG8CJu4JZE1gAmETGOSoCUwMmoBukiY6aAKTErwJmLgnkTWBSYRNYIijJjA5aAK6SZrsoAlMSfAmYOKeQtYEphA2gWGOmsDUoAnoJmmqgyYwLcGbgIl7GlkT0JxT483+Ax1zFcjs/dAfHBDO3WN7upzPQI3Ye6dXx3NqgDXBQeAQcBhYF6wH1gcbgA3BRmAKmAqmgelgBpgJNgabgFlgU/AssBnYHGwBtgRbga3BNmBbsB3YHuwAdgQ7gZ3BLmBXsBt4Ntgd7AH2BHuBvcE+YF/wHCtHM+V8lpWjaF6T8Zzp4EzrZ2bL+QV25/T090mZE47PeytWnxeS+LyIxOdcEp/zSHzOJ/G5gMTnQhKfi0h8LibxuYTE51ISnxeT+FxG4nM5ic8VJD5XkvhcReJzNYnPS0h8riHxeSmJz7UkPteR+FzvyGfY5zMltiM1pBjzZSQxhxVjvpwk5jyKMV9BEnNexZg3kMScTzHmK0liTlKM+SqSmEcqxnw1ScybFGO+hiTmKiG9mK8libleWC/mjSQxz1GMeRNJzBcqxnwdScwXKcZ8PUnMcxVjvoEk5nmKMW8miXm+Ysw3ksS8QDHmm0hiXqgY880kMS9SjPkWkpgXK8a8hSTmJYox30oS81LFmG8jiflixZhvJ4n5U08v5jtIYp6o+Pn5TpKYv1OM+S6SmGcrvp/vJol5mWLM95DEvFwx5ntJYl6hGPN9JDGvVIz5fpKYVynG/ABJzKsVY36QJOZLFGN+iCTmNYoxP0wS86WKMT9CEvNaxZgfJYl5nWLMj5HEvF4x5sdJYs7v6cX8BEnMBRRjfpIk5oKKMT9FEvNpijE/TRLz6YoxbyWJuZBizNtIYi6sGPN2kpiLKMa8gyTmMxRj3kkSc1HFmHc5iDm654G5N9zcK23uHTb30pp7S829lubeQ3Mvnrk3zdyrZe5dMvfymHtbzL0em0XmXgBzbdxcKzbXTs21RHNtzVxrMtdezLUI8928+a7afHdrvss03+2Z77rMdz/muxDz3YD5rGw+O5rPUuazhVlrm7WnWYuZtYn5XW1+d5lebnqbea+b2je1YObmf+r0Ujng0AEA", - "verificationKey": "0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f" - } - ] -} diff --git a/yarn-project/noir-contracts/src/scripts/compile.sh b/yarn-project/noir-contracts/src/scripts/compile.sh deleted file mode 100755 index adedfaeba4f..00000000000 --- a/yarn-project/noir-contracts/src/scripts/compile.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# Example: - -# ./compile.sh private_token ecdsa_account -# or -# yarn noir:build private_token ecdsa_account - -# Enable strict mode: -# Exit on error (set -e), treat unset variables as an error (set -u), -# and propagate the exit status of the first failing command in a pipeline (set -o pipefail). -set -euo pipefail; - -# Run build scripts -./scripts/compile.sh "$@" -echo "Generating types" -./scripts/types.sh "$@" \ No newline at end of file diff --git a/yarn-project/noir-contracts/src/scripts/copy_output.ts b/yarn-project/noir-contracts/src/scripts/copy_output.ts deleted file mode 100644 index f27f20b2f6f..00000000000 --- a/yarn-project/noir-contracts/src/scripts/copy_output.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { ContractArtifact } from '@aztec/foundation/abi'; -import { createConsoleLogger } from '@aztec/foundation/log'; -import { generateNoirContractInterface, generateTypescriptContractInterface } from '@aztec/noir-compiler'; - -import { readFileSync, writeFileSync } from 'fs'; -import camelCase from 'lodash.camelcase'; -import omit from 'lodash.omit'; -import snakeCase from 'lodash.snakecase'; -import upperFirst from 'lodash.upperfirst'; -import { join as pathJoin } from 'path'; -import { format } from 'util'; - -// const STATEMENT_TYPES = ['type', 'params', 'return'] as const; -const log = createConsoleLogger('aztec:noir-contracts'); - -const PROJECT_CONTRACTS = [ - { name: 'SchnorrSingleKeyAccount', target: '../aztec.js/src/account_contract/artifacts/', exclude: [] }, - { name: 'SchnorrAccount', target: '../aztec.js/src/account_contract/artifacts/', exclude: [] }, - { name: 'EcdsaAccount', target: '../aztec.js/src/account_contract/artifacts/', exclude: [] }, -]; - -const INTERFACE_CONTRACTS = ['private_token', 'private_token_airdrop', 'test']; - -/** - * Writes the contract to a specific project folder, if needed. - * @param artifact - The artifact to write. - */ -function writeToProject(artifact: any) { - for (const projectContract of PROJECT_CONTRACTS) { - if (artifact.name === projectContract.name) { - const toWrite = { - ...artifact, - functions: artifact.functions.map((f: any) => omit(f, projectContract.exclude)), - // If we maintain debug symbols they will get committed to git. - debug: undefined, - }; - const targetFilename = pathJoin(projectContract.target, `${snakeCase(artifact.name)}_contract.json`); - writeFileSync(targetFilename, JSON.stringify(toWrite, null, 2) + '\n'); - log(`Written ${targetFilename}`); - } - } -} - -/** - * Processes an artifact generated by noir-compiler. - * Currently unused. This should be used once contracts are compiled with `noir-compiler` instead of Nargo. - * - * @param projectName - The name of the project - * @param contractName - The name of the contract - */ -function processNoirCompilerArtifact(projectName: string, contractName: string) { - const artifactJsonFilePath = `src/contracts/${projectName}/target/${contractName}.json`; - const artifactJson: ContractArtifact = JSON.parse(readFileSync(artifactJsonFilePath).toString()); - return artifactJson; -} - -const main = () => { - const name = process.argv[2]; - if (!name) { - throw new Error(`Missing argument contract name`); - } - - const projectName = `${snakeCase(name)}_contract`; - const contractName = upperFirst(camelCase(name)); - const artifactJson = processNoirCompilerArtifact(projectName, contractName); - - // Write the artifact: - const artifactsDir = 'src/artifacts'; - const artifactFileName = `${snakeCase(name)}_contract.json`; - writeFileSync(pathJoin(artifactsDir, artifactFileName), JSON.stringify(artifactJson, null, 2) + '\n'); - log(`Written ${pathJoin(artifactsDir, artifactFileName)}`); - - // Write some artifacts to other packages in the monorepo: - writeToProject(artifactJson); - - // Write a .ts contract interface, for consumption by the typescript code - const tsInterfaceDestFilePath = `src/types/${name}.ts`; - const tsAbiImportPath = `../artifacts/${artifactFileName}`; - writeFileSync(tsInterfaceDestFilePath, generateTypescriptContractInterface(artifactJson, tsAbiImportPath)); - log(`Written ${tsInterfaceDestFilePath}`); - - // Write a .nr contract interface, for consumption by other Aztec.nr contracts - if (INTERFACE_CONTRACTS.includes(name)) { - const projectDirPath = `src/contracts/${projectName}`; - const noirInterfaceDestFilePath = `${projectDirPath}/src/interface.nr`; - try { - writeFileSync(noirInterfaceDestFilePath, generateNoirContractInterface(artifactJson)); - log(`Written ${noirInterfaceDestFilePath}`); - } catch (err) { - log(`Error generating Aztec.nr interface for ${name}: ${err}`); - } - } -}; - -try { - main(); -} catch (err: unknown) { - log(format(`Error copying build output`, err)); - process.exit(1); -} diff --git a/yarn-project/noir-contracts/src/scripts/copy_source.ts b/yarn-project/noir-contracts/src/scripts/copy_source.ts deleted file mode 100644 index c9c3745c16c..00000000000 --- a/yarn-project/noir-contracts/src/scripts/copy_source.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* eslint-disable jsdoc/require-jsdoc */ -import { createConsoleLogger } from '@aztec/foundation/log'; - -import * as fs from 'fs'; -import snakeCase from 'lodash.snakecase'; -import * as path from 'path'; -import { format } from 'util'; - -// heavily copying yarn-project/noir-contracts/src/scripts/copy_output.ts -const log = createConsoleLogger('aztec:noir-contracts:source_copy'); - -/** - * for the typechecker... - */ -interface NoirSourceCopy { - name: string; - target: string; - exclude: string[]; -} - -const NOIR_SOURCE_COPIES: NoirSourceCopy[] = [ - { name: 'PrivateToken', target: '../boxes/private-token/src/artifacts', exclude: [] }, -]; - -/** - * Sometimes we want to duplicate the noir source code elsewhere, - * for example in the boxes we provide as Aztec Quickstarts. - * @param contractName - UpperCamelCase contract name that we check need copying - */ -function copyNrFilesExceptInterface(contractName: string): void { - // stored in `noir-contracts` under snake case naming - const snakeCaseContractName = `${snakeCase(contractName)}_contract`; - const projectDirPath = `src/contracts/${snakeCaseContractName}`; - - for (const noirCopy of NOIR_SOURCE_COPIES) { - if (noirCopy.name === contractName) { - const target = noirCopy.target; - - try { - // Ensure target directory exists - if (!fs.existsSync(target)) { - throw Error(`target copy path ${target} doesnt exist`); - } - // Read the project directory - const files = fs.readdirSync(projectDirPath); - - // Filter and copy *.nr files except interface.nr - files - .filter( - file => - file.endsWith('.nr') && - file !== 'interface.nr' && - (!noirCopy.exclude || !noirCopy.exclude.includes(file)), - ) - .forEach(file => { - const sourcePath = path.join(projectDirPath, file); - const targetPath = path.join(target, file); - log(`copying ${sourcePath} to ${targetPath}`); - fs.copyFileSync(sourcePath, targetPath); - }); - - log(`Copied .nr files from ${contractName} to ${target} successfully!`); - } catch (err) { - log(format(`Error copying files from ${contractName} to ${target}:`, err)); - } - } - } -} - -const main = () => { - const contractName = process.argv[2]; - if (!contractName) { - throw new Error(`Missing argument contract name`); - } - - copyNrFilesExceptInterface(contractName); -}; - -try { - main(); -} catch (err: unknown) { - log(format(`Error copying build output`, err)); - process.exit(1); -} diff --git a/yarn-project/noir-contracts/src/scripts/mockedKeys.json b/yarn-project/noir-contracts/src/scripts/mockedKeys.json deleted file mode 100644 index 71c2a966c7e..00000000000 --- a/yarn-project/noir-contracts/src/scripts/mockedKeys.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "verificationKey": "0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f" -} diff --git a/yarn-project/noir-contracts/tsconfig.json b/yarn-project/noir-contracts/tsconfig.json index fc8bba71c0b..a82cec59baa 100644 --- a/yarn-project/noir-contracts/tsconfig.json +++ b/yarn-project/noir-contracts/tsconfig.json @@ -8,12 +8,6 @@ "references": [ { "path": "../aztec.js" - }, - { - "path": "../foundation" - }, - { - "path": "../noir-compiler" } ], "include": [ diff --git a/yarn-project/pxe/tsconfig.json b/yarn-project/pxe/tsconfig.json index c282504efe6..907a410c56b 100644 --- a/yarn-project/pxe/tsconfig.json +++ b/yarn-project/pxe/tsconfig.json @@ -9,9 +9,6 @@ { "path": "../acir-simulator" }, - { - "path": "../kv-store" - }, { "path": "../circuits.js" }, @@ -24,6 +21,9 @@ { "path": "../key-store" }, + { + "path": "../kv-store" + }, { "path": "../noir-compiler" }, diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 2f7b27d8744..fc56b14cff8 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -219,7 +219,6 @@ __metadata: "@types/jest": ^29.5.0 "@types/lodash.every": ^4.6.7 "@types/lodash.partition": ^4.6.0 - "@types/lodash.zip": ^4.2.7 "@types/node": ^18.7.23 buffer: ^6.0.3 crypto-browserify: ^3.12.0 @@ -227,7 +226,6 @@ __metadata: jest-mock-extended: ^3.0.3 lodash.every: ^4.6.0 lodash.partition: ^4.6.0 - lodash.zip: ^4.2.0 process: ^0.11.10 resolve-typescript-plugin: ^2.0.1 stream-browserify: ^3.0.0 @@ -314,6 +312,7 @@ __metadata: "@types/lodash.startcase": ^4.4.7 "@types/node": ^18.7.23 "@types/semver": ^7.5.2 + "@types/source-map-support": ^0.5.10 commander: ^9.0.0 jest: ^29.5.0 jest-mock-extended: ^3.0.5 @@ -321,6 +320,7 @@ __metadata: lodash.startcase: ^4.4.0 node-fetch: ^3.3.2 semver: ^7.5.4 + source-map-support: ^0.5.21 ts-jest: ^29.1.0 ts-node: ^10.9.1 tslib: ^2.4.0 @@ -590,20 +590,9 @@ __metadata: resolution: "@aztec/noir-contracts@workspace:noir-contracts" dependencies: "@aztec/aztec.js": "workspace:^" - "@aztec/foundation": "workspace:^" - "@aztec/noir-compiler": "workspace:^" "@jest/globals": ^29.5.0 "@types/jest": ^29.5.0 - "@types/lodash.camelcase": ^4.3.7 - "@types/lodash.omit": ^4.5.7 - "@types/lodash.snakecase": ^4.1.7 - "@types/lodash.upperfirst": ^4.3.7 - "@types/node": ^18.7.23 jest: ^29.5.0 - lodash.camelcase: ^4.3.0 - lodash.omit: ^4.5.0 - lodash.snakecase: ^4.1.1 - lodash.upperfirst: ^4.3.1 ts-jest: ^29.1.0 ts-node: ^10.9.1 tslib: ^2.4.0 @@ -3588,15 +3577,6 @@ __metadata: languageName: node linkType: hard -"@types/lodash.snakecase@npm:^4.1.7": - version: 4.1.7 - resolution: "@types/lodash.snakecase@npm:4.1.7" - dependencies: - "@types/lodash": "*" - checksum: 02a246ea5984ea60e29a8f023b2b4440150118e6c082dd7c40c7e4aad5b86b2d124fdaddab671ced50e2eaf84f6490010fb8815bed76bc08ef828dd59885d651 - languageName: node - linkType: hard - "@types/lodash.startcase@npm:^4.4.7": version: 4.4.7 resolution: "@types/lodash.startcase@npm:4.4.7" @@ -3820,6 +3800,15 @@ __metadata: languageName: node linkType: hard +"@types/source-map-support@npm:^0.5.10": + version: 0.5.10 + resolution: "@types/source-map-support@npm:0.5.10" + dependencies: + source-map: ^0.6.0 + checksum: ef287caea52a41b600a128d36cf961f048913e30fe143f7d882d19014635d0ca89e27013a48b0e6353ca277689d633c2ef65a25b2f8cd6d82916a2f908f18c38 + languageName: node + linkType: hard + "@types/stack-utils@npm:^2.0.0": version: 2.0.1 resolution: "@types/stack-utils@npm:2.0.1" @@ -10005,13 +9994,6 @@ __metadata: languageName: node linkType: hard -"lodash.snakecase@npm:^4.1.1": - version: 4.1.1 - resolution: "lodash.snakecase@npm:4.1.1" - checksum: 1685ed3e83dda6eae5a4dcaee161a51cd210aabb3e1c09c57150e7dd8feda19e4ca0d27d0631eabe8d0f4eaa51e376da64e8c018ae5415417c5890d42feb72a8 - languageName: node - linkType: hard - "lodash.startcase@npm:^4.4.0": version: 4.4.0 resolution: "lodash.startcase@npm:4.4.0" @@ -12594,7 +12576,7 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:~0.5.20": +"source-map-support@npm:^0.5.21, source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: