node: XPLA watcher (#1676)
This commit is contained in:
parent
59882d963d
commit
9657f41561
|
@ -122,6 +122,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
|
||||||
networks = append(networks, network{"Neon", vaa.ChainIDNeon})
|
networks = append(networks, network{"Neon", vaa.ChainIDNeon})
|
||||||
networks = append(networks, network{"Injective", vaa.ChainIDInjective})
|
networks = append(networks, network{"Injective", vaa.ChainIDInjective})
|
||||||
networks = append(networks, network{"Arbitrum", vaa.ChainIDArbitrum})
|
networks = append(networks, network{"Arbitrum", vaa.ChainIDArbitrum})
|
||||||
|
networks = append(networks, network{"XPLA", vaa.ChainIDXpla})
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(only) > 0 {
|
if len(only) > 0 {
|
||||||
|
|
|
@ -121,6 +121,10 @@ var (
|
||||||
injectiveLCD *string
|
injectiveLCD *string
|
||||||
injectiveContract *string
|
injectiveContract *string
|
||||||
|
|
||||||
|
xplaWS *string
|
||||||
|
xplaLCD *string
|
||||||
|
xplaContract *string
|
||||||
|
|
||||||
algorandIndexerRPC *string
|
algorandIndexerRPC *string
|
||||||
algorandIndexerToken *string
|
algorandIndexerToken *string
|
||||||
algorandAlgodRPC *string
|
algorandAlgodRPC *string
|
||||||
|
@ -242,6 +246,10 @@ func init() {
|
||||||
injectiveLCD = NodeCmd.Flags().String("injectiveLCD", "", "Path to LCD service root for Injective http calls")
|
injectiveLCD = NodeCmd.Flags().String("injectiveLCD", "", "Path to LCD service root for Injective http calls")
|
||||||
injectiveContract = NodeCmd.Flags().String("injectiveContract", "", "Wormhole contract address on Injective blockchain")
|
injectiveContract = NodeCmd.Flags().String("injectiveContract", "", "Wormhole contract address on Injective blockchain")
|
||||||
|
|
||||||
|
xplaWS = NodeCmd.Flags().String("xplaWS", "", "Path to root for XPLA websocket connection")
|
||||||
|
xplaLCD = NodeCmd.Flags().String("xplaLCD", "", "Path to LCD service root for XPLA http calls")
|
||||||
|
xplaContract = NodeCmd.Flags().String("xplaContract", "", "Wormhole contract address on XPLA blockchain")
|
||||||
|
|
||||||
algorandIndexerRPC = NodeCmd.Flags().String("algorandIndexerRPC", "", "Algorand Indexer RPC URL")
|
algorandIndexerRPC = NodeCmd.Flags().String("algorandIndexerRPC", "", "Algorand Indexer RPC URL")
|
||||||
algorandIndexerToken = NodeCmd.Flags().String("algorandIndexerToken", "", "Algorand Indexer access token")
|
algorandIndexerToken = NodeCmd.Flags().String("algorandIndexerToken", "", "Algorand Indexer access token")
|
||||||
algorandAlgodRPC = NodeCmd.Flags().String("algorandAlgodRPC", "", "Algorand Algod RPC URL")
|
algorandAlgodRPC = NodeCmd.Flags().String("algorandAlgodRPC", "", "Algorand Algod RPC URL")
|
||||||
|
@ -420,6 +428,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
readiness.RegisterComponent(common.ReadinessNeonSyncing)
|
readiness.RegisterComponent(common.ReadinessNeonSyncing)
|
||||||
readiness.RegisterComponent(common.ReadinessInjectiveSyncing)
|
readiness.RegisterComponent(common.ReadinessInjectiveSyncing)
|
||||||
readiness.RegisterComponent(common.ReadinessArbitrumSyncing)
|
readiness.RegisterComponent(common.ReadinessArbitrumSyncing)
|
||||||
|
readiness.RegisterComponent(common.ReadinessXplaSyncing)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *statusAddr != "" {
|
if *statusAddr != "" {
|
||||||
|
@ -601,6 +610,15 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
if *arbitrumContract == "" {
|
if *arbitrumContract == "" {
|
||||||
logger.Fatal("Please specify --arbitrumContract")
|
logger.Fatal("Please specify --arbitrumContract")
|
||||||
}
|
}
|
||||||
|
if *xplaWS == "" {
|
||||||
|
logger.Fatal("Please specify --xplaWS")
|
||||||
|
}
|
||||||
|
if *xplaLCD == "" {
|
||||||
|
logger.Fatal("Please specify --xplaLCD")
|
||||||
|
}
|
||||||
|
if *xplaContract == "" {
|
||||||
|
logger.Fatal("Please specify --xplaContract")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if *ethRopstenRPC != "" {
|
if *ethRopstenRPC != "" {
|
||||||
logger.Fatal("Please do not specify --ethRopstenRPC in non-testnet mode")
|
logger.Fatal("Please do not specify --ethRopstenRPC in non-testnet mode")
|
||||||
|
@ -623,6 +641,15 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
if *injectiveContract != "" && !*unsafeDevMode {
|
if *injectiveContract != "" && !*unsafeDevMode {
|
||||||
logger.Fatal("Please do not specify --injectiveContract")
|
logger.Fatal("Please do not specify --injectiveContract")
|
||||||
}
|
}
|
||||||
|
if *xplaWS != "" && !*unsafeDevMode {
|
||||||
|
logger.Fatal("Please do not specify --xplaWS")
|
||||||
|
}
|
||||||
|
if *xplaLCD != "" && !*unsafeDevMode {
|
||||||
|
logger.Fatal("Please do not specify --xplaLCD")
|
||||||
|
}
|
||||||
|
if *xplaContract != "" && !*unsafeDevMode {
|
||||||
|
logger.Fatal("Please do not specify --xplaContract")
|
||||||
|
}
|
||||||
if *arbitrumRPC != "" && !*unsafeDevMode {
|
if *arbitrumRPC != "" && !*unsafeDevMode {
|
||||||
logger.Fatal("Please do not specify --arbitrumRPC")
|
logger.Fatal("Please do not specify --arbitrumRPC")
|
||||||
}
|
}
|
||||||
|
@ -848,6 +875,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
chainObsvReqC[vaa.ChainIDEthereumRopsten] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
chainObsvReqC[vaa.ChainIDEthereumRopsten] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||||
chainObsvReqC[vaa.ChainIDInjective] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
chainObsvReqC[vaa.ChainIDInjective] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||||
chainObsvReqC[vaa.ChainIDArbitrum] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
chainObsvReqC[vaa.ChainIDArbitrum] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||||
|
chainObsvReqC[vaa.ChainIDXpla] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||||
}
|
}
|
||||||
go handleReobservationRequests(rootCtx, clock.New(), logger, obsvReqC, chainObsvReqC)
|
go handleReobservationRequests(rootCtx, clock.New(), logger, obsvReqC, chainObsvReqC)
|
||||||
|
|
||||||
|
@ -1054,6 +1082,13 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if *testnetMode {
|
||||||
|
logger.Info("Starting XPLA watcher")
|
||||||
|
if err := supervisor.Run(ctx, "xplawatch",
|
||||||
|
cosmwasm.NewWatcher(*xplaWS, *xplaLCD, *xplaContract, lockC, chainObsvReqC[vaa.ChainIDXpla], common.ReadinessXplaSyncing, vaa.ChainIDXpla).Run); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if *algorandIndexerRPC != "" {
|
if *algorandIndexerRPC != "" {
|
||||||
if err := supervisor.Run(ctx, "algorandwatch",
|
if err := supervisor.Run(ctx, "algorandwatch",
|
||||||
|
|
|
@ -23,6 +23,7 @@ const (
|
||||||
ReadinessNeonSyncing readiness.Component = "neonSyncing"
|
ReadinessNeonSyncing readiness.Component = "neonSyncing"
|
||||||
ReadinessTerra2Syncing readiness.Component = "terra2Syncing"
|
ReadinessTerra2Syncing readiness.Component = "terra2Syncing"
|
||||||
ReadinessInjectiveSyncing readiness.Component = "injectiveSyncing"
|
ReadinessInjectiveSyncing readiness.Component = "injectiveSyncing"
|
||||||
|
ReadinessXplaSyncing readiness.Component = "xplaSyncing"
|
||||||
ReadinessPythNetSyncing readiness.Component = "pythnetSyncing"
|
ReadinessPythNetSyncing readiness.Component = "pythnetSyncing"
|
||||||
ReadinessArbitrumSyncing readiness.Component = "arbitrumSyncing"
|
ReadinessArbitrumSyncing readiness.Component = "arbitrumSyncing"
|
||||||
ReadinessWormchainSyncing readiness.Component = "wormchainSyncing"
|
ReadinessWormchainSyncing readiness.Component = "wormchainSyncing"
|
||||||
|
|
|
@ -28,6 +28,7 @@ import {
|
||||||
isEVMChain,
|
isEVMChain,
|
||||||
isTerraChain,
|
isTerraChain,
|
||||||
CHAIN_ID_PYTHNET,
|
CHAIN_ID_PYTHNET,
|
||||||
|
CHAIN_ID_XPLA,
|
||||||
} from "./consts";
|
} from "./consts";
|
||||||
import { hashLookup } from "./near";
|
import { hashLookup } from "./near";
|
||||||
|
|
||||||
|
@ -99,6 +100,8 @@ export const tryUint8ArrayToNative = (
|
||||||
return humanAddress("wormhole", a.slice(-20));
|
return humanAddress("wormhole", a.slice(-20));
|
||||||
} else if (chainId === CHAIN_ID_NEAR) {
|
} else if (chainId === CHAIN_ID_NEAR) {
|
||||||
throw Error("uint8ArrayToNative: Use tryHexToNativeStringNear instead.");
|
throw Error("uint8ArrayToNative: Use tryHexToNativeStringNear instead.");
|
||||||
|
} else if (chainId === CHAIN_ID_XPLA) {
|
||||||
|
throw Error("uint8ArrayToNative: XPLA not supported yet.");
|
||||||
} else if (chainId === CHAIN_ID_OSMOSIS) {
|
} else if (chainId === CHAIN_ID_OSMOSIS) {
|
||||||
throw Error("uint8ArrayToNative: Osmosis not supported yet.");
|
throw Error("uint8ArrayToNative: Osmosis not supported yet.");
|
||||||
} else if (chainId === CHAIN_ID_SUI) {
|
} else if (chainId === CHAIN_ID_SUI) {
|
||||||
|
@ -231,6 +234,8 @@ export const tryNativeToHexString = (
|
||||||
return uint8ArrayToHex(arrayify(sha256(Buffer.from(address))));
|
return uint8ArrayToHex(arrayify(sha256(Buffer.from(address))));
|
||||||
} else if (chainId === CHAIN_ID_OSMOSIS) {
|
} else if (chainId === CHAIN_ID_OSMOSIS) {
|
||||||
throw Error("hexToNativeString: Osmosis not supported yet.");
|
throw Error("hexToNativeString: Osmosis not supported yet.");
|
||||||
|
} else if (chainId === CHAIN_ID_XPLA) {
|
||||||
|
throw Error("hexToNativeString: XPLA not supported yet.");
|
||||||
} else if (chainId === CHAIN_ID_SUI) {
|
} else if (chainId === CHAIN_ID_SUI) {
|
||||||
throw Error("hexToNativeString: Sui not supported yet.");
|
throw Error("hexToNativeString: Sui not supported yet.");
|
||||||
} else if (chainId === CHAIN_ID_APTOS) {
|
} else if (chainId === CHAIN_ID_APTOS) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ export const CHAINS = {
|
||||||
optimism: 24,
|
optimism: 24,
|
||||||
gnosis: 25,
|
gnosis: 25,
|
||||||
pythnet: 26,
|
pythnet: 26,
|
||||||
|
xpla: 28,
|
||||||
ropsten: 10001,
|
ropsten: 10001,
|
||||||
wormholechain: 3104,
|
wormholechain: 3104,
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -61,7 +62,7 @@ export type EVMChainName =
|
||||||
*/
|
*/
|
||||||
export type SolanaChainName = "solana" | "pythnet";
|
export type SolanaChainName = "solana" | "pythnet";
|
||||||
|
|
||||||
export type CosmWasmChainName = "terra" | "terra2" | "injective";
|
export type CosmWasmChainName = "terra" | "terra2" | "injective" | "xpla";
|
||||||
export type TerraChainName = "terra" | "terra2";
|
export type TerraChainName = "terra" | "terra2";
|
||||||
|
|
||||||
export type Contracts = {
|
export type Contracts = {
|
||||||
|
@ -211,6 +212,11 @@ const MAINNET = {
|
||||||
token_bridge: undefined,
|
token_bridge: undefined,
|
||||||
nft_bridge: undefined,
|
nft_bridge: undefined,
|
||||||
},
|
},
|
||||||
|
xpla: {
|
||||||
|
core: undefined,
|
||||||
|
token_bridge: undefined,
|
||||||
|
nft_bridge: undefined,
|
||||||
|
},
|
||||||
ropsten: {
|
ropsten: {
|
||||||
core: undefined,
|
core: undefined,
|
||||||
token_bridge: undefined,
|
token_bridge: undefined,
|
||||||
|
@ -360,6 +366,12 @@ const TESTNET = {
|
||||||
token_bridge: undefined,
|
token_bridge: undefined,
|
||||||
nft_bridge: undefined,
|
nft_bridge: undefined,
|
||||||
},
|
},
|
||||||
|
xpla: {
|
||||||
|
core: "xpla1upkjn4mthr0047kahvn0llqx4qpqfn75lnph4jpxfn8walmm8mqsanyy35",
|
||||||
|
token_bridge:
|
||||||
|
"xpla1alpgm9geq76dzhk5xvt6qqc2lza0vtzzpskgys5rkmjzph8cs69sl09fq9",
|
||||||
|
nft_bridge: undefined,
|
||||||
|
},
|
||||||
ropsten: {
|
ropsten: {
|
||||||
core: "0x210c5F5e2AF958B4defFe715Dc621b7a3BA888c5",
|
core: "0x210c5F5e2AF958B4defFe715Dc621b7a3BA888c5",
|
||||||
token_bridge: "0xF174F9A837536C449321df1Ca093Bb96948D5386",
|
token_bridge: "0xF174F9A837536C449321df1Ca093Bb96948D5386",
|
||||||
|
@ -509,6 +521,11 @@ const DEVNET = {
|
||||||
token_bridge: undefined,
|
token_bridge: undefined,
|
||||||
nft_bridge: undefined,
|
nft_bridge: undefined,
|
||||||
},
|
},
|
||||||
|
xpla: {
|
||||||
|
core: undefined,
|
||||||
|
token_bridge: undefined,
|
||||||
|
nft_bridge: undefined,
|
||||||
|
},
|
||||||
ropsten: {
|
ropsten: {
|
||||||
core: undefined,
|
core: undefined,
|
||||||
token_bridge: undefined,
|
token_bridge: undefined,
|
||||||
|
@ -586,6 +603,7 @@ export const CHAIN_ID_ARBITRUM = CHAINS["arbitrum"];
|
||||||
export const CHAIN_ID_OPTIMISM = CHAINS["optimism"];
|
export const CHAIN_ID_OPTIMISM = CHAINS["optimism"];
|
||||||
export const CHAIN_ID_GNOSIS = CHAINS["gnosis"];
|
export const CHAIN_ID_GNOSIS = CHAINS["gnosis"];
|
||||||
export const CHAIN_ID_PYTHNET = CHAINS["pythnet"];
|
export const CHAIN_ID_PYTHNET = CHAINS["pythnet"];
|
||||||
|
export const CHAIN_ID_XPLA = CHAINS["xpla"];
|
||||||
export const CHAIN_ID_ETHEREUM_ROPSTEN = CHAINS["ropsten"];
|
export const CHAIN_ID_ETHEREUM_ROPSTEN = CHAINS["ropsten"];
|
||||||
export const CHAIN_ID_WORMHOLE_CHAIN = CHAINS["wormholechain"];
|
export const CHAIN_ID_WORMHOLE_CHAIN = CHAINS["wormholechain"];
|
||||||
|
|
||||||
|
@ -733,7 +751,8 @@ export function isCosmWasmChain(
|
||||||
return (
|
return (
|
||||||
chainId === CHAIN_ID_TERRA ||
|
chainId === CHAIN_ID_TERRA ||
|
||||||
chainId === CHAIN_ID_TERRA2 ||
|
chainId === CHAIN_ID_TERRA2 ||
|
||||||
chainId === CHAIN_ID_INJECTIVE
|
chainId === CHAIN_ID_INJECTIVE ||
|
||||||
|
chainId === CHAIN_ID_XPLA
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,8 @@ func (c ChainID) String() string {
|
||||||
return "pythnet"
|
return "pythnet"
|
||||||
case ChainIDWormchain:
|
case ChainIDWormchain:
|
||||||
return "wormholechain"
|
return "wormholechain"
|
||||||
|
case ChainIDXpla:
|
||||||
|
return "xpla"
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("unknown chain ID: %d", c)
|
return fmt.Sprintf("unknown chain ID: %d", c)
|
||||||
}
|
}
|
||||||
|
@ -199,6 +201,8 @@ func ChainIDFromString(s string) (ChainID, error) {
|
||||||
return ChainIDPythNet, nil
|
return ChainIDPythNet, nil
|
||||||
case "wormholechain":
|
case "wormholechain":
|
||||||
return ChainIDWormchain, nil
|
return ChainIDWormchain, nil
|
||||||
|
case "xpla":
|
||||||
|
return ChainIDXpla, nil
|
||||||
default:
|
default:
|
||||||
return ChainIDUnset, fmt.Errorf("unknown chain ID: %s", s)
|
return ChainIDUnset, fmt.Errorf("unknown chain ID: %s", s)
|
||||||
}
|
}
|
||||||
|
@ -248,6 +252,8 @@ const (
|
||||||
ChainIDArbitrum ChainID = 23
|
ChainIDArbitrum ChainID = 23
|
||||||
// ChainIDPythNet is the ChainID of PythNet
|
// ChainIDPythNet is the ChainID of PythNet
|
||||||
ChainIDPythNet ChainID = 26
|
ChainIDPythNet ChainID = 26
|
||||||
|
// ChainIDXpla is the ChainID of Xpla
|
||||||
|
ChainIDXpla ChainID = 28
|
||||||
//ChainIDWormchain is the ChainID of Wormholechain
|
//ChainIDWormchain is the ChainID of Wormholechain
|
||||||
ChainIDWormchain ChainID = 3104
|
ChainIDWormchain ChainID = 3104
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ func TestChainIDFromString(t *testing.T) {
|
||||||
{input: "terra2", output: ChainIDTerra2},
|
{input: "terra2", output: ChainIDTerra2},
|
||||||
{input: "injective", output: ChainIDInjective},
|
{input: "injective", output: ChainIDInjective},
|
||||||
{input: "arbitrum", output: ChainIDArbitrum},
|
{input: "arbitrum", output: ChainIDArbitrum},
|
||||||
|
{input: "xpla", output: ChainIDXpla},
|
||||||
{input: "ethereum-ropsten", output: ChainIDEthereumRopsten},
|
{input: "ethereum-ropsten", output: ChainIDEthereumRopsten},
|
||||||
|
|
||||||
{input: "Solana", output: ChainIDSolana},
|
{input: "Solana", output: ChainIDSolana},
|
||||||
|
@ -66,6 +67,7 @@ func TestChainIDFromString(t *testing.T) {
|
||||||
{input: "Terra2", output: ChainIDTerra2},
|
{input: "Terra2", output: ChainIDTerra2},
|
||||||
{input: "Injective", output: ChainIDInjective},
|
{input: "Injective", output: ChainIDInjective},
|
||||||
{input: "Arbitrum", output: ChainIDArbitrum},
|
{input: "Arbitrum", output: ChainIDArbitrum},
|
||||||
|
{input: "XPLA", output: ChainIDXpla},
|
||||||
{input: "Ethereum-ropsten", output: ChainIDEthereumRopsten},
|
{input: "Ethereum-ropsten", output: ChainIDEthereumRopsten},
|
||||||
{input: "Wormholechain", output: ChainIDWormchain},
|
{input: "Wormholechain", output: ChainIDWormchain},
|
||||||
{input: "wormholechain", output: ChainIDWormchain},
|
{input: "wormholechain", output: ChainIDWormchain},
|
||||||
|
@ -160,6 +162,7 @@ func TestChainId_String(t *testing.T) {
|
||||||
{input: 18, output: "terra2"},
|
{input: 18, output: "terra2"},
|
||||||
{input: 19, output: "injective"},
|
{input: 19, output: "injective"},
|
||||||
{input: 23, output: "arbitrum"},
|
{input: 23, output: "arbitrum"},
|
||||||
|
{input: 28, output: "xpla"},
|
||||||
{input: 10001, output: "ethereum-ropsten"},
|
{input: 10001, output: "ethereum-ropsten"},
|
||||||
{input: 3104, output: "wormholechain"},
|
{input: 3104, output: "wormholechain"},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue