github.com/badrootd/nibiru-cometbft@v0.37.5-0.20240307173500-2a75559eee9b/docs/core/how-to-read-logs.md (about) 1 --- 2 order: 7 3 --- 4 5 # How to read logs 6 7 ## Walkabout example 8 9 We first create three connections (mempool, consensus and query) to the 10 application (running `kvstore` locally in this case). 11 12 ```sh 13 I[10-04|13:54:27.364] Starting multiAppConn module=proxy impl=multiAppConn 14 I[10-04|13:54:27.366] Starting localClient module=abci-client connection=query impl=localClient 15 I[10-04|13:54:27.366] Starting localClient module=abci-client connection=mempool impl=localClient 16 I[10-04|13:54:27.367] Starting localClient module=abci-client connection=consensus impl=localClient 17 ``` 18 19 Then CometBFT and the application perform a handshake. 20 21 ```sh 22 I[10-04|13:54:27.367] ABCI Handshake module=consensus appHeight=90 appHash=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD 23 I[10-04|13:54:27.368] ABCI Replay Blocks module=consensus appHeight=90 storeHeight=90 stateHeight=90 24 I[10-04|13:54:27.368] Completed ABCI Handshake - CometBFT and App are synced module=consensus appHeight=90 appHash=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD 25 ``` 26 27 After that, we start a few more things like the event switch and reactors. 28 29 ```sh 30 I[10-04|13:54:27.374] Starting EventSwitch module=types impl=EventSwitch 31 I[10-04|13:54:27.375] This node is a validator module=consensus 32 I[10-04|13:54:27.379] Starting Node module=main impl=Node 33 I[10-04|13:54:27.381] Local listener module=p2p ip=:: port=26656 34 I[10-04|13:54:30.386] Starting DefaultListener module=p2p impl=Listener(@10.0.2.15:26656) 35 I[10-04|13:54:30.387] Starting P2P Switch module=p2p impl="P2P Switch" 36 I[10-04|13:54:30.387] Starting MempoolReactor module=mempool impl=MempoolReactor 37 I[10-04|13:54:30.387] Starting BlockchainReactor module=blockchain impl=BlockchainReactor 38 I[10-04|13:54:30.387] Starting ConsensusReactor module=consensus impl=ConsensusReactor 39 I[10-04|13:54:30.387] ConsensusReactor module=consensus fastSync=false 40 I[10-04|13:54:30.387] Starting ConsensusState module=consensus impl=ConsensusState 41 I[10-04|13:54:30.387] Starting WAL module=consensus wal=/home/vagrant/.cometbft/data/cs.wal/wal impl=WAL 42 I[10-04|13:54:30.388] Starting TimeoutTicker module=consensus impl=TimeoutTicker 43 ``` 44 45 Notice the second row where CometBFT reports that "This node is a 46 validator". It also could be just an observer (regular node). 47 48 Next we replay all the messages from the WAL. 49 50 ```sh 51 I[10-04|13:54:30.390] Catchup by replaying consensus messages module=consensus height=91 52 I[10-04|13:54:30.390] Replay: New Step module=consensus height=91 round=0 step=RoundStepNewHeight 53 I[10-04|13:54:30.390] Replay: Done module=consensus 54 ``` 55 56 "Started node" message signals that everything is ready for work. 57 58 ```sh 59 I[10-04|13:54:30.391] Starting RPC HTTP server on tcp socket 0.0.0.0:26657 module=rpc-server 60 I[10-04|13:54:30.392] Started node module=main nodeInfo="NodeInfo{id: DF22D7C92C91082324A1312F092AA1DA197FA598DBBFB6526E, moniker: anonymous, network: test-chain-3MNw2N [remote , listen 10.0.2.15:26656], version: 0.11.0-10f361fc ([wire_version=0.6.2 p2p_version=0.5.0 consensus_version=v1/0.2.2 rpc_version=0.7.0/3 tx_index=on rpc_addr=tcp://0.0.0.0:26657])}" 61 ``` 62 63 Next follows a standard block creation cycle, where we enter a new 64 round, propose a block, receive more than 2/3 of prevotes, then 65 precommits and finally have a chance to commit a block. For details, 66 please refer to [Byzantine Consensus Algorithm](https://github.com/cometbft/cometbft/blob/v0.37.x/spec/consensus/consensus.md). 67 68 ```sh 69 I[10-04|13:54:30.393] enterNewRound(91/0). Current: 91/0/RoundStepNewHeight module=consensus 70 I[10-04|13:54:30.393] enterPropose(91/0). Current: 91/0/RoundStepNewRound module=consensus 71 I[10-04|13:54:30.393] enterPropose: Our turn to propose module=consensus proposer=125B0E3C5512F5C2B0E1109E31885C4511570C42 privValidator="PrivValidator{125B0E3C5512F5C2B0E1109E31885C4511570C42 LH:90, LR:0, LS:3}" 72 I[10-04|13:54:30.394] Signed proposal module=consensus height=91 round=0 proposal="Proposal{91/0 1:21B79872514F (-1,:0:000000000000) {/10EDEDD7C84E.../}}" 73 I[10-04|13:54:30.397] Received complete proposal block module=consensus height=91 hash=F671D562C7B9242900A286E1882EE64E5556FE9E 74 I[10-04|13:54:30.397] enterPrevote(91/0). Current: 91/0/RoundStepPropose module=consensus 75 I[10-04|13:54:30.397] enterPrevote: ProposalBlock is valid module=consensus height=91 round=0 76 I[10-04|13:54:30.398] Signed and pushed vote module=consensus height=91 round=0 vote="Vote{0:125B0E3C5512 91/00/1(Prevote) F671D562C7B9 {/89047FFC21D8.../}}" err=null 77 I[10-04|13:54:30.401] Added to prevote module=consensus vote="Vote{0:125B0E3C5512 91/00/1(Prevote) F671D562C7B9 {/89047FFC21D8.../}}" prevotes="VoteSet{H:91 R:0 T:1 +2/3:F671D562C7B9242900A286E1882EE64E5556FE9E:1:21B79872514F BA{1:X} map[]}" 78 I[10-04|13:54:30.401] enterPrecommit(91/0). Current: 91/0/RoundStepPrevote module=consensus 79 I[10-04|13:54:30.401] enterPrecommit: +2/3 prevoted proposal block. Locking module=consensus hash=F671D562C7B9242900A286E1882EE64E5556FE9E 80 I[10-04|13:54:30.402] Signed and pushed vote module=consensus height=91 round=0 vote="Vote{0:125B0E3C5512 91/00/2(Precommit) F671D562C7B9 {/80533478E41A.../}}" err=null 81 I[10-04|13:54:30.404] Added to precommit module=consensus vote="Vote{0:125B0E3C5512 91/00/2(Precommit) F671D562C7B9 {/80533478E41A.../}}" precommits="VoteSet{H:91 R:0 T:2 +2/3:F671D562C7B9242900A286E1882EE64E5556FE9E:1:21B79872514F BA{1:X} map[]}" 82 I[10-04|13:54:30.404] enterCommit(91/0). Current: 91/0/RoundStepPrecommit module=consensus 83 I[10-04|13:54:30.405] Finalizing commit of block with 0 txs module=consensus height=91 hash=F671D562C7B9242900A286E1882EE64E5556FE9E root=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD 84 I[10-04|13:54:30.405] Block{ 85 Header{ 86 ChainID: test-chain-3MNw2N 87 Height: 91 88 Time: 2017-10-04 13:54:30.393 +0000 UTC 89 NumTxs: 0 90 LastBlockID: F15AB8BEF9A6AAB07E457A6E16BC410546AA4DC6:1:D505DA273544 91 LastCommit: 56FEF2EFDB8B37E9C6E6D635749DF3169D5F005D 92 Data: 93 Validators: CE25FBFF2E10C0D51AA1A07C064A96931BC8B297 94 App: E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD 95 }#F671D562C7B9242900A286E1882EE64E5556FE9E 96 Data{ 97 98 }# 99 Commit{ 100 BlockID: F15AB8BEF9A6AAB07E457A6E16BC410546AA4DC6:1:D505DA273544 101 Precommits: Vote{0:125B0E3C5512 90/00/2(Precommit) F15AB8BEF9A6 {/FE98E2B956F0.../}} 102 }#56FEF2EFDB8B37E9C6E6D635749DF3169D5F005D 103 }#F671D562C7B9242900A286E1882EE64E5556FE9E module=consensus 104 I[10-04|13:54:30.408] Executed block module=state height=91 validTxs=0 invalidTxs=0 105 I[10-04|13:54:30.410] Committed state module=state height=91 txs=0 hash=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD 106 I[10-04|13:54:30.410] Recheck txs module=mempool numtxs=0 height=91 107 ``` 108 109 ## List of modules 110 111 Here is the list of modules you may encounter in CometBFT's log and a 112 little overview what they do. 113 114 - `abci-client` As mentioned in [Application Development Guide](../app-dev/abci-cli.md), CometBFT acts as an ABCI 115 client with respect to the application and maintains 3 connections: 116 mempool, consensus and query. The code used by CometBFT can 117 be found [here](https://github.com/cometbft/cometbft/blob/v0.37.x/abci/client). 118 - `blockchain` Provides storage, pool (a group of peers), and reactor 119 for both storing and exchanging blocks between peers. 120 - `consensus` The heart of CometBFT, which is the 121 implementation of the consensus algorithm. Includes two 122 "submodules": `wal` (write-ahead logging) for ensuring data 123 integrity and `replay` to replay blocks and messages on recovery 124 from a crash. 125 - `events` Simple event notification system. The list of events can be 126 found 127 [here](https://github.com/cometbft/cometbft/blob/v0.37.x/types/events.go). 128 You can subscribe to them by calling `subscribe` RPC method. Refer 129 to [RPC docs](./rpc.md) for additional information. 130 - `mempool` Mempool module handles all incoming transactions, whenever 131 they are coming from peers or the application. 132 - `p2p` Provides an abstraction around peer-to-peer communication. For 133 more details, please check out the 134 [README](https://github.com/cometbft/cometbft/blob/v0.37.x/p2p/README.md). 135 - `rpc` [CometBFT's RPC](./rpc.md). 136 - `rpc-server` RPC server. For implementation details, please read the 137 [doc.go](https://github.com/cometbft/cometbft/blob/v0.37.x/rpc/jsonrpc/doc.go). 138 - `state` Represents the latest state and execution submodule, which 139 executes blocks against the application. 140 - `types` A collection of the publicly exposed types and methods to 141 work with them.