Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): Update the token bridge tutorial #11578

Merged
merged 37 commits into from
Feb 12, 2025
Merged

Conversation

critesjosh
Copy link
Contributor

@critesjosh critesjosh commented Jan 28, 2025

This PR updates the token bridge tutorial pages in the docs, and adds an e2e test to ensure that referenced code is always working.

closes #10638

@critesjosh critesjosh marked this pull request as ready for review January 29, 2025 18:12
@AztecBot
Copy link
Collaborator

AztecBot commented Jan 29, 2025

Docs Preview

Hey there! 👋 You can check your preview at https://67acd87be967f80abd6b04a1--aztec-docs-dev.netlify.app

@catmcgee
Copy link
Contributor

catmcgee commented Feb 4, 2025

im a bit confused about how to follow this tutorial. the contracts part reads as more of a reference like the uniswap one. would it be better to go step-by-step?

@critesjosh
Copy link
Contributor Author

The top section is more of an overview of the components involved in the token bridge. I didn't write it with the intention that developers would reproduce all of these components locally as they follow along. So the first half of the page is more of an explainer and the second half of the page (starting with "Running with Aztec.js") is really where the tutorial starts. The tutorial is just about interacting with all of the components in TS.

Do you think this a bad idea for the page structure? Or is it okay and should I just make it more clear at the beginning how the page is structured?

@catmcgee
Copy link
Contributor

catmcgee commented Feb 5, 2025

@critesjosh I think that's good but yeah I'd say it needs to be more clear where the dev would start following along. maybe it makes more sense in the dapp tutorial section rather than contracts?

@critesjosh
Copy link
Contributor Author

@critesjosh I think that's good but yeah I'd say it needs to be more clear where the dev would start following along. maybe it makes more sense in the dapp tutorial section rather than contracts?

Ok I added detail to make it more clear when to follow along. I'm not sure that it makes sense to put in dapp tutorial section since its not really a dapp, its just a script that uses all of these contracts. The script is useful in that it helps developers better understand the flow of data between the contracts I think

@critesjosh critesjosh requested a review from catmcgee February 5, 2025 18:06
Copy link
Contributor

@catmcgee catmcgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some initial comments about structure

mkdir token-bridge-tutorial
cd token-bridge-tutorial
yarn init -y
yarn add @aztec/aztec.js @aztec/noir-contracts.js @aztec/l1-artifacts @aztec/accounts @aztec/ethereum @aztec/types @types/node typescript@^5.0.4 viem@^2.22.8 tsx
Copy link
Contributor

@catmcgee catmcgee Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in new aztec sandbox i also had to add tslib and lodash.omit

Suggested change
yarn add @aztec/aztec.js @aztec/noir-contracts.js @aztec/l1-artifacts @aztec/accounts @aztec/ethereum @aztec/types @types/node typescript@^5.0.4 viem@^2.22.8 tsx
yarn add @aztec/aztec.js @aztec/noir-contracts.js @aztec/l1-artifacts @aztec/accounts @aztec/ethereum @aztec/types @types/node typescript@^5.0.4 viem@^2.22.8 tsx tslib lodash.omit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything works besides this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share the error you see without these installed? I just ran through this again and it works for me without these additional packages. Maybe its a mac vs linux thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@signorecello was hitting some errors as well, installing node versino 18.19 made it work. I will update the file to specify the node version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the version i am using too. the lodash error was Error: @aztec/circuit-types tried to access lodash.omit, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound. and tslib was the usual cannot find

Copy link
Contributor Author

@critesjosh critesjosh Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the problem. Can you try creating .yarnrc.yml and specify the node linker?

echo "nodeLinker: node-modules" > .yarnrc.yml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works

@critesjosh critesjosh requested a review from catmcgee February 7, 2025 17:13
Copy link
Contributor

@catmcgee catmcgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving. but would be good if we can get @jzaki or @saleel to go through and see if they hit errors as @signorecello & i got different ones

Copy link
Contributor

@jzaki jzaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments


The Aztec message Inbox expects a recipient Aztec address that can consume the message (the corresponding L2 bridge contract), the Aztec version (similar to Ethereum's `chainId`), the message content hash (which includes the token recipient and amount in this case), and a `secretHash`, where the corresponding `secret` is used to consume the message on the receiving contract.

So in summary, it deposits tokens to the portal, encodes a mint message, hashes it, and sends it to the Aztec rollup via the Inbox. The L2 token contract can then mint the tokens when it processes the message.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section might benefit from a couple of simple overview diagrams, to frame everything

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt?
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this took me 3 mins to make with claude.ai. good idea

@signorecello
Copy link
Contributor

approving. but would be good if we can get @jzaki or @saleel to go through and see if they hit errors as @signorecello & i got different ones

the issue was node versions, it worked with 18.10 which although (very) old is the default one for the monorepo

@critesjosh critesjosh enabled auto-merge (squash) February 12, 2025 17:01
@critesjosh critesjosh merged commit aaf42a7 into master Feb 12, 2025
52 checks passed
@critesjosh critesjosh deleted the jc/docs-bridge-tutorial branch February 12, 2025 17:32
sklppy88 pushed a commit that referenced this pull request Feb 13, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.76.3</summary>

##
[0.76.3](aztec-package-v0.76.2...aztec-package-v0.76.3)
(2025-02-12)


### Features

* Add undici
([#11818](#11818))
([8503c7a](8503c7a))
* Initial multi-proof test
([#11779](#11779))
([f54db75](f54db75))
</details>

<details><summary>barretenberg.js: 0.76.3</summary>

##
[0.76.3](barretenberg.js-v0.76.2...barretenberg.js-v0.76.3)
(2025-02-12)


### Features

* **perf:** Speed up construction of bbjs Frs & cache zero hashes in
ephemeral trees (redo)
([#11894](#11894))
([e093acf](e093acf))


### Bug Fixes

* Memory fragmentation fixes to cut UltraHonk memory usage by 26%
([#11895](#11895))
([b4e2264](b4e2264))
</details>

<details><summary>aztec-packages: 0.76.3</summary>

##
[0.76.3](aztec-packages-v0.76.2...aztec-packages-v0.76.3)
(2025-02-12)


### Features

* Add undici
([#11818](#11818))
([8503c7a](8503c7a))
* **avm:** Sequential lookup resolution
([#11769](#11769))
([3980f6c](3980f6c))
* Enable ws for reth on devnet
([#11922](#11922))
([7124664](7124664)),
closes
[#11921](#11921)
* Initial multi-proof test
([#11779](#11779))
([f54db75](f54db75))
* Native world state now supports checkpointing
([#11739](#11739))
([6464059](6464059))
* **perf:** Speed up construction of bbjs Frs & cache zero hashes in
ephemeral trees (redo)
([#11894](#11894))
([e093acf](e093acf))


### Bug Fixes

* Correctly configure batch queue
([#11934](#11934))
([4908df8](4908df8))
* De-dup pubkey conversion of cli-wallet param
([#11948](#11948))
([5529871](5529871))
* **docs:** Update the token bridge tutorial
([#11578](#11578))
([aaf42a7](aaf42a7))
* Don't restart kind control plane automatically
([#11923](#11923))
([c23c0f9](c23c0f9))
* Empty blocks can now be unwound
([#11920](#11920))
([fdc2042](fdc2042))
* Gcloud logs
([#11944](#11944))
([c53b1c5](c53b1c5)),
closes
[#11887](#11887)
* Lmdb cmake race condition
([#11959](#11959))
([031200d](031200d))
* Memory fragmentation fixes to cut UltraHonk memory usage by 26%
([#11895](#11895))
([b4e2264](b4e2264))
* Npm packages noir resolution
([#11946](#11946))
([d3e3f20](d3e3f20))
* Set resource limits on Loki pods
([#11940](#11940))
([6999982](6999982))


### Miscellaneous

* Only take FF (and not Flavor) in compute_logderivative_inverse
([#11938](#11938))
([bbbded3](bbbded3))
* Op queue cleanup
([#11925](#11925))
([082ed66](082ed66))
* Renaming `pxe_db.nr` as `capsules.nr`
([#11905](#11905))
([14d873c](14d873c))
* Replace relative paths to noir-protocol-circuits
([9ce401a](9ce401a))
* Use realistic size Client IVC proofs during simulations
([#11692](#11692))
([90b9fbf](90b9fbf))
* Use RelationChecker in relation correctness tests and add Translator
interleaving test
([#11878](#11878))
([ed215e8](ed215e8))
</details>

<details><summary>barretenberg: 0.76.3</summary>

##
[0.76.3](barretenberg-v0.76.2...barretenberg-v0.76.3)
(2025-02-12)


### Features

* **avm:** Sequential lookup resolution
([#11769](#11769))
([3980f6c](3980f6c))
* Native world state now supports checkpointing
([#11739](#11739))
([6464059](6464059))


### Bug Fixes

* Empty blocks can now be unwound
([#11920](#11920))
([fdc2042](fdc2042))
* Lmdb cmake race condition
([#11959](#11959))
([031200d](031200d))
* Memory fragmentation fixes to cut UltraHonk memory usage by 26%
([#11895](#11895))
([b4e2264](b4e2264))


### Miscellaneous

* Only take FF (and not Flavor) in compute_logderivative_inverse
([#11938](#11938))
([bbbded3](bbbded3))
* Op queue cleanup
([#11925](#11925))
([082ed66](082ed66))
* Use RelationChecker in relation correctness tests and add Translator
interleaving test
([#11878](#11878))
([ed215e8](ed215e8))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Feb 14, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.76.3</summary>

##
[0.76.3](AztecProtocol/aztec-packages@aztec-package-v0.76.2...aztec-package-v0.76.3)
(2025-02-12)


### Features

* Add undici
([#11818](AztecProtocol/aztec-packages#11818))
([8503c7a](AztecProtocol/aztec-packages@8503c7a))
* Initial multi-proof test
([#11779](AztecProtocol/aztec-packages#11779))
([f54db75](AztecProtocol/aztec-packages@f54db75))
</details>

<details><summary>barretenberg.js: 0.76.3</summary>

##
[0.76.3](AztecProtocol/aztec-packages@barretenberg.js-v0.76.2...barretenberg.js-v0.76.3)
(2025-02-12)


### Features

* **perf:** Speed up construction of bbjs Frs & cache zero hashes in
ephemeral trees (redo)
([#11894](AztecProtocol/aztec-packages#11894))
([e093acf](AztecProtocol/aztec-packages@e093acf))


### Bug Fixes

* Memory fragmentation fixes to cut UltraHonk memory usage by 26%
([#11895](AztecProtocol/aztec-packages#11895))
([b4e2264](AztecProtocol/aztec-packages@b4e2264))
</details>

<details><summary>aztec-packages: 0.76.3</summary>

##
[0.76.3](AztecProtocol/aztec-packages@aztec-packages-v0.76.2...aztec-packages-v0.76.3)
(2025-02-12)


### Features

* Add undici
([#11818](AztecProtocol/aztec-packages#11818))
([8503c7a](AztecProtocol/aztec-packages@8503c7a))
* **avm:** Sequential lookup resolution
([#11769](AztecProtocol/aztec-packages#11769))
([3980f6c](AztecProtocol/aztec-packages@3980f6c))
* Enable ws for reth on devnet
([#11922](AztecProtocol/aztec-packages#11922))
([7124664](AztecProtocol/aztec-packages@7124664)),
closes
[#11921](AztecProtocol/aztec-packages#11921)
* Initial multi-proof test
([#11779](AztecProtocol/aztec-packages#11779))
([f54db75](AztecProtocol/aztec-packages@f54db75))
* Native world state now supports checkpointing
([#11739](AztecProtocol/aztec-packages#11739))
([6464059](AztecProtocol/aztec-packages@6464059))
* **perf:** Speed up construction of bbjs Frs & cache zero hashes in
ephemeral trees (redo)
([#11894](AztecProtocol/aztec-packages#11894))
([e093acf](AztecProtocol/aztec-packages@e093acf))


### Bug Fixes

* Correctly configure batch queue
([#11934](AztecProtocol/aztec-packages#11934))
([4908df8](AztecProtocol/aztec-packages@4908df8))
* De-dup pubkey conversion of cli-wallet param
([#11948](AztecProtocol/aztec-packages#11948))
([5529871](AztecProtocol/aztec-packages@5529871))
* **docs:** Update the token bridge tutorial
([#11578](AztecProtocol/aztec-packages#11578))
([aaf42a7](AztecProtocol/aztec-packages@aaf42a7))
* Don't restart kind control plane automatically
([#11923](AztecProtocol/aztec-packages#11923))
([c23c0f9](AztecProtocol/aztec-packages@c23c0f9))
* Empty blocks can now be unwound
([#11920](AztecProtocol/aztec-packages#11920))
([fdc2042](AztecProtocol/aztec-packages@fdc2042))
* Gcloud logs
([#11944](AztecProtocol/aztec-packages#11944))
([c53b1c5](AztecProtocol/aztec-packages@c53b1c5)),
closes
[#11887](AztecProtocol/aztec-packages#11887)
* Lmdb cmake race condition
([#11959](AztecProtocol/aztec-packages#11959))
([031200d](AztecProtocol/aztec-packages@031200d))
* Memory fragmentation fixes to cut UltraHonk memory usage by 26%
([#11895](AztecProtocol/aztec-packages#11895))
([b4e2264](AztecProtocol/aztec-packages@b4e2264))
* Npm packages noir resolution
([#11946](AztecProtocol/aztec-packages#11946))
([d3e3f20](AztecProtocol/aztec-packages@d3e3f20))
* Set resource limits on Loki pods
([#11940](AztecProtocol/aztec-packages#11940))
([6999982](AztecProtocol/aztec-packages@6999982))


### Miscellaneous

* Only take FF (and not Flavor) in compute_logderivative_inverse
([#11938](AztecProtocol/aztec-packages#11938))
([bbbded3](AztecProtocol/aztec-packages@bbbded3))
* Op queue cleanup
([#11925](AztecProtocol/aztec-packages#11925))
([082ed66](AztecProtocol/aztec-packages@082ed66))
* Renaming `pxe_db.nr` as `capsules.nr`
([#11905](AztecProtocol/aztec-packages#11905))
([14d873c](AztecProtocol/aztec-packages@14d873c))
* Replace relative paths to noir-protocol-circuits
([9ce401a](AztecProtocol/aztec-packages@9ce401a))
* Use realistic size Client IVC proofs during simulations
([#11692](AztecProtocol/aztec-packages#11692))
([90b9fbf](AztecProtocol/aztec-packages@90b9fbf))
* Use RelationChecker in relation correctness tests and add Translator
interleaving test
([#11878](AztecProtocol/aztec-packages#11878))
([ed215e8](AztecProtocol/aztec-packages@ed215e8))
</details>

<details><summary>barretenberg: 0.76.3</summary>

##
[0.76.3](AztecProtocol/aztec-packages@barretenberg-v0.76.2...barretenberg-v0.76.3)
(2025-02-12)


### Features

* **avm:** Sequential lookup resolution
([#11769](AztecProtocol/aztec-packages#11769))
([3980f6c](AztecProtocol/aztec-packages@3980f6c))
* Native world state now supports checkpointing
([#11739](AztecProtocol/aztec-packages#11739))
([6464059](AztecProtocol/aztec-packages@6464059))


### Bug Fixes

* Empty blocks can now be unwound
([#11920](AztecProtocol/aztec-packages#11920))
([fdc2042](AztecProtocol/aztec-packages@fdc2042))
* Lmdb cmake race condition
([#11959](AztecProtocol/aztec-packages#11959))
([031200d](AztecProtocol/aztec-packages@031200d))
* Memory fragmentation fixes to cut UltraHonk memory usage by 26%
([#11895](AztecProtocol/aztec-packages#11895))
([b4e2264](AztecProtocol/aztec-packages@b4e2264))


### Miscellaneous

* Only take FF (and not Flavor) in compute_logderivative_inverse
([#11938](AztecProtocol/aztec-packages#11938))
([bbbded3](AztecProtocol/aztec-packages@bbbded3))
* Op queue cleanup
([#11925](AztecProtocol/aztec-packages#11925))
([082ed66](AztecProtocol/aztec-packages@082ed66))
* Use RelationChecker in relation correctness tests and add Translator
interleaving test
([#11878](AztecProtocol/aztec-packages#11878))
([ed215e8](AztecProtocol/aztec-packages@ed215e8))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: fix Token Bridge tutorial
5 participants