diff --git a/bridge/docs/observability.md b/bridge/docs/observability.md index 0288a8205..0fe31d05c 100644 --- a/bridge/docs/observability.md +++ b/bridge/docs/observability.md @@ -134,7 +134,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: @@ -956,7 +956,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", @@ -978,7 +978,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", @@ -997,7 +997,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", @@ -1018,7 +1018,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", @@ -1034,7 +1034,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", @@ -1073,7 +1073,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", @@ -1089,7 +1089,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", @@ -1108,7 +1108,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", @@ -1129,7 +1129,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", @@ -1145,7 +1145,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", @@ -1181,7 +1181,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", @@ -1197,7 +1197,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", @@ -1216,7 +1216,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", @@ -1237,7 +1237,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", @@ -1253,7 +1253,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", @@ -1272,7 +1272,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", @@ -1288,7 +1288,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", @@ -1322,7 +1322,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", @@ -1344,7 +1344,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", @@ -1363,7 +1363,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", @@ -1382,7 +1382,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", @@ -1398,7 +1398,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", @@ -1417,7 +1417,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", @@ -1433,7 +1433,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 f8f677567..63c6d45d8 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") @@ -51,7 +51,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 92c9d48d7..9cee7b2ce 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 76d869d73..d33b68c43 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 d3461b458..44501b25e 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