Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit e713bac

Browse files
committed
Problem:(CRO-541) no automated test for jailing, unjailing using liveness faults
add bin scripts add jailing intergration test add validators jail test show status check staked state after unjail wait for test activate jailing, unjailing intergration test tidy up tidy up add python error exit tidy up make apt install as one line use TENDERMINT_FLAG env variable remove ssh remove un-necessary script remove redundant code tidy up fix nix path add nix tidy up tidy up add nix path tidy up folders add path fix nix path tidy up port bind random port for simulataneous testing tidy up yml tidy up files activate test add zmq fix nix compile fix display compile zeromq fix jail.nix activate compiling fix toml remove config remove config recompile add clang change docker source fix FROM try with localhost change to url update chainbot tidy up tidy up ports tidy up assert tidy up python remove go0,go1 fix python exception remove ssh add tear down fix python test change name fix python exception warning tidy validators remove un-necessary assert remove un-necessary import update chainbot markdown apply dummy env tidy up do not use config directly remove tendermint argment handled in config.toml add project to docker-compose fix current_hash activate compile use project name in compiling support simultaneous running give enough time to boot up because if it's run simultaneously, 1/n times slower for tendermint, it takes long time~ restore to simple code make faster
1 parent 8bc35ce commit e713bac

28 files changed

+1627
-0
lines changed

.drone.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,33 @@ trigger:
122122
event:
123123
- push
124124

125+
126+
---
127+
kind: pipeline
128+
type: exec
129+
name: integration-tests-jail-unjail
130+
131+
platform:
132+
os: linux
133+
arch: amd64
134+
135+
steps:
136+
- name: integration-tests
137+
commands:
138+
- cd integration-tests/jail
139+
- ./run.sh
140+
- name: teardown
141+
commands:
142+
- cd integration-tests/jail
143+
- export JAIL_CLIENT_RPC=9981
144+
- export JAIL_CHAIN_RPC=26657
145+
- ./shutdown.sh
146+
when:
147+
status:
148+
- success
149+
- failure
150+
151+
125152
---
126153
kind: signature
127154
hmac: dae5cd458b9f583fe5d3d01f64776c6af23ea9bd9a8c651db4f840ac2fb79d6c

integration-tests/bot/README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
Prerequisite
2+
============
3+
4+
* [tendermint](https://tendermint.com/downloads) in PATH.
5+
* [docker](https://docs.docker.com/install/) with ``integration-tests-chain-tx-enclave`` (or ``integration-tests-chain-tx-enclave-sw`` for software mode) image inside.
6+
* binaries ``dev-utils`` ``client-cli`` ``chain-abci`` ``client-rpc`` in PATH.
7+
* python3.7+
8+
9+
Install
10+
=======
11+
12+
```
13+
$ pip3 install git+https://github.com/yihuang/crypto-chain-bot.git
14+
```
15+
16+
OR:
17+
18+
```
19+
$ git clone https://github.com/yihuang/crypto-chain-bot.git
20+
$ cd crypto-chain-bot
21+
$ pip3 install -e .
22+
```
23+
24+
Usage
25+
=====
26+
27+
$ cd /path/to/testnet
28+
$ chainbot.py gen 2 > cluster.json
29+
$ cat cluster.json
30+
{
31+
"genesis_time": "2019-11-20T08:56:48.618137Z",
32+
"rewards_pool": 0,
33+
"nodes": [
34+
{
35+
"name": "node0",
36+
"mnemonic": "sea hurdle public diesel family mushroom situate nasty act young smoke fantasy olive paddle talent",
37+
"validator_seed": "da65e6e809413a217b03f77bb00800e9c36d8a2f11ff00669c412ec34e077225",
38+
"node_seed": "dbbdd0c1e8ca293cd90ce9f417224bdfafdccb70e43cb2ed1732b2884c553773",
39+
"bonded_coin": 2500000000000000000,
40+
"unbonded_coin": 2500000000000000000,
41+
"base_port": 26650
42+
},
43+
{
44+
"name": "node1",
45+
"mnemonic": "absent noble used scout unfair cannon attack brass review scrap soap legal sugar carpet warrior",
46+
"validator_seed": "60ab92ba36ab4222ea4f986ea060399bb550ae6f7b7f885e69c9b0bbe88be39d",
47+
"node_seed": "e2fc20e58511b7e313488cc953dc09ebae4fb50145170ffdd0fe159627d5f5d3",
48+
"bonded_coin": 2500000000000000000,
49+
"unbonded_coin": 2500000000000000000,
50+
"base_port": 26660
51+
}
52+
],
53+
"config_patch": [
54+
{
55+
"op": "replace",
56+
"path": "/initial_fee_policy/base_fee",
57+
"value": "0.0"
58+
},
59+
{
60+
"op": "replace",
61+
"path": "/initial_fee_policy/per_byte_fee",
62+
"value": "0.0"
63+
}
64+
]
65+
}
66+
$ chainbot.py prepare cluster.json
67+
$ ls -1 .
68+
node0
69+
node1
70+
tasks.ini
71+
cluster.json
72+
$ supervisord -n -c tasks.ini
73+
74+
Manage the running processes:
75+
76+
$ supervisorctl -c tasks.ini
77+
node0:chain-abci-node0 RUNNING pid 12080, uptime 0:00:13
78+
node0:client-rpc-node0 RUNNING pid 12096, uptime 0:00:10
79+
node0:tendermint-node0 RUNNING pid 12065, uptime 0:00:14
80+
node0:tx-enclave-node0 RUNNING pid 12064, uptime 0:00:14
81+
node1:chain-abci-node1 RUNNING pid 12081, uptime 0:00:13
82+
node1:client-rpc-node1 RUNNING pid 12097, uptime 0:00:10
83+
node1:tendermint-node1 RUNNING pid 12068, uptime 0:00:14
84+
node1:tx-enclave-node1 RUNNING pid 12067, uptime 0:00:14
85+
86+
Port Usage
87+
==========
88+
89+
* base-port: 26650 + (node_index * 10)
90+
* tendermint-p2p-port: base-port + 6
91+
* tendermint-rpc-port: base-port + 7
92+
* chain-abci: base-port + 8
93+
* tx-enclave: base-port + 0
94+
* client-rpc-port: base-port + 9
95+
96+
``chainrpc.py``
97+
===============
98+
99+
Wallet RPC
100+
----------
101+
102+
$ chainrpc.py wallet restore 'winter kit mistake video congress crucial cement gaze seven certain fog cloud jeans brisk glue'
103+
Default
104+
$ chainrpc.py address list
105+
0x7c1691e7ff768c83da2a2a6e22484adefc746c8f
106+
$ chainrpc.py address create
107+
0xda360623ad8a10360ff7afc9311b8dc0db024e98
108+
$ chainrpc.py staking state 0xda360623ad8a10360ff7afc9311b8dc0db024e98
109+
address: 0xda360623ad8a10360ff7afc9311b8dc0db024e98
110+
bonded: 0
111+
council_node: null
112+
nonce: 0
113+
punishment: null
114+
unbonded: 5000000000000000000
115+
unbonded_from: 1574240208
116+
$ chainrpc.py address list --type transfer
117+
dcro14rd97zpjh38a9l9sza4z7zzatfyjas04xy0yq3v75hmxdju7cwrs94yn76
118+
$ chainrpc.py staking withdraw_all_unbonded_stake 0xda360623ad8a10360ff7afc9311b8dc0db024e98 dcro14rd97zpjh38a9l9sza4z7zzatfyjas04xy0yq3v75hmxdju7cwrs94yn76
119+
d68732a45412f319b10e1bfe025e724c1e61e0a8ef80e8f490919cb4ed526b8c
120+
$ chainrpc.py wallet balance
121+
0
122+
$ chainrpc.py wallet sync
123+
$ chainrpc.py wallet balance
124+
5000000000000000000
125+
126+
Tendermint RPC
127+
---------------
128+
129+
$ chainrpc.py chain status
130+
node_info: {"protocol_version": {"p2p": "7", "block": "10", "app": "0"}, "id": "3135de411a5028c61c12ab6635add83ead051342", "listen_addr": "tcp://0.0.0.0:26656", "network": "test-chain-y3m1e6-AB", "version": "0.32.7", "channels": "4020212223303800", "moniker": "node0", "other": {"tx_index": "on", "rpc_address": "tcp://127.0.0.1:26657"}}
131+
sync_info: {"latest_block_hash": "A4C30E0C9A2DC3630233AE8DD9459588CFE7994E6E47C0AE017FEB00AC119AE0", "latest_app_hash": "97500A2754824891C5E56FD39DCD2B670331232FDD9ABDCA07453E5F97F8D856", "latest_block_height": "180", "latest_block_time": "2019-11-26T08:45:42.203115Z", "catching_up": false}
132+
validator_info: {"address": "9004A42E6DD6E4D0A088F26EFF11A2DF699D0238", "pub_key": {"type": "tendermint/PubKeyEd25519", "value": "1GcI44AMk2O0puoBBszFCSzWIxlGQP8qOGiGBqUJ+Lk="}, "voting_power": "50000000000"}

0 commit comments

Comments
 (0)