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

refactor(evm): unique chain ids for all networks #1976

Merged
merged 6 commits into from
Jul 30, 2024
Merged

Conversation

onikonychev
Copy link
Contributor

@onikonychev onikonychev commented Jul 29, 2024

Generates unique chain ids for mainnet, testnets, devnets and localnets.
Each of our public JSON-RPC endpoints (all but localnets) will need to be registered at:

Slot 7200 - 7300 if chain ids seem to be empty so far.

Summary by CodeRabbit

  • New Features

    • Updated chain ID constants to enhance clarity and flexibility for different network configurations, including new identifiers for testnets, devnets, and local networks.
  • Bug Fixes

    • Modified test cases to align with the updated chain ID constants for improved accuracy in network identification.
  • Documentation

    • Added a new entry in the CHANGELOG summarizing the changes and improvements related to unique chain IDs for all networks.

@onikonychev onikonychev requested a review from a team as a code owner July 29, 2024 09:11
Copy link
Contributor

coderabbitai bot commented Jul 29, 2024

Walkthrough

This change introduces a significant refactor to the handling of Ethereum chain IDs across various networks within the project. The mainnet ID is updated, and new identifiers are added for multiple testnet and devnet configurations. These adjustments enhance clarity and functionality in network configurations, ensuring better compatibility with Ethereum EVM standards.

Changes

Files Change Summary
CHANGELOG.md Added entry for refactor of unique chain IDs for all networks to enhance management of network identifiers.
app/appconst/appconst.go Updated mainnet chain ID from 420 to 7200, added new constants for testnets and devnets, and reorganized knownEthChainIDMap to reflect these changes.
app/appconst/appconst_test.go Modified test cases to reflect new chain ID constants for local and development networks, ensuring alignment with updates in appconst.go.

Poem

🐰 In the meadow, hopping so bright,
New chain IDs twinkle, a joyful sight.
With networks restructured, clear paths we weave,
In code's gentle dance, we truly believe!
🌟 Each hop a step toward progress anew,
A warren of wonders, for me and for you!


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.

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 9ac9d70 and c23caf8.

Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • app/appconst/appconst.go (1 hunks)
  • app/appconst/appconst_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
Additional comments not posted (7)
app/appconst/appconst_test.go (2)

29-31: Verify the correctness of the new constant ETH_CHAIN_ID_LOCALNET_0.

Ensure that appconst.ETH_CHAIN_ID_LOCALNET_0 is correctly defined and used throughout the codebase.


34-39: Verify the correctness of the new constants ETH_CHAIN_ID_TESTNET_1 and ETH_CHAIN_ID_DEVNET_2.

Ensure that appconst.ETH_CHAIN_ID_TESTNET_1 and appconst.ETH_CHAIN_ID_DEVNET_2 are correctly defined and used throughout the codebase.

Verification successful

The constants ETH_CHAIN_ID_TESTNET_1 and ETH_CHAIN_ID_DEVNET_2 are correctly defined and used.

  • Defined in app/appconst/appconst.go:
    • ETH_CHAIN_ID_TESTNET_1 as int64 = 7210
    • ETH_CHAIN_ID_DEVNET_2 as int64 = 7221
  • Used in app/appconst/appconst_test.go for test cases.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of the new constants `ETH_CHAIN_ID_TESTNET_1` and `ETH_CHAIN_ID_DEVNET_2`.

# Test: Search for the definition and usage of `ETH_CHAIN_ID_TESTNET_1` and `ETH_CHAIN_ID_DEVNET_2`. Expect: Correct definition and usage.
rg --type go 'ETH_CHAIN_ID_TESTNET_1|ETH_CHAIN_ID_DEVNET_2'

Length of output: 350

app/appconst/appconst.go (5)

55-57: Verify the correctness of the new constants values for devnets.

Ensure that the new values 7220, 7221, and 7222 for ETH_CHAIN_ID_DEVNET_1, ETH_CHAIN_ID_DEVNET_2, and ETH_CHAIN_ID_DEVNET_3 are correct and used consistently throughout the codebase.


51-53: Verify the correctness of the new constants values for testnets.

Ensure that the new values 7210, 7211, and 7212 for ETH_CHAIN_ID_TESTNET_1, ETH_CHAIN_ID_TESTNET_2, and ETH_CHAIN_ID_TESTNET_3 are correct and used consistently throughout the codebase.


59-62: Verify the correctness of the new constants values for localnets.

Ensure that the new values 7230, 7231, 7232, and 7233 for ETH_CHAIN_ID_LOCALNET_0, ETH_CHAIN_ID_LOCALNET_1, ETH_CHAIN_ID_LOCALNET_2, and ETH_CHAIN_ID_LOCALNET_3 are correct and used consistently throughout the codebase.


49-49: Verify the correctness of the new constant value for ETH_CHAIN_ID_MAINNET.

Ensure that the new value 7200 for ETH_CHAIN_ID_MAINNET is correct and used consistently throughout the codebase.


68-81: Verify the correctness of the updated mappings in knownEthChainIDMap.

Ensure that the mappings for nibiru-testnet-1, nibiru-testnet-2, nibiru-testnet-3, nibiru-devnet-1, nibiru-devnet-2, nibiru-devnet-3, nibiru-localnet-0, nibiru-localnet-1, nibiru-localnet-2, and nibiru-localnet-3 are correct and used consistently throughout the codebase.

@onikonychev onikonychev enabled auto-merge (squash) July 29, 2024 20:28
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 c23caf8 and c6d7680.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

@onikonychev onikonychev merged commit d78385b into main Jul 30, 2024
15 of 16 checks passed
@onikonychev onikonychev deleted the on/chain-ids branch July 30, 2024 12:14
@coderabbitai coderabbitai bot mentioned this pull request Jan 28, 2025
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.

2 participants