Grinnode-live / 2020-grin-bug-bash-challenge

Finding bugs in Grin-Wallet & Grin-nodes for a bounty prior to Grin fork v5.
3 stars 1 forks source link

[GRIN-Node] test if TUI is working #11

Closed MCM-Mike closed 3 years ago

MCM-Mike commented 3 years ago

Description: Test if tui can be turned off , on a Grin-Node

Prerequisites Setup your Grin-Node and make the following changes to your grin-node.toml file:

#whether to run the ncurses TUI (Ncurses must be installed)
run_tui = false

and restart your Grin-Node.

Expected result: After node restart , you should not see a graphical interface similar to this:

image

marekyggdrasil commented 3 years ago

I thought TUI is always on? Every time I built and run a node I was getting it without explicitly turning it on.

marekyggdrasil commented 3 years ago

After discussing with @bladedoyle I suggest to set run_tui = false and confirm TUI does not appear.

goyle commented 3 years ago

Description

Test if TUI can be turned off on a Grin-Node.

Prerequisites

Setup your Grin-Node and make the following changes to your grin-node.toml file:

#whether to run the ncurses TUI (Ncurses must be installed)
run_tui = false

and restart your Grin-Node.

Expected result

After node restart, you should not see a graphical interface.

Building the Node

These steps for building the node was done previously for issue #14. The node version is v5.0.0-rc.1.

Click here to see the full steps for building the node. 1. Download grin v5.0.0-rc.1 ``` $ wget https://github.com/mimblewimble/grin/archive/v5.0.0-rc.1.tar.gz ``` 1. 1. Extract v5.0.0-rc.1.tar.gz ``` $ tar -xvf v5.0.0-rc.1.tar.gz ``` * Output is as follows. ``` grin-5.0.0-rc.1/ grin-5.0.0-rc.1/.cargo/ grin-5.0.0-rc.1/.cargo/config grin-5.0.0-rc.1/.ci/ grin-5.0.0-rc.1/.ci/general-jobs grin-5.0.0-rc.1/.ci/release.yml grin-5.0.0-rc.1/.ci/test.yml grin-5.0.0-rc.1/.ci/windows-release.yml grin-5.0.0-rc.1/.editorconfig grin-5.0.0-rc.1/.github/ ... ``` 1. Install rust. ``` $ curl https://sh.rustup.rs -sSf | sh; source $HOME/.cargo/env ``` * Proceed with installation with default profile. ``` default host triple: x86_64-unknown-linux-gnu default toolchain: stable (default) profile: default modify PATH variable: yes ``` * Output as follows. ``` stable-x86_64-unknown-linux-gnu installed - rustc 1.48.0 (7eac88abb 2020-11-16) ``` 1. Download dependencies. Include the missing `libcursesw5`. ``` # apt install build-essential git tor cmake git libgit2-dev clang libncursesw5 libncurses5-dev libncursesw5-dev zlib1g-dev pkg-config libssl-dev llvm ``` 1. Build grin node v5.0.0-rc.1. ``` $ cd grin-5.0.0-rc.1/ $ cargo build --release ``` 1. Configure the node to save its logs and chain data in the current directory. This is optional and I did this for convenience and testing purposes. ``` $ cd target/release/ $ ./grin server config ``` * The output will be as follows. ``` grin-server.toml file configured and created in current directory ``` 1. If the previous step is done, enable DEBUG mode in `grin-server.toml`. ``` #log level for file: Error, Warning, Info, Debug, Trace file_log_level = "Debug" ``` 1. Start node. ``` $ ./grin ``` 1. Wait until Grin has fully synced.

Steps

  1. Shut down the node by pressing q.
  2. Edit grin-server.toml by changing run_tui to false and stdout log level to Debug.
    #whether to run the ncurses TUI (Ncurses must be installed)
    run_tui = false
    #log level for stdout: Error, Warning, Info, Debug, Trace
    stdout_log_level = "Debug"
  3. Run the node: ./grin
  4. The node should now be started without UI.

Final Results

20201220 17:50:33.491 INFO grin_util::logger - log4rs is initialized, file level: Debug, stdout level: Debug, min. level: Debug
20201220 17:50:33.491 INFO grin - Using configuration file at /home/user/grin-5.0.0-rc.1/target/release/grin-server.toml
20201220 17:50:33.491 INFO grin - This is Grin version 5.0.0-rc.1, built for x86_64-unknown-linux-gnu by rustc 1.48.0 (7eac88abb 2020-11-16).
20201220 17:50:33.491 DEBUG grin - Built with profile "release", features "".
20201220 17:50:33.491 INFO grin - Chain: Mainnet
20201220 17:50:33.491 INFO grin - Accept Fee Base: 500000
20201220 17:50:33.491 INFO grin - Future Time Limit: 300
20201220 17:50:33.491 INFO grin - Feature: NRD kernel enabled: false
20201220 17:50:33.491 WARN grin::cmd::server - Starting GRIN w/o UI...
20201220 17:50:33.492 INFO grin_servers::grin::server - Starting server, genesis block: 40adad0aec27
20201220 17:50:33.492 DEBUG grin_store::lmdb - DB Mapsize for /home/user/grin-5.0.0-rc.1/target/release/chain_data/lmdb is 939524096
20201220 17:50:33.492 DEBUG grin_chain::chain - migrate_db_v2_v3: previously migrated, skipping
20201220 17:50:33.492 DEBUG grin_store::leaf_set - bitmap 189891 pos (380886 bytes)
20201220 17:50:35.825 DEBUG grin_store::prune_list - bitmap 582053 pos (866004 bytes), pruned_cache 7901269 pos (923305 bytes), shift_cache 582053, leaf_shift_cache 582053
20201220 17:50:35.825 DEBUG grin_store::leaf_set - bitmap 189891 pos (380886 bytes)
20201220 17:50:38.147 DEBUG grin_store::prune_list - bitmap 582053 pos (866004 bytes), pruned_cache 7901269 pos (923305 bytes), shift_cache 582053, leaf_shift_cache 582053
20201220 17:50:38.204 DEBUG grin_chain::txhashset::bitmap_accumulator - applied 4361 chunks from idx 0 to idx 4360 (56ms)
20201220 17:50:38.245 DEBUG grin_chain::txhashset::txhashset - attempting to open kernel PMMR using ProtocolVersion(2) - FAIL (verify failed)
20201220 17:50:38.275 DEBUG grin_chain::txhashset::txhashset - attempting to open kernel PMMR using ProtocolVersion(1) - SUCCESS
20201220 17:50:38.275 DEBUG grin_chain::txhashset::txhashset - init_head: header PMMR: current head 0001a121da4f at pos 2021589
20201220 17:50:38.275 DEBUG grin_chain::txhashset::txhashset - init_head: header PMMR: resetting to 0001a121da4f at pos 2021589 (height 1010799)
20201220 17:50:38.275 DEBUG grin_chain::txhashset::txhashset - Rewind header extension to 0001a121da4f at 1010799 from 0001a121da4f at 1010799
20201220 17:50:38.282 DEBUG grin_chain::txhashset::txhashset - Rewind header extension to 0001a121da4f at 1010799 from 0001a121da4f at 1010799
20201220 17:50:38.282 DEBUG grin_chain::txhashset::txhashset - Rewind extension to 0001a121da4f at 1010799 from 0001a121da4f at 1010799
20201220 17:50:38.282 DEBUG grin_chain::txhashset::bitmap_accumulator - applied 1 chunks from idx 4360 to idx 4360 (0ms)
20201220 17:50:38.282 DEBUG grin_chain::types - validate roots: 0001a121da4f at 1010799, c3c8277aedbe vs. c3c8277aedbe (original: 5fb80f1cbb88, merged: c3c8277aedbe)
20201220 17:50:38.283 DEBUG grin_chain::chain - init: rewinding and validating before we start... 0001a121da4f at 1010799
20201220 17:50:38.730 DEBUG grin_chain::txhashset::txhashset - init_output_pos_index: removed 0 stale index entries
20201220 17:50:38.996 DEBUG grin_chain::txhashset::txhashset - init_output_pos_index: 189891 utxos
20201220 17:50:39.117 DEBUG grin_chain::txhashset::txhashset - init_output_pos_index: 0 utxos with missing index entries
20201220 17:50:39.117 DEBUG grin_chain::chain - head: 1734410642906381 @ 1010799 [0001a121da4f]
20201220 17:50:39.117 DEBUG grin_chain::chain - header_head: 1734410642906381 @ 1010799 [0001a121da4f]
20201220 17:50:39.117 DEBUG grin_chain::chain - sync_head: 1734408061685695 @ 1010793 [0001285c1d02]
20201220 17:50:39.117 DEBUG grin_chain::chain - txhashset_archive_header: body_head - 0001a121da4f, 1010799, txhashset height - 1007280
20201220 17:50:39.117 DEBUG grin_chain::chain - init_segmenter: initializing new segmenter for 00004ce83e14 at 1007280
20201220 17:50:39.117 DEBUG grin_chain::txhashset::txhashset - Rewind extension to 00004ce83e14 at 1007280 from 0001a121da4f at 1010799
20201220 17:50:39.314 DEBUG grin_chain::txhashset::bitmap_accumulator - applied 3051 chunks from idx 1301 to idx 4351 (43ms)
20201220 17:50:39.315 DEBUG grin_chain::chain - init_segmenter: done, took 197ms
20201220 17:50:39.315 DEBUG grin_chain::txhashset::segmenter - kernel_segment: id: (9, 0), leaves: 512, hashes: 0, proof hashes: 13, took 0ms
20201220 17:50:39.315 DEBUG grin_chain::txhashset::segmenter - bitmap_segment: id: (9, 0), leaves: 512, hashes: 0, proof hashes: 4, took 0ms
20201220 17:50:39.315 DEBUG grin_chain::txhashset::segmenter - output_segment: id: (11, 0), leaves: 100, hashes: 469, proof hashes: 12, took 0ms
20201220 17:50:39.316 DEBUG grin_chain::txhashset::segmenter - rangeproof_segment: id: (7, 0), leaves: 10, hashes: 43, proof hashes: 16, took 0ms
20201220 17:50:39.316 DEBUG grin_servers::grin::server - Capabilities: HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH | PIBD_HIST
20201220 17:50:39.316 DEBUG grin_store::lmdb - DB Mapsize for /home/user/grin-5.0.0-rc.1/target/release/chain_data/peer is 134217728
20201220 17:50:39.316 DEBUG grin_chain::types - sync_state: sync_status: Initial -> AwaitingPeers(true)
20201220 17:50:39.316 INFO grin_servers::grin::server - Starting rest apis at: 127.0.0.1:3413
20201220 17:50:39.316 WARN grin_api::handlers - Starting HTTP Node APIs server at 127.0.0.1:3413.
20201220 17:50:39.316 WARN grin_api::handlers - HTTP Node listener started.
20201220 17:50:39.316 INFO grin_servers::grin::server - Starting dandelion monitor: 127.0.0.1:3413
20201220 17:50:39.316 DEBUG grin_servers::grin::dandelion_monitor - Started Dandelion transaction monitor.
20201220 17:50:39.316 WARN grin_servers::grin::server - Grin server started.
20201220 17:50:39.316 INFO grin_servers::common::types - DandelionEpoch: next_epoch: is_stem: true (90%), relay: None
20201220 17:50:39.325 DEBUG grin_servers::grin::seed - monitor_peers: on 0.0.0.0:3414, 0 connected (0 most_work). all 6233 = 6108 healthy + 0 banned + 125 defunct
20201220 17:50:39.420 DEBUG grin_p2p::peer - connect: handshaking with Ok(116.203.154.223:3414)
20201220 17:50:39.507 DEBUG grin_p2p::peer - connect: handshaking with Ok(213.239.217.14:3414)
20201220 17:50:39.508 DEBUG grin_p2p::peer - connect: handshaking with Ok(35.181.35.93:3414)
20201220 17:50:39.508 DEBUG grin_p2p::peer - connect: handshaking with Ok(18.204.166.78:3414)
20201220 17:50:39.509 DEBUG grin_p2p::peer - connect: handshaking with Ok(176.9.86.219:3414)
20201220 17:50:39.509 DEBUG grin_p2p::peer - connect: handshaking with Ok(49.12.108.173:3414)
20201220 17:50:39.509 DEBUG grin_p2p::peer - connect: handshaking with Ok(5.135.184.54:3414)
20201220 17:50:39.509 DEBUG grin_p2p::peer - connect: handshaking with Ok(85.10.201.143:3414)
20201220 17:50:39.595 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(116.203.154.223:3414), ProtocolVersion(2), "MW/Grin 4.0.1", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH
20201220 17:50:39.595 DEBUG grin_p2p::peer - connect: handshaking with Ok(108.196.200.233:3414)
20201220 17:50:39.595 DEBUG grin_p2p::peer - connect: handshaking with Ok(157.230.142.11:3414)
20201220 17:50:39.595 DEBUG grin_p2p::peers - Saving newly connected peer 116.203.154.223:3414.
20201220 17:50:39.595 DEBUG grin_p2p::store - save_peer: PeerAddr(116.203.154.223:3414) marked Healthy
20201220 17:50:39.595 DEBUG grin_p2p::peer - connect: handshaking with Ok(35.237.62.254:3414)
20201220 17:50:39.613 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(213.239.217.14:3414), ProtocolVersion(1000), "MW/Grin 5.0.0-rc.1", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH | PIBD_HIST
20201220 17:50:39.613 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(35.181.35.93:3414), ProtocolVersion(2), "MW/Grin 4.0.0", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH
20201220 17:50:39.613 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(176.9.86.219:3414), ProtocolVersion(1000), "MW/Grin 5.0.0-rc.1", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH | PIBD_HIST
20201220 17:50:39.613 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(5.135.184.54:3414), ProtocolVersion(1000), "MW/Grin 5.0.0-beta.2", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH | PIBD_HIST
20201220 17:50:39.613 DEBUG grin_p2p::peers - Saving newly connected peer 213.239.217.14:3414.
20201220 17:50:39.613 DEBUG grin_p2p::store - save_peer: PeerAddr(213.239.217.14:3414) marked Healthy
20201220 17:50:39.614 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(85.10.201.143:3414), ProtocolVersion(1000), "MW/Grin 5.0.0-rc.1", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH | PIBD_HIST
20201220 17:50:39.616 DEBUG grin_p2p::peers - Saving newly connected peer 35.181.35.93:3414.
20201220 17:50:39.616 DEBUG grin_p2p::store - save_peer: PeerAddr(35.181.35.93:3414) marked Healthy
20201220 17:50:39.620 DEBUG grin_p2p::peers - Saving newly connected peer 176.9.86.219:3414.
20201220 17:50:39.620 DEBUG grin_p2p::store - save_peer: PeerAddr(176.9.86.219:3414) marked Healthy
20201220 17:50:39.628 DEBUG grin_p2p::peers - Saving newly connected peer 5.135.184.54:3414.
20201220 17:50:39.628 DEBUG grin_p2p::store - save_peer: PeerAddr(5.135.184.54:3414) marked Healthy
20201220 17:50:39.632 DEBUG grin_p2p::peers - Saving newly connected peer 85.10.201.143:3414.
20201220 17:50:39.632 DEBUG grin_p2p::store - save_peer: PeerAddr(85.10.201.143:3414) marked Healthy
20201220 17:50:39.682 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(49.12.108.173:3414), ProtocolVersion(1000), "MW/Grin 4.1.1", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH
20201220 17:50:39.683 DEBUG grin_p2p::peer - connect: handshaking with Ok(116.62.217.224:3414)
20201220 17:50:39.683 DEBUG grin_p2p::peers - Saving newly connected peer 49.12.108.173:3414.
20201220 17:50:39.683 DEBUG grin_p2p::store - save_peer: PeerAddr(49.12.108.173:3414) marked Healthy
20201220 17:50:39.683 DEBUG grin_p2p::peer - connect: handshaking with Ok(47.97.218.157:3414)
20201220 17:50:39.764 DEBUG grin_p2p::handshake - Connected! Cumulative 1734411965481835 offered from PeerAddr(18.204.166.78:3414), ProtocolVersion(2), "MW/Grin 4.0.0", HEADER_HIST | TXHASHSET_HIST | PEER_LIST | TX_KERNEL_HASH
20201220 17:50:39.764 DEBUG grin_p2p::peers - Saving newly connected peer 18.204.166.78:3414.
20201220 17:50:39.764 DEBUG grin_p2p::store - save_peer: PeerAddr(18.204.166.78:3414) marked Healthy
20201220 17:50:39.767 DEBUG grin_p2p::store - save_peer: PeerAddr(78.16.64.54:3414) marked Healthy
20201220 17:50:39.767 DEBUG grin_p2p::store - save_peer: PeerAddr(178.121.87.201:3414) marked Healthy
20201220 17:50:39.769 DEBUG grin_p2p::store - save_peer: PeerAddr(213.136.88.51:3414) marked Healthy
20201220 17:50:39.770 DEBUG grin_p2p::store - save_peer: PeerAddr(151.68.201.22:3414) marked Healthy
...

Errors

None encountered.

marekyggdrasil commented 3 years ago

Well done!