Introduction

With configuration file, you can build your own test mitum network with the number of consensus nodes and can run it. The network of contest will produce the log messages and with it, you can watch how ISAAC+ and mitum works.

For example, this is simple contest configuration file:

sample.yml
1
2
3
4
5
6
7
 condition:
     all:
         node_state:
             - current_state="booting" AND new_state="joining"

         new_block:
             - m="new block created" AND block.height>=12

This config will check the 2 conditions on all nodes from json log messages and if matched log found, the output will be printed. The first condition is,

current_state="booting" AND new_state="joining"

This expression is from SQL-like, especially it is similar with a part of WHERE expression of SQL. This expression will check if the state of node changes from booting to joining.

m="new block created" AND block.height>=12

This expression will check if the message of log(m) is new block created and it’s block height(block.height) is over 12.

With this config file, contest can be run like this:

1
2
3
4
 $ ./contest run sample.yml \
     --log ./contest-sample \
     --number-of-nodes 4 \
     --exit-after 10s

The output will be:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 ...

 query: (and:(node = [n2]), (m = [new block created]), (block.height >= [12]), (block.round = [0]))
 matched log:
 {
   "level": "info",
   "node": "n2",
   "m": "new block created"
 }
 ================================================================================
 query: (and:(node = [n3]), (m = [new block created]), (block.height >= [12]), (block.round = [0]))
 matched log:
 {
   "level": "info",
   "node": "n3",
   "m": "new block created"
 }
 ================================================================================
 query: (and:(node = [n1]), (m = [new block created]), (block.height >= [12]), (block.round = [0]))
 matched log:
 {
   "level": "info",
   "node": "n1",
   "m": "new block created"
 }
 ================================================================================
 query: (and:(node = [n4]), (m = [new block created]), (block.height >= [12]), (block.round = [0]))
 matched log:
 {
   "level": "info",
   "node": "n4",
   "m": "new block created"
 }
 ================================================================================
 query: (and:(node = [n2]), (current_state = [booting]), (new_state = [joining]))
 matched log:
 {
   "level": "info",
   "node": "n2",
   "current_state": "booting",
   "new_state": "joining",
   "m": "state changed"
 }
 ================================================================================
 query: (and:(node = [n3]), (current_state = [booting]), (new_state = [joining]))
 matched log:
 {
   "level": "info",
   "node": "n3",
   "current_state": "booting",
   "new_state": "joining",
   "m": "state changed"
 }
 ================================================================================
 query: (and:(node = [n4]), (current_state = [booting]), (new_state = [joining]))
 matched log:
 {
   "level": "info",
   "node": "n4",
   "current_state": "booting",
   "new_state": "joining",
   "m": "state changed"
 }
 ================================================================================
 query: (and:(node = [n1]), (current_state = [booting]), (new_state = [joining]))
 matched log:
 {
   "level": "info",
   "node": "n1",
   "current_state": "booting",
   "new_state": "joining",
   "m": "state changed"
 }
 ================================================================================

 ...

 exit 0

The output of command will produce the result of checking conditions with the matched log messages.

Installation

The detailed instruction about installation is at Contest project page.