Skip to content

Commit

Permalink
docs: minor documentation improvements (#13594)
Browse files Browse the repository at this point in the history
* updates

* rename `sh` to `shell` for syntax coloring

* keep navbar the same on mobile
  • Loading branch information
julienrbrt authored Oct 19, 2022
1 parent a3b8b7f commit 0dbae70
Show file tree
Hide file tree
Showing 21 changed files with 180 additions and 168 deletions.
4 changes: 2 additions & 2 deletions contrib/githooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Installation:

```sh
```shell
git config core.hooksPath contrib/githooks
```

Expand All @@ -13,7 +13,7 @@ to correctly format the `.go` files included in the commit, provided
that all the aforementioned commands are installed and available
in the user's search `$PATH` environment variable:

```sh
```shell
go get golang.org/x/tools/cmd/goimports
go get github.com/golangci/misspell/cmd/misspell@master
```
Expand Down
41 changes: 20 additions & 21 deletions cosmovisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ sidebar_position: 1

`cosmovisor` is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, `cosmovisor` can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary.

<!-- TOC -->
* [Design](#design)
* [Contributing](#contributing)
* [Setup](#setup)
Expand Down Expand Up @@ -49,21 +48,21 @@ You can download Cosmovisor from the [GitHub releases](https://github.com/cosmos

To install the latest version of `cosmovisor`, run the following command:

```sh
```shell
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest
```

To install a previous version, you can specify the version. IMPORTANT: Chains that use Cosmos-SDK v0.44.3 or earlier (eg v0.44.2) and want to use auto-download feature MUST use `cosmovisor v0.1.0`

```sh
```shell
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]
```

Run `cosmovisor version` to check the cosmovisor version.

You can also install from source by pulling the cosmos-sdk repository and switching to the correct version and building as follows:

```sh
```shell
git clone [email protected]:cosmos/cosmos-sdk
cd cosmos-sdk
git checkout cosmovisor/vx.x.x
Expand All @@ -72,7 +71,7 @@ make cosmovisor

This will build cosmovisor in `/cosmovisor` directory. Afterwards you may want to put it into your machine's PATH like as follows:

```sh
```shell
cp cosmovisor/cosmovisor ~/go/bin/cosmovisor
```

Expand Down Expand Up @@ -210,7 +209,7 @@ If `DAEMON_ALLOW_DOWNLOAD_BINARIES` is set to `true`, and no local binary can be

When submitting this as a proposal ensure there are no spaces. An example command using `gaiad` could look like:

```sh
```shell
> gaiad tx gov submit-proposal software-upgrade Vega \
--title Vega \
--deposit 100uatom \
Expand All @@ -237,7 +236,7 @@ Note that for this mechanism to provide strong security guarantees, all URLs sho

To properly create a sha256 checksum on linux, you can use the `sha256sum` utility. For example:

```sh
```shell
sha256sum ./testdata/repo/zip_directory/autod.zip
```

Expand All @@ -253,20 +252,20 @@ The following instructions provide a demonstration of `cosmovisor` using the sim

Let's create a new chain using the `v0.44` version of simapp (the Cosmos SDK demo app):

```sh
```shell
git checkout v0.44.6
make build
```

Clean `~/.simapp` (never do this in a production environment):

```sh
```shell
./build/simd unsafe-reset-all
```

Set up app config:

```sh
```shell
./build/simd config chain-id test
./build/simd config keyring-backend test
./build/simd config broadcast-mode sync
Expand All @@ -276,19 +275,19 @@ Initialize the node and overwrite any previous genesis file (never do this in a

<!-- TODO: init does not read chain-id from config -->

```sh
```shell
./build/simd init test --chain-id test --overwrite
```

Set the minimum gas price to `0stake` in `~/.simapp/config/app.toml`:

```sh
```shell
minimum-gas-prices = "0stake"
```

For the sake of this demonstration, amend `voting_period` in `genesis.json` to a reduced time of 20 seconds (`20s`):

```sh
```shell
cat <<< $(jq '.app_state.gov.voting_params.voting_period = "20s"' $HOME/.simapp/config/genesis.json) > $HOME/.simapp/config/genesis.json
```

Expand All @@ -297,7 +296,7 @@ Create a validator, and setup genesis transaction:
<!-- TODO: add-genesis-account does not read keyring-backend from config -->
<!-- TODO: gentx does not read chain-id from config -->

```sh
```shell
./build/simd keys add validator
./build/simd add-genesis-account validator 1000000000stake --keyring-backend test
./build/simd gentx validator 1000000stake --chain-id test
Expand All @@ -308,27 +307,27 @@ Create a validator, and setup genesis transaction:

Set the required environment variables:

```sh
```shell
export DAEMON_NAME=simd
export DAEMON_HOME=$HOME/.simapp
```

Set the optional environment variable to trigger an automatic app restart:

```sh
```shell
export DAEMON_RESTART_AFTER_UPGRADE=true
```

Create the folder for the genesis binary and copy the `simd` binary:

```sh
```shell
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin
cp ./build/simd $DAEMON_HOME/cosmovisor/genesis/bin
```

Now you can run cosmovisor with simapp v0.44:

```sh
```shell
cosmovisor run start
```

Expand All @@ -340,21 +339,21 @@ Next, we can add a migration - which is defined using `x/upgrade` [upgrade plan]

Build the new version `simd` binary:

```sh
```shell
make build
```

Create the folder for the upgrade binary and copy the `simd` binary:

```sh
```shell
mkdir -p $DAEMON_HOME/cosmovisor/upgrades/test1/bin
cp ./build/simd $DAEMON_HOME/cosmovisor/upgrades/test1/bin
```

Open a new terminal window and submit an upgrade proposal along with a deposit and a vote (these commands must be run within 20 seconds of each other):
Note, when using a `v0.46+` chain, replace `submit-proposal` by `submit-legacy-proposal`.

```sh
```shell
./build/simd tx gov submit-proposal software-upgrade test1 --title upgrade --description upgrade --upgrade-height 200 --from validator --yes
./build/simd tx gov deposit 1 10000000stake --from validator --yes
./build/simd tx gov vote 1 yes --from validator --yes
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ to send users to the GitHub.

Make sure you are in the `docs` directory and run the following commands:

```sh
```shell
rm -rf node_modules
```

This command will remove old version of the visual theme and required packages. This step is optional.

```sh
```shell
npm install
```

Install the theme and all dependencies.

```sh
```shell
npm start
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ must result in the serialization
When inspecting the serialized document, you see that every second field is
omitted:

```sh
```shell
$ echo 0a1b54686520776f726c64206e65656473206368616e676520f09f8cb318e8bebec8bc2e280138024a084e696365206f6e654a095468616e6b20796f75 | xxd -r -p | protoc --decode_raw
1: "The world needs change \360\237\214\263"
3: 1596806111080
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture/adr-037-gov-split-vote.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ tally() {

The CLI command for creating a multi-option vote would be as such:

```sh
```shell
simd tx gov vote 1 "yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05" --from mykey
```

To create a single-option vote a user can do either

```sh
```shell
simd tx gov vote 1 "yes=1" --from mykey
```

or

```sh
```shell
simd tx gov vote 1 yes --from mykey
```

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/core/07-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/simapp/simd/cmd/root.go#L210-L

Each flag is bound to it's respecteve named environment variable. Then name of the environment variable consist of two parts - capital case `basename` followed by flag name of the flag. `-` must be substituted with `_`. For example flag `--home` for application with basename `GAIA` is bound to `GAIA_HOME`. It allows reducing the amount of flags typed for routine operations. For example instead of:

```sh
```shell
gaia --home=./ --node=<node address> --chain-id="testchain-1" --keyring-backend=test tx ... --from=<key name>
```

this will be more convenient:

```sh
```shell
# define env variables in .env, .envrc etc
GAIA_HOME=<path to home>
GAIA_NODE=<node address>
Expand Down
8 changes: 7 additions & 1 deletion docs/docs/ecosystem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ Read more about writing smart contracts with CosmWasm at their [documentation si

Read more about writing smart contracts with solidity at the official [`evm` documentation page](https://docs.evmos.org/modules/evm/).

## Explore Further

:::tip
For non Cosmos SDK related tooling, you can have a look at the [Awesome Cosmos](https://github.com/cosmos/awesome-cosmos) GitHub repository.
:::

> Note: If you would like to add your tooling to this section, please make a pr to the cosmos-sdk, we will gladly accept it.
:::note
If you would like to add your tooling to this section, please make a [PR to the Cosmos SDK](https://github.com/cosmos/cosmos-sdk/edit/main/docs/docs/ecosystem/README.md).
:::
2 changes: 1 addition & 1 deletion docs/docs/ecosystem/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"label": "Ecosystem",
"position": 8,
"link": null
}
}
4 changes: 2 additions & 2 deletions docs/docs/run-node/00-keyring.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ times in a single command resulting in repeated password prompts. If using bash
to execute commands using the `file` option you may want to utilize the following format
for multiple prompts:

```sh
```shell
# assuming that KEYPASSWD is set in the environment
$ gaiacli config keyring-backend file # use file backend
$ (echo $KEYPASSWD; echo $KEYPASSWD) | gaiacli keys add me # multiple prompts
Expand Down Expand Up @@ -79,7 +79,7 @@ passphrase expiration.

The password store must be set up prior to first use:

```sh
```shell
pass init <GPG_KEY_ID>
```

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/run-node/04-rosetta.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ An implementation example can be found in `simapp` package.

To run Rosetta in your application CLI, use the following command:

```sh
```shell
appd rosetta --help
```

To test and run Rosetta API endpoints for applications that are running and exposed, use the following command:

```sh
```shell
appd rosetta
--blockchain "your application name (ex: gaia)"
--network "your chain identifier (ex: testnet-1)"
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/run-node/05-run-testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ The first validator node is now running in-process, which means the test network

Check the status of the first validator node:

```sh
```shell
simd status
```

Import the key from the provided mnemonic:

```sh
```shell
simd keys add test --recover --keyring-backend test
```

Check the balance of the account address:

```sh
```shell
simd q bank balances [address]
```

Expand Down
21 changes: 14 additions & 7 deletions docs/docs/tooling/00-protobuf.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ It is known that Cosmos SDK uses protocol buffers extensively, this docuemnt is
To generate the proto file, the Cosmos SDK uses a docker image, this image is provided to all to use as well. The latest version is `ghcr.io/cosmos/proto-builder:0.11.0`

Below is the example of the Cosmos SDK's commands for generating, linting, and formatting protobuf files that can be reused in any applications makefile.
```
https://github.com/cosmos/cosmos-sdk/blob/fae395818607e429e9f96f08f69b2ba377511fd9/Makefile#L408-L437

```go reference
https://github.com/cosmos/cosmos-sdk/blob/10ac33edb87dab12ffa496e76f1114ea9225a107/Makefile#L408-L437
```

The script used to generate the protobuf files can be found in the `scripts/` directory.

```sh reference
https://github.com/cosmos/cosmos-sdk/blob/10e8aadcad3a30dda1d6163c39c9f86b4a877e54/scripts/protocgen.sh#L1-L37
```shell reference
https://github.com/cosmos/cosmos-sdk/blob/10ac33edb87dab12ffa496e76f1114ea9225a107/scripts/protocgen.sh#L1-L37
```

## Buf
Expand Down Expand Up @@ -60,7 +61,9 @@ The above diagram all the files and directories within the Cosmos SDK `proto/` d
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.gogo.yaml#L1-l9
```

> Example of how to define `gen` files can be found [here](https://docs.buf.build/tour/generate-go-code)
:::tip
Example of how to define `gen` files can be found [here](https://docs.buf.build/tour/generate-go-code)
:::

#### `buf.gen.pulsar.yaml`

Expand All @@ -70,7 +73,9 @@ https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.gogo.yaml#L1-l9
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.pulsar.yaml#L1-L18
```

> Example of how to define `gen` files can be found [here](https://docs.buf.build/tour/generate-go-code)
:::tip
Example of how to define `gen` files can be found [here](https://docs.buf.build/tour/generate-go-code)
:::

#### `buf.gen.swagger.yaml`

Expand All @@ -80,7 +85,9 @@ https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.pulsar.yaml#L1-L18
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.swagger.yaml#L1-L6
```

> Example of how to define `gen` files can be found [here](https://docs.buf.build/tour/generate-go-code)
:::tip
Example of how to define `gen` files can be found [here](https://docs.buf.build/tour/generate-go-code)
:::

#### `buf.lock`

Expand Down
Loading

0 comments on commit 0dbae70

Please sign in to comment.