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

docs: initialize a guide to use the V2 contracts in localnet #235

Merged
merged 9 commits into from
Jul 18, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Jul 17, 2024

Closes: #234

This PR adds a document introducing the localnet environment for V2 contracts.

Over the time, the documentation and local environment tooling will be improved and potentially moved to a new repo outlined here: #224

This document allows to have an initial entrypoint for developers who want to experiment with the new architecture

Summary by CodeRabbit

  • Documentation
    • Added documentation for V2 Contracts - Local Development Environment, explaining the architecture for building Universal Apps with GatewayZEVM and GatewayEVM. Includes functions for depositing, withdrawing, and cross-chain smart contract calls.
    • Provides instructions for deploying a local network using Anvil and includes examples of contracts utilizing the V2 interface.

Copy link
Contributor

coderabbitai bot commented Jul 17, 2024

Walkthrough

The recent changes introduce a notice in the README about the ongoing development of Version 2 (V2) of the smart contract architecture, which aims to enhance the developer experience for building Universal Apps. Additionally, comprehensive documentation for the V2 Contracts - Local Development Environment has been added, explaining the architecture, interface, and usage of GatewayZEVM and GatewayEVM contracts for local testing.

Changes

File Change Summary
readme.md Added an important notice about V2 development and instructions for testing on the local network.
v2_localnet.md Introduced detailed documentation for V2 Contracts - Local Development Environment, covering architecture, interfaces, and usage examples.

Sequence Diagram(s)

No sequence diagrams provided as the changes primarily involve documentation updates and a notice addition.

Assessment against linked issues

Objective Addressed Explanation
Add notice for V2 development (#234)

Poem

In the realm where code is spun,
V2 rises like the morning sun.
Gateways open, seamless calls,
Across the chains, the future sprawls.
Test in local, dreams made real,
Universal Apps' new appeal.
CodeRabbit hops with glee,
V2's here, for all to see! 🌟


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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@codecov-commenter
Copy link

codecov-commenter commented Jul 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.29%. Comparing base (07ae254) to head (9c39229).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #235   +/-   ##
=======================================
  Coverage   58.29%   58.29%           
=======================================
  Files          11       11           
  Lines         235      235           
  Branches       61       61           
=======================================
  Hits          137      137           
  Misses         98       98           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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: 2

Outside diff range, codebase verification and nitpick comments (1)
v2_localnet.md (1)

3-3: Clarify the stability of the V2 architecture.

The notice about the architecture's stability is crucial but could be more explicit about what might change.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2bbd352 and e1f43be.

Files selected for processing (2)
  • readme.md (1 hunks)
  • v2_localnet.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • readme.md
Additional context used
LanguageTool
v2_localnet.md

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ewayZEVM and GatewayEVM. * GatewayEVM: Deployed on each connected chain to int...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~10-~10: Loose punctuation mark.
Context: ...interact with ZetaChain. * GatewayZEVM: Deployed on ZetaChain to interact with ...

(UNLIKELY_OPENING_PUNCTUATION)

Markdownlint
v2_localnet.md

100-100: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


101-101: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


39-39: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


45-45: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


51-51: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


57-57: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


65-65: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


71-71: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


77-77: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


86-86: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


93-93: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


105-105: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


114-114: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


134-134: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Gitleaks
v2_localnet.md

116-117: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


119-120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


122-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (3)
v2_localnet.md (3)

12-12: Check the link to the V2 contracts source code.

Ensure that the link to the V2 contracts source code is correct and accessible.

Verification successful

The link to the V2 contracts source code is correct and accessible.

  • The directory contracts/prototypes/ exists, confirming the link is valid.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the link to the V2 contracts source code.

# Test: Check if the directory exists. Expect: Directory exists.
if [ -d "contracts/prototypes/" ]; then
  echo "Directory exists."
else
  echo "Directory does not exist."
fi

Length of output: 79


85-139: Review and test the setup commands for local environment.

Ensure that the provided commands for setting up the local environment and testing the contracts work as intended.

Verification successful

Review and test the setup commands for local environment.

The provided commands for setting up the local environment and testing the contracts are correctly documented and the necessary scripts are present in the package.json file. The expected contract files are also present in the repository.

  • The yarn and npx commands are correctly referenced in the v2_localnet.md file.
  • The localnet script is defined in the package.json file.
  • The expected contract files are present in the protocol-contracts/contracts/prototypes/zevm and protocol-contracts/contracts/prototypes/evm directories.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Test the provided setup commands for the local environment.

# Test: Simulate the commands in a controlled environment. Expect: Commands execute without errors.
echo "Simulating setup commands..."
echo "Cloning repository..."
git clone https://github.com/zeta-chain/protocol-contracts.git
cd protocol-contracts
echo "Starting local environment network..."
yarn
yarn localnet --hide="NODE"
echo "Testing contract interactions..."
npx hardhat zevm-call --network localhost
npx hardhat zevm-withdraw-and-call --network localhost
npx hardhat evm-call --network localhost
npx hardhat evm-deposit-and-call --network localhost

Length of output: 1135


Script:

#!/bin/bash
# Verify the presence of the `yarn` and `npx` commands in the documentation
echo "Searching for 'yarn' command in documentation..."
rg 'yarn' v2_localnet.md

echo "Searching for 'npx' command in documentation..."
rg 'npx' v2_localnet.md

# Check the `package.json` file for the `localnet` script definition
echo "Checking for 'localnet' script in package.json..."
rg '"localnet"' protocol-contracts/package.json

# List the files in the repository to ensure the presence of the expected contract files
echo "Listing files in the repository..."
ls protocol-contracts/contracts/prototypes/zevm
ls protocol-contracts/contracts/prototypes/evm

Length of output: 1163

Tools
Markdownlint

100-100: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


101-101: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


86-86: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


93-93: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


105-105: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


114-114: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


134-134: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Gitleaks

116-117: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


119-120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


122-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


7-11: Validate the description of the Gateway contracts.

Ensure that the description of GatewayEVM and GatewayZEVM matches their actual implementation and roles within the system.

Verification successful

Descriptions of Gateway Contracts Verified

The descriptions of GatewayEVM and GatewayZEVM in the documentation accurately reflect their implementations and roles within the system.

  • GatewayEVM: Deployed on each connected chain to interact with ZetaChain.
  • GatewayZEVM: Deployed on ZetaChain to interact with connected chains.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the descriptions of GatewayEVM and GatewayZEVM match their implementations.

ast-grep --lang solidity --pattern $'contract GatewayEVM {
  $$$
}' --pattern $'contract GatewayZEVM {
  $$$
}'

Length of output: 228


Script:

#!/bin/bash
# Description: Verify the descriptions of GatewayEVM and GatewayZEVM match their implementations.

# Search for the definitions of GatewayEVM and GatewayZEVM contracts in Solidity files.
rg 'contract GatewayEVM' -A 10 --glob '*.sol'
rg 'contract GatewayZEVM' -A 10 --glob '*.sol'

Length of output: 17032


Script:

#!/bin/bash
# Extract more context around the definitions of GatewayEVM and GatewayZEVM contracts to understand their roles and interactions.

# Extract lines around the definition of GatewayEVM contract
rg 'contract GatewayEVM' -A 50 --glob 'contracts/prototypes/evm/GatewayEVM.sol'

# Extract lines around the definition of GatewayZEVM contract
rg 'contract GatewayZEVM' -A 50 --glob 'contracts/prototypes/zevm/GatewayZEVM.sol'

Length of output: 8430

Tools
LanguageTool

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ewayZEVM and GatewayEVM. * GatewayEVM: Deployed on each connected chain to int...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~10-~10: Loose punctuation mark.
Context: ...interact with ZetaChain. * GatewayZEVM: Deployed on ZetaChain to interact with ...

(UNLIKELY_OPENING_PUNCTUATION)

v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Show resolved Hide resolved
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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e1f43be and 9ee91f5.

Files selected for processing (1)
  • v2_localnet.md (1 hunks)
Additional context used
LanguageTool
v2_localnet.md

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ewayZEVM and GatewayEVM. * GatewayEVM: Deployed on each connected chain to int...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~10-~10: Loose punctuation mark.
Context: ...interact with ZetaChain. * GatewayZEVM: Deployed on ZetaChain to interact with ...

(UNLIKELY_OPENING_PUNCTUATION)

Markdownlint
v2_localnet.md

100-100: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


101-101: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


39-39: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


45-45: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


51-51: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


57-57: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


65-65: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


71-71: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


77-77: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


86-86: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


93-93: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


105-105: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


114-114: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


134-134: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Gitleaks
v2_localnet.md

116-117: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


119-120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


122-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (9)
v2_localnet.md (9)

33-35: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

33-33: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


39-41: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

39-39: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


45-47: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

45-45: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


51-53: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

51-51: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


57-59: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

57-57: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


65-67: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

65-65: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


71-73: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

71-71: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


77-79: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

This is a duplicate comment from a previous review.

Tools
Markdownlint

77-77: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


115-123: Remove or redact private keys from the documentation.

The inclusion of private keys in the documentation poses a significant security risk.

- Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
- Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
- Account #1: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000 ETH)
- Private Key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
- Account #2: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000 ETH)
- Private Key: 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
+ Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
+ Account #1: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000 ETH)
+ Account #2: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000 ETH)

This is a duplicate comment from a previous review.

Tools
Gitleaks

116-117: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


119-120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


122-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Show resolved Hide resolved
v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Show resolved Hide resolved
v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Show resolved Hide resolved
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9ee91f5 and e0768fb.

Files selected for processing (1)
  • v2_localnet.md (1 hunks)
Additional context used
LanguageTool
v2_localnet.md

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ewayZEVM and GatewayEVM. * GatewayEVM: Deployed on each connected chain to int...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~10-~10: Loose punctuation mark.
Context: ...interact with ZetaChain. * GatewayZEVM: Deployed on ZetaChain to interact with ...

(UNLIKELY_OPENING_PUNCTUATION)

Markdownlint
v2_localnet.md

100-100: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


101-101: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


39-39: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


45-45: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


51-51: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


57-57: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


65-65: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


71-71: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


77-77: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


86-86: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


93-93: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


105-105: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


114-114: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


134-134: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Gitleaks
v2_localnet.md

116-117: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


119-120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


122-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (1)
v2_localnet.md (1)

1-13: Introduction and Notice are well articulated.

The sections clearly communicate the ongoing development and potential instability of the V2 architecture, which is crucial for setting the right expectations for developers.

Tools
LanguageTool

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ewayZEVM and GatewayEVM. * GatewayEVM: Deployed on each connected chain to int...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~10-~10: Loose punctuation mark.
Context: ...interact with ZetaChain. * GatewayZEVM: Deployed on ZetaChain to interact with ...

(UNLIKELY_OPENING_PUNCTUATION)

v2_localnet.md Show resolved Hide resolved
v2_localnet.md Outdated Show resolved Hide resolved
v2_localnet.md Show resolved Hide resolved
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 (6)
v2_localnet.md (6)

14-27: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```solidity

---

`33-35`: **Specify the programming language for code blocks.**

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

```diff
- ```
+ ```solidity


Also applies to: 39-41, 45-47, 51-53, 57-59, 65-67, 71-73, 77-79

---

`83-89`: **Fix the unordered list style.**

The unordered list style should use asterisks instead of dashes for consistency.

```diff
- - A local Ethereum network (using Hardhat) with the two gateway contracts deployed
- - A background worker that relay messages between the two gateway contracts. It simulates the cross-chain message relaying that would normally happen between live networks with the [observers/signers](https://www.zetachain.com/docs/developers/architecture/observers/) mechanism. This allows to simulate a cross-chain environment on a single local chain.
+ * A local Ethereum network (using Hardhat) with the two gateway contracts deployed
+ * A background worker that relays messages between the two gateway contracts. It simulates the cross-chain message relaying that would normally happen between live networks with the [observers/signers](https://www.zetachain.com/docs/developers/architecture/observers/) mechanism. This allows simulating a cross-chain environment on a single local chain.
Tools
Markdownlint

86-86: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


110-110: Fix the grammatical issue.

The grammatical number of the noun doesn't look right. Consider replacing it.

- The developers can develop application using these addresses, the messages will automatically be relayed by the worker.
+ The developers can develop applications using these addresses, and the messages will automatically be relayed by the worker.
Tools
LanguageTool

[uncategorized] ~110-~110: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...242Eb8F ``` The developers can develop application using these addresses, the messages wil...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)


114-123: Add a note about security best practices.

Remind readers that the provided keys should never be used in production environments.

+ **Note:** The provided keys are for test accounts and should never be used in production environments.
Tools
Markdownlint

114-114: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Gitleaks

116-117: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


119-120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


122-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


135-139: Specify the programming language for code blocks.

The Markdown file lacks language specifications for fenced code blocks, which improves readability and syntax highlighting.

- ```
+ ```bash

</blockquote></details>

</blockquote></details>

<details>
<summary>Review details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**

<details>
<summary>Commits</summary>

Files that changed from the base of the PR and between e0768fbbd70e86366927ded27e13e448f1566500 and 5af352b77db91a547a4d7a940d1ce4a2a8da58b8.

</details>


<details>
<summary>Files selected for processing (1)</summary>

* v2_localnet.md (1 hunks)

</details>










<details>
<summary>Additional context used</summary>

<details>
<summary>LanguageTool</summary><blockquote>

<details>
<summary>v2_localnet.md</summary><blockquote>

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ewayZEVM and GatewayEVM.  * `GatewayEVM`: Deployed on each connected chain to int...

(UNLIKELY_OPENING_PUNCTUATION)

---

[uncategorized] ~10-~10: Loose punctuation mark.
Context: ...interact with ZetaChain. * `GatewayZEVM`: Deployed on ZetaChain to interact with ...

(UNLIKELY_OPENING_PUNCTUATION)

---

[uncategorized] ~101-~101: This verb does not appear to agree with the subject. Consider using a different form.
Context: ...cts deployed - A background worker that relay messages between the two gateway contra...

(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)

---

[uncategorized] ~110-~110: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...242Eb8F ```  The developers can develop application using these addresses, the messages wil...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)

</blockquote></details>

</blockquote></details>
<details>
<summary>Markdownlint</summary><blockquote>

<details>
<summary>v2_localnet.md</summary><blockquote>

100-100: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

---

101-101: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

---

86-86: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

93-93: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

105-105: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

114-114: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

134-134: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</blockquote></details>

</blockquote></details>
<details>
<summary>Gitleaks</summary><blockquote>

<details>
<summary>v2_localnet.md</summary><blockquote>

116-117: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

---

119-120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

---

122-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

</blockquote></details>

</blockquote></details>

</details>
<details>
<summary>Additional comments not posted (1)</summary><blockquote>

<details>
<summary>v2_localnet.md (1)</summary><blockquote>

`1-12`: **LGTM!**

The introduction section is clear and provides a good overview of the new architecture and the primary contracts involved.

<details>
<summary>Tools</summary>

<details>
<summary>LanguageTool</summary><blockquote>

[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ewayZEVM and GatewayEVM.  * `GatewayEVM`: Deployed on each connected chain to int...

(UNLIKELY_OPENING_PUNCTUATION)

---

[uncategorized] ~10-~10: Loose punctuation mark.
Context: ...interact with ZetaChain. * `GatewayZEVM`: Deployed on ZetaChain to interact with ...

(UNLIKELY_OPENING_PUNCTUATION)

</blockquote></details>

</details>

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

v2_localnet.md Show resolved Hide resolved
@lumtis lumtis requested a review from skosito July 18, 2024 07:35

The motivation behind this interface is intuitiveness and simplicity. We support different asset types by using function overloading.

### `GatewayEVM`
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: when documenting contracts we can consider leveraging slither printers.

i.e:

The command slither contracts/prototypes/zevm/GatewayZEVM.sol --print contract-summary will output the following, which we can reuse:

+ Contract GatewayZEVM (Upgradeable) (Most derived contract)
  - From UUPSUpgradeable
    - __UUPSUpgradeable_init() (internal)
    - __UUPSUpgradeable_init_unchained() (internal)
    - proxiableUUID() (external)
    - upgradeTo(address) (public)
    - upgradeToAndCall(address,bytes) (public)
  - From ERC1967UpgradeUpgradeable
    - __ERC1967Upgrade_init() (internal)
    - __ERC1967Upgrade_init_unchained() (internal)
    - _changeAdmin(address) (internal)
    - _getAdmin() (internal)
    - _getBeacon() (internal)
    - _getImplementation() (internal)
    - _setAdmin(address) (private)
    - _setBeacon(address) (private)
    - _setImplementation(address) (private)
    - _upgradeBeaconToAndCall(address,bytes,bool) (internal)
    - _upgradeTo(address) (internal)
    - _upgradeToAndCall(address,bytes,bool) (internal)
    - _upgradeToAndCallUUPS(address,bytes,bool) (internal)
  - From Initializable
    - _disableInitializers() (internal)
    - _getInitializedVersion() (internal)
    - _isInitializing() (internal)
  - From OwnableUpgradeable
    - __Ownable_init() (internal)
    - __Ownable_init_unchained() (internal)
    - _checkOwner() (internal)
    - _transferOwnership(address) (internal)
    - owner() (public)
    - renounceOwnership() (public)
    - transferOwnership(address) (public)
  - From ContextUpgradeable
    - __Context_init() (internal)
    - __Context_init_unchained() (internal)
    - _contextSuffixLength() (internal)
    - _msgData() (internal)
    - _msgSender() (internal)
  - From GatewayZEVM
    - _authorizeUpgrade(address) (internal)
    - _withdraw(uint256,address) (internal)
    - call(bytes,bytes) (external)
    - constructor() (public)
    - deposit(address,uint256,address) (external)
    - depositAndCall(zContext,address,uint256,address,bytes) (external)
    - execute(zContext,address,uint256,address,bytes) (external)
    - initialize() (public)
    - withdraw(bytes,uint256,address) (external)
    - withdrawAndCall(bytes,uint256,address,bytes) (external)

The full list of slither printers:

cfg, ck, constructor-calls, contract-summary, data-dependency, declaration, dominator, echidna, function-id, function-summary, halstead, loc, martin, modifiers, call-graph, evm, human-summary, inheritance, inheritance-graph, slithir, slithir-ssa, not-pausable, vars-and-auth, require, variable-order

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good, just wanted to display the dev interface here

@lumtis lumtis merged commit 8f89b49 into main Jul 18, 2024
11 checks passed
@lumtis lumtis deleted the docs/v2-guide branch July 18, 2024 12:10
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.

Add notice for V2 development
4 participants