Trying to figure out why eth watcher does not work properly on CI env 5

This commit is contained in:
Kirill Fedoseev 2019-10-29 13:19:32 +03:00
parent adbb1f09c7
commit 935b8c87a8
4 changed files with 18 additions and 13 deletions

View File

@ -49,8 +49,6 @@ orbs:
docker cp "./workspace/ganache_side_data" "tmp:/ganache_side_data" docker cp "./workspace/ganache_side_data" "tmp:/ganache_side_data"
docker cp "./workspace/ganache_home_data" "tmp:/ganache_home_data" docker cp "./workspace/ganache_home_data" "tmp:/ganache_home_data"
docker kill tmp docker kill tmp
ls ./workspace/ganache_side_data
ls ./workspace/ganache_home_data
restore_tss_image: restore_tss_image:
description: "Restores tss image from cache" description: "Restores tss image from cache"
steps: steps:

View File

@ -22,7 +22,7 @@ start_dev_blockchain_networks() {
docker run -d --network blockchain_side --rm --name ganache_side -v "ganache_side_data:/app/db" \ docker run -d --network blockchain_side --rm --name ganache_side -v "ganache_side_data:/app/db" \
-p "7545:8545" \ -p "7545:8545" \
trufflesuite/ganache-cli:latest \ trufflesuite/ganache-cli:latest \
-m "shrug dwarf easily blade trigger lucky reopen cage lake scatter desk boat" -i 33 -q --db /app/db -b "$BLOCK_TIME" --noVMErrorsOnRPCResponse -m "shrug dwarf easily blade trigger lucky reopen cage lake scatter desk boat" -i 33 --db /app/db -b "$BLOCK_TIME" --noVMErrorsOnRPCResponse
echo "Starting home test blockchain" echo "Starting home test blockchain"
@ -32,7 +32,7 @@ start_dev_blockchain_networks() {
docker run -d --network blockchain_home --rm --name ganache_home -v "ganache_home_data:/app/db" \ docker run -d --network blockchain_home --rm --name ganache_home -v "ganache_home_data:/app/db" \
-p "8545:8545" \ -p "8545:8545" \
trufflesuite/ganache-cli:latest \ trufflesuite/ganache-cli:latest \
-m "shrug dwarf easily blade trigger lucky reopen cage lake scatter desk boat" -i 44 -q --db /app/db -b "$BLOCK_TIME" --noVMErrorsOnRPCResponse -m "shrug dwarf easily blade trigger lucky reopen cage lake scatter desk boat" -i 44 --db /app/db -b "$BLOCK_TIME" --noVMErrorsOnRPCResponse
sleep 4 sleep 4
} }

View File

@ -12,14 +12,12 @@ const abiBridge = require('./contracts_data/Bridge.json').abi
const { HOME_RPC_URL, HOME_BRIDGE_ADDRESS, RABBITMQ_URL, HOME_START_BLOCK, VALIDATOR_PRIVATE_KEY } = process.env const { HOME_RPC_URL, HOME_BRIDGE_ADDRESS, RABBITMQ_URL, HOME_START_BLOCK, VALIDATOR_PRIVATE_KEY } = process.env
setInterval(() => { axios.post(HOME_RPC_URL, {
axios.post(HOME_RPC_URL, { jsonrpc: '2.0',
jsonrpc: '2.0', method: 'eth_getCode',
method: "eth_blockNumber", params: [ HOME_BRIDGE_ADDRESS, 'latest' ],
params: [], id: 1
id: 1 }).then(x => console.log(x.data), console.log)
}).then(console.log, console.log)
}, 5000)
const homeWeb3 = new Web3(HOME_RPC_URL) const homeWeb3 = new Web3(HOME_RPC_URL)
const bridge = new homeWeb3.eth.Contract(abiBridge, HOME_BRIDGE_ADDRESS) const bridge = new homeWeb3.eth.Contract(abiBridge, HOME_BRIDGE_ADDRESS)
@ -104,7 +102,15 @@ async function initialize () {
foreignNonce[epoch] = parseInt(await redis.get(`foreignNonce${epoch}`)) || 0 foreignNonce[epoch] = parseInt(await redis.get(`foreignNonce${epoch}`)) || 0
} }
logger.debug('Checking if current validator') logger.debug('Checking if current validator')
isCurrentValidator = (await bridge.methods.getValidators().call()).includes(validatorAddress) let currentValidators = []
try {
logger.debug('1')
currentValidators = await bridge.methods.getValidators().call()
logger.debug('2')
} catch (e) {
logger.debug('%o', e)
}
isCurrentValidator = (currentValidators).includes(validatorAddress)
if (isCurrentValidator) { if (isCurrentValidator) {
logger.info(`${validatorAddress} is a current validator`) logger.info(`${validatorAddress} is a current validator`)
} else { } else {

View File

@ -1,3 +1,4 @@
exit: true
reporter: mocha-multi-reporters reporter: mocha-multi-reporters
reporter-option: reporter-option:
- configFile=./reportersConfig.json - configFile=./reportersConfig.json