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: Add environment documentation link and description #23330

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

GarmashAlex
Copy link
Contributor

@GarmashAlex GarmashAlex commented Jan 10, 2025

Closes: #XXXX (Note: Since we don't have a specific issue number, this would be filled with actual issue number if exists)

This PR improves the documentation in UPGRADING.md by replacing a TODO placeholder with comprehensive documentation about the Environment struct and its services. The changes include:

This PR adds proper documentation for the Environment struct in the
UPGRADING.md file, replacing a TODO placeholder. The added documentation
helps developers understand the essential services provided to modules
through the Environment struct, including logging, event handling,
gas metering, header access, routing, and store services.
This documentation helps developers better understand the module environment system when upgrading their applications to the latest version.

The change improves developer experience by providing clear information about the module environment system directly in the upgrade guide, making it easier for developers to understand and implement the necessary changes during upgrades.

  • 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

Release Notes

This PR adds proper documentation for the Environment struct in the
UPGRADING.md file, replacing a TODO placeholder. The added documentation
helps developers understand the essential services provided to modules
through the Environment struct, including logging, event handling,
gas metering, header access, routing, and store services.

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Removed x/params module
    • Removed x/crisis module
    • Removed gRPC Web client support
  • New Features

    • Added x/protocolpool module
    • Added x/validate module
    • Introduced support for unordered transactions
    • Added SignMode Textual feature
  • Migration Guidance

    • Updated module parameter management approach
    • Simplified application structure
    • Revised transaction and account handling methods

Developers should carefully review the upgrading documentation for detailed migration instructions.

@GarmashAlex GarmashAlex requested a review from a team as a code owner January 10, 2025 21:49
Copy link
Contributor

coderabbitai bot commented Jan 10, 2025

📝 Walkthrough

Walkthrough

The pull request introduces extensive modifications to the Cosmos SDK documentation, particularly the upgrading guide. Key changes include the removal of the x/params module, with migration guidance provided for developers. Significant refactoring of the SimApp section is noted, alongside updates to transaction handling and Protobuf practices. New modules like x/protocolpool and x/validate have been added, while the x/crisis module has been removed. Overall, the changes reflect a substantial restructuring of the Cosmos SDK towards improved modularity and transaction management.

Changes

File Change Summary
UPGRADING.md - Removed x/params module documentation
- Added migration instructions for new module paradigms
- Updated SimApp configuration guidelines
- Simplified server.AddCommands method
- Documented removal of gRPC Web client and new transaction handling approaches
- Introduced new modules x/protocolpool and x/validate, and documented changes in x/auth module

Possibly related PRs

  • docs: fix dead link in UPGRADING.md #23059: This PR directly addresses changes in the UPGRADING.md document, which includes the removal of the x/params module and updates related to the SimApp section, aligning closely with the changes made in the main PR.
  • docs: add a synopsis upgrade doc for 52 #23097: This PR adds a synopsis upgrade document for version 0.52, which includes significant changes such as the removal of the x/params module and the introduction of the x/protocolpool module, directly relating to the modifications in the main PR.
  • docs: update modules list doc #23172: This PR updates the modules list in the documentation, reflecting the removal of the x/params module and the addition of new modules like x/protocolpool, which corresponds with the changes in the main PR.

Suggested Labels

T:Docs, C:x/accounts, C:x/accounts/lockup

Suggested Reviewers

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

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

🧹 Nitpick comments (4)
UPGRADING.md (4)

339-339: Fix grammatical error in environment documentation.

The sentence structure needs improvement for better clarity.

-Learn more about environment in the [core/appmodule/v2/environment.go](core/appmodule/v2/environment.go) file.
+Learn more about the environment in the [core/appmodule/v2/environment.go](core/appmodule/v2/environment.go) file.

Line range hint 1-24: Add version compatibility matrix.

Consider adding a compatibility matrix at the beginning of the document to help users quickly determine the upgrade path based on their current version.

Add a section like this at the beginning:

## Version Compatibility Matrix

| From Version | To Version | Upgrade Path |
|-------------|------------|--------------|
| v0.50.x     | v0.52.x    | Direct      |
| v0.47.x     | v0.52.x    | Must upgrade to v0.50.x first |

Line range hint 471-484: Improve clarity of Vote Extensions documentation.

The Vote Extensions section should provide more context about what they are and their importance.

Add an explanation paragraph before the technical details:

Vote Extensions allow validators to include additional data with their precommit votes during consensus. This feature enables advanced functionalities like threshold decryption, random beacon, and other protocols that require validators to commit to additional data during block finalization.

Line range hint 599-627: Add missing configuration example for gRPC-Web nginx setup.

The gRPC-Web section mentions using nginx as a reverse proxy but doesn't provide a configuration example.

Add a basic nginx configuration example:

Example nginx configuration for gRPC-Web:

```nginx
server {
    listen 9090;
    server_name localhost;

    location / {
        proxy_pass http://localhost:1317;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }
}
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1a4c9a and 0c1cb30.

📒 Files selected for processing (1)
  • UPGRADING.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
UPGRADING.md (1)

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

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (1)
UPGRADING.md (1)

Line range hint 628-630: Provide database migration guidance.

The database support section removes several database backends but doesn't provide specific migration guidance.

Add specific migration tools and steps for each unsupported database:

### Database Migration Tools

* From LevelDB/BoltDB to GoLevelDB: Use [cosmos-db-migrate](https://github.com/cosmos/cosmos-db-migrate)
* From BadgerDB to GoLevelDB: Use [badger-to-goleveldb](https://github.com/cosmos/tools/tree/master/cmd/badger-to-goleveldb)

Example migration command:

@GarmashAlex
Copy link
Contributor Author

@julienrbrt

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

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

339-339: Enhance environment documentation with more details

The documentation about the Environment struct could be improved by:

  1. Adding examples of how to use each service (logging, event handling, etc.)
  2. Clarifying when a module might want to skip store creation
  3. Providing a link to example modules that demonstrate proper environment usage
-Learn more about environment in the [core/appmodule/v2/environment.go](core/appmodule/v2/environment.go) file. The Environment struct provides essential services to modules including logging, event handling, gas metering, header access, routing, and both KV and memory store services. Given the fields of environment, this means runtime creates a kv store service for all modules by default. It can happen that some modules do not have a store necessary (such as `x/auth/tx` for instance). In this case, the store creation should be skipped in `app_config.go`:
+Learn more about environment in the [core/appmodule/v2/environment.go](core/appmodule/v2/environment.go) file. The Environment struct provides essential services to modules:
+
+* Logging: Structured logging with module context
+* Event Handling: Emit and handle module-specific events
+* Gas Metering: Track and manage gas consumption
+* Header Access: Read block header information
+* Routing: Message and query routing between modules
+* Store Services: Both KV and memory store capabilities
+
+By default, runtime creates a KV store service for all modules. However, some modules (like `x/auth/tx`) don't require persistent storage. For such modules, skip store creation in `app_config.go`:
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1cb30 and c3aefe1.

📒 Files selected for processing (1)
  • UPGRADING.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
UPGRADING.md (1)

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

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary

UPGRADING.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 Jan 11, 2025
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

🧹 Nitpick comments (2)
UPGRADING.md (2)

339-339: Fix the markdown link syntax.

The markdown link syntax is incorrect. The closing square bracket and opening parenthesis should be adjacent.

-The 'Environment struct provides essential services](https://docs.cosmos.network/main/learn/advanced/core#environment)
+The [Environment struct provides essential services](https://docs.cosmos.network/main/learn/advanced/core#environment)

Line range hint 339-349: Enhance documentation clarity and formatting.

The documentation about the Environment struct and store services could be improved for better readability and understanding.

-The 'Environment struct provides essential services](https://docs.cosmos.network/main/learn/advanced/core#environment) to modules including logging, event handling, gas metering, header access, routing, and both KV and memory store services. Given the fields of environment, this means runtime creates a kv store service for all modules by default. It can happen that some modules do not have a store necessary (such as `x/auth/tx` for instance). In this case, the store creation should be skipped in `app_config.go`:
+The [Environment struct](https://docs.cosmos.network/main/learn/advanced/core#environment) provides essential services to modules, including:
+
+* Logging
+* Event handling
+* Gas metering
+* Header access
+* Routing
+* KV and memory store services
+
+By default, runtime creates a KV store service for all modules. However, some modules (such as `x/auth/tx`) may not require a store. In such cases, store creation can be skipped in `app_config.go`:
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3aefe1 and fd83a32.

📒 Files selected for processing (1)
  • UPGRADING.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
UPGRADING.md (1)

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

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary

@tac0turtle tac0turtle added this pull request to the merge queue Jan 13, 2025
Merged via the queue into cosmos:main with commit 1b5b338 Jan 13, 2025
69 of 72 checks passed
mergify bot pushed a commit that referenced this pull request Jan 13, 2025
Co-authored-by: Julien Robert <[email protected]>
(cherry picked from commit 1b5b338)
julienrbrt pushed a commit that referenced this pull request Jan 13, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants