Merge pull request #67 from poanetwork/oracle-e2e-contracts

E2E tests using root contracts
This commit is contained in:
Alexander Kolotov 2019-05-24 14:56:41 +03:00 committed by GitHub
commit 94e923d965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 54 additions and 24 deletions

3
.gitmodules vendored

@ -1,6 +1,3 @@
[submodule "contracts"]
path = contracts
url = https://github.com/poanetwork/poa-bridge-contracts.git
[submodule "contracts-2.2.0"]
path = contracts-2.2.0
url = https://github.com/poanetwork/poa-bridge-contracts.git

@ -9,12 +9,15 @@ COPY ui-e2e/package.json ./ui-e2e/
COPY monitor/package.json ./monitor/
COPY contracts/package.json ./contracts/
COPY ui/lib/web3-eth/index.js ./ui/lib/web3-eth/index.js
COPY yarn.lock .
RUN yarn install
COPY . .
COPY contracts contracts
RUN yarn workspace poa-parity-bridge-contracts run compile
RUN cd contracts-2.2.0 && rm -f package-lock.json && npm install --silent && npm install --silent truffle@4.1.11 && npm run compile && cd deploy && rm -f package-lock.json && npm install --silent && npm install --silent web3@1.0.0-beta.33
RUN yarn workspace ui run compile:contracts && yarn workspace ui run postinstall
RUN cd contracts/deploy && rm -f package-lock.json && npm install
COPY ui ui
RUN yarn workspace ui run compile:contracts && yarn workspace ui run postinstall
COPY . .

@ -1 +1 @@
Subproject commit 492f6d010a1324676801df918f0449965e770c64
Subproject commit b1c4c35fbc86acacf3a6d857c7e6b232aec2592f

@ -1 +0,0 @@
Subproject commit 46151629adb3dd20e6fb47d4ba91b88c6d388c4f

@ -11,5 +11,5 @@
"address": "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b",
"privateKey": "0x8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
},
"contractsPath": "../contracts-2.2.0"
"contractsPath": "../contracts"
}

@ -1,9 +1,10 @@
BRIDGE_MODE=NATIVE_TO_ERC
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
DEPLOYMENT_GAS_LIMIT=4600000
HOME_DEPLOYMENT_GAS_PRICE=10000000000
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
DEPLOY_REWARDABLE_TOKEN=false
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
BRIDGEABLE_TOKEN_SYMBOL="TEST"
@ -18,6 +19,7 @@ HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
HOME_MIN_AMOUNT_PER_TX=10000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=1000000000
HOME_REWARDABLE=false
FOREIGN_RPC_URL=http://parity2:8545
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
@ -28,6 +30,9 @@ FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
FOREIGN_GAS_PRICE=10000000000
FOREIGN_REWARDABLE=false
REQUIRED_NUMBER_OF_VALIDATORS=1
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000
BLOCK_REWARD_ADDRESS=0x0000000000000000000000000000000000000000

@ -1,9 +1,10 @@
BRIDGE_MODE=ERC_TO_ERC
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
DEPLOYMENT_GAS_LIMIT=4600000
HOME_DEPLOYMENT_GAS_PRICE=10000000000
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
DEPLOY_REWARDABLE_TOKEN=false
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
BRIDGEABLE_TOKEN_SYMBOL="TEST"
@ -18,6 +19,7 @@ HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
HOME_MIN_AMOUNT_PER_TX=10000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=1000000000
HOME_REWARDABLE=false
FOREIGN_RPC_URL=http://parity2:8545
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
@ -28,7 +30,12 @@ FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
FOREIGN_GAS_PRICE=10000000000
FOREIGN_REWARDABLE=false
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
REQUIRED_NUMBER_OF_VALIDATORS=1
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000
BLOCK_REWARD_ADDRESS=0x0000000000000000000000000000000000000000
DPOS_STAKING_ADDRESS=0x0000000000000000000000000000000000000000
ERC20_EXTENDED_BY_ERC677=false

@ -1,9 +1,9 @@
BRIDGE_MODE=ERC_TO_NATIVE
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
DEPLOYMENT_GAS_LIMIT=4600000
HOME_DEPLOYMENT_GAS_PRICE=10000000000
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
BRIDGEABLE_TOKEN_SYMBOL="TEST"
@ -18,6 +18,7 @@ HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
HOME_MIN_AMOUNT_PER_TX=10000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=1000000000
HOME_REWARDABLE=false
FOREIGN_RPC_URL=http://parity2:8545
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
@ -28,9 +29,11 @@ FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
FOREIGN_GAS_PRICE=10000000000
FOREIGN_REWARDABLE=false
BLOCK_REWARD_ADDRESS=0xF9698Eb93702dfdd0e2d802088d4c21822a8A977
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
REQUIRED_NUMBER_OF_VALIDATORS=1
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000

@ -7,7 +7,7 @@ require('dotenv').config({
const {
deployContract,
sendRawTx,
sendRawTxForeign,
privateKeyToAddress
} = require(`../${contractsPath}/deploy/src/deploymentUtils`)
const {
@ -34,7 +34,7 @@ async function deployErc20() {
const mintData = await poa20foreign.methods
.mint(user.address, '1000000000000000000')
.encodeABI({ from: DEPLOYMENT_ACCOUNT_ADDRESS })
await sendRawTx({
await sendRawTxForeign({
data: mintData,
nonce: foreignNonce,
to: poa20foreign.options.address,

@ -1,7 +1,9 @@
require('dotenv').config()
const promiseLimit = require('promise-limit')
const { HttpListProviderError } = require('http-list-provider')
const rootLogger = require('../../services/logger')
const { web3Home } = require('../../services/web3')
const promiseLimit = require('promise-limit')
const bridgeValidatorsABI = require('../../../abis/BridgeValidators.abi')
const { EXIT_CODES, MAX_CONCURRENT_EVENTS } = require('../../utils/constants')
const estimateGas = require('./estimateGas')
@ -10,7 +12,6 @@ const {
AlreadySignedError,
InvalidValidatorError
} = require('../../utils/errors')
const { HttpListProviderError } = require('http-list-provider')
const limit = promiseLimit(MAX_CONCURRENT_EVENTS)

@ -1,8 +1,8 @@
const { hexToNumber } = require('web3-utils')
const logger = require('../services/logger').child({
module: 'web3'
})
const { sendRawTx } = require('./sendTx')
const { hexToNumber } = require('web3-utils')
async function getNonce(web3, address) {
try {

@ -4,5 +4,5 @@
"erc20NativeUrl" : "http://localhost:3002",
"homeAccount": "./accounts/user77_7FC1.json",
"foreignAccount": "./accounts/user42_7FC1.json",
"contractsPath": "../contracts-2.2.0"
"contractsPath": "../contracts"
}

@ -1,10 +1,11 @@
BRIDGE_MODE=NATIVE_TO_ERC
DEPLOYMENT_ACCOUNT_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
DEPLOYMENT_GAS_LIMIT=4600000
HOME_DEPLOYMENT_GAS_PRICE=10000000000
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
DEPLOY_REWARDABLE_TOKEN=false
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
BRIDGEABLE_TOKEN_SYMBOL="TEST"
@ -19,6 +20,7 @@ HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
HOME_MIN_AMOUNT_PER_TX=10000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=1000000000
HOME_REWARDABLE=false
FOREIGN_RPC_URL=http://parity2:8545
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
@ -29,6 +31,9 @@ FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
FOREIGN_GAS_PRICE=10000000000
FOREIGN_REWARDABLE=false
REQUIRED_NUMBER_OF_VALIDATORS=1
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000
BLOCK_REWARD_ADDRESS=0x0000000000000000000000000000000000000000

@ -1,10 +1,11 @@
BRIDGE_MODE=ERC_TO_ERC
DEPLOYMENT_ACCOUNT_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
DEPLOYMENT_GAS_LIMIT=4600000
HOME_DEPLOYMENT_GAS_PRICE=10000000000
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
DEPLOY_REWARDABLE_TOKEN=false
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
BRIDGEABLE_TOKEN_SYMBOL="TEST"
@ -19,6 +20,7 @@ HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
HOME_MIN_AMOUNT_PER_TX=10000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=1000000000
HOME_REWARDABLE=false
FOREIGN_RPC_URL=http://parity2:8545
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
@ -30,6 +32,11 @@ FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
FOREIGN_GAS_PRICE=10000000000
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
FOREIGN_REWARDABLE=false
REQUIRED_NUMBER_OF_VALIDATORS=1
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000
BLOCK_REWARD_ADDRESS=0x0000000000000000000000000000000000000000
DPOS_STAKING_ADDRESS=0x0000000000000000000000000000000000000000
ERC20_EXTENDED_BY_ERC677=false

@ -1,9 +1,9 @@
BRIDGE_MODE=ERC_TO_NATIVE
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9
DEPLOYMENT_GAS_LIMIT=4600000
HOME_DEPLOYMENT_GAS_PRICE=10000000000
FOREIGN_DEPLOYMENT_GAS_PRICE=10000000000
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=50
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
BRIDGEABLE_TOKEN_NAME="Your New Bridged Token"
BRIDGEABLE_TOKEN_SYMBOL="TEST"
@ -18,6 +18,7 @@ HOME_MAX_AMOUNT_PER_TX=1500000000000000000000000
HOME_MIN_AMOUNT_PER_TX=10000000000000000
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
HOME_GAS_PRICE=1000000000
HOME_REWARDABLE=false
FOREIGN_RPC_URL=http://parity2:8545
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
@ -28,9 +29,11 @@ FOREIGN_MAX_AMOUNT_PER_TX=750000000000000000000000
FOREIGN_MIN_AMOUNT_PER_TX=10000000000000000
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
FOREIGN_GAS_PRICE=10000000000
FOREIGN_REWARDABLE=false
BLOCK_REWARD_ADDRESS=0xF9698Eb93702dfdd0e2d802088d4c21822a8A977
ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f
REQUIRED_NUMBER_OF_VALIDATORS=1
VALIDATORS="0xaaB52d66283F7A1D5978bcFcB55721ACB467384b"
VALIDATORS_REWARD_ACCOUNTS=0x0000000000000000000000000000000000000000

@ -7,7 +7,7 @@ require('dotenv').config({
const {
deployContract,
sendRawTx
sendRawTxForeign
} = require(path.join('..', contractsPath, 'deploy/src/deploymentUtils'))
const {
web3Foreign,
@ -33,7 +33,7 @@ async function deployErc20() {
const mintData = await poa20foreign.methods
.mint(user, '500000000000000000000')
.encodeABI({ from: DEPLOYMENT_ACCOUNT_ADDRESS })
await sendRawTx({
await sendRawTxForeign({
data: mintData,
nonce: foreignNonce,
to: poa20foreign.options.address,