Skip to content

Commit

Permalink
node: Injective mainnet support (#2084)
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters authored Dec 7, 2022
1 parent 523a301 commit c94ad13
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 28 deletions.
47 changes: 20 additions & 27 deletions node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,31 +620,13 @@ 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")
}
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")
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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)

Expand Down
1 change: 1 addition & 0 deletions node/pkg/governor/mainnet_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/governor/mainnet_tokens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions node/pkg/governor/manual_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}
}
1 change: 1 addition & 0 deletions sdk/mainnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions sdk/testnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c94ad13

Please sign in to comment.