From d17ea2ad2b65f4f19f16c31a332ad8953a6e9ade Mon Sep 17 00:00:00 2001 From: Alexander Kolotov Date: Fri, 2 Oct 2020 19:44:05 +0300 Subject: [PATCH] One point of handling all collected signatures requests (#457) --- CONFIGURATION.md | 3 ++- oracle/src/events/processAMBCollectedSignatures/index.js | 6 +++++- oracle/src/events/processCollectedSignatures/index.js | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 29469832..da514fb2 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -22,7 +22,7 @@ COMMON_FOREIGN_GAS_PRICE_FACTOR | A value that will multiply the gas price of th name | description | value --- | --- | --- -ORACLE_BRIDGE_MODE | The bridge mode. The bridge starts listening to a different set of events based on this parameter. | NATIVE_TO_ERC / ERC_TO_ERC / ERC_TO_NATIVE +ORACLE_BRIDGE_MODE | The bridge mode. The bridge starts listening to a different set of events based on this parameter. | NATIVE_TO_ERC / ERC_TO_ERC / ERC_TO_NATIVE / ARBITRARY_MESSAGE ORACLE_ALLOW_HTTP_FOR_RPC | **Only use in test environments - must be omitted in production environments.**. If this parameter is specified and set to `yes`, RPC URLs can be specified in form of HTTP links. A warning that the connection is insecure will be written to the logs. | `yes` / `no` ORACLE_HOME_RPC_POLLING_INTERVAL | The interval in milliseconds used to request the RPC node in the Home network for new blocks. The interval should match the average production time for a new block. | integer ORACLE_FOREIGN_RPC_POLLING_INTERVAL | The interval in milliseconds used to request the RPC node in the Foreign network for new blocks. The interval should match the average production time for a new block. | integer @@ -40,6 +40,7 @@ ORACLE_TX_REDUNDANCY | If set to `true`, instructs oracle to send `eth_sendRawTr ORACLE_HOME_TO_FOREIGN_ALLOWANCE_LIST | Filename with a list of addresses, separated by newlines. If set, determines the privileged set of accounts whose requests will be automatically processed by the CollectedSignatures watcher. | string ORACLE_HOME_TO_FOREIGN_BLOCK_LIST | Filename with a list of addresses, separated by newlines. If set, determines the blocked set of accounts whose requests will not be automatically processed by the CollectedSignatures watcher. Has a lower priority than the `ORACLE_HOME_TO_FOREIGN_ALLOWANCE_LIST` | string ORACLE_HOME_TO_FOREIGN_CHECK_SENDER | If set to `true`, instructs the oracle to do an extra check for transaction origin in the block/allowance list. `false` by default. | `true` / `false` +ORACLE_ALWAYS_RELAY_SIGNATURES | If set to `true`, the oracle will always relay signatures even if it was not the last who finilized the signatures collecting process. The default is `false`. | `true` / `false` ## UI configuration diff --git a/oracle/src/events/processAMBCollectedSignatures/index.js b/oracle/src/events/processAMBCollectedSignatures/index.js index 6985953f..05af5397 100644 --- a/oracle/src/events/processAMBCollectedSignatures/index.js +++ b/oracle/src/events/processAMBCollectedSignatures/index.js @@ -12,6 +12,8 @@ const { MAX_CONCURRENT_EVENTS, EXTRA_GAS_ABSOLUTE } = require('../../utils/const const limit = promiseLimit(MAX_CONCURRENT_EVENTS) +const { ORACLE_ALWAYS_RELAY_SIGNATURES } = process.env + let validatorContract = null function processCollectedSignaturesBuilder(config) { @@ -39,7 +41,9 @@ function processCollectedSignaturesBuilder(config) { eventTransactionHash: colSignature.transactionHash }) - if (authorityResponsibleForRelay !== web3Home.utils.toChecksumAddress(config.validatorAddress)) { + if (ORACLE_ALWAYS_RELAY_SIGNATURES && ORACLE_ALWAYS_RELAY_SIGNATURES === 'true') { + logger.debug('Validator handles all CollectedSignature requests') + } else if (authorityResponsibleForRelay !== web3Home.utils.toChecksumAddress(config.validatorAddress)) { logger.info(`Validator not responsible for relaying CollectedSignatures ${colSignature.transactionHash}`) return } diff --git a/oracle/src/events/processCollectedSignatures/index.js b/oracle/src/events/processCollectedSignatures/index.js index 448168b6..91e21ba4 100644 --- a/oracle/src/events/processCollectedSignatures/index.js +++ b/oracle/src/events/processCollectedSignatures/index.js @@ -13,7 +13,8 @@ const { MAX_CONCURRENT_EVENTS } = require('../../utils/constants') const { ORACLE_HOME_TO_FOREIGN_ALLOWANCE_LIST, ORACLE_HOME_TO_FOREIGN_BLOCK_LIST, - ORACLE_HOME_TO_FOREIGN_CHECK_SENDER + ORACLE_HOME_TO_FOREIGN_CHECK_SENDER, + ORACLE_ALWAYS_RELAY_SIGNATURES } = process.env const limit = promiseLimit(MAX_CONCURRENT_EVENTS) @@ -45,7 +46,9 @@ function processCollectedSignaturesBuilder(config) { eventTransactionHash: colSignature.transactionHash }) - if (authorityResponsibleForRelay !== web3Home.utils.toChecksumAddress(config.validatorAddress)) { + if (ORACLE_ALWAYS_RELAY_SIGNATURES && ORACLE_ALWAYS_RELAY_SIGNATURES === 'true') { + logger.debug('Validator handles all CollectedSignature requests') + } else if (authorityResponsibleForRelay !== web3Home.utils.toChecksumAddress(config.validatorAddress)) { logger.info(`Validator not responsible for relaying CollectedSignatures ${colSignature.transactionHash}`) return }