From d6db0ba017d9e9b450ed7a8e8945746413a09ac2 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:03:21 +0300 Subject: [PATCH 01/14] move debug to tutorials --- docs/docs/{kb/13-debug.md => guide/10-debug.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/docs/{kb/13-debug.md => guide/10-debug.md} (100%) diff --git a/docs/docs/kb/13-debug.md b/docs/docs/guide/10-debug.md similarity index 100% rename from docs/docs/kb/13-debug.md rename to docs/docs/guide/10-debug.md From 5bf2343615e5c409d914c96efc20a1c9b32a12cb Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:03:38 +0300 Subject: [PATCH 02/14] small tweaks --- docs/docs/guide/10-debug.md | 39 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/docs/docs/guide/10-debug.md b/docs/docs/guide/10-debug.md index 5f85ee555e..0e45bfe368 100644 --- a/docs/docs/guide/10-debug.md +++ b/docs/docs/guide/10-debug.md @@ -1,12 +1,11 @@ --- -sidebar_position: 13 -description: Blockchain Debug +description: Debugging your Cosmos SDK blockchain --- -# Blockchain Debug +# Debugging a chain -Ignite chain debug command can help you to find issues during development. -It uses [Delve](https://github.com/go-delve/delve) debugger which enables you to +Ignite chain debug command can help you find issues during development. It uses +[Delve](https://github.com/go-delve/delve) debugger which enables you to interact with your blockchain app by controlling the execution of the process, evaluating variables, and providing information of thread / goroutine state, CPU register state and more. @@ -14,10 +13,10 @@ register state and more. ## Debug Command The debug command requires that the blockchain app binary is build with -debugging support by removing optimizations and inlining. -A debug binary is built by default by the `ignite chain serve` command or can -optionally be created using the `--debug` flag when running `ignite chain init` -or `ignite chain build` sub-commands. +debugging support by removing optimizations and inlining. A debug binary is +built by default by the `ignite chain serve` command or can optionally be +created using the `--debug` flag when running `ignite chain init` or `ignite +chain build` sub-commands. To start a debugging session in the terminal run: @@ -33,10 +32,11 @@ Type 'help' for list of commands. (dlv) ``` -At this point the blockchain app blocks execution so you can set one or more +At this point the blockchain app blocks execution, so you can set one or more breakpoints before continuing execution. -Use the [break](https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md#break) +Use the +[break](https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md#break) (alias `b`) command to set any number of breakpoints using, for example the `:` notation: @@ -47,7 +47,7 @@ Use the [break](https://github.com/go-delve/delve/blob/master/Documentation/cli/ This command adds a breakpoint to the `x/hello/client/cli/query_say_hello.go` file at line 14. -Once all breakpoints are setted resume blockchain execution using the +Once all breakpoints are set resume blockchain execution using the [continue](https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md#continue) (alias `c`) command: @@ -112,7 +112,7 @@ extension is installed. VS Code debugging is configured using the `launch.json` file which is usually located inside the `.vscode` folder in your workspace. -You can use the following launch configuration to set up VS Code as debugging +You can use the following launch configuration to set up VS Code as debugging client: ```json title=launch.json @@ -133,7 +133,7 @@ client: ``` Alternatively it's possible to create a custom `launch.json` file from the "Run -and Debug" panel. When prompted choose the Go debugger option labeled "Go: +and Debug" panel. When prompted choose the Go debugger option labeled "Go: Connect to Server" and enter the debug host address and then the port number. ## Example: Debugging a Blockchain App @@ -141,10 +141,15 @@ Connect to Server" and enter the debug host address and then the port number. In this short example we will be using Ignite CLI to create a new blockchain and a query to be able to trigger a debugging breakpoint when the query is called. -To create a new blockchain and a query run: +Create a new blockchain: ```bash ignite scaffold chain hello +``` + +Scaffold a new query in the `hello` directory: + +```bash ignite scaffold query say-hello name --response name ``` @@ -177,7 +182,7 @@ hellod query hello say-hello bob A debugger shell will be launched when the breakpoint is triggered: -``` +```go 7: "google.golang.org/grpc/codes" 8: "google.golang.org/grpc/status" 9: "hello/x/hello/types" @@ -200,5 +205,5 @@ From then on you can use Delve commands like `next` (alias `n`) or `print` "bob" ``` -Finally use `quit` (alias `q`) to stop the blockchain app and finish the +Finally, use `quit` (alias `q`) to stop the blockchain app and finish the debugging session. From 0b209dc3388ba11e6bc45120f4ff3cadd6ae1fa8 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:06:18 +0300 Subject: [PATCH 03/14] remove bash syntax highlighting --- docs/docs/guide/10-debug.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/docs/guide/10-debug.md b/docs/docs/guide/10-debug.md index 0e45bfe368..e49c12b364 100644 --- a/docs/docs/guide/10-debug.md +++ b/docs/docs/guide/10-debug.md @@ -20,7 +20,7 @@ chain build` sub-commands. To start a debugging session in the terminal run: -```bash +``` ignite chain debug ``` @@ -71,13 +71,13 @@ client connections. To start a debug server use the following flag: -```bash +``` ignite chain debug --server ``` To start a debug server with a custom address use the following flags: -```bash +``` ignite chain debug --server --server-address 127.0.0.1:30500 ``` @@ -94,7 +94,7 @@ Using it as debugging client is straightforward as it doesn't require any configuration. Once the debug server is running and listening for client requests connect to it by running: -```bash +``` gdlv connect 127.0.0.1:30500 ``` @@ -143,26 +143,26 @@ a query to be able to trigger a debugging breakpoint when the query is called. Create a new blockchain: -```bash +``` ignite scaffold chain hello ``` Scaffold a new query in the `hello` directory: -```bash +``` ignite scaffold query say-hello name --response name ``` The next step initializes the blockchain's data directory and compiles a debug binary: -```bash +``` ignite chain init --debug ``` Once the initialization finishes launch the debugger shell: -```bash +``` ignite chain debug ``` @@ -176,7 +176,7 @@ Within the debugger shell create a breakpoint that will be triggered when the From a different terminal use the `hellod` binary to call the query: -```bash +``` hellod query hello say-hello bob ``` From c624c7c1230806dde3a519da1ea1b1f3d130ba68 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:28:12 +0300 Subject: [PATCH 04/14] move docker article --- docs/docs/{kb => guide}/09-docker.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/docs/{kb => guide}/09-docker.md (100%) diff --git a/docs/docs/kb/09-docker.md b/docs/docs/guide/09-docker.md similarity index 100% rename from docs/docs/kb/09-docker.md rename to docs/docs/guide/09-docker.md From 9527f582cf0d8277c7ba1d405d2502bc49ef0580 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:28:33 +0300 Subject: [PATCH 05/14] docker article at the end of list --- docs/docs/guide/{09-docker.md => 11-docker.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/docs/guide/{09-docker.md => 11-docker.md} (100%) diff --git a/docs/docs/guide/09-docker.md b/docs/docs/guide/11-docker.md similarity index 100% rename from docs/docs/guide/09-docker.md rename to docs/docs/guide/11-docker.md From bc8f5a513edfc4c9ddf4432463f8035e972c65f0 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:28:51 +0300 Subject: [PATCH 06/14] wrap 80 chars --- docs/docs/guide/11-docker.md | 115 +++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 46 deletions(-) diff --git a/docs/docs/guide/11-docker.md b/docs/docs/guide/11-docker.md index efaa0b6d8f..7daacb1aad 100644 --- a/docs/docs/guide/11-docker.md +++ b/docs/docs/guide/11-docker.md @@ -1,29 +1,33 @@ --- description: Run Ignite CLI using a Docker container. -sidebar_position: 9 --- # Run Ignite CLI in Docker -You can run Ignite CLI inside a Docker container without installing the Ignite CLI binary directly on your machine. +You can run Ignite CLI inside a Docker container without installing the Ignite +CLI binary directly on your machine. -Running Ignite CLI in Docker can be useful for various reasons; isolating your test environment, running Ignite CLI on -an unsupported operating system, or experimenting with a different version of Ignite CLI without installing it. +Running Ignite CLI in Docker can be useful for various reasons; isolating your +test environment, running Ignite CLI on an unsupported operating system, or +experimenting with a different version of Ignite CLI without installing it. -Docker containers are like virtual machines because they provide an isolated environment to programs that runs inside -them. In this case, you can run Ignite CLI in an isolated environment. +Docker containers are like virtual machines because they provide an isolated +environment to programs that runs inside them. In this case, you can run Ignite +CLI in an isolated environment. -Experimentation and file system impact is limited to the Docker instance. The host machine is not impacted by changes to -the container. +Experimentation and file system impact is limited to the Docker instance. The +host machine is not impacted by changes to the container. ## Prerequisites -Docker must be installed. See [Get Started with Docker](https://www.docker.com/get-started). +Docker must be installed. See [Get Started with +Docker](https://www.docker.com/get-started). ## Ignite CLI Commands in Docker -After you scaffold and start a chain in your Docker container, all Ignite CLI commands are available. Just type the -commands after `docker run -ti ignite/cli`. For example: +After you scaffold and start a chain in your Docker container, all Ignite CLI +commands are available. Just type the commands after `docker run -ti +ignite/cli`. For example: ```bash docker run -ti ignitehq/cli -h @@ -35,10 +39,10 @@ docker run -ti ignitehq/cli chain serve When Docker is installed, you can build a blockchain with a single command. -Ignite CLI, and the chains you serve with Ignite CLI, persist some files. -When using the CLI binary directly, those files are located in `$HOME/.ignite` -and `$HOME/.cache`, but in the context of Docker it's better to use a directory different from `$HOME`, so we -use `$HOME/sdh`. This folder should be created +Ignite CLI, and the chains you serve with Ignite CLI, persist some files. When +using the CLI binary directly, those files are located in `$HOME/.ignite` and +`$HOME/.cache`, but in the context of Docker it's better to use a directory +different from `$HOME`, so we use `$HOME/sdh`. This folder should be created manually prior to the docker commands below, or else Docker creates it with the root user. @@ -46,31 +50,38 @@ root user. mkdir $HOME/sdh ``` -To scaffold a blockchain `planet` in the `/apps` directory in the container, run this command in a terminal window: +To scaffold a blockchain `planet` in the `/apps` directory in the container, run +this command in a terminal window: ```bash docker run -ti -v $HOME/sdh:/home/tendermint -v $PWD:/apps ignitehq/cli:0.25.1 scaffold chain planet ``` -Be patient, this command takes a minute or two to run because it does everything for you: +Be patient, this command takes a minute or two to run because it does everything +for you: - Creates a container that runs from the `ignitehq/cli:0.25.1` image. - Executes the Ignite CLI binary inside the image. -- `-v $HOME/sdh:/home/tendermint` maps the `$HOME/sdh` directory in your local computer (the host machine) to the home - directory `/home/tendermint` inside the container. -- `-v $PWD:/apps` maps the current directory in the terminal window on the host machine to the `/apps` directory in the - container. You can optionally specify an absolute path instead of `$PWD`. - - Using `-w` and `-v` together provides file persistence on the host machine. The application source code on the Docker - container is mirrored to the file system of the host machine. - - **Note:** The directory name for the `-w` and `-v` flags can be a name other than `/app`, but the same directory must - be specified for both flags. If you omit `-w` and `-v`, the changes are made in the container only and are lost when - that container is shut down. +- `-v $HOME/sdh:/home/tendermint` maps the `$HOME/sdh` directory in your local + computer (the host machine) to the home directory `/home/tendermint` inside + the container. +- `-v $PWD:/apps` maps the current directory in the terminal window on the host + machine to the `/apps` directory in the container. You can optionally specify + an absolute path instead of `$PWD`. + + Using `-w` and `-v` together provides file persistence on the host machine. + The application source code on the Docker container is mirrored to the file + system of the host machine. + + **Note:** The directory name for the `-w` and `-v` flags can be a name other + than `/app`, but the same directory must be specified for both flags. If you + omit `-w` and `-v`, the changes are made in the container only and are lost + when that container is shut down. ## Starting a blockchain -To start the blockchain node in the Docker container you just created, run this command: +To start the blockchain node in the Docker container you just created, run this +command: ```bash docker run -ti -v $HOME/sdh:/home/tendermint -v $PWD:/apps -p 1317:1317 -p 26657:26657 ignitehq/cli:0.25.1 chain serve -p planet @@ -78,39 +89,51 @@ docker run -ti -v $HOME/sdh:/home/tendermint -v $PWD:/apps -p 1317:1317 -p 26657 This command does the following: -- `-v $HOME/sdh:/home/tendermint` maps the `$HOME/sdh` directory in your local computer (the host machine) to the home - directory `/home/tendermint` inside the container. -- `-v $PWD:/apps` persists the scaffolded app in the container to the host machine at current working directory. -- `serve -p planet` specifies to use the `planet` directory that contains the source code of the blockchain. -- `-p 1317:1317` maps the API server port (cosmos-sdk) to the host machine to forward port 1317 listening inside the - container to port 1317 on the host machine. -- `-p 26657:26657` maps RPC server port 26657 (tendermint) on the host machine to port 26657 in Docker. -- After the blockchain is started, open `http://localhost:26657` to see the Tendermint API. -- The `-v` flag specifies for the container to access the application's source code from the host machine, so it can - build and run it. +- `-v $HOME/sdh:/home/tendermint` maps the `$HOME/sdh` directory in your local + computer (the host machine) to the home directory `/home/tendermint` inside + the container. +- `-v $PWD:/apps` persists the scaffolded app in the container to the host + machine at current working directory. +- `serve -p planet` specifies to use the `planet` directory that contains the + source code of the blockchain. +- `-p 1317:1317` maps the API server port (cosmos-sdk) to the host machine to + forward port 1317 listening inside the container to port 1317 on the host + machine. +- `-p 26657:26657` maps RPC server port 26657 (tendermint) on the host machine + to port 26657 in Docker. +- After the blockchain is started, open `http://localhost:26657` to see the + Tendermint API. +- The `-v` flag specifies for the container to access the application's source + code from the host machine, so it can build and run it. ## Versioning -You can specify which version of Ignite CLI to install and run in your Docker container. +You can specify which version of Ignite CLI to install and run in your Docker +container. ### Latest version - By default, `ignite/cli` resolves to `ignite/cli:latest`. -- The `latest` image tag is always the latest stable [Ignite CLI release](https://github.com/ignite/cli/releases). +- The `latest` image tag is always the latest stable [Ignite CLI + release](https://github.com/ignite/cli/releases). -For example, if latest release is [v0.25.1](https://github.com/ignite/cli/releases/tag/v0.25.1), the `latest` tag points -to the `0.25.1` tag. +For example, if latest release is +[v0.25.1](https://github.com/ignite/cli/releases/tag/v0.25.1), the `latest` tag +points to the `0.25.1` tag. ### Specific version -You can specify to use a specific version of Ignite CLI. All available tags are in -the [ignite/cli image](https://hub.docker.com/r/ignite/cli/tags?page=1&ordering=last_updated) on Docker Hub. +You can specify to use a specific version of Ignite CLI. All available tags are +in the [ignite/cli +image](https://hub.docker.com/r/ignite/cli/tags?page=1&ordering=last_updated) on +Docker Hub. For example: - Use `ignitehq/cli:0.25.1` (without the `v` prefix) to use version `0.25.1`. - Use `ignitehq/cli` to use the latest version. -- Use `ignitehq/cli:main` to use the `main` branch, so you can experiment with the upcoming version. +- Use `ignitehq/cli:main` to use the `main` branch, so you can experiment with + the upcoming version. To get the latest image, run `docker pull`. From 27cae8ca921f4161c89b026ed624cad5fc191df6 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:29:18 +0300 Subject: [PATCH 07/14] change title --- docs/docs/guide/11-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/guide/11-docker.md b/docs/docs/guide/11-docker.md index 7daacb1aad..2c5b11fd8b 100644 --- a/docs/docs/guide/11-docker.md +++ b/docs/docs/guide/11-docker.md @@ -2,7 +2,7 @@ description: Run Ignite CLI using a Docker container. --- -# Run Ignite CLI in Docker +# Running inside a Docker container You can run Ignite CLI inside a Docker container without installing the Ignite CLI binary directly on your machine. From 57ff8c8232ce880d1a6f486fffb934635add62bc Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:29:42 +0300 Subject: [PATCH 08/14] move simapp --- docs/docs/{kb => guide}/10-simapp.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/docs/{kb => guide}/10-simapp.md (100%) diff --git a/docs/docs/kb/10-simapp.md b/docs/docs/guide/10-simapp.md similarity index 100% rename from docs/docs/kb/10-simapp.md rename to docs/docs/guide/10-simapp.md From c202b0d32d82af43e90c544405d185dfd4057225 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:30:15 +0300 Subject: [PATCH 09/14] reorder --- docs/docs/guide/{10-simapp.md => 12-simapp.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/docs/guide/{10-simapp.md => 12-simapp.md} (100%) diff --git a/docs/docs/guide/10-simapp.md b/docs/docs/guide/12-simapp.md similarity index 100% rename from docs/docs/guide/10-simapp.md rename to docs/docs/guide/12-simapp.md From 60b0e4a92f571780a372e2e6364f08dd8a4ebcbb Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:30:32 +0300 Subject: [PATCH 10/14] wrap 80 chars --- docs/docs/guide/12-simapp.md | 81 +++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/docs/docs/guide/12-simapp.md b/docs/docs/guide/12-simapp.md index b1e73135b2..ef625bbda4 100644 --- a/docs/docs/guide/12-simapp.md +++ b/docs/docs/guide/12-simapp.md @@ -5,28 +5,35 @@ description: Test different scenarios for your chain. # Chain simulation -The Ignite CLI chain simulator can help you to run your chain based in randomized inputs for you can make fuzz testing -and also benchmark test for your chain, simulating the messages, blocks, and accounts. You can scaffold a template to -perform simulation testing in each module along with a boilerplate simulation methods for each scaffolded message. +The Ignite CLI chain simulator can help you to run your chain based in +randomized inputs for you can make fuzz testing and also benchmark test for your +chain, simulating the messages, blocks, and accounts. You can scaffold a +template to perform simulation testing in each module along with a boilerplate +simulation methods for each scaffolded message. ## Module simulation -Every new module that is scaffolded with Ignite CLI implements the Cosmos -SDK [Module Simulation](https://docs.cosmos.network/main/building-modules/simulator.html). +Every new module that is scaffolded with Ignite CLI implements the Cosmos SDK +[Module +Simulation](https://docs.cosmos.network/main/building-modules/simulator.html). -- Each new message creates a file with the simulation methods required for the tests. -- Scaffolding a `CRUD` type like a `list` or `map` creates a simulation file with `create`, `update`, and `delete` - simulation methods in the `x//simulation` folder and registers these methods - in `x//module_simulation.go`. -- Scaffolding a single message creates an empty simulation method to be implemented by the user. +- Each new message creates a file with the simulation methods required for the + tests. +- Scaffolding a `CRUD` type like a `list` or `map` creates a simulation file + with `create`, `update`, and `delete` simulation methods in the + `x//simulation` folder and registers these methods in + `x//module_simulation.go`. +- Scaffolding a single message creates an empty simulation method to be + implemented by the user. -We recommend that you maintain the simulation methods for each new modification into the message keeper methods. +We recommend that you maintain the simulation methods for each new modification +into the message keeper methods. -Every simulation is weighted because the sender of the operation is assigned randomly. The weight defines how much the -simulation calls the message. +Every simulation is weighted because the sender of the operation is assigned +randomly. The weight defines how much the simulation calls the message. -For better randomizations, you can define a random seed. The simulation with the same random seed is deterministic with -the same output. +For better randomizations, you can define a random seed. The simulation with the +same random seed is deterministic with the same output. ## Scaffold a simulation @@ -36,8 +43,8 @@ To create a new chain: ignite scaffold chain mars ``` -Review the empty `x/mars/simulation` folder and the `x/mars/module_simulation.go` file to see that a simulation is not -registered. +Review the empty `x/mars/simulation` folder and the +`x/mars/module_simulation.go` file to see that a simulation is not registered. Now, scaffold a new message: @@ -45,21 +52,24 @@ Now, scaffold a new message: ignite scaffold list user address balance:uint state ``` -A new file `x/mars/simulation/user.go` is created and is registered with the weight in the `x/mars/module_simulation.go` -file. +A new file `x/mars/simulation/user.go` is created and is registered with the +weight in the `x/mars/module_simulation.go` file. -Be sure to define the proper simulation weight with a minimum weight of 0 and a maximum weight of 100. +Be sure to define the proper simulation weight with a minimum weight of 0 and a +maximum weight of 100. -For this example, change the `defaultWeightMsgDeleteUser` to 30 and the `defaultWeightMsgUpdateUser` to 50. +For this example, change the `defaultWeightMsgDeleteUser` to 30 and the +`defaultWeightMsgUpdateUser` to 50. -Run the `BenchmarkSimulation` method into `app/simulation_test.go` to run simulation tests for all modules: +Run the `BenchmarkSimulation` method into `app/simulation_test.go` to run +simulation tests for all modules: ```bash ignite chain simulate ``` -You can also define flags that are provided by the simulation. Flags are defined by the -method `simapp.GetSimulatorFlags()`: +You can also define flags that are provided by the simulation. Flags are defined +by the method `simapp.GetSimulatorFlags()`: ```bash ignite chain simulate -v --numBlocks 200 --blockSize 50 --seed 33 @@ -75,26 +85,31 @@ go test -v -benchmem -run=^$ -bench ^BenchmarkSimulation -cpuprofile cpu.out ./a ### Skip message -Use logic to avoid sending a message without returning an error. Return only `simtypes.NoOpMsg(...)` into the simulation -message handler. +Use logic to avoid sending a message without returning an error. Return only +`simtypes.NoOpMsg(...)` into the simulation message handler. ## Params -Scaffolding a module with params automatically adds the module in the `module_simulaton.go` file: +Scaffolding a module with params automatically adds the module in the +`module_simulaton.go` file: ```bash ignite s module earth --params channel:string,minLaunch:uint,maxLaunch:int ``` -After the parameters are scaffolded, change the `x//module_simulation.go` file to set the random parameters into -the `RandomizedParams` method. The simulation will change the params randomly according to call the function. +After the parameters are scaffolded, change the +`x//module_simulation.go` file to set the random parameters into the +`RandomizedParams` method. The simulation will change the params randomly +according to call the function. ## Invariants -Simulating a chain can help you prevent -[chain invariants errors](https://docs.cosmos.network/main/building-modules/invariants.html). An invariant is a function -called by the chain to check if something broke, invalidating the chain data. To create a new invariant and check the -chain integrity, you must create a method to validate the invariants and register all invariants. +Simulating a chain can help you prevent [chain invariants +errors](https://docs.cosmos.network/main/building-modules/invariants.html). An +invariant is a function called by the chain to check if something broke, +invalidating the chain data. To create a new invariant and check the chain +integrity, you must create a method to validate the invariants and register all +invariants. For example, in `x/earth/keeper/invariants.go`: From 8d7a4f265ee74173667b1a35bc6c330694483eda Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:32:58 +0300 Subject: [PATCH 11/14] remove bash syntax --- docs/docs/guide/12-simapp.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/guide/12-simapp.md b/docs/docs/guide/12-simapp.md index ef625bbda4..8f5421f99e 100644 --- a/docs/docs/guide/12-simapp.md +++ b/docs/docs/guide/12-simapp.md @@ -39,7 +39,7 @@ same random seed is deterministic with the same output. To create a new chain: -```bash +``` ignite scaffold chain mars ``` @@ -48,7 +48,7 @@ Review the empty `x/mars/simulation` folder and the Now, scaffold a new message: -```bash +``` ignite scaffold list user address balance:uint state ``` @@ -64,14 +64,14 @@ For this example, change the `defaultWeightMsgDeleteUser` to 30 and the Run the `BenchmarkSimulation` method into `app/simulation_test.go` to run simulation tests for all modules: -```bash +``` ignite chain simulate ``` You can also define flags that are provided by the simulation. Flags are defined by the method `simapp.GetSimulatorFlags()`: -```bash +``` ignite chain simulate -v --numBlocks 200 --blockSize 50 --seed 33 ``` @@ -79,7 +79,7 @@ Wait for the entire simulation to finish and check the result of the messages. The default `go test` command works to run the simulation: -```bash +``` go test -v -benchmem -run=^$ -bench ^BenchmarkSimulation -cpuprofile cpu.out ./app -Commit=true ``` @@ -93,7 +93,7 @@ Use logic to avoid sending a message without returning an error. Return only Scaffolding a module with params automatically adds the module in the `module_simulaton.go` file: -```bash +``` ignite s module earth --params channel:string,minLaunch:uint,maxLaunch:int ``` From 350c9bf46c67da8928df316aeb6057e5e2a8459c Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:33:39 +0300 Subject: [PATCH 12/14] update to v0.25.2 --- docs/docs/guide/11-docker.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/guide/11-docker.md b/docs/docs/guide/11-docker.md index 2c5b11fd8b..77edaa31ab 100644 --- a/docs/docs/guide/11-docker.md +++ b/docs/docs/guide/11-docker.md @@ -54,13 +54,13 @@ To scaffold a blockchain `planet` in the `/apps` directory in the container, run this command in a terminal window: ```bash -docker run -ti -v $HOME/sdh:/home/tendermint -v $PWD:/apps ignitehq/cli:0.25.1 scaffold chain planet +docker run -ti -v $HOME/sdh:/home/tendermint -v $PWD:/apps ignitehq/cli:0.25.2 scaffold chain planet ``` Be patient, this command takes a minute or two to run because it does everything for you: -- Creates a container that runs from the `ignitehq/cli:0.25.1` image. +- Creates a container that runs from the `ignitehq/cli:0.25.2` image. - Executes the Ignite CLI binary inside the image. - `-v $HOME/sdh:/home/tendermint` maps the `$HOME/sdh` directory in your local computer (the host machine) to the home directory `/home/tendermint` inside @@ -84,7 +84,7 @@ To start the blockchain node in the Docker container you just created, run this command: ```bash -docker run -ti -v $HOME/sdh:/home/tendermint -v $PWD:/apps -p 1317:1317 -p 26657:26657 ignitehq/cli:0.25.1 chain serve -p planet +docker run -ti -v $HOME/sdh:/home/tendermint -v $PWD:/apps -p 1317:1317 -p 26657:26657 ignitehq/cli:0.25.2 chain serve -p planet ``` This command does the following: @@ -118,8 +118,8 @@ container. release](https://github.com/ignite/cli/releases). For example, if latest release is -[v0.25.1](https://github.com/ignite/cli/releases/tag/v0.25.1), the `latest` tag -points to the `0.25.1` tag. +[v0.25.2](https://github.com/ignite/cli/releases/tag/v0.25.2), the `latest` tag +points to the `0.25.2` tag. ### Specific version @@ -130,7 +130,7 @@ Docker Hub. For example: -- Use `ignitehq/cli:0.25.1` (without the `v` prefix) to use version `0.25.1`. +- Use `ignitehq/cli:0.25.2` (without the `v` prefix) to use version `0.25.2`. - Use `ignitehq/cli` to use the latest version. - Use `ignitehq/cli:main` to use the `main` branch, so you can experiment with the upcoming version. From 86744da39a4565698407eb5cf78c4fe189c1e8e0 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 15:35:23 +0300 Subject: [PATCH 13/14] add title to code block --- docs/docs/guide/12-simapp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/guide/12-simapp.md b/docs/docs/guide/12-simapp.md index 8f5421f99e..fd2dcea96f 100644 --- a/docs/docs/guide/12-simapp.md +++ b/docs/docs/guide/12-simapp.md @@ -114,7 +114,7 @@ invariants. For example, in `x/earth/keeper/invariants.go`: -```go +```go title="x/earth/keeper/invariants.go" package keeper import ( From 41a7bc4ac00fad59671438665d1e111c0df7008d Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 5 Jan 2023 16:20:03 +0300 Subject: [PATCH 14/14] remove go syntax --- docs/docs/guide/10-debug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/guide/10-debug.md b/docs/docs/guide/10-debug.md index e49c12b364..e1b578a9fe 100644 --- a/docs/docs/guide/10-debug.md +++ b/docs/docs/guide/10-debug.md @@ -182,7 +182,7 @@ hellod query hello say-hello bob A debugger shell will be launched when the breakpoint is triggered: -```go +``` 7: "google.golang.org/grpc/codes" 8: "google.golang.org/grpc/status" 9: "hello/x/hello/types"