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: create v2 upgrading guide skeleton #22696

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions UPGRADING_v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Upgrading Cosmos SDK v2 [DRAFT, see #22531](https://github.com/cosmos/cosmos-sdk/issues/22531)

This guide provides instructions for upgrading to specific versions of Cosmos SDK.
Note, always read the **SimApp** section for more information on application wiring updates.

## Upgrading from v0.52.x to v2.

First and foremost, v2 uses [depinject](./depinject/README.md) to wire the module and application dependencies.
This guide assumes that you have already made your modules depinject compatible, and that you made use of depinject in your application.

### Modules

### Server


### SimApp

With the migration to server/v2 and runtime/v2 some changes are required in the `root.go` and `app.go` of your application.

#### `app.go`


#### `root.go`

Thanks to the more modular design of v2, the application developer is free to pick which server to use in their application:

```go
// wire server commands
return serverv2.AddCommands[T](
rootCmd,
logger,
simApp,
deps.GlobalConfig,
initServerConfig(),
deps.ConsensusServer,
grpcServer,
storeComponent,
telemetryServer,
restServer,
grpcgatewayServer,
)
```
Comment on lines +27 to +42
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Document server configuration parameters

The server configuration example needs explanation of each parameter.

 ```go
 // wire server commands
 return serverv2.AddCommands[T](
 	rootCmd,
 	logger,
 	simApp,
 	deps.GlobalConfig,
 	initServerConfig(),
 	deps.ConsensusServer,
 	grpcServer,
 	storeComponent,
 	telemetryServer,
 	restServer,
 	grpcgatewayServer,
 )

+Parameters explained:
+* rootCmd: Root command of your application
+* logger: Application logger instance
+* simApp: Your application instance
+* deps.GlobalConfig: Global configuration settings
+* initServerConfig(): Server-specific configuration
+* deps.ConsensusServer: Consensus server component
+* grpcServer: gRPC server instance
+* storeComponent: State store component
+* telemetryServer: Metrics server (port 7180)
+* restServer: REST API server (port 8080)
+* grpcgatewayServer: gRPC-Gateway server


<!-- This is an auto-generated comment by CodeRabbit -->


## Upgrading from v0.50.x to v2

Upgrading directly from v0.50.x to v2 is supported.
Modules should be updated to support all the latest changes in the SDK.

Read the module section from the v0.52 [UPGRADING.md](UPGRADING.md) file for more information.
Then simply follow the instructions from the [v0.52 section](#upgrading-from-v052x-to-v200) from this file.
Comment on lines +49 to +50
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix broken link and enhance migration path

The link fragment is incorrect and the migration path needs more detail.

-Read the module section from the v0.52 [UPGRADING.md](UPGRADING.md) file for more information.
-Then simply follow the instructions from the [v0.52 section](#upgrading-from-v052x-to-v200) from this file.
+1. First, read the module section from the v0.52 [UPGRADING.md](UPGRADING.md) file
+2. Then follow the instructions in the [v0.52.x to v2.0.0 section](#upgrading-from-v052x-to-v200) above
+
+### Migration Checklist
+- [ ] Update module dependencies to v0.52.x compatible versions
+- [ ] Apply all breaking changes from v0.52.x
+- [ ] Follow the v2.0.0 upgrade steps above
+- [ ] Test thoroughly with the new architecture
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Read the module section from the v0.52 [UPGRADING.md](UPGRADING.md) file for more information.
Then simply follow the instructions from the [v0.52 section](#upgrading-from-v052x-to-v200) from this file.
1. First, read the module section from the v0.52 [UPGRADING.md](UPGRADING.md) file
2. Then follow the instructions in the [v0.52.x to v2.0.0 section](#upgrading-from-v052x-to-v200) above
### Migration Checklist
- [ ] Update module dependencies to v0.52.x compatible versions
- [ ] Apply all breaking changes from v0.52.x
- [ ] Follow the v2.0.0 upgrade steps above
- [ ] Test thoroughly with the new architecture
🧰 Tools
🪛 Markdownlint (0.37.0)

62-62: null
Link fragments should be valid

(MD051, link-fragments)

Loading