omni / poa-bridge

POA <-> Ethereum bridge for self transfers of POA native token to POA20 (ERC20 representation). Not supported. Use TokenBridge instead
https://github.com/poanetwork/token-bridge
GNU General Public License v3.0
79 stars 38 forks source link

Failover RPC support #107

Open akolotov opened 6 years ago

akolotov commented 6 years ago

At this moment it is possible to configure on one RPC url for each bridge direction:

home.rpc_host/home.rpc_port
foreign.rpc_host/foreign.rpc_port 

It means that if the remote node will not be accessible (e.g. the link is down or the node was shut down) the bridge will not be able to get events and send transactions by using the corresponding RPC channel.

In order to increase availability of the bridge opearations it is suggested to introduce two types of RCP URLs: primary RPC URL and failover RPC URL:

home.primary_rpc_host/home.primary_rpc_port
home.failover_rpc_host/home.failover_rpc_port
foreign.primary_rpc_host/foreign.primary_rpc_port
foreign.failover_rpc_host/foreign.failover_rpc_port 

In this case, the bridge should switch to failover RPC link if the primary RPC node is not accessible by primary RPC URL. As soon as the link is switched the corresponding log message should appear, e.g.

The primary RPC channel (<url is here>) is not accessible. Switching to the failover RPC channel (<url is here>)

If the failover RPC URL is not configured the bridge should crash as soon as the primary RPC channel is down.

If the failover RPC URL is down the primary RPC URL must be checked again and the bridge should switch to this channel.

If both channels are not available the bridge must crash with the corresponding log message.