diff --git a/deployment/CONFIGURATION.md b/deployment/CONFIGURATION.md index 4c48836f0..d631aec4d 100644 --- a/deployment/CONFIGURATION.md +++ b/deployment/CONFIGURATION.md @@ -4,7 +4,7 @@ Please see the [Configuration](../CONFIGURATION.md) for additional configuration ## Prerequisites -A functional Ubuntu 16.04 server launched using a trusted hosting provider. For more information, see our tutorials on [setting up a validator node on AWS](https://github.com/poanetwork/wiki/wiki/Validator-Node-on-AWS) or [setting up on non-AWS](https://github.com/poanetwork/wiki/wiki/Validator-Node-Non-AWS). +A functional Ubuntu 16.04 server launched using a trusted hosting provider. * Record the IP address (required for file setup). * Setup ssh access to your node via public+private keys (using passwords is less secure). * When creating the node, set a meaningful `hostname` that can identify you (e.g. `validator-0x...`). @@ -13,7 +13,7 @@ A functional Ubuntu 16.04 server launched using a trusted hosting provider. For 1. Clone this repository and go to the `deployment` folder ``` -git clone --recursive https://github.com/poanetwork/tokenbridge +git clone --recursive https://github.com/gnosischain/tokenbridge cd tokenbridge/deployment ``` 2. Create the file `hosts.yml` from `hosts.yml.example` @@ -24,25 +24,21 @@ cp hosts.yml.example hosts.yml `hosts.yml` should have the following structure: ```yaml -: +all: children: oracle: - hosts: - : - ansible_user: - ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "" - #syslog_server_port: "://:" # When this parameter is set all bridge logs will be redirected to : address. - : - # (...) - monitor: - hosts: - : - ansible_user: - #syslog_server_port: "://:" - #monitor_cron_schedule: "*/4 * * * *" # When this parameter is set, it will overwrite default schedule for performing checks + children: + : + hosts: + : + ansible_user: + ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "........................." # without 0x + #syslog_server_port: "://:" # When this parameter is set all bridge logs will be redirected to : address. ``` -The config above would install the Oracle on ``, and both Oracle and Monitor on ``. +Deprecated: monitor playbook! + +The config above would install the Oracle on ``. ``` | Value | Description | @@ -58,17 +54,13 @@ The config above would install the Oracle on ``, and both Oracle and 3. Copy the bridge name(s) to the hosts.yml file. 1. Go to the group_vars folder. `cd group_vars` - 2. Note the and add it to the hosts.yml configuration. For example, if a bridge file is named sokol-kovan.yml, you would change the value in hosts.yml to sokol-kovan. - -## Examples - -[Deploy a monitor for multiple bridges](./MONITOR.md) + 2. Note the and add it to the hosts.yml configuration. For example, if a bridge file is named native_test.yml, you would change the value in hosts.yml to native_test. ## Administrator Configurations 1. The `group_vars/.yml` file contains the public bridge parameters. This file is prepared by administrators for each bridge. The validator only needs to add the required bridge name in the hosts.yml file to tell Ansible which file to use. - `group_vars/example.yml` shows an example configuration for the POA/Sokol - POA/Sokol bridge. Parameter values should match values from the .env file for the Oracle. See [Configuration parameters](../../oracle/README.md#configuration-parameters) for details. + `group_vars/native_test.yml` shows an example configuration for the XDAI Native Bridge: Chiado - Goerli. Parameter values should match values from the .env file for the Oracle. See [Configuration parameters](../../oracle/README.md#configuration-parameters) for details. 2. You can also add the following parameters in the `group_vars` to change the default behavior of the playbooks: diff --git a/deployment/EXECUTION.md b/deployment/EXECUTION.md index ac9dba84a..54439ce07 100644 --- a/deployment/EXECUTION.md +++ b/deployment/EXECUTION.md @@ -44,7 +44,6 @@ The deployed components have the following services: Component | Service Name --- | --- Oracle | poabridge -Monitor | tokenbridge-monitor Use the default `SysVinit` commands to `start`, `stop`, `restart`, and `rebuild` the service and to check the `status` of the service. @@ -72,8 +71,10 @@ where the __ could be one of the following: - `signature-request` - `collected-signatures` - `affirmation-request` +- `transfer` ## Reset nonce counters + In case some tx from your bridge validator account were done outside the bridge, you might need to update nonce counters. 1. ssh to your bridge node and run: diff --git a/deployment/group_vars/amb.yml b/deployment/group_vars/amb.yml deleted file mode 100644 index 82af3ecb9..000000000 --- a/deployment/group_vars/amb.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -ORACLE_BRIDGE_MODE: "ARBITRARY_MESSAGE" -COMMON_HOME_BRIDGE_ADDRESS: "0x8397be90BCF57b0B71219f555Fe121b22e5a994C" -COMMON_FOREIGN_BRIDGE_ADDRESS: "0x1feB40aD9420b186F019A717c37f5546165d411E" -MONITOR_PORT: 3013 diff --git a/deployment/group_vars/amb_production.yml b/deployment/group_vars/amb_production.yml new file mode 100644 index 000000000..420f32ade --- /dev/null +++ b/deployment/group_vars/amb_production.yml @@ -0,0 +1,44 @@ +--- +## General settings +ORACLE_BRIDGE_MODE: "ARBITRARY_MESSAGE" +ORACLE_ALLOW_HTTP_FOR_RPC: yes +ORACLE_LOG_LEVEL: info + +## Home contract +COMMON_HOME_RPC_URL: "https://rpc.ankr.com/gnosis" +ORACLE_HOME_RPC_POLLING_INTERVAL: 15000 +COMMON_HOME_BRIDGE_ADDRESS: "0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59" + +## Foreign contract +COMMON_FOREIGN_RPC_URL: "https://mainnet.infura.io/v3/" +ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 24000 +COMMON_FOREIGN_BRIDGE_ADDRESS: "0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e" + +ORACLE_TX_REDUNDANCY: true +ORACLE_HOME_TX_RESEND_INTERVAL: 300000 + +## Home Gasprice +COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "eip1559-gas-estimation" +COMMON_HOME_GAS_PRICE_SPEED_TYPE: "fast" +COMMON_HOME_GAS_PRICE_FALLBACK: 2000000000 # in wei +COMMON_HOME_GAS_PRICE_FACTOR: 1 +ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 + +## Foreign Gasprice +COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL: "eip1559-gas-estimation" +COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE: "fast" +COMMON_FOREIGN_GAS_PRICE_FALLBACK: 100000000000 # in wei +COMMON_FOREIGN_GAS_PRICE_FACTOR: 1 +ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 + +QUEUE_URL: "amqp://rabbit-amb" +REDIS_URL: "redis://redis-amb" + +# disable building and pulling of docker images from the Docker Hub +# skip_pull: true +# skip_build: true + +## BEGIN Calculated by scripts/getValidatorStartBlocks.js +# ORACLE_HOME_START_BLOCK: 25106875 +# ORACLE_FOREIGN_START_BLOCK: 16027237 +## END Calculated by scripts/getValidatorStartBlocks.js diff --git a/deployment/group_vars/amb_test.yml b/deployment/group_vars/amb_test.yml new file mode 100644 index 000000000..4712e51ad --- /dev/null +++ b/deployment/group_vars/amb_test.yml @@ -0,0 +1,36 @@ +--- +ORACLE_BRIDGE_MODE: "ARBITRARY_MESSAGE" +ORACLE_LOG_LEVEL: debug + +COMMON_HOME_RPC_URL: "https://rpc.chiadochain.net/" +COMMON_HOME_BRIDGE_ADDRESS: "0x60b0f8800039457de96D1b6c0A13fc270F1C99CE" +ORACLE_HOME_RPC_POLLING_INTERVAL: 5000 + +COMMON_FOREIGN_RPC_URL: "https://goerli.infura.io/v3/" +COMMON_FOREIGN_BRIDGE_ADDRESS: "0xa3264bAFa607BDe904A9A400d2C3a3a3d0C79eA8" +ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 5000 + +ORACLE_TX_REDUNDANCY: true +ORACLE_HOME_TX_RESEND_INTERVAL: 300000 + +COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "eip1559-gas-estimation" +COMMON_HOME_GAS_PRICE_SPEED_TYPE: "fast" +COMMON_HOME_GAS_PRICE_FALLBACK: 1000000000 +COMMON_HOME_GAS_PRICE_FACTOR: 1 +ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 + +COMMON_FOREIGN_GAS_PRICE_FALLBACK: 10000000000 +COMMON_FOREIGN_GAS_PRICE_FACTOR: 1 +ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 + +ORACLE_ALLOW_HTTP_FOR_RPC: false + +# = +QUEUE_URL: "amqp://rabbit-amb" +REDIS_URL: "redis://redis-amb" +#!= + +## BEGIN Calculated by scripts/getValidatorStartBlocks.js +# ORACLE_HOME_START_BLOCK: 849859 +# ORACLE_FOREIGN_START_BLOCK: 7951812 +## END Calculated by scripts/getValidatorStartBlocks.js diff --git a/deployment/group_vars/dai.yml b/deployment/group_vars/dai.yml deleted file mode 100644 index 4d7e1a440..000000000 --- a/deployment/group_vars/dai.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -## General settings -ORACLE_BRIDGE_MODE: "ERC_TO_NATIVE" - -## Home contract -COMMON_HOME_RPC_URL: "https://dai.poa.network" -COMMON_HOME_BRIDGE_ADDRESS: "0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6" -ORACLE_HOME_RPC_POLLING_INTERVAL: 5000 - -## Foreign contract -COMMON_FOREIGN_RPC_URL: "https://mainnet.infura.io" -COMMON_FOREIGN_BRIDGE_ADDRESS: "0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016" -ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 5000 - -## Home Gasprice -# COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "https://localhost:8888/" -COMMON_HOME_GAS_PRICE_SPEED_TYPE: "standard" -COMMON_HOME_GAS_PRICE_FALLBACK: 0 -COMMON_HOME_GAS_PRICE_FACTOR: 600000 - -## Foreign Gasprice -COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL: "https://gasprice.poa.network/" -COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE: "standard" -COMMON_FOREIGN_GAS_PRICE_FALLBACK: 10000000000 -ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 -COMMON_FOREIGN_GAS_PRICE_FACTOR: 1 - -## Monitor -MONITOR_BRIDGE_NAME: "xdai" -MONITOR_PORT: 3003 -MONITOR_CACHE_EVENTS: "true" -MONITOR_HOME_START_BLOCK: 759 -MONITOR_FOREIGN_START_BLOCK: 6478417 -MONITOR_VALIDATOR_HOME_TX_LIMIT: 300000 -MONITOR_VALIDATOR_FOREIGN_TX_LIMIT: 300000 -MONITOR_TX_NUMBER_THRESHOLD: 100 diff --git a/deployment/group_vars/erc-to-native.yml b/deployment/group_vars/erc-to-native.yml deleted file mode 100644 index 345b359b5..000000000 --- a/deployment/group_vars/erc-to-native.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -ORACLE_BRIDGE_MODE: "ERC_TO_NATIVE" -COMMON_HOME_BRIDGE_ADDRESS: "0x5118AC62AE912Dd5B51EEfF7338c4fcb0248Ba8c" -COMMON_FOREIGN_BRIDGE_ADDRESS: "0x32198D570fffC7033641F8A9094FFDCaAEF42624" -MONITOR_PORT: 3012 diff --git a/deployment/group_vars/native_production.yml b/deployment/group_vars/native_production.yml new file mode 100644 index 000000000..af37e43b0 --- /dev/null +++ b/deployment/group_vars/native_production.yml @@ -0,0 +1,40 @@ +--- +## General settings +ORACLE_BRIDGE_MODE: "ERC_TO_NATIVE" +ORACLE_ALLOW_HTTP_FOR_RPC: yes +ORACLE_LOG_LEVEL: info + +## Home contract +COMMON_HOME_RPC_URL: "https://rpc.ankr.com/gnosis" +ORACLE_HOME_RPC_POLLING_INTERVAL: 15000 +COMMON_HOME_BRIDGE_ADDRESS: "0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6" + +## Foreign contract +COMMON_FOREIGN_RPC_URL: "https://mainnet.infura.io/v3/" +ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 24000 +COMMON_FOREIGN_BRIDGE_ADDRESS: "0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016" + +ORACLE_TX_REDUNDANCY: true +ORACLE_HOME_TX_RESEND_INTERVAL: 300000 + +## Home Gasprice +COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "eip1559-gas-estimation" +COMMON_HOME_GAS_PRICE_SPEED_TYPE: "fast" +COMMON_HOME_GAS_PRICE_FALLBACK: 2000000000 # in wei +COMMON_HOME_GAS_PRICE_FACTOR: 1 +ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 + +## Foreign Gasprice +COMMON_FOREIGN_GAS_PRICE_SUPPLIER_URL: "eip1559-gas-estimation" +COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE: "fast" +COMMON_FOREIGN_GAS_PRICE_FALLBACK: 100000000000 # in wei +COMMON_FOREIGN_GAS_PRICE_FACTOR: 1 +ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 + +QUEUE_URL: "amqp://rabbit" +REDIS_URL: "redis://redis" + +## BEGIN Calculated by scripts/getValidatorStartBlocks.js +# ORACLE_HOME_START_BLOCK: 25106875 +# ORACLE_FOREIGN_START_BLOCK: 16027237 +## END Calculated by scripts/getValidatorStartBlocks.js diff --git a/deployment/group_vars/native_test.yml b/deployment/group_vars/native_test.yml new file mode 100644 index 000000000..1b58f6e98 --- /dev/null +++ b/deployment/group_vars/native_test.yml @@ -0,0 +1,36 @@ +--- +ORACLE_BRIDGE_MODE: "ERC_TO_NATIVE" +ORACLE_LOG_LEVEL: debug + +COMMON_HOME_RPC_URL: "https://rpc.chiadochain.net/" +COMMON_HOME_BRIDGE_ADDRESS: "0x1558B3D83D56bDF55Db1E9410AAdBD2F79057228" +ORACLE_HOME_RPC_POLLING_INTERVAL: 5000 + +COMMON_FOREIGN_RPC_URL: "https://goerli.infura.io/v3/" +COMMON_FOREIGN_BRIDGE_ADDRESS: "0x71cf72bdc6b3f77a12c7521e34c711c7dec0c336" +ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 5000 + +ORACLE_TX_REDUNDANCY: true +ORACLE_HOME_TX_RESEND_INTERVAL: 300000 + +COMMON_HOME_GAS_PRICE_SUPPLIER_URL: "eip1559-gas-estimation" +COMMON_HOME_GAS_PRICE_SPEED_TYPE: "fast" +COMMON_HOME_GAS_PRICE_FALLBACK: 1000000000 +COMMON_HOME_GAS_PRICE_FACTOR: 1 +ORACLE_HOME_GAS_PRICE_UPDATE_INTERVAL: 600000 + +COMMON_FOREIGN_GAS_PRICE_FALLBACK: 30000000000 +COMMON_FOREIGN_GAS_PRICE_FACTOR: 1 +ORACLE_FOREIGN_GAS_PRICE_UPDATE_INTERVAL: 600000 + +ORACLE_ALLOW_HTTP_FOR_RPC: false + +# = +QUEUE_URL: "amqp://rabbit" +REDIS_URL: "redis://redis" +#!= + +## BEGIN Calculated by scripts/getValidatorStartBlocks.js +# ORACLE_HOME_START_BLOCK: 838278 +# ORACLE_FOREIGN_START_BLOCK: 7949543 +## END Calculated by scripts/getValidatorStartBlocks.js diff --git a/deployment/hosts.yml.example b/deployment/hosts.yml.example index 5cde8e82f..4a02145ab 100644 --- a/deployment/hosts.yml.example +++ b/deployment/hosts.yml.example @@ -1,15 +1,13 @@ --- -sokol-kovan: +# EXECUTION COMMAND: +# ansible-playbook -e 'ansible_python_interpreter=/usr/bin/python3' -i hosts.yml site.yml --ask-become --limit +all: children: oracle: - hosts: - 127.0.0.1: - ansible_user: ubuntu - ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - #syslog_server_port: "udp://127.0.0.1:514" - monitor: - hosts: - 127.0.0.1: - ansible_user: ubuntu - #syslog_server_port: "://:" - #monitor_cron_schedule: "*/4 * * * *" + children: + : + hosts: + : + ansible_user: + ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "........................." # without 0x + #syslog_server_port: "://:" # When this parameter is set all bridge logs will be redirected to : address. diff --git a/deployment/roles/oracle/templates/poabridge.j2 b/deployment/roles/oracle/templates/poabridge.j2 index 31f7b1a5a..14fedeba8 100644 --- a/deployment/roles/oracle/templates/poabridge.j2 +++ b/deployment/roles/oracle/templates/poabridge.j2 @@ -36,7 +36,15 @@ start(){ cd $WORKDIR sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose $composefileoverride down -v sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose $composefileoverride rm -fv - sudo -u "{{ compose_service_user }}" ORACLE_VALIDATOR_ADDRESS=$vaddr ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey /usr/local/bin/docker-compose $composefileoverride up --detach + sudo -u "{{ compose_service_user }}" \ + ORACLE_VALIDATOR_ADDRESS=$vaddr ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey \ + /usr/local/bin/docker-compose $composefileoverride up --detach + + # this containers are not used in production because a validator should not execute a claim in the foreign network + sudo -u "{{ compose_service_user }}" \ + ORACLE_VALIDATOR_ADDRESS=$vaddr ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=$vkey \ + /usr/local/bin/docker-compose $composefileoverride \ + stop bridge_senderforeign bridge_collected } stop(){ diff --git a/deployment/site.yml b/deployment/site.yml index 53a2de0d3..cb9da5e1e 100644 --- a/deployment/site.yml +++ b/deployment/site.yml @@ -4,8 +4,9 @@ become: true roles: - { role: oracle } -- name: Install Monitor - hosts: monitor - become: true - roles: - - { role: monitor } +# @TODO deprecated +# - name: Install Monitor +# hosts: monitor +# become: true +# roles: +# - { role: monitor }