Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
ddb6abb
fix: relative LogFn import
spypsy Jan 31, 2024
ae6d34b
WIP Moving noir out of yarn-project
spypsy Feb 1, 2024
5feaaff
update gititnore
spypsy Feb 6, 2024
6e9454f
copy contract artifacts in noir-contracts.js
spypsy Feb 6, 2024
162c34c
merge with master
spypsy Feb 6, 2024
586eb86
update noir-contracts references
spypsy Feb 6, 2024
0642f88
merge with master
spypsy Feb 6, 2024
c2afa1b
fresh yarn
spypsy Feb 6, 2024
eff150a
udpate contracts
spypsy Feb 6, 2024
2658d91
bootstraps & ignores
spypsy Feb 7, 2024
eccb350
fix copy-contracts script
spypsy Feb 7, 2024
7c11570
update test_contract
spypsy Feb 7, 2024
b285891
Merge branch 'master' into spy/move-noir
spypsy Feb 7, 2024
9aa0b94
merge conflicts
spypsy Feb 7, 2024
c131cbd
new instance deployer contract
spypsy Feb 7, 2024
251b758
import ContractClassRegisterer
spypsy Feb 7, 2024
c6d2c3c
WIP noir-contracts dockerfile
spypsy Feb 7, 2024
7e7f45b
aztec-nr dockerfile
spypsy Feb 7, 2024
dc08948
update tomls again
spypsy Feb 7, 2024
ee421d2
WIP moving noir-protocol-circuits
spypsy Feb 7, 2024
a2ad617
merge with master
spypsy Feb 7, 2024
cb3b49c
fixing bootstrap
spypsy Feb 7, 2024
383911d
fix workflows, add package.local.json
spypsy Feb 8, 2024
d1a732d
update refs to protocol-circuits
spypsy Feb 8, 2024
95ef564
yarn prepare
spypsy Feb 8, 2024
c25f526
move aztec-nr, dockerize
spypsy Feb 8, 2024
14fde1e
update aztec-nr refs
spypsy Feb 8, 2024
c3b88d5
fix build:contracts in noir-contracts.js
spypsy Feb 8, 2024
e7c3cf7
remove noir from yarn-project-base docker img
spypsy Feb 8, 2024
d5c5061
add new docker images to CI
spypsy Feb 8, 2024
8b89da4
add noir-contracts to yarn-project deps
spypsy Feb 8, 2024
5db6d4a
rm redundant dep
spypsy Feb 8, 2024
8dd91b2
add noir-contracts deps to manifest
spypsy Feb 9, 2024
25795f4
brin in noir-contracts to yarn-project-base
spypsy Feb 9, 2024
64771a7
Fix typo
spypsy Feb 9, 2024
8f9dd58
Merge branch 'master' into spy/move-noir
spypsy Feb 9, 2024
7738b4a
bring in n-p-c
spypsy Feb 9, 2024
7c4beec
update docs
spypsy Feb 9, 2024
9692570
restore versioned docs
spypsy Feb 9, 2024
90476ff
bring in aztec-nr to docs
spypsy Feb 9, 2024
c4e0fac
use local json in codegen types
spypsy Feb 9, 2024
b4bea0a
Merge branch 'master' into spy/move-noir
spypsy Feb 9, 2024
86238a4
bring aztec-nr to boxes
spypsy Feb 9, 2024
6f97eda
fix cli e2e
spypsy Feb 9, 2024
4a09d9a
add aztec-nr dep to docs manifest
spypsy Feb 9, 2024
0fbc798
fix external imports of noir abi artifacts
spypsy Feb 9, 2024
12be3fa
no nargo formatting in yarn-project
spypsy Feb 9, 2024
6aa82fb
Merge branch 'master' into spy/move-noir
spypsy Feb 9, 2024
fd4318b
Fix package.local.json
spypsy Feb 9, 2024
194f34b
more fixes
spypsy Feb 9, 2024
8abf837
upadte guides, add migration notes
spypsy Feb 9, 2024
c805068
fix noir-contracts.js json import
spypsy Feb 9, 2024
664dc4a
Merge branch 'master' into spy/move-noir
spypsy Feb 12, 2024
4a04a4b
update import
spypsy Feb 12, 2024
c467178
update user import noir paths
spypsy Feb 12, 2024
2c1db6b
simplify noir-contracts docker img
spypsy Feb 12, 2024
4a6583a
update noir-protocol-circuits
spypsy Feb 12, 2024
578e52e
move to noir-projects
spypsy Feb 12, 2024
1043ef1
update CI & docker builds
spypsy Feb 12, 2024
f19f6f8
update docs
spypsy Feb 12, 2024
064d28e
migration fixes
spypsy Feb 12, 2024
f9d7643
Merge branch 'master' into spy/move-noir
spypsy Feb 12, 2024
391a008
fix boxes dockerfile
spypsy Feb 12, 2024
7bf0735
fix bootstrap / gates report
spypsy Feb 12, 2024
7c17dec
Merge branch 'master' into spy/move-noir
spypsy Feb 12, 2024
b7da41c
fix nargo imports
spypsy Feb 12, 2024
0f51ad5
fix noir relative dir
spypsy Feb 12, 2024
53becd2
remove old files
spypsy Feb 12, 2024
1b7a538
fix boxes dockerfile typo
spypsy Feb 12, 2024
7d393b0
fix formatting
spypsy Feb 12, 2024
b4f7ee2
Merge branch 'master' into spy/move-noir
spypsy Feb 12, 2024
4ce8f4e
move new fee related nr files
spypsy Feb 12, 2024
05265f6
update avm test contract
spypsy Feb 12, 2024
b24bf9a
Merge branch 'master' into spy/move-noir
spypsy Feb 12, 2024
d6af6d3
fix NARGO_BACKEND_PATH
spypsy Feb 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 18 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,17 @@ jobs:
name: "Build and test"
command: build l1-contracts

noir-projects:
machine:
image: ubuntu-2204:2023.07.2
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: "Build and test"
command: build noir-projects

boxes-files:
machine:
image: ubuntu-2204:2023.07.2
Expand Down Expand Up @@ -1207,14 +1218,20 @@ workflows:

- boxes-files: *defaults

- noir-projects:
requires:
- avm-transpiler
- noir-ecr-manifest
<<: *defaults

# Yarn Project
- yarn-project-base:
requires:
- avm-transpiler
- l1-contracts
- bb-js
- noir-ecr-manifest
- noir-packages
- noir-projects
- boxes-files
<<: *defaults
- yarn-project:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mirror_repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ jobs:
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
- name: Push to aztec-nr repo
run: |
SUBREPO_PATH=yarn-project/aztec-nr
SUBREPO_PATH=aztec-nr
git config --global user.name AztecBot
git config --global user.email tech@aztecprotocol.com

monorepo_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
# list all aztec-packages tags, take the "highest" version
monorepo_tag="$(git tag --list aztec-packages-v* | sort --version-sort | tail -1)"
monorepo_protocol_circuits_path="yarn-project/noir-protocol-circuits"
monorepo_protocol_circuits_path="noir-packages/noir-protocol-circuits"

# take all Nargo.toml files that reference noir-protocol-circuits
nargo_files="$(find $SUBREPO_PATH -name 'Nargo.toml' | xargs grep --files-with-matches 'noir-protocol-circuits')"

# match lines like this:
# protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" }
# and replace with
# protocol_types = { git="https://github.com/aztecprotocol/aztec-packages", tag="aztec-packages-v0.16.9", directory="yarn-project/noir-protocol-circuits/src/crates/types" }
# protocol_types = { git="https://github.com/aztecprotocol/aztec-packages", tag="aztec-packages-v0.16.9", directory="noir-projects/noir-protocol-circuits/src/crates/types" }
for nargo_file in $nargo_files; do
sed --regexp-extended --in-place \
"s;path\s*=\s*\".*noir-protocol-circuits(.*)\";git=\"$monorepo_url\", tag=\"$monorepo_tag\", directory=\"$monorepo_protocol_circuits_path\1\";" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protocol-circuits-gate-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
run: nargo --version

- name: Generate gates report
working-directory: ./yarn-project/noir-protocol-circuits/src
working-directory: ./noir-projects/noir-protocol-circuits/src
run: |
nargo info --json > protocol_circuits_report.json
mv protocol_circuits_report.json ../../../protocol_circuits_report.json
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ cmake-build-debug
# Local Netlify folder
.netlify

.graphite*
.graphite*

noir-protocol-circuits/src/target/*.json
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ All the packages that make up [Aztec](https://docs.aztec.network).

## Popular packages

- [Aztec.nr](./yarn-project/aztec-nr/): A [Noir](https://noir-lang.org) framework for smart contracts on Aztec.
- [Aztec.nr](./aztec-nr/): A [Noir](https://noir-lang.org) framework for smart contracts on Aztec.
- [Aztec](./yarn-project/aztec/): A package for starting up local dev net modules, including a local 'sandbox' devnet, an Ethereum network, deployed rollup contracts and Aztec execution environment.
- [Aztec.js](./yarn-project/aztec.js/): A tool for interacting with the Aztec network. It communicates via the [Private Execution Environment (PXE)](./yarn-project/pxe/).
- [Example contracts](./yarn-project/noir-contracts/): Example contracts for the Aztec network, written in Noir.
- [Example contracts](./noir-contracts/): Example contracts for the Aztec network, written in Noir.
- [End to end tests](./yarn-project/end-to-end/): Integration tests written in Typescript--a good reference for how to use the packages for specific tasks.
- [Aztec Boxes](./boxes/): Example starter projects.

Expand Down Expand Up @@ -71,7 +71,8 @@ We currently use [git-subrepo](https://github.com/ingydotnet/git-subrepo) to man
There is an automatic mirror pushing noir to a PR on noir side. If the mirror is not working, generally we need to do a "git subrepo pull noir".

Recovering if the sync is not happening with basic pull commands:
- manually editing the commit variable in noir/.gitrepo:
this needs to exist in the branch we push to, and have the same content as our base. This is similar to submodules, except instead of pointing to the final state of the module, it points to the last commit we have sync'd from, for purposes of commit replay. This can be fixed to match the commit in master after merges.
- manually editing the parent variable in noir/.gitrepo: this is the parent of the last sync commit on aztec side. If you get errors with a commit not being found in the upstream repo, and the commit mentioned is not the commit variable above, it might indicate this is somehow incorrect. This can happen when commit content is ported without its history, e.g. squashes
- use pull --force ONLY where you would use git reset. That is, if you really want to match some upstream noir for a purpose its fine, but you'll lose local changes (if any)

- manually editing the commit variable in noir/.gitrepo:
this needs to exist in the branch we push to, and have the same content as our base. This is similar to submodules, except instead of pointing to the final state of the module, it points to the last commit we have sync'd from, for purposes of commit replay. This can be fixed to match the commit in master after merges.
- manually editing the parent variable in noir/.gitrepo: this is the parent of the last sync commit on aztec side. If you get errors with a commit not being found in the upstream repo, and the commit mentioned is not the commit variable above, it might indicate this is somehow incorrect. This can happen when commit content is ported without its history, e.g. squashes
- use pull --force ONLY where you would use git reset. That is, if you really want to match some upstream noir for a purpose its fine, but you'll lose local changes (if any)
5 changes: 3 additions & 2 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fi

# Install pre-commit git hooks.
HOOKS_DIR=$(git rev-parse --git-path hooks)
echo "(cd barretenberg/cpp && ./format.sh staged)" > $HOOKS_DIR/pre-commit
echo "(cd barretenberg/cpp && ./format.sh staged)" >$HOOKS_DIR/pre-commit
chmod +x $HOOKS_DIR/pre-commit

git submodule update --init --recursive
Expand All @@ -55,6 +55,7 @@ PROJECTS=(
noir
l1-contracts
avm-transpiler
noir-projects
yarn-project
)

Expand All @@ -66,7 +67,7 @@ for P in "${PROJECTS[@]}"; do
echo "**************************************"
echo
$P/bootstrap_cache.sh
else
else
echo "**************************************"
echo -e "\033[1mBootstrapping $P...\033[0m"
echo "**************************************"
Expand Down
2 changes: 2 additions & 0 deletions boxes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
# Produces a container that can be run to test a specific box. See docker-compose.yml.
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/aztec AS aztec
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir as noir
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-projects as noir-projects

# We need yarn. Start fresh container.
FROM node:18.19.0
COPY --from=aztec /usr/src /usr/src
COPY --from=noir /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo
COPY --from=noir-projects /usr/src/noir-projects/aztec-nr /usr/src/noir-projects/aztec-nr
WORKDIR /usr/src/boxes
ENV AZTEC_NARGO=/usr/src/noir/target/release/nargo
ENV AZTEC_CLI=/usr/src/yarn-project/cli/aztec-cli-dest
Expand Down
2 changes: 1 addition & 1 deletion boxes/blank-react/src/contracts/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ compiler_version = ">=0.18.0"
type = "contract"

[dependencies]
aztec = { path = "../../../../yarn-project/aztec-nr/aztec" }
aztec = { path = "../../../../noir-projects/aztec-nr/aztec" }
2 changes: 1 addition & 1 deletion boxes/blank/src/contracts/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ compiler_version = ">=0.18.0"
type = "contract"

[dependencies]
aztec = { path = "../../../../yarn-project/aztec-nr/aztec" }
aztec = { path = "../../../../noir-projects/aztec-nr/aztec" }
8 changes: 4 additions & 4 deletions boxes/token/src/contracts/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compiler_version = ">=0.18.0"
type = "contract"

[dependencies]
aztec = { path = "../../../../yarn-project/aztec-nr/aztec" }
safe_math = { path = "../../../../yarn-project/aztec-nr/safe-math" }
compressed_string = {path = "../../../../yarn-project/aztec-nr/compressed-string"}
authwit = { path = "../../../../yarn-project/aztec-nr/authwit" }
aztec = { path = "../../../../noir-projects/aztec-nr/aztec" }
safe_math = { path = "../../../../noir-projects/aztec-nr/safe-math" }
compressed_string = { path = "../../../../noir-projects/aztec-nr/compressed-string" }
authwit = { path = "../../../../noir-projects/aztec-nr/authwit" }
9 changes: 9 additions & 0 deletions build_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ noir-packages:
- ^noir/tooling/noirc_abi
- ^noir/tooling/noirc_abi_wasm

noir-projects:
buildDir: noir-projects
dependencies:
- noir
- avm-transpiler

noir-compile-acir-tests:
buildDir: noir/test_programs
# Awkward. Maybe change dockerfile paths to be absolute.
Expand Down Expand Up @@ -134,6 +140,7 @@ yarn-project-base:
- noir-packages
- boxes-files
- avm-transpiler
- noir-projects

yarn-project:
buildDir: yarn-project
Expand Down Expand Up @@ -178,6 +185,7 @@ boxes:
dependencies:
- aztec
- noir
- noir-projects
runDependencies:
- aztec

Expand Down Expand Up @@ -205,6 +213,7 @@ docs:
- ^.*.nr$
dependencies:
- yarn-project
- noir-projects

yellow-paper:
buildDir: yellow-paper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To generate them, include a `--ts` option in the `codegen` command with a path t
aztec-cli codegen ./aztec-nargo/output/target/path -o src/artifacts --ts
```

Below is typescript code generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr) contract:
Below is typescript code generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract:

```ts showLineNumbers
export class TokenContract extends ContractBase {
Expand Down Expand Up @@ -127,7 +127,7 @@ To generate them, include a `--nr` option in the `codegen` command with a path t
aztec-cli codegen ./aztec-nargo/output/target/path -o ./path/to/output/folder --nr
```

Below is an example interface, also generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/noir-contracts/contracts/token_contract/src/main.nr) contract:
Below is an example interface, also generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract:

```rust
impl TokenPrivateContextInterface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ There are several optional arguments that can be passed:
<Tabs groupId="deployment-methods">
<TabItem value="cli" label="Aztec CLI">

`aztec-cli deploy` takes 1 mandatory argument which is the path to the contract artifact file in a JSON format (e.g. `contracts/target/PrivateToken.json`). Alternatively you can pass the name of an example contract as exported by `@aztec/noir-contracts` (run `aztec-cli example-contracts` to see the full list of contracts available).
`aztec-cli deploy` takes 1 mandatory argument which is the path to the contract artifact file in a JSON format (e.g. `contracts/target/PrivateToken.json`). Alternatively you can pass the name of an example contract as exported by `@aztec/noir-contracts.js` (run `aztec-cli example-contracts` to see the full list of contracts available).

The command also takes the following optional arguments:

Expand Down Expand Up @@ -105,7 +105,7 @@ const tx = ExampleContract.deploy(pxe).send({

### Deploying token contract

To give you a more complete example we will deploy a `Token` contract whose artifacts are included in the `@aztec/noir-contracts` package.
To give you a more complete example we will deploy a `Token` contract whose artifacts are included in the `@aztec/noir-contracts.js` package.

The contract has `admin` as a constructor argument.
We will deploy the contract with the `aztec-cli` and pass the `admin` address as an argument.
Expand Down
24 changes: 16 additions & 8 deletions docs/docs/developers/contracts/references/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,57 @@ description: Documentation of Aztec's Global Variables in the Public and Private
---

# Global Variables
For developers coming from solidity, this concept will be similar to how the global `block` variable exposes a series of block values. The idea is the same in Aztec. Developers can access a namespace of values made available in each function.

`Aztec` has two execution environments, Private and Public. Each execution environment contains a different global variables object.
For developers coming from solidity, this concept will be similar to how the global `block` variable exposes a series of block values. The idea is the same in Aztec. Developers can access a namespace of values made available in each function.

## Private Global Variables
#include_code private-global-variables /yarn-project/aztec-nr/aztec/src/context/globals/private_global_variables.nr rust
`Aztec` has two execution environments, Private and Public. Each execution environment contains a different global variables object.

## Private Global Variables

#include_code private-global-variables /noir-projects/aztec-nr/aztec/src/context/globals/private_global_variables.nr rust

The private global variables contain:

### Chain Id

The chain id differs depending on which Aztec instance you are on ( NOT the Ethereum hardfork that the rollup is settling to ). On original deployment of the network, this value will be 1.

```rust
context.chain_id();
```

### Version

The version number indicates which Aztec hardfork you are on. The Genesis block of the network will have the version number 1.

```rust
context.version();
```


## Public Global Variables
#include_code global-variables /yarn-project/noir-protocol-circuits/src/crates/types/src/abis/global_variables.nr rust

#include_code global-variables /noir-projects/noir-protocol-circuits/src/crates/types/src/abis/global_variables.nr rust

The public global variables contain the values present in the `private global variables` described above, with the addition of:

### Timestamp

The timestamp is the unix timestamp in which the block has been executed. The value is provided by the block's proposer (therefore can have variance). This value will always increase.

```rust
context.timestamp();
```

### Block Number

The block number is a sequential identifier that labels each individual block of the network. This value will be the block number of the block the accessing transaction is included in.
The block number of the genesis block will be 1, with the number increasing by 1 for every block after.

```rust
context.block_number();
```

:::info *Why do the available global variables differ per execution environment?*
The global variables are constrained by the proving environment. In the case of public functions, they are executed on a sequencer that will know the timestamp and number of the next block ( as they are the block producer ).
:::info _Why do the available global variables differ per execution environment?_
The global variables are constrained by the proving environment. In the case of public functions, they are executed on a sequencer that will know the timestamp and number of the next block ( as they are the block producer ).
In the case of private functions, we cannot be sure which block our transaction will be included in, hence we can not guarantee values for the timestamp or block number.
:::
Loading