diff --git a/integration-tests/all/run.sh b/integration-tests/all/run.sh new file mode 100755 index 000000000..eb9d9b83c --- /dev/null +++ b/integration-tests/all/run.sh @@ -0,0 +1,14 @@ +#!/bin/bash +./run_jail.sh +ret=$? +if [ $ret -ne 0 ]; then + echo "jail test fail" + exit -1 +fi + +./run_join.sh +ret=$? +if [ $ret -ne 0 ]; then + echo "join test fail" + exit -1 +fi diff --git a/integration-tests/all/run_jail.sh b/integration-tests/all/run_jail.sh new file mode 100755 index 000000000..46e6ee5cd --- /dev/null +++ b/integration-tests/all/run_jail.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd ../jail +./run.sh diff --git a/integration-tests/all/run_join.sh b/integration-tests/all/run_join.sh new file mode 100755 index 000000000..63ef9db79 --- /dev/null +++ b/integration-tests/all/run_join.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd ../join +./run.sh diff --git a/integration-tests/bot/chainbot.py b/integration-tests/bot/chainbot.py index 6b9ad735f..141ab463f 100755 --- a/integration-tests/bot/chainbot.py +++ b/integration-tests/bot/chainbot.py @@ -15,6 +15,7 @@ import fire import toml import nacl.signing +import copy from nacl.encoding import HexEncoder PASSPHRASE = '123456' @@ -340,7 +341,16 @@ async def gen_wallet_addr(mnemonic, type='Staking', count=1): return addrs -async def gen_genesis(cfg): +async def gen_genesis(cfg_orig): + cfg = copy.deepcopy(cfg_orig) + newnodes= [] + for n in cfg["nodes"]: + print(n) + if n["bonded_coin"]> 0: + newnodes.append(n) + cfg["nodes"]= newnodes + + genesis = { "genesis_time": cfg['genesis_time'], "chain_id": cfg['chain_id'], diff --git a/integration-tests/bot/chainrpc.py b/integration-tests/bot/chainrpc.py index 3336c3139..fbe4ef84c 100755 --- a/integration-tests/bot/chainrpc.py +++ b/integration-tests/bot/chainrpc.py @@ -183,6 +183,9 @@ def withdraw_all_unbonded(self, from_address, to_address, view_keys=None, name=D def unjail(self, address, name=DEFAULT_WALLET, enckey=None): return call('staking_unjail', [name, enckey or get_enckey()], fix_address(address)) + def join(self, node_name, node_pubkey, node_staking_address, name=DEFAULT_WALLET, enckey=None): + return call('staking_validatorNodeJoin', [name, enckey or get_enckey()], node_name, node_pubkey, fix_address(node_staking_address)) + class MultiSig: def create_address(self, public_keys, self_public_key, required_signatures, name=DEFAULT_WALLET, enckey=None): diff --git a/integration-tests/bot/jail_test.py b/integration-tests/bot/jail_test.py index dbecc9795..97d5b4ec8 100755 --- a/integration-tests/bot/jail_test.py +++ b/integration-tests/bot/jail_test.py @@ -19,6 +19,16 @@ def __init__(self) : # wallet b self.node1_address = "" self.node1_mnemonics="" + + # wallet b + self.node2_address = "" + self.node2_mnemonics="" + + self.keya="" + self.keyb="" + self.keyc="" + + self.headers = { 'Content-Type': 'application/json', } @@ -39,29 +49,32 @@ def get_containers(self) : - def get_staking_state(self,name, passphrase, addr): - return self.rpc.staking.state(addr, name) + def get_staking_state(self,name, enckey, addr): + return self.rpc.staking.state(addr, name, enckey) - def create_staking_address(self,name, passphrase): - return self.rpc.address.create(name,'staking') + def create_staking_address(self,name, enckey): + return self.rpc.address.create(name,'staking', enckey) def restore_wallets(self): print("restore wallets") self.rpc.wallet.restore(self.node0_mnemonics, "a") self.rpc.wallet.restore(self.node1_mnemonics, "b") + self.rpc.wallet.restore(self.node2_mnemonics, "c") def create_addresses(self): - self.create_staking_address("a", "1") - self.create_staking_address("a", "1") - self.create_staking_address("b", "1") - self.create_staking_address("b", "1") + self.create_staking_address("a", self.keya) + self.create_staking_address("a", self.keya) + self.create_staking_address("b", self.keyb) + self.create_staking_address("b", self.keyb) + self.create_staking_address("c", self.keyc) + self.create_staking_address("c", self.keyc) - def unjail(self,name, passphrase, address): + def unjail(self,name, enckey, address): try: - return self.rpc.staking.unjail(address, name) + return self.rpc.staking.unjail(address, name, enckey) except jsonrpcclient.exceptions.JsonRpcClientError as ex: print("unjail fail={}".format(ex)) @@ -131,8 +144,8 @@ def test_unjailing(self) : self.check_validators() if remain_time< 0 : assert False - self.unjail("b","1", self.node1_address) - state= self.get_staking_state("b","1", self.node1_address) + self.unjail("b",self.keyb, self.node1_address) + state= self.get_staking_state("b",self.keyb, self.node1_address) print("state {}".format(state)) punishment=state["punishment"] print("{0} remain time={1:.2f} punishment {2}".format(datetime.datetime.now(), remain_time, punishment)) @@ -151,9 +164,18 @@ def main (self) : self.restore_wallets() except jsonrpcclient.exceptions.JsonRpcClientError as ex: print("wallet already exists={}".format(ex)) + self.keya=self.rpc.wallet.enckey("a") + self.keyb=self.rpc.wallet.enckey("b") + self.keyc=self.rpc.wallet.enckey("c") self.create_addresses() self.test_unjailing() + def main2 (self) : + try : + self.restore_wallets() + except jsonrpcclient.exceptions.JsonRpcClientError as ex: + print("wallet already exists={}".format(ex)) + self.create_addresses() def read_info(self): print("read data") @@ -162,16 +184,20 @@ def read_info(self): print(json.dumps(data,indent=4)) self.node0_address= data["nodes"][0]["staking"][0] self.node1_address= data["nodes"][1]["staking"][0] + self.node2_address= data["nodes"][2]["staking"][0] self.node0_mnemonics=data["nodes"][0]["mnemonic"] self.node1_mnemonics=data["nodes"][1]["mnemonic"] + self.node2_mnemonics=data["nodes"][2]["mnemonic"] def display_info(self): print("jail test current hash={}".format(CURRENT_HASH)) print("node0 staking= {}".format(self.node0_address)) print("node1 staking= {}".format(self.node1_address)) + print("node2 staking= {}".format(self.node2_address)) print("node0 mnemonics= {}".format(self.node0_mnemonics)) print("node1 mnemonics= {}".format(self.node1_mnemonics)) + print("node2 mnemonics= {}".format(self.node2_mnemonics)) p = Program() diff --git a/integration-tests/bot/join_test.py b/integration-tests/bot/join_test.py new file mode 100755 index 000000000..ec5a79a12 --- /dev/null +++ b/integration-tests/bot/join_test.py @@ -0,0 +1,337 @@ +#!/usr/bin/python3 +import docker +import json +import requests +import datetime +import time +import jsonrpcclient +from chainrpc import RPC, Blockchain +from decouple import config +from chainbot import SigningKey +CURRENT_HASH = config('CURRENT_HASH', '') +class Program : + def __init__(self) : + self.rpc = RPC() + self.blockchain = Blockchain() + # wallet a + self.node0_address = "" + self.node0_address1 = "" + self.node0_transfer_address = "" + self.node0_mnemonics= "" + + # wallet b + self.node1_address = "" + self.node1_address1= "" + self.node1_transfer_address = "" + self.node1_mnemonics="" + + # wallet b + self.node2_address = "" + self.node2_mnemonics="" + + # keys + self.keya="" + self.keyb="" + self.keyc="" + + self.headers = { + 'Content-Type': 'application/json', + } + + def get_containers(self) : + client = docker.from_env() + containers= client.containers.list() + ret= {} + for container in containers: + id = container + #ret[id.name]= id.id + ret[id.name]= container + return ret + + + #show_containers() + # tendermint rpc + + + + def get_staking_state(self,name, enckey, addr): + return self.rpc.staking.state(addr, name, enckey) + + + def create_staking_address(self,name, enckey): + return self.rpc.address.create(name,'staking', enckey) + + def activate_sync(self): + print("activate sync") + self.rpc.wallet.sync_unlock("a", self.rpc.wallet.enckey("a")) + self.rpc.wallet.sync_unlock("b", self.rpc.wallet.enckey("b")) + self.rpc.wallet.sync_unlock("c", self.rpc.wallet.enckey("c")) + + def restore_wallets(self): + print("restore wallets") + self.rpc.wallet.restore(self.node0_mnemonics, "a") + self.rpc.wallet.restore(self.node1_mnemonics, "b") + self.rpc.wallet.restore(self.node2_mnemonics, "c") + + + def create_addresses(self): + self.create_staking_address("a", self.keya) + self.create_staking_address("a", self.keya) + self.create_staking_address("b", self.keyb) + self.create_staking_address("b", self.keyb) + self.create_staking_address("c", self.keyc) + self.create_staking_address("c", self.keyc) + + + def unjail(self,name, enckey, address): + try: + return self.rpc.staking.unjail(address, name, enckey) + except jsonrpcclient.exceptions.JsonRpcClientError as ex: + print("unjail fail={}".format(ex)) + + def check_validators(self) : + try: + x= self.rpc.chain.validators() + print(x) + data =len(x["validators"]) + return data + except requests.ConnectionError: + return 0 + + def check_validators_old(self) : + x=self.blockchain.validators()["validators"] + print("check validators") + data =len(x) + print("count={} check_validators={}".format(data,x)) + return data + + + def wait_for_ready(self,count) : + initial_time=time.time() # in seconds + MAX_TIME = 3600 + while True: + current_time= time.time() + elasped_time= current_time - initial_time + remain_time = MAX_TIME - elasped_time + validators=self.check_validators() + if remain_time< 0 : + assert False + print("{0} remain time={1:.2f} current validators={2} waiting for validators={3}".format(datetime.datetime.now(), remain_time, validators, count)) + if count== validators : + print("validators ready") + break + time.sleep(10) + + + def test_jailing(self) : + print("test jailing") + self.wait_for_ready(2) + containers=self.get_containers() + print(containers) + assert "{}_chain1_1".format(CURRENT_HASH) in containers + print("wait for jailing") + time.sleep(10) + jailthis = containers["{}_chain1_1".format(CURRENT_HASH)] + print("jail = " , jailthis) + jailthis.kill() + self.wait_for_ready(1) + #jailed + containers=self.get_containers() + print(containers) + assert "{}_chain1_1".format(CURRENT_HASH) not in containers + print("jail test success") + + + def test_unjailing(self) : + initial_time=time.time() # in seconds + print("test unjailing") + self.wait_for_ready(1) + + MAX_TIME = 3600 + while True: + current_time= time.time() + elasped_time= current_time - initial_time + remain_time = MAX_TIME - elasped_time + self.check_validators() + if remain_time< 0 : + assert False + self.unjail("b", self.keyb, self.node1_address) + state= self.get_staking_state("b", self.keyb, self.node1_address) + print("state {}".format(state)) + punishment=state["punishment"] + print("{0} remain time={1:.2f} punishment {2}".format(datetime.datetime.now(), remain_time, punishment)) + if punishment is None : + print("unjailed!!") + break + else : + print("still jailed") + time.sleep(10) + print("unjail test success") + + ############################################################################3 + def main2 (self) : + self.test_jailing() + try : + self.restore_wallets() + self.activate_sync() + except jsonrpcclient.exceptions.JsonRpcClientError as ex: + print("wallet already exists={}".format(ex)) + self.create_addresses() + self.test_unjailing() + + def prepare(self) : + try : + self.restore_wallets() + except jsonrpcclient.exceptions.JsonRpcClientError as ex: + print("wallet already exists={}".format(ex)) + self.keya=self.rpc.wallet.enckey("a") + self.keyb=self.rpc.wallet.enckey("b") + self.keyc=self.rpc.wallet.enckey("c") + self.create_addresses() + self.rpc.wallet.sync_unlock("a", self.keya) + self.rpc.wallet.sync_unlock("b", self.keyb) + + def deposit(self): + transactions= self.rpc.wallet.transactions("b", 0,1, False, self.keyb) + assert len(transactions)==1 + tx= transactions[0] + txid= tx["transaction_id"] + tx_index=0 + print("txid={}".format(txid)) + print(transactions) + deposit_address=self.node1_address + print("deposit to {} from utxo tx {}-index {}".format(deposit_address, txid, tx_index)) + self.rpc.staking.deposit(deposit_address, [{'id':txid, 'index':tx_index}], "b", self.keyb) + print("done") + + + def withdraw(self): + self.rpc.staking.withdraw_all_unbonded(self.node0_address1, self.node0_transfer_address,[], "a", self.keya) + self.rpc.wallet.sync("a", self.keya) + time.sleep(2) + + def transfer(self): + balance_a= int(self.rpc.wallet.balance("a", self.keya)["total"]) + viewkey_a= self.rpc.wallet.view_key("a", False, self.keya) + balance_b= int(self.rpc.wallet.balance("b", self.keyb)["total"]) + viewkey_b= self.rpc.wallet.view_key("b", False, self.keyb) + print("a balance={} viewkey={}".format(balance_a, viewkey_a)) + print(balance_a) + print("b balance={} viewkey={}".format(balance_b, viewkey_b)) + print("====================================") + self.rpc.wallet.send(self.node1_transfer_address,balance_a, "a", [viewkey_a,viewkey_b], self.keya) + time.sleep(5) + self.rpc.wallet.sync("a", self.keya) + self.rpc.wallet.sync("b", self.keyb) + balance_a= int(self.rpc.wallet.balance("a", self.keya)["total"]) + viewkey_a= self.rpc.wallet.view_key("a", False, self.keya) + balance_b= int(self.rpc.wallet.balance("b", self.keyb)["total"]) + viewkey_b= self.rpc.wallet.view_key("b", False, self.keyb) + print("a balance={} viewkey={}".format(balance_a, viewkey_a)) + print("b balance={} viewkey={}".format(balance_b, viewkey_b)) + time.sleep(2) + + def wait_for_rpc(self): + while True: + try: + wallets= self.rpc.wallet.list() + break + except requests.exceptions.ConnectionError as ex: + print("connection fail {}".format(datetime.datetime.now())) + time.sleep(5) + print(json.dumps(wallets, indent=4)) + + def join_node(self): + print("join node") + time.sleep(4); + self.rpc.wallet.sync("b", self.keyb) + node_name="node1" + node_pubkey=self.node1_validator_pubkey + node_staking_address= self.node1_address + print("name={} pubkey={} staking={}".format(node_name, node_pubkey,node_staking_address)) + self.rpc.staking.join(node_name, node_pubkey, node_staking_address, "b", self.keyb) + + def wait_for_council_node(self): + print("wait for council node") + while True: + res = self.rpc.staking.state( self.node1_address, "b",self.keyb) + print("state={}".format(res)) + time.sleep(2) + if res["council_node"] != None : + break + print("join success {} became a council node".format(self.node1_address)) + + def wait_for_validators(self): + print("wait for validators") + while True: + validators=self.check_validators() + print("validators count={}".format(validators)) + time.sleep(2) + if validators >= 2: + break + print("join success validator count {}".format(validators)) + + + + def main (self) : + self.wait_for_rpc() + self.prepare() + self.withdraw() + self.transfer() + self.deposit() + self.join_node() + self.wait_for_council_node() + self.wait_for_validators() + + + def read_info(self): + print("read data") + with open('info.json') as json_file: + data = json.load(json_file) + print(json.dumps(data,indent=4)) + self.node0_address= data["nodes"][0]["staking"][0] + self.node0_address1= data["nodes"][0]["staking"][1] + self.node0_transfer_address= data["nodes"][0]["transfer"][0] + self.node0_validator_seed=data["nodes"][0]["validator_seed"] + self.node0_validator_pubkey= SigningKey(self.node0_validator_seed).pub_key_base64() + + + + self.node1_address= data["nodes"][1]["staking"][0] + self.node1_address1= data["nodes"][1]["staking"][1] + self.node1_transfer_address= data["nodes"][1]["transfer"][0] + self.node1_validator_seed=data["nodes"][1]["validator_seed"] + self.node1_validator_pubkey= SigningKey(self.node1_validator_seed).pub_key_base64() + + + self.node2_address= data["nodes"][2]["staking"][0] + + self.node0_mnemonics=data["nodes"][0]["mnemonic"] + self.node1_mnemonics=data["nodes"][1]["mnemonic"] + self.node2_mnemonics=data["nodes"][2]["mnemonic"] + self.node2_validator_seed=data["nodes"][2]["validator_seed"] + self.node2_validator_pubkey= SigningKey(self.node2_validator_seed).pub_key_base64() + + def display_info(self): + print("jail test current hash={}".format(CURRENT_HASH)) + print("node0 staking= {}".format(self.node0_address)) + print("node0 staking1= {}".format(self.node0_address1)) + print("node0 transfer= {}".format(self.node0_transfer_address)) + print("node1 staking= {}".format(self.node1_address)) + print("node2 staking= {}".format(self.node2_address)) + print("node0 mnemonics= {}".format(self.node0_mnemonics)) + print("node1 mnemonics= {}".format(self.node1_mnemonics)) + print("node2 mnemonics= {}".format(self.node2_mnemonics)) + print("node0 validator seed= {}".format(self.node0_validator_seed)) + print("node0 validator pubkey= {}".format(self.node0_validator_pubkey)) + print("node1 validator seed= {}".format(self.node1_validator_seed)) + print("node1 validator pubkey= {}".format(self.node1_validator_pubkey)) + print("node2 validator seed= {}".format(self.node2_validator_seed)) + print("node2 validator pubkey= {}".format(self.node2_validator_pubkey)) + + + +p = Program() +p.read_info() +p.display_info() +p.main() diff --git a/integration-tests/bot/make.py b/integration-tests/bot/make.py index 1509f4992..14b5483d4 100755 --- a/integration-tests/bot/make.py +++ b/integration-tests/bot/make.py @@ -4,16 +4,20 @@ import jsonpatch a = CLI() print("make config") -src=a._gen(count=2, chain_id='test-ab', expansion_cap=50000000000000000, root_path='./', hostname='localhost') +src=a._gen(count=3, chain_id='test-ab', expansion_cap=50000000000000000, root_path='./', hostname='localhost') patch = jsonpatch.JsonPatch([ {'op': 'replace', 'path': '/nodes/0/bonded_coin', 'value': 3750000000000000000}, {'op': 'replace', 'path': '/nodes/0/unbonded_coin', 'value': 1250000000000000000}, {'op': 'replace', 'path': '/nodes/1/bonded_coin', 'value': 1250000000000000000}, {'op': 'replace', 'path': '/nodes/1/unbonded_coin', 'value': 3700000000000000000}, + {'op': 'replace', 'path': '/nodes/2/bonded_coin', 'value': 0}, + {'op': 'replace', 'path': '/nodes/2/unbonded_coin', 'value': 0}, {'op': 'replace', 'path': '/nodes/0/base_port', 'value':26650}, {'op': 'replace', 'path': '/nodes/1/base_port', 'value':26650}, + {'op': 'replace', 'path': '/nodes/2/base_port', 'value':26650}, {'op': 'replace', 'path': '/nodes/0/hostname', 'value':'chain0'}, {'op': 'replace', 'path': '/nodes/1/hostname', 'value':'chain1'}, + {'op': 'replace', 'path': '/nodes/2/hostname', 'value':'chain2'}, {'op': 'add', 'path': '/chain_config_patch/2', 'value': {"op":"replace", "path":"/slashing_config/slash_wait_period", "value":10} }, {'op': 'add', 'path': '/chain_config_patch/3', 'value': {"op":"replace", "path":"/jailing_config/jail_duration", "value":86} }, {'op': 'add', 'path': '/chain_config_patch/4', 'value': {"op":"replace", "path":"/jailing_config/block_signing_window", "value":20} }, diff --git a/integration-tests/bot/make_join.py b/integration-tests/bot/make_join.py new file mode 100755 index 000000000..18e315a23 --- /dev/null +++ b/integration-tests/bot/make_join.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from chainbot import CLI +import json +import jsonpatch +a = CLI() +print("make config") +src=a._gen(count=3, chain_id='test-ab', expansion_cap=50000000000000000, root_path='./', hostname='localhost') +patch = jsonpatch.JsonPatch([ + {'op': 'replace', 'path': '/nodes/0/bonded_coin', 'value': 3750000000000000000}, + {'op': 'replace', 'path': '/nodes/0/unbonded_coin', 'value': 1250000000000000000}, + {'op': 'replace', 'path': '/nodes/1/bonded_coin', 'value': 0}, + {'op': 'replace', 'path': '/nodes/1/unbonded_coin', 'value': 0}, + {'op': 'replace', 'path': '/nodes/2/bonded_coin', 'value': 0}, + {'op': 'replace', 'path': '/nodes/2/unbonded_coin', 'value': 0}, + {'op': 'replace', 'path': '/nodes/0/base_port', 'value':26650}, + {'op': 'replace', 'path': '/nodes/1/base_port', 'value':26650}, + {'op': 'replace', 'path': '/nodes/2/base_port', 'value':26650}, + {'op': 'replace', 'path': '/nodes/0/hostname', 'value':'chain0'}, + {'op': 'replace', 'path': '/nodes/1/hostname', 'value':'chain1'}, + {'op': 'replace', 'path': '/nodes/2/hostname', 'value':'chain2'}, + {'op': 'add', 'path': '/chain_config_patch/2', 'value': {"op":"replace", "path":"/slashing_config/slash_wait_period", "value":10} }, + {'op': 'add', 'path': '/chain_config_patch/3', 'value': {"op":"replace", "path":"/jailing_config/jail_duration", "value":86} }, + {'op': 'add', 'path': '/chain_config_patch/4', 'value': {"op":"replace", "path":"/jailing_config/block_signing_window", "value":20} }, + {'op': 'add', 'path': '/chain_config_patch/5', 'value': {"op":"replace", "path":"/jailing_config/missed_block_threshold", "value":10} }, +]) + + +dst=jsonpatch.apply_patch(src, patch) +print(json.dumps(dst, indent=4)) +a._prepare(dst) +apphash= json.load(open('./node0/tendermint/config/genesis.json'))['app_hash'] +f = open("run_test_env.sh", "w") +f.write("export APP_HASH={}\n".format(apphash)) +f.close() + +print("apphash=", apphash) + +print(json.dumps(dst, indent=4)) + + + + diff --git a/integration-tests/jail/Dockerfile b/integration-tests/jail/Dockerfile index e1502e4bf..39fc1a771 100644 --- a/integration-tests/jail/Dockerfile +++ b/integration-tests/jail/Dockerfile @@ -9,12 +9,7 @@ RUN sed -i 's/security.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list RUN sed -i 's/archive.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list RUN apt-get update RUN apt install -y --no-install-recommends whois wget curl python3 libssl-dev libcurl4-openssl-dev libelf-dev libdw-dev gcc binutils-dev libc6-dev pkg-config build-essential openssh-server cmake libgflags-dev libzmq3-dev pkg-config libssl-dev libzmq3-dev unzip tmux -ENV SGX_MODE=SW -ENV NETWORK_ID=AB -ENV RUSTFLAGS=-Ctarget-feature=+aes,+ssse3 ENV PATH=$HOME/bin:$PATH -ENV APP_PORT=25933 -ENV TX_ENCLAVE_STORAGE=/enclave-storage ENV LD_LIBRARY_PATH=$HOME/lib ENV PKG_CONFIG_PATH=$HOME/lib/pkgconfig RUN mkdir /root/bin diff --git a/integration-tests/jail/compile/Dockerfile b/integration-tests/jail/compile/Dockerfile index eb8400a6e..bd9a323bc 100644 --- a/integration-tests/jail/compile/Dockerfile +++ b/integration-tests/jail/compile/Dockerfile @@ -9,7 +9,7 @@ RUN sed -i 's/security.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list RUN sed -i 's/archive.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list RUN apt-get update RUN apt install -y --no-install-recommends whois wget curl python3 libssl-dev libcurl4-openssl-dev libelf-dev libdw-dev gcc binutils-dev libc6-dev pkg-config build-essential openssh-server cmake libgflags-dev libzmq3-dev pkg-config libssl-dev libzmq3-dev unzip tmux clang -ENV SGX_MODE=SW +ENV SGX_MODE=HW ENV NETWORK_ID=AB ENV RUSTFLAGS=-Ctarget-feature=+aes,+ssse3 ENV PATH=$HOME/bin:$PATH diff --git a/integration-tests/jail/disk/bin/abci.sh b/integration-tests/jail/disk/bin/abci.sh index 8444781d0..ae3072896 100755 --- a/integration-tests/jail/disk/bin/abci.sh +++ b/integration-tests/jail/disk/bin/abci.sh @@ -1,2 +1,2 @@ #!/bin/bash -./chain-abci --host 0.0.0.0 --port 26658 --chain_id test-ab --genesis_app_hash $APP_HASH --enclave_server tcp://127.0.0.1:25933 --tx_query tcp://127.0.0.1:25933 +./chain-abci --host 0.0.0.0 --port 26658 --chain_id test-ab --genesis_app_hash $APP_HASH --enclave_server tcp://127.0.0.1:25933 --tx_query 127.0.0.1:3443 diff --git a/integration-tests/jail/disk/bin/query/query.sh b/integration-tests/jail/disk/bin/query/query.sh new file mode 100755 index 000000000..d271ac1a5 --- /dev/null +++ b/integration-tests/jail/disk/bin/query/query.sh @@ -0,0 +1,2 @@ +#!/bin/bash +LD_LIBRARY_PATH=$PWD ./tx-query-app 0.0.0.0:3443 tcp://127.0.0.1:25933 diff --git a/integration-tests/jail/disk/go_compile.sh b/integration-tests/jail/disk/go_compile.sh index 1b98c9c3f..883e221b0 100755 --- a/integration-tests/jail/disk/go_compile.sh +++ b/integration-tests/jail/disk/go_compile.sh @@ -13,13 +13,27 @@ echo "rust flags=" $RUSTFLAGS echo "app port=" $APP_PORT echo "compile chain" pwd -ls -cd /root/chain -cargo clean -cargo build + + cd /root/chain/chain-tx-enclave/tx-validation make clean make +ret=$? +if [ $ret -ne 0 ]; then + exit -1 +fi +cd /root + +cd /root/chain/chain-tx-enclave/tx-query +make clean +make +ret=$? +if [ $ret -ne 0 ]; then + exit -1 +fi +cd /root + + cd /root cp /root/chain/target/debug/client-rpc /root/disk/bin cp /root/chain/target/debug/client-cli /root/disk/bin @@ -27,5 +41,8 @@ cp /root/chain/target/debug/chain-abci /root/disk/bin cp /root/chain/target/debug/dev-utils /root/disk/bin cp /root/chain/chain-tx-enclave/tx-validation/bin/enclave.signed.so /root/disk/bin cp /root/chain/chain-tx-enclave/tx-validation/bin/tx-validation-app /root/disk/bin +mkdir /root/disk/bin/query +cp /root/chain/chain-tx-enclave/tx-query/bin/enclave.signed.so /root/disk/bin/query +cp /root/chain/chain-tx-enclave/tx-query/bin/tx-query-app /root/disk/bin/query cp /root/bin/tendermint /root/disk/bin echo "copied OK" diff --git a/integration-tests/jail/disk/go_test.sh b/integration-tests/jail/disk/go_test.sh index 156f75b3b..5ce99f4d9 100755 --- a/integration-tests/jail/disk/go_test.sh +++ b/integration-tests/jail/disk/go_test.sh @@ -8,7 +8,7 @@ rm -rf /enclave-storage echo "copy binaries" mkdir /root/bin echo "copy tendermint config" -cp /root/disk/bin/* /root/bin +cp -Rf /root/disk/bin/* /root/bin mkdir /root/.tendermint mkdir /root/.tendermint/config cp /root/config/* /root/.tendermint/config diff --git a/integration-tests/jail/disk/launch.sh b/integration-tests/jail/disk/launch.sh index 236037c04..69a25c6da 100755 --- a/integration-tests/jail/disk/launch.sh +++ b/integration-tests/jail/disk/launch.sh @@ -10,6 +10,13 @@ echo "activate enclave" nohup ./enclave.sh > enclave.log & sleep 2 +echo "activate query" +cd ./query +nohup ./query.sh > query.log & +cd .. +sleep 2 + + echo "activate abci" nohup ./abci.sh > abci.log & sleep 2 diff --git a/integration-tests/jail/disk/prepare.sh b/integration-tests/jail/disk/prepare.sh index 71816e88f..5c899ce6b 100755 --- a/integration-tests/jail/disk/prepare.sh +++ b/integration-tests/jail/disk/prepare.sh @@ -1,5 +1,5 @@ #!/bin/bash -export SGX_MODE=SW +export SGX_MODE=HW export NETWORK_ID=AB export RUSTFLAGS=-Ctarget-feature=+aes,+ssse3 export PATH=$HOME/.cargo/bin:$HOME/bin:$PATH diff --git a/integration-tests/jail/docker-compose.yml b/integration-tests/jail/docker-compose.yml index 225869738..6b8b0c46a 100644 --- a/integration-tests/jail/docker-compose.yml +++ b/integration-tests/jail/docker-compose.yml @@ -6,6 +6,10 @@ services: volumes: - ./disk:/root/disk - ./disk/config0:/root/config + - /nix:/nix + devices: + - /dev/isgx + - /dev/sgx image: chain_test0 ports: - ${JAIL_CLIENT_RPC:-9981}:9981 @@ -15,14 +19,33 @@ services: RUST_BACKTRACE: 1 RUST_LOG: debug APP_HASH: $APP_HASH + SPID: $SPID + IAS_API_KEY: $IAS_API_KEY + SGX_MODE: HW + NETWORK_ID: AB + RUSTFLAGS: -Ctarget-feature=+aes,+ssse3 + APP_PORT: 25933 + TX_ENCLAVE_STORAGE: /enclave-storage + chain1: build: . volumes: - ./disk:/root/disk - ./disk/config1:/root/config + - /nix:/nix + devices: + - /dev/isgx + - /dev/sgx image: chain_test1 command: /root/disk/go_test.sh environment: RUST_BACKTRACE: 1 RUST_LOG: debug APP_HASH: $APP_HASH + SPID: $SPID + IAS_API_KEY: $IAS_API_KEY + SGX_MODE: HW + NETWORK_ID: AB + RUSTFLAGS: -Ctarget-feature=+aes,+ssse3 + APP_PORT: 25933 + TX_ENCLAVE_STORAGE: /enclave-storage diff --git a/integration-tests/jail/go.sh b/integration-tests/jail/go.sh new file mode 100755 index 000000000..87c1beda1 --- /dev/null +++ b/integration-tests/jail/go.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker run --rm -it -v $PWD/disk:/root/disk -v /nix:/nix -v /opt/intel:/opt/intel -v $HOME/Github:/root/Github --device /dev/isgx my diff --git a/integration-tests/jail/run_compile.sh b/integration-tests/jail/run_compile.sh index 62254f740..69876baeb 100755 --- a/integration-tests/jail/run_compile.sh +++ b/integration-tests/jail/run_compile.sh @@ -1,9 +1,43 @@ #!/bin/bash echo "compile binaries" -cd ./compile +SRC=../../target/debug +FILE=./disk/bin +export CURRENT_HASH=$(git rev-parse HEAD) +echo "compile enclave" +if [ -f "$FILE/tx-validation-app" ] && [ -f "$FILE/query/tx-query-app" ] +then + echo "sgx binaries ready" +else + cd ./compile + echo "compile CURRENT_HASH=" $CURRENT_HASH + docker-compose -p $CURRENT_HASH up + cd .. +fi + + + +if [ -f "$FILE/client-rpc" ] && [ -f "$FILE/client-cli" ] && [ -f "$FILE/chain-abci" ] && [ -f "$FILE/dev-utils" ] +then + echo "binaries ready" +else + echo "compile chain" + nix-shell rust.nix --run "cargo build" + cp $SRC/client-rpc $FILE/client-rpc + cp $SRC/client-cli $FILE/client-cli + cp $SRC/chain-abci $FILE/chain-abci + cp $SRC/dev-utils $FILE/dev-utils +fi + + + +echo "check binaries" +if [ -f "$FILE/client-rpc" ] && [ -f "$FILE/client-cli" ] && [ -f "$FILE/chain-abci" ] && [ -f "$FILE/dev-utils" ]&& [ -f "$FILE/tx-validation-app" ] && [ -f "$FILE/query/tx-query-app" ] + +then + echo "compile scuccesss" +else + echo "compile failed" + exit -1 +fi -export CURRENT_HASH=$(git rev-parse HEAD) -echo "compile CURRENT_HASH=" $CURRENT_HASH -docker-compose -p $CURRENT_HASH up -cd .. diff --git a/integration-tests/jail/run_test.sh b/integration-tests/jail/run_test.sh index 40dd961de..1ff9120ae 100755 --- a/integration-tests/jail/run_test.sh +++ b/integration-tests/jail/run_test.sh @@ -1,8 +1,8 @@ #!/bin/bash echo "run test" -. run_open_port.sh -. run_test_env.sh +. ./run_open_port.sh +. ./run_test_env.sh echo "client rpc port="$JAIL_CLIENT_RPC echo "chain rpc port="$JAIL_CHAIN_RPC @@ -17,3 +17,4 @@ ret=$? if [ $ret -ne 0 ]; then exit -1 fi +docker-compose -p $CURRENT_HASH down diff --git a/integration-tests/jail/rust.nix b/integration-tests/jail/rust.nix new file mode 100644 index 000000000..ec48a3d5c --- /dev/null +++ b/integration-tests/jail/rust.nix @@ -0,0 +1,25 @@ +with import {}; + +stdenv.mkDerivation { + name = "rust-env"; + nativeBuildInputs = [ + rustc cargo + ]; + LIBCLANG_PATH="${llvmPackages.libclang}/lib"; + buildInputs = [ + # Example Run-time Additional Dependencies + openssl zeromq rocksdb clang gcc pkgconfig binutils-unwrapped gdb llvm + ]; + + shellHook = '' + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "zeromq-[0-9\.]+$" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "clang-[0-9\.]+$" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "libffi-[0-9\.]+$" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "llvm_6.0" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "gcc-6.5.0-lib" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "libedit" | head -n1)/lib":$LD_LIBRARY_PATH + ''; + + # Set Environment Variables + RUST_BACKTRACE = 1; +} diff --git a/integration-tests/join/Dockerfile b/integration-tests/join/Dockerfile new file mode 100644 index 000000000..07966e2ba --- /dev/null +++ b/integration-tests/join/Dockerfile @@ -0,0 +1,15 @@ +FROM cryptocom/chain:latest +LABEL maintainer="Crypto.com" +RUN echo 'source /opt/sgxsdk/environment' >> /root/.docker_bashrc +RUN echo 'source /root/.cargo/env' >> /root/.docker_bashrc +RUN rm -rf /var/lib/apt/lists/* +RUN apt-get clean +RUN sed -i 's/old-releases.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list +RUN sed -i 's/security.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list +RUN sed -i 's/archive.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list +RUN apt-get update +RUN apt install -y --no-install-recommends whois wget curl python3 libssl-dev libcurl4-openssl-dev libelf-dev libdw-dev gcc binutils-dev libc6-dev pkg-config build-essential openssh-server cmake libgflags-dev libzmq3-dev pkg-config libssl-dev libzmq3-dev unzip tmux +ENV PATH=$HOME/bin:$PATH +ENV LD_LIBRARY_PATH=$HOME/lib +ENV PKG_CONFIG_PATH=$HOME/lib/pkgconfig +RUN mkdir /root/bin diff --git a/integration-tests/join/disk/go_compile.sh b/integration-tests/join/disk/go_compile.sh new file mode 100755 index 000000000..883e221b0 --- /dev/null +++ b/integration-tests/join/disk/go_compile.sh @@ -0,0 +1,48 @@ +#!/bin/bash +cd /root/disk +mkdir /root/chain +cp -Rf /root/chain_src/* /root/chain +source /root/disk/prepare.sh +source /opt/sgxsdk/environment +source /root/.cargo/env +echo "sgx mode=" $SGX_MODE +echo "network id=" $NETWORK_ID +echo "path=" $PATH +echo "enclave storage=" $TX_ENCLAVE_STORAGE +echo "rust flags=" $RUSTFLAGS +echo "app port=" $APP_PORT +echo "compile chain" +pwd + + +cd /root/chain/chain-tx-enclave/tx-validation +make clean +make +ret=$? +if [ $ret -ne 0 ]; then + exit -1 +fi +cd /root + +cd /root/chain/chain-tx-enclave/tx-query +make clean +make +ret=$? +if [ $ret -ne 0 ]; then + exit -1 +fi +cd /root + + +cd /root +cp /root/chain/target/debug/client-rpc /root/disk/bin +cp /root/chain/target/debug/client-cli /root/disk/bin +cp /root/chain/target/debug/chain-abci /root/disk/bin +cp /root/chain/target/debug/dev-utils /root/disk/bin +cp /root/chain/chain-tx-enclave/tx-validation/bin/enclave.signed.so /root/disk/bin +cp /root/chain/chain-tx-enclave/tx-validation/bin/tx-validation-app /root/disk/bin +mkdir /root/disk/bin/query +cp /root/chain/chain-tx-enclave/tx-query/bin/enclave.signed.so /root/disk/bin/query +cp /root/chain/chain-tx-enclave/tx-query/bin/tx-query-app /root/disk/bin/query +cp /root/bin/tendermint /root/disk/bin +echo "copied OK" diff --git a/integration-tests/join/disk/go_test.sh b/integration-tests/join/disk/go_test.sh new file mode 100755 index 000000000..5ce99f4d9 --- /dev/null +++ b/integration-tests/join/disk/go_test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +cd /root/bin +echo "clear folders" +rm -rf /root/bin/.enclave +rm -rf /root/bin/.cro-storage +rm -rf /root/bin/.storage +rm -rf /enclave-storage +echo "copy binaries" +mkdir /root/bin +echo "copy tendermint config" +cp -Rf /root/disk/bin/* /root/bin +mkdir /root/.tendermint +mkdir /root/.tendermint/config +cp /root/config/* /root/.tendermint/config +echo "clear disk" +/root/bin/tendermint unsafe_reset_all +sleep 2 +source /root/disk/prepare.sh +source /opt/sgxsdk/environment +source /root/.cargo/env +echo "sgx mode=" $SGX_MODE +echo "network id=" $NETWORK_ID +echo "path=" $PATH +echo "enclave storage=" $TX_ENCLAVE_STORAGE +echo "rust flags=" $RUSTFLAGS +echo "app port=" $APP_PORT +echo "compile chain" +echo "ready" + +cd /root/disk +/root/disk/launch.sh +sleep infinity diff --git a/integration-tests/join/disk/launch.sh b/integration-tests/join/disk/launch.sh new file mode 100755 index 000000000..69a25c6da --- /dev/null +++ b/integration-tests/join/disk/launch.sh @@ -0,0 +1,31 @@ +#!/bin/bash +export RUST_LOG=info +cd /root/bin + +echo "activate aesm" +./aesm.sh +sleep 2 + +echo "activate enclave" +nohup ./enclave.sh > enclave.log & +sleep 2 + +echo "activate query" +cd ./query +nohup ./query.sh > query.log & +cd .. +sleep 2 + + +echo "activate abci" +nohup ./abci.sh > abci.log & +sleep 2 + +echo "activate tendermint" +./tendermint.sh & +sleep 20 + +echo "activate client-rpc" +nohup ./client-rpc.sh > rpc.log & +sleep 1 + diff --git a/integration-tests/join/disk/prepare.sh b/integration-tests/join/disk/prepare.sh new file mode 100755 index 000000000..5c899ce6b --- /dev/null +++ b/integration-tests/join/disk/prepare.sh @@ -0,0 +1,10 @@ +#!/bin/bash +export SGX_MODE=HW +export NETWORK_ID=AB +export RUSTFLAGS=-Ctarget-feature=+aes,+ssse3 +export PATH=$HOME/.cargo/bin:$HOME/bin:$PATH +export APP_PORT=25933 +export TX_ENCLAVE_STORAGE=/enclave-storage +export LD_LIBRARY_PATH=$HOME/lib +export PKG_CONFIG_PATH=$HOME/lib/pkgconfig +source ~/.bashrc diff --git a/integration-tests/join/docker-compose.yml b/integration-tests/join/docker-compose.yml new file mode 100644 index 000000000..dabff59f6 --- /dev/null +++ b/integration-tests/join/docker-compose.yml @@ -0,0 +1,72 @@ +version: '3' + +services: + chain0: + build: . + volumes: + - ./disk:/root/disk + - ./disk/config0:/root/config + - /nix:/nix + devices: + - /dev/isgx + - /dev/sgx + image: chain_test0 + ports: + - ${JAIL_CLIENT_RPC:-9981}:9981 + - ${JAIL_CHAIN_RPC:-26657}:26657 + command: /root/disk/go_test.sh + environment: + RUST_BACKTRACE: 1 + RUST_LOG: debug + APP_HASH: $APP_HASH + SPID: $SPID + IAS_API_KEY: $IAS_API_KEY + SGX_MODE: HW + NETWORK_ID: AB + RUSTFLAGS: -Ctarget-feature=+aes,+ssse3 + APP_PORT: 25933 + TX_ENCLAVE_STORAGE: /enclave-storage + chain1: + build: . + volumes: + - ./disk:/root/disk + - ./disk/config1:/root/config + - /nix:/nix + devices: + - /dev/isgx + - /dev/sgx + image: chain_test1 + command: /root/disk/go_test.sh + environment: + RUST_BACKTRACE: 1 + RUST_LOG: debug + APP_HASH: $APP_HASH + SPID: $SPID + IAS_API_KEY: $IAS_API_KEY + SGX_MODE: HW + NETWORK_ID: AB + RUSTFLAGS: -Ctarget-feature=+aes,+ssse3 + APP_PORT: 25933 + TX_ENCLAVE_STORAGE: /enclave-storage + chain2: + build: . + volumes: + - ./disk:/root/disk + - ./disk/config2:/root/config + - /nix:/nix + devices: + - /dev/isgx + - /dev/sgx + image: chain_test2 + command: /root/disk/go_test.sh + environment: + RUST_BACKTRACE: 1 + RUST_LOG: debug + APP_HASH: $APP_HASH + SPID: $SPID + IAS_API_KEY: $IAS_API_KEY + SGX_MODE: HW + NETWORK_ID: AB + RUSTFLAGS: -Ctarget-feature=+aes,+ssse3 + APP_PORT: 25933 + TX_ENCLAVE_STORAGE: /enclave-storage diff --git a/integration-tests/join/go.sh b/integration-tests/join/go.sh new file mode 100755 index 000000000..87c1beda1 --- /dev/null +++ b/integration-tests/join/go.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker run --rm -it -v $PWD/disk:/root/disk -v /nix:/nix -v /opt/intel:/opt/intel -v $HOME/Github:/root/Github --device /dev/isgx my diff --git a/integration-tests/join/python.nix b/integration-tests/join/python.nix new file mode 100644 index 000000000..e50ac9a49 --- /dev/null +++ b/integration-tests/join/python.nix @@ -0,0 +1,18 @@ +with import {}; + +stdenv.mkDerivation { + name = "rust-env"; + nativeBuildInputs = [ + rustc cargo + + # Example Build-time Additional Dependencies + pkgconfig + ]; + buildInputs = [ + # Example Run-time Additional Dependencies + openssl + ]; + + # Set Environment Variables + RUST_BACKTRACE = 1; +} diff --git a/integration-tests/join/run.sh b/integration-tests/join/run.sh new file mode 100755 index 000000000..531e7e664 --- /dev/null +++ b/integration-tests/join/run.sh @@ -0,0 +1,28 @@ +#!/bin/bash +echo "join test" + +source /etc/profile.d/nix.sh +. ./run_compile.sh + +export PATH=$(pwd)/disk/bin:$PATH +echo "binaries" +echo $PATH +ls $(pwd)/disk/bin + +echo "setup" +sleep 2 +#setup +. ./run_setup.sh + +#open port +echo "open port" +. ./run_open_port.sh +sleep 1 + +echo "preparing test" +sleep 5 +# test +. ./run_test.sh + +echo "test finished successfully" +exit 0 diff --git a/integration-tests/join/run_compile.sh b/integration-tests/join/run_compile.sh new file mode 100755 index 000000000..36f994f7f --- /dev/null +++ b/integration-tests/join/run_compile.sh @@ -0,0 +1,18 @@ +#!/bin/bash +echo "compile binaries" + +SRC=../jail/disk/bin +FILE=./disk/bin +mkdir $FILE +cp -Rf $SRC/* $FILE + +echo "check binaries" +if [ -f "$FILE/client-rpc" ] && [ -f "$FILE/client-cli" ] && [ -f "$FILE/chain-abci" ] && [ -f "$FILE/dev-utils" ]&& [ -f "$FILE/tx-validation-app" ] && [ -f "$FILE/query/tx-query-app" ] + +then + echo "compile scuccesss" +else + echo "compile failed" + exit -1 +fi + diff --git a/integration-tests/join/run_setup.sh b/integration-tests/join/run_setup.sh new file mode 100755 index 000000000..48cc2905a --- /dev/null +++ b/integration-tests/join/run_setup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +echo "setup" +sleep 1 + +export CURRENT_HASH=$(git rev-parse HEAD) +echo "setup CURRENT_HASH=" $CURRENT_HASH + +echo PATH=$PWD/disk/bin:$PATH +export PATH=$(pwd)/disk/bin:$PATH +nix-shell ../jail/jail.nix --run "export PASSPHRASE=1 && python3 ../bot/make_join.py" +mkdir ./disk/config0 +cp ./node0/tendermint/config/* ./disk/config0/ + +mkdir ./disk/config1 +cp ./node1/tendermint/config/* ./disk/config1/ + +mkdir ./disk/config2 +cp ./node2/tendermint/config/* ./disk/config2/ + +# nix +nix-shell ../jail/jail.nix --run "export PASSPHRASE=1 && python3 ../bot/open_port.py" diff --git a/integration-tests/join/run_test.sh b/integration-tests/join/run_test.sh new file mode 100755 index 000000000..d9477de38 --- /dev/null +++ b/integration-tests/join/run_test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +echo "run test" + +. ./run_open_port.sh +. ./run_test_env.sh + +echo "client rpc port="$JAIL_CLIENT_RPC +echo "chain rpc port="$JAIL_CHAIN_RPC + + +export CURRENT_HASH=$(git rev-parse HEAD) +echo "run CURRENT_HASH=" $CURRENT_HASH +docker-compose -p $CURRENT_HASH up -d +echo "docker compose ok" +nix-shell ../jail/jail.nix --run "export PASSPHRASE=1 && python3 ../bot/join_test.py" +ret=$? +if [ $ret -ne 0 ]; then + exit -1 +fi +docker-compose -p $CURRENT_HASH down diff --git a/integration-tests/join/rust.nix b/integration-tests/join/rust.nix new file mode 100644 index 000000000..ec48a3d5c --- /dev/null +++ b/integration-tests/join/rust.nix @@ -0,0 +1,25 @@ +with import {}; + +stdenv.mkDerivation { + name = "rust-env"; + nativeBuildInputs = [ + rustc cargo + ]; + LIBCLANG_PATH="${llvmPackages.libclang}/lib"; + buildInputs = [ + # Example Run-time Additional Dependencies + openssl zeromq rocksdb clang gcc pkgconfig binutils-unwrapped gdb llvm + ]; + + shellHook = '' + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "zeromq-[0-9\.]+$" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "clang-[0-9\.]+$" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "libffi-[0-9\.]+$" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "llvm_6.0" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "gcc-6.5.0-lib" | head -n1)/lib":$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="/nix/store/$(ls /nix/store | grep -E "libedit" | head -n1)/lib":$LD_LIBRARY_PATH + ''; + + # Set Environment Variables + RUST_BACKTRACE = 1; +} diff --git a/integration-tests/join/shutdown.sh b/integration-tests/join/shutdown.sh new file mode 100755 index 000000000..f29ea6a45 --- /dev/null +++ b/integration-tests/join/shutdown.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export CURRENT_HASH=$(git rev-parse HEAD) +echo "shutdown CURRENT_HASH=" $CURRENT_HASH +docker-compose -p $CURRENT_HASH down