Skip to content

Commit ffbca8b

Browse files
Oracle watcher for AMB async calls (#509)
1 parent 38f1bae commit ffbca8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1360
-346
lines changed

CONFIGURATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ORACLE_FOREIGN_TX_RESEND_INTERVAL | Interval in milliseconds for automatic resen
4747
ORACLE_SHUTDOWN_SERVICE_URL | Optional external URL to some other service/monitor/configuration manager that controls the remote shutdown process. GET request should return `application/json` message with the following schema: `{ shutdown: true/false }`. | URL
4848
ORACLE_SHUTDOWN_SERVICE_POLLING_INTERVAL | Optional interval in milliseconds used to request the side RPC node or external shutdown service. Default is 120000. | integer
4949
ORACLE_SIDE_RPC_URL | Optional HTTPS URL(s) for communication with the external shutdown service or side RPC nodes, used for shutdown manager activities. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL(s)
50+
ORACLE_FOREIGN_ARCHIVE_RPC_URL | Optional HTTPS URL(s) for communication with the archive nodes on the foreign network. Only used in AMB bridge mode for async information request processing. Several URLs can be specified, delimited by spaces. If the connection to one of these nodes is lost the next URL is used for connection. | URL(s)
5051
ORACLE_SHUTDOWN_CONTRACT_ADDRESS | Optional contract address in the side chain accessible through `ORACLE_SIDE_RPC_URL`, where the method passed in `ORACLE_SHUTDOWN_CONTRACT_METHOD` is implemented. | `address`
5152
ORACLE_SHUTDOWN_CONTRACT_METHOD | Method signature to be used in the side chain to identify the current shutdown status. Method should return boolean. Default value is `isShutdown()`. | `function signature`
5253
ORACLE_FOREIGN_RPC_BLOCK_POLLING_LIMIT | Max length for the block range used in `eth_getLogs` requests for polling contract events for the Foreign chain. Infinite, if not provided. | `integer`

deployment-e2e/molecule/ultimate-commons/oracle-docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
- oracle_net_db_bridge_request
1010
- oracle_net_db_bridge_collected
1111
- oracle_net_db_bridge_affirmation
12+
- oracle_net_db_bridge_information
1213
- oracle_net_db_bridge_transfer
1314
- oracle_net_db_bridge_senderhome
1415
- oracle_net_db_bridge_senderforeign
1516
- oracle_net_db_bridge_shutdown
1617
- oracle_net_rabbit_bridge_request
1718
- oracle_net_rabbit_bridge_collected
1819
- oracle_net_rabbit_bridge_affirmation
20+
- oracle_net_rabbit_bridge_information
1921
- oracle_net_rabbit_bridge_transfer
2022
- oracle_net_rabbit_bridge_senderhome
2123
- oracle_net_rabbit_bridge_senderforeign

deployment/roles/oracle/tasks/logging.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
with_items:
44
- docker-compose
55
- docker-compose-transfer
6+
- docker-compose-amb
67
loop_control:
78
loop_var: file
89

deployment/roles/oracle/tasks/post_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
set_fact: composefileoverride="-f docker-compose-transfer.yml"
4343
when: ORACLE_BRIDGE_MODE == "ERC_TO_NATIVE"
4444

45+
- name: Extend docker compose file for amb
46+
set_fact: composefileoverride="-f docker-compose-amb.yml"
47+
when: ORACLE_BRIDGE_MODE == "ARBITRARY_MESSAGE"
48+
4549
- name: Install .key config
4650
template:
4751
src: key.j2

deployment/roles/oracle/tasks/pre_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
with_items:
2121
- docker-compose.yml
2222
- docker-compose-transfer.yml
23+
- docker-compose-amb.yml

e2e-commons/components-envs/oracle-amb.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ ORACLE_ALLOW_HTTP_FOR_RPC=yes
2424
ORACLE_HOME_START_BLOCK=1
2525
ORACLE_FOREIGN_START_BLOCK=1
2626
ORACLE_HOME_TO_FOREIGN_BLOCK_LIST=/mono/oracle/access-lists/block_list.txt
27+
ORACLE_FOREIGN_ARCHIVE_RPC_URL=http://parity2:8545

e2e-commons/contracts-envs/amb.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ HOME_RPC_URL=http://parity1:8545
99
HOME_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
1010
HOME_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
1111
HOME_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
12-
HOME_MAX_AMOUNT_PER_TX=8000000
12+
HOME_MAX_AMOUNT_PER_TX=2000000
1313
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
1414
HOME_GAS_PRICE=1000000000
1515

1616
FOREIGN_RPC_URL=http://parity2:8545
1717
FOREIGN_BRIDGE_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
1818
FOREIGN_VALIDATORS_OWNER=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
1919
FOREIGN_UPGRADEABLE_ADMIN=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b
20-
FOREIGN_MAX_AMOUNT_PER_TX=8000000
20+
FOREIGN_MAX_AMOUNT_PER_TX=2000000
2121
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
2222
FOREIGN_GAS_PRICE=10000000000
2323

e2e-commons/down.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ if [ $CI ]; then exit $rc; fi
55

66
ps | grep node | grep -v grep | grep -v yarn | awk '{print "kill " $1}' | /bin/bash
77
docker-compose down
8+
docker-compose -p validator1 down
89
docker-compose -p validator2 down
910
docker-compose -p validator3 down
1011
docker network rm ultimate || true

e2e-commons/up.sh

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,52 +15,42 @@ docker network create --driver bridge ultimate || true
1515
docker-compose up -d parity1 parity2 e2e
1616

1717
startValidator () {
18-
docker-compose $1 run -d --name $4 redis
19-
docker-compose $1 run -d --name $5 rabbit
18+
db_env="-e ORACLE_QUEUE_URL=amqp://$4 -e ORACLE_REDIS_URL=redis://$3"
19+
20+
docker-compose $1 run -d --name $3 redis
21+
docker-compose $1 run -d --name $4 rabbit
22+
2023
if [[ -z "$MODE" || "$MODE" == erc-to-native ]]; then
21-
docker-compose $1 run $2 $3 -d oracle-erc20-native yarn watcher:signature-request
22-
docker-compose $1 run $2 $3 -d oracle-erc20-native yarn watcher:collected-signatures
23-
docker-compose $1 run $2 $3 -d oracle-erc20-native yarn watcher:affirmation-request
24-
docker-compose $1 run $2 $3 -d oracle-erc20-native yarn watcher:transfer
24+
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:signature-request
25+
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:collected-signatures
26+
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:affirmation-request
27+
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:transfer
2528
fi
2629
if [[ -z "$MODE" || "$MODE" == amb ]]; then
27-
docker-compose $1 run $2 $3 -d oracle-amb yarn watcher:signature-request
28-
docker-compose $1 run $2 $3 -d oracle-amb yarn watcher:collected-signatures
29-
docker-compose $1 run $2 $3 -d oracle-amb yarn watcher:affirmation-request
30+
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:signature-request
31+
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:collected-signatures
32+
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:affirmation-request
33+
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:information-request
3034
fi
31-
docker-compose $1 run $2 $3 -d oracle-amb yarn sender:home
32-
docker-compose $1 run $2 $3 -d oracle-amb yarn sender:foreign
33-
docker-compose $1 run $2 $3 -d oracle-amb yarn manager:shutdown
34-
}
3535

36-
startAMBValidator () {
37-
docker-compose $1 run -d --name $4 redis
38-
docker-compose $1 run -d --name $5 rabbit
39-
docker-compose $1 run $2 $3 -d oracle-amb yarn watcher:signature-request
40-
docker-compose $1 run $2 $3 -d oracle-amb yarn watcher:collected-signatures
41-
docker-compose $1 run $2 $3 -d oracle-amb yarn watcher:affirmation-request
42-
docker-compose $1 run $2 $3 -d oracle-amb yarn sender:home
43-
docker-compose $1 run $2 $3 -d oracle-amb yarn sender:foreign
44-
docker-compose $1 run $2 $3 -d oracle-amb yarn manager:shutdown
36+
docker-compose $1 run $2 $db_env -d oracle-amb yarn sender:home
37+
docker-compose $1 run $2 $db_env -d oracle-amb yarn sender:foreign
38+
docker-compose $1 run $2 $db_env -d oracle-amb yarn manager:shutdown
4539
}
4640

4741
while [ "$1" != "" ]; do
4842
if [ "$1" == "oracle" ]; then
49-
startValidator "" "" "" "redis" "rabbit"
43+
startValidator "-p validator1" "" redis rabbit
5044
fi
5145

5246
if [ "$1" == "oracle-validator-2" ]; then
53-
oracle2name="-p validator2"
5447
oracle2Values="-e ORACLE_VALIDATOR_ADDRESS=0xdCC784657C78054aa61FbcFFd2605F32374816A4 -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=5a5c3645d0f04e9eb4f27f94ed4c244a225587405b8838e7456f7781ce3a9513"
55-
oracle2comp="-e ORACLE_QUEUE_URL=amqp://rabbit2 -e ORACLE_REDIS_URL=redis://redis2"
56-
startValidator "$oracle2name" "$oracle2Values" "$oracle2comp" "redis2" "rabbit2"
48+
startValidator "-p validator2" "$oracle2Values" redis2 rabbit2
5749
fi
5850

5951
if [ "$1" == "oracle-validator-3" ]; then
60-
oracle3name="-p validator3"
6152
oracle3Values="-e ORACLE_VALIDATOR_ADDRESS=0xDcef88209a20D52165230104B245803C3269454d -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=f877f62a1c19f852cff1d29f0fb1ecac18821c0080d4cc0520c60c098293dca1"
62-
oracle3comp="-e ORACLE_QUEUE_URL=amqp://rabbit3 -e ORACLE_REDIS_URL=redis://redis3"
63-
startValidator "$oracle3name" "$oracle3Values" "$oracle3comp" "redis3" "rabbit3"
53+
startValidator "-p validator3" "$oracle3Values" redis3 rabbit3
6454
fi
6555

6656
if [ "$1" == "alm" ]; then
@@ -92,17 +82,15 @@ while [ "$1" != "" ]; do
9282
fi
9383

9484
if [ "$1" == "alm-e2e" ]; then
95-
startAMBValidator "" "" "" "redis" "rabbit"
85+
MODE=amb
86+
87+
startValidator "-p validator1" "" redis rabbit
9688

97-
oracle2name="-p validator2"
9889
oracle2Values="-e ORACLE_VALIDATOR_ADDRESS=0xdCC784657C78054aa61FbcFFd2605F32374816A4 -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=5a5c3645d0f04e9eb4f27f94ed4c244a225587405b8838e7456f7781ce3a9513"
99-
oracle2comp="-e ORACLE_QUEUE_URL=amqp://rabbit2 -e ORACLE_REDIS_URL=redis://redis2"
100-
startAMBValidator "$oracle2name" "$oracle2Values" "$oracle2comp" "redis2" "rabbit2"
90+
startValidator "-p validator2" "$oracle2Values" redis2 rabbit2
10191

102-
oracle3name="-p validator3"
10392
oracle3Values="-e ORACLE_VALIDATOR_ADDRESS=0xDcef88209a20D52165230104B245803C3269454d -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=f877f62a1c19f852cff1d29f0fb1ecac18821c0080d4cc0520c60c098293dca1"
104-
oracle3comp="-e ORACLE_QUEUE_URL=amqp://rabbit3 -e ORACLE_REDIS_URL=redis://redis3"
105-
startAMBValidator "$oracle3name" "$oracle3Values" "$oracle3comp" "redis3" "rabbit3"
93+
startValidator "-p validator3" "$oracle3Values" redis3 rabbit3
10694
fi
10795

10896
shift # Shift all the parameters down by one

oracle-e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"start": "mocha",
7+
"start": "mocha --exit",
88
"lint": "eslint . --ignore-path ../.eslintignore",
99
"amb": "mocha test/amb.js",
1010
"erc-to-native": "mocha test/ercToNative.js",

0 commit comments

Comments
 (0)