Compare commits
5 Commits
3.0.0-rc0
...
feature/am
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5490b8b029 | ||
|
|
3f93fef016 | ||
|
|
8f72516374 | ||
|
|
98155e3075 | ||
|
|
0d724147bd |
15
.github/workflows/main.yml
vendored
15
.github/workflows/main.yml
vendored
@@ -149,6 +149,12 @@ jobs:
|
||||
run: docker login ${DOCKER_REGISTRY} -u ${{ github.actor }} -p ${{ github.token }}
|
||||
- name: yarn run ${{ matrix.task }}
|
||||
run: ${{ !matrix.use-cache || steps.cache-repo.outputs.cache-hit }} && yarn run ${{ matrix.task }}
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: logs-${{ matrix.task }}
|
||||
path: e2e-commons/logs
|
||||
deployment:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
@@ -210,3 +216,12 @@ jobs:
|
||||
run: sudo chown -R $USER:docker /var/run/docker.sock
|
||||
- name: Run oracle e2e tests
|
||||
run: docker-compose -f ./e2e-commons/docker-compose.yml run -e ULTIMATE=true e2e yarn workspace oracle-e2e run ${{ matrix.task }}
|
||||
- name: Save logs
|
||||
if: always()
|
||||
run: e2e-commons/down.sh
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: logs-ultimate-${{ matrix.task }}
|
||||
path: e2e-commons/logs
|
||||
|
||||
Submodule contracts updated: 004d466a3d...c2575aa268
@@ -34,7 +34,7 @@ provisioner:
|
||||
inventory:
|
||||
host_vars:
|
||||
multiple-host:
|
||||
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
|
||||
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "6c48435bd464a53ed66ed62127c4dba8af75cf1a99a8ebe2680599948fbfbc6d"
|
||||
MONITOR_PORT: 3003
|
||||
syslog_server_port: "udp://127.0.0.1:514"
|
||||
verifier:
|
||||
|
||||
@@ -33,7 +33,7 @@ provisioner:
|
||||
inventory:
|
||||
host_vars:
|
||||
oracle-host:
|
||||
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
|
||||
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "6c48435bd464a53ed66ed62127c4dba8af75cf1a99a8ebe2680599948fbfbc6d"
|
||||
syslog_server_port: "udp://127.0.0.1:514"
|
||||
verifier:
|
||||
name: testinfra
|
||||
|
||||
@@ -5,13 +5,13 @@ ORACLE_LOG_LEVEL: debug
|
||||
|
||||
## Home contract
|
||||
COMMON_HOME_RPC_URL: "https://sokol.poa.network"
|
||||
COMMON_HOME_BRIDGE_ADDRESS: "0x98aFdE294f1C46aA0a27Cc4049ED337F879d8976"
|
||||
COMMON_HOME_BRIDGE_ADDRESS: "0x59ba90A588ce732AB33FD32Aab1b58c21400A0f6"
|
||||
ORACLE_HOME_RPC_POLLING_INTERVAL: 5000
|
||||
|
||||
## Foreign contract
|
||||
COMMON_FOREIGN_RPC_URL: "https://sokol.poa.network"
|
||||
COMMON_FOREIGN_BRIDGE_ADDRESS: "0x5a584f4C30B36f282848dAc9a2b20E7BEF481981"
|
||||
ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 1000
|
||||
COMMON_FOREIGN_RPC_URL: "https://kovan.infura.io/v3/5d7bd94c50ed43fab1cb8e74f58678b0"
|
||||
COMMON_FOREIGN_BRIDGE_ADDRESS: "0xdA4a49a00F4fF4A5988b9AceE95f99e3b2c208b6"
|
||||
ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 5000
|
||||
|
||||
## Home Gasprice
|
||||
COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/"
|
||||
@@ -31,8 +31,8 @@ ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000
|
||||
MONITOR_BRIDGE_NAME: "bridge"
|
||||
MONITOR_PORT: 3003
|
||||
MONITOR_CACHE_EVENTS: "false"
|
||||
MONITOR_HOME_START_BLOCK: 0
|
||||
MONITOR_FOREIGN_START_BLOCK: 0
|
||||
MONITOR_HOME_START_BLOCK: 20821049
|
||||
MONITOR_FOREIGN_START_BLOCK: 24773297
|
||||
MONITOR_VALIDATOR_HOME_TX_LIMIT: 300000
|
||||
MONITOR_VALIDATOR_FOREIGN_TX_LIMIT: 300000
|
||||
MONITOR_TX_NUMBER_THRESHOLD: 100
|
||||
|
||||
@@ -1,7 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
cd $(dirname $0)
|
||||
|
||||
if [ $CI ]; then exit $rc; fi
|
||||
if [ $CI ]; then
|
||||
rm -rf logs || true
|
||||
|
||||
mkdir ./logs
|
||||
|
||||
for project in "" validator{1,2,3}; do
|
||||
for container in $(docker-compose -p "$project" ps | tail -n +3 | awk '{print $1}') ; do
|
||||
if [[ -z "$project" ]]; then
|
||||
path="./logs/$container.log"
|
||||
else
|
||||
mkdir -p "./logs/$project"
|
||||
path="./logs/$project/$container.log"
|
||||
fi
|
||||
docker logs "$container" > "$path" 2>&1
|
||||
done
|
||||
done
|
||||
|
||||
touch ../oracle/.env
|
||||
for file in ../oracle/docker-compose-{amb,transfer}.yml; do
|
||||
for container in $(docker-compose -f "$file" ps | tail -n +3 | awk '{print $1}') ; do
|
||||
mkdir -p "./logs/oracle"
|
||||
docker logs "$container" > "./logs/oracle/$container.log" 2>&1
|
||||
done
|
||||
done
|
||||
|
||||
exit $rc;
|
||||
fi
|
||||
|
||||
ps | grep node | grep -v grep | grep -v yarn | awk '{print "kill " $1}' | /bin/bash
|
||||
docker-compose down
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "mocha --timeout 120000",
|
||||
"start": "mocha --timeout 120000 --exit",
|
||||
"lint": "eslint . --ignore-path ../.eslintignore"
|
||||
},
|
||||
"author": "",
|
||||
|
||||
@@ -101,6 +101,21 @@ async function main(mode) {
|
||||
chain: 'home'
|
||||
})).map(normalizeEvent)
|
||||
homeToForeignRequests = [...homeToForeignRequests, ...homeToForeignRequestsNew]
|
||||
if (bridgeMode === BRIDGE_MODES.ARBITRARY_MESSAGE) {
|
||||
const used = {}
|
||||
const total = homeToForeignRequests.length
|
||||
const onlyFirstUniqueFilter = e => {
|
||||
const msgId = e.returnValues.messageId || e.transactionHash
|
||||
if (used[msgId]) {
|
||||
return false
|
||||
}
|
||||
used[msgId] = true
|
||||
return true
|
||||
}
|
||||
homeToForeignRequests = homeToForeignRequests.filter(onlyFirstUniqueFilter)
|
||||
const dropped = total - homeToForeignRequests.length
|
||||
logger.debug(`Dropped ${dropped}/${total} UserRequestForSignature events with same message id`)
|
||||
}
|
||||
|
||||
logger.debug("calling foreignBridge.getPastEvents('RelayedMessage')")
|
||||
const homeToForeignConfirmations = (await getPastEvents(foreignBridge, {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "mocha --exit",
|
||||
"start": "mocha",
|
||||
"lint": "eslint . --ignore-path ../.eslintignore",
|
||||
"amb": "mocha test/amb.js",
|
||||
"erc-to-native": "mocha test/ercToNative.js",
|
||||
|
||||
@@ -140,6 +140,73 @@ describe('arbitrary message bridging', () => {
|
||||
const value = await foreignBox.methods.value().call()
|
||||
assert(!toBN(value).eq(toBN(newValue)), 'Message should not be relayed by oracle automatically')
|
||||
})
|
||||
|
||||
it('should reconfirm message in case of validators change', async () => {
|
||||
const newValue = 15
|
||||
|
||||
const initialValue = await foreignBox.methods.value().call()
|
||||
assert(!toBN(initialValue).eq(toBN(newValue)), 'initial value should be different from new value')
|
||||
|
||||
const signatures = await homeBridge.getPastEvents('SignedForUserRequest', {
|
||||
fromBlock: 0,
|
||||
toBlock: 'latest'
|
||||
})
|
||||
|
||||
const { events } = await homeBox.methods
|
||||
.setValueOnOtherNetworkUsingManualLane(newValue, amb.home, amb.foreignBox)
|
||||
.send()
|
||||
.catch(e => {
|
||||
console.error(e)
|
||||
})
|
||||
const message = homeWeb3.eth.abi.decodeParameter('bytes', events['0'].raw.data)
|
||||
|
||||
await delay(10000)
|
||||
|
||||
await setRequiredSignatures({
|
||||
bridgeContract: homeBridge,
|
||||
web3: homeWeb3,
|
||||
requiredSignatures: 3,
|
||||
options: {
|
||||
from: validator.address,
|
||||
gas: '4000000'
|
||||
}
|
||||
})
|
||||
|
||||
const signatures2 = await homeBridge.getPastEvents('SignedForUserRequest', {
|
||||
fromBlock: 0,
|
||||
toBlock: 'latest'
|
||||
})
|
||||
|
||||
assert(
|
||||
signatures2.length === signatures.length + requiredSignatures,
|
||||
`Incorrect amount of signatures submitted, got ${signatures2.length}, expected ${signatures.length +
|
||||
requiredSignatures}`
|
||||
)
|
||||
|
||||
await homeBridge.methods.requestMessageReconfirm(message).send()
|
||||
|
||||
await delay(10000)
|
||||
|
||||
const signatures3 = await homeBridge.getPastEvents('SignedForUserRequest', {
|
||||
fromBlock: 0,
|
||||
toBlock: 'latest'
|
||||
})
|
||||
|
||||
assert(
|
||||
signatures3.length === signatures.length + 3,
|
||||
`Incorrect amount of signatures submitted, got ${signatures3.length}, expected ${signatures.length + 3}`
|
||||
)
|
||||
|
||||
await setRequiredSignatures({
|
||||
bridgeContract: homeBridge,
|
||||
web3: homeWeb3,
|
||||
requiredSignatures: 2,
|
||||
options: {
|
||||
from: validator.address,
|
||||
gas: '4000000'
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
it('should confirm but not relay message from manual lane', async () => {
|
||||
|
||||
@@ -1 +1 @@
|
||||
--timeout 120000
|
||||
--timeout 120000 --exit
|
||||
|
||||
52
oracle/esController.sol
Normal file
52
oracle/esController.sol
Normal file
@@ -0,0 +1,52 @@
|
||||
//SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
/*
|
||||
This contract can be used together with the emergency shutdown
|
||||
functionality of the TokenBridge oracles.
|
||||
*/
|
||||
|
||||
pragma solidity 0.7.6;
|
||||
|
||||
contract PauseController {
|
||||
address public manager;
|
||||
bool internal paused;
|
||||
bytes32 private immutable ID;
|
||||
|
||||
constructor (string memory _id, address _manager) {
|
||||
require(bytes(_id).length <= 32);
|
||||
bytes32 id;
|
||||
assembly {
|
||||
id := mload(add(_id, 32))
|
||||
}
|
||||
ID = id;
|
||||
|
||||
manager = _manager;
|
||||
}
|
||||
|
||||
modifier onlyManager() {
|
||||
require(msg.sender == manager);
|
||||
_;
|
||||
}
|
||||
|
||||
function changeManager(address _newmanager) external onlyManager {
|
||||
require(_newmanager != address(0));
|
||||
manager = _newmanager;
|
||||
}
|
||||
|
||||
function pause() external onlyManager {
|
||||
paused = true;
|
||||
}
|
||||
|
||||
function play() external onlyManager {
|
||||
paused = false;
|
||||
}
|
||||
|
||||
function isPaused() external view returns(bool) {
|
||||
return paused;
|
||||
}
|
||||
|
||||
function id() external view returns(string memory) {
|
||||
return string(abi.encodePacked(ID));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user