|
| 1 | +# Debugging cardano-cli errors on testnet |
| 2 | + |
| 3 | +This document is intended for Cardano node and `cardano-cli` (CLI) users, as well as Cardano developers that wish to investigate CLI problems. |
| 4 | + |
| 5 | +We recommend making sure the `cardano-node` tests pass before starting to debug a problem. Additionally, take a look at the [Consensus sanity checklist](https://input-output-hk.github.io/ouroboros-consensus/docs/for-developers/SanityChecks). |
| 6 | + |
| 7 | +Once the node tests successfully pass, and you've read through the Consensus checklist, collect node logs to speed up the process of finding the cause of a problem. Below, we describe the steps to run a node that connects to a given testnet and get access to a `cardano-cli` that can be used to communicate with the node. These instructions work on a Unix environment with `nix` installed. |
| 8 | + |
| 9 | +Clone [cardano-world](https://github.com/input-output-hk/cardano-world) and check out the testnet branch (eg `sanchonet`). |
| 10 | + |
| 11 | +Once inside the `cardano-world` directory, enter a `nix` shell which has `cardano-node` in its path: |
| 12 | + |
| 13 | +```sh |
| 14 | +nix shell github:input-output-hk/cardano-node\?ref=8.1.1\#cardano-node |
| 15 | +``` |
| 16 | + |
| 17 | +where `8.1.1` should be replaced with the version intended to be tested. Once inside the `nix` shell, we can check whether the `cardano-node` executable is in our `PATH`: |
| 18 | + |
| 19 | +```sh |
| 20 | +which cardano-node |
| 21 | +``` |
| 22 | + |
| 23 | +```text |
| 24 | +/nix/store/scmkvbvx1355nwmclmrfd2snwvsgsn30-cardano-node-exe-cardano-node-8.1.1/bin/cardano-node |
| 25 | +``` |
| 26 | + |
| 27 | +The configuration files for the node can be found inside the `docs/environment/testnet_name`. You can copy these files to a new directory to edit them and have the node use the configuration inside said directory. For instance, after we copy the configuration files to a director named `node-custom-config`, the node can be readily run: |
| 28 | + |
| 29 | +```sh |
| 30 | + cardano-node run \ |
| 31 | + --config node-custom-config/config.json \ |
| 32 | + --database-path my-node-db \ |
| 33 | + --socket-path node.socket \ |
| 34 | + --topology custom-node-config/topology.json | tee -a node.log |
| 35 | +``` |
| 36 | + |
| 37 | +In particular, make sure to enable the relevant tracers in the node configuration file. In the example above this file is `node-custom-config/config.json`. |
| 38 | + |
| 39 | +Once the node is running, we need a CLI to communicate with it. To enter a shell that has `cardano-cli` in its `PATH` you can run: |
| 40 | + |
| 41 | +```sh |
| 42 | +nix develop .#x86_64-linux.automation.devshells.dev |
| 43 | +which cardano-cli |
| 44 | +``` |
| 45 | + |
| 46 | +```text |
| 47 | +/nix/store/cbr6kgfsq7pqjwdirvm75lwzaibxvyfm-devshell-dir/bin/cardano-cli |
| 48 | +``` |
| 49 | + |
| 50 | +## Debugging options |
| 51 | + |
| 52 | +It might be a good idea to adjust the `mapSeverity` attribute for the `LocalTxSubmissionProtocol` to `Debug` in the node configuration file. |
| 53 | + |
| 54 | +```json |
| 55 | +... |
| 56 | + "mapSeverity": { |
| 57 | + "cardano.node.LocalTxSubmissionProtocol": "Debug" |
| 58 | + } |
| 59 | +... |
| 60 | + |
| 61 | +``` |
0 commit comments