From c94ad13c8c5b487dca6da810ebbff20073389c02 Mon Sep 17 00:00:00 2001 From: kev1n-peters <96065607+kev1n-peters@users.noreply.github.com> Date: Wed, 7 Dec 2022 13:43:44 -0600 Subject: [PATCH] node: Injective mainnet support (#2084) --- node/cmd/guardiand/node.go | 47 ++++++++++-------------- node/pkg/governor/mainnet_chains.go | 1 + node/pkg/governor/mainnet_tokens_test.go | 2 +- node/pkg/governor/manual_tokens.go | 1 + sdk/mainnet_consts.go | 1 + sdk/testnet_consts.go | 1 + 6 files changed, 25 insertions(+), 28 deletions(-) diff --git a/node/cmd/guardiand/node.go b/node/cmd/guardiand/node.go index c340481848..45545a2a94 100644 --- a/node/cmd/guardiand/node.go +++ b/node/cmd/guardiand/node.go @@ -620,15 +620,6 @@ func runNode(cmd *cobra.Command, args []string) { if *neonContract == "" { logger.Fatal("Please specify --neonContract") } - if *injectiveWS == "" { - logger.Fatal("Please specify --injectiveWS") - } - if *injectiveLCD == "" { - logger.Fatal("Please specify --injectiveLCD") - } - if *injectiveContract == "" { - logger.Fatal("Please specify --injectiveContract") - } } else { if *neonRPC != "" && !*unsafeDevMode { logger.Fatal("Please do not specify --neonRPC") @@ -636,15 +627,6 @@ func runNode(cmd *cobra.Command, args []string) { if *neonContract != "" && !*unsafeDevMode { logger.Fatal("Please do not specify --neonContract") } - if *injectiveWS != "" && !*unsafeDevMode { - logger.Fatal("Please do not specify --injectiveWS") - } - if *injectiveLCD != "" && !*unsafeDevMode { - logger.Fatal("Please do not specify --injectiveLCD") - } - if *injectiveContract != "" && !*unsafeDevMode { - logger.Fatal("Please do not specify --injectiveContract") - } } if *nodeName == "" { logger.Fatal("Please specify --nodeName") @@ -699,6 +681,16 @@ func runNode(cmd *cobra.Command, args []string) { if *pythnetRPC == "" { logger.Fatal("Please specify --pythnetRPC") } + + if *injectiveWS == "" { + logger.Fatal("Please specify --injectiveWS") + } + if *injectiveLCD == "" { + logger.Fatal("Please specify --injectiveLCD") + } + if *injectiveContract == "" { + logger.Fatal("Please specify --injectiveContract") + } } if *bigTablePersistenceEnabled { @@ -1208,6 +1200,16 @@ func runNode(cmd *cobra.Command, args []string) { } } + if shouldStart(injectiveWS) { + logger.Info("Starting Injective watcher") + readiness.RegisterComponent(common.ReadinessInjectiveSyncing) + chainObsvReqC[vaa.ChainIDInjective] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize) + if err := supervisor.Run(ctx, "injectivewatch", + cosmwasm.NewWatcher(*injectiveWS, *injectiveLCD, *injectiveContract, lockC, chainObsvReqC[vaa.ChainIDInjective], common.ReadinessInjectiveSyncing, vaa.ChainIDInjective).Run); err != nil { + return err + } + } + if *testnetMode { if shouldStart(neonRPC) { if solanaFinalizedWatcher == nil { @@ -1222,15 +1224,6 @@ func runNode(cmd *cobra.Command, args []string) { return err } } - if shouldStart(injectiveWS) { - logger.Info("Starting Injective watcher") - readiness.RegisterComponent(common.ReadinessInjectiveSyncing) - chainObsvReqC[vaa.ChainIDInjective] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize) - if err := supervisor.Run(ctx, "injectivewatch", - cosmwasm.NewWatcher(*injectiveWS, *injectiveLCD, *injectiveContract, lockC, chainObsvReqC[vaa.ChainIDInjective], common.ReadinessInjectiveSyncing, vaa.ChainIDInjective).Run); err != nil { - return err - } - } } go handleReobservationRequests(rootCtx, clock.New(), logger, obsvReqC, chainObsvReqC) diff --git a/node/pkg/governor/mainnet_chains.go b/node/pkg/governor/mainnet_chains.go index a1ea4efe73..c5f846e872 100644 --- a/node/pkg/governor/mainnet_chains.go +++ b/node/pkg/governor/mainnet_chains.go @@ -25,6 +25,7 @@ func chainList() []chainConfigEntry { chainConfigEntry{emitterChainID: vaa.ChainIDKlaytn, dailyLimit: 5_000_000, bigTransactionSize: 500_000}, chainConfigEntry{emitterChainID: vaa.ChainIDCelo, dailyLimit: 5_000_000, bigTransactionSize: 500_000}, chainConfigEntry{emitterChainID: vaa.ChainIDNear, dailyLimit: 5_000_000, bigTransactionSize: 500_000}, + chainConfigEntry{emitterChainID: vaa.ChainIDInjective, dailyLimit: 200_000, bigTransactionSize: 20_000}, chainConfigEntry{emitterChainID: vaa.ChainIDTerra2, dailyLimit: 500_000, bigTransactionSize: 50_000}, chainConfigEntry{emitterChainID: vaa.ChainIDMoonbeam, dailyLimit: 5_000_000, bigTransactionSize: 500_000}, chainConfigEntry{emitterChainID: vaa.ChainIDArbitrum, dailyLimit: 200_000, bigTransactionSize: 20_000}, diff --git a/node/pkg/governor/mainnet_tokens_test.go b/node/pkg/governor/mainnet_tokens_test.go index 64b6515d8b..67c0cf88ee 100644 --- a/node/pkg/governor/mainnet_tokens_test.go +++ b/node/pkg/governor/mainnet_tokens_test.go @@ -14,7 +14,7 @@ func TestTokenListSize(t *testing.T) { /* Assuming that governed tokens will need to be updated every time we regenerate it */ - assert.Equal(t, 133, len(tokenConfigEntries)) + assert.Equal(t, 134, len(tokenConfigEntries)) } func TestTokenListAddressSize(t *testing.T) { diff --git a/node/pkg/governor/manual_tokens.go b/node/pkg/governor/manual_tokens.go index 1e2a708dd8..da8de5f483 100644 --- a/node/pkg/governor/manual_tokens.go +++ b/node/pkg/governor/manual_tokens.go @@ -15,6 +15,7 @@ func manualTokenList() []tokenConfigEntry { tokenConfigEntry{chain: 13, addr: "0000000000000000000000005096db80b21ef45230c9e423c373f1fc9c0198dd", symbol: "WEMIX", coinGeckoId: "wemix-token", decimals: 8, price: 1.74}, tokenConfigEntry{chain: 13, addr: "0000000000000000000000005c74070fdea071359b86082bd9f9b3deaafbe32b", symbol: "KDAI", coinGeckoId: "dai", decimals: 8, price: 1.00}, tokenConfigEntry{chain: 15, addr: "0000000000000000000000000000000000000000000000000000000000000000", symbol: "NEAR", coinGeckoId: "near", decimals: 8, price: 3.85}, + tokenConfigEntry{chain: 19, addr: "017038850bf3af746c36803cce35009268f00d22ae2b55ffb59ac5f2a6add40b", symbol: "INJ", coinGeckoId: "injective-protocol", decimals: 8, price: 1.64}, tokenConfigEntry{chain: 24, addr: "0000000000000000000000004200000000000000000000000000000000000042", symbol: "OP", coinGeckoId: "optimism", decimals: 8, price: 1.31}, } } diff --git a/sdk/mainnet_consts.go b/sdk/mainnet_consts.go index 0973150a1e..43cc94009b 100644 --- a/sdk/mainnet_consts.go +++ b/sdk/mainnet_consts.go @@ -117,6 +117,7 @@ var knownTokenbridgeEmitters = map[vaa.ChainID]string{ vaa.ChainIDArbitrum: "0000000000000000000000000b2402144Bb366A632D14B83F244D2e0e21bD39c", vaa.ChainIDOptimism: "0000000000000000000000001D68124e65faFC907325e3EDbF8c4d84499DAa8b", vaa.ChainIDXpla: "8f9cf727175353b17a5f574270e370776123d90fd74956ae4277962b4fdee24c", + vaa.ChainIDInjective: "00000000000000000000000045dbea4617971d93188eda21530bc6503d153313", } // KnownNFTBridgeEmitters is a list of well-known mainnet emitters for the NFT bridge. diff --git a/sdk/testnet_consts.go b/sdk/testnet_consts.go index 4194ea85d0..9d1c96ad3f 100644 --- a/sdk/testnet_consts.go +++ b/sdk/testnet_consts.go @@ -30,6 +30,7 @@ var knownTestnetTokenbridgeEmitters = map[vaa.ChainID]string{ vaa.ChainIDOptimism: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e", vaa.ChainIDNeon: "000000000000000000000000c7a204bdbfe983fcd8d8e61d02b475d4073ff97e", vaa.ChainIDXpla: "b66da121bd3621c8d2604c08c82965640fe682d606af26a302ee09094f5e62cf", + vaa.ChainIDInjective: "00000000000000000000000003f3e7b2e363f51cf6e57ef85f43a2b91dbce501", } // KnownTestnetNFTBridgeEmitters is a map of known NFT emitters on the various L1 testnets.