Skip to content

Conversation

luchenqun
Copy link
Contributor

@luchenqun luchenqun commented Sep 9, 2024

Description

Execute the command testnet init-files --v 4 --output-dir ./nodes --chain-id evmos_9000-1 --keyring-backend test --base-fee 10000 --min-gas-price 10000

for gentxs/node0.json file now is

{
  "body": {
    "messages": [
      {
        "@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
        "validator_address": "evmos1hajh6rhhkjqkwet6wqld3lgx8ur4y3khjuxkxh"
      }
    ],
  }
}

The correct approach should be:

{
  "body": {
    "messages": [
      {
        "@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
        "validator_address": "evmosvaloper1hajh6rhhkjqkwet6wqld3lgx8ur4y3khljfx82"
      }
    ],
  }
}

One more minor change is that I have adjusted the commission previously collected by validators from 100% to the default 5% set by the staking module.

Summary by CodeRabbit

  • New Features
    • Enhanced the testnet setup process by fixing the evmosd testnet init-files command to address validator address errors.
  • Bug Fixes
    • Corrected the validator address format to ensure proper functionality during validator creation.
    • Updated commission rates to use a default value, improving flexibility and correctness in configuration.

@luchenqun luchenqun requested a review from a team as a code owner September 9, 2024 10:09
@luchenqun luchenqun requested review from ramacarlucho and MalteHerrmann and removed request for a team September 9, 2024 10:09
Copy link
Contributor

coderabbitai bot commented Sep 9, 2024

Walkthrough

The changes introduce a fix for the command evmosd testnet init-files, addressing an error related to the validator_address. The implementation modifies the address format for the validator to ensure proper validation and updates the commission rates to utilize a default value. These adjustments improve the functionality and reliability of the testnet setup process.

Changes

File Change Summary
CHANGELOG.md Added entry for version v19.2.0 documenting the fix for evmosd testnet init-files related to validator_address.
cmd/evmosd/testnet.go Modified the initTestnetFiles function to change the validator address format and update commission rates.
client/testnet.go Updated address handling in initTestnetFiles to use sdk.ValAddress(addr).String().
testutil/network/network.go Changed address creation in New function to use sdk.ValAddress(addr).String().

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Command
    participant Validator

    User->>Command: Run evmosd testnet init-files
    Command->>Validator: Create Validator with formatted address
    Validator-->>Command: Validator created successfully
    Command-->>User: Testnet setup complete
Loading

🐇 In the meadow where bunnies play,
A fix was made, hip-hip-hooray!
With addresses neat and rates just right,
The testnet shines, oh what a sight!
Hops of joy, we leap and cheer,
For smoother setups, the time is near! 🌼

Tip

Announcements
  • The review status is no longer posted as a separate comment when there are no actionable or nitpick comments. In such cases, the review status is included in the walkthrough comment.
  • We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs: Walkthrough comment now includes a list of potentially related PRs to help you recall past context. Please share any feedback in the discussion post on our Discord.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs in the walkthrough comment. You can also provide custom labeling instructions in the UI or configuration file.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8206a2f and fa813ee.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional context used
Markdownlint
CHANGELOG.md

56-56: Expected: 120; Actual: 133
Line length

(MD013, line-length)


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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 67f0b0c and bd0e967.

Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • cmd/evmosd/testnet.go (1 hunks)
Additional context used
Markdownlint
CHANGELOG.md

54-54: Expected: 120; Actual: 133
Line length

(MD013, line-length)

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

54-54: Changelog entry added for evmosd testnet init-files fix.

The addition of the changelog entry under version v19.2.0 is appropriate and follows the standard format for documenting changes. It provides clear information about the fix related to the validator_address in the evmosd testnet init-files command, which enhances the usability and reliability of the testnet setup process.

This entry helps ensure that users and developers are aware of the changes and their impact, promoting transparency and accountability in the development process.

Tools
Markdownlint

54-54: Expected: 120; Actual: 133
Line length

(MD013, line-length)

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 22.63%. Comparing base (f097735) to head (fa813ee).
Report is 301 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2826       +/-   ##
===========================================
- Coverage   70.45%   22.63%   -47.82%     
===========================================
  Files         293      413      +120     
  Lines       22559    73244    +50685     
===========================================
+ Hits        15893    16580      +687     
- Misses       5800    54923    +49123     
- Partials      866     1741      +875     

see 401 files with indirect coverage changes

Copy link
Contributor

@GAtom22 GAtom22 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @luchenqun!

@GAtom22
Copy link
Contributor

GAtom22 commented Sep 9, 2024

Can you please add the same change on this line and this one?

@luchenqun
Copy link
Contributor Author

Can you please add the same change on this line and this one?

Done. After finishing, I rechecked everything once again. There shouldn't be any fish that slipped through the net. ^_^

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 (2)
client/testnet.go (1)

314-314: Inconsistent handling of validator addresses found.

The change to use sdk.ValAddress(addr).String() for formatting validator addresses has not been consistently applied across the codebase. Instances of addr.String() still exist in several files, which may lead to inconsistencies in address handling.

  • Files with addr.String():
    • x/vesting/types/msg.go
    • x/vesting/keeper/msg_server.go
    • x/vesting/keeper/grpc_query.go
    • x/vesting/keeper/utils.go
    • x/evm/keeper/grpc_query_test.go
    • x/evm/keeper/fees_test.go
    • x/erc20/types/token_pair_test.go
    • wallets/ledger/ledger_test.go
    • utils/utils_test.go
    • testutil/staking-rewards.go
    • testutil/network/network.go
    • testutil/integration/evmos/utils/genesis.go
    • rpc/namespaces/ethereum/personal/api.go
    • rpc/backend/evm_query_client_test.go
    • cmd/evmosd/testnet.go
    • cmd/evmosd/genaccounts.go
    • client/testnet.go
    • app/export.go
    • crypto/hd/algorithm_test.go
    • app/ante/integration_test.go

Please review these instances and update them as necessary to ensure consistent handling of validator addresses.

Analysis chain

Correct handling of validator addresses.

The change from addr.String() to sdk.ValAddress(addr).String() ensures that the validator address is correctly formatted. This is a crucial fix for maintaining the integrity of validator addresses in the system.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of validator address handling have been updated.

# Test: Search for the old address handling method. Expect: No occurrences.
rg --type go -A 5 $'addr.String()'

Length of output: 24421

testutil/network/network.go (1)

429-429: Inconsistent handling of validator addresses.

The verification revealed multiple instances of addr.String() still present in the codebase. These occurrences should be reviewed to determine if they need to be updated to sdk.ValAddress(addr).String() to ensure consistent and correct handling of validator addresses.

  • x/vesting/types/msg.go
  • x/vesting/keeper/utils.go
  • wallets/ledger/ledger_test.go
  • x/vesting/keeper/msg_server.go
  • x/vesting/keeper/grpc_query.go
  • x/erc20/types/token_pair_test.go
  • x/evm/keeper/fees_test.go
  • x/evm/keeper/grpc_query_test.go
  • utils/utils_test.go
  • testutil/network/network.go
  • testutil/staking-rewards.go
  • testutil/integration/evmos/utils/genesis.go
  • rpc/namespaces/ethereum/personal/api.go
  • rpc/backend/evm_query_client_test.go
  • client/testnet.go
  • crypto/hd/algorithm_test.go
  • cmd/evmosd/testnet.go
  • app/export.go
  • app/ante/integration_test.go
  • cmd/evmosd/genaccounts.go
Analysis chain

Correct handling of validator addresses.

The change from addr.String() to sdk.ValAddress(addr).String() ensures that the validator address is correctly formatted. This is a crucial fix for maintaining the integrity of validator addresses in the system.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all instances of validator address handling have been updated.

# Test: Search for the old address handling method. Expect: No occurrences.
rg --type go -A 5 $'addr.String()'

Length of output: 24421

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bd0e967 and 8206a2f.

Files selected for processing (2)
  • client/testnet.go (1 hunks)
  • testutil/network/network.go (1 hunks)

Copy link
Contributor

@0xstepit 0xstepit left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @luchenqun 🙏

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 (1)
CHANGELOG.md (1)

Line range hint 1-1: Reminder: Add tests.

The TODO comment indicates that tests are missing.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Tools
Markdownlint

56-56: Expected: 120; Actual: 133
Line length

(MD013, line-length)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8206a2f and fa813ee.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional context used
Markdownlint
CHANGELOG.md

56-56: Expected: 120; Actual: 133
Line length

(MD013, line-length)

@GAtom22 GAtom22 merged commit d3058ba into evmos:main Sep 10, 2024
47 of 53 checks passed
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