From 432cec020ed1bb73adcc1d6be8159609c22d328e Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 22 May 2024 04:27:51 -0400 Subject: [PATCH] chore(docs): Add redirects (#6581) This PR adds some catch all redirects to avoid getting 404s. It also cleans up a few pages for when a user clicks a dropdown. --- docs/docs/aztec/concepts/index.md | 7 +- .../aztec/roadmap/features_initial_ldt.md | 2 + .../writing_contracts/index.md | 6 +- .../writing_contracts/storage/index.md | 2 +- .../sandbox_reference/sandbox-reference.md | 52 ----- .../contract_artifact.md | 109 +++++++++ .../smart_contract_reference/index.md | 108 +-------- .../storage/_category_.json | 8 +- docs/netlify.toml | 206 +++--------------- 9 files changed, 151 insertions(+), 349 deletions(-) create mode 100644 docs/docs/reference/smart_contract_reference/contract_artifact.md diff --git a/docs/docs/aztec/concepts/index.md b/docs/docs/aztec/concepts/index.md index 88bbd6efa57..bcc6b7b2248 100644 --- a/docs/docs/aztec/concepts/index.md +++ b/docs/docs/aztec/concepts/index.md @@ -2,14 +2,14 @@ title: Concepts --- -import Image from '@theme/IdealImage'; -import DocCardList from '@theme/DocCardList'; +import Image from "@theme/IdealImage"; +import DocCardList from "@theme/DocCardList"; This page outlines Aztec's fundamental technical concepts. ## Aztec Overview - + 1. A user interacts with Aztec through Aztec.js (like web3js or ethersjs) or Aztec CLI 2. Private functions are executed in the PXE, which is client-side @@ -52,6 +52,7 @@ Aztec allows private communications with Ethereum - ie no-one knows where the tr This is achieved through portals - these are smart contracts deployed on an EVM that are related to the Ethereum smart contract you want to interact with. Learn more about portals [here](/protocol-specs/l1-smart-contracts/index.md). + ## Circuits Aztec operates on three types of circuits: diff --git a/docs/docs/aztec/roadmap/features_initial_ldt.md b/docs/docs/aztec/roadmap/features_initial_ldt.md index fdc5020fb3b..3dcacfb76f8 100644 --- a/docs/docs/aztec/roadmap/features_initial_ldt.md +++ b/docs/docs/aztec/roadmap/features_initial_ldt.md @@ -5,6 +5,8 @@ sidebar_position: 0 The Aztec Sandbox is intended to provide developers with a lightweight and fast local node, running alongside a PXE. +You can learn more about running the Sandbox [here](../../reference/sandbox_reference/sandbox-reference.md). + Developers should be able to quickly spin up local, emulated instances of an Ethereum blockchain and an Aztec encrypted rollup, and start deploying private contracts and submitting private txs. The sandbox allows developers to: diff --git a/docs/docs/guides/smart_contracts/writing_contracts/index.md b/docs/docs/guides/smart_contracts/writing_contracts/index.md index 2c857ff0af3..c295b7a4e6f 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/index.md +++ b/docs/docs/guides/smart_contracts/writing_contracts/index.md @@ -1,7 +1,7 @@ --- -title: Portals +title: Writing Contracts --- -A portal is a point of contact between L1 and a contract on Aztec. For applications such as token bridges, this is the point where the tokens are held on L1 while used in L2. +import DocCardList from "@theme/DocCardList"; -As outlined in [Communication](/protocol-specs/l1-smart-contracts/index.md), an Aztec L2 contract does not have to be linked to a portal contract, but can specify an intended portal in storage. Note, that a portal doesn't actually need to be a contract, it could be any address on L1. + diff --git a/docs/docs/guides/smart_contracts/writing_contracts/storage/index.md b/docs/docs/guides/smart_contracts/writing_contracts/storage/index.md index 7198612356d..d5d3714d7af 100644 --- a/docs/docs/guides/smart_contracts/writing_contracts/storage/index.md +++ b/docs/docs/guides/smart_contracts/writing_contracts/storage/index.md @@ -1,5 +1,5 @@ --- -title: Defining Storage +title: Declaring Storage --- On this page, you will learn how to define storage in your smart contract. diff --git a/docs/docs/reference/sandbox_reference/sandbox-reference.md b/docs/docs/reference/sandbox_reference/sandbox-reference.md index c02d4a7988c..2ecce9b8a9b 100644 --- a/docs/docs/reference/sandbox_reference/sandbox-reference.md +++ b/docs/docs/reference/sandbox_reference/sandbox-reference.md @@ -8,58 +8,6 @@ For a quick start, follow the [guide](/getting_started.md) to install the sandbo ::: -## Manual Install - - -You can manually install the sandbox via the underlying script used in the [Aztec Boxes](/getting_started.md#run-the-npx-script). - -### 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) - -### Install the sandbox - -To install the latest Sandbox version, run: - -```bash -bash -i <(curl -s install.aztec.network) -``` - -This will install the following tools: - -- **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. - -Once these have been installed, to start the sandbox, run: - -```bash -aztec-sandbox -``` - -### Have fun! - -**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 - - ## Manual Install You can manually install the sandbox via the underlying script used in the [Aztec Boxes](getting_started.md#run-the-npx-script). diff --git a/docs/docs/reference/smart_contract_reference/contract_artifact.md b/docs/docs/reference/smart_contract_reference/contract_artifact.md new file mode 100644 index 00000000000..8c47f55d714 --- /dev/null +++ b/docs/docs/reference/smart_contract_reference/contract_artifact.md @@ -0,0 +1,109 @@ +--- +title: "Contract Artifact Reference" +--- + +After compiling a contract you'll get a Contract Artifact file, that contains the data needed to interact with a specific contract, including its name, functions that can be executed, and the interface and code of those functions. Since private functions are not published in the Aztec network, you'll need this artifact file to be able to call private functions of contracts. + +The artifact file can be used with `aztec.js` to instantiate contract objects and interact with them. + +## Contract Artifact Structure + +The structure of a contract artifact is as follows: +```json +{ + "name": "CardGame", + "functions": [ + { + "name": "constructor", + "functionType": "private", + "isInternal": false, + "parameters": [], + "returnTypes": [], + "bytecode": "...", + "verificationKey": "..." + }, + { + "name": "on_card_played", + "functionType": "public", + "isInternal": true, + "parameters": [ + { + "name": "game", + "type": { + "kind": "integer", + "sign": "unsigned", + "width": 32 + }, + "visibility": "private" + }, + { + "name": "player", + "type": { + "kind": "field" + }, + "visibility": "private" + }, + { + "name": "card_as_field", + "type": { + "kind": "field" + }, + "visibility": "private" + } + ], + "returnTypes": [ + ... + ], + "bytecode": "...", + "verificationKey": "..." + }, + ... + ] +} + +``` + +### `name` +It is a simple string that matches the name that the contract developer used for this contract in noir. It's used for logs and errors. + +### `functions` +A contract is a collection of several functions that can be called. Each function has the following properties: + +#### `function.name` +A simple string that matches the name that the contract developer used for this function in noir. For logging and debugging purposes. + +#### `function.functionType` +The function type can have one of the following values: + +- Private: The function is ran and proved locally by the clients, and its bytecode not published to the network. +- Public: The function is ran and proved by the sequencer, and its bytecode is published to the network. +- Unconstrained: The function is ran locally by the clients to generate digested information useful for the user. It's not meant to be transacted against. + +#### `function.isInternal` +The is internal property is a boolean that indicates whether the function is internal to the contract and cannot be called from outside. + +#### `function.parameters` +Each function can have multiple parameters that are arguments to execute the function. Parameters have a name, and type (like integers, strings, or complex types like arrays and structures). + +#### `function.returnTypes` +The return types property defines the types of values that the function returns after execution. + +#### `function.bytecode` +The bytecode is a string representing the compiled ACIR of the function, ready for execution on the network. + +#### `function.verificationKey` +The verification key is an optional property that contains the verification key of the function. This key is used to verify the proof of the function execution. + +### `debug` (Optional) +Although not significant for non-developer users, it is worth mentioning that there is a debug section in the contract artifact which helps contract developers to debug and test their contracts. This section mainly contains debug symbols and file maps that link back to the original source code. + +## Understanding Parameter and Return Types +To make the most of the functions, it's essential to understand the types of parameters and return values. Here are some common types you might encounter: + + - `field`: A basic type representing a field element in the finite field of the curve used in the Aztec protocol. + - `boolean`: A simple true/false value. + - `integer`: Represents whole numbers. It has attributes defining its sign (positive or negative) and width (the number of bits representing the integer). + - `array`: Represents a collection of elements, all of the same type. It has attributes defining its length and the type of elements it holds. + - `string`: Represents a sequence of characters with a specified length. + - `struct`: A complex type representing a structure with various fields, each having a specific type and name. + diff --git a/docs/docs/reference/smart_contract_reference/index.md b/docs/docs/reference/smart_contract_reference/index.md index 8c47f55d714..40166896821 100644 --- a/docs/docs/reference/smart_contract_reference/index.md +++ b/docs/docs/reference/smart_contract_reference/index.md @@ -1,109 +1,7 @@ --- -title: "Contract Artifact Reference" +title: Smart Contract Reference --- -After compiling a contract you'll get a Contract Artifact file, that contains the data needed to interact with a specific contract, including its name, functions that can be executed, and the interface and code of those functions. Since private functions are not published in the Aztec network, you'll need this artifact file to be able to call private functions of contracts. - -The artifact file can be used with `aztec.js` to instantiate contract objects and interact with them. - -## Contract Artifact Structure - -The structure of a contract artifact is as follows: -```json -{ - "name": "CardGame", - "functions": [ - { - "name": "constructor", - "functionType": "private", - "isInternal": false, - "parameters": [], - "returnTypes": [], - "bytecode": "...", - "verificationKey": "..." - }, - { - "name": "on_card_played", - "functionType": "public", - "isInternal": true, - "parameters": [ - { - "name": "game", - "type": { - "kind": "integer", - "sign": "unsigned", - "width": 32 - }, - "visibility": "private" - }, - { - "name": "player", - "type": { - "kind": "field" - }, - "visibility": "private" - }, - { - "name": "card_as_field", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "returnTypes": [ - ... - ], - "bytecode": "...", - "verificationKey": "..." - }, - ... - ] -} - -``` - -### `name` -It is a simple string that matches the name that the contract developer used for this contract in noir. It's used for logs and errors. - -### `functions` -A contract is a collection of several functions that can be called. Each function has the following properties: - -#### `function.name` -A simple string that matches the name that the contract developer used for this function in noir. For logging and debugging purposes. - -#### `function.functionType` -The function type can have one of the following values: - -- Private: The function is ran and proved locally by the clients, and its bytecode not published to the network. -- Public: The function is ran and proved by the sequencer, and its bytecode is published to the network. -- Unconstrained: The function is ran locally by the clients to generate digested information useful for the user. It's not meant to be transacted against. - -#### `function.isInternal` -The is internal property is a boolean that indicates whether the function is internal to the contract and cannot be called from outside. - -#### `function.parameters` -Each function can have multiple parameters that are arguments to execute the function. Parameters have a name, and type (like integers, strings, or complex types like arrays and structures). - -#### `function.returnTypes` -The return types property defines the types of values that the function returns after execution. - -#### `function.bytecode` -The bytecode is a string representing the compiled ACIR of the function, ready for execution on the network. - -#### `function.verificationKey` -The verification key is an optional property that contains the verification key of the function. This key is used to verify the proof of the function execution. - -### `debug` (Optional) -Although not significant for non-developer users, it is worth mentioning that there is a debug section in the contract artifact which helps contract developers to debug and test their contracts. This section mainly contains debug symbols and file maps that link back to the original source code. - -## Understanding Parameter and Return Types -To make the most of the functions, it's essential to understand the types of parameters and return values. Here are some common types you might encounter: - - - `field`: A basic type representing a field element in the finite field of the curve used in the Aztec protocol. - - `boolean`: A simple true/false value. - - `integer`: Represents whole numbers. It has attributes defining its sign (positive or negative) and width (the number of bits representing the integer). - - `array`: Represents a collection of elements, all of the same type. It has attributes defining its length and the type of elements it holds. - - `string`: Represents a sequence of characters with a specified length. - - `struct`: A complex type representing a structure with various fields, each having a specific type and name. +import DocCardList from "@theme/DocCardList"; + diff --git a/docs/docs/reference/smart_contract_reference/storage/_category_.json b/docs/docs/reference/smart_contract_reference/storage/_category_.json index 9abbe38441b..49a4bd8abca 100644 --- a/docs/docs/reference/smart_contract_reference/storage/_category_.json +++ b/docs/docs/reference/smart_contract_reference/storage/_category_.json @@ -1,6 +1,6 @@ { - "position": 0, - "collapsible": true, - "collapsed": true, - "label": "Smart Contract Reference" + "position": 0, + "collapsible": true, + "collapsed": true, + "label": "Storage" } diff --git a/docs/netlify.toml b/docs/netlify.toml index 736bb7fbec2..60322008128 100644 --- a/docs/netlify.toml +++ b/docs/netlify.toml @@ -1,215 +1,59 @@ [[redirects]] - from = "/how-aztec-works/*" - to = "/" - -[[redirects]] - from = "/sdk/*" - to = "/" - -[[redirects]] - from = "/developers/*" - to = "/" - -[[redirects]] - from = "/spec/*" - to = "/" - -[[redirects]] - from = "/compliance" - to = "/" - -[[redirects]] - from = "/dev_docs/aztec3/*" - to = "/learn/about_aztec/what_is_aztec" - -[[redirects]] - from = "/dev_docs/contracts/types" - to = "/developers/contracts/syntax/types" - -[[redirects]] - from = "/dev_docs/contracts/storage" - to = "/developers/contracts/syntax/storage" - -[[redirects]] - from = "/dev_docs/contracts/state_variables" - to = "/developers/contracts/syntax/storage" - -[[redirects]] - from = "/dev_docs/contracts/functions" - to = "/developers/contracts/syntax/functions" - -[[redirects]] - from = "/dev_docs/contracts/visibility" - to = "/developers/contracts/syntax/visibility" - -[[redirects]] - from = "/dev_docs/contracts/globals" - to = "/developers/contracts/syntax/globals" - -[[redirects]] - from = "/dev_docs/contracts/syntax" - to = "/developers/contracts/syntax/main" - -[[redirects]] - from = "/dev_docs/contracts/contract" - to = "/developers/contracts/syntax/contract" - -[[redirects]] - from = "/dev_docs/getting_started/cli" - to = "/developers/cli/main" - -[[redirects]] - from = "/dev_docs/getting_started/noir_contracts" - to = "/developers/contracts/main" - -[[redirects]] - from = "/dev_docs/getting_started/token_contract_tutorial" - to = "/developers/tutorials/writing_token_contract" - -[[redirects]] - from = "/dev_docs/getting_started/updating" - to = "/developers/updating" - -[[redirects]] - from = "/dev_docs/sandbox/main" - to = "/developers/getting_started/sandbox" - -[[redirects]] - from = "/dev_docs/cli/updating" - to = "/developers/updating" - -[[redirects]] - from = "/dev_docs/dapps/tutorials/main" - to = "/developers/tutorials/writing_dapp/main" + from = "/developers/tutorials/*" + to = "/tutorials/contract_tutorials/private_voting_contract" [[redirects]] - from = "/dev_docs/dapps/tutorials/project_setup" - to = "/developers/tutorials/writing_dapp/project_setup" + from = "/developers/sandbox/*" + to = "/reference/sandbox_reference" [[redirects]] - from = "/dev_docs/dapps/tutorials/contract_deployment" - to = "/developers/tutorials/writing_dapp/contract_deployment" + from = "/developers/contracts/*" + to = "/reference/smart_contract_reference" [[redirects]] - from = "/dev_docs/dapps/tutorials/contract_interaction" - to = "/developers/tutorials/writing_dapp/contract_interaction" - -[[redirects]] - from = "/dev_docs/dapps/tutorials/rpc_server" - to = "/developers/tutorials/writing_dapp/rpc_server" - -[[redirects]] - from = "/dev_docs/dapps/tutorials/testing" - to = "/developers/tutorials/writing_dapp/testing" + from = "/dev_docs/*" + to = "/getting_started" [[redirects]] from = "/aztec/cryptography/cryptography-roadmap" - to = "/about_aztec/roadmap/cryptography_roadmap" + to = "/aztec/roadmap/cryptography_roadmap" [[redirects]] from = "/aztec/milestones/features-initial-ldt" - to = "/about_aztec/roadmap/features_initial_ldt" - -[[redirects]] - from = "/aztec/protocol/trees" - to = "/learn/concepts/storage/trees/main" - -[[redirects]] - from = "/aztec/protocol/trees/indexed-merkle-tree" - to = "/learn/concepts/storage/trees/indexed_merkle_tree" - -[[redirects]] - from = "/aztec/protocol/circuits/private-kernel" - to = "/learn/concepts/circuits/kernels/private_kernel" - -[[redirects]] - from = "/aztec/protocol/circuits/public-kernel" - to = "/learn/concepts/circuits/kernels/public_kernel" - -[[redirects]] - from = "/aztec/protocol/circuits/rollup" - to = "/learn/concepts/circuits/rollup_circuits/main" - -[[redirects]] - from = "/aztec/protocol/public-functions-vm-architectures" - to = "/learn/concepts/hybrid_state/public_vm" - -[[redirects]] - from = "/aztec/how-it-works/private-smart-contracts" - to = "/learn/concepts/contracts/main" - -[[redirects]] - from = "/aztec/how-it-works/private-state" - to = "/learn/concepts/hybrid_state/main" - -[[redirects]] - from = "/concepts/foundation/state_model" - to = "/learn/concepts/hybrid_state/main" - -[[redirects]] - from = "/aztec/how-it-works/private-public-execution" - to = "/learn/concepts/communication/public_private_calls/main" - -[[redirects]] - from="/concepts/foundation/communication/public_private_calls" - to="/learn/concepts/communication/public_private_calls/main" - -[[redirects]] - from="/learn/concepts/communication/public_private_calls/main" - to="/learn/concepts/communication/public_private_calls" - -[[redirects]] - from = "/aztec/how-it-works/l1-l2-messaging" - to = "/learn/concepts/communication/cross_chain_calls" - -[[redirects]] - from = "/aztec/protocol/contract-creation" - to = "/learn/concepts/contracts/contract_creation" + to = "/aztec/roadmap/" [[redirects]] - from = "/concepts/advanced/contract_creation" - to = "/learn/concepts/smart_contracts/main" + from = "/learn/concepts/*" + to = "/aztec/concepts/" [[redirects]] from = "/noir" to = "/" [[redirects]] - from = "/aztec-connect-sunset" - to = "/misc/aztec-connect-sunset" + from = "/misc/aztec-connect-sunset" + to = "/aztec_connect_sunset" [[redirects]] - from = "/glossary" - to = "/misc/glossary" + from= "zk-money/userguide" + to= "/aztec_connect_sunset" [[redirects]] - from = "/aztec/*" + from = "/how-aztec-works/*" to = "/" [[redirects]] - from = "/dev_docs/contracts/syntax/state_variables" - to = "/developers/contracts/syntax/storage" - -[[redirects]] - from = "/dev_docs/getting_started/sandbox" - to = "/developers/getting_started/quickstart" - -[[redirects]] - from = "/dev_docs/getting_started/updating" - to = "/developers/cli/updating" - -[[redirects]] - from = "/dev_docs/sandbox_errors/main" - to = "developers/debugging/sandbox-errors" + from = "/sdk/*" + to = "/" [[redirects]] - from = "/dev_docs/contracts/common_errors" - to = "developers/debugging/aztecnr-errors" + from = "/developers/*" + to = "/" [[redirects]] - from = "/misc/aztec-connect-sunset" - to = "/misc/aztec_connect_sunset" + from = "/spec/*" + to = "/" [[redirects]] - from= "zk-money/userguide" - to= "/misc/aztec_connect_sunset" + from = "/compliance" + to = "/" \ No newline at end of file