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

localnet #443

Merged
merged 13 commits into from
Aug 31, 2024
Merged

localnet #443

merged 13 commits into from
Aug 31, 2024

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Aug 21, 2024

Localnet tutorial.

Depends on zeta-chain/example-contracts#189

Summary by CodeRabbit

  • New Features
    • Introduced a "Localnet" section in the tutorial documentation for improved guidance on local development practices.
    • Added a comprehensive guide for setting up and using a Localnet environment for developing universal applications interacting with ZetaChain and EVM gateways.

Copy link
Contributor

coderabbitai bot commented Aug 21, 2024

Walkthrough

Walkthrough

The changes introduce a new section titled "localnet" in the tutorial documentation, providing developers with guidance on setting up a local development environment for universal applications. This includes detailed instructions for deploying contracts and simulating interactions with ZetaChain and EVM gateways.

Changes

Files Change Summary
src/pages/developers/tutorials/_meta.json Added a new section titled "localnet" with attributes for title, read time, and description to enhance guidance on local development practices.
src/pages/developers/tutorials/localnet.mdx Introduced a comprehensive guide for setting up Localnet, detailing steps for starting a local testnet node, deploying contracts, and managing interactions.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented Aug 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 10:37am

@fadeev fadeev marked this pull request as ready for review August 21, 2024 18:56
@fadeev fadeev requested review from bbbeeeee, brewmaster012 and a team as code owners August 21, 2024 18:56
@fadeev
Copy link
Member Author

fadeev commented Aug 21, 2024

Localnet is still WIP (for example, reverts fail: zeta-chain/localnet#23), but it's still better than nothing.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Outside diff range, codebase verification and nitpick comments (2)
src/pages/developers/tutorials/localnet.mdx (2)

34-34: Insert a comma for improved readability.

Consider adding a comma after "set up" for better readability.

Use this diff to improve the sentence:

  deployed. After the localnet is set up you will see a list of protocol contract
+ deployed. After the localnet is set up, you will see a list of protocol contract
Tools
LanguageTool

[uncategorized] ~34-~34: Possible missing comma found.
Context: ...ing deployed. After the localnet is set up you will see a list of protocol contrac...

(AI_HYDRA_LEO_MISSING_COMMA)


75-75: Insert a comma for improved readability.

Consider adding a comma after "local testnet" for better readability.

Use this diff to improve the sentence:

  Even though both contracts are deployed on the same local testnet we will think
+ Even though both contracts are deployed on the same local testnet, we will think
Tools
LanguageTool

[typographical] ~75-~75: Consider inserting a comma for improved readability.
Context: ...s are deployed on the same local testnet we will think of Hello as running on ZetaC...

(MISSING_COMMAS)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 46a1da6 and fcf4b6b.

Files selected for processing (2)
  • src/pages/developers/tutorials/_meta.json (1 hunks)
  • src/pages/developers/tutorials/localnet.mdx (1 hunks)
Additional context used
LanguageTool
src/pages/developers/tutorials/localnet.mdx

[duplication] ~12-~12: Possible typo: you repeated a word
Context: ...ment of ZetaChain by observing events and and relaying the contract calls between EVM...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~34-~34: Possible missing comma found.
Context: ...ing deployed. After the localnet is set up you will see a list of protocol contrac...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~75-~75: Consider inserting a comma for improved readability.
Context: ...s are deployed on the same local testnet we will think of Hello as running on ZetaC...

(MISSING_COMMAS)


[duplication] ~98-~98: Possible typo: you repeated a word
Context: ...d' event emitted ``` Localnet picks up the the "Deposited" event and calls the ZetaCha...

(ENGLISH_WORD_REPEAT_RULE)


[duplication] ~162-~162: Possible typo: you repeated a word
Context: ...d' event emitted ``` Localnet picks up the the "Called" event and calls the EVM gatewa...

(ENGLISH_WORD_REPEAT_RULE)

Additional comments not posted (1)
src/pages/developers/tutorials/_meta.json (1)

12-16: New entry for "localnet" looks good.

The addition of the "localnet" section is consistent with the existing structure and enhances the documentation by providing guidance on local development practices.

src/pages/developers/tutorials/localnet.mdx Outdated Show resolved Hide resolved
src/pages/developers/tutorials/localnet.mdx Outdated Show resolved Hide resolved
src/pages/developers/tutorials/localnet.mdx Outdated Show resolved Hide resolved
fadeev and others added 3 commits August 21, 2024 22:05
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (5)
src/pages/developers/tutorials/localnet.mdx (5)

10-10: Insert missing comma for improved readability.

Add a comma after "blockchain" to improve readability.

- and running on the same local blockchain Simulates the real-world testnet
+ and running on the same local blockchain, Simulates the real-world testnet

23-23: Insert missing comma for improved readability.

Add a comma after "localnet" to improve readability.

- update localnet just run `yarn add --dev @zetachain/localnet`. The template
+ update localnet, just run `yarn add --dev @zetachain/localnet`. The template
Tools
LanguageTool

[uncategorized] ~23-~23: Possible missing comma found.
Context: ...ocalnetpackage. If you need to update localnet just runyarn add --dev @zetachain/loc...

(AI_HYDRA_LEO_MISSING_COMMA)


75-75: Insert missing comma for improved readability.

Add a comma after "testnet" to improve readability.

- Even though both contracts are deployed on the same local testnet we will think
+ Even though both contracts are deployed on the same local testnet, we will think
Tools
LanguageTool

[typographical] ~75-~75: Consider inserting a comma for improved readability.
Context: ...s are deployed on the same local testnet we will think of Hello as running on ZetaC...

(MISSING_COMMAS)


134-134: Insert missing comma for improved readability.

Add a comma after "app" to improve readability.

- Now instead of emitting an event from a universal app we see an error caused by
+ Now instead of emitting an event from a universal app, we see an error caused by
Tools
LanguageTool

[uncategorized] ~134-~134: Possible missing comma found.
Context: ...d of emitting an event from a universal app we see an error caused by the `revert()...

(AI_HYDRA_LEO_MISSING_COMMA)


162-162: Correct repeated word "the".

There is a repeated word "the" in the sentence. Consider removing one of them for clarity.

- Localnet picks up the the "Called" event and calls the EVM gateway `execute`
+ Localnet picks up the "Called" event and calls the EVM gateway `execute`
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fcf4b6b and a818990.

Files selected for processing (1)
  • src/pages/developers/tutorials/localnet.mdx (1 hunks)
Additional context used
LanguageTool
src/pages/developers/tutorials/localnet.mdx

[uncategorized] ~23-~23: Possible missing comma found.
Context: ...ocalnetpackage. If you need to update localnet just runyarn add --dev @zetachain/loc...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~34-~34: Possible missing comma found.
Context: ...ing deployed. After the localnet is set up you will see a list of protocol contrac...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~75-~75: Consider inserting a comma for improved readability.
Context: ...s are deployed on the same local testnet we will think of Hello as running on ZetaC...

(MISSING_COMMAS)


[uncategorized] ~134-~134: Possible missing comma found.
Context: ...d of emitting an event from a universal app we see an error caused by the `revert()...

(AI_HYDRA_LEO_MISSING_COMMA)

Additional comments not posted (1)
src/pages/developers/tutorials/localnet.mdx (1)

25-50: LGTM!

The instructions for starting the localnet and listing the contract addresses are clear and correctly formatted.

Tools
LanguageTool

[uncategorized] ~34-~34: Possible missing comma found.
Context: ...ing deployed. After the localnet is set up you will see a list of protocol contrac...

(AI_HYDRA_LEO_MISSING_COMMA)

@fadeev
Copy link
Member Author

fadeev commented Aug 27, 2024

@bbbeeeee @brewmaster012 @zeta-chain/fullstack please, review.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (4)
src/pages/developers/tutorials/localnet.mdx (4)

1-13: Improve readability with minor grammatical changes.

Consider the following changes for better readability:

- Localnet is a local development environment that simplifies the development of universal apps.
+ Localnet is a local development environment that simplifies the development of universal applications.

- Localnet:
+ Localnet performs the following actions:

- Starts an [Anvil](https://book.getfoundry.sh/anvil/) local testnet node
+ - Starts an [Anvil](https://book.getfoundry.sh/anvil/) local testnet node.

- Deploys [protocol contracts](https://github.com/zeta-chain/protocol-contracts/tree/main/v2) on the local testnet node. Both [EVM gateway and ZetaChain gateway](/developers/evm/gateway/) are deployed and running on the same local blockchain Simulates the real-world testnet environment of ZetaChain by observing events and relaying the contract calls between EVM gateway and ZetaChain gateway
+ - Deploys [protocol contracts](https://github.com/zeta-chain/protocol-contracts/tree/main/v2) on the local testnet node. Both the [EVM gateway and ZetaChain gateway](/developers/evm/gateway/) are deployed and running on the same local blockchain. Simulates the real-world testnet environment of ZetaChain by observing events and relaying the contract calls between the EVM gateway and ZetaChain gateway.

23-25: Improve readability with minor grammatical changes.

Consider the following change for better readability:

- If you need to update localnet just run `yarn add --dev @zetachain/localnet`.
+ If you need to update Localnet, just run `yarn add --dev @zetachain/localnet`.
Tools
LanguageTool

[uncategorized] ~24-~24: Possible missing comma found.
Context: ...ocalnetpackage. If you need to update localnet just runyarn add --dev @zetachain/loc...

(AI_HYDRA_LEO_MISSING_COMMA)


33-51: Improve readability with minor grammatical changes.

Consider the following change for better readability:

- After the localnet is set up you will see a list of protocol contract addresses:
+ After the localnet is set up, you will see a list of protocol contract addresses:
Tools
LanguageTool

[uncategorized] ~35-~35: Possible missing comma found.
Context: ...ing deployed. After the localnet is set up you will see a list of protocol contrac...

(AI_HYDRA_LEO_MISSING_COMMA)


76-79: Improve readability with minor grammatical changes.

Consider the following change for better readability:

- Even though both contracts are deployed on the same local testnet we will think of Hello as running on ZetaChain and Receiver as running on a generic EVM chain.
+ Even though both contracts are deployed on the same local testnet, we will think of Hello as running on ZetaChain and Receiver as running on a generic EVM chain.
Tools
LanguageTool

[typographical] ~76-~76: Consider inserting a comma for improved readability.
Context: ...s are deployed on the same local testnet we will think of Hello as running on ZetaC...

(MISSING_COMMAS)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a818990 and bd2e165.

Files selected for processing (1)
  • src/pages/developers/tutorials/localnet.mdx (1 hunks)
Additional context used
LanguageTool
src/pages/developers/tutorials/localnet.mdx

[uncategorized] ~24-~24: Possible missing comma found.
Context: ...ocalnetpackage. If you need to update localnet just runyarn add --dev @zetachain/loc...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~35-~35: Possible missing comma found.
Context: ...ing deployed. After the localnet is set up you will see a list of protocol contrac...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~76-~76: Consider inserting a comma for improved readability.
Context: ...s are deployed on the same local testnet we will think of Hello as running on ZetaC...

(MISSING_COMMAS)

Additional comments not posted (13)
src/pages/developers/tutorials/localnet.mdx (13)

15-21: LGTM!

The instructions for cloning the example contracts repo and installing dependencies are clear and correct.


27-31: LGTM!

The instructions for starting Localnet are clear and correct.


53-54: LGTM!

The instructions for keeping the terminal window open and opening a new terminal are clear and correct.


55-60: LGTM!

The instructions for compiling and deploying contracts are clear and correct.


62-74: LGTM!

The description of the deployed contract addresses is clear and correct.


81-88: LGTM!

The instructions for calling a universal app from EVM are clear and correct.


90-104: LGTM!

The description of the "Deposited" event and the subsequent actions is clear and correct.


106-110: LGTM!

The description of the onCrossChainCall execution and the emitted event is clear and correct.


112-121: LGTM!

The instructions for calling a universal app from EVM and forcing a revert are clear and correct.


123-140: LGTM!

The description of the "Deposited" event and the subsequent actions when forcing a revert is clear and correct.


142-146: LGTM!

The description of the onRevert function execution is clear and correct.


148-154: LGTM!

The instructions for calling a receiver contract from a universal app are clear and correct.


170-174: LGTM!

The description of the receiver contract emitting an event is clear and correct.

src/pages/developers/tutorials/localnet.mdx Show resolved Hide resolved
@fadeev fadeev requested a review from CharlieMc0 August 29, 2024 10:29
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bd2e165 and 1cf9c57.

Files selected for processing (1)
  • src/pages/developers/tutorials/localnet.mdx (1 hunks)
Additional context used
LanguageTool
src/pages/developers/tutorials/localnet.mdx

[typographical] ~76-~76: Consider inserting a comma for improved readability.
Context: ...s are deployed on the same local testnet we will think of Hello as running on ZetaC...

(MISSING_COMMAS)

Additional comments not posted (12)
src/pages/developers/tutorials/localnet.mdx (12)

1-2: LGTM!

The introductory section is clear and concise.


4-13: LGTM!

The Localnet features section is clear and concise.


15-21: LGTM!

The section on cloning the example contracts repo and installing dependencies is clear and concise.


23-25: LGTM!

The section on installing Localnet is clear and concise.


27-31: LGTM!

The section on starting Localnet is clear and concise.


33-51: LGTM!

The section on Localnet output is clear and concise.


53-54: LGTM!

The section on keeping the terminal window open is clear and concise.


55-74: LGTM!

The section on compiling and deploying contracts is clear and concise.


81-110: LGTM!

The section on calling a universal app from EVM is clear and concise.


112-146: LGTM!

The section on calling a universal app from EVM and reverting is clear and concise.


148-174: LGTM!

The section on calling a receiver contract from a universal app is clear and concise.


176-181: LGTM!

The concluding section is clear and concise.

@fadeev
Copy link
Member Author

fadeev commented Aug 30, 2024

@bbbeeeee @brewmaster012 @zeta-chain/fullstack please, review.

Copy link
Collaborator

@GMaiolo GMaiolo left a comment

Choose a reason for hiding this comment

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

Concept ACK

@fadeev fadeev merged commit 49773f9 into main Aug 31, 2024
6 checks passed
@fadeev fadeev deleted the localnet branch August 31, 2024 01:04
This was referenced Oct 1, 2024
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.

3 participants