-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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(core): add core documentation and principles #21511
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f8fad15
docs(core): add core documentation and principles
julienrbrt 2159eb7
updates
julienrbrt d1fe7c3
docs
julienrbrt 62495e5
feedback
julienrbrt 29ea929
zerodep
julienrbrt 63a5d8e
Merge branch 'main' into julien/core-principles
julienrbrt d2cb5d0
`make mocks`
julienrbrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
# Cosmos SDK Core | ||
|
||
The [cosmossdk.io/core](https://pkg.go.dev/cosmossdk.io/core) go module defines | ||
"core" functionality for the Cosmos SDK. | ||
The [cosmossdk.io/core](https://pkg.go.dev/cosmossdk.io/core) Go module defines essential APIs and interfaces for the Cosmos SDK ecosystem. It serves as a foundation for building modular blockchain applications. | ||
|
||
Currently functionality for registering modules using the [appmodule](https://pkg.go.dev/cosmossdk.io/core/appmodule) | ||
package and composing apps using the [appconfig](https://pkg.go.dev/cosmossdk.io/core/appconfig) | ||
package is provided. | ||
Key features and principles: | ||
|
||
In the future core functionality for building Cosmos SDK app modules will be | ||
provided in this go module. | ||
1. Provides stable, long-term maintained APIs for module development and app composition. | ||
2. Focuses on interface definitions without implementation details. | ||
3. Implementations are housed in the runtime(/v2) or individual modules. | ||
4. Modules depend solely on core APIs for maximum compatibility. | ||
5. New API additions undergo thorough consideration to maintain stability. | ||
6. Adheres to a no-breaking-changes policy for reliable dependency management. | ||
|
||
The core module offers the [appmodule](https://pkg.go.dev/cosmossdk.io/core/appmodule) and [appmodule/v2](https://pkg.go.dev/cosmossdk.io/core/appmodule/v2) packages that includes APIs to describe how modules can be written. | ||
Additionally, it contains all core services APIs that can be used in modules to interact with the SDK, majoritarily via the `appmodule.Environment` struct. | ||
Last but not least, it provides codecs and packages for the Cosmos SDK's core types (think of, for instance, logger, store interface or an address codec). | ||
julienrbrt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Developers and contributors approach core API design with careful deliberation, ensuring that additions provide significant value while maintaining the module's stability and simplicity. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
// Package appmodule defines the functionality for registering Cosmos SDK app | ||
// modules that are assembled using the cosmossdk.io/depinject | ||
// dependency injection system and the declarative app configuration format | ||
// handled by the appconfig package. | ||
// Package appmodule defines what is needed for an module to be used in the Cosmos SDK (runtime). | ||
// It is equivalent to the appmodulev2 package, but less flexibility to stay compatible with baseapp instead of server/v2. | ||
// If you are looking at integrating dependency injection into your module please see depinject appconfig documentation. | ||
julienrbrt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
package appmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package appmodule | ||
|
||
import ( | ||
"cosmossdk.io/core/appmodule/v2" | ||
appmodulev2 "cosmossdk.io/core/appmodule/v2" | ||
) | ||
|
||
// Environment is used to get all services to their respective module | ||
// Contract: All fields of environment are always populated. | ||
type Environment = appmodule.Environment | ||
// Environment is used to get all services to their respective module. | ||
// Contract: All fields of environment are always populated by runtime. | ||
type Environment = appmodulev2.Environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
package appmodule | ||
|
||
import ( | ||
"cosmossdk.io/core/appmodule/v2" | ||
appmodulev2 "cosmossdk.io/core/appmodule/v2" | ||
) | ||
|
||
// HasConsensusVersion is the interface for declaring a module consensus version. | ||
type HasConsensusVersion = appmodule.HasConsensusVersion | ||
type HasConsensusVersion = appmodulev2.HasConsensusVersion | ||
|
||
// HasMigrations is implemented by a module which upgrades or has upgraded to a new consensus version. | ||
type HasMigrations = appmodule.HasMigrations | ||
type HasMigrations = appmodulev2.HasMigrations | ||
|
||
// MigrationRegistrar is the interface for registering in-place store migrations. | ||
type MigrationRegistrar = appmodule.MigrationRegistrar | ||
type MigrationRegistrar = appmodulev2.MigrationRegistrar | ||
|
||
// MigrationHandler is the migration function that each module registers. | ||
type MigrationHandler = appmodule.MigrationHandler | ||
type MigrationHandler = appmodulev2.MigrationHandler | ||
|
||
// VersionMap is a map of moduleName -> version | ||
type VersionMap = appmodule.VersionMap | ||
type VersionMap = appmodulev2.VersionMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Package appmodule defines what is needed for an module to be used in the Cosmos SDK (runtime/v2). | ||
// If you are looking at integrating dependency injection into your module please see depinject appconfig documentation. | ||
package appmodulev2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package appmodule | ||
package appmodulev2 | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package appmodule | ||
package appmodulev2 | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package appmodule | ||
package appmodulev2 | ||
|
||
import "context" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package appmodule | ||
package appmodulev2 | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package appmodule | ||
package appmodulev2 | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// package genesis is used to define appmodule.HasGenesisAuto experimental auto genesis. | ||
// This genesis package isn't supported in server/v2. | ||
package genesis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix subject-verb agreement.
There seems to be a subject-verb agreement error in this line. "packages" is plural, so the verb should be "include" instead of "includes".
Apply this diff to fix the agreement error:
Committable suggestion
Tools
LanguageTool