From 349dc933eac5552a2b8e15a6d767b90e5b83aafa Mon Sep 17 00:00:00 2001 From: LHerskind Date: Fri, 22 Sep 2023 08:06:23 +0000 Subject: [PATCH 1/3] fix: update sidebar + embed youtube video --- .../concepts/advanced/data_structures/indexed_merkle_tree.md | 4 ++++ docs/docs/dev_docs/{testing => tutorials}/testing.md | 4 ++-- docs/sidebars.js | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) rename docs/docs/dev_docs/{testing => tutorials}/testing.md (97%) diff --git a/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md b/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md index 5e61e570052..0cf26ac2816 100644 --- a/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md +++ b/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md @@ -9,6 +9,10 @@ import Disclaimer from "../../../misc/common/\_disclaimer.mdx"; ## Indexed Merkle Trees +This article will introduce the concept of an indexed merkle tree, and how it can be used to improve the performance of nullifier trees in circuits. The content was also covered in a presentation with the [Privacy + Scaling Explorations](https://pse.dev/). + + + #### Primer on Nullifier Trees Currently the only feasible way to get privacy in public blockchains is via a UTXO model. In this model, state is stored in encrypted UTXO's in merkle trees. However, to maintain privacy, state can not be updated. The very act of performing an update leaks information. In order to simulate "updating" the state, we "destroy" old UTXO's and create new ones for each state update. Resulting in a merkle tree that is append-only. diff --git a/docs/docs/dev_docs/testing/testing.md b/docs/docs/dev_docs/tutorials/testing.md similarity index 97% rename from docs/docs/dev_docs/testing/testing.md rename to docs/docs/dev_docs/tutorials/testing.md index 8ae02751cdb..e00bccd1a81 100644 --- a/docs/docs/dev_docs/testing/testing.md +++ b/docs/docs/dev_docs/tutorials/testing.md @@ -127,7 +127,7 @@ In the near future, transactions where a public function call fails will get min We can check private or public state directly rather than going through view-only methods, as we did in the initial example by calling `token.methods.balance().view()`. Bear in mind that directly accessing contract storage will break any kind of encapsulation. -To query storage directly, you'll need to know the slot you want to access. This can be checked in the [contract's `Storage` definition](../contracts/syntax/storage.md) directly for most data types. However, when it comes to mapping types, as in most EVM languages, we'll need to calculate the slot for a given key. To do this, we'll use the `CheatCodes` utility class: +To query storage directly, you'll need to know the slot you want to access. This can be checked in the [contract's `Storage` definition](../contracts/syntax/storage.md) directly for most data types. However, when it comes to mapping types, as in most EVM languages, we'll need to calculate the slot for a given key. To do this, we'll use the [`CheatCodes`](./../testing/cheat_codes.md) utility class: #include_code calc-slot /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript @@ -163,7 +163,7 @@ We can query the RPC server for the unencrypted logs emitted in the block where ## Cheats -The `CheatCodes` class, which we used for [calculating the storage slot above](#state), also includes a set of cheat methods for modifying the chain state that can be handy for testing. +The [`CheatCodes`](./../testing/cheat_codes.md) class, which we used for [calculating the storage slot above](#state), also includes a set of cheat methods for modifying the chain state that can be handy for testing. ### Set next block timestamp diff --git a/docs/sidebars.js b/docs/sidebars.js index 230c1a5b0ff..061f120d6f3 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -223,6 +223,7 @@ const sidebars = { "dev_docs/tutorials/writing_dapp/testing", ], }, + "dev_docs/tutorials/testing", ], }, @@ -318,7 +319,7 @@ const sidebars = { type: "doc", id: "dev_docs/testing/main", }, - items: ["dev_docs/testing/testing", "dev_docs/testing/cheat_codes"], + items: ["dev_docs/testing/cheat_codes"], }, { From 2641b50a9bcab7ab4282e25173f3ba7142c0f009 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Fri, 22 Sep 2023 08:17:20 +0000 Subject: [PATCH 2/3] chore: fix broken links --- docs/docs/dev_docs/tutorials/writing_dapp/testing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/dev_docs/tutorials/writing_dapp/testing.md b/docs/docs/dev_docs/tutorials/writing_dapp/testing.md index 7083e22a658..ff9732be801 100644 --- a/docs/docs/dev_docs/tutorials/writing_dapp/testing.md +++ b/docs/docs/dev_docs/tutorials/writing_dapp/testing.md @@ -4,7 +4,7 @@ title: Testing To wrap up this tutorial, we'll set up a simple automated test for our dapp contracts. We will be using [jest](https://jestjs.io/), but any nodejs test runner works fine. -Here we'll only test the happy path for a `transfer` on our private token contract, but in a real application you should be testing both happy and unhappy paths, as well as both your contracts and application logic. Refer to the full [testing guide](../../testing/testing.md) for more info on testing and assertions. +Here we'll only test the happy path for a `transfer` on our private token contract, but in a real application you should be testing both happy and unhappy paths, as well as both your contracts and application logic. Refer to the full [testing guide](../testing.md) for more info on testing and assertions. ## Dependencies @@ -32,7 +32,7 @@ import TokenContractAbi from "../contracts/token/target/Token.json" assert { typ describe("token", () => {}); ``` -Let's set up our test suite. We'll start [a new Sandbox instance within the test](../../testing/testing.md#running-sandbox-in-the-nodejs-process), create two fresh accounts to test with, and deploy an instance of our contract. The `aztec-sandbox` and `aztec.js` provide the helper functions we need to do this: +Let's set up our test suite. We'll start [a new Sandbox instance within the test](../testing.md#running-sandbox-in-the-nodejs-process), create two fresh accounts to test with, and deploy an instance of our contract. The `aztec-sandbox` and `aztec.js` provide the helper functions we need to do this: #include_code setup yarn-project/end-to-end/src/sample-dapp/index.test.mjs javascript @@ -44,7 +44,7 @@ Now that we have a working test environment, we can write our first test for exe #include_code test yarn-project/end-to-end/src/sample-dapp/index.test.mjs javascript -In this example, we assert that the `recipient`'s balance is increased by the amount transferred. We could also test that the `owner`'s funds are decremented by the same amount, or that a transaction that attempts to send more funds than those available would fail. Check out the [testing guide](../../testing/testing.md) for more ideas. +In this example, we assert that the `recipient`'s balance is increased by the amount transferred. We could also test that the `owner`'s funds are decremented by the same amount, or that a transaction that attempts to send more funds than those available would fail. Check out the [testing guide](../testing.md) for more ideas. ## Running our tests From a8e4827239f09ca610039fffd951cc72bb6caf94 Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:41:04 +0200 Subject: [PATCH 3/3] Update docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md Co-authored-by: Rahul Kothari --- .../concepts/advanced/data_structures/indexed_merkle_tree.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md b/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md index 0cf26ac2816..927a4e6a387 100644 --- a/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md +++ b/docs/docs/concepts/advanced/data_structures/indexed_merkle_tree.md @@ -9,7 +9,7 @@ import Disclaimer from "../../../misc/common/\_disclaimer.mdx"; ## Indexed Merkle Trees -This article will introduce the concept of an indexed merkle tree, and how it can be used to improve the performance of nullifier trees in circuits. The content was also covered in a presentation with the [Privacy + Scaling Explorations](https://pse.dev/). +This article will introduce the concept of an indexed merkle tree, and how it can be used to improve the performance of nullifier trees in circuits. The content was also covered in a presentation for the [Privacy + Scaling Explorations team at the Ethereum Foundation](https://pse.dev/).