diff --git a/custom-version-plugin.js b/custom-version-plugin.js index f1ecdba1f..8c4cf997d 100644 --- a/custom-version-plugin.js +++ b/custom-version-plugin.js @@ -3,15 +3,15 @@ const path = require('path'); // Helper function to get all files recursively from a directory function getAllFiles(dirPath, arrayOfFiles) { - const files = fs.readdirSync(dirPath); - arrayOfFiles = arrayOfFiles || []; + const files = fs.readdirSync(dirPath); files.forEach(function (file) { - if (fs.statSync(path.join(dirPath, file)).isDirectory()) { - arrayOfFiles = getAllFiles(path.join(dirPath, file), arrayOfFiles); + const filePath = path.join(dirPath, file); + if (fs.statSync(filePath).isDirectory()) { + arrayOfFiles = getAllFiles(filePath, arrayOfFiles); } else { - arrayOfFiles.push(path.join(dirPath, file)); + arrayOfFiles.push(filePath); } }); @@ -29,15 +29,15 @@ module.exports = function (_context, _options) { async loadContent() { // Read the versions.json file to get the list of versions - const versionsJsonPath = path.join(_context.siteDir, 'cosmos-sdk-docs', 'versions.json'); + const versionsJsonPath = path.join(_context.siteDir, 'versions.json'); const versions = JSON.parse(fs.readFileSync(versionsJsonPath, 'utf8')); // Read the version config file - const versionConfigPath = path.join(_context.siteDir, 'cosmos-sdk-docs', 'version_config.json'); + const versionConfigPath = path.join(_context.siteDir, 'version_config.json'); const versionConfig = JSON.parse(fs.readFileSync(versionConfigPath, 'utf8')); // Read all the files in the /docs folder - const docsPath = path.join(_context.siteDir, 'cosmos-sdk-docs', 'docs'); + const docsPath = path.join(_context.siteDir, 'docs'); const files = getAllFiles(docsPath); // Iterate through the list of versions @@ -54,6 +54,8 @@ module.exports = function (_context, _options) { // Check if the file exists in the version directory if (!fs.existsSync(customFilePath) && !shouldExcludeFile(version, relativePath, versionConfig)) { // If the file doesn't exist and it's not excluded, copy it from the /docs folder + const customFileDir = path.dirname(customFilePath); + fs.mkdirSync(customFileDir, { recursive: true }); fs.copyFileSync(file, customFilePath); console.log(`Copied file from /docs to version-${version}:`, relativePath); } diff --git a/docs/develop/_category_.json b/docs/develop/_category_.json index 8b015fa11..f40637f4d 100644 --- a/docs/develop/_category_.json +++ b/docs/develop/_category_.json @@ -1,5 +1,5 @@ { - "label": "Develop", - "position": 0, - "link": null + "label": "Develop", + "position": 0, + "link": null } \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index 58eee8fb0..0454ec6f8 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -3,9 +3,8 @@ const lightCodeTheme = require("prism-react-renderer/themes/github"); const darkCodeTheme = require("prism-react-renderer/themes/dracula"); -const customVersionPlugin = require('./custom-version-plugin'); - +// const lastVersion = "v0.47"; const lastVersion = "current"; /** @type {import('@docusaurus/types').Config} */ @@ -107,6 +106,18 @@ const config = { position: "right", dropdownActiveClassDisabled: true, // versions not yet migrated to docusaurus + dropdownItemsAfter: [ + { + href: "https://docs.cosmos.network/v0.46/", + label: "v0.46", + target: "_self", + }, + { + href: "https://docs.cosmos.network/v0.45/", + label: "v0.45", + target: "_self", + }, + ], }, ], }, @@ -207,7 +218,6 @@ const config = { }, }; }, - customVersionPlugin, [ "@docusaurus/plugin-google-analytics", { diff --git a/version_config.json b/version_config.json index efcb80dcd..5c9fa3b7c 100644 --- a/version_config.json +++ b/version_config.json @@ -1,29 +1,29 @@ { "0.45": { - "excludedPaths": ["integrate/modules/slashing", "integrate/modules/nft", "integrate/modules/group", "integrate/modules/genutil", - "integrate/modules/consensus", "integrate/modules/circuit", "integrate/building-modules/autocli", "integrate/building-modules/depinject", - "integrate/building-modules/testing", "integrate/building-apps", "integrate/architecture/rfc", "integrate/specs", "interate/architeture/adr-041-in-place-store-migrations", "interate/architeture/adr-042-group-module", + "excludedPaths": ["integrate/modules/slashing", "integrate/modules/nft", "integrate/building-modules/15-depinject.md", "integrate/modules/genutil", + "integrate/modules/consensus", "integrate/modules/circuit", "integrate/building-apps","integrate/building-modules/autocli", "integrate/building-modules/depinject", + "integrate/building-modules/testing", "integrate/building-apps", "integrate/architecture/rfc", "integrate/specs", "integrate/architecture/adr-041-in-place-store-migrations", "integrate/architecture/adr-042-group-module", "integrate/architecture/adr-043-nft-module", "integrate/architecture/adr-044-protobuf-updates-guidelines", "integrate/architecture/adr-045-check-delivertx-middlewares", "integrate/architecture/adr-046-module-params", "integrate/architecture/adr-046-module-params", "integrate/architecture/adr-047-extend-upgrade-plan", "integrate/architecture/adr-048-consensus-fees", "integrate/architecture/adr-049-state-sync-hooks", "integrate/architecture/adr-050-sign-mode-textual", - "integrate/architecture/adr-050-sign-mode-textual-annex1", "integrate/architecture/adr-050-sign-mode-textual-annex2", "integrate/architecture/adr-053-go-module-refactoring","integrate/arcitecture/adr-054-semver-compatible-modules", + "integrate/architecture/adr-050-sign-mode-textual-annex1", "integrate/architecture/adr-050-sign-mode-textual-annex2", "integrate/architecture/adr-053-go-module-refactoring","integrate/architecture/adr-054-semver-compatible-modules", "integrate/architecture/adr-055-orm", "integrate/architecture/adr-057-app-wiring", "integrate/architecture/adr-058-auto-generated-cli", "integrate/architecture/adr-059-test-scopes", "integrate/architecture/adr-060-abci-1.0", "integrate/architecture/adr-061-liquid-staking", "integrate/architecture/adr-062-collections-state-layer", "integrate/architecture/adr-062-collections-state-layer", "integrate/architecture/adr-063-core-module-api", "integrate/architecture/adr-064-abci-2.0", - "integrate/architecture/adr-065-store-v2"] + "integrate/architecture/adr-065-store-v2", "integrate/architecture/README"] }, "0.46": { - "excludedPaths": ["integrate/modules/genutil", "integrate/modules/consensus", "integrate/modules/circuit", "integrate/architecture/rfc", - "integrate/specs", "integrate/tooling", "integrate/building-modules/depinject", "integrate/architecture/adr-007-specialization-groups", + "excludedPaths": ["integrate/modules/genutil", "integrate/building-modules/15-depinject.md","integrate/modules/consensus", "integrate/modules/circuit", "integrate/architecture/rfc", + "integrate/specs", "integrate/building-apps", "integrate/building-modules/depinject", "integrate/architecture/adr-007-specialization-groups", "integrate/architecture/adr-008-dCERT-group", "integrate/architecture/adr-014-proportional-slashing", - "integrate/architecture/adr-034-account-rekeying", "interate/architeture/adr-041-in-place-store-migrations", "interate/architeture/adr-042-group-module", + "integrate/architecture/adr-034-account-keying", "integrate/architecture/adr-041-in-place-store-migrations", "integrate/architecture/adr-042-group-module", "integrate/architecture/adr-043-nft-module", "integrate/architecture/adr-044-protobuf-updates-guidelines", "integrate/architecture/adr-045-check-delivertx-middlewares", "integrate/architecture/adr-048-consensus-fees", "integrate/architecture/adr-049-state-sync-hooks", "integrate/architecture/adr-050-sign-mode-textual", - "integrate/architecture/adr-050-sign-mode-textual-annex1", "integrate/architecture/adr-050-sign-mode-textual-annex2", "integrate/arcitecture/adr-054-semver-compatible-modules", + "integrate/architecture/adr-050-sign-mode-textual-annex1", "integrate/architecture/adr-050-sign-mode-textual-annex2", "integrate/architecture/adr-054-semver-compatible-modules", "integrate/architecture/adr-055-orm", "integrate/architecture/adr-057-app-wiring", "integrate/architecture/adr-058-auto-generated-cli", "integrate/architecture/adr-059-test-scopes", "integrate/architecture/adr-060-abci-1.0", "integrate/architecture/adr-061-liquid-staking", "integrate/architecture/adr-062-collections-state-layer", "integrate/architecture/adr-062-collections-state-layer", "integrate/architecture/adr-063-core-module-api", "integrate/architecture/adr-064-abci-2.0", - "integrate/architecture/adr-065-store-v2"] + "integrate/architecture/adr-065-store-v2", "integrate/architecture/README"] }, "0.47": { "excludedPaths": [] diff --git a/versioned_docs/version-0.45/integrate/ibc/README.md b/versioned_docs/version-0.45/integrate/ibc/README.md index 3d002f2df..8caf30f1b 100644 --- a/versioned_docs/version-0.45/integrate/ibc/README.md +++ b/versioned_docs/version-0.45/integrate/ibc/README.md @@ -17,4 +17,4 @@ This repository contains reference documentation for the IBC protocol integratio **NOTE**: The IBC module has been moved to its [own repository](https://github.com/cosmos/ibc-go). After reading about IBC, head on to the [Building Modules -documentation](../building-modules/README.md) to learn more about the process of building modules. +documentation](../building-modules/) to learn more about the process of building modules. diff --git a/versioned_docs/version-0.45/integrate/ibc/integration.md b/versioned_docs/version-0.45/integrate/ibc/integration.md index 209f51e46..6364c8275 100644 --- a/versioned_docs/version-0.45/integrate/ibc/integration.md +++ b/versioned_docs/version-0.45/integrate/ibc/integration.md @@ -165,7 +165,7 @@ func NewApp(...args) *App { ### Module Managers -In order to use IBC, we need to add the new modules to the module `Manager` and to the `SimulationManager` in case your application supports [simulations](./../building-modules/simulator.md). +In order to use IBC, we need to add the new modules to the module `Manager` and to the `SimulationManager` in case your application supports [simulations](../building-modules/simulator). ```go // app.go diff --git a/versioned_docs/version-0.45/integrate/ibc/overview.md b/versioned_docs/version-0.45/integrate/ibc/overview.md index 437114ace..82ccddf15 100644 --- a/versioned_docs/version-0.45/integrate/ibc/overview.md +++ b/versioned_docs/version-0.45/integrate/ibc/overview.md @@ -50,7 +50,7 @@ In IBC, blockchains do not directly pass messages to each other over the network - The proof format that all implementations must produce and verify is defined in [ICS-23 implementation](https://github.com/confio/ics23). -### [Capabilities](./ocap.md) +### Capabilities IBC is intended to work in execution environments where modules do not necessarily trust each other. IBC must authenticate module actions on ports and channels so that only modules with the appropriate permissions can use the channels. This security is accomplished using [dynamic capabilities](../architecture/adr-003-dynamic-capability-store.md). Upon binding to a port or creating a channel for a module, IBC returns a dynamic capability that the module must claim to use that port or channel. This binding strategy prevents other modules from using that port or channel since those modules do not own the appropriate capability. diff --git a/versioned_docs/version-0.45/integrate/modules/README.md b/versioned_docs/version-0.45/integrate/modules/README.md new file mode 100644 index 000000000..eaa7b96fc --- /dev/null +++ b/versioned_docs/version-0.45/integrate/modules/README.md @@ -0,0 +1,37 @@ +--- +sidebar_position: 0 +slug : /modules +--- + +# Module Summary + +Here are some production-grade modules that can be used in Cosmos SDK applications, along with their respective documentation: + +* [Auth](auth/README.md) - Authentication of accounts and transactions for Cosmos SDK applications. +* [Authz](authz/README.md) - Authorization for accounts to perform actions on behalf of other accounts. +* [Bank](bank/README.md) - Token transfer functionalities. +* [Crisis](crisis/README.md) - Halting the blockchain under certain circumstances (e.g. if an invariant is broken). +* [Distribution](distribution/README.md) - Fee distribution, and staking token provision distribution. +* [Evidence](evidence/README.md) - Evidence handling for double signing, misbehaviour, etc. +* [Feegrant](feegrant/README.md) - Grant fee allowances for executing transactions. +* [Governance](gov/README.md) - On-chain proposals and voting. +* [Mint](mint/README.md) - Creation of new units of staking token. +* [Params](params/README.md) - Globally available parameter store. +* [Staking](staking/README.md) - Proof-of-Stake layer for public blockchains. +* [Upgrade](upgrade/README.md) - Software upgrades handling and coordination. + +To learn more about the process of building modules, visit the [building modules reference documentation](https://docs.cosmos.network/main/building-modules/intro). + +## IBC + +The IBC module for the SDK is maintained by the IBC Go team in its [own repository](https://github.com/cosmos/ibc-go). + +Additionally, the [capability module](https://github.com/cosmos/ibc-go/tree/fdd664698d79864f1e00e147f9879e58497b5ef1/modules/capability) is from v0.48+ maintained by the IBC Go team in its [own repository](https://github.com/cosmos/ibc-go/tree/fdd664698d79864f1e00e147f9879e58497b5ef1/modules/capability). + +## CosmWasm + +The CosmWasm module enables smart contracts, learn more by going to their [documentation site](https://book.cosmwasm.com/), or visit [the repository](https://github.com/CosmWasm/cosmwasm). + +## EVM + +Read more about writing smart contracts with solidity at the official [`evm` documentation page](https://docs.evmos.org/modules/evm/). diff --git a/versioned_docs/version-0.45/integrate/rfc/README.md b/versioned_docs/version-0.45/integrate/rfc/README.md new file mode 100644 index 000000000..be74d080d --- /dev/null +++ b/versioned_docs/version-0.45/integrate/rfc/README.md @@ -0,0 +1,34 @@ +--- +sidebar_position: 1 +--- + +# Requests for Comments + +A Request for Comments (RFC) is a record of discussion on an open-ended topic +related to the design and implementation of the Cosmos SDK, for which no +immediate decision is required. + +The purpose of an RFC is to serve as a historical record of a high-level +discussion that might otherwise only be recorded in an ad-hoc way (for example, +via gists or Google docs) that are difficult to discover for someone after the +fact. An RFC _may_ give rise to more specific architectural _decisions_ for +the Cosmos SDK, but those decisions must be recorded separately in +[Architecture Decision Records (ADR)](../architecture). + +As a rule of thumb, if you can articulate a specific question that needs to be +answered, write an ADR. If you need to explore the topic and get input from +others to know what questions need to be answered, an RFC may be appropriate. + +## RFC Content + +An RFC should provide: + +* A **changelog**, documenting when and how the RFC has changed. +* An **abstract**, briefly summarizing the topic so the reader can quickly tell + whether it is relevant to their interest. +* Any **background** a reader will need to understand and participate in the + substance of the discussion (links to other documents are fine here). +* The **discussion**, the primary content of the document. + +The [rfc-template.md](rfc-template.md) file includes placeholders for these +sections. diff --git a/versioned_docs/version-0.46/integrate/building-modules/11-structure.md b/versioned_docs/version-0.46/integrate/building-modules/11-structure.md new file mode 100644 index 000000000..3520dfa48 --- /dev/null +++ b/versioned_docs/version-0.46/integrate/building-modules/11-structure.md @@ -0,0 +1,93 @@ +--- +sidebar_position: 1 +--- + +# Recommended Folder Structure + +:::note Synopsis +This document outlines the recommended structure of Cosmos SDK modules. These ideas are meant to be applied as suggestions. Application developers are encouraged to improve upon and contribute to module structure and development design. +::: + +## Structure + +A typical Cosmos SDK module can be structured as follows: + +```shell +proto +└── {project_name} +    └── {module_name} +    └── {proto_version} +       ├── {module_name}.proto +       ├── event.proto +       ├── genesis.proto +       ├── query.proto +       └── tx.proto +``` + +* `{module_name}.proto`: The module's common message type definitions. +* `event.proto`: The module's message type definitions related to events. +* `genesis.proto`: The module's message type definitions related to genesis state. +* `query.proto`: The module's Query service and related message type definitions. +* `tx.proto`: The module's Msg service and related message type definitions. + +```shell +x/{module_name} +├── client +│   ├── cli +│   │ ├── query.go +│   │   └── tx.go +│   └── testutil +│   ├── cli_test.go +│   └── suite.go +├── exported +│   └── exported.go +├── keeper +│   ├── genesis.go +│   ├── grpc_query.go +│   ├── hooks.go +│   ├── invariants.go +│   ├── keeper.go +│   ├── keys.go +│   ├── msg_server.go +│   └── querier.go +├── module +│   └── module.go +│   └── abci.go +├── simulation +│   ├── decoder.go +│   ├── genesis.go +│   ├── operations.go +│   └── params.go +├── {module_name}.pb.go +├── codec.go +├── errors.go +├── events.go +├── events.pb.go +├── expected_keepers.go +├── genesis.go +├── genesis.pb.go +├── keys.go +├── msgs.go +├── params.go +├── query.pb.go +├── tx.pb.go +└── 05-depinject.md +``` + +* `client/`: The module's CLI client functionality implementation and the module's CLI testing suite. +* `exported/`: The module's exported types - typically interface types. If a module relies on keepers from another module, it is expected to receive the keepers as interface contracts through the `expected_keepers.go` file (see below) in order to avoid a direct dependency on the module implementing the keepers. However, these interface contracts can define methods that operate on and/or return types that are specific to the module that is implementing the keepers and this is where `exported/` comes into play. The interface types that are defined in `exported/` use canonical types, allowing for the module to receive the keepers as interface contracts through the `expected_keepers.go` file. This pattern allows for code to remain DRY and also alleviates import cycle chaos. +* `keeper/`: The module's `Keeper` and `MsgServer` implementation. +* `module/`: The module's `AppModule` and `AppModuleBasic` implementation. + * `abci.go`: The module's `BeginBlocker` and `EndBlocker` implementations (this file is only required if `BeginBlocker` and/or `EndBlocker` need to be defined). +* `simulation/`: The module's [simulation](14-simulator.md) package defines functions used by the blockchain simulator application (`simapp`). +* `REAMDE.md`: The module's specification documents outlining important concepts, state storage structure, and message and event type definitions. Learn more how to write module specs in the [spec guidelines](../spec/SPEC_MODULE.md). +* The root directory includes type definitions for messages, events, and genesis state, including the type definitions generated by Protocol Buffers. + * `codec.go`: The module's registry methods for interface types. + * `errors.go`: The module's sentinel errors. + * `events.go`: The module's event types and constructors. + * `expected_keepers.go`: The module's [expected keeper](06-keeper.md#type-definition) interfaces. + * `genesis.go`: The module's genesis state methods and helper functions. + * `keys.go`: The module's store keys and associated helper functions. + * `msgs.go`: The module's message type definitions and associated methods. + * `params.go`: The module's parameter type definitions and associated methods. + * `*.pb.go`: The module's type definitions generated by Protocol Buffers (as defined in the respective `*.proto` files above). diff --git a/versioned_docs/version-0.46/integrate/modules/README.md b/versioned_docs/version-0.46/integrate/modules/README.md new file mode 100644 index 000000000..2270e78eb --- /dev/null +++ b/versioned_docs/version-0.46/integrate/modules/README.md @@ -0,0 +1,39 @@ +--- +sidebar_position: 0 +slug : /modules +--- + +# Module Summary + +Here are some production-grade modules that can be used in Cosmos SDK applications, along with their respective documentation: + +* [Auth](auth/README.md) - Authentication of accounts and transactions for Cosmos SDK applications. +* [Authz](authz/README.md) - Authorization for accounts to perform actions on behalf of other accounts. +* [Bank](bank/README.md) - Token transfer functionalities. +* [Crisis](crisis/README.md) - Halting the blockchain under certain circumstances (e.g. if an invariant is broken). +* [Distribution](distribution/README.md) - Fee distribution, and staking token provision distribution. +* [Evidence](evidence/README.md) - Evidence handling for double signing, misbehaviour, etc. +* [Feegrant](feegrant/README.md) - Grant fee allowances for executing transactions. +* [Governance](gov/README.md) - On-chain proposals and voting. +* [Mint](mint/README.md) - Creation of new units of staking token. +* [Params](params/README.md) - Globally available parameter store. +* [Slashing](slashing/README.md) - Validator punishment mechanisms. +* [Staking](staking/README.md) - Proof-of-Stake layer for public blockchains. +* [Upgrade](upgrade/README.md) - Software upgrades handling and coordination. +* [NFT](nft/README.md) - NFT module implemented based on [ADR43](https://docs.cosmos.network/main/architecture/adr-043-nft-module.html). + +To learn more about the process of building modules, visit the [building modules reference documentation](https://docs.cosmos.network/main/building-modules/intro). + +## IBC + +The IBC module for the SDK is maintained by the IBC Go team in its [own repository](https://github.com/cosmos/ibc-go). + +Additionally, the [capability module](https://github.com/cosmos/ibc-go/tree/fdd664698d79864f1e00e147f9879e58497b5ef1/modules/capability) is from v0.48+ maintained by the IBC Go team in its [own repository](https://github.com/cosmos/ibc-go/tree/fdd664698d79864f1e00e147f9879e58497b5ef1/modules/capability). + +## CosmWasm + +The CosmWasm module enables smart contracts, learn more by going to their [documentation site](https://book.cosmwasm.com/), or visit [the repository](https://github.com/CosmWasm/cosmwasm). + +## EVM + +Read more about writing smart contracts with solidity at the official [`evm` documentation page](https://docs.evmos.org/modules/evm/). diff --git a/versioned_docs/version-0.46/integrate/rfc/README.md b/versioned_docs/version-0.46/integrate/rfc/README.md new file mode 100644 index 000000000..be74d080d --- /dev/null +++ b/versioned_docs/version-0.46/integrate/rfc/README.md @@ -0,0 +1,34 @@ +--- +sidebar_position: 1 +--- + +# Requests for Comments + +A Request for Comments (RFC) is a record of discussion on an open-ended topic +related to the design and implementation of the Cosmos SDK, for which no +immediate decision is required. + +The purpose of an RFC is to serve as a historical record of a high-level +discussion that might otherwise only be recorded in an ad-hoc way (for example, +via gists or Google docs) that are difficult to discover for someone after the +fact. An RFC _may_ give rise to more specific architectural _decisions_ for +the Cosmos SDK, but those decisions must be recorded separately in +[Architecture Decision Records (ADR)](../architecture). + +As a rule of thumb, if you can articulate a specific question that needs to be +answered, write an ADR. If you need to explore the topic and get input from +others to know what questions need to be answered, an RFC may be appropriate. + +## RFC Content + +An RFC should provide: + +* A **changelog**, documenting when and how the RFC has changed. +* An **abstract**, briefly summarizing the topic so the reader can quickly tell + whether it is relevant to their interest. +* Any **background** a reader will need to understand and participate in the + substance of the discussion (links to other documents are fine here). +* The **discussion**, the primary content of the document. + +The [rfc-template.md](rfc-template.md) file includes placeholders for these +sections.