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

imp(erc20): Add reference to EIP-7528 (native asset address) to default ERC-20 params and use it for example chain #57

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MalteHerrmann
Copy link
Collaborator

@MalteHerrmann MalteHerrmann commented Nov 1, 2024

This PR adds a reference to EIP-7528 to the default native precompiles entry on the evmOS repository

Summary by CodeRabbit

  • Improvements

    • Updated changelog to include a reference to EIP-7528 for native asset address in ERC-20 parameters.
    • Added documentation to recommend using a canonical address for ERC-20 representation of the chain's native denomination.
    • Enhanced local node setup script with new commands for ERC20 token configuration.
  • Configuration Changes

    • Simplified change type mappings in the configuration file for better readability.

@MalteHerrmann MalteHerrmann requested a review from a team as a code owner November 1, 2024 09:26
@MalteHerrmann MalteHerrmann requested review from hanchon and GAtom22 and removed request for a team November 1, 2024 09:26
Copy link

coderabbitai bot commented Nov 1, 2024

Walkthrough

The pull request includes updates to the .clconfig.json file, where change type mappings have been modified to shorter identifiers for categories such as API breaking changes and bug fixes. Additionally, the CHANGELOG.md has been updated to reference EIP-7528 in the context of ERC-20 parameters. A comment has also been added in x/erc20/types/params.go to recommend using a canonical address for the chain's native denomination, enhancing documentation without altering existing functionality.

Changes

File Change Summary
.clconfig.json Updated change type mappings:
- "API Breaking": "api\\s*breaking""API Breaking": "feat-api"
- "Bug Fixes": "bug\\s*fixes""Bug Fixes": "fix"
- "Improvements": "improvements""Improvements": "imp"
- "State Machine Breaking": "state\\s*machine\\s*breaking""State Machine Breaking": "feat-smb"
CHANGELOG.md Added a reference to EIP-7528 under the "Improvements" section regarding ERC-20 parameters.
x/erc20/types/params.go Added a comment above DefaultNativePrecompiles recommending the use of a canonical address for ERC-20.
example_chain/local_node.sh Enhanced token configuration with new commands for native denomination as a token pair for STRv2.

🐇 "In the code, we hop and play,
With changes brightening up the day.
Mappings short, and logs refined,
A canonical guide for all to find.
Let's celebrate with a joyful cheer,
For every change, we hold so dear!" 🥕


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@MalteHerrmann MalteHerrmann changed the title improvements(erc20): Add reference to EIP-7528 (native asset address) to default ERC-20 params. imp(erc20): Add reference to EIP-7528 (native asset address) to default ERC-20 params. Nov 1, 2024
Copy link

@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 and nitpick comments (2)
.clconfig.json (1)

27-30: LGTM! The simplified change type identifiers are more maintainable.

The changes make the identifiers more concise and align better with conventional commit formats. The use of "feat-" prefix for breaking changes provides good consistency.

Consider adding a comment in the JSON file documenting the expected format of these change type identifiers to help contributors use them correctly. For example:

{
+ // Change types follow these patterns:
+ // - Breaking changes: feat-*  (e.g., feat-api, feat-smb)
+ // - Improvements: imp
+ // - Bug fixes: fix
  "change_types": {
    "API Breaking": "feat-api",
    "Bug Fixes": "fix",
    "Improvements": "imp",
    "State Machine Breaking": "feat-smb"
  },
CHANGELOG.md (1)

11-11: LGTM with a minor suggestion for clarity.

The changelog entry follows the correct format and accurately reflects the PR's purpose. Consider making the description slightly more informative by explaining what EIP-7528 standardizes.

- (erc20) [#57](https://github.com/evmos/os/pull/57) Add reference to EIP-7528 (native asset address) to default ERC-20 params.
+ (erc20) [#57](https://github.com/evmos/os/pull/57) Add reference to EIP-7528 (standardized native asset address format) to default ERC-20 params.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bf18711 and 762c86a.

📒 Files selected for processing (3)
  • .clconfig.json (2 hunks)
  • CHANGELOG.md (1 hunks)
  • x/erc20/types/params.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • x/erc20/types/params.go

@MalteHerrmann MalteHerrmann changed the title imp(erc20): Add reference to EIP-7528 (native asset address) to default ERC-20 params. imp(erc20): Add reference to EIP-7528 (native asset address) to default ERC-20 params and use it for example chain Nov 1, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days-before-close if no further activity occurs.

Copy link

@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

🧹 Nitpick comments (1)
CHANGELOG.md (1)

11-11: LGTM! Consider wrapping the line for better readability.

The changelog entry accurately describes the changes and follows the standard format. While the line exceeds the recommended 120-character limit, it maintains consistency with existing entries.

Consider wrapping the line:

-- (erc20) [#57](https://github.com/evmos/os/pull/57) Add reference to EIP-7528 (native asset address) to default ERC-20 params and use in example chain.
++ (erc20) [#57](https://github.com/evmos/os/pull/57) Add reference to EIP-7528 (native asset address) 
++   to default ERC-20 params and use in example chain.
🧰 Tools
🪛 Markdownlint (0.37.0)

11-11: Expected: 120; Actual: 152
Line length

(MD013, line-length)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 762c86a and 499ac51.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • example_chain/local_node.sh (1 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
CHANGELOG.md

11-11: Expected: 120; Actual: 152
Line length

(MD013, line-length)

🔇 Additional comments (1)
example_chain/local_node.sh (1)

137-139: Verify the contract_owner value and consider adding input validation.

The implementation correctly uses the EIP-7528 canonical address for native assets (0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). However, there are a few considerations:

  1. The contract_owner value of 1 seems arbitrary. Please verify if this is the intended value.
  2. Consider adding validation for the EIP-7528 address format.

Let's verify the contract_owner usage:

✅ Verification successful

Based on the search results, I can now generate the final response as the findings provide clear context about the contract_owner value:

The contract_owner value of 1 is correct as it represents a ModuleAccount owner type

The codebase shows that contract_owner is an ENUM where:

  • 0: invalid
  • 1: ModuleAccount
  • 2: external address

Since this is configuring a native token (using the EIP-7528 canonical address) in the genesis, using ModuleAccount (value 1) as the owner type is the correct choice.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of contract_owner in the codebase
# to understand its expected values and validation

# Search for contract_owner in Go files
echo "Searching for contract_owner in Go files:"
rg -A 3 "contract_owner" --type go

# Search for validation of EIP-7528 address
echo "Searching for EIP-7528 address validation:"
rg -A 3 "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"

Length of output: 4928

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.

1 participant