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 authz docs #22062

Merged
merged 1 commit into from
Oct 3, 2024
Merged

docs: update authz docs #22062

merged 1 commit into from
Oct 3, 2024

Conversation

akhilkumarpilli
Copy link
Contributor

@akhilkumarpilli akhilkumarpilli commented Oct 3, 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

  • New Features

    • Introduced a new revoke-all command in the CLI for the authz module, allowing users to revoke all authorizations created by them.
  • Documentation

    • Enhanced clarity and consistency in the x/authz/README.md.
    • Updated links and references to the latest Cosmos SDK version.
    • Expanded descriptions for StakeAuthorization and clarified gas charges associated with authorizations.

Copy link
Contributor

coderabbitai bot commented Oct 3, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request primarily focus on updating the documentation in the x/authz/README.md file to enhance clarity and consistency. Key modifications include refining descriptions of authorizations, expanding details on StakeAuthorization, and updating links to reflect the new Cosmos SDK version. Additionally, a new revoke-all command has been introduced in the CLI section, and various sections have been reworded for improved readability and coherence.

Changes

File Change Summary
x/authz/README.md Updates for clarity and consistency; refined descriptions for authorizations; expanded StakeAuthorization details; updated links to Cosmos SDK v0.52.0-beta.1; added revoke-all command in CLI; reworded sections for readability.

Assessment against linked issues

Objective Addressed Explanation
Update documentation to match v0.52 (21429)
Ensure clarity and consistency in language (21429)
Update references to latest SDK version (21429)
Add new commands for better functionality (21429)

Possibly related PRs

  • docs(x/authz): update grant docs #21677: This PR updates the documentation for StakeAuthorization and the grant command, which is closely related to the changes made in the main PR regarding the StakeAuthorization descriptions and the overall clarity of the x/authz documentation.

Suggested labels

Type: ADR

Suggested reviewers

  • raynaudoe
  • julienrbrt
  • sontrinh16

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.

@akhilkumarpilli akhilkumarpilli added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Oct 3, 2024
@akhilkumarpilli akhilkumarpilli marked this pull request as ready for review October 3, 2024 07:50
@akhilkumarpilli akhilkumarpilli requested review from raynaudoe and a team as code owners October 3, 2024 07: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 (3)
x/authz/README.md (3)

41-43: Approved with a minor suggestion for improvement

The changes in this section enhance clarity and align well with the PR objectives. The distinction between the authz and auth modules is now more clearly explained.

Consider revising line 41 for better grammar:

- Authorization is an interface that must be implemented by a concrete authorization logic to validate and execute grants. Authorizations are extensible and can be defined for any Msg service method, even if the Msg method is defined outside of the module.
+ Authorization is an interface that must be implemented by concrete authorization logic to validate and execute grants. Authorizations are extensible and can be defined for any Msg service method, even if the Msg method is defined outside the module.
🧰 Tools
🪛 LanguageTool

[style] ~41-~41: This phrase is redundant. Consider using “outside”.
Context: ...thod, even if the Msg method is defined outside of the module. See the SendAuthorization...

(OUTSIDE_OF)


87-94: Approved with a minor suggestion for improvement

The updates to the StakeAuthorization section provide more detailed and accurate information, which aligns well with the PR objectives. The SDK version update is correct and consistent with the changes.

Consider revising line 87 for better style:

- `StakeAuthorization` implements the `Authorization` interface for messages in the [staking module](https://docs.cosmos.network/main/build/modules/staking). It takes an `AuthorizationType` to specify whether you want to authorize delegation, undelegation, redelegation or cancel unbonding delegation, each of which must be authorized separately. It also takes an optional `MaxTokens` that keeps track of a limit to the amount of tokens that can be delegated/undelegated/redelegated.
+ `StakeAuthorization` implements the `Authorization` interface for messages in the [staking module](https://docs.cosmos.network/main/build/modules/staking). It takes an `AuthorizationType` to specify whether you want to authorize delegation, undelegation, redelegation or cancel unbonding delegation, each of which must be authorized separately. It also takes an optional `MaxTokens` that keeps track of a limit to the number of tokens that can be delegated/undelegated/redelegated.

This change replaces "amount of tokens" with "number of tokens" for better grammatical accuracy when referring to countable items.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~87-~87: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...ens` that keeps track of a limit to the amount of tokens that can be delegated/undeleg...

(AMOUNTOF_TO_NUMBEROF)


99-101: Approved with suggestions for minor grammatical improvements

The updates to the Gas section provide more detailed and specific information about gas costs associated with StakeAuthorization and grant revocation. This information is valuable for developers and aligns with the PR objectives of improving documentation clarity.

Consider the following grammatical improvements:

  1. In line 99:
- To prevent DoS attacks, granting `StakeAuthorization`s with `x/authz` incurs gas. `StakeAuthorization` allows you to authorize another account to delegate, undelegate, or redelegate tokens to validators. The granter can define a list of validators for which they allow or deny delegations. The Cosmos SDK then iterates over these lists and charge 10 gas for each validator included in both lists.
+ To prevent DoS attacks, granting `StakeAuthorization`s with `x/authz` incurs gas. `StakeAuthorization` allows you to authorize another account to delegate, undelegate, or redelegate tokens to validators. The granter can define a list of validators for which they allow or deny delegations. The Cosmos SDK then iterates over these lists and charges 10 gas units for each validator included in both lists.
  1. In line 101:
- Since the state maintains a list of granter-grantee pairs with same expiration, we iterate over this list to remove the grant from the list (in case of any revoke of particular `msgType`), charging 20 gas for each iteration.
+ Since the state maintains a list of granter-grantee pairs with same expiration, we iterate over this list to remove the grant from the list (in case of any revoke of particular `msgType`), charging 20 gas units for each iteration.

These changes ensure grammatical correctness when referring to gas costs.

🧰 Tools
🪛 LanguageTool

[grammar] ~99-~99: After the number ‘10’, use a plural noun. Did you mean “gases”, “gasses”?
Context: ...iterates over these lists and charge 10 gas for each validator included in both lis...

(CD_NNU)


[grammar] ~101-~101: After the number ‘20’, use a plural noun. Did you mean “gases”, “gasses”?
Context: ...e of particular msgType), charging 20 gas for each iteration. ## State ### Gran...

(CD_NNU)

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4e6a43b and eb9ae37.

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

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

🪛 LanguageTool
x/authz/README.md

[style] ~41-~41: This phrase is redundant. Consider using “outside”.
Context: ...thod, even if the Msg method is defined outside of the module. See the SendAuthorization...

(OUTSIDE_OF)


[uncategorized] ~87-~87: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...ens` that keeps track of a limit to the amount of tokens that can be delegated/undeleg...

(AMOUNTOF_TO_NUMBEROF)


[grammar] ~99-~99: After the number ‘10’, use a plural noun. Did you mean “gases”, “gasses”?
Context: ...iterates over these lists and charge 10 gas for each validator included in both lis...

(CD_NNU)


[grammar] ~101-~101: After the number ‘20’, use a plural noun. Did you mean “gases”, “gasses”?
Context: ...e of particular msgType), charging 20 gas for each iteration. ## State ### Gran...

(CD_NNU)

🔇 Additional comments (4)
x/authz/README.md (4)

121-124: Approved: Improved clarity on grant pruning process

The updates to the GrantQueue section provide more detailed and specific information about the grant pruning process. The addition of the maximum number of grants that can be deleted in each EndBlock run (200) is particularly valuable for developers understanding the system's behavior. This change aligns well with the PR objectives of improving documentation clarity and accuracy.


Line range hint 179-187: Approved: Clear documentation for new MsgRevokeAll message

The addition of the MsgRevokeAll section is a valuable update to the documentation. It clearly explains the purpose of this new message type, which allows a granter to revoke all authorizations they have issued. The section also provides important information about the conditions under which the message handling should fail.

This addition aligns well with the PR objectives of updating documentation for new features in version 0.52 of the Cosmos SDK. The explanation is concise yet comprehensive, providing developers with the necessary information to understand and use this new functionality.


317-329: Approved: Clear documentation for new 'revoke-all' CLI command

The addition of the 'revoke-all' command documentation in the Transactions section is a valuable update. It clearly explains the purpose of this new CLI command, which allows a granter to revoke all authorizations they have created. The section provides a concise explanation of the command's syntax and includes a practical example of its usage.

This addition aligns perfectly with the PR objectives of updating documentation for new features in version 0.52 of the Cosmos SDK. The explanation is user-friendly and provides CLI users with the necessary information to understand and use this new functionality effectively.


Line range hint 1-365: Approved: Comprehensive update aligning with PR objectives

This update to the x/authz/README.md file successfully achieves the objectives outlined in the PR. The documentation has been thoroughly revised to reflect the changes in Cosmos SDK version 0.52, including:

  1. Introduction of new features such as MsgRevokeAll and the 'revoke-all' CLI command.
  2. Clarification and expansion of existing sections, providing more detailed information about authorizations, gas costs, and the grant pruning process.
  3. Updates to code references and links to match the new SDK version.

These changes significantly improve the documentation's clarity, accuracy, and completeness. The updates will be valuable for developers working with the authz module in Cosmos SDK v0.52.

While there were a few minor grammatical and stylistic suggestions, the overall quality of the documentation is high and meets the standards expected for the Cosmos SDK.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~87-~87: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...ens` that keeps track of a limit to the amount of tokens that can be delegated/undeleg...

(AMOUNTOF_TO_NUMBEROF)


[grammar] ~99-~99: After the number ‘10’, use a plural noun. Did you mean “gases”, “gasses”?
Context: ...iterates over these lists and charge 10 gas for each validator included in both lis...

(CD_NNU)


[grammar] ~101-~101: After the number ‘20’, use a plural noun. Did you mean “gases”, “gasses”?
Context: ...e of particular msgType), charging 20 gas for each iteration. ## State ### Gran...

(CD_NNU)

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

nice!

@akhilkumarpilli akhilkumarpilli added this pull request to the merge queue Oct 3, 2024
Merged via the queue into main with commit 09be7c7 Oct 3, 2024
79 checks passed
@akhilkumarpilli akhilkumarpilli deleted the akhil/authz-doc branch October 3, 2024 11:15
mergify bot pushed a commit that referenced this pull request Oct 3, 2024
(cherry picked from commit 09be7c7)
@mergify mergify bot mentioned this pull request Oct 3, 2024
12 tasks
julienrbrt pushed a commit that referenced this pull request Oct 3, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 27, 2024
12 tasks
@coderabbitai coderabbitai bot mentioned this pull request Nov 27, 2024
12 tasks
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/authz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants