deployment of an AMB oracle

This commit is contained in:
Alexander Kolotov 2022-06-06 15:47:02 +03:00
parent 6692a5fc87
commit c07138f69f
7 changed files with 229 additions and 167 deletions

@ -5,7 +5,6 @@ sokol-kovan:
hosts:
127.0.0.1:
ansible_user: ubuntu
TB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
#syslog_server_port: "udp://127.0.0.1:514"
monitor:

@ -1,12 +1,4 @@
---
- name: Get blocks for TokenBridge
become_user: "{{ compose_service_user }}"
shell: docker-compose run --rm --entrypoint "node scripts/getValidatorStartBlocks.js" bridge_affirmation
args:
chdir: "{{ bridge_path }}/oracle"
register: TBBLOCKS
when: (TB_HOME_START_BLOCK is not defined) or (TB_FOREIGN_START_BLOCK is not defined)
- name: Get blocks for AMB
become_user: "{{ compose_service_user }}"
shell: docker-compose run --rm --entrypoint "node scripts/getValidatorStartBlocks.js" bridge_amb_affirmation
@ -15,15 +7,6 @@
register: AMBBLOCKS
when: (AMB_HOME_START_BLOCK is not defined) or (AMB_FOREIGN_START_BLOCK is not defined)
- name: Write blocks for TokenBridge
blockinfile:
path: "{{ bridge_path }}/oracle/.env"
marker: "## {mark} Calculated by scripts/getValidatorStartBlocks.js"
block: |
TB_HOME_START_BLOCK={{ (TBBLOCKS.stdout | from_json).homeStartBlock }}
TB_FOREIGN_START_BLOCK={{ (TBBLOCKS.stdout | from_json).foreignStartBlock }}
when: (TB_HOME_START_BLOCK is not defined) or (TB_FOREIGN_START_BLOCK is not defined)
- name: Write blocks for AMB
blockinfile:
path: "{{ bridge_path }}/oracle/.env"
@ -33,17 +16,6 @@
AMB_FOREIGN_START_BLOCK={{ (AMBBLOCKS.stdout | from_json).foreignStartBlock }}
when: (AMB_HOME_START_BLOCK is not defined) or (AMB_FOREIGN_START_BLOCK is not defined)
- name: Get validator address for TokenBridge
become_user: "{{ compose_service_user }}"
shell: docker-compose run --rm -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="{{ TB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}" --entrypoint "node scripts/privateKeyToAddress.js" bridge_affirmation
args:
chdir: "{{ bridge_path }}/oracle"
register: TBVADDRESS
- name: Set TB_ORACLE_VALIDATOR_ADDRESS variable
set_fact:
TB_ORACLE_VALIDATOR_ADDRESS: "{{ TBVADDRESS.stdout }}"
- name: Get validator address for AMB
become_user: "{{ compose_service_user }}"
shell: docker-compose run --rm -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="{{ AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}" --entrypoint "node scripts/privateKeyToAddress.js" bridge_affirmation

@ -14,6 +14,6 @@
- name: Copy docker-compose file
copy:
src: ../../../../oracle/docker-compose-combined.yml
src: ../../../../oracle/docker-compose-amb.yml
dest: "{{ bridge_path }}/oracle/docker-compose.yml"
mode: '0755'

@ -5,7 +5,6 @@ ORACLE_LOG_LEVEL={{ ORACLE_LOG_LEVEL }}
## Home contract
COMMON_HOME_RPC_URL={{ COMMON_HOME_RPC_URL }}
TB_HOME_BRIDGE_ADDRESS={{ TB_HOME_BRIDGE_ADDRESS }}
AMB_HOME_BRIDGE_ADDRESS={{ AMB_HOME_BRIDGE_ADDRESS }}
ORACLE_HOME_RPC_POLLING_INTERVAL={{ ORACLE_HOME_RPC_POLLING_INTERVAL }}
{% if ORACLE_HOME_RPC_BLOCK_POLLING_LIMIT | default('') != '' %}
@ -17,7 +16,6 @@ COMMON_FOREIGN_RPC_URL={{ COMMON_FOREIGN_RPC_URL }}
{% if ORACLE_FOREIGN_ARCHIVE_RPC_URL | default('') != '' %}
ORACLE_FOREIGN_ARCHIVE_RPC_URL={{ ORACLE_FOREIGN_ARCHIVE_RPC_URL }}
{% endif %}
TB_FOREIGN_BRIDGE_ADDRESS={{ TB_FOREIGN_BRIDGE_ADDRESS }}
AMB_FOREIGN_BRIDGE_ADDRESS={{ AMB_FOREIGN_BRIDGE_ADDRESS }}
ORACLE_FOREIGN_RPC_POLLING_INTERVAL={{ ORACLE_FOREIGN_RPC_POLLING_INTERVAL }}
{% if ORACLE_FOREIGN_RPC_BLOCK_POLLING_LIMIT | default('') != '' %}
@ -59,8 +57,6 @@ COMMON_FOREIGN_GAS_PRICE_FACTOR={{ COMMON_FOREIGN_GAS_PRICE_FACTOR }}
## Transport configuration
ORACLE_ALLOW_HTTP_FOR_RPC={{ "yes" if ORACLE_ALLOW_HTTP_FOR_RPC else "no" }}
TB_QUEUE_URL={{ TB_QUEUE_URL }}
TB_REDIS_URL={{ TB_REDIS_URL }}
AMB_QUEUE_URL={{ AMB_QUEUE_URL }}
AMB_REDIS_URL={{ AMB_REDIS_URL }}
{% if ORACLE_FOREIGN_TX_RESEND_INTERVAL | default('') != '' %}
@ -70,23 +66,6 @@ ORACLE_FOREIGN_TX_RESEND_INTERVAL={{ ORACLE_FOREIGN_TX_RESEND_INTERVAL }}
ORACLE_HOME_TX_RESEND_INTERVAL={{ ORACLE_HOME_TX_RESEND_INTERVAL }}
{% endif %}
## Emergency shutdown configuration for TokenBridge
{% if TB_SHUTDOWN_SERVICE_URL | default('') != '' %}
TB_SHUTDOWN_SERVICE_URL={{ TB_SHUTDOWN_SERVICE_URL }}
{% endif %}
{% if TB_SHUTDOWN_SERVICE_POLLING_INTERVAL | default('') != '' %}
TB_SHUTDOWN_SERVICE_POLLING_INTERVAL={{ TB_SHUTDOWN_SERVICE_POLLING_INTERVAL }}
{% endif %}
{% if TB_SIDE_RPC_URL | default('') != '' %}
TB_SIDE_RPC_URL={{ TB_SIDE_RPC_URL }}
{% endif %}
{% if TB_SHUTDOWN_CONTRACT_ADDRESS | default('') != '' %}
TB_SHUTDOWN_CONTRACT_ADDRESS={{ TB_SHUTDOWN_CONTRACT_ADDRESS }}
{% endif %}
{% if TB_SHUTDOWN_CONTRACT_METHOD | default('') != '' %}
TB_SHUTDOWN_CONTRACT_METHOD={{ TB_SHUTDOWN_CONTRACT_METHOD }}
{% endif %}
## Emergency shutdown configuration for AMB
{% if AMB_SHUTDOWN_SERVICE_URL | default('') != '' %}
AMB_SHUTDOWN_SERVICE_URL={{ AMB_SHUTDOWN_SERVICE_URL }}
@ -104,13 +83,6 @@ AMB_SHUTDOWN_CONTRACT_ADDRESS={{ AMB_SHUTDOWN_CONTRACT_ADDRESS }}
AMB_SHUTDOWN_CONTRACT_METHOD={{ AMB_SHUTDOWN_CONTRACT_METHOD }}
{% endif %}
{% if TB_HOME_START_BLOCK | default('') != '' %}
TB_HOME_START_BLOCK={{ TB_HOME_START_BLOCK }}
{% endif %}
{% if TB_FOREIGN_START_BLOCK | default('') != '' %}
TB_FOREIGN_START_BLOCK={{ TB_FOREIGN_START_BLOCK }}
{% endif %}
{% if AMB_HOME_START_BLOCK | default('') != '' %}
AMB_HOME_START_BLOCK={{ AMB_HOME_START_BLOCK }}
{% endif %}

@ -1,6 +1,2 @@
## Validator-specific options
TB_ORACLE_VALIDATOR_ADDRESS={{ TB_ORACLE_VALIDATOR_ADDRESS }}
TB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY={{ TB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}
AMB_ORACLE_VALIDATOR_ADDRESS={{ AMB_ORACLE_VALIDATOR_ADDRESS }}
## Validator-specific options AMB_ORACLE_VALIDATOR_ADDRESS={{ AMB_ORACLE_VALIDATOR_ADDRESS }}
AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY={{ AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY }}

@ -14,8 +14,6 @@ WORKDIR="{{ '/home/' + compose_service_user | default('poadocker') + '/' + bridg
#Getting path to private key file and variable name for parsing key file
keyfile="{{ keyfile_path }}"
tbvaddr="TB_ORACLE_VALIDATOR_ADDRESS="
tbvkey="TB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="
ambvaddr="AMB_ORACLE_VALIDATOR_ADDRESS="
ambvkey="AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="
@ -23,12 +21,6 @@ ambvkey="AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY="
while read -r line
do
case $line in
$tbvaddr*)
tbvaddr=${line#$tbvaddr}
;;
$tbvkey*)
tbvkey=${line#$tbvkey}
;;
$ambvaddr*)
ambvaddr=${line#$ambvaddr}
;;
@ -44,8 +36,6 @@ start(){
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose rm -fv
sudo -u "{{ compose_service_user }}" \
TB_ORACLE_VALIDATOR_ADDRESS=$tbvaddr \
TB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$tbvkey \
AMB_ORACLE_VALIDATOR_ADDRESS=$ambvaddr \
AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$ambvkey \
/usr/local/bin/docker-compose up --detach

@ -1,97 +1,230 @@
---
version: '2.4'
networks:
net_db_bridge_amb_green: {driver: bridge}
net_db_bridge_amb_red: {driver: bridge}
net_rabbit_bridge_amb_green: {driver: bridge}
net_rabbit_bridge_amb_red: {driver: bridge}
net_ne_bridge_amb_red: {driver: bridge}
net_ne_bridge_amb_green: {driver: bridge}
services:
rabbit:
extends:
file: docker-compose.yml
service: rabbit
networks:
- net_rabbit_bridge_information
redis:
extends:
file: docker-compose.yml
service: redis
networks:
- net_db_bridge_information
bridge_request:
extends:
file: docker-compose.yml
service: bridge_request
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_collected:
extends:
file: docker-compose.yml
service: bridge_collected
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_affirmation:
extends:
file: docker-compose.yml
service: bridge_affirmation
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_information:
bridge_amb_affirmation:
cpus: 0.1
mem_limit: 500m
image: poanetwork/tokenbridge-oracle:latest
entrypoint: yarn watcher:affirmation-request
env_file: ./.env
environment:
- NODE_ENV=production
- ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}
environment: [NODE_ENV=production,
ORACLE_BRIDGE_MODE=ARBITRARY_MESSAGE,
'COMMON_HOME_BRIDGE_ADDRESS=${AMB_HOME_BRIDGE_ADDRESS}',
'COMMON_FOREIGN_BRIDGE_ADDRESS=${AMB_FOREIGN_BRIDGE_ADDRESS}',
'ORACLE_QUEUE_URL=${AMB_QUEUE_URL}',
'ORACLE_REDIS_URL=${AMB_REDIS_URL}',
'ORACLE_FOREIGN_START_BLOCK=${AMB_FOREIGN_START_BLOCK}',
'ORACLE_VALIDATOR_ADDRESS=${AMB_ORACLE_VALIDATOR_ADDRESS}']
image: poanetwork/tokenbridge-oracle:latest
logging:
driver: syslog
options: {tag: '{{.Name}}/{{.ID}}'}
mem_limit: 500m
networks: [net_db_bridge_amb_green,
net_rabbit_bridge_amb_green,
net_ne_bridge_amb_green]
restart: unless-stopped
depends_on:
- redis-amb
- rabbit-amb
bridge_amb_information:
cpus: 0.1
entrypoint: yarn watcher:information-request
networks:
- net_db_bridge_information
- net_rabbit_bridge_information
bridge_senderhome:
extends:
file: docker-compose.yml
service: bridge_senderhome
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_senderforeign:
extends:
file: docker-compose.yml
service: bridge_senderforeign
networks:
- net_db_bridge_request
- net_rabbit_bridge_request
bridge_shutdown:
extends:
file: docker-compose.yml
service: bridge_shutdown
networks:
- net_db_bridge_shutdown
env_file: ./.env
environment: [NODE_ENV=production,
ORACLE_BRIDGE_MODE=ARBITRARY_MESSAGE,
'COMMON_HOME_BRIDGE_ADDRESS=${AMB_HOME_BRIDGE_ADDRESS}',
'COMMON_FOREIGN_BRIDGE_ADDRESS=${AMB_FOREIGN_BRIDGE_ADDRESS}',
'ORACLE_QUEUE_URL=${AMB_QUEUE_URL}',
'ORACLE_REDIS_URL=${AMB_REDIS_URL}',
'ORACLE_HOME_START_BLOCK=${AMB_HOME_START_BLOCK}',
'ORACLE_VALIDATOR_ADDRESS=${AMB_ORACLE_VALIDATOR_ADDRESS}']
image: poanetwork/tokenbridge-oracle:latest
logging:
driver: syslog
options: {tag: '{{.Name}}/{{.ID}}'}
mem_limit: 500m
networks: [net_db_bridge_amb_green,
net_rabbit_bridge_amb_green,
net_ne_bridge_amb_green]
restart: unless-stopped
depends_on:
- redis-amb
- rabbit-amb
bridge_amb_request:
cpus: 0.1
entrypoint: yarn watcher:signature-request
env_file: ./.env
environment: [NODE_ENV=production,
ORACLE_BRIDGE_MODE=ARBITRARY_MESSAGE,
'COMMON_HOME_BRIDGE_ADDRESS=${AMB_HOME_BRIDGE_ADDRESS}',
'COMMON_FOREIGN_BRIDGE_ADDRESS=${AMB_FOREIGN_BRIDGE_ADDRESS}',
'ORACLE_QUEUE_URL=${AMB_QUEUE_URL}',
'ORACLE_REDIS_URL=${AMB_REDIS_URL}',
'ORACLE_HOME_START_BLOCK=${AMB_HOME_START_BLOCK}',
'ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=${AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY}']
image: poanetwork/tokenbridge-oracle:latest
logging:
driver: syslog
options: {tag: '{{.Name}}/{{.ID}}'}
mem_limit: 500m
networks: [net_db_bridge_amb_red,
net_rabbit_bridge_amb_red,
net_ne_bridge_amb_red]
restart: unless-stopped
depends_on:
- redis-amb
- rabbit-amb
bridge_amb_shutdown:
cpus: 0.1
entrypoint: yarn manager:shutdown
env_file: ./.env
environment: [NODE_ENV=production,
ORACLE_BRIDGE_MODE=ARBITRARY_MESSAGE,
'ORACLE_REDIS_URL=${AMB_REDIS_URL}',
'ORACLE_SHUTDOWN_SERVICE_POLLING_INTERVAL=${AMB_SHUTDOWN_SERVICE_POLLING_INTERVAL}',
'ORACLE_SIDE_RPC_URL=${AMB_SIDE_RPC_URL}',
'ORACLE_SHUTDOWN_CONTRACT_ADDRESS=${AMB_SHUTDOWN_CONTRACT_ADDRESS}',
'ORACLE_SHUTDOWN_CONTRACT_METHOD=${AMB_SHUTDOWN_CONTRACT_METHOD}']
image: poanetwork/tokenbridge-oracle:latest
logging:
driver: syslog
options: {tag: '{{.Name}}/{{.ID}}'}
mem_limit: 500m
networks: [net_db_bridge_amb_green]
restart: unless-stopped
depends_on:
- redis-amb
bridge_amb_senderhome:
cpus: 0.1
entrypoint: yarn sender:home
env_file: ./.env
environment: [NODE_ENV=production,
ORACLE_BRIDGE_MODE=ARBITRARY_MESSAGE,
'COMMON_HOME_BRIDGE_ADDRESS=${AMB_HOME_BRIDGE_ADDRESS}',
'COMMON_FOREIGN_BRIDGE_ADDRESS=${AMB_FOREIGN_BRIDGE_ADDRESS}',
'ORACLE_QUEUE_URL=${AMB_QUEUE_URL}',
'ORACLE_REDIS_URL=${AMB_REDIS_URL}',
'ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=${AMB_ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY}']
image: poanetwork/tokenbridge-oracle:latest
logging:
driver: syslog
options: {tag: '{{.Name}}/{{.ID}}'}
mem_limit: 500m
networks: [net_db_bridge_amb_red,
net_rabbit_bridge_amb_red,
net_ne_bridge_amb_red]
restart: unless-stopped
depends_on:
- redis-amb
- rabbit-amb
networks:
net_db_bridge_request:
driver: bridge
net_db_bridge_collected:
driver: bridge
net_db_bridge_affirmation:
driver: bridge
net_db_bridge_information:
driver: bridge
net_db_bridge_senderhome:
driver: bridge
net_db_bridge_senderforeign:
driver: bridge
net_rabbit_bridge_request:
driver: bridge
net_db_bridge_shutdown:
driver: bridge
net_rabbit_bridge_collected:
driver: bridge
net_rabbit_bridge_affirmation:
driver: bridge
net_rabbit_bridge_information:
driver: bridge
net_rabbit_bridge_senderhome:
driver: bridge
net_rabbit_bridge_senderforeign:
driver: bridge
# bridge_amb_collected:
# cpus: 0.1
# entrypoint: yarn watcher:collected-signatures
# env_file: ./.env
# environment: [NODE_ENV=production,
# ORACLE_BRIDGE_MODE=ARBITRARY_MESSAGE,
# 'COMMON_HOME_BRIDGE_ADDRESS=${AMB_HOME_BRIDGE_ADDRESS}',
# 'COMMON_FOREIGN_BRIDGE_ADDRESS=${AMB_FOREIGN_BRIDGE_ADDRESS}',
# 'ORACLE_QUEUE_URL=${AMB_QUEUE_URL}',
# 'ORACLE_REDIS_URL=${AMB_REDIS_URL}',
# 'ORACLE_HOME_START_BLOCK=${AMB_HOME_START_BLOCK}',
# 'ORACLE_ALWAYS_RELAY_SIGNATURES=true'
# 'ORACLE_HOME_TO_FOREIGN_ALLOWANCE_LIST=/mono/oracle/access-lists/allowance_list.txt',
# 'ORACLE_VALIDATOR_ADDRESS=${ORACLE_VALIDATOR_ADDRESS}']
# image: poanetwork/tokenbridge-oracle:latest
# volumes:
# - '~/amb_bridge_data/access-lists/allowance_list.txt:/mono/oracle/access-lists/allowance_list.txt'
# logging:
# driver: syslog
# options: {tag: '{{.Name}}/{{.ID}}'}
# mem_limit: 500m
# networks: [net_db_bridge_amb_green,
# net_rabbit_bridge_amb_green,
# net_ne_bridge_amb_green]
# restart: unless-stopped
# bridge_amb_senderforeign:
# cpus: 0.1
# entrypoint: yarn sender:foreign
# env_file: ./.env
# environment: [NODE_ENV=production,
# ORACLE_BRIDGE_MODE=ARBITRARY_MESSAGE,
# 'COMMON_HOME_BRIDGE_ADDRESS=${AMB_HOME_BRIDGE_ADDRESS}',
# 'COMMON_FOREIGN_BRIDGE_ADDRESS=${AMB_FOREIGN_BRIDGE_ADDRESS}',
# 'ORACLE_QUEUE_URL=${AMB_QUEUE_URL}',
# 'ORACLE_REDIS_URL=${AMB_REDIS_URL}',
# 'ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=${ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY}']
# image: poanetwork/tokenbridge-oracle:latest
# logging:
# driver: syslog
# options: {tag: '{{.Name}}/{{.ID}}'}
# mem_limit: 500m
# networks: [net_db_bridge_amb_red,
# net_rabbit_bridge_amb_red]
# restart: unless-stopped
rabbit-amb:
cpus: 0.3
environment: [RABBITMQ_NODENAME=node@rabbit-amb]
hostname: rabbit-amb
image: rabbitmq:3
logging:
driver: syslog
options: {tag: '{{.Name}}/{{.ID}}'}
mem_limit: 500m
networks: [net_rabbit_bridge_amb_red,
net_rabbit_bridge_amb_green]
restart: unless-stopped
volumes: ['~/amb_bridge_data/rabbitmq:/var/lib/rabbitmq/mnesia']
redis-amb:
command: [redis-server, --appendonly, 'yes']
cpus: 0.1
hostname: redis-amb
image: redis:4
logging:
driver: syslog
options: {tag: '{{.Name}}/{{.ID}}'}
mem_limit: 500m
networks: [net_db_bridge_amb_red,
net_db_bridge_amb_green]
restart: unless-stopped
volumes: ['~/amb_bridge_data/redis:/data']
ne:
container_name: ne
image: nethermind/nethermind:latest
networks: [net_ne_bridge_amb_green,
net_ne_bridge_amb_red]
command:
--config xdai
--baseDbPath /nethermind
--JsonRpc.Enabled true
--JsonRpc.Host 0.0.0.0
--Init.StoreReceipts false
--TxPool.Size 8192
--Pruning.Mode Hybrid
--Pruning.CacheMb 1024
--Sync.FastSync true
--Sync.FastBlocks true
--Sync.DownloadBodiesInFastSync false
--Sync.DownloadReceiptsInFastSync false
--Sync.DownloadHeadersInFastSync false
volumes:
- ~/ne-data/logs:/nethermind/logs
- ~/ne-data/nethermind_db:/nethermind/nethermind_db
expose:
- "8545"
ports:
- "30304:30303/tcp"
- "30304:30303/udp"
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "1"