diff --git a/bridge/docs/observability.md b/bridge/docs/observability.md index fe59f9e7b..9e2622188 100644 --- a/bridge/docs/observability.md +++ b/bridge/docs/observability.md @@ -137,7 +137,7 @@ the source field set contains all fields which are included in the source object | Instance_public_key | string | yes | Instance public key which you can use to filter logs by instance | | Bridge_wallet_address | string | yes | The bridge account address which you can use to filter logs by bridge | | Stellar_network | string | yes | Stellar network name which you can use to filter logs by environment | -| Tfchain_url | string | yes | The url of the substrate rpc node which you can use to filter logs by environment | +| Tfchain_urls | []string | yes | The urls of the substrate rpc nodes which you can use to filter logs by environment | #### Event-specific fields: @@ -1014,7 +1014,7 @@ the filtered result would be similar to the one below: "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "16d8b06b59aaa5514c645260263e5477bb8aad211502c56cb8849ed5b423d354", "event_action": "payment_received", @@ -1036,7 +1036,7 @@ the filtered result would be similar to the one below: "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "16d8b06b59aaa5514c645260263e5477bb8aad211502c56cb8849ed5b423d354", "event_action": "transfer_initiated", @@ -1055,7 +1055,7 @@ the filtered result would be similar to the one below: "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "16d8b06b59aaa5514c645260263e5477bb8aad211502c56cb8849ed5b423d354", "event_action": "mint_proposed", @@ -1076,7 +1076,7 @@ the filtered result would be similar to the one below: "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "16d8b06b59aaa5514c645260263e5477bb8aad211502c56cb8849ed5b423d354", "event_action": "mint_completed", @@ -1092,7 +1092,7 @@ the filtered result would be similar to the one below: "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "16d8b06b59aaa5514c645260263e5477bb8aad211502c56cb8849ed5b423d354", "event_action": "transfer_completed", @@ -1131,7 +1131,7 @@ This time, the transfer was not completed on the other network and was instead r "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "10", "event_action": "event_burn_tx_created_received", @@ -1147,7 +1147,7 @@ This time, the transfer was not completed on the other network and was instead r "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "10", "event_action": "transfer_initiated", @@ -1166,7 +1166,7 @@ This time, the transfer was not completed on the other network and was instead r "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "10", "event_action": "mint_proposed", @@ -1187,7 +1187,7 @@ This time, the transfer was not completed on the other network and was instead r "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "10", "event_action": "mint_completed", @@ -1203,7 +1203,7 @@ This time, the transfer was not completed on the other network and was instead r "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "10", "event_action": "transfer_completed", @@ -1239,7 +1239,7 @@ For a more simplified view, you can filter events by the transfer category to di "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "13", "event_action": "event_burn_tx_created_received", @@ -1255,7 +1255,7 @@ For a more simplified view, you can filter events by the transfer category to di "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "13", "event_action": "transfer_initiated", @@ -1274,7 +1274,7 @@ For a more simplified view, you can filter events by the transfer category to di "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "13", "event_action": "withdraw_proposed", @@ -1295,7 +1295,7 @@ For a more simplified view, you can filter events by the transfer category to di "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "13", "event_action": "event_burn_tx_ready_received", @@ -1311,7 +1311,7 @@ For a more simplified view, you can filter events by the transfer category to di "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "13", "event_action": "stellar_transaction_submitted", @@ -1330,7 +1330,7 @@ For a more simplified view, you can filter events by the transfer category to di "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "13", "event_action": "withdraw_completed", @@ -1346,7 +1346,7 @@ For a more simplified view, you can filter events by the transfer category to di "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "13", "event_action": "transfer_completed", @@ -1380,7 +1380,7 @@ Also Upon reviewing the `refund_proposed` event, we found that the `reason` fiel "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "7f0406ad7b8d4f0de6dade19eb3979ef93857a56c6daa4bf9f2b0bb22a21d84f", "event_action": "payment_received", @@ -1402,7 +1402,7 @@ Also Upon reviewing the `refund_proposed` event, we found that the `reason` fiel "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "7f0406ad7b8d4f0de6dade19eb3979ef93857a56c6daa4bf9f2b0bb22a21d84f", "event_action": "transfer_initiated", @@ -1421,7 +1421,7 @@ Also Upon reviewing the `refund_proposed` event, we found that the `reason` fiel "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "7f0406ad7b8d4f0de6dade19eb3979ef93857a56c6daa4bf9f2b0bb22a21d84f", "event_action": "refund_proposed", @@ -1440,7 +1440,7 @@ Also Upon reviewing the `refund_proposed` event, we found that the `reason` fiel "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "7f0406ad7b8d4f0de6dade19eb3979ef93857a56c6daa4bf9f2b0bb22a21d84f", "event_action": "event_refund_tx_ready_received", @@ -1456,7 +1456,7 @@ Also Upon reviewing the `refund_proposed` event, we found that the `reason` fiel "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "7f0406ad7b8d4f0de6dade19eb3979ef93857a56c6daa4bf9f2b0bb22a21d84f", "event_action": "stellar_transaction_submitted", @@ -1475,7 +1475,7 @@ Also Upon reviewing the `refund_proposed` event, we found that the `reason` fiel "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "7f0406ad7b8d4f0de6dade19eb3979ef93857a56c6daa4bf9f2b0bb22a21d84f", "event_action": "refund_completed", @@ -1491,7 +1491,7 @@ Also Upon reviewing the `refund_proposed` event, we found that the `reason` fiel "Instance_public_key": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Bridge_wallet_address": "GBD3PXJEQOCQ5VR2JSMFNXYBBQF5RDEZP5GMTXDYZWMNZQJHR6HFX3AJ", "Stellar_network": "testnet", - "Tfchain_url": "ws://localhost:9944" + "Tfchain_urls": ["ws://localhost:9944"] }, "trace_id": "7f0406ad7b8d4f0de6dade19eb3979ef93857a56c6daa4bf9f2b0bb22a21d84f", "event_action": "transfer_completed", diff --git a/bridge/tfchain_bridge/main.go b/bridge/tfchain_bridge/main.go index 613ae1217..ebd3adf5e 100644 --- a/bridge/tfchain_bridge/main.go +++ b/bridge/tfchain_bridge/main.go @@ -18,7 +18,7 @@ func main() { var bridgeCfg pkg.BridgeConfig var debug bool - flag.StringVar(&bridgeCfg.TfchainURL, "tfchainurl", "", "Tfchain websocket url") + flag.StringArrayVar(&bridgeCfg.TfchainURLs, "tfchainurl", []string{}, "Tfchain websocket urls") flag.StringVar(&bridgeCfg.TfchainSeed, "tfchainseed", "", "Tfchain secret seed") flag.StringVar(&bridgeCfg.StellarBridgeAccount, "bridgewallet", "", "stellar bridge wallet") flag.StringVar(&bridgeCfg.StellarSeed, "secret", "", "stellar secret") @@ -39,7 +39,7 @@ func main() { } missingParams := []string{} - if bridgeCfg.TfchainURL == "" { + if len(bridgeCfg.TfchainURLs) == 0 { missingParams = append(missingParams, "tfchainurl") } if bridgeCfg.TfchainSeed == "" { @@ -82,7 +82,7 @@ func main() { Instance_public_key: address, Bridge_wallet_address: bridgeCfg.StellarBridgeAccount, Stellar_network: bridgeCfg.StellarNetwork, - Tfchain_url: bridgeCfg.TfchainURL, + Tfchain_urls: bridgeCfg.TfchainURLs, } log.Logger = log.Logger.With().Interface("source", sourceLogEntry).Logger() diff --git a/bridge/tfchain_bridge/pkg/bridge/bridge.go b/bridge/tfchain_bridge/pkg/bridge/bridge.go index 7428f3713..496050a55 100644 --- a/bridge/tfchain_bridge/pkg/bridge/bridge.go +++ b/bridge/tfchain_bridge/pkg/bridge/bridge.go @@ -29,7 +29,7 @@ type Bridge struct { } func NewBridge(ctx context.Context, cfg pkg.BridgeConfig) (*Bridge, string, error) { - subClient, err := subpkg.NewSubstrateClient(cfg.TfchainURL, cfg.TfchainSeed) + subClient, err := subpkg.NewSubstrateClient(cfg.TfchainURLs, cfg.TfchainSeed) if err != nil { return nil, "", err } diff --git a/bridge/tfchain_bridge/pkg/config.go b/bridge/tfchain_bridge/pkg/config.go index de3bec488..efba5730a 100644 --- a/bridge/tfchain_bridge/pkg/config.go +++ b/bridge/tfchain_bridge/pkg/config.go @@ -3,7 +3,7 @@ package pkg import "errors" type BridgeConfig struct { - TfchainURL string + TfchainURLs []string TfchainSeed string RescanBridgeAccount bool PersistencyFile string diff --git a/bridge/tfchain_bridge/pkg/logger/logger.go b/bridge/tfchain_bridge/pkg/logger/logger.go index e4b371818..9ab247df9 100644 --- a/bridge/tfchain_bridge/pkg/logger/logger.go +++ b/bridge/tfchain_bridge/pkg/logger/logger.go @@ -25,7 +25,7 @@ type SourceCommonLogEntry struct { Instance_public_key string Bridge_wallet_address string Stellar_network string - Tfchain_url string + Tfchain_urls []string } type refundReasonKey struct{} diff --git a/bridge/tfchain_bridge/pkg/substrate/client.go b/bridge/tfchain_bridge/pkg/substrate/client.go index eb61c9f4d..614a1d27b 100644 --- a/bridge/tfchain_bridge/pkg/substrate/client.go +++ b/bridge/tfchain_bridge/pkg/substrate/client.go @@ -32,8 +32,8 @@ type SubstrateClient struct { } // NewSubstrate creates a substrate client -func NewSubstrateClient(url string, seed string) (*SubstrateClient, error) { - mngr := substrate.NewManager(url) +func NewSubstrateClient(urls []string, seed string) (*SubstrateClient, error) { + mngr := substrate.NewManager(urls...) cl, err := mngr.Substrate() if err != nil { return nil, err