docs: improve documentation navigation and redirection (#13455)

This commit is contained in:
Julien Robert
2022-10-06 15:51:10 +02:00
committed by GitHub
parent ff39d243d4
commit 74ce07eb26
43 changed files with 299 additions and 12935 deletions
+104 -67
View File
@@ -3,19 +3,48 @@ module.exports = {
title: "Cosmos SDK",
locales: {
"/": {
lang: "en-US"
lang: "en-US",
},
},
base: process.env.VUEPRESS_BASE || "/",
head: [
['link', { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" }],
['link', { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" }],
['link', { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" }],
['link', { rel: "manifest", href: "/site.webmanifest" }],
['meta', { name: "msapplication-TileColor", content: "#2e3148" }],
['meta', { name: "theme-color", content: "#ffffff" }],
['link', { rel: "icon", type: "image/svg+xml", href: "/favicon-svg.svg" }],
['link', { rel: "apple-touch-icon-precomposed", href: "/apple-touch-icon-precomposed.png" }],
[
"link",
{
rel: "apple-touch-icon",
sizes: "180x180",
href: "/apple-touch-icon.png",
},
],
[
"link",
{
rel: "icon",
type: "image/png",
sizes: "32x32",
href: "/favicon-32x32.png",
},
],
[
"link",
{
rel: "icon",
type: "image/png",
sizes: "16x16",
href: "/favicon-16x16.png",
},
],
["link", { rel: "manifest", href: "/site.webmanifest" }],
["meta", { name: "msapplication-TileColor", content: "#2e3148" }],
["meta", { name: "theme-color", content: "#ffffff" }],
["link", { rel: "icon", type: "image/svg+xml", href: "/favicon-svg.svg" }],
[
"link",
{
rel: "apple-touch-icon-precomposed",
href: "/apple-touch-icon-precomposed.png",
},
],
],
themeConfig: {
repo: "cosmos/cosmos-sdk",
@@ -27,28 +56,28 @@ module.exports = {
algolia: {
id: "BH4D9OD16A",
key: "ac317234e6a42074175369b2f42e9754",
index: "cosmos-sdk"
index: "cosmos-sdk",
},
versions: [
{
"label": "v0.44",
"key": "v0.44"
label: "v0.45",
key: "v0.45",
},
{
"label": "v0.45",
"key": "v0.45"
label: "v0.46",
key: "v0.46",
},
{
"label": "v0.46",
"key": "v0.46"
label: "v0.47 - Twilight",
key: "v0.47",
},
{
"label": "main",
"key": "main"
}
label: "main",
key: "main",
},
],
topbar: {
banner: false
banner: false,
},
sidebar: {
auto: true,
@@ -59,28 +88,28 @@ module.exports = {
{
title: "Modules",
directory: true,
path: "/modules"
}
]
path: "/modules",
},
],
},
{
title: "Resources",
children: [
{
title: "Tutorials",
path: "https://tutorials.cosmos.network"
path: "https://tutorials.cosmos.network",
},
{
title: "SDK API Reference",
path: "https://pkg.go.dev/github.com/cosmos/cosmos-sdk"
path: "https://pkg.go.dev/github.com/cosmos/cosmos-sdk",
},
{
title: "REST API Spec",
path: "https://cosmos.network/rpc/"
}
]
}
]
path: "https://cosmos.network/rpc/",
},
],
},
],
},
gutter: {
title: "Help & Support",
@@ -89,90 +118,92 @@ module.exports = {
title: "Discord",
text: "Chat with Cosmos developers on Discord.",
url: "https://discordapp.com/channels/669268347736686612",
bg: "linear-gradient(225.11deg, #2E3148 0%, #161931 95.68%)"
bg: "linear-gradient(225.11deg, #2E3148 0%, #161931 95.68%)",
},
forum: {
title: "Cosmos SDK Forum",
text: "Join the SDK Developer Forum to learn more.",
url: "https://forum.cosmos.network/",
bg: "linear-gradient(225deg, #46509F -1.08%, #2F3564 95.88%)",
logo: "cosmos"
logo: "cosmos",
},
github: {
title: "Found an Issue?",
text: "Help us improve this page by suggesting edits on GitHub."
}
text: "Help us improve this page by suggesting edits on GitHub.",
},
},
footer: {
question: {
text: "Chat with Cosmos developers in <a href='https://discord.gg/cosmosnetwork' target='_blank'>Discord</a> or reach out on the <a href='https://forum.cosmos.network/c/tendermint' target='_blank'>SDK Developer Forum</a> to learn more."
text:
"Chat with Cosmos developers in <a href='https://discord.gg/cosmosnetwork' target='_blank'>Discord</a> or reach out on the <a href='https://forum.cosmos.network/c/tendermint' target='_blank'>SDK Developer Forum</a> to learn more.",
},
logo: "/logo-bw.svg",
textLink: {
text: "cosmos.network",
url: "https://cosmos.network"
url: "https://cosmos.network",
},
services: [
{
service: "medium",
url: "https://blog.cosmos.network/"
url: "https://blog.cosmos.network/",
},
{
service: "twitter",
url: "https://twitter.com/cosmos"
url: "https://twitter.com/cosmos",
},
{
service: "linkedin",
url: "https://www.linkedin.com/company/tendermint/"
url: "https://www.linkedin.com/company/interchain-gmbh/",
},
{
service: "reddit",
url: "https://reddit.com/r/cosmosnetwork"
url: "https://reddit.com/r/cosmosnetwork",
},
{
service: "telegram",
url: "https://t.me/cosmosproject"
url: "https://t.me/cosmosproject",
},
{
service: "youtube",
url: "https://www.youtube.com/c/CosmosProject"
}
url: "https://www.youtube.com/c/CosmosProject",
},
],
smallprint: "The development of the Cosmos SDK is led primarily by [Interchain Core Teams](https://interchain.io/ecosystem). Funding for this development comes primarily from the Interchain Foundation, a Swiss non-profit.",
smallprint:
"The development of the Cosmos SDK is led primarily by [Interchain Core Teams](https://interchain.io/ecosystem). Funding for this development comes primarily from the Interchain Foundation, a Swiss non-profit.",
links: [
{
title: "Documentation",
children: [
{
title: "Cosmos Hub",
url: "https://hub.cosmos.network"
url: "https://hub.cosmos.network",
},
{
title: "Tendermint Core",
url: "https://docs.tendermint.com"
url: "https://docs.tendermint.com",
},
{
title: "IBC-Go",
url: "https://ibc.cosmos.network"
title: "IBC Go",
url: "https://ibc.cosmos.network",
},
]
],
},
{
title: "Community",
children: [
{
title: "Cosmos blog",
url: "https://blog.cosmos.network"
url: "https://blog.cosmos.network",
},
{
title: "Forum",
url: "https://forum.cosmos.network"
url: "https://forum.cosmos.network",
},
{
title: "Chat",
url: "https://discord.gg/cosmosnetwork"
}
]
url: "https://discord.gg/cosmosnetwork",
},
],
},
{
title: "Contributing",
@@ -180,29 +211,35 @@ module.exports = {
{
title: "Contributing to the docs",
url:
"https://github.com/cosmos/cosmos-sdk/blob/main/docs/DOCS_README.md"
"https://github.com/cosmos/cosmos-sdk/blob/main/docs/DOCS_README.md",
},
{
title: "Source code on GitHub",
url: "https://github.com/cosmos/cosmos-sdk/"
}
]
}
]
}
url: "https://github.com/cosmos/cosmos-sdk/",
},
],
},
],
},
},
plugins: [
[
"@vuepress/google-analytics",
{
ga: "UA-51029217-2"
}
ga: "UA-51029217-2",
},
],
[
"@vuepress/html-redirect",
{
countdown: 0,
},
],
[
"sitemap",
{
hostname: "https://docs.cosmos.network"
}
]
]
hostname: "https://docs.cosmos.network",
},
],
],
};
-8
View File
@@ -1,8 +0,0 @@
export default ({ router }) => {
router.addRoutes([
{ path: "/main/spec/*", redirect: "/modules/" },
{ path: "/main/spec/governance/", redirect: "/modules/gov/" },
{ path: "/v0.43/", redirect: "/v0.44/" }, // TODO to fix: https://github.com/cosmos/cosmos-sdk/issues/11798
{ path: "/master/", redirect: "/" },
]);
};
+98
View File
@@ -0,0 +1,98 @@
/master https://docs.cosmos.network/main/
/main/spec/governance/ https://docs.cosmos.network/main/modules/gov/
/v0.43 https://docs.cosmos.network/main/
/v0.44 https://docs.cosmos.network/main/
/main/modules/auth/01_concepts.html https://docs.cosmos.network/main/modules/auth/
/main/modules/auth/02_state.html https://docs.cosmos.network/main/modules/auth/
/main/modules/auth/03_antehandlers.html https://docs.cosmos.network/main/modules/auth/
/main/modules/auth/04_keepers.html https://docs.cosmos.network/main/modules/auth/
/main/modules/auth/05_vesting.html https://docs.cosmos.network/main/modules/vesting/
/main/modules/auth/06_params.html https://docs.cosmos.network/main/modules/auth/
/main/modules/auth/07_client.html https://docs.cosmos.network/main/modules/auth/
/main/modules/authz/01_concepts.html https://docs.cosmos.network/main/modules/authz/
/main/modules/authz/02_state.html https://docs.cosmos.network/main/modules/authz/
/main/modules/authz/03_messages.html https://docs.cosmos.network/main/modules/authz/
/main/modules/authz/04_events.html https://docs.cosmos.network/main/modules/authz/
/main/modules/authz/05_client.html https://docs.cosmos.network/main/modules/authz/
/main/modules/bank/01_state.html https://docs.cosmos.network/main/modules/bank/
/main/modules/bank/02_keepers.html https://docs.cosmos.network/main/modules/bank/
/main/modules/bank/04_events.html https://docs.cosmos.network/main/modules/bank/
/main/modules/bank/05_params.html https://docs.cosmos.network/main/modules/bank/
/main/modules/bank/06_client.html https://docs.cosmos.network/main/modules/bank/
/main/modules/capability/01_concepts.html https://docs.cosmos.network/main/modules/capability/
/main/modules/capability/02_state.html https://docs.cosmos.network/main/modules/capability/
/main/modules/crisis/01_state.html https://docs.cosmos.network/main/modules/crisis/
/main/modules/crisis/02_messages.html https://docs.cosmos.network/main/modules/crisis/
/main/modules/crisis/03_events.html https://docs.cosmos.network/main/modules/crisis/
/main/modules/crisis/04_params.html https://docs.cosmos.network/main/modules/crisis/
/main/modules/crisis/05_client.html https://docs.cosmos.network/main/modules/crisis/
/main/modules/distribution/01_concepts.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/distribution/02_state.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/distribution/03_begin_block.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/distribution/04_messages.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/distribution/05_hooks.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/distribution/06_events.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/distribution/07_params.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/distribution/08_client.html https://docs.cosmos.network/main/modules/distribution/
/main/modules/epoching/01_state.html https://docs.cosmos.network/main/modules/epoching/
/main/modules/epoching/03_to_improve.html https://docs.cosmos.network/main/modules/epoching/
/main/modules/evidence/01_concepts.html https://docs.cosmos.network/main/modules/evidence/
/main/modules/evidence/02_state.html https://docs.cosmos.network/main/modules/evidence/
/main/modules/evidence/03_messages.html https://docs.cosmos.network/main/modules/evidence/
/main/modules/evidence/04_events.html https://docs.cosmos.network/main/modules/evidence/
/main/modules/evidence/05_params.html https://docs.cosmos.network/main/modules/evidence/
/main/modules/evidence/06_begin_block.html https://docs.cosmos.network/main/modules/evidence/
/main/modules/evidence/07_client.html https://docs.cosmos.network/main/modules/evidence/
/main/modules/feegrant/01_concepts.html https://docs.cosmos.network/main/modules/feegrant/
/main/modules/feegrant/02_state.html https://docs.cosmos.network/main/modules/feegrant/
/main/modules/feegrant/03_messages.html https://docs.cosmos.network/main/modules/feegrant/
/main/modules/feegrant/04_events.html https://docs.cosmos.network/main/modules/feegrant/
/main/modules/feegrant/05_client.html https://docs.cosmos.network/main/modules/feegrant/
/main/modules/gov/01_concepts.html https://docs.cosmos.network/main/modules/gov/
/main/modules/gov/02_state.html https://docs.cosmos.network/main/modules/gov/
/main/modules/gov/03_messages.html https://docs.cosmos.network/main/modules/gov/
/main/modules/gov/04_events.html https://docs.cosmos.network/main/modules/gov/
/main/modules/gov/05_future_improvements.html https://docs.cosmos.network/main/modules/gov/
/main/modules/gov/06_params.html https://docs.cosmos.network/main/modules/gov/
/main/modules/gov/07_client.html https://docs.cosmos.network/main/modules/gov/
/main/modules/gov/08_metadata.html https://docs.cosmos.network/main/modules/gov/
/main/modules/group/01_concepts.html https://docs.cosmos.network/main/modules/group/
/main/modules/group/02_state.html https://docs.cosmos.network/main/modules/group/
/main/modules/group/03_messages.html https://docs.cosmos.network/main/modules/group/
/main/modules/group/04_events.html https://docs.cosmos.network/main/modules/group/
/main/modules/group/05_client.html https://docs.cosmos.network/main/modules/group/
/main/modules/group/06_metadata.html https://docs.cosmos.network/main/modules/group/
/main/modules/mint/01_concepts.html https://docs.cosmos.network/main/modules/mint/
/main/modules/mint/02_state.html https://docs.cosmos.network/main/modules/mint/
/main/modules/mint/03_begin_block.html https://docs.cosmos.network/main/modules/mint/
/main/modules/mint/04_params.html https://docs.cosmos.network/main/modules/mint/
/main/modules/mint/05_events.html https://docs.cosmos.network/main/modules/mint/
/main/modules/mint/06_client.html https://docs.cosmos.network/main/modules/mint/
/main/modules/nft/01_concepts.html https://docs.cosmos.network/main/modules/nft/
/main/modules/nft/02_state.html https://docs.cosmos.network/main/modules/nft/
/main/modules/nft/03_messages.html https://docs.cosmos.network/main/modules/nft/
/main/modules/nft/04_events.html https://docs.cosmos.network/main/modules/nft/
/main/modules/params/01_keeper.html https://docs.cosmos.network/main/modules/params/
/main/modules/params/02_subspace.html https://docs.cosmos.network/main/modules/params/
/main/modules/slashing/01_concepts.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/02_state.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/03_messages.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/04_begin_block.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/05_hooks.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/06_events.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/07_tombstone.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/08_params.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/slashing/09_client.html https://docs.cosmos.network/main/modules/slashing/
/main/modules/staking/01_state.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/02_state_transitions.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/03_messages.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/04_begin_block.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/05_end_block.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/06_hooks.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/07_events.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/08_params.html https://docs.cosmos.network/main/modules/staking/
/main/modules/staking/09_client.html https://docs.cosmos.network/main/modules/staking/
/main/modules/upgrade/01_concepts.html https://docs.cosmos.network/main/modules/upgrade/
/main/modules/upgrade/02_state.html https://docs.cosmos.network/main/modules/upgrade/
/main/modules/upgrade/03_events.html https://docs.cosmos.network/main/modules/upgrade/
/main/modules/upgrade/04_client.html https://docs.cosmos.network/main/modules/upgrade/
@@ -47,7 +47,7 @@ a name. A `String()` method is provided for debugging.
A `Capability` is simply a struct, the address of which is taken for the actual capability.
```golang
```go
type Capability struct {
index uint64
}
@@ -55,7 +55,7 @@ type Capability struct {
A `CapabilityKeeper` contains a persistent store key, memory store key, and mapping of allocated module names.
```golang
```go
type CapabilityKeeper struct {
persistentKey StoreKey
memKey StoreKey
@@ -71,7 +71,7 @@ and passed to modules, which can then use them to claim capabilities they receiv
capabilities which they own by name, in addition to creating new capabilities & authenticating capabilities
passed by other modules.
```golang
```go
type ScopedCapabilityKeeper struct {
persistentKey StoreKey
memKey StoreKey
@@ -83,7 +83,7 @@ type ScopedCapabilityKeeper struct {
`ScopeToModule` is used to create a scoped sub-keeper with a particular name, which must be unique.
It MUST be called before `InitialiseAndSeal`.
```golang
```go
func (ck CapabilityKeeper) ScopeToModule(moduleName string) ScopedCapabilityKeeper {
if k.sealed {
panic("cannot scope to module via a sealed capability keeper")
@@ -110,7 +110,7 @@ necessary `ScopedCapabilityKeeper`s, in order to populate the memory store with
capability keys in accordance with the keys previously claimed by particular modules and prevent the
creation of any new `ScopedCapabilityKeeper`s.
```golang
```go
func (ck CapabilityKeeper) InitialiseAndSeal(ctx Context) {
if ck.sealed {
panic("capability keeper is sealed")
@@ -140,7 +140,7 @@ func (ck CapabilityKeeper) InitialiseAndSeal(ctx Context) {
reference. The newly created capability is automatically persisted; the calling module need not
call `ClaimCapability`.
```golang
```go
func (sck ScopedCapabilityKeeper) NewCapability(ctx Context, name string) (Capability, error) {
// check name not taken in memory store
if capStore.Get("rev/" + name) != nil {
@@ -178,7 +178,7 @@ func (sck ScopedCapabilityKeeper) NewCapability(ctx Context, name string) (Capab
does in fact correspond to a particular name (the name can be untrusted user input)
with which the calling module previously associated it.
```golang
```go
func (sck ScopedCapabilityKeeper) AuthenticateCapability(name string, capability Capability) bool {
// return whether forward mapping in memory store matches name
return memStore.Get(sck.moduleName + "/fwd/" + capability) === name
@@ -192,7 +192,7 @@ so that future `GetCapability` calls will succeed.
in the future. Capabilities are multi-owner, so if multiple modules have a single `Capability` reference,
they will all own it.
```golang
```go
func (sck ScopedCapabilityKeeper) ClaimCapability(ctx Context, capability Capability, name string) error {
persistentStore := ctx.KVStore(sck.persistentKey)
@@ -212,7 +212,7 @@ func (sck ScopedCapabilityKeeper) ClaimCapability(ctx Context, capability Capabi
`GetCapability` allows a module to fetch a capability which it has previously claimed by name.
The module is not allowed to retrieve capabilities which it does not own.
```golang
```go
func (sck ScopedCapabilityKeeper) GetCapability(ctx Context, name string) (Capability, error) {
// fetch the index of capability using reverse mapping in memstore
index := memStore.Get(sck.moduleName + "/rev/" + name)
@@ -228,7 +228,7 @@ func (sck ScopedCapabilityKeeper) GetCapability(ctx Context, name string) (Capab
`ReleaseCapability` allows a module to release a capability which it had previously claimed. If no
more owners exist, the capability will be deleted globally.
```golang
```go
func (sck ScopedCapabilityKeeper) ReleaseCapability(ctx Context, capability Capability) err {
persistentStore := ctx.KVStore(sck.persistentKey)
@@ -263,7 +263,7 @@ func (sck ScopedCapabilityKeeper) ReleaseCapability(ctx Context, capability Capa
Any modules which use dynamic capabilities must be provided a `ScopedCapabilityKeeper` in `app.go`:
```golang
```go
ck := NewCapabilityKeeper(persistentKey, memoryKey)
mod1Keeper := NewMod1Keeper(ck.ScopeToModule("mod1"), ....)
mod2Keeper := NewMod2Keeper(ck.ScopeToModule("mod2"), ....)
@@ -281,14 +281,14 @@ Consider the case where `mod1` wants to create a capability, associate it with a
Module 1 would have the following code:
```golang
```go
capability := scopedCapabilityKeeper.NewCapability(ctx, "resourceABC")
mod2Keeper.SomeFunction(ctx, capability, args...)
```
`SomeFunction`, running in module 2, could then claim the capability:
```golang
```go
func (k Mod2Keeper) SomeFunction(ctx Context, capability Capability) {
k.sck.ClaimCapability(ctx, capability, "resourceABC")
// other logic...
@@ -297,7 +297,7 @@ func (k Mod2Keeper) SomeFunction(ctx Context, capability Capability) {
Later on, module 2 can retrieve that capability by name and pass it to module 1, which will authenticate it against the resource:
```golang
```go
func (k Mod2Keeper) SomeOtherFunction(ctx Context, name string) {
capability := k.sck.GetCapability(ctx, name)
mod1.UseResource(ctx, capability, "resourceABC")
@@ -306,7 +306,7 @@ func (k Mod2Keeper) SomeOtherFunction(ctx Context, name string) {
Module 1 will then check that this capability key is authenticated to use the resource before allowing module 2 to use it:
```golang
```go
func (k Mod1Keeper) UseResource(ctx Context, capability Capability, resource string) {
if !k.sck.AuthenticateCapability(name, capability) {
return errors.New("unauthenticated")
@@ -50,7 +50,7 @@ core functionality or persistence.
Balances will be stored first by the address, then by the denomination (the reverse is also possible,
but retrieval of all balances for a single account is presumed to be more frequent):
```golang
```go
var BalancesPrefix = []byte("balances")
func (k Keeper) SetBalance(ctx Context, addr AccAddress, balance Coin) error {
@@ -15,7 +15,7 @@ The application MUST store the most recent `n` headers in a persistent store. At
The application MUST store this information by storing new headers immediately when handling `abci.RequestBeginBlock`:
```golang
```go
func BeginBlock(ctx sdk.Context, keeper HistoricalHeaderKeeper, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
info := HistoricalInfo{
Header: ctx.BlockHeader(),

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

@@ -4,7 +4,7 @@ parent:
order: 5
-->
# Building a Chain
# Building Apps
This repository contains documentation on concepts developers need to know in order to build a Cosmos SDK applications.
@@ -7,8 +7,6 @@ order: 0
This section is intended to provide an overview of the `app.go` file and is still a work in progress.
For now we invite you to read the [tutorials](https://tutorials.cosmos.network) for a deep dive on how to build a chain.
<!--
## `app.go`
Since `v0.47.0` the Cosmos SDK have made easier wiring an `app.go` thanks to dependency injection:
@@ -19,6 +17,4 @@ Since `v0.47.0` the Cosmos SDK have made easier wiring an `app.go` thanks to dep
## `app_legacy.go`
+++ https://github.com/cosmos/cosmos-sdk/blob/main/simapp/app_legacy.go
-->
+++ https://github.com/cosmos/cosmos-sdk/blob/main/simapp/app_legacy.go
-17
View File
@@ -1,17 +0,0 @@
<!--
order: 1
-->
# Dependency Injection
This section is intended to provide an overview of the `depinject` package and is still a work in progress.
The SDK uses a dependency injection framework called `depinject` for helping building a chain faster.
## `AppConfig`
* https://pkg.go.dev/cosmossdk.io/core/appconfig
## `depinject`
* https://pkg.go.dev/cosmossdk.io/depinject
+2 -2
View File
@@ -27,7 +27,7 @@ Migration registration takes place in the `Configurator` using the `RegisterMigr
You can register one or more migrations. If you register more than one migration script, list the migrations in increasing order and ensure there are enough migrations that lead to the desired consensus version. For example, to migrate to version 3 of a module, register separate migrations for version 1 and version 2 as shown in the following example:
```golang
```go
func (am AppModule) RegisterServices(cfg module.Configurator) {
// --snip--
cfg.RegisterMigration(types.ModuleName, 1, func(ctx sdk.Context) error {
@@ -47,7 +47,7 @@ Since these migrations are functions that need access to a Keeper's store, use a
To define the functionality that takes place during an upgrade, write a migration script and place the functions in a `migrations/` directory. For example, to write migration scripts for the bank module, place the functions in `x/bank/migrations/`. Use the recommended naming convention for these functions. For example, `v2bank` is the script that migrates the package `x/bank/migrations/v2`:
```golang
```go
// Migrating bank module from version 1 to 2
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2bank.MigrateStore(ctx, m.keeper.storeKey) // v2bank is package `x/bank/migrations/v2`.
+16 -12589
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -15,5 +15,8 @@
"license": "ISC",
"dependencies": {
"vuepress-theme-cosmos": "^1.0.183"
},
"devDependencies": {
"@vuepress/plugin-html-redirect": "^0.1.4"
}
}
+1
View File
@@ -2,3 +2,4 @@
rm -rf modules
rm -rf run-node/cosmovisor.md
rm -rf building-apps/depinject.md
+4 -13
View File
@@ -7,15 +7,6 @@ for D in ../x/*; do
MODDOC=modules/$(echo $D | awk -F/ '{print $NF}')
rm -rf $MODDOC
mkdir -p $MODDOC && cp -r $D/README.md "$_"
if [ -f "$MODDOC/README.md" ]; then
cd $MODDOC
# This ensures that we have multiples pages for the modules documantation
# This is easier to read for the user
# In order to split pages, we need to add a <!-- order: X --> in the module README.md, for each pages that we want.
csplit -k -q README.md '/<!-- order:/' '{*}' --prefix='section_' --suffix-format='%02d.md'
mv section_00.md README.md
cd ../..
fi
fi
done
@@ -23,11 +14,11 @@ done
## TODO to be removed in https://github.com/cosmos/cosmos-sdk/issues/9958
mkdir -p modules/vesting
cp -r ../x/auth/vesting/README.md modules/vesting
cd modules/vesting
csplit -k -q README.md '/<!-- order:/' '{*}' --prefix='section_' --suffix-format='%02d.md'
mv section_00.md README.md
cd ../..
cat ../x/README.md | sed 's/\.\/x/\/modules/g' | sed 's/\.\.\/docs\/building-modules\/README\.md/\/building-modules\/intro\.html/g' > ./modules/README.md
## Add Cosmovisor documentation
cp ../cosmovisor/README.md ./run-node/cosmovisor.md
## Add depinject documentation
cp ../depinject/README.md ./building-apps/depinject.md
+16 -19
View File
@@ -19,26 +19,23 @@ element as a part of a larger description.
## Common Layout
The following generalized file structure should be used to breakdown
specifications for modules. With the exception of README.md, `XX` at the
beginning of the file name should be replaced with a number to indicate
document flow (ex. read `01_state.md` before `02_state_transitions.md`). The
following list is nonbinding and all files are optional.
The following generalized `README` structure should be used to breakdown
specifications for modules. The following list is nonbinding and all sections are optional.
* `README.md` - overview of the module
* `XX_concepts.md` - describe specialized concepts and definitions used throughout the spec
* `XX_state.md` - specify and describe structures expected to marshalled into the store, and their keys
* `XX_state_transitions.md` - standard state transition operations triggered by hooks, messages, etc.
* `XX_messages.md` - specify message structure(s) and expected state machine behaviour(s)
* `XX_begin_block.md` - specify any begin-block operations
* `XX_end_block.md` - specify any end-block operations
* `XX_hooks.md` - describe available hooks to be called by/from this module
* `XX_events.md` - list and describe event tags used
* `XX_client.md` - list and describe CLI commands and gRPC and REST endpoints
* `XX_params.md` - list all module parameters, their types (in JSON) and examples
* `XX_future_improvements.md` - describe future improvements of this module
* `XX_tests.md` - acceptance tests
* `XX_appendix.md` - supplementary details referenced elsewhere within the spec
* `# {Module Name}` - overview of the module
* `## Concepts` - describe specialized concepts and definitions used throughout the spec
* `## State` - specify and describe structures expected to marshalled into the store, and their keys
* `## State Transitions` - standard state transition operations triggered by hooks, messages, etc.
* `## Messages` - specify message structure(s) and expected state machine behaviour(s)
* `## Begin Block` - specify any begin-block operations
* `## End Block` - specify any end-block operations
* `## Hooks` - describe available hooks to be called by/from this module
* `## Events` - list and describe event tags used
* `## Client` - list and describe CLI commands and gRPC and REST endpoints
* `## Params` - list all module parameters, their types (in JSON) and examples
* `## Future Improvements` - describe future improvements of this module
* `## Tests` - acceptance tests
* `## Appendix` - supplementary details referenced elsewhere within the spec
### Notation for key-value mapping
+2 -2
View File
@@ -168,7 +168,7 @@ removed from each `KVStore`. Note, it is up to the underlying `KVStore`
implementation to determine how pruning is actually performed. The `PruningOptions`
are defined as follows:
```golang
```go
type PruningOptions struct {
// KeepRecent defines how many recent heights to keep on disk.
KeepRecent uint64
@@ -198,7 +198,7 @@ to it's respective `KVStore` instance.
Example:
```golang
```go
func NewApp(...) Application {
// ...
+4 -5
View File
@@ -1,5 +1,4 @@
release/v0.44.x v0.44
release/v0.45.x v0.45
main master
main main
release/v0.46.x v0.46
release/v0.45.x v0.45
release/v0.46.x v0.46
main v0.47
main main