Skip to content

Commit e5d4a7b

Browse files
docs: add wasm info to docs; update scripts (#3158)
* docs: update docs - add cosmwasm * build: update dockerfiles * scripts: update startup script for single node * Update docs/docs/getting-started/installation.md Co-authored-by: Philip Offtermatt <[email protected]> --------- Co-authored-by: Philip Offtermatt <[email protected]>
1 parent 7273079 commit e5d4a7b

File tree

7 files changed

+81
-62
lines changed

7 files changed

+81
-62
lines changed

Dockerfile

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ RUN LEDGER_ENABLED=true LINK_STATICALLY=true BUILD_TAGS=muslc make build
2222
RUN echo "Ensuring binary is statically linked ..." \
2323
&& file /src/app/build/gaiad | grep "statically linked"
2424

25-
# Add to a distroless container
26-
FROM cgr.dev/chainguard/static:$IMG_TAG
25+
FROM alpine:$IMG_TAG
26+
RUN apk add --no-cache build-base
27+
RUN adduser -D nonroot
2728
ARG IMG_TAG
28-
COPY --from=gaiad-builder /src/app/build/gaiad /usr/local/bin/
29+
COPY --from=gaiad-builder /src/app/build/gaiad /usr/local/bin/
2930
EXPOSE 26656 26657 1317 9090
30-
USER 0
31+
USER nonroot
3132

32-
ENTRYPOINT ["gaiad", "start"]
33+
ENTRYPOINT ["gaiad", "start"]

contrib/single-node.sh

+20-21
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,29 @@
22

33
set -o errexit -o nounset
44

5-
CHAINID=$1
6-
GENACCT=$2
7-
8-
if [ -z "$1" ]; then
9-
echo "Need to input chain id..."
10-
exit 1
11-
fi
12-
13-
if [ -z "$2" ]; then
14-
echo "Need to input genesis account address..."
15-
exit 1
16-
fi
17-
18-
# Build genesis file incl account for passed address
19-
coins="10000000000stake,100000000000samoleans"
20-
gaiad init --chain-id $CHAINID $CHAINID
5+
HOME_DIR="${1:-$HOME}"
6+
CHAINID="test-gaia"
7+
USER_COINS="100000000000stake"
8+
STAKE="100000000stake"
9+
MONIKER="gaia-test-node"
10+
11+
12+
echo "Using home dir: $HOME_DIR"
13+
gaiad init --chain-id $CHAINID $MONIKER --home "$HOME_DIR/.gaia"
14+
15+
echo "Setting up genesis file"
16+
jq ".app_state.gov.params.voting_period = \"20s\" | .app_state.gov.params.expedited_voting_period = \"10s\" | .app_state.staking.params.unbonding_time = \"86400s\"" \
17+
"${HOME_DIR}/gaia/config/genesis.json" > \
18+
"${HOME_DIR}/edited_genesis.json" && mv "${HOME_DIR}/edited_genesis.json" "${HOME_DIR}/config/genesis.json"
19+
20+
2121
gaiad keys add validator --keyring-backend="test"
22-
gaiad genesis add-genesis-account $(gaiad keys show validator -a --keyring-backend="test") $coins
23-
gaiad genesis add-genesis-account $GENACCT $coins
24-
gaiad genesis gentx validator 5000000000stake --keyring-backend="test" --chain-id $CHAINID
22+
gaiad genesis add-genesis-account $(gaiad keys show validator -a --keyring-backend="test") $USER_COINS
23+
gaiad genesis gentx validator $STAKE --keyring-backend="test" --chain-id $CHAINID
2524
gaiad genesis collect-gentxs
2625

2726
# Set proper defaults and change ports
28-
echo "Setting rpc listen address"
27+
echo "Setting up node configs"
2928
# sed -i '' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ~/.gaia/config/config.toml
3029
sleep 1
3130
sed -i -r 's/timeout_commit = "5s"/timeout_commit = "1s"/g' ~/.gaia/config/config.toml
@@ -34,4 +33,4 @@ sed -i -r 's/index_all_keys = false/index_all_keys = true/g' ~/.gaia/config/conf
3433
sed -i -r 's/minimum-gas-prices = ""/minimum-gas-prices = "0stake"/g' ~/.gaia/config/app.toml
3534

3635
# Start the gaia
37-
gaiad start --pruning=nothing
36+
gaiad start --api.enable=true

docs/DOCS_README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,19 @@ git checkout <your_working_branch>
8282
cd docs
8383
```
8484

85-
Serve the app
85+
Start the app
8686

8787
```bash
88-
npm run serve
88+
npm run start
8989
```
9090

9191
then navigate to `localhost:3000` in your browser.
9292

9393
To build documentation as a static website run `npm run build`. You will find the website in `build` directory.
94+
After building the docs website you can start it with `npm run serve`.
9495

95-
## Search
9696

97-
We are using [Algolia](https://www.algolia.com) to power full-text search. This uses a public API search-only key in the `config.js` as well as a [cosmos_network.json](https://github.com/algolia/docsearch-configs/blob/master/configs/cosmos_network.json) configuration file that we can update with PRs.
98-
99-
### Update and Build the RPC docs
97+
## Update and Build the RPC docs
10098

10199
1. Execute the following command at the root directory to install the swagger-ui generate tool.
102100

docs/docs/getting-started/installation.md

+48-19
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,33 @@ Install `make` and `gcc`.
2020
**Ubuntu:**
2121

2222
```bash
23-
sudo apt-get update
23+
sudo apt update
2424

25-
sudo apt-get install -y make gcc
25+
sudo apt install -y make gcc build-essential
2626
```
2727

2828
## Install Go
2929

3030
:::tip
31-
**Go 1.21+** is required.
31+
**Go 1.22+** is required.
3232
:::
3333

3434
We suggest the following two ways to install Go. Check out the [official docs](https://golang.org/doc/install) and Go installer for the correct download for your operating system. Alternatively, you can install Go yourself from the command line. Detailed below are standard default installation locations, but feel free to customize.
3535

36+
Since the introduction of CosmWasm in Gaia v18 it is recommended to build the binaries with `CGO` enabled - simply set `CGO_ENABLED=1` in your terminal befre building the binary.
37+
38+
Building the `gaiad` binary on Windows is not supported due to [dependency issues](https://github.com/CosmWasm/wasmvm).
39+
3640
**[Go Binary Downloads](https://go.dev/dl/)**
3741

3842
**Ubuntu:**
3943

40-
At the time of this writing, the latest release is `1.21.7`. We're going to download the tarball, extract it to `/usr/local`, and export `GOROOT` to our `$PATH`
44+
At the time of this writing, the latest release is `1.22.3`. We're going to download the tarball, extract it to `/usr/local`, and export `GOROOT` to our `$PATH`
4145

4246
```bash
43-
curl -OL https://go.dev/dl/go1.21.7.darwin-amd64.tar.gz
47+
curl -OL https://go.dev/dl/go1.22.3.darwin-amd64.tar.gz
4448

45-
sudo tar -C /usr/local -xvf https://go.dev/dl/go1.21.7.darwin-amd64.tar.gz
49+
sudo tar -C /usr/local -xvf https://go.dev/dl/go1.22.3.darwin-amd64.tar.gz
4650

4751

4852
export PATH=$PATH:/usr/local/go/bin
@@ -94,31 +98,56 @@ You should see something similar to the following:
9498
```bash
9599
name: gaia
96100
server_name: gaiad
97-
version: v15.0.0
101+
version: v18.0.0
98102
commit: 682770f2410ab0d33ac7f0c7203519d7a99fa2b6
99-
build_tags: netgo,ledger
100-
go: go version go1.21.7 linux/amd64
103+
build_tags: netgo,ledger,muslc
104+
go: go version go1.22.3 linux/amd64
105+
```
106+
107+
## Docker
108+
109+
`Dockerfile` is available in the gaia repo.
110+
111+
Building:
112+
113+
```shell
114+
git clone -b <latest-release-tag> https://github.com/cosmos/gaia.git
115+
cd gaia
116+
docker build -t cosmos-ics:local -f Dockerfile ./
101117
```
102118

119+
## Static linking
120+
121+
In case you need to build a binary with all dependencies statically linked please check our [Dockerfile](https://github.com/cosmos/gaia/blob/main/Dockerfile).
122+
123+
You must have `libwasmvm` available on your machine.
124+
Choose the build that matches your platform and OS:
125+
* https://github.com/CosmWasm/wasmvm?tab=readme-ov-file#builds-of-libwasmvm
126+
127+
For more information, please check `wasmvm` [documentation](https://github.com/CosmWasm/wasmvm).
128+
129+
103130
### Build Tags
104131

105132
Build tags indicate special features that have been enabled in the binary.
106133

107-
| Build Tag | Description |
108-
| --------- | ----------------------------------------------- |
109-
| netgo | Name resolution will use pure Go code |
110-
| ledger | Ledger devices are supported (hardware wallets) |
134+
| Build Tag | Description |
135+
|-------------------|-------------------------------------------------|
136+
| netgo | Name resolution will use pure Go code |
137+
| ledger | Ledger devices are supported (hardware wallets) |
138+
| static_wasm/muslc | Used for statically linked wasmd dependencies |
139+
111140

112141
## Work with a Cosmos SDK Clone
113142

114143
To work with your own modifications of the Cosmos SDK, make a fork of this repo, and add a `replace` clause to the `go.mod` file.
115-
The `replace` clause you add to `go.mod` must provide the correct import path:
116-
117-
- Make appropriate changes
118-
- Add `replace github.com/cosmos/cosmos-sdk => /path/to/clone/cosmos-sdk` to `go.mod`
119-
- Run `make clean install` or `make clean build`
120-
- Test changes
144+
The `replace` clause you add to `go.mod` must provide the correct import path.
121145

146+
```shell
147+
go mod edit -replace github.com/cosmos/cosmos-sdk=../cosmos-sdk
148+
go mod tidy
149+
make install # or make build
150+
```
122151
## Next
123152

124153
Now you can [join the mainnet](../hub-tutorials/join-mainnet), [the public testnet](../hub-tutorials/join-testnet).

docs/docs/getting-started/quickstart.mdx docs/docs/getting-started/quickstart.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
title: Quick Start - Join Mainnet
33
sidebar_position: 3
44
---
5-
6-
import Tabs from '@theme/Tabs';
7-
import TabItem from '@theme/TabItem';
8-
95
**Bootstrap a `cosmoshub-4` mainnet node**
106

117
### Prerequisites
@@ -24,7 +20,7 @@ For reference, the list of `rpc_servers` and `persistent` peers can be found in
2420
```bash
2521
# Build gaiad binary and initialize chain
2622
cd $HOME
27-
git clone -b v15.0.0 https://github.com/cosmos/gaia --depth=1
23+
git clone -b v18.0.0 https://github.com/cosmos/gaia --depth=1
2824
cd gaiad
2925
make install
3026
gaiad init CUSTOM_MONIKER --chain-id cosmoshub-4

docs/docs/validators/overview.mdx docs/docs/validators/overview.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ title: Validator Overview
33
order: 1
44
---
55

6-
import { Var } from '@site/src/js/Var';
7-
import { currentParams } from '@site/docs/governance/current-parameters.js';
8-
96
## Introduction
107

118
The Cosmos Hub is based on [CometBFT](https://docs.cometbft.com/v0.37/introduction/what-is-cometbft) that relies on a set of validators that are responsible for committing new blocks in the blockchain. These validators participate in the consensus protocol by broadcasting votes that contain cryptographic signatures signed by each validator's private key.
129

13-
Validator candidates can bond their own ATOM and have ATOM ["delegated"](../delegators/delegator-guide-cli.md), or staked, to them by token holders. The Cosmos Hub has <Var children={currentParams.staking.MaxValidators} /> validators, see Proposal <Var children={currentParams.proposals.numberOfValidatorsProp} />, but over time the number of validators can be increased with governance proposals. The validators are determined by the total number of ATOM tokens delegated to themthe top <Var children={currentParams.staking.MaxValidators} /> validator candidates with the most voting power are the current Cosmos validators.
10+
Validator candidates can bond their own ATOM and have ATOM ["delegated"](../delegators/delegator-guide-cli.md), or staked, to them by token holders. The Cosmos Hub has 180 active validators, but over time the number of validators can be changed through governance (`MaxValidators` parameter). Validator voting power is determined by the total number of ATOM tokens delegated to them. Validators that do not have enough voting power to be in the top 180 are considered inactive. Inactive validators can become active if their staked amount increases so that they fall into the top 180 validators.
1411

1512
Validators and their delegators earn ATOM as block provisions and tokens as transaction fees through execution of the Tendermint consensus protocol. Note that validators can set a commission percentage on the fees their delegators receive as additional incentive. You can find an overview of all current validators and their voting power on [Mintscan](https://www.mintscan.io/cosmos/validators).
1613

e2e.Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ARG IMG_TAG=latest
33
# Compile the gaiad binary
44
FROM golang:1.22-alpine AS gaiad-builder
55
WORKDIR /src/app/
6-
ENV PACKAGES="curl make git libc-dev bash file gcc linux-headers eudev-dev python3"
6+
ENV PACKAGES="curl make git libc-dev bash file gcc linux-headers eudev-dev"
77
RUN apk add --no-cache $PACKAGES
88

99
# See https://github.com/CosmWasm/wasmvm/releases
@@ -22,7 +22,6 @@ RUN LEDGER_ENABLED=false LINK_STATICALLY=true BUILD_TAGS=muslc make build
2222
RUN echo "Ensuring binary is statically linked ..." \
2323
&& file /src/app/build/gaiad | grep "statically linked"
2424

25-
# Add to a distroless container
2625
FROM alpine:$IMG_TAG
2726
RUN apk add --no-cache build-base
2827
RUN adduser -D nonroot

0 commit comments

Comments
 (0)