Skip to content

Commit

Permalink
Merge branch 'master' into md/04-11-feat_bb_support_for_public_input_…
Browse files Browse the repository at this point in the history
…columns
  • Loading branch information
Maddiaa0 authored May 10, 2024
2 parents 66f958e + 98d32f1 commit fa470ee
Show file tree
Hide file tree
Showing 128 changed files with 4,413 additions and 1,735 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# Use instance types with low interruption rate in us-east-2 https://aws.amazon.com/ec2/spot/instance-advisor/
ec2_instance_type: r6in.32xlarge r6a.32xlarge i4i.32xlarge r7iz.32xlarge
ec2_ami_id: ami-04d8422a9ba4de80f
ec2_spot_instance_strategy: BestEffort
ec2_spot_instance_strategy: None
ec2_instance_ttl: 40 # refreshed by jobs
secrets: inherit

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/start-spot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
# Use instance types with low interruption rate in us-east-2 https://aws.amazon.com/ec2/spot/instance-advisor/
ec2_instance_type: r6in.32xlarge r6a.32xlarge i4i.32xlarge r7iz.32xlarge
ec2_ami_id: ami-04d8422a9ba4de80f
ec2_spot_instance_strategy: None
ec2_instance_ttl: 40 # refreshed by jobs
secrets: inherit

Expand Down
4 changes: 2 additions & 2 deletions barretenberg/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/AztecProtocol/barretenberg
branch = master
commit = a0f30c4760a4fe7db9680377d97cd7a75b048fdb
parent = b2c019b6b11c3aaa98d8bbb79b77b42a5f87f0d0
commit = a4926337861c17293b637e0a17ee7d6688a19c96
parent = 553078c5a21159b5c4db0fd5d76a5dae41d94e6a
method = merge
cmdver = 0.4.6
31 changes: 11 additions & 20 deletions boxes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,27 @@ Aztec Boxes are the one-stop-shop for developing on Aztec. They often include a

Boxes include the sandbox installation script and its start command. By choosing the appropriate box, you can get started working on Aztec in a minimal amount of time.

## Getting started
## Contributing

If you have [node](https://nodejs.org/en/download) installed, you can open a terminal in any folder and run:
Because of the CI/CD nature of the monorepo, every box is tested against every merge on master. This drastically reduces their maintenance cost. Thus, some scripting is needed to make sure the user gets a working repository after "unboxing".

`npx create-aztec-app`
Most of the logic is in the `bin.js` file, where `commander` commands stuff. The script does the following:

or
- Prompts the user for options and commands
- Inits some global variables such as a logger, a getter for the github repositories, the latest stable versions and tags, etc
- Prompts the user to choose the project and clone it. It then rewrites the `Nargo.toml` and `package.json` files to point to the repos instead of the local dependencies.
- Queries the local docker daemon for any existing sandbox images, prompting the user to install or update it if needed
- Asks the user if they want to run the sandbox right away

`npx create-aztec-app`

The script will install the sandbox, run it, and clone the boilerplate you chose. You can pass some options:

| Option | Description |
| --- | --- |
| -d, --debug | Displays some more information for debug reasons. |
| -gh, --github_token | You can pass a github_token in case you hit API rate limit |
| -v, --version | You can specify a semver version, or "MASTER" |
| -h, --help | Shows up this help menu |

If at any time you encounter problems, refer to the guides at [docs.aztec.network](https://docs.aztec.network) for more information.

## Templates

Currently there are two boxes:
As noted above, every box is tested at every merge to master. Any breaking changes need to happen in every box, so we try to keep the number of templates strategically low. For that reason, we ask contributors to reach directly to the [devrel team](https://github.com/orgs/AztecProtocol/teams/devrel) before adding another template.

Currently there are two "app" boxes and one "contract-only" box:

- React - A React boilerplate with a minimal UI.
- Vanilla JS and HTML - Some say if you get something working in vanilla JS and HTML, you can make it work on any framework. If you can't find the box you need, this could be a good starting point.

And one contract-only box:

- Token - An example token contract on Aztec

## Support
Expand Down
29 changes: 29 additions & 0 deletions boxes/boxes/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@

This box is a one-stop-shop for Aztec that will deploy a minimal React page. You can use it as a boilerplate to start developing your own Aztec app in seconds!

## Getting Started

The easiest way to start is with a Github Codespaces, which has a generous free tier. Just click on this button:

[![One-Click React Starter](.devcontainer/assets/react_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Freact%2Fdevcontainer.json)

## Using the `npx` command

The above method just uses the `npx` command, AKA "unboxing the box". This is a CLI command to quickly start developing on your own machine.

### Prerequisites

- Node >v18
- Docker

### Usage

Just open a terminal and write:

```bash
npx create-aztec-app
```

It should ask you some questions about your project, install and run the Sandbox (local developer network). You can also start, stop, update, and do other things on the sandbox through this script. Just run:

```bash
npx create-aztec-app sandbox --help
```

## More information

Visit the [Aztec Docs](https://docs.aztec.network) for more information on how Aztec works, and the [Awesome Aztec Repository](https://github.com/AztecProtocol/awesome-aztec) for more cool projects, boilerplates and tooling.
30 changes: 30 additions & 0 deletions boxes/boxes/vanilla/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

This box is a one-stop-shop for Aztec that will deploy a minimal barebones HTML+JS page. You can use it as a boilerplate to start developing your own Aztec app in seconds!


## Getting Started

The easiest way to start is with a Github Codespaces, which has a generous free tier. Just click on this button:

[![One-Click HTML/TS Starter](.devcontainer/assets/vanilla_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Fvanilla%2Fdevcontainer.json)

## Using the `npx` command

The above method just uses the `npx` command, AKA "unboxing the box". This is a CLI command to quickly start developing on your own machine.

### Prerequisites

- Node >v18
- Docker

### Usage

Just open a terminal and write:

```bash
npx create-aztec-app
```

It should ask you some questions about your project, install and run the Sandbox (local developer network). You can also start, stop, update, and do other things on the sandbox through this script. Just run:

```bash
npx create-aztec-app sandbox --help
```

## More information

Visit the [Aztec Docs](https://docs.aztec.network) for more information on how Aztec works, and the [Awesome Aztec Repository](https://github.com/AztecProtocol/awesome-aztec) for more cool projects, boilerplates and tooling.
31 changes: 30 additions & 1 deletion boxes/contract-only/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,36 @@

This box is a one-stop-shop for Aztec with the %%contract_name%% example contract. You can use it as a boilerplate to start developing your own Aztec app in seconds!

## How to start
## Getting Started

The easiest way to start is with a Github Codespaces, which has a generous free tier. Just click on this button:

[![One-Click Token Starter](.devcontainer/assets/token_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Ftoken%2Fdevcontainer.json)

## Using the `npx` command

The above method just uses the `npx` command, AKA "unboxing the box". This is a CLI command to quickly start developing on your own machine.

### Prerequisites

- Node >v18
- Docker

### Usage

Just open a terminal and write:

```bash
npx create-aztec-app
```

It should ask you some questions about your project, install and run the Sandbox (local developer network). You can also start, stop, update, and do other things on the sandbox through this script. Just run:

```bash
npx create-aztec-app sandbox --help
```

## What's in the box

The script copied one of the example contracts and put it into a one-size-fits-all "box". With it, you can run commands such as:

Expand Down
3 changes: 1 addition & 2 deletions boxes/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "create-aztec-app",
"packageManager": "yarn@4.0.2",
"version": "0.4.2",
"version": "0.4.4",
"type": "module",
"private": true,
"scripts": {
"compile": "yarn workspaces foreach -A -v run compile",
"build": "yarn workspaces foreach -A -v run build",
Expand Down
6 changes: 3 additions & 3 deletions boxes/scripts/steps/sandbox/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import axios from "axios";

const sandbox = (command) =>
execSync(
`docker-compose -f $HOME/.aztec/docker-compose.yml -p sandbox ${command}`,
{ stdio: "inherit" },
`docker compose -f $HOME/.aztec/docker-compose.yml -p sandbox ${command}`,
{ stdio: "inherit" }
);

export const start = () => sandbox("up -d");
Expand All @@ -29,7 +29,7 @@ export async function sandboxRunStep() {
Accept: "*/*",
"Content-Type": "application/json",
},
},
}
);
spinner.succeed();
success("The Sandbox is already running!");
Expand Down
5 changes: 4 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"fuzzers",
"gitmodules",
"gitrepo",
"gossipsub",
"grumpkin",
"gtest",
"gzipped",
Expand Down Expand Up @@ -132,6 +133,7 @@
"linkability",
"lmdb",
"maddiaa",
"mcache",
"memdown",
"memfs",
"Merkle",
Expand Down Expand Up @@ -171,6 +173,7 @@
"Palla",
"parallelizable",
"Pedersen",
"peekable",
"permissionless",
"permissionlessly",
"persistable",
Expand Down Expand Up @@ -296,4 +299,4 @@
"flagWords": [
"anonymous"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ While shared state variables are much less leaky than the assertion in public ap

The `max_block_number` transaction property will be set to a value close to the current block number plus the duration of the delay in blocks. The exact value depends on the historical block over which the private proof is constructed. For example, if the current block number is 100 and a shared state variable has a delay of 20 blocks, then transactions that read this value privately will set `max_block_number` to a value close to 120 (clients building proofs on older state will select a lower `max_block_number`). This implicitly leaks the duration of the delay.

Applications using similar delays will therefore be part of the same privacy set. It is expected for social coordination to result in small set of predetermined delays that developers choose from depending on their needs, as an example a viable set might be: 12 hours (for time-sensitive operations, such as emergency mechanisms), 5 days (for middle-of-the-road operations) and 2 weeks (for operations that require lengthy public scrutiny).
Applications using similar delays will therefore be part of the same privacy set. It is expected for social coordination to result in small set of predetermined delays that developers choose from depending on their needs, as an example a viable set might be: 12 hours (for time-sensitive operations, such as emergency mechanisms), 5 days (for middle-of-the-road operations) and 2 weeks (for operations that require lengthy public scrutiny). These delays can be changed during the contract lifetime as the application's needs evolve.

:::note
Shared state delays are currently hardcoded at compilation time and cannot be changed, but there are plans to make this a mutable value.
:::note
Additionally, users might choose to coordinate and constrain their transactions to set `max_block_number` to a value lower than would be strictly needed by the applications they interact with (if any!) using some common delay, and by doing so prevent privacy leakage.

### Choosing Epochs

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/developers/contracts/testing_contracts/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ To make testing easier, the sandbox is shipped with cheat codes to easily test i

## Examples

You can find example tests in the [aztec-starter](https://github.com/AztecProtocol/aztec-starter/tree/main) repo as well as the [Aztec Boxes](https://github.com/AztecProtocol/aztec-packages/tree/master/boxes).
You can find example tests in the [Aztec Boxes](https://github.com/AztecProtocol/aztec-packages/tree/master/boxes). You can also have a look at the [end-to-end tests](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/end-to-end).
79 changes: 18 additions & 61 deletions docs/docs/developers/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,43 @@
title: Quickstart
---

In this guide, you will
The easiest way to start developing on Aztec is simply to click on one of these buttons:

1. Set up the Aztec sandbox (local development environment) locally
2. Install the Aztec development kit
3. Use Aztec.js to deploy an example contract that comes with the sandbox
4. Use Aztec.js to interact with the contract you just deployed
[![One-Click React Starter](/img/codespaces_badges/react_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Freact%2Fdevcontainer.json) [![One-Click HTML/TS Starter](/img/codespaces_badges/vanilla_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Fvanilla%2Fdevcontainer.json) [![One-Click Token Starter](/img/codespaces_badges/token_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Ftoken%2Fdevcontainer.json)

... in less than 10 minutes.
That's it!

## Prerequisites
This creates a codespace with a prebuilt image containing one of the "Aztec Boxes" and a development network (sandbox).
- You can develop directly on the codespace, push it to a repo, make yourself at home.
- You can also just use the sandbox that comes with it. The URL will be logged, you just need to use it as your `PXE_URL`.

- Node.js >= v18 (recommend installing with [nvm](https://github.com/nvm-sh/nvm))

## Install Docker

Aztec tooling requires the Docker daemon to be running, and this is easily achieved via Docker Desktop. See [this page of the Docker docs](https://docs.docker.com/get-docker/) for instructions on how to install Docker Desktop for your operating system.
Note: if installing via Docker Desktop, you do NOT need to keep the application open at all times (just Docker daemon).

Installing and running the Docker daemon can also be achieved by installing Docker Engine, see [these instructions](https://docs.docker.com/engine/install/).

However installed, ensure Docker daemon is running. See [start Docker daemon](https://docs.docker.com/config/daemon/start/).

### Note on Linux

If you are running Linux, you will need to set the context (because Docker Desktop runs in a VM by default). See [this page](https://docs.docker.com/desktop/faqs/linuxfaqs/#what-is-the-difference-between-docker-desktop-for-linux-and-docker-engine) for more information. You can do this by running:

```bash
docker context use default
```

## Install the Sandbox
## Develop Locally

You can run the Sandbox using Docker.
The above method uses Aztec boxes to install the sandbox and clone the repo. You can use it too to get started on your own machine and use your own IDE.

To install the latest Sandbox version, run:
You can also [install the sandbox manually](../sandbox/references/sandbox-reference.md).

```bash
bash -i <(curl -s install.aztec.network)
```

> If Docker has been installed on your linux server but you encounter the error "Docker is not running. Please start Docker and try again". If you're encountering this issue, it's likely because Docker is running with root user privileges. In such cases, consider [managing Docker as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to resolve the problem.
### Prerequisites

- Node.js >= v18 (recommend installing with [nvm](https://github.com/nvm-sh/nvm))
- Docker (visit [this page of the Docker docs](https://docs.docker.com/get-docker/) on how to install it)

This will install the following:

- **aztec** - launches various infrastructure subsystems (sequencer, prover, pxe, etc).
- **aztec-nargo** - aztec's build of nargo, the noir compiler toolchain.
- **aztec-sandbox** - a wrapper around docker-compose that launches services needed for sandbox testing.
- **aztec-up** - a tool to upgrade the aztec toolchain to the latest, or specific versions.
- **aztec-builder** - A useful tool for projects to generate ABIs and update their dependencies.

### Run the `npx` script

Once these have been installed, to start the sandbox, run:
With the node installation, you now should have `npm` and be able to run `npx` scripts. You can do that by running:

```bash
aztec-sandbox
npx create-aztec-app
```

This will attempt to run the Sandbox on ` localhost:8080`, so you will have to make sure nothing else is running on that port or change the port defined in `./.aztec/docker-compose.yml`. Running the installation again will overwrite any changes made to the `docker-compose.yml`.
And follow the instructions. If all goes well, you should now have a development environment running locally on your machine.

**Congratulations, you have just installed and run the Aztec Sandbox!**

```bash
/\ | |
/ \ ___| |_ ___ ___
/ /\ \ |_ / __/ _ \/ __|
/ ____ \ / /| || __/ (__
/_/___ \_\/___|\__\___|\___|

```
In the terminal, you will see some logs:
1. Sandbox version
2. Contract addresses of rollup contracts
3. PXE (private execution environment) setup logs
4. Initial accounts that are shipped with the sandbox and can be used in tests
You can run `npx create-aztec-app sandbox -h` to start, stop, update and output logs from the sandbox.

## What's next?

To deploy a smart contract to your sandbox and interact with it using Aztec.js, go to the [next page](aztecjs-getting-started.md).

To skip this and write your first smart contract, go to the [Aztec.nr getting started page](aztecnr-getting-started.md).


Loading

0 comments on commit fa470ee

Please sign in to comment.