Skip to content

Commit c976184

Browse files
chore: update documentation from cosmos-sdk/docs (#285)
chore: Sync docs from cosmos-sdk/docs Co-authored-by: tac0turtle <[email protected]>
1 parent 5ed98ec commit c976184

File tree

21 files changed

+500
-87
lines changed

21 files changed

+500
-87
lines changed

docs/build/abci/01-prepare-proposal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/baseapp/abci_utils.go
3333
```
3434

3535
This default implementation can be overridden by the application developer in
36-
favor of a custom implementation in [`app_di.go`](../building-apps/01-app-go-v2.md):
36+
favor of a custom implementation in [`app_di.go`](../building-apps/01-app-go-di.md):
3737

3838
```go
3939
prepareOpt := func(app *baseapp.BaseApp) {

docs/build/abci/02-process-proposal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/baseapp/abci_utils.go#L21
1818
```
1919

2020
Like `PrepareProposal`, this implementation is the default and can be modified by
21-
the application developer in [`app_di.go`](../building-apps/01-app-go-v2.md). If you decide to implement
21+
the application developer in [`app_di.go`](../building-apps/01-app-go-di.md). If you decide to implement
2222
your own `ProcessProposal` handler, you must ensure that the transactions
2323
provided in the proposal DO NOT exceed the maximum block gas and `maxtxbytes` (if set).
2424

docs/build/building-apps/00-runtime.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,23 @@ The runtime App struct contains several key components:
2020
```go
2121
type App struct {
2222
*baseapp.BaseApp
23-
ModuleManager *module.Manager
24-
UnorderedTxManager *unorderedtx.Manager
25-
configurator module.Configurator
23+
ModuleManager *module.Manager
24+
configurator module.Configurator
2625
config *runtimev1alpha1.Module
2726
storeKeys []storetypes.StoreKey
2827
// ... other fields
2928
}
3029
```
3130

32-
It is the struct that any Cosmos SDK application should embed to leverage the runtime module.
31+
Cosmos SDK applications should embed the `*runtime.App` struct to leverage the runtime module.
3332

3433
```go reference
35-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_di.go#L61-L62
34+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_di.go#L60-L61
3635
```
3736

3837
### Configuration
3938

40-
The runtime module is configured using App Wiring. The main configuration object is the [`Module` message](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/app/runtime/v1alpha1/module.proto), which supports the following key settings:
39+
The runtime module is configured using App Wiring. The main configuration object is the [`Module` message](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/proto/cosmos/app/runtime/v1alpha1/module.proto), which supports the following key settings:
4140

4241
* `app_name`: The name of the application
4342
* `begin_blockers`: List of module names to call during BeginBlock
@@ -59,7 +58,7 @@ However it provides a flexible store key configuration through:
5958
Example configuration:
6059

6160
```go reference
62-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/v2/app_config.go#L138-L147
61+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_config.go#L133-L138
6362
```
6463

6564
## Key Features
@@ -68,7 +67,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/v2/app_config.go
6867

6968
The runtime module integrates with the `BaseApp` and other core SDK components to provide a seamless experience for developers.
7069

71-
The developer only needs to embed the `App` struct in their application to leverage the runtime module.
70+
The developer only needs to embed the `runtime.App` struct in their application to leverage the runtime module.
7271
The configuration of the module manager and other core components is handled internally via the [`AppBuilder`](#4-application-building).
7372

7473
### 2. Module Registration
@@ -77,7 +76,7 @@ Runtime has built-in support for [`depinject`-enabled modules](../building-modul
7776
Such modules can be registered through the configuration file (often named `app_config.go`), with no additional code required.
7877

7978
```go reference
80-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_config.go#L210-L215
79+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_config.go#L210-L216
8180
```
8281

8382
Additionally, the runtime package facilitates manual module registration through the `RegisterModules` method. This is the primary integration point for modules not registered via configuration.
@@ -94,30 +93,30 @@ The SDK recommends using the declarative approach with `depinject` for module re
9493

9594
### 3. Service Registration
9695

97-
Runtime registers all [core services](../../learn/advanced/02-core.md) required by modules.
98-
These services include the `store`, the `event manager`, the `context`, and the `logger`.
99-
As runtime is doing the wiring of modules, it can ensure that the services are scoped to their respective modules.
96+
Runtime registers all [core services](https://pkg.go.dev/cosmossdk.io/core) required by modules.
97+
These services include `store`, `event manager`, `context`, and `logger`.
98+
Runtime ensures that services are scoped to their respective modules during the wiring process.
10099

101100
```go reference
102-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/runtime/module.go#L250-L279
101+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/runtime/module.go#L201-L235
103102
```
104103

105-
Additionally, runtime provides automatic registration of other essential (f.e gRPC routes) services, available to the App:
104+
Additionally, runtime provides automatic registration of other essential (i.e., gRPC routes) services available to the App:
106105

107106
* AutoCLI Query Service
108107
* Reflection Service
109108
* Custom module services
110109

111110
```go reference
112-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/runtime/builder.go#L74-L77
111+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/runtime/builder.go#L52-L54
113112
```
114113

115114
### 4. Application Building
116115

117116
The `AppBuilder` type provides a structured way to build applications:
118117

119118
```go reference
120-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/runtime/builder.go#L22-L29
119+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/runtime/builder.go#L14-L19
121120
```
122121

123122
Key building steps:
@@ -131,14 +130,14 @@ Key building steps:
131130
An application only needs to call `AppBuilder.Build` to create a fully configured application (`runtime.App`).
132131

133132
```go reference
134-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/runtime/builder.go#L36-L80
133+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/runtime/builder.go#L26-L57
135134
```
136135

137-
More information on building applications can be found in the [next section](./01-app-go-di.md).
136+
More information on building applications can be found in the [next section](./02-app-building.md).
138137

139138
## Best Practices
140139

141-
1. **Module Order**: Carefully consider the order of modules in begin_blockers and end_blockers
140+
1. **Module Order**: Carefully consider the order of modules in begin_blockers, end_blockers, and pre_blockers.
142141
2. **Store Keys**: Use override_store_keys only when necessary to maintain clarity
143142
3. **Genesis Order**: Maintain correct initialization order in init_genesis
144143
4. **Migration Management**: Use order_migrations to control upgrade paths

docs/build/building-apps/01-app-go-di.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,39 @@ The `app_config.go` file is the single place to configure all modules parameters
2929
1. Create the `AppConfig` variable:
3030

3131
```go reference
32-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_di.go#L93-L99
32+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_config.go#L289-L303
3333
```
3434

35-
Where the `appConfig`, combine the [runtime](./00-runtime.md) and the modules configuration.
35+
Where the `appConfig` combines the [runtime](./00-runtime.md) configuration and the (extra) modules configuration.
3636

3737
```go reference
38-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_config.go#L107-L111
38+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_di.go#L113-L161
3939
```
4040

4141
2. Configure the `runtime` module:
4242

43-
In this configuration, the order at which the modules are defined is important.
43+
In this configuration, the order at which the modules are defined in PreBlockers, BeginBlocks, and EndBlockers is important.
4444
They are named in the order they should be executed by the module manager.
4545

4646
```go reference
47-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_config.go#L110-L187
47+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_config.go#L103-L188
4848
```
4949

5050
3. Wire the other modules:
5151

5252
Next to runtime, the other (depinject-enabled) modules are wired in the `AppConfig`:
5353

5454
```go reference
55-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_config.go#L196-L215
55+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_config.go#L103-L286
5656
```
5757

5858
Note: the `tx` isn't a module, but a configuration. It should be wired in the `AppConfig` as well.
5959
6060
```go reference
61-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_config.go#L188-L195
61+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_config.go#L222-L227
6262
```
6363
64-
See the complete `app_config.go` file for `SimApp` [here](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_config.go).
64+
See the complete `app_config.go` file for `SimApp` [here](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_config.go).
6565
6666
### Alternative formats
6767
@@ -100,18 +100,18 @@ modules:
100100
"@type": cosmos.staking.module.v1.Module
101101
- name: tx
102102
config:
103-
"@type": cosmos.tx.config.v1.Config
103+
"@type": cosmos.tx.module.v1.Module
104104
```
105105
106-
A more complete example of `app.yaml` can be found [here](https://github.com/cosmosregistry/chain-minimal/blob/mini-v050.2/app/app.yaml).
106+
A more complete example of `app.yaml` can be found [here](https://github.com/cosmos/cosmos-sdk/blob/release/v0.53.x/simapp/example_app.yaml).
107107
108108
## `app_di.go`
109109
110-
`app_di.go` is the place where `SimApp` is constructed. `depinject.Inject` facilitates that by automatically wiring the app modules and keepers, provided an application configuration `AppConfig` is provided. `SimApp` is constructed, when calling the injected `*runtime.AppBuilder`, with `appBuilder.Build(...)`.
110+
`app_di.go` is the place where `SimApp` is constructed. `depinject.Inject` automatically wires the app modules and keepers when provided with an application configuration (`AppConfig`). `SimApp` is constructed upon calling the injected `*runtime.AppBuilder` with `appBuilder.Build(...)`.
111111
In short `depinject` and the [`runtime` package](./00-runtime.md) abstract the wiring of the app, and the `AppBuilder` is the place where the app is constructed. [`runtime`](./00-runtime.md) takes care of registering the codecs, KV store, subspaces and instantiating `baseapp`.
112112
113113
```go reference
114-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_di.go#L101-L290
114+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_di.go#L100-L270
115115
```
116116
117117
:::warning
@@ -121,16 +121,16 @@ When using `depinject.Inject`, the injected types must be pointers.
121121
### Advanced Configuration
122122
123123
In advanced cases, it is possible to inject extra (module) configuration in a way that is not (yet) supported by `AppConfig`.
124-
In this case, use `depinject.Configs` for combining the extra configuration and `AppConfig`, and `depinject.Supply` to providing that extra configuration.
125-
More information on how work `depinject.Configs` and `depinject.Supply` can be found in the [`depinject` documentation](https://pkg.go.dev/cosmossdk.io/depinject).
124+
In this case, use `depinject.Configs` for combining the extra configuration, and `AppConfig` and `depinject.Supply` for providing the extra configuration.
125+
More information on how `depinject.Configs` and `depinject.Supply` function can be found in the [`depinject` documentation](https://pkg.go.dev/cosmossdk.io/depinject).
126126
127127
```go reference
128-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app_di.go#L117-L161
128+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_di.go#L114-L162
129129
```
130130
131131
### Registering non app wiring modules
132132
133-
It is possible to combine app wiring / depinject enabled modules with non app wiring modules.
133+
It is possible to combine app wiring / depinject enabled modules with non-app wiring modules.
134134
To do so, use the `app.RegisterModules` method to register the modules on your app, as well as `app.RegisterStores` for registering the extra stores needed.
135135
136136
```go
@@ -149,7 +149,7 @@ if err := app.RegisterModules(&exampleAppModule); err != nil {
149149
```
150150
151151
:::warning
152-
When using AutoCLI and combining app wiring and non app wiring modules. The AutoCLI options should be manually constructed instead of injected.
152+
When using AutoCLI and combining app wiring and non-app wiring modules. The AutoCLI options should be manually constructed instead of injected.
153153
Otherwise it will miss the non depinject modules and not register their CLI.
154154
:::
155155
@@ -160,5 +160,5 @@ Note that in the complete `SimApp` `app_di.go` file, testing utilities are also
160160
:::
161161
162162
```go reference
163-
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app.go
163+
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/simapp/app_di.go
164164
```

docs/build/building-apps/02-app-mempool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Namely, the SDK provides the following mempools:
2929
* [Sender Nonce Mempool](#sender-nonce-mempool)
3030
* [Priority Nonce Mempool](#priority-nonce-mempool)
3131

32-
The default SDK is a [No-op Mempool](#no-op-mempool), but it can be replaced by the application developer in [`app.go`](./01-app-go-v2.md):
32+
By default, the SDK uses the [No-op Mempool](#no-op-mempool), but it can be replaced by the application developer in [`app.go`](./01-app-go-di.md):
3333

3434
```go
3535
nonceMempool := mempool.NewSenderNonceMempool()

docs/build/building-modules/15-depinject.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ The module is now ready to be used with `depinject` by a chain developer.
121121

122122
## Integrate in an application
123123

124-
The App Wiring is done in `app_config.go` / `app.yaml` and `app_v2.go` and is explained in detail in the [overview of `app_v2.go`](../building-apps/01-app-go-v2.md).
124+
The App Wiring is done in `app_config.go` / `app.yaml` and `app_v2.go` and is explained in detail in the [overview of `app_v2.go`](../building-apps/01-app-go-di.md).

docs/build/modules/authz/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/bank/types/send_authoriz
8282

8383
#### StakeAuthorization
8484

85-
`StakeAuthorization` implements the `Authorization` interface for messages in the [staking module](https://docs.cosmos.network/v0.50/build/modules/staking). It takes an `AuthorizationType` to specify whether you want to authorise delegating, undelegating or redelegating (i.e. these have to be authorised separately). It also takes an optional `MaxTokens` that keeps track of a limit to the amount of tokens that can be delegated/undelegated/redelegated. If left empty, the amount is unlimited. Additionally, this Msg takes an `AllowList` or a `DenyList`, which allows you to select which validators you allow or deny grantees to stake with.
85+
`StakeAuthorization` implements the `Authorization` interface for messages in the [staking module](https://docs.cosmos.network/v0.53/build/modules/staking). It takes an `AuthorizationType` to specify whether you want to authorise delegating, undelegating or redelegating (i.e. these have to be authorised separately). It also takes an optional `MaxTokens` that keeps track of a limit to the amount of tokens that can be delegated/undelegated/redelegated. If left empty, the amount is unlimited. Additionally, this Msg takes an `AllowList` or a `DenyList`, which allows you to select which validators you allow or deny grantees to stake with.
8686

8787
```protobuf reference
8888
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/authz.proto#L11-L35

0 commit comments

Comments
 (0)