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

chore: rebrand to anvil-zksync #277

Merged
merged 8 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This CODEOWNERS file sets the individuals responsible for code in the era-test-node repository.
# This CODEOWNERS file sets the individuals responsible for code in the zksync-docs repository.

# These users are the default owners for everything in the repo.
# They will be requested for review when someone opens a pull request.
Expand Down
17 changes: 9 additions & 8 deletions content/00.zksync-era/10.guides/20.zksync-101/00.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ npm install -g zksync-cli

## Setup local node

This series of guides will use an in memory node which allows for quicker testing and debugging processes.
This series of guides will use in memory anvil-zksync node which allows for quicker testing and debugging processes.
A great benefit of using a local node is that you will avoid incurring any actual transaction costs.
ZKsync Era node provides a set of rich wallets that come with more than enough ETH to use for development.

### Run a local in memory node
### Run a local in memory anvil-zksync node

To run a local in memory node on your machine, you will need Docker running.
To run a local in memory anvil-zksync node on your machine, you will need Docker running.
The easiest way to start Docker is to run the Docker Desktop app.

We are going to use the "In memory node" module for our local node setup.
Expand Down Expand Up @@ -79,12 +79,13 @@ We are going to use the "In memory node" module for our local node setup.
zksync-cli dev start
```

The in memory node includes pre-configured rich wallets for use, see [in-memory-node rich wallets](/zksync-era/tooling/local-setup/in-memory-node#pre-configured-rich-wallets).
anvil-zksync node includes pre-configured rich wallets for use, see [anvil-zksync rich wallets](/build/test-and-debug/in-memory-node#pre-configured-rich-wallets).

Your in memory node is accessible at **[http://127.0.0.1:8011](http://127.0.0.1:8011/)**, ready for deployment or testing purposes.
Your anvil-zksync node is accessible at **[http://127.0.0.1:8011](http://127.0.0.1:8011/)**, ready for deployment or testing purposes.
You can use the Docker Desktop app to view logs from the running ZKsync Era node or use the `zksync-cli dev logs` command.
When you are done running your in memory node, you can stop it with `zksync-cli dev stop`.
You can learn more about managing a local node with ZKsync CLI on [Running a node](/zksync-era/tooling/zksync-cli/running-a-node).

When you are done running your anvil-zksync node, you can stop it with `zksync-cli dev stop`.
You can learn more about managing a local node with ZKsync CLI on [Running a node](/build/zksync-cli/running-a-node).

## Create the ZKsync 101 project

Expand All @@ -98,7 +99,7 @@ zksync-cli create zksync-101 --template zksync-101
After you run the `create` command, the CLI will download and install packages for the project.
You should see a success message and instructions to get started with your project.

Since we are using a local in memory node for development, we can use one of the
Since we are using a local in memory anvil-zksync node for development, we can use one of the
rich wallets for transactions and deployments.

Rename the `.env.example` to `.env` which includes the private key for the first rich wallet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In this section you will learn how to:

:check-icon Craft a smart contract to fund Zeek's latest adventure.

:check-icon Deploy the contract onto your local in memory node.
:check-icon Deploy the contract onto your local in memory anvil-zksync node.

:check-icon Interact with the contract with ZKsync CLI

Expand Down Expand Up @@ -94,7 +94,7 @@ Estimated deployment cost: 0.0065057128 ETH

## Interact with the contract

Now that our contract is deployed to our local in memory node, let's interact with it!
Now that our contract is deployed to our local in memory anvil-zksync node, let's interact with it!
We initially set up the crowdfunding campaign with an amount of `.02 ETH` for the goal.

### Read from the contract using ZKsync CLI
Expand Down Expand Up @@ -191,7 +191,7 @@ to interact with the deployed contract using ZKsync CLI!
- **EVM Compatibility:** ZKsync is EVM compatible and you can write smart contracts in Solidity or Vyper.
- **Custom Compilation:** Contracts deployed to ZKsync are compiled using `zksolc` or `zkvyper` as
they generate a special bytecode for ZKsync's ZKEVM.
- **Development Tools:** In memory node is a quick and easy local node environment to deploy to,
- **Development Tools:** In memory anvil-zksync node is a quick and easy local node environment to deploy to,
saving costs on deployment while developing.
- **ZKsync CLI:** A powerful command line tool to interact with contracts easily.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ numerous similar contracts efficiently.

## Setup the project

Make sure to go through the setup provided in the initial [Getting started](/zksync-era/guides/zksync-101) section.
You will have downloaded the 101 project through ZKsync CLI `create` and started up a local in memory node for development.
Make sure to go through the setup provided in the initial [Getting started](/build/start-coding/zksync-101) section.
You will have downloaded the 101 project through ZKsync CLI `create` and started up a local in memory anvil-zksync node for development.

If you haven't started up your local in memory node or you're not sure, run the following:
If you haven't started up your local in memory anvil-zksync node or you're not sure, run the following:

```bash
zksync-cli dev restart
Expand Down
4 changes: 2 additions & 2 deletions content/00.zksync-era/10.guides/20.zksync-101/30.testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ in the second, work flawlessly.
Make sure to go through the setup provided in the initial [Getting started](/zksync-era/guides/zksync-101) section.
You will have downloaded the 101 project through ZKsync CLI `create`.
Since we are using `hardhat-zksync` for testing, you do not need to have the
in memory node running for this section.
in memory anvil-zksync node running for this section.

If your local in-memory node is running, stop it with the following command:
If your local `anvil-zksync` node is running, stop it with the following command:

```bash
zksync-cli dev stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ lead you through the strategies and practices for making the `CrowdfundingCampai

## Setup the project

Make sure to go through the setup provided in the initial [Getting started](/zksync-era/guides/zksync-101) section.
You will have downloaded the 101 project through ZKsync CLI `create` and started up a local in-memory node for development.
Make sure to go through the setup provided in the initial [Getting started](/build/start-coding/zksync-101) section.
You will have downloaded the 101 project through ZKsync CLI `create` and started up a local anvil-zksync node for development.

If you haven't started up your local in-memory node or you're not sure, run the following:
If you haven't started up your local `anvil-zksync` node or you're not sure, run the following:

```bash
zksync-cli dev restart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ V2_BeaconCrowdfundingCampaign initialized. Transaction Hash: 0x5f3131c77fcac1939
## Verify upgradeable contracts

::callout{icon="i-heroicons-exclamation-triangle" color="amber"}
Since we are using the in memory node for our smart contracts, we do not have the feature
Since we are using the in memory anvil-zksync node for our smart contracts, we do not have the feature
available to verify the smart contract.

The following explains how you can verify an upgraded smart contract on testnet or mainnet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ V2CrowdfundingCampaign initialized. Transaction Hash: 0x3a7cbf9d584457bc6b452964
## Verify upgradable contracts

::callout{icon="i-heroicons-exclamation-triangle" color="amber"}
Since we are using in memory node for our smart contracts, we do not have the feature
Since we are using in memory anvil-zksync node for our smart contracts, we do not have the feature
available to verify the smart contract.

The following explains how you can verify an upgraded smart contract on testnet or mainnet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ V2_UUPSCrowdfundingCampaign initialized! Transaction Hash: 0xab959f588b64dc6dee1
## Verify upgradable contracts

::callout{icon="i-heroicons-exclamation-triangle" color="amber"}
Since we are using the in memory node for our smart contracts, we do not have the feature
Since we are using the in memory anvil-zksync node for our smart contracts, we do not have the feature
available to verify the smart contract.

The following explains how you can verify an upgraded smart contract on testnet or mainnet.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
title: Hardhat
description: Learn how to test on era-test-node with Hardhat.
description: Learn how to test on anvil-zksync with Hardhat.
---

In the world of decentralized applications, the margin for error is remarkably narrow.
A single mistake in a contract can have catastrophic implications.
For those seeking an efficient method to test and refine their contracts,
this guide showcases how to utilize Hardhat and `era_test_node` for all testing needs.
this guide showcases how to utilize Hardhat and `anvil-zksync` for all testing needs.

To test our contract, we are going to use Hardhat and `era_test_node` for rapid local development.
To test our contract, we are going to use Hardhat and `anvil-zksync` for rapid local development.
In our tests we're going to use `zksync-ethers` to interact with the `Greeter` contract,
and we'll use [Mocha](https://mochajs.org/) as our test runner.

### Prerequisites

- `zksync-cli` installed from the [zksync-cli section](/zksync-era/tooling/zksync-cli).
- `era_test_node` installed and running. See [In-memory Node](/zksync-era/tooling/local-setup/in-memory-node).
- `zksync-cli` installed from the [zksync-cli section](/build/zksync-cli).
- `anvil-zksync` installed and running. See [anvil-zksync](/build/test-and-debug/in-memory-node).

---
## Environment setup
Expand Down Expand Up @@ -73,10 +73,10 @@ and we'll use [Mocha](https://mochajs.org/) as our test runner.
The `@nomicfoundation/hardhat-chai-matchers` plugin adds Ethereum specific capabilities
to the [Chai](https://www.chaijs.com/) assertion library for testing smart contracts.

1. Start `era_test_node`:
1. Start `anvil-zksync`:

```bash
./target/release/era_test_node run
./target/release/anvil-zksync run
```

---
Expand Down Expand Up @@ -288,7 +288,7 @@ This section imports all necessary utilities and configurations needed to run ou
- `expect` from Chai provides assertion functionalities for our tests.
- `Wallet`, `Provider`, and `Contract` from `zksync-ethers` help us with ZKsync functionalities like creating wallets and interacting with contracts.
- `hre` and `Deployer` give us hardhat specific functionalities for deploying and interacting with our contract.
- `zkSyncTestnet` from our hardhat configuration provides network details of our running `era_test_node.`
- `zkSyncTestnet` from our hardhat configuration provides network details of our running `anvil-zksync.`
#### Contract Deployment Utility
Expand Down
12 changes: 6 additions & 6 deletions content/00.zksync-era/40.tooling/10.local-setup/00.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@ description: Learn about the recommended paths of testing and debugging your pro
ZKsync Era provides two distinct testing environments for your local development needs:

- Dockerized local setup
- In-Memory Node.
- anvil-zksync (in-memory node implementation for ZKsync).

Each solution boasts unique characteristics tailored to diverse use cases.
This section aims to unpack the intricacies of these tools, aiding you in selecting the setup best suited for your development workflow.

---
## In-Memory node vs Dockerized local setup
## anvil-zksync vs Dockerized local setup

The local testing process revolves around two principal options:

1. **Dockerized local setup**: An extensive ZKsync Era network simulation that comprises a Postgres database,
a local Geth node functioning as Layer 1, and the ZKsync node.
Opt for this setup for comprehensive simulations and testing that require interaction with both L1 and L2.

2. **In-Memory node**: A lightweight, speedy alternative, the in-memory node, supports forking the state from various networks,
2. **anvil-zksync**: A lightweight, speedy alternative, the anvil-zksync node, supports forking the state from various networks,
including the mainnet and testnet. This choice is ideal for swift testing, prototyping, and bootloader and system contract testing.

### When to use each

- Use the **Dockerized local setup** for in-depth simulations and tests that necessitate L1 and L2 interaction.
This detailed setup mirrors how your contracts will function within the mainnet ZKsync Era network.

- Opt for the **In-Memory node** for swift testing, prototyping, or testing new changes via the local bootloader and system contracts.
- Opt for the **anvil-zksync** for swift testing, prototyping, or testing new changes via the local bootloader and system contracts.
This setup facilitates forking the state from the mainnet or testnet, suitable for replaying transactions
or observing the impact of modifications on existing contracts.

### Feature comparison

The following table highlights the key characteristics of each testing environment for a quick comparison:

| Feature | In-memory node | Dockerized local setup |
| Feature | anvil-zksync | Dockerized local setup |
| --------------------------------------- | ------------------- | ---------------------- |
| Quick startup | Yes | No |
| Supports forking state | Yes | No |
Expand All @@ -51,5 +51,5 @@ The following table highlights the key characteristics of each testing environme
| Websocket support | No | Yes |

Whether you're testing new contracts, debugging transactions, or prototyping, ZKsync Era provides robust options for local testing.
Both the Dockerized local setup and the In-Memory Node offer feature-rich and quick setup options, each with their distinct strengths and limitations.
Both the Dockerized local setup and the anvil-zksync offer feature-rich and quick setup options, each with their distinct strengths and limitations.
Choose the most appropriate setup based on your specific needs, and happy testing!
Loading
Loading