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: update bank docs #22053

Merged
merged 9 commits into from
Oct 3, 2024
Merged

docs: update bank docs #22053

merged 9 commits into from
Oct 3, 2024

Conversation

sontrinh16
Copy link
Member

@sontrinh16 sontrinh16 commented Oct 2, 2024

Description

ref: #21429


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Documentation
    • Updated terminology and clarified descriptions in the bank module's README.
    • Expanded total supply description to encompass all accounts within a chain.
    • Detailed the ModuleAccount and Keeper interfaces, including method changes and new commands.
    • Introduced new commands for querying spendable balances and metadata, with examples included.
    • Deprecated SendEnabled parameter with a warning about backward compatibility.
    • Updated event emission structure and attributes for coin transfers.

@sontrinh16 sontrinh16 requested review from julienrbrt and a team as code owners October 2, 2024 21:36
Copy link
Contributor

coderabbitai bot commented Oct 2, 2024

Warning

Rate limit exceeded

@sontrinh16 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between 7a9f919 and b9ac93c.

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in the pull request focus on updating the x/bank/README.md documentation to improve clarity and accuracy regarding the bank module's functionality. Key modifications include terminology updates, detailed descriptions of interfaces, and the introduction of new commands for querying balances. Method signatures in the Keeper interface have been altered to return error types instead of void. Additionally, deprecated parameters and expanded CLI commands have been documented to enhance user understanding.

Changes

File Path Change Summary
x/bank/README.md Updated terminology, clarified total supply description, detailed ModuleAccount and Keeper interfaces, modified return types for InitGenesis and ExportGenesis methods, introduced new CLI commands for querying balances, noted deprecation of SendEnabled.

Possibly related PRs

Suggested reviewers

  • julienrbrt
  • akhilkumarpilli
  • hieuvubk
  • tac0turtle

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

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

🧹 Outside diff range and nitpick comments (3)
x/bank/README.md (3)

84-89: Enhanced description of supply Keeper interface

The changes provide more detailed information about the functionality of the supply Keeper interface, which is valuable for developers working with the bank module.

Consider revising line 85 for better readability:

-The supply `Keeper` interface also introduces new wrapper functions for the auth `Keeper`
-and the bank `SendKeeper` in order to be able to:
+The supply `Keeper` interface also introduces new wrapper functions for the auth `Keeper`
+and the bank `SendKeeper` to:

This change removes the redundant phrase "in order to be able to," making the sentence more concise.

🧰 Tools
🪛 LanguageTool

[style] ~85-~85: Consider a shorter alternative to avoid wordiness.
Context: ...auth Keeper and the bank SendKeeper in order to be able to: * Get ModuleAccounts by ...

(IN_ORDER_TO_PREMIUM)


272-275: New information on send restrictions

The addition of information about clearing send restrictions and their application during SendCoins and InputOutputCoins is valuable. However, there are some grammatical issues that should be addressed.

Consider the following revisions:

-Send restrictions can also be cleared by using `ClearSendRestriction`.
+Send restrictions can be cleared using `ClearSendRestriction`.

-During `SendCoins`, the send restriction is applied before coins are removed from the `from_address` and adding them to the `to_address`.
+During `SendCoins`, the send restriction is applied before coins are removed from the `from_address` and added to the `to_address`.

-During `InputOutputCoins`, the send restriction is applied after the input coins are removed, once for each output before the funds are added.
+During `InputOutputCoins`, the send restriction is applied after the input coins are removed, once for each output before the funds are added.

281-283: Additional context on send restriction limitations

The added information about the limitations of send restrictions provides important context for developers. However, there are several grammatical and clarity issues that need to be addressed.

Consider the following revisions:

-Thirdly, this issue could lead into a chain halt if a token is disabled and the token is moved in the begin/endblock. This is the last reason we see the current change as they are more damaging then beneficial for users.
+Thirdly, this issue could lead to a chain halt if a token is disabled and the token is moved in the begin/end block. This is the final reason we see the current changes as more beneficial than damaging for users.

-A send restriction function should make use of a custom value in the context to allow bypassing that specific restriction.
+A send restriction function should use a custom value in the context to allow bypassing that specific restriction.

These changes improve grammar, clarity, and correct the use of "then" to "than".

🧰 Tools
🪛 LanguageTool

[grammar] ~281-~281: The word ‘begin’ is not a noun. Did you mean “beginning” or “start”?
Context: ... disabled and the token is moved in the begin/endblock. This is the last reason we se...

(PREPOSITION_VERB)


[uncategorized] ~281-~281: Possible missing comma found.
Context: ...s is the last reason we see the current change as they are more damaging then benefici...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~281-~281: “then” (at that time, later on) seems less likely than “than” (as in: greater than).
Context: ...urrent change as they are more damaging then beneficial for users. A send restricti...

(AI_HYDRA_LEO_CP_THEN_THAN)

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bf95c81 and b068830.

📒 Files selected for processing (1)
  • x/bank/README.md (20 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
x/bank/README.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

🪛 LanguageTool
x/bank/README.md

[style] ~85-~85: Consider a shorter alternative to avoid wordiness.
Context: ...auth Keeper and the bank SendKeeper in order to be able to: * Get ModuleAccounts by ...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~278-~278: Possible missing comma found.
Context: ...nd user accounts without restrictions. Secondly this limitation would limit the usage o...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~279-~279: It seems likely that a singular genitive (’s) apostrophe is missing.
Context: ...al is used to get those tokens into the users account this would fall under the discr...

(AI_HYDRA_LEO_APOSTROPHE_S_XS)


[uncategorized] ~279-~279: Possible missing comma found.
Context: ...used to get those tokens into the users account this would fall under the discretion of...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~279-~279: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ... to what they would like to do here. We can not make strong assumptions here. Thirdly,...

(CAN_NOT_PREMIUM)


[grammar] ~281-~281: The word ‘begin’ is not a noun. Did you mean “beginning” or “start”?
Context: ... disabled and the token is moved in the begin/endblock. This is the last reason we se...

(PREPOSITION_VERB)


[uncategorized] ~281-~281: Possible missing comma found.
Context: ...s is the last reason we see the current change as they are more damaging then benefici...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~281-~281: “then” (at that time, later on) seems less likely than “than” (as in: greater than).
Context: ...urrent change as they are more damaging then beneficial for users. A send restricti...

(AI_HYDRA_LEO_CP_THEN_THAN)


[uncategorized] ~336-~336: Possible missing comma found.
Context: ...ut you don't want your send restriction applied you just need to apply custom value in...

(AI_HYDRA_LEO_MISSING_COMMA)

🔇 Additional comments (9)
x/bank/README.md (9)

52-54: Improved clarity in total supply definition

The changes provide a more precise explanation of what total supply represents in the context of the bank module. This improvement in clarity is beneficial for developers and users alike.


147-149: Improved explanation of denied addresses

The changes provide a clearer explanation of the concept of denied addresses in the bank module. This additional context helps developers understand the purpose and implementation of this feature.


196-197: Updated function signatures for InitGenesis and ExportGenesis

The function signatures for InitGenesis and ExportGenesis have been updated to include error handling and return types. This change improves the robustness of the module by allowing for proper error propagation.


214-214: Updated function signature for BurnCoins

The BurnCoins function signature has been updated to accept a byte slice for the address instead of an sdk.AccAddress. This change might affect existing implementations.

Please ensure that all calls to BurnCoins throughout the codebase have been updated to match this new signature. You may want to run a search for all occurrences of BurnCoins to verify this change has been propagated correctly.


451-451: Minor formatting improvements in transfer events

The changes in the attribute values for transfer events (sender and recipient) improve consistency in the documentation.

Also applies to: 461-461


Line range hint 621-674: New CLI commands for querying balances

The addition of new CLI commands for querying balances, including spendable balances, greatly enhances the functionality available to users. These commands provide more granular control over balance queries, allowing users to retrieve specific information as needed.


679-702: Updated documentation for denom-metadata commands

The updates to the documentation for denom-metadata and denoms-metadata commands improve clarity and provide better examples for users.


Line range hint 705-730: New CLI commands for querying total supply

The introduction of new CLI commands for querying total supply, including the ability to query for specific denominations, adds valuable functionality for users and developers working with the bank module.


747-766: New CLI commands for querying params and denom owners

The addition of CLI commands for querying params and denom owners further expands the module's querying capabilities, providing users with more tools to inspect the state of the bank module.

x/bank/README.md Outdated Show resolved Hide resolved
@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Oct 3, 2024
@sontrinh16 sontrinh16 enabled auto-merge October 3, 2024 09:50
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 and nitpick comments (2)
x/bank/README.md (2)

84-89: Improved Keeper interface description with minor suggestion

The updated description of the supply Keeper interface provides more detailed information about its functionality, including new wrapper functions for the auth Keeper and bank SendKeeper. This is a valuable addition to the documentation.

Consider simplifying the phrase "in order to be able to" to "to" for conciseness:

-The supply `Keeper` interface also introduces new wrapper functions for the auth `Keeper`
-and the bank `SendKeeper` in order to be able to:
+The supply `Keeper` interface also introduces new wrapper functions for the auth `Keeper`
+and the bank `SendKeeper` to:
🧰 Tools
🪛 LanguageTool

[style] ~85-~85: Consider a shorter alternative to avoid wordiness.
Context: ...auth Keeper and the bank SendKeeper in order to be able to: * Get ModuleAccounts by ...

(IN_ORDER_TO_PREMIUM)


279-282: Important information on send restriction limitations with minor suggestions

This paragraph provides valuable insights into the design decisions and limitations of send restrictions, particularly for module-to-account and module-to-module transfers. This information is crucial for developers to understand the system's behavior.

Consider the following minor improvements for clarity and correctness:

  1. Replace "can not" with "cannot" for grammatical correctness.
  2. Restructure the last sentence for better readability. For example:
-We can not make strong assumptions here.
+We cannot make strong assumptions in this case.

-Thirdly, this issue could lead into a chain halt if a token is disabled and the token is moved in the begin/endblock. This is the last reason we see the current change as they are more damaging then beneficial for users.
+Thirdly, this issue could lead to a chain halt if a disabled token is moved in the begin/end block. This potential for system-wide disruption is the final reason we view the current restrictions as more damaging than beneficial for users.
🧰 Tools
🪛 LanguageTool

[style] ~279-~279: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ... to what they would like to do here. We can not make strong assumptions here. Thirdly,...

(CAN_NOT_PREMIUM)


[grammar] ~281-~281: The word ‘begin’ is not a noun. Did you mean “beginning” or “start”?
Context: ... disabled and the token is moved in the begin/endblock. This is the last reason we se...

(PREPOSITION_VERB)


[misspelling] ~281-~281: Did you mean “than”?
Context: ...urrent change as they are more damaging then beneficial for users. A send restricti...

(LESS_MORE_THEN)

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b068830 and 7a9f919.

📒 Files selected for processing (1)
  • x/bank/README.md (20 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
x/bank/README.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

🪛 LanguageTool
x/bank/README.md

[style] ~85-~85: Consider a shorter alternative to avoid wordiness.
Context: ...auth Keeper and the bank SendKeeper in order to be able to: * Get ModuleAccounts by ...

(IN_ORDER_TO_PREMIUM)


[style] ~279-~279: Unless you want to emphasize “not”, use “cannot” which is more common.
Context: ... to what they would like to do here. We can not make strong assumptions here. Thirdly,...

(CAN_NOT_PREMIUM)


[grammar] ~281-~281: The word ‘begin’ is not a noun. Did you mean “beginning” or “start”?
Context: ... disabled and the token is moved in the begin/endblock. This is the last reason we se...

(PREPOSITION_VERB)


[misspelling] ~281-~281: Did you mean “than”?
Context: ...urrent change as they are more damaging then beneficial for users. A send restricti...

(LESS_MORE_THEN)

🔇 Additional comments (8)
x/bank/README.md (8)

13-14: Improved clarity with "legacy vesting accounts"

The change from "vesting accounts" to "legacy vesting accounts" provides better specificity and context. This is a good improvement in the documentation.


52-54: Enhanced explanation of total supply

The expanded description of total supply provides a more comprehensive and accurate explanation. It now clearly states that the total supply includes all accounts within a chain, which is crucial for users to understand the scope of this metric.


196-197: Improved error handling in Genesis methods

The updates to the InitGenesis and ExportGenesis method signatures enhance error handling capabilities:

  1. InitGenesis now returns an error, allowing for proper error propagation.
  2. ExportGenesis now returns both a pointer to GenesisState and an error, improving state management and error handling.

These changes align with Go best practices and allow for more robust implementation of these critical functions.


214-214: Enhanced flexibility in BurnCoins method

The BurnCoins method now accepts the address parameter as a byte slice ([]byte) instead of a specific address type. This change offers greater flexibility and potentially improved efficiency when working with addresses at a lower level.


274-275: Valuable clarification on send restriction application

This addition provides crucial information about when send restrictions are applied in SendCoins and InputOutputCoins operations. It clarifies that restrictions are checked before coins are moved, which is essential knowledge for developers implementing or working with these functions.


336-337: Valuable guidance on bypassing send restrictions

This addition provides essential information for developers on how to bypass send restrictions when necessary. The explanation of using a custom context value offers a flexible solution for cases where restrictions need to be selectively applied. This guidance is particularly useful for implementing more complex transaction logic.


595-599: Critical deprecation notice and migration guidance

This warning provides essential information about the deprecation of the SendEnabled parameter and offers clear guidance on using the new send_enabled field in genesis. This addition is crucial for developers to understand the changes in the system and maintain backward compatibility while adopting new features.


Line range hint 621-766: Comprehensive expansion of CLI documentation

This extensive addition to the CLI documentation is a significant improvement. It includes:

  1. New commands for querying various types of balances (including spendable balances).
  2. Commands for querying denomination metadata and owners.
  3. Clear examples for each command.

The structure is consistent and easy to follow, making it an excellent resource for users interacting with the bank module via CLI. This comprehensive documentation will greatly assist developers and users in effectively utilizing the bank module's features.

Copy link
Contributor

@akhilkumarpilli akhilkumarpilli left a comment

Choose a reason for hiding this comment

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

lgtm, small nit

x/bank/README.md Outdated Show resolved Hide resolved
@sontrinh16 sontrinh16 added this pull request to the merge queue Oct 3, 2024
@sontrinh16 sontrinh16 removed this pull request from the merge queue due to a manual request Oct 3, 2024
@sontrinh16 sontrinh16 enabled auto-merge October 3, 2024 10:29
@sontrinh16 sontrinh16 added this pull request to the merge queue Oct 3, 2024
Merged via the queue into main with commit 9251d4e Oct 3, 2024
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release C:x/bank
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants