diff --git a/docs/docs/about_aztec/roadmap/features_initial_ldt.md b/docs/docs/about_aztec/roadmap/features_initial_ldt.md index f85c0bc28bf..50cf79233f1 100644 --- a/docs/docs/about_aztec/roadmap/features_initial_ldt.md +++ b/docs/docs/about_aztec/roadmap/features_initial_ldt.md @@ -8,7 +8,7 @@ Devs should be able to quickly spin up local, emulated instances of an Ethereum Here's a summary of the features we intend to support with the first release of the Aztec Sandbox. -## Noir Contracts +## Aztec.nr Contracts - Noir `contract` scopes. - Declare a `contract`, containing a collection of state variables and functions. @@ -21,7 +21,7 @@ Here's a summary of the features we intend to support with the first release of - public functions - May read and modify public state. - `constructor` functions, for initialising contract state. -- `import` other Noir contracts, so their functions may be called. +- `import` other Aztec.nr contracts, so their functions may be called. - Nested function calls, for contract composability - private functions can call private functions of other contracts, and receive return values. - private functions can call public functions any contract. @@ -29,14 +29,14 @@ Here's a summary of the features we intend to support with the first release of - public functions can call public functions of other contracts, and receive return values. - private functions can be called recursively. - public functions can be called recursively. -- Send messages from Noir contracts to Ethereum L1, for consumption by L1 smart contracts. +- Send messages from Aztec.nr contracts to Ethereum L1, for consumption by L1 smart contracts. - Useful, for example, if writing an app to withdraw funds from L2 to L1. - Consume messages which have been sent by: - L1 functions. - Useful, for example, if writing an app to deposit funds from L1 to L2. - public L2 functions. -- Emit `event` data from a Noir Contract. - - Allows applications to subscribe to events which have been emitted by a Noir contract's functions, for example. +- Emit `event` data from a Aztec.nr Contract. + - Allows applications to subscribe to events which have been emitted by a Aztec.nr contract's functions, for example. - Write `unconstrained` functions. - These allow developers to write `pure` and `view` functions, which can perform calculations and retrieve state. E.g. for fetching contract-specific information, which may then be consumed by a dapp, without having to generate a zero-knowledge proof or interact with the 'network'. @@ -46,13 +46,13 @@ A typescript wrapper for making RPC calls to an Aztec LDT node. - Similar in purpose to `web3.js`/`ethers.js`/`viem`, but for interacting with Aztec Network nodes. The RPC interface for an Aztec node is necessarily different from that of an Ethereum node, because it deals with encrypted transactions and state variables. - A library for public/private key management. -- Construct `Contract` instances from a Noir contract's JSON ABI. +- Construct `Contract` instances from a Aztec.nr contract's JSON ABI. - Deploy new contracts to the Aztec LDT. - Construct tx requests, passing arguments to a function of a contract. - Sign tx requests. - Send txs to the LDT node, for simulating. - Send txs to the LDT node, to be sent to the LDT network. -- Call `unconstrained` functions of a Noir contract, to perform `pure` calculations or retrieve state. +- Call `unconstrained` functions of a Aztec.nr contract, to perform `pure` calculations or retrieve state. ## Aztec Local Developer Testnet Node diff --git a/docs/docs/concepts/advanced/circuits/kernels/private_kernel.md b/docs/docs/concepts/advanced/circuits/kernels/private_kernel.md index d079a3deaa8..405a6163061 100644 --- a/docs/docs/concepts/advanced/circuits/kernels/private_kernel.md +++ b/docs/docs/concepts/advanced/circuits/kernels/private_kernel.md @@ -6,7 +6,7 @@ This circuit is executed by the user, on their own device. This is to ensure pri - Verifies a user's signature. - Hides the user's address. -- Verifies an app's proof - i.e. a proof which has been output after the execution of some function in a Noir Contract. +- Verifies an app's proof - i.e. a proof which has been output after the execution of some function in an Aztec.nr Contract. - Performs private state reads and writes. - Exposes (forwards) the following data to the next recursive circuit: - new note hashes; @@ -21,5 +21,5 @@ This circuit is executed by the user, on their own device. This is to ensure pri - Verifies a previous 'Private Kernel Proof', recursively, when verifying transactions which are composed of many private function calls. - Optionally can [deploy](../../contract_creation) a new private contract. -> Note: **This is the only core protocol circuit which actually needs to be "zk" (zero knowledge)!!!** That's because this is the only core protocol circuit which handles private data, and hence the only circuit for which proofs must not leak any information about witnesses! (The private data being handled includes: details of the Noir Contract function which has been executed; the address of the user who executed the function; the intelligible inputs and outputs of that function). +> Note: **This is the only core protocol circuit which actually needs to be "zk" (zero knowledge)!!!** That's because this is the only core protocol circuit which handles private data, and hence the only circuit for which proofs must not leak any information about witnesses! (The private data being handled includes: details of the Aztec.nr Contract function which has been executed; the address of the user who executed the function; the intelligible inputs and outputs of that function). > This is a really interesting point. Most so-called "zk-Rollups" do not make use of this "zero knowledge" property. Their snarks are "snarks"; with no need for zero-knowledge, because they don't seek privacy; they only seek the 'succinct' computation-compression properties of snarks. Aztec's "zk-Rollup" actually makes use of "zero knowledge" snarks. That's why we sometimes call it a "zk-zk-Rollup", or "_actual_ zk-Rollup". diff --git a/docs/docs/concepts/advanced/circuits/main.md b/docs/docs/concepts/advanced/circuits/main.md index b959287941a..3f21cb79053 100644 --- a/docs/docs/concepts/advanced/circuits/main.md +++ b/docs/docs/concepts/advanced/circuits/main.md @@ -7,7 +7,7 @@ title: Circuits In Aztec, circuits come from two sources: 1. Core protocol circuits -2. User-written circuits (written as Noir Contracts and deployed to the network) +2. User-written circuits (written as Aztec.nr Contracts and deployed to the network) This page focusses on the core protocol circuits. These circuits check that the rules of the protocol are being adhered to. diff --git a/docs/docs/concepts/advanced/data_structures/trees.md b/docs/docs/concepts/advanced/data_structures/trees.md index 75cbcdddf45..903b80a3de1 100644 --- a/docs/docs/concepts/advanced/data_structures/trees.md +++ b/docs/docs/concepts/advanced/data_structures/trees.md @@ -25,11 +25,11 @@ So, if an app needs to edit a private state variable (which will be represented ### Example Note -An example blob of data might be defined in a Noir Contract as: +An example blob of data might be defined in an Aztec.nr Contract as: ```rust struct MyNote { - storage_slot: Field, // determined by the Noir Contract + storage_slot: Field, // determined by the Aztec.nr Contract value: Field, owner_public_key: Point, // The owner of this private state // (and the person who may edit it). @@ -37,7 +37,7 @@ struct MyNote { } ``` -The note might be committed-to, within a function of the Noir Contract as: +The note might be committed-to, within a function of the Aztec.nr Contract as: ```rust note_hash: Field = pedersen::compress( diff --git a/docs/docs/concepts/foundation/accounts/keys.md b/docs/docs/concepts/foundation/accounts/keys.md index 0e4755c3798..9f7ca23f581 100644 --- a/docs/docs/concepts/foundation/accounts/keys.md +++ b/docs/docs/concepts/foundation/accounts/keys.md @@ -69,7 +69,7 @@ The privacy master key is used to derive encryption keys. Encryption keys, as th In a future version, encryption keys will be differentiated between incoming and outgoing. When sending a note to another user, the sender will use the recipient's incoming encryption key for encrypting the data for them, and will optionally use their own outgoing encryption key for encrypting any data about the destination of that note. This is useful for reconstructing transaction history from on-chain data. For example, during a token transfer, the token contract may dictate that the sender encrypts the note with value with the recipient's incoming key, but also records the transfer with its own outgoing key for bookkeeping purposes. -An application in Noir can access the encryption public key for a given address using the oracle call `get_public_key`, which you can then use for calls such as `emit_encrypted_log`: +An application in Aztec.nr can access the encryption public key for a given address using the oracle call `get_public_key`, which you can then use for calls such as `emit_encrypted_log`: #include_code encrypted /yarn-project/noir-libs/value-note/src/utils.nr rust @@ -81,7 +81,7 @@ In order to be able to provide the public encryption key for a given address, th In addition to deriving encryption keys, the privacy master key is used for deriving nullifier secrets. Whenever a private note is consumed, a nullifier deterministically derived from it is emitted. This mechanisms prevents double-spends, since nullifiers are checked by the protocol to be unique. Now, in order to preserve privacy, a third party should not be able to link a note commitment to its nullifier - this link is enforced by the note implementation. Therefore, calculating the nullifier for a note requires a secret from its owner. -An application in Noir can request a nullifier from the current user for computing the nullifier of a note via the `get_secret_key` oracle call: +An application in Aztec.nr can request a nullifier from the current user for computing the nullifier of a note via the `get_secret_key` oracle call: #include_code nullifier /yarn-project/noir-libs/value-note/src/value_note.nr rust diff --git a/docs/docs/concepts/foundation/state_model.md b/docs/docs/concepts/foundation/state_model.md index e29d1350849..87db190203c 100644 --- a/docs/docs/concepts/foundation/state_model.md +++ b/docs/docs/concepts/foundation/state_model.md @@ -10,7 +10,7 @@ import Disclaimer from '../../misc/common/\_disclaimer.mdx'; ## Private State -Private state must be treated differently from public state and this must be expressed in the semantics of the Noir language. +Private state must be treated differently from public state and this must be expressed in the semantics of Aztec.nr. Private state is encrypted and therefore is "owned" by a user or a set of users (via shared secrets) that are able to decrypt the state. @@ -22,12 +22,12 @@ Modification of state variables can be emulated by nullifying the a state record ### Abstracting UTXO's from App's / Users -The goal of Noir's contract syntax is abstract the UTXO model away from an app user / developer, contract developers are the only actor who should have to think about UTXO's. +The goal of the Aztec.nr smart contract library is to abstract the UTXO model away from an app user / developer, contract developers are the only actor who should have to think about UTXO's. This is achieved with two main features: 1. Users sign over transactions, not over specific UTXO's -2. Noir contracts support developer defined `unconstrained` getter functions to help dApp's make sense of UTXO's. e.g `getBalance()`. These functions can be called outside of a transaction context to read private state. +2. Aztec.nr contracts support developer defined `unconstrained` getter functions to help dApp's make sense of UTXO's. e.g `getBalance()`. These functions can be called outside of a transaction context to read private state. ### The lifecycle of a note diff --git a/docs/docs/dev_docs/contracts/common_errors.md b/docs/docs/dev_docs/contracts/common_errors.md index 75762ef9cd6..ce96e27ed09 100644 --- a/docs/docs/dev_docs/contracts/common_errors.md +++ b/docs/docs/dev_docs/contracts/common_errors.md @@ -2,7 +2,7 @@ List common errors. -There are two kinds of errors: errors in a noir contract, and errors spat out by an Aztec Sandbox node! +There are two kinds of errors: errors in an Aztec.nr contract, and errors spat out by an Aztec Sandbox node! Maybe even auto-generate error docs, based on error codes in our codebase. diff --git a/docs/docs/dev_docs/contracts/compiling.md b/docs/docs/dev_docs/contracts/compiling.md index 109aa96732b..845ffdf645e 100644 --- a/docs/docs/dev_docs/contracts/compiling.md +++ b/docs/docs/dev_docs/contracts/compiling.md @@ -1,10 +1,10 @@ # Compiling contracts -Once you have written a [contract](../contracts/main.md) in Noir, you will need to compile it into an [artifact](./abi.md) in order to use it. +Once you have written a [contract](../contracts/main.md) in Aztec.nr, you will need to compile it into an [artifact](./abi.md) in order to use it. In this guide we will cover how to do so, both using the CLI and programmatically. -We'll also cover how to generate a helper [TypeScript interface](#typescript-interfaces) and a [Noir interface](#noir-interfaces) for easily interacting with your contract from your typescript app and from other noir contracts, respectively. +We'll also cover how to generate a helper [TypeScript interface](#typescript-interfaces) and an [Aztec.nr interface](#noir-interfaces) for easily interacting with your contract from your typescript app and from other Aztec.nr contracts, respectively. ## Prerequisites @@ -76,13 +76,13 @@ export class PrivateTokenContract extends ContractBase { Read more about interacting with contracts using `aztec.js` [here](../dapps/main.md). -### Noir interfaces +### Aztec.nr interfaces -A Noir contract can [call a function](./functions.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serialising the arguments, which is not type-safe. +An Aztec.nr contract can [call a function](./functions.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serialising the arguments, which is not type-safe. To make this easier, the compiler can generate contract interface structs that expose a convenience method for each function listed in a given contract ABI. These structs are intended to be used from another contract project that calls into the current one. For each contract, two interface structs are generated: one to be used from private functions with a `PrivateContext`, and one to be used from open functions with a `PublicContext`. -To generate them, include a `--interface` option in the compile command with a path to the target folder for the generated Noir interface files: +To generate them, include a `--interface` option in the compile command with a path to the target folder for the generated Aztec.nr interface files: ``` aztec-cli compile --interface ./path/to/another_aztec_contract_project/src ./path/to/my_aztec_contract_project @@ -128,7 +128,7 @@ impl PrivateTokenPrivateContextInterface { } ``` -Read more about how to use the Noir interfaces [here](./functions.md#contract-interface). +Read more about how to use the Aztec.nr interfaces [here](./functions.md#contract-interface). :::info At the moment, the compiler generates these interfaces from already compiled ABIs, and not from source code. This means that you should not import a generated interface from within the same project as its source contract, or you risk circular references. @@ -143,9 +143,9 @@ npm install @aztec/noir-compiler ` The compiler exposes the following functions: -- `compileUsingNargo`: Compiles a Noir project in the target folder using the `nargo` binary available on the shell `PATH` and returns the generated ABIs. +- `compileUsingNargo`: Compiles an Aztec.nr project in the target folder using the `nargo` binary available on the shell `PATH` and returns the generated ABIs. - `generateTypescriptContractInterface`: Generates a typescript class for the given contract ABI. -- `generateNoirContractInterface`: Generates a Noir interface struct for the given contract ABI. +- `generateNoirContractInterface`: Generates a Aztec.nr interface struct for the given contract ABI. ## Next steps diff --git a/docs/docs/dev_docs/contracts/contract.md b/docs/docs/dev_docs/contracts/contract.md index 9e94abb09ff..211491237ee 100644 --- a/docs/docs/dev_docs/contracts/contract.md +++ b/docs/docs/dev_docs/contracts/contract.md @@ -18,7 +18,7 @@ contract MyContract { ``` -> A note for vanilla Noir devs: There is no [`main()`](https://noir-lang.org/getting_started/breakdown/#mainnr) function within a Noir Contract scope. This is because more than one function of a contract may be called and proven as external (as opposed to inlined by the compiler). +> A note for vanilla Noir devs: There is no [`main()`](https://noir-lang.org/getting_started/breakdown/#mainnr) function within a Noir `contract` scope. This is because more than one function of a contract may be called and proven as external (as opposed to inlined by the compiler). ## Structure of a contract diff --git a/docs/docs/dev_docs/contracts/layout.md b/docs/docs/dev_docs/contracts/layout.md index 2c657d37fc7..a6db7b63a6d 100644 --- a/docs/docs/dev_docs/contracts/layout.md +++ b/docs/docs/dev_docs/contracts/layout.md @@ -2,7 +2,7 @@ ## Directory structure -Here's a common layout for a basic Noir Contract project: +Here's a common layout for a basic Aztec.nr Contract project: ```title="layout of an aztec contract project" ─── my_aztec_contract_project diff --git a/docs/docs/dev_docs/contracts/main.md b/docs/docs/dev_docs/contracts/main.md index 571a4fe3156..b5e5ecc1787 100644 --- a/docs/docs/dev_docs/contracts/main.md +++ b/docs/docs/dev_docs/contracts/main.md @@ -2,7 +2,7 @@ ## What is Aztec.nr? -**Aztec.nr** is a library for writing Aztec smart contracts. +**Aztec.nr** is a framework for writing Aztec smart contracts. ## Nomenclature @@ -12,17 +12,17 @@ A **smart contract** is just a collection of persistent state variables, and a c An **Aztec smart contract** is a smart contract with **private** state variables and **private** functions. -**Aztec.nr** is a library for writing Aztec smart contracts, written in Noir. +**Aztec.nr** is a framework for writing Aztec smart contracts, written in Noir. # Getting started ## Install Noir -To write a Noir Contract, you need to write Noir, and to write Noir, you need to [install Nargo](https://noir-lang.org/getting_started/nargo_installation). +To write an Aztec.nr contract, you need to write Noir, and to write Noir, you need to [install Nargo](https://noir-lang.org/getting_started/nargo_installation). ## Install Noir tooling -There are a number of tools to make writing Noir Contracts more pleasant. See [here](https://github.com/noir-lang/awesome-noir#get-coding). +There are a number of tools to make writing Aztec.nr contracts more pleasant. See [here](https://github.com/noir-lang/awesome-noir#get-coding). ## Quick start @@ -30,7 +30,8 @@ There are a number of tools to make writing Noir Contracts more pleasant. See [h Starter kit ::: -## Example Noir Contract + +## 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. diff --git a/docs/docs/dev_docs/contracts/types.md b/docs/docs/dev_docs/contracts/types.md index de66faed98b..a7e81ff0027 100644 --- a/docs/docs/dev_docs/contracts/types.md +++ b/docs/docs/dev_docs/contracts/types.md @@ -1,2 +1,2 @@ See Noir docs for Noir types. -See [state_variables](./state_variables.md) for Noir Contract state variable types. \ No newline at end of file +See [state_variables](./state_variables.md) for Aztec.nr state variable types. \ No newline at end of file diff --git a/docs/docs/dev_docs/contracts/workflow.md b/docs/docs/dev_docs/contracts/workflow.md index f208a34e33b..9ebe0ac2431 100644 --- a/docs/docs/dev_docs/contracts/workflow.md +++ b/docs/docs/dev_docs/contracts/workflow.md @@ -1,4 +1,4 @@ -# Noir contract workflow +# Aztec.nr smart contract workflow ## Write diff --git a/docs/docs/dev_docs/dapps/main.md b/docs/docs/dev_docs/dapps/main.md index cf4484cd4eb..d267ad9a162 100644 --- a/docs/docs/dev_docs/dapps/main.md +++ b/docs/docs/dev_docs/dapps/main.md @@ -21,7 +21,7 @@ Explain how to write a dapp using [`aztec.js`](https://github.com/AztecProtocol/ - Use the e2e tests as inspiration. - Instantiate a contract - Deploy a contract - - How to generate a nice typescript interface for a Noir Contract's functions (we have a little `.ts` program in `noir-contracts` to generate a types file at the moment... how would a user do this?) + - How to generate a nice typescript interface for an Aztec.nr contract's functions (we have a little `.ts` program in `noir-contracts` to generate a types file at the moment... how would a user do this?) - Call 'view' functions - Simulate functions (simulate the result, without sending to the 'network') - Execute functions (send them to the 'network') diff --git a/docs/docs/dev_docs/getting_started/sandbox.md b/docs/docs/dev_docs/getting_started/sandbox.md index 8f2dc173a20..fc31b6708da 100644 --- a/docs/docs/dev_docs/getting_started/sandbox.md +++ b/docs/docs/dev_docs/getting_started/sandbox.md @@ -6,7 +6,7 @@ import Image from "@theme/IdealImage"; ## Introduction -The Aztec Sandbox aims to provide a local development system against which you can build and test Noir contracts in a fast, safe, and free environment. +The Aztec Sandbox aims to provide a local development system against which you can build and test Aztec.nr contracts in a fast, safe, and free environment. Here we will walkthrough the process of retrieving the Sandbox, installing the client libraries and using it to deploy and use a fully private token contract on the Aztec network. diff --git a/docs/docs/dev_docs/sandbox/common_errors.md b/docs/docs/dev_docs/sandbox/common_errors.md index 5552601ff65..c13345e00dd 100644 --- a/docs/docs/dev_docs/sandbox/common_errors.md +++ b/docs/docs/dev_docs/sandbox/common_errors.md @@ -26,7 +26,7 @@ For static calls, new commitments aren't allowed For static calls, new nullifiers aren't allowed #### 2009 - PRIVATE_KERNEL__NON_PRIVATE_FUNCTION_EXECUTED_WITH_PRIVATE_KERNEL -You cannot execute a public noir function in the private kernel +You cannot execute a public Aztec.nr function in the private kernel #### 2011 - PRIVATE_KERNEL__UNSUPPORTED_OP You are trying to do something that is currently unsupported in the private kernel. If this is a blocker feel free to open up an issue on our monorepo [aztec3-packages](https://github.com/AztecProtocol/aztec3-packages/tree/master) or reach out to us on discord @@ -34,7 +34,7 @@ You are trying to do something that is currently unsupported in the private kern Note that certain operations are unsupported on certain versions of the private kernel. Eg static calls are allowed for all but the initial iteration of the private kernel (which initialises the kernel for subsequent function calls). #### 2012 - PRIVATE_KERNEL__CONTRACT_ADDRESS_MISMATCH -For the initial iteration of the private kernel, only the expected noir contract should be the entrypoint. Static and delegate calls are not allowed in the initial iteration. +For the initial iteration of the private kernel, only the expected Aztec.nr contract should be the entrypoint. Static and delegate calls are not allowed in the initial iteration. #### 2013 - PRIVATE_KERNEL__NON_PRIVATE_KERNEL_VERIFIED_WITH_PRIVATE_KERNEL The previous kernel iteration within the private kernel must also be private @@ -46,7 +46,7 @@ A constructor must be executed as the first tx in the recursion i.e. a construct Confirms that the TxRequest (user's intent) matches the private call being executed. This error may happen when: * origin address of tx_request doesn't match call_stack_item's contract_address * tx_request.function_data doesn't match call_stack_item.function_data -* noir function args passed to tx_request doesn't match args in the call_stack_item +* Aztec.nr function args passed to tx_request doesn't match args in the call_stack_item #### 2018 - PRIVATE_KERNEL__READ_REQUEST_PRIVATE_DATA_ROOT_MISMATCH Given a read request and provided witness, we check that the merkle root obtained from the witness' sibling path and it's leaf is similar to the historic state root we want to read against. This is a sanity check to ensure we are reading from the right state. @@ -65,7 +65,7 @@ But for non transient reads, we do a merkle membership check. Redas are done at You are trying to do something that is currently unsupported in the public kernel. If this is a blocker feel free to open up an issue on our monorepo [aztec3-packages](https://github.com/AztecProtocol/aztec3-packages/tree/master) or reach out to us on discord #### 3002 - PUBLIC_KERNEL__PRIVATE_FUNCTION_NOT_ALLOWED -Calling a private noir function in a public kernel is not allowed. +Calling a private Aztec.nr function in a public kernel is not allowed. #### 3005 - PUBLIC_KERNEL__NON_EMPTY_PRIVATE_CALL_STACK Public functions are executed after all the private functions are (see [private-public execution](../../concepts/foundation/communication/public_private_calls.md)). As such, private call stack must be empty when executing in the public kernel. @@ -109,7 +109,7 @@ The L1 chain ID you used in your proof generation (for your private transaction) #### 4008 - BASE__INVALID_VERSION Same as [section 4007](#4007---base__invalid_chain_id) except the `version` refers to the version of the Aztec L2 instance. -Some scary bugs like `4003 - BASE__INVALID_NULLIFIER_SUBTREE` and `4004 - BASE__INVALID_NULLIFIER_RANGE` which are to do malformed nullifier trees (see [Indexed Merkle Trees](../../concepts/advanced/data_structures/indexed_merkle_tree.md)) etc may seem unrelated at a glance, but at a closer look may be because of some bug in an application's Noir code. Same is true for certain instances of `7008 - MEMBERSHIP_CHECK_FAILED`. +Some scary bugs like `4003 - BASE__INVALID_NULLIFIER_SUBTREE` and `4004 - BASE__INVALID_NULLIFIER_RANGE` which are to do malformed nullifier trees (see [Indexed Merkle Trees](../../concepts/advanced/data_structures/indexed_merkle_tree.md)) etc may seem unrelated at a glance, but at a closer look may be because of some bug in an application's Aztec.nr code. Same is true for certain instances of `7008 - MEMBERSHIP_CHECK_FAILED`. ### Generic circuit errors @@ -119,7 +119,7 @@ Circuits work by having a fixed size array. As such, we have limits on how many * too many new commitments in one tx * too many new nullifiers in one tx - - Note: Nullifiers may be created even outside the context of your noir code. Eg, when creating a contract, we add a nullifier for its address to prevent same address from ever occurring. Similarly, we add a nullifier for your transaction hash too. + - Note: Nullifiers may be created even outside the context of your Aztec.nr code. Eg, when creating a contract, we add a nullifier for its address to prevent same address from ever occurring. Similarly, we add a nullifier for your transaction hash too. * too many private function calls in one tx (i.e. call stack size exceeded) * too many public function calls in one tx (i.e. call stack size exceeded) * too many new L2 to L1 messages in one tx @@ -159,7 +159,7 @@ Users may create a proof against a historic state in Aztec. The rollup circuits * "Public call stack size exceeded" - In Aztec, the sequencer executes all enqueued public functions in a transaction (to prevent race conditions - see [private-public execution](../../concepts/foundation/communication/public_private_calls.md)). This error says there are too many public functions requested. -* "Array size exceeds target length" - happens if you add more items than allowed by the constants set due to our circuit limitations (eg sending too many L2 to L1 messages or creating a function that exceeds the call stack length or return more values than what Noir functions allows) +* "Array size exceeds target length" - happens if you add more items than allowed by the constants set due to our circuit limitations (eg sending too many L2 to L1 messages or creating a function that exceeds the call stack length or returns more values than what Aztec.nr functions allow) * "Failed to publish block" - Happens when sequencer tries to submit its L2 block + proof to the rollup contract. Use the CLI to find any solidity error and then refer the [Contract errors section](#l1-aztec-contract-errors). diff --git a/docs/docs/dev_docs/sandbox/components.md b/docs/docs/dev_docs/sandbox/components.md index 588aeaa016f..cb07a4b6139 100644 --- a/docs/docs/dev_docs/sandbox/components.md +++ b/docs/docs/dev_docs/sandbox/components.md @@ -2,7 +2,11 @@ title: Components --- - + + +:::TODO Outdated +This page needs to be updated. +::: import Disclaimer from '../../misc/common/\_disclaimer.mdx'; @@ -84,10 +88,10 @@ Responsibilities: These tasks are lower priority than providing a handcrafted ABI. -- The ability for a dev to enclose a collection of Noir functions in a 'contract scope'. -- The ability to create a Noir contract abi from the above. +- The ability for a dev to enclose a collection of Aztec.nr functions in a 'contract scope'. +- The ability to create an Aztec.nr contract abi from the above. -Design a Noir Contract ABI, similar to a Solidity ABI which is output by Solc (see [here](https://docs.soliditylang.org/en/v0.8.13/abi-spec.html#json)). It might include for each function: +Design an Aztec.nr Contract ABI, similar to a Solidity ABI which is output by Solc (see [here](https://docs.soliditylang.org/en/v0.8.13/abi-spec.html#json)). It might include for each function: - ACIR opcodes (akin to Solidity bytecode). - Function name and parameter names & types. @@ -109,7 +113,7 @@ aztec.js should always be stateless. It offers the ability to interact with stat The analogous AC component would be the AztecSdk (wraps the CoreSdk which is more analogous to the private client). - Allows a user to create an Aztec keypair. Call `create_account` on Wallet. -- Create a `Contract` instance (similar to web3.js), given a path to a Noir Contract ABI. +- Create a `Contract` instance (similar to web3.js), given a path to an Aztec.nr Contract ABI. - Construct `tx_request` by calling e.g. `contract.get_deployment_request(constructor_args)`. - Call wallet `sign_tx_request(tx_request)` to get signature. - Call `simulate_tx(signed_tx_request)` on the Private Client. In future this would help compute gas, for now we won't actually return gas (it's hard). Returns success or failure, so client knows if it should proceed, and computed kernel circuit public outputs. diff --git a/docs/docs/dev_docs/sandbox/main.md b/docs/docs/dev_docs/sandbox/main.md index 9ddf0ce78ac..2f33ffa684a 100644 --- a/docs/docs/dev_docs/sandbox/main.md +++ b/docs/docs/dev_docs/sandbox/main.md @@ -2,7 +2,7 @@ ## What is the Aztec Sandbox? -The Aztec Sandbox is local development system against which you can build and test Noir contracts in a fast, safe, and free environment. +The Aztec Sandbox is local development system against which you can build and test Aztec.nr contracts in a fast, safe, and free environment. To learn more and to download to for yourself you can visit the [website](https://sandbox.aztec.network). diff --git a/docs/docs/dev_docs/testing/cheat_codes.md b/docs/docs/dev_docs/testing/cheat_codes.md index 4a09ac7f811..458b5f406db 100644 --- a/docs/docs/dev_docs/testing/cheat_codes.md +++ b/docs/docs/dev_docs/testing/cheat_codes.md @@ -382,7 +382,7 @@ Otherwise, it will throw an error. const timestamp = await cc.eth.timestamp(); const newTimestamp = timestamp + 100_000_000; await cc.aztec.warp(newTimestamp); -// any noir contract calls that make use of current timestamp +// any Aztec.nr contract calls that make use of current timestamp // and is executed in the next rollup block will now read `newTimestamp` ``` @@ -395,7 +395,7 @@ public computeSlotInMap(baseSlot: Fr | bigint, key: Fr | bigint): Fr #### Description Compute storage slot for a map key. -The baseSlot is specified in the noir contract. +The baseSlot is specified in the Aztec.nr contract. #### Example ```rust diff --git a/docs/docs/dev_docs/testing/main.md b/docs/docs/dev_docs/testing/main.md index ca7cd33a835..a6adae5114b 100644 --- a/docs/docs/dev_docs/testing/main.md +++ b/docs/docs/dev_docs/testing/main.md @@ -2,8 +2,8 @@ Please use the [TUTORIAL-TEMPLATE](../../TUTORIAL_TEMPLATE.md) for standalone guides / tutorials. -## Testing in Noir +## Testing in Aztec.nr Individual functions can be tested much like [how 'regular Noir' functions can be tested](https://noir-lang.org/nargo/testing). -But a Noir Contract typically tracks state variables, so you'll likely need to write more complex tests in TypeScript, using Aztec.js \ No newline at end of file +But an Aztec.nr contract typically tracks state variables, so you'll likely need to write more complex tests in TypeScript, using Aztec.js \ No newline at end of file diff --git a/docs/docs/dev_docs/wallets/architecture.md b/docs/docs/dev_docs/wallets/architecture.md index 27818b48b9f..2d81c594655 100644 --- a/docs/docs/dev_docs/wallets/architecture.md +++ b/docs/docs/dev_docs/wallets/architecture.md @@ -8,7 +8,7 @@ Architecture-wise, a wallet is an instance of an **Aztec RPC Server** which mana Additionally, a wallet must be able to handle one or more [account contract implementations](../../concepts/foundation/accounts/main.md#account-contracts-and-wallets). When a user creates a new account, the account is represented on-chain by an account contract. The wallet is responsible for deploying and interacting with this contract. A wallet may support multiple flavours of accounts, such as an account that uses ECDSA signatures, or one that relies on WebAuthn, or one that requires multi-factor authentication. For a user, the choice of what account implementation to use is then determined by the wallet they interact with. -In code, this translates to a wallet implementing an **Entrypoint** interface that defines [how to create an _execution request_ out of an array of _function calls_](./main.md#transaction-lifecycle) for the specific implementation of an account contract. Think of the entrypoint interface as the Javascript counterpart of an account contract, or the piece of code that knows how to format and authenticate a transaction based on the rules defined in Noir by the user's account. +In code, this translates to a wallet implementing an **Entrypoint** interface that defines [how to create an _execution request_ out of an array of _function calls_](./main.md#transaction-lifecycle) for the specific implementation of an account contract. Think of the entrypoint interface as the Javascript counterpart of an account contract, or the piece of code that knows how to format and authenticate a transaction based on the rules defined in Aztec.nr by the user's account. ## Entrypoint interface 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 b6ddc219c5d..b1f02e156f7 100644 --- a/docs/docs/dev_docs/wallets/writing_an_account_contract.md +++ b/docs/docs/dev_docs/wallets/writing_an_account_contract.md @@ -14,7 +14,7 @@ For the sake of simplicity, we will hardcode the signing public key into the con ## The account contract -Let's start with the account contract itself in Noir. Create [a new Noir contract project](../contracts/main.md) that will contain a file with the code for the account contract, with a hardcoded public key: +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 @@ -54,7 +54,7 @@ Note the usage of the `_with_packed_args` variant of [`call_public_function` and ## The typescript side of things -Now that we have a valid Noir account contract, we need to write the typescript glue code that will take care of formatting and authenticating transactions so they can be processed by our contract, as well as deploying the contract during account setup. This takes the form of implementing the `AccountContract` interface: +Now that we have a valid Aztec.nr account contract, we need to write the typescript glue code that will take care of formatting and authenticating transactions so they can be processed by our contract, as well as deploying the contract during account setup. This takes the form of implementing the `AccountContract` interface: #include_code account-contract-interface yarn-project/aztec.js/src/account/contract/index.ts typescript diff --git a/l1-contracts/GUIDE_LINES.md b/l1-contracts/GUIDE_LINES.md index 255f85c52a5..650c09befbf 100644 --- a/l1-contracts/GUIDE_LINES.md +++ b/l1-contracts/GUIDE_LINES.md @@ -5,7 +5,7 @@ In the following, there will be guidelines for the process of writing readable, - when optimizing - when reviewing. -In general the language of choice will be Solidity for our L1 contracts, so most of the specific style rules will be having that in mind, but the process for writing it can be adapted slightly for vyper, and will have an extension when Noir contracts are more mature. +In general the language of choice will be Solidity for our L1 contracts, so most of the specific style rules will be having that in mind, but the process for writing it can be adapted slightly for vyper, and will have an extension when Aztec.nr contracts are more mature. ![](https://media.tenor.com/ry_sCXk6wH0AAAAC/pirates-caribbean-code.gif) diff --git a/l1-contracts/src/core/libraries/Decoder.sol b/l1-contracts/src/core/libraries/Decoder.sol index 2de68f9d980..b5f604437fc 100644 --- a/l1-contracts/src/core/libraries/Decoder.sol +++ b/l1-contracts/src/core/libraries/Decoder.sol @@ -401,7 +401,7 @@ library Decoder { // Iterate until all the logs were processed while (remainingLogsLength > 0) { - // The length of the logs emitted by Noir from the function call corresponding to this kernel iteration + // The length of the logs emitted by Aztec.nr from the function call corresponding to this kernel iteration uint256 privateCircuitPublicInputLogsLength = read4(_l2Block, offset); offset += 0x4; diff --git a/yarn-project/acir-simulator/src/acvm/serialize.ts b/yarn-project/acir-simulator/src/acvm/serialize.ts index 8784774486c..00ca0d9de48 100644 --- a/yarn-project/acir-simulator/src/acvm/serialize.ts +++ b/yarn-project/acir-simulator/src/acvm/serialize.ts @@ -127,11 +127,11 @@ export function toAcvmCallPrivateStackItem(item: PrivateCallStackItem): ACVMFiel /** * Converts a public call stack item with the request for executing a public function to - * a set of ACVM fields accepted by the enqueue_public_function_call_oracle Noir function. + * a set of ACVM fields accepted by the enqueue_public_function_call_oracle Aztec.nr function. * Note that only the fields related to the request are serialized: those related to the result * are empty since this is just an execution request, so we don't send them to the circuit. * @param item - The public call stack item to serialize to be passed onto Noir. - * @returns The fields expected by the enqueue_public_function_call_oracle Noir function. + * @returns The fields expected by the enqueue_public_function_call_oracle Aztec.nr function. */ export async function toAcvmEnqueuePublicFunctionResult(item: PublicCallRequest): Promise { return [ diff --git a/yarn-project/acir-simulator/src/client/client_execution_context.ts b/yarn-project/acir-simulator/src/client/client_execution_context.ts index 550490b48be..5dc9ff7d549 100644 --- a/yarn-project/acir-simulator/src/client/client_execution_context.ts +++ b/yarn-project/acir-simulator/src/client/client_execution_context.ts @@ -186,7 +186,7 @@ export class ClientTxExecutionContext { }); // TODO: notice, that if we don't have a note in our DB, we don't know how big the preimage needs to be, and so we don't actually know how many dummy notes to return, or big to make those dummy notes, or where to position `is_some` booleans to inform the noir program that _all_ the notes should be dummies. - // By a happy coincidence, a `0` field is interpreted as `is_none`, and since in this case (of an empty db) we'll return all zeros (paddedZeros), the noir program will treat the returned data as all dummies, but this is luck. Perhaps a preimage size should be conveyed by the get_notes noir oracle? + // By a happy coincidence, a `0` field is interpreted as `is_none`, and since in this case (of an empty db) we'll return all zeros (paddedZeros), the noir program will treat the returned data as all dummies, but this is luck. Perhaps a preimage size should be conveyed by the get_notes Aztec.nr oracle? const preimageLength = notes?.[0]?.preimage.length ?? 0; if ( !notes.every(({ preimage }) => { diff --git a/yarn-project/acir-simulator/src/client/db_oracle.ts b/yarn-project/acir-simulator/src/client/db_oracle.ts index 2392e382495..cb3c77b113c 100644 --- a/yarn-project/acir-simulator/src/client/db_oracle.ts +++ b/yarn-project/acir-simulator/src/client/db_oracle.ts @@ -27,7 +27,7 @@ export interface NoteData { } /** - * The format that noir uses to get L1 to L2 Messages. + * The format that Aztec.nr uses to get L1 to L2 Messages. */ export interface MessageLoadOracleInputs { /** diff --git a/yarn-project/acir-simulator/src/client/debug.ts b/yarn-project/acir-simulator/src/client/debug.ts index 21efa0e576c..a6e7d97d075 100644 --- a/yarn-project/acir-simulator/src/client/debug.ts +++ b/yarn-project/acir-simulator/src/client/debug.ts @@ -24,7 +24,7 @@ export function acvmFieldMessageToString(msg: ACVMField[]): string { } /** - * Format a debug string for Noir filling in `'{0}'` entries with their + * Format a debug string for Aztec.nr filling in `'{0}'` entries with their * corresponding values from the args array. * * @param formatStr - str of form `'this is a string with some entries like {0} and {1}'` 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 d45cbddf93b..3ba37e9f200 100644 --- a/yarn-project/acir-simulator/src/client/private_execution.test.ts +++ b/yarn-project/acir-simulator/src/client/private_execution.test.ts @@ -223,7 +223,7 @@ describe('Private Execution test suite', () => { const storageSlot = Fr.random(); const note = buildNote(60n, owner, storageSlot); - // Should be the same as how we compute the values for the ValueNote in the noir library. + // Should be the same as how we compute the values for the ValueNote in the Aztec.nr library. const valueNoteHash = pedersenPlookupCommitInputs( circuitsWasm, note.preimage.map(f => f.toBuffer()), @@ -451,7 +451,7 @@ describe('Private Execution test suite', () => { const storageSlot = Fr.random(); const note = buildNote(60n, owner, storageSlot); - // Should be the same as how we compute the values for the ValueNote in the noir library. + // Should be the same as how we compute the values for the ValueNote in the Aztec.nr library. const valueNoteHash = pedersenPlookupCommitInputs( circuitsWasm, note.preimage.map(f => f.toBuffer()), @@ -627,7 +627,7 @@ describe('Private Execution test suite', () => { expect(result.nestedExecutions).toHaveLength(1); expect(result.nestedExecutions[0].callStackItem.publicInputs.returnValues[0]).toEqual(new Fr(privateIncrement)); - // check that Noir calculated the call stack item hash like cpp does + // check that Aztec.nr calculated the call stack item hash like cpp does const wasm = await CircuitsWasm.get(); const expectedCallStackItemHash = computeCallStackItemHash(wasm, result.nestedExecutions[0].callStackItem); expect(result.callStackItem.publicInputs.privateCallStack[0]).toEqual(expectedCallStackItemHash); diff --git a/yarn-project/acir-simulator/src/utils.ts b/yarn-project/acir-simulator/src/utils.ts index fa30e578657..a15b8f74b0f 100644 --- a/yarn-project/acir-simulator/src/utils.ts +++ b/yarn-project/acir-simulator/src/utils.ts @@ -3,7 +3,7 @@ import { Grumpkin, pedersenPlookupCommitInputs } from '@aztec/circuits.js/barret import { Fr } from '@aztec/foundation/fields'; /** - * A point in the format that noir uses. + * A point in the format that Aztec.nr uses. */ export type NoirPoint = { /** The x coordinate. */ diff --git a/yarn-project/aztec-rpc/src/contract_data_oracle/index.ts b/yarn-project/aztec-rpc/src/contract_data_oracle/index.ts index f398edfe86b..0984e3dcc70 100644 --- a/yarn-project/aztec-rpc/src/contract_data_oracle/index.ts +++ b/yarn-project/aztec-rpc/src/contract_data_oracle/index.ts @@ -5,7 +5,7 @@ import { ContractCommitmentProvider, ContractDatabase } from '@aztec/types'; import { ContractTree } from '../contract_tree/index.js'; /** - * ContractDataOracle serves as a data manager and retriever for noir contracts. + * ContractDataOracle serves as a data manager and retriever for Aztec.nr contracts. * It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses * from a given contract address and function selector. The class maintains a cache of ContractTree instances * to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch diff --git a/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts b/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts index 72fd032da4a..9feaa2d9b89 100644 --- a/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts +++ b/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts @@ -217,7 +217,7 @@ async function main() { // 3. Claim WETH on L2 logger('Minting weth on L2'); - // Call the mint tokens function on the noir contract + // Call the mint tokens function on the Aztec.nr contract const consumptionTx = wethL2Contract.methods .mint(wethAmountToBridge, owner.address, messageKey, secret, ethAccount.toField()) .send(); @@ -298,7 +298,7 @@ async function main() { // 6. claim dai on L2 logger('Consuming messages to mint dai on L2'); - // Call the mint tokens function on the noir contract + // Call the mint tokens function on the Aztec.nr contract const daiMintTx = daiL2Contract.methods .mint(daiAmountToBridge, owner.address, depositDaiMessageKey, secret, ethAccount.toField()) .send(); diff --git a/yarn-project/aztec.js/src/contract_deployer/contract_deployer.ts b/yarn-project/aztec.js/src/contract_deployer/contract_deployer.ts index fb9a9b14ea7..c01f4490025 100644 --- a/yarn-project/aztec.js/src/contract_deployer/contract_deployer.ts +++ b/yarn-project/aztec.js/src/contract_deployer/contract_deployer.ts @@ -6,7 +6,7 @@ import { DeployMethod } from './deploy_method.js'; /** * A class for deploying contract. - * @remarks Keeping this around even though we have noir contract types because it can be useful for non-TS users. + * @remarks Keeping this around even though we have Aztec.nr contract types because it can be useful for non-TS users. */ export class ContractDeployer { constructor(private abi: ContractAbi, private arc: AztecRPC, private publicKey?: PublicKey) {} diff --git a/yarn-project/aztec.js/src/utils/cheat_codes.ts b/yarn-project/aztec.js/src/utils/cheat_codes.ts index 1dc12106108..d5e644e6ff4 100644 --- a/yarn-project/aztec.js/src/utils/cheat_codes.ts +++ b/yarn-project/aztec.js/src/utils/cheat_codes.ts @@ -151,7 +151,7 @@ export class EthCheatCodes { /** * Computes the slot value for a given map and key. - * @param baseSlot - The base slot of the map (specified in noir contract) + * @param baseSlot - The base slot of the map (specified in Aztec.nr contract) * @param key - The key to lookup in the map * @returns The storage slot of the value in the map */ @@ -228,7 +228,7 @@ export class AztecCheatCodes { /** * Computes the slot value for a given map and key. - * @param baseSlot - The base slot of the map (specified in noir contract) + * @param baseSlot - The base slot of the map (specified in Aztec.nr contract) * @param key - The key to lookup in the map * @returns The storage slot of the value in the map */ diff --git a/yarn-project/bootstrap.sh b/yarn-project/bootstrap.sh index f3ad539416e..78be8c3e692 100755 --- a/yarn-project/bootstrap.sh +++ b/yarn-project/bootstrap.sh @@ -16,7 +16,7 @@ set -eu yarn install --immutable -# Build the necessary dependencies for noir contracts typegen. +# Build the necessary dependencies for Aztec.nr contracts typegen. for DIR in foundation noir-compiler circuits.js; do echo "Building $DIR..." cd $DIR @@ -24,7 +24,7 @@ for DIR in foundation noir-compiler circuits.js; do cd .. done -# Run remake bindings before building noir contracts or l1 contracts as they depend on files created by it. +# Run remake bindings before building Aztec.nr contracts or l1 contracts as they depend on files created by it. yarn --cwd circuits.js remake-bindings yarn --cwd circuits.js remake-constants diff --git a/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts b/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts index f79632c5f83..7a142332a03 100644 --- a/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts +++ b/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts @@ -243,7 +243,7 @@ describe('uniswap_trade_on_l1_from_l2', () => { // 3. Claim WETH on L2 logger('Minting weth on L2'); - // Call the mint tokens function on the noir contract + // Call the mint tokens function on the Aztec.nr contract const consumptionTx = wethL2Contract.methods .mint(wethAmountToBridge, owner, messageKey, secret, ethAccount.toField()) .send(); @@ -324,7 +324,7 @@ describe('uniswap_trade_on_l1_from_l2', () => { // 6. claim dai on L2 logger('Consuming messages to mint dai on L2'); - // Call the mint tokens function on the noir contract + // Call the mint tokens function on the Aztec.nr contract const daiMintTx = daiL2Contract.methods .mint(daiAmountToBridge, owner, depositDaiMessageKey, secret, ethAccount.toField()) .send(); diff --git a/yarn-project/circuits.js/src/structs/verification_key.test.ts b/yarn-project/circuits.js/src/structs/verification_key.test.ts index 40256ed8613..7dd17b375dc 100644 --- a/yarn-project/circuits.js/src/structs/verification_key.test.ts +++ b/yarn-project/circuits.js/src/structs/verification_key.test.ts @@ -1,7 +1,7 @@ import { VerificationKey } from './verification_key.js'; describe('structs/verification_key', () => { - // The VK below was grabbed from the noir contract artifact child_contract.json + // The VK below was grabbed from the Aztec.nr contract artifact child_contract.json it(`can deserialize vk built by noir`, () => { const serialized = `0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f`; const vk = VerificationKey.fromBuffer(Buffer.from(serialized, 'hex')); diff --git a/yarn-project/cli/README.md b/yarn-project/cli/README.md index e2ec0163948..87f643a669f 100644 --- a/yarn-project/cli/README.md +++ b/yarn-project/cli/README.md @@ -135,7 +135,7 @@ aztec-cli create-account ### deploy -Deploys a compiled Noir contract to Aztec. +Deploys a compiled Aztec.nr contract to Aztec. Syntax: @@ -145,12 +145,12 @@ aztec-cli deploy [options] Options: -- `-c, --contract-abi `: Path to the compiled Noir contract's ABI file in JSON format. You can also use one of Aztec's example contracts found in [@aztec/noir-contracts](https://www.npmjs.com/package/@aztec/noir-contracts), e.g. PrivateTokenContractAbi. You can get a full ist of the available contracts with `aztec-cli example-contracts` +- `-c, --contract-abi `: Path to the compiled Aztec.nr contract's ABI file in JSON format. You can also use one of Aztec's example contracts found in [@aztec/noir-contracts](https://www.npmjs.com/package/@aztec/noir-contracts), e.g. PrivateTokenContractAbi. You can get a full ist of the available contracts with `aztec-cli example-contracts` - `-a, --args ` (optional): Contract constructor arguments Default: []. - `-u, --rpc-url `: URL of the Aztec RPC. Default: `http://localhost:8080`. - `-k, --public-key `: Public key of the deployer. If not provided, it will check the RPC for existing ones. -This command deploys a compiled Noir contract to Aztec. It requires the path to the contract's ABI file in JSON format. Optionally, you can specify the public key of the deployer and provide constructor arguments for the contract. The command displays the address of the deployed contract. +This command deploys a compiled Aztec.nr contract to Aztec. It requires the path to the contract's ABI file in JSON format. Optionally, you can specify the public key of the deployer and provide constructor arguments for the contract. The command displays the address of the deployed contract. Example usage: diff --git a/yarn-project/cli/src/index.ts b/yarn-project/cli/src/index.ts index b1ac8bb4c7c..a597a07e21f 100644 --- a/yarn-project/cli/src/index.ts +++ b/yarn-project/cli/src/index.ts @@ -148,10 +148,10 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { program .command('deploy') - .description('Deploys a compiled Noir contract to Aztec.') + .description('Deploys a compiled Aztec.nr contract to Aztec.') .argument( '', - "A compiled Noir contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", + "A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", ) .option('-a, --args ', 'Contract constructor arguments', []) .option('-u, --rpc-url ', 'URL of the Aztec RPC', AZTEC_RPC_HOST || 'http://localhost:8080') @@ -360,7 +360,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { .option('-a, --args [functionArgs...]', 'Function arguments', []) .requiredOption( '-c, --contract-abi ', - "A compiled Noir contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", + "A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", ) .requiredOption('-ca, --contract-address
', 'Aztec address of the contract.') .option('-k, --private-key ', "The sender's private key.", PRIVATE_KEY) @@ -406,7 +406,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { .option('-a, --args [functionArgs...]', 'Function arguments', []) .requiredOption( '-c, --contract-abi ', - "A compiled Noir contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", + "A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", ) .requiredOption('-ca, --contract-address
', 'Aztec address of the contract.') .option('-f, --from ', 'Public key of the TX viewer. If empty, will try to find account in RPC.') @@ -438,7 +438,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { .argument('', 'The encoded hex string') .requiredOption( '-c, --contract-abi ', - "A compiled Noir contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", + "A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts", ) .requiredOption('-p, --parameter ', 'The name of the struct parameter to decode into') .action(async (encodedString, options) => { 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 24edd48610b..2c8d21403ee 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 @@ -64,7 +64,7 @@ describe('e2e_pending_commitments_contract', () => { return contract; }; - it('Noir function can "get" notes it just "inserted"', async () => { + it('Aztec.nr function can "get" notes it just "inserted"', async () => { const mintAmount = 65n; const deployedContract = await deployContract(); @@ -76,7 +76,7 @@ describe('e2e_pending_commitments_contract', () => { expect(receipt.status).toBe(TxStatus.MINED); }, 60_000); - it('Squash! Noir function can "create" and "nullify" note in the same TX', async () => { + it('Squash! Aztec.nr function can "create" and "nullify" note in the same TX', async () => { // Kernel will squash the noteHash and its nullifier. // Realistic way to describe this test is "Mint note A, then burn note A in the same transaction" const mintAmount = 65n; @@ -101,7 +101,7 @@ describe('e2e_pending_commitments_contract', () => { await expectNullifiersSquashedExcept(0); }, 60_000); - it('Squash! Noir function can "create" 2 notes and "nullify" both in the same TX', async () => { + it('Squash! Aztec.nr function can "create" 2 notes and "nullify" both in the same TX', async () => { // Kernel will squash both noteHashes and their nullifier. // Realistic way to describe this test is "Mint notes A and B, then burn both in the same transaction" const mintAmount = 65n; @@ -125,7 +125,7 @@ describe('e2e_pending_commitments_contract', () => { await expectNullifiersSquashedExcept(0); }, 60_000); - it('Squash! Noir function can "create" 2 notes and "nullify" 1 in the same TX (kernel will squash one note + nullifier)', async () => { + it('Squash! Aztec.nr function can "create" 2 notes and "nullify" 1 in the same TX (kernel will squash one note + nullifier)', async () => { // Kernel will squash one noteHash and its nullifier. // The other note will become persistent! // Realistic way to describe this test is "Mint notes A and B, then burn note A in the same transaction" @@ -150,7 +150,7 @@ describe('e2e_pending_commitments_contract', () => { await expectNullifiersSquashedExcept(0); }, 60_000); - it('Squash! Noir function can nullify a pending note and a persistent in the same TX', async () => { + it('Squash! Aztec.nr function can nullify a pending note and a persistent in the same TX', async () => { // Create 1 note in isolated TX. // Then, in a separate TX, create 1 new note and nullify BOTH notes. // In this second TX, the kernel will squash one note + nullifier, diff --git a/yarn-project/end-to-end/src/fixtures/cross_chain_test_harness.ts b/yarn-project/end-to-end/src/fixtures/cross_chain_test_harness.ts index ad71a3f1733..9084a112687 100644 --- a/yarn-project/end-to-end/src/fixtures/cross_chain_test_harness.ts +++ b/yarn-project/end-to-end/src/fixtures/cross_chain_test_harness.ts @@ -166,7 +166,7 @@ export class CrossChainTestHarness { async consumeMessageOnAztecAndMintSecretly(bridgeAmount: bigint, messageKey: Fr, secret: Fr) { this.logger('Consuming messages on L2 secretively'); - // Call the mint tokens function on the noir contract + // Call the mint tokens function on the Aztec.nr contract const consumptionTx = this.l2Contract.methods .mint(bridgeAmount, this.ownerAddress, messageKey, secret, this.ethAccount.toField()) .send(); @@ -178,7 +178,7 @@ export class CrossChainTestHarness { async consumeMessageOnAztecAndMintPublicly(bridgeAmount: bigint, messageKey: Fr, secret: Fr) { this.logger('Consuming messages on L2 Publicly'); - // Call the mint tokens function on the noir contract + // Call the mint tokens function on the Aztec.nr contract const consumptionTx = this.l2Contract.methods .mintPublic(bridgeAmount, this.ownerAddress, messageKey, secret, this.ethAccount.toField()) .send(); diff --git a/yarn-project/foundation/src/abi/abi.ts b/yarn-project/foundation/src/abi/abi.ts index 0fecd88c5cd..18dd0dd2793 100644 --- a/yarn-project/foundation/src/abi/abi.ts +++ b/yarn-project/foundation/src/abi/abi.ts @@ -96,7 +96,7 @@ export interface StructType extends BasicType<'struct'> { } /** - * Noir function types. + * Aztec.nr function types. */ export enum FunctionType { SECRET = 'secret', diff --git a/yarn-project/foundation/src/abi/decoder.ts b/yarn-project/foundation/src/abi/decoder.ts index 0dfbe09708c..cece6e9d949 100644 --- a/yarn-project/foundation/src/abi/decoder.ts +++ b/yarn-project/foundation/src/abi/decoder.ts @@ -62,7 +62,7 @@ class ReturnValuesDecoder { /** * Decodes all the return values for the given function ABI. - * Noir support only single return value + * Aztec.nr support only single return value * The return value can however be simple types, structs or arrays * @returns The decoded return values. */ diff --git a/yarn-project/noir-compiler/README.md b/yarn-project/noir-compiler/README.md index 92558025bbb..ade6f9bfa0c 100644 --- a/yarn-project/noir-compiler/README.md +++ b/yarn-project/noir-compiler/README.md @@ -1,6 +1,6 @@ -# Aztec Noir compiler +# Aztec.nr compiler -The Aztec noir compiler compiles noir contracts using nargo and outputs Aztec formatted contract ABIs. The compiler can also generate typescript classes for each contract, as well as Noir interfaces for calling external functions. +The Aztec.nr compiler compiles Aztec.nr contracts using nargo and outputs Aztec formatted contract ABIs. The compiler can also generate typescript classes for each contract, as well as Aztec.nr interfaces for calling external functions. ## Installation diff --git a/yarn-project/noir-compiler/package.json b/yarn-project/noir-compiler/package.json index 067b9a5c6d9..7ef409d0bb4 100644 --- a/yarn-project/noir-compiler/package.json +++ b/yarn-project/noir-compiler/package.json @@ -10,7 +10,7 @@ "entryPoints": [ "./src/index.ts" ], - "name": "Aztec noir compiler", + "name": "Aztec.nr compiler", "tsconfig": "./tsconfig.json" }, "bin": { diff --git a/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap b/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap index 4a4607ed288..5defbe9affe 100644 --- a/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap +++ b/yarn-project/noir-compiler/src/__snapshots__/index.test.ts.snap @@ -3,9 +3,167 @@ exports[`noir-compiler using nargo binary compiles the test contract 1`] = ` [ { + "debug": { + "debugSymbols": [ + "eJyrVsrJT04syczPK1ayqlYyULKKrlYqLkjMA/GKSxKLSpSsDE0MdZRS81KALFOzWh2ltMycVCC7VgdDpbEJVKGZOVydsQkWhUYGMJVGxkhKa2N1lAwH2gm1tQDKLFO0", + "eJyrVsrJT04syczPK1ayqq6tBQAz9wY7", + ], + "fileMap": { + "3": { + "path": "std/hash", + "source": "mod poseidon; + +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} + +#[foreign(blake2s)] +fn blake2s(_input : [u8; N]) -> [u8; 32] {} + +fn pedersen(input : [Field; N]) -> [Field; 2] { + pedersen_with_separator(input, 0) +} + +#[foreign(pedersen)] +fn pedersen_with_separator(_input : [Field; N], _separator : u32) -> [Field; 2] {} + +#[foreign(hash_to_field_128_security)] +fn hash_to_field(_input : [Field; N]) -> Field {} + +#[foreign(keccak256)] +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] {} + +// mimc-p/p implementation +// constants are (publicly generated) random numbers, for instance using keccak as a ROM. +// You must use constants generated for the native field +// Rounds number should be ~ log(p)/log(exp) +// For 254 bit primes, exponent 7 and 91 rounds seems to be recommended +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field { + //round 0 + let mut t = x + k; + let mut h = t.pow_32(exp); + //next rounds + for i in 1 .. constants.len() { + t = h + k + constants[i]; + h = t.pow_32(exp); + }; + h + k +} + +global MIMC_BN254_ROUNDS = 91; + +//mimc implementation with hardcoded parameters for BN254 curve. +fn mimc_bn254(array: [Field; N]) -> Field { + //mimc parameters + let exponent = 7; + //generated from seed "mimc" using keccak256 + let constants: [Field; MIMC_BN254_ROUNDS] = [ + 0, + 20888961410941983456478427210666206549300505294776164667214940546594746570981, + 15265126113435022738560151911929040668591755459209400716467504685752745317193, + 8334177627492981984476504167502758309043212251641796197711684499645635709656, + 1374324219480165500871639364801692115397519265181803854177629327624133579404, + 11442588683664344394633565859260176446561886575962616332903193988751292992472, + 2558901189096558760448896669327086721003508630712968559048179091037845349145, + 11189978595292752354820141775598510151189959177917284797737745690127318076389, + 3262966573163560839685415914157855077211340576201936620532175028036746741754, + 17029914891543225301403832095880481731551830725367286980611178737703889171730, + 4614037031668406927330683909387957156531244689520944789503628527855167665518, + 19647356996769918391113967168615123299113119185942498194367262335168397100658, + 5040699236106090655289931820723926657076483236860546282406111821875672148900, + 2632385916954580941368956176626336146806721642583847728103570779270161510514, + 17691411851977575435597871505860208507285462834710151833948561098560743654671, + 11482807709115676646560379017491661435505951727793345550942389701970904563183, + 8360838254132998143349158726141014535383109403565779450210746881879715734773, + 12663821244032248511491386323242575231591777785787269938928497649288048289525, + 3067001377342968891237590775929219083706800062321980129409398033259904188058, + 8536471869378957766675292398190944925664113548202769136103887479787957959589, + 19825444354178182240559170937204690272111734703605805530888940813160705385792, + 16703465144013840124940690347975638755097486902749048533167980887413919317592, + 13061236261277650370863439564453267964462486225679643020432589226741411380501, + 10864774797625152707517901967943775867717907803542223029967000416969007792571, + 10035653564014594269791753415727486340557376923045841607746250017541686319774, + 3446968588058668564420958894889124905706353937375068998436129414772610003289, + 4653317306466493184743870159523234588955994456998076243468148492375236846006, + 8486711143589723036499933521576871883500223198263343024003617825616410932026, + 250710584458582618659378487568129931785810765264752039738223488321597070280, + 2104159799604932521291371026105311735948154964200596636974609406977292675173, + 16313562605837709339799839901240652934758303521543693857533755376563489378839, + 6032365105133504724925793806318578936233045029919447519826248813478479197288, + 14025118133847866722315446277964222215118620050302054655768867040006542798474, + 7400123822125662712777833064081316757896757785777291653271747396958201309118, + 1744432620323851751204287974553233986555641872755053103823939564833813704825, + 8316378125659383262515151597439205374263247719876250938893842106722210729522, + 6739722627047123650704294650168547689199576889424317598327664349670094847386, + 21211457866117465531949733809706514799713333930924902519246949506964470524162, + 13718112532745211817410303291774369209520657938741992779396229864894885156527, + 5264534817993325015357427094323255342713527811596856940387954546330728068658, + 18884137497114307927425084003812022333609937761793387700010402412840002189451, + 5148596049900083984813839872929010525572543381981952060869301611018636120248, + 19799686398774806587970184652860783461860993790013219899147141137827718662674, + 19240878651604412704364448729659032944342952609050243268894572835672205984837, + 10546185249390392695582524554167530669949955276893453512788278945742408153192, + 5507959600969845538113649209272736011390582494851145043668969080335346810411, + 18177751737739153338153217698774510185696788019377850245260475034576050820091, + 19603444733183990109492724100282114612026332366576932662794133334264283907557, + 10548274686824425401349248282213580046351514091431715597441736281987273193140, + 1823201861560942974198127384034483127920205835821334101215923769688644479957, + 11867589662193422187545516240823411225342068709600734253659804646934346124945, + 18718569356736340558616379408444812528964066420519677106145092918482774343613, + 10530777752259630125564678480897857853807637120039176813174150229243735996839, + 20486583726592018813337145844457018474256372770211860618687961310422228379031, + 12690713110714036569415168795200156516217175005650145422920562694422306200486, + 17386427286863519095301372413760745749282643730629659997153085139065756667205, + 2216432659854733047132347621569505613620980842043977268828076165669557467682, + 6309765381643925252238633914530877025934201680691496500372265330505506717193, + 20806323192073945401862788605803131761175139076694468214027227878952047793390, + 4037040458505567977365391535756875199663510397600316887746139396052445718861, + 19948974083684238245321361840704327952464170097132407924861169241740046562673, + 845322671528508199439318170916419179535949348988022948153107378280175750024, + 16222384601744433420585982239113457177459602187868460608565289920306145389382, + 10232118865851112229330353999139005145127746617219324244541194256766741433339, + 6699067738555349409504843460654299019000594109597429103342076743347235369120, + 6220784880752427143725783746407285094967584864656399181815603544365010379208, + 6129250029437675212264306655559561251995722990149771051304736001195288083309, + 10773245783118750721454994239248013870822765715268323522295722350908043393604, + 4490242021765793917495398271905043433053432245571325177153467194570741607167, + 19596995117319480189066041930051006586888908165330319666010398892494684778526, + 837850695495734270707668553360118467905109360511302468085569220634750561083, + 11803922811376367215191737026157445294481406304781326649717082177394185903907, + 10201298324909697255105265958780781450978049256931478989759448189112393506592, + 13564695482314888817576351063608519127702411536552857463682060761575100923924, + 9262808208636973454201420823766139682381973240743541030659775288508921362724, + 173271062536305557219323722062711383294158572562695717740068656098441040230, + 18120430890549410286417591505529104700901943324772175772035648111937818237369, + 20484495168135072493552514219686101965206843697794133766912991150184337935627, + 19155651295705203459475805213866664350848604323501251939850063308319753686505, + 11971299749478202793661982361798418342615500543489781306376058267926437157297, + 18285310723116790056148596536349375622245669010373674803854111592441823052978, + 7069216248902547653615508023941692395371990416048967468982099270925308100727, + 6465151453746412132599596984628739550147379072443683076388208843341824127379, + 16143532858389170960690347742477978826830511669766530042104134302796355145785, + 19362583304414853660976404410208489566967618125972377176980367224623492419647, + 1702213613534733786921602839210290505213503664731919006932367875629005980493, + 10781825404476535814285389902565833897646945212027592373510689209734812292327, + 4212716923652881254737947578600828255798948993302968210248673545442808456151, + 7594017890037021425366623750593200398174488805473151513558919864633711506220, + 18979889247746272055963929241596362599320706910852082477600815822482192194401, + 13602139229813231349386885113156901793661719180900395818909719758150455500533, + ]; + + let mut r = 0; + for elem in array { + let h = mimc(elem, r, constants, exponent); + r = r + elem + h; + } + r +} +", + }, + }, + }, "functions": [ { - "bytecode": "H4sIAAAAAAAA/61RQQ6DQAjEtfU9sIALt36lm67/f0GjRkzWs04ymeEykGECgAQHho1T6Dn/w48bX3DFGPoJxXug4cGs1GUxziKt5EZMX8xeTVG0zkZGavrLxtxMrHj1gk7CjRZ1XiLs/dxd2Hd7+tT9YO9037cCCmnZhZgBAAA=", + "bytecode": "H4sIAAAAAAAA/61Q0QrDMAhMuqXfo1EbfduvLCz9/y8Y66gF6Wt7cJwncsjNKaVH2pE3zq6H//r8v3luLO6n0z7iyHu5wjVgvjFrClkEC/NodSDhG6p1FWDpi6KiqHyqEg1lbdatgSHTwFWMVg8r9/0FsfMcOo49l9DxD+/NSgK4AQAA", "functionType": "secret", "isInternal": false, "name": "constructor", @@ -22,7 +180,7 @@ exports[`noir-compiler using nargo binary compiles the test contract 1`] = ` "verificationKey": "0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f", }, { - "bytecode": "H4sIAAAAAAAA/6WOSwqAMAwFU0+Ub5vsvEqL6f2PIKKCIK6czcBbPGYBgAJv7m29LFhVs3GSUEeO4YZqozo5mdvGLpKu3mJEwyCVpGkhE0/K4wt/wf2r9fAOFP9TANAAAAA=", + "bytecode": "H4sIAAAAAAAA/6WPuw2AMAxEHSbyN7E7VkmEs/8IFIAUCVHxmpOuON3bAKDAm6fb7xSsqtk4Sagjx3BDtVGdnMztYBdJV28xomGQStK0kIkXZdnCX3D/+rp6nNHQ/4XYAAAA", "functionType": "open", "isInternal": false, "name": "openFunction", @@ -40,19 +198,21 @@ exports[`noir-compiler using nargo binary compiles the test contract 1`] = ` ] `; -exports[`noir-compiler using nargo binary generates noir external interface 1`] = ` +exports[`noir-compiler using nargo binary generates Aztec.nr external interface 1`] = ` "/* Autogenerated file, do not edit! */ use dep::std; -use dep::aztec::context::PrivateContext; +use dep::aztec::context::{ PrivateContext, PublicContext }; use dep::aztec::constants_gen::RETURN_VALUES_LENGTH; -struct TestContractContractInterface { + +// Interface for calling TestContract functions from a private context +struct TestContractPrivateContextInterface { address: Field, } -impl TestContractContractInterface { +impl TestContractPrivateContextInterface { fn at(address: Field) -> Self { Self { address, @@ -69,7 +229,34 @@ impl TestContractContractInterface { } } + + + + +// Interface for calling TestContract functions from a public context +struct TestContractPublicContextInterface { + address: Field, +} + +impl TestContractPublicContextInterface { + fn at(address: Field) -> Self { + Self { + address, + } + } + + fn openFunction( + self, + context: PublicContext + ) -> [Field; RETURN_VALUES_LENGTH] { + let mut serialised_args = [0; 0]; + context.call_public_function(self.address, 0x46be982e, serialised_args) + } + +} + + " `; @@ -78,12 +265,12 @@ exports[`noir-compiler using nargo binary generates typescript interface 1`] = ` /* Autogenerated file, do not edit! */ /* eslint-disable */ -import { AztecAddress, ContractBase, ContractFunctionInteraction, ContractMethod, DeployMethod, FieldLike, Wallet } from '@aztec/aztec.js'; +import { AztecAddress, CompleteAddress, ContractBase, ContractFunctionInteraction, ContractMethod, DeployMethod, FieldLike, Wallet } from '@aztec/aztec.js'; import { Fr, Point } from '@aztec/foundation/fields'; import { AztecRPC, PublicKey } from '@aztec/types'; import { ContractAbi } from '@aztec/foundation/abi'; import TestContractContractAbiJson from '../target/test.json' assert { type: 'json' }; -export const TestContractContractAbi = TestContractContractAbiJson as ContractAbi; +export const TestContractContractAbi = TestContractContractAbiJson as unknown as ContractAbi; /** * Type-safe interface for contract TestContract; @@ -91,12 +278,12 @@ export const TestContractContractAbi = TestContractContractAbiJson as ContractAb export class TestContractContract extends ContractBase { private constructor( - /** The deployed contract's address. */ - address: AztecAddress, + /** The deployed contract's complete address. */ + completeAddress: CompleteAddress, /** The wallet. */ wallet: Wallet, ) { - super(address, TestContractContractAbi, wallet); + super(completeAddress, TestContractContractAbi, wallet); } @@ -113,10 +300,11 @@ export class TestContractContract extends ContractBase { /** The wallet. */ wallet: Wallet, ) { - if ((await wallet.getContractData(address)) === undefined) { + const extendedContractData = await wallet.getExtendedContractData(address); + if (extendedContractData === undefined) { throw new Error('Contract ' + address.toString() + ' is not deployed'); } - return new TestContractContract(address, wallet); + return new TestContractContract(extendedContractData.getCompleteAddress(), wallet); } diff --git a/yarn-project/noir-compiler/src/cli/contract.ts b/yarn-project/noir-compiler/src/cli/contract.ts index 020908f0ab0..92243a5a368 100644 --- a/yarn-project/noir-compiler/src/cli/contract.ts +++ b/yarn-project/noir-compiler/src/cli/contract.ts @@ -8,7 +8,7 @@ import path, { resolve } from 'path'; import { compileUsingNargo, generateNoirContractInterface, generateTypescriptContractInterface } from '../index.js'; /** - * Registers a 'contract' command on the given commander program that compiles a Noir contract project. + * Registers a 'contract' command on the given commander program that compiles an Aztec.nr contract project. * @param program - Commander program. * @param log - Optional logging function. * @returns The program with the command registered. @@ -16,10 +16,10 @@ import { compileUsingNargo, generateNoirContractInterface, generateTypescriptCon export function compileContract(program: Command, name = 'contract', log: LogFn = () => {}): Command { return program .command(name) - .argument('', 'Path to the noir project to compile') + .argument('', 'Path to the Aztec.nr project to compile') .option('-o, --outdir ', 'Output folder for the binary artifacts, relative to the project path', 'target') .option('-ts, --typescript ', 'Optional output folder for generating typescript wrappers', undefined) - .option('-i, --interface ', 'Optional output folder for generating noir contract interface', undefined) + .option('-i, --interface ', 'Optional output folder for generating an Aztec.nr contract interface', undefined) .description('Compiles the contracts in the target project') .action( @@ -48,7 +48,9 @@ export function compileContract(program: Command, name = 'contract', log: LogFn if (noirInterface) { const noirInterfacePath = resolve(projectPath, noirInterface, `${contract.name}_interface.nr`); - log(`Writing ${contract.name} Noir external interface to ${path.relative(currentDir, noirInterfacePath)}`); + log( + `Writing ${contract.name} Aztec.nr external interface to ${path.relative(currentDir, noirInterfacePath)}`, + ); const noirWrapper = generateNoirContractInterface(contract); mkdirpSync(path.dirname(noirInterfacePath)); writeFileSync(noirInterfacePath, noirWrapper); diff --git a/yarn-project/noir-compiler/src/compile/nargo.ts b/yarn-project/noir-compiler/src/compile/nargo.ts index 790f4462b84..bba92a98617 100644 --- a/yarn-project/noir-compiler/src/compile/nargo.ts +++ b/yarn-project/noir-compiler/src/compile/nargo.ts @@ -19,7 +19,7 @@ export type CompileOpts = { }; /** - * A class that compiles noir contracts using nargo via the shell. + * A class that compiles Aztec.nr contracts using nargo via the shell. */ export class NargoContractCompiler { private log: LogFn; @@ -28,8 +28,8 @@ export class NargoContractCompiler { } /** - * Compiles the contracts in projectPath and returns the Noir artifact. - * @returns Noir artifact of the compiled contracts. + * Compiles the contracts in projectPath and returns the Aztec.nr artifact. + * @returns Aztec.nr artifact of the compiled contracts. */ public compile(): Promise { const stdio = this.opts.quiet ? 'ignore' : 'inherit'; 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 a6d32037717..ba3f02d48d3 100644 --- a/yarn-project/noir-compiler/src/contract-interface-gen/abi.ts +++ b/yarn-project/noir-compiler/src/contract-interface-gen/abi.ts @@ -6,7 +6,7 @@ import { mockVerificationKey } from '../mocked_keys.js'; import { NoirCompilationArtifacts, NoirFunctionEntry } from '../noir_artifact.js'; /** - * Generates an Aztec ABI for a Noir function build artifact. Replaces verification key with a mock value. + * Generates an Aztec ABI for a Aztec.nr function build artifact. Replaces verification key with a mock value. * @param fn - Noir function entry. * @returns Aztec ABI function entry. */ diff --git a/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts b/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts index cbd9cea1532..8f81f7697ba 100644 --- a/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts +++ b/yarn-project/noir-compiler/src/contract-interface-gen/noir.ts @@ -134,8 +134,8 @@ function generateSerialisation(parameters: ABIParameter[]) { } /** - * Generate a function interface for a particular function of the Noir Contract being processed. This function will be a method of the ContractInterface struct being created here. - * @param functionData - Data relating to the function, which can be used to generate a callable Noir Function. + * Generate a function interface for a particular function of the Aztec.nr Contract being processed. This function will be a method of the ContractInterface struct being created here. + * @param functionData - Data relating to the function, which can be used to generate a callable Aztec.nr Function. * @param kind - Whether this interface will be used from private or public functions. * @returns A code string. */ @@ -272,7 +272,7 @@ ${contractImpl} /** * Generates the Noir code to represent an interface for calling a contract. - * @param abi - The compiled Noir artifact. + * @param abi - The compiled Aztec.nr artifact. * @returns The corresponding ts code. */ export function generateNoirContractInterface(abi: ContractAbi) { diff --git a/yarn-project/noir-compiler/src/index.test.ts b/yarn-project/noir-compiler/src/index.test.ts index 9a09d1fe8f8..804dc88da31 100644 --- a/yarn-project/noir-compiler/src/index.test.ts +++ b/yarn-project/noir-compiler/src/index.test.ts @@ -39,7 +39,7 @@ describe('noir-compiler', () => { expect(result).toMatchSnapshot(); }); - it('generates noir external interface', () => { + it('generates Aztec.nr external interface', () => { const result = generateNoirContractInterface(compiled[0]); expect(result).toMatchSnapshot(); }); diff --git a/yarn-project/noir-compiler/src/index.ts b/yarn-project/noir-compiler/src/index.ts index b7054d89577..85b52ffe7bd 100644 --- a/yarn-project/noir-compiler/src/index.ts +++ b/yarn-project/noir-compiler/src/index.ts @@ -12,7 +12,7 @@ export { generateTypescriptContractInterface } from './contract-interface-gen/ty export { generateAztecAbi }; /** - * Compile Noir contracts in project path using a nargo binary available in the shell. + * Compile Aztec.nr contracts in project path using a nargo binary available in the shell. * @param projectPath - Path to project. * @param opts - Compiler options. * @returns Compiled artifacts. diff --git a/yarn-project/noir-compiler/src/noir_artifact.ts b/yarn-project/noir-compiler/src/noir_artifact.ts index 40eed69101f..f1fab9562a7 100644 --- a/yarn-project/noir-compiler/src/noir_artifact.ts +++ b/yarn-project/noir-compiler/src/noir_artifact.ts @@ -1,9 +1,9 @@ import { ABIParameter, ABIType, DebugFileMap, DebugInfo } from '@aztec/foundation/abi'; -/** The noir function types. */ +/** The Aztec.nr function types. */ type NoirFunctionType = 'Open' | 'Secret' | 'Unconstrained'; -/** The ABI of a noir function. */ +/** The ABI of an Aztec.nr function. */ interface NoirFunctionAbi { /** The parameters of the function. */ parameters: ABIParameter[]; @@ -16,7 +16,7 @@ interface NoirFunctionAbi { } /** - * The compilation result of a noir function. + * The compilation result of an Aztec.nr function. */ export interface NoirFunctionEntry { /** The name of the function. */ @@ -36,7 +36,7 @@ export interface NoirFunctionEntry { } /** - * The compilation result of a noir contract. + * The compilation result of an Aztec.nr contract. */ export interface NoirCompiledContract { /** The name of the contract. */ @@ -48,7 +48,7 @@ export interface NoirCompiledContract { } /** - * The debug metadata of a noir contract. + * The debug metadata of an Aztec.nr contract. */ export interface NoirDebugMetadata { /** diff --git a/yarn-project/noir-contracts/README.md b/yarn-project/noir-contracts/README.md index b4631099f63..33d3ea1518b 100644 --- a/yarn-project/noir-contracts/README.md +++ b/yarn-project/noir-contracts/README.md @@ -1,4 +1,4 @@ -# Noir contracts +# Aztec.nr contracts This package contains the source code and the Aztec ABIs for the example contracts used in tests. diff --git a/yarn-project/noir-contracts/scripts/compile.sh b/yarn-project/noir-contracts/scripts/compile.sh index 972e9652730..09c1d896f6c 100755 --- a/yarn-project/noir-contracts/scripts/compile.sh +++ b/yarn-project/noir-contracts/scripts/compile.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Compiles noir contracts in parallel, bubbling any compilation errors +# Compiles Aztec.nr contracts in parallel, bubbling any compilation errors source ./scripts/catch.sh source ./scripts/nargo_check.sh diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr b/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr index fe9fa044e5e..d2c29d6c6e8 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr +++ b/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr @@ -44,7 +44,7 @@ contract Test { context.this_address() } - // Test codegen for noir interfaces + // Test codegen for Aztec.nr interfaces // See yarn-project/acir-simulator/src/client/private_execution.test.ts 'nested calls through autogenerated interface' // Note; this function is deliberately NOT annotated with #[aztec(private)] due to its use in tests fn testCodeGen( diff --git a/yarn-project/noir-contracts/src/scripts/copy_output.ts b/yarn-project/noir-contracts/src/scripts/copy_output.ts index 05da55f50be..68ec5ca5204 100644 --- a/yarn-project/noir-contracts/src/scripts/copy_output.ts +++ b/yarn-project/noir-contracts/src/scripts/copy_output.ts @@ -88,7 +88,7 @@ const main = () => { writeFileSync(tsInterfaceDestFilePath, generateTypescriptContractInterface(artifactJson, tsAbiImportPath)); log(`Written ${tsInterfaceDestFilePath}`); - // Write a .nr contract interface, for consumption by other Noir Contracts + // 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`; @@ -96,7 +96,7 @@ const main = () => { writeFileSync(noirInterfaceDestFilePath, generateNoirContractInterface(artifactJson)); log(`Written ${noirInterfaceDestFilePath}`); } catch (err) { - log(`Error generating noir interface for ${name}: ${err}`); + log(`Error generating Aztec.nr interface for ${name}: ${err}`); } } }; diff --git a/yarn-project/noir-libs/safe-math/src/safe_u120.nr b/yarn-project/noir-libs/safe-math/src/safe_u120.nr index ccb6ab906a8..5feeb3cca23 100644 --- a/yarn-project/noir-libs/safe-math/src/safe_u120.nr +++ b/yarn-project/noir-libs/safe-math/src/safe_u120.nr @@ -259,11 +259,10 @@ fn test_mul_div_up_ghost_overflow() { // It should not be possible for us to overflow `mul_div_up` through the adder, since that require the divisor to be 1 // since we otherwise would not be at the max value. If divisor is 1, adder is 0. - #[test(should_fail)] fn test_mul_div_up_zero_divisor() { let a = SafeU120::new(6); let b = SafeU120::new(3); let c = SafeU120::new(0); let _d = SafeU120::mul_div_up(a, b, c); -} \ No newline at end of file +} diff --git a/yarn-project/types/src/contract_database.ts b/yarn-project/types/src/contract_database.ts index 7eb2333ed88..f9b8581febb 100644 --- a/yarn-project/types/src/contract_database.ts +++ b/yarn-project/types/src/contract_database.ts @@ -3,7 +3,7 @@ import { AztecAddress } from '@aztec/foundation/aztec-address'; import { ContractDao } from './contract_dao.js'; /** - * Represents a ContractDatabase interface for managing noir contracts. + * Represents a ContractDatabase interface for managing Aztec.nr contracts. * Provides methods for adding and retrieving ContractDao objects by their associated addresses. */ export interface ContractDatabase { diff --git a/yarn-project/yarn-project-base/Dockerfile b/yarn-project/yarn-project-base/Dockerfile index ffcf3abb8c2..dca9635efdc 100644 --- a/yarn-project/yarn-project-base/Dockerfile +++ b/yarn-project/yarn-project-base/Dockerfile @@ -108,7 +108,7 @@ RUN ./scripts/generate-artifacts.sh WORKDIR /usr/src/yarn-project -# Generate noir contract artifacts +# Generate Aztec.nr contract artifacts FROM builder_ as noir_types COPY . . COPY --from=noir /usr/src/yarn-project/noir-contracts/src/contracts /usr/src/yarn-project/noir-contracts/src/contracts @@ -121,7 +121,7 @@ RUN ./scripts/types_all.sh # Run yarn build again to build the types RUN yarn build -# Take noir contract artifacts into the final build image +# Take Aztec.nr contract artifacts into the final build image FROM builder_ as final COPY . . COPY --from=noir_types /usr/src/yarn-project/noir-contracts/src/artifacts /usr/src/yarn-project/noir-contracts/src/artifacts