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

Commit

Permalink
Problem:(CRO-541) no automated test for jailing, unjailing using live…
Browse files Browse the repository at this point in the history
…ness 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
  • Loading branch information
leejw51crypto committed Dec 11, 2019
1 parent 7d0f26c commit ac8b74c
Show file tree
Hide file tree
Showing 28 changed files with 1,620 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,33 @@ trigger:
event:
- push


---
kind: pipeline
type: exec
name: integration-tests-jail-unjail

platform:
os: linux
arch: amd64

steps:
- name: integration-tests
commands:
- cd integration-tests/jail
- ./run.sh
- name: teardown
commands:
- cd integration-tests/jail
- export JAIL_CLIENT_RPC=9981
- export JAIL_CHAIN_RPC=26657
- ./shutdown.sh
when:
status:
- success
- failure


---
kind: signature
hmac: dae5cd458b9f583fe5d3d01f64776c6af23ea9bd9a8c651db4f840ac2fb79d6c
Expand Down
132 changes: 132 additions & 0 deletions integration-tests/bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
Prerequisite
============

* [tendermint](https://tendermint.com/downloads) in PATH.
* [docker](https://docs.docker.com/install/) with ``integration-tests-chain-tx-enclave`` (or ``integration-tests-chain-tx-enclave-sw`` for software mode) image inside.
* binaries ``dev-utils`` ``client-cli`` ``chain-abci`` ``client-rpc`` in PATH.
* python3.7+

Install
=======

```
$ pip3 install git+https://github.com/yihuang/crypto-chain-bot.git
```

OR:

```
$ git clone https://github.com/yihuang/crypto-chain-bot.git
$ cd crypto-chain-bot
$ pip3 install -e .
```

Usage
=====

$ cd /path/to/testnet
$ chainbot.py gen 2 > cluster.json
$ cat cluster.json
{
"genesis_time": "2019-11-20T08:56:48.618137Z",
"rewards_pool": 0,
"nodes": [
{
"name": "node0",
"mnemonic": "sea hurdle public diesel family mushroom situate nasty act young smoke fantasy olive paddle talent",
"validator_seed": "da65e6e809413a217b03f77bb00800e9c36d8a2f11ff00669c412ec34e077225",
"node_seed": "dbbdd0c1e8ca293cd90ce9f417224bdfafdccb70e43cb2ed1732b2884c553773",
"bonded_coin": 2500000000000000000,
"unbonded_coin": 2500000000000000000,
"base_port": 26650
},
{
"name": "node1",
"mnemonic": "absent noble used scout unfair cannon attack brass review scrap soap legal sugar carpet warrior",
"validator_seed": "60ab92ba36ab4222ea4f986ea060399bb550ae6f7b7f885e69c9b0bbe88be39d",
"node_seed": "e2fc20e58511b7e313488cc953dc09ebae4fb50145170ffdd0fe159627d5f5d3",
"bonded_coin": 2500000000000000000,
"unbonded_coin": 2500000000000000000,
"base_port": 26660
}
],
"config_patch": [
{
"op": "replace",
"path": "/initial_fee_policy/base_fee",
"value": "0.0"
},
{
"op": "replace",
"path": "/initial_fee_policy/per_byte_fee",
"value": "0.0"
}
]
}
$ chainbot.py prepare cluster.json
$ ls -1 .
node0
node1
tasks.ini
cluster.json
$ supervisord -n -c tasks.ini

Manage the running processes:

$ supervisorctl -c tasks.ini
node0:chain-abci-node0 RUNNING pid 12080, uptime 0:00:13
node0:client-rpc-node0 RUNNING pid 12096, uptime 0:00:10
node0:tendermint-node0 RUNNING pid 12065, uptime 0:00:14
node0:tx-enclave-node0 RUNNING pid 12064, uptime 0:00:14
node1:chain-abci-node1 RUNNING pid 12081, uptime 0:00:13
node1:client-rpc-node1 RUNNING pid 12097, uptime 0:00:10
node1:tendermint-node1 RUNNING pid 12068, uptime 0:00:14
node1:tx-enclave-node1 RUNNING pid 12067, uptime 0:00:14

Port Usage
==========

* base-port: 26650 + (node_index * 10)
* tendermint-p2p-port: base-port + 6
* tendermint-rpc-port: base-port + 7
* chain-abci: base-port + 8
* tx-enclave: base-port + 0
* client-rpc-port: base-port + 9

``chainrpc.py``
===============

Wallet RPC
----------

$ chainrpc.py wallet restore 'winter kit mistake video congress crucial cement gaze seven certain fog cloud jeans brisk glue'
Default
$ chainrpc.py address list
0x7c1691e7ff768c83da2a2a6e22484adefc746c8f
$ chainrpc.py address create
0xda360623ad8a10360ff7afc9311b8dc0db024e98
$ chainrpc.py staking state 0xda360623ad8a10360ff7afc9311b8dc0db024e98
address: 0xda360623ad8a10360ff7afc9311b8dc0db024e98
bonded: 0
council_node: null
nonce: 0
punishment: null
unbonded: 5000000000000000000
unbonded_from: 1574240208
$ chainrpc.py address list --type transfer
dcro14rd97zpjh38a9l9sza4z7zzatfyjas04xy0yq3v75hmxdju7cwrs94yn76
$ chainrpc.py staking withdraw_all_unbonded_stake 0xda360623ad8a10360ff7afc9311b8dc0db024e98 dcro14rd97zpjh38a9l9sza4z7zzatfyjas04xy0yq3v75hmxdju7cwrs94yn76
d68732a45412f319b10e1bfe025e724c1e61e0a8ef80e8f490919cb4ed526b8c
$ chainrpc.py wallet balance
0
$ chainrpc.py wallet sync
$ chainrpc.py wallet balance
5000000000000000000

Tendermint RPC
---------------

$ chainrpc.py chain status
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"}}
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}
validator_info: {"address": "9004A42E6DD6E4D0A088F26EFF11A2DF699D0238", "pub_key": {"type": "tendermint/PubKeyEd25519", "value": "1GcI44AMk2O0puoBBszFCSzWIxlGQP8qOGiGBqUJ+Lk="}, "voting_power": "50000000000"}
Loading

0 comments on commit ac8b74c

Please sign in to comment.