Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
submodules
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sudo: required

language: node_js

services:
- docker

before_install:
- docker build -t parity parity
- docker build -t e2e .

script:
- ./run-tests.sh
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:8

RUN mkdir /stuff
WORKDIR /stuff

COPY package.json .
COPY package-lock.json .
COPY .git .git
COPY .gitmodules .

RUN npm install --unsafe-perm

COPY envs envs

COPY index.js .

CMD ["npm", "start"]
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3'
services:
parity1:
image: parity
parity2:
image: parity
e2e:
image: e2e
command: "true"
4 changes: 2 additions & 2 deletions config/bridge.env → envs/bridge.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
HOME_RPC_URL=http://localhost:8545
FOREIGN_RPC_URL=http://localhost:8555
HOME_RPC_URL=http://parity1:8545
FOREIGN_RPC_URL=http://parity2:8545
HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
POA20_ADDRESS=0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B
Expand Down
4 changes: 2 additions & 2 deletions config/contracts-deploy.env → envs/contracts-deploy.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DEPLOYMENT_GAS_LIMIT=4000000
DEPLOYMENT_GAS_PRICE=10
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50

HOME_RPC_URL=http://localhost:8545
HOME_RPC_URL=http://parity1:8545
HOME_OWNER_MULTISIG=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
HOME_UPGRADEABLE_ADMIN_VALIDATORS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
HOME_UPGRADEABLE_ADMIN_BRIDGE=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
Expand All @@ -14,7 +14,7 @@ HOME_MIN_AMOUNT_PER_TX=10000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=10

FOREIGN_RPC_URL=http://localhost:8555
FOREIGN_RPC_URL=http://parity2:8545
FOREIGN_OWNER_MULTISIG=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
FOREIGN_UPGRADEABLE_ADMIN_VALIDATORS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
FOREIGN_UPGRADEABLE_ADMIN_BRIDGE=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
Expand Down
17 changes: 6 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const assert = require('assert')
const chalk = require('chalk')
const kill = require('tree-kill')

const configDir = path.join(__dirname, 'config')
const envsDir = path.join(__dirname, 'envs')
const deployContractsDir = path.join(__dirname, 'submodules/poa-bridge-contracts/deploy')
const abisDir = path.join(__dirname, 'submodules/poa-bridge-contracts/build/contracts')
const bridgeDir = path.join(__dirname, 'submodules/bridge-nodejs')

const privateKeyUser = '0x63e48a8ba0b99e0377c6b483af4a072cbca5ffbcfdac77be72e69f4960125800'

const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8555'))
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity1:8545'))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://parity2:8545'))

const { toBN } = foreignWeb3.utils

Expand Down Expand Up @@ -72,19 +72,16 @@ async function main() {

// start parity nodes
console.log(chalk.blue('start parity nodes'))
const homeParity = exec('parity --chain ./config/chain.json -d ./data/data-home --reseal-min-period 0')
const foreignParity = exec('parity --chain ./config/chain.json -d ./data/data-foreign --reseal-min-period 0 --ports-shift 10')

await Promise.all([waitForOutput(homeParity, 'Public node URL'), waitForOutput(foreignParity, 'Public node URL')])
await sleep(1000)

// deploy bridge contracts
shell.cp(path.join(configDir, 'contracts-deploy.env'), path.join(deployContractsDir, '.env'))
shell.cp(path.join(envsDir, 'contracts-deploy.env'), path.join(deployContractsDir, '.env'))
console.log(chalk.blue('deploy contracts'))
shell.cd(deployContractsDir)
shell.exec('node deploy.js')

// start bridge
shell.cp(path.join(configDir, 'bridge.env'), path.join(bridgeDir, '.env'))
shell.cp(path.join(envsDir, 'bridge.env'), path.join(bridgeDir, '.env'))
console.log(chalk.blue('start bridge'))
shell.cd(bridgeDir)
shell.exec('git checkout db')
Expand Down Expand Up @@ -114,8 +111,6 @@ async function main() {
assert(satisfied, 'Account should have tokens')

console.log(chalk.blue('kill child processes'))
kill(homeParity.pid)
kill(foreignParity.pid)
kill(bridge.pid)
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"postinstall": "git submodule update --init && cd submodules/poa-bridge-contracts && npm install && ./node_modules/.bin/truffle compile && cd deploy && npm install && cd ../../bridge-nodejs && npm install"
"postinstall": "git submodule update --init && cd submodules/poa-bridge-contracts && npm install && ./node_modules/.bin/truffle compile && cd deploy && npm install && cd ../../bridge-nodejs && npm install",
"start": "node index.js"
},
"author": "",
"license": "ISC",
Expand Down
7 changes: 7 additions & 0 deletions parity/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM parity/parity

WORKDIR /stuff

COPY . .

CMD ["--chain", "chain.json", "--jsonrpc-interface", "all"]
File renamed without changes.
5 changes: 5 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docker-compose up -d
docker-compose run e2e npm start
rc=$?
docker-compose down
exit $rc