node: add oasis support

commit-id:31eeeb35
This commit is contained in:
Leo 2021-12-20 20:40:58 +01:00 committed by Leopold Schabel
parent 95afe6cdbb
commit 3c1ee3bdc3
6 changed files with 27 additions and 0 deletions

View File

@ -86,6 +86,8 @@ spec:
- ws://eth-devnet:8545 - ws://eth-devnet:8545
- --avalancheRPC - --avalancheRPC
- ws://eth-devnet:8545 - ws://eth-devnet:8545
- --oasisRPC
- ws://eth-devnet:8545
- --terraWS - --terraWS
- ws://terra-terrad:26657/websocket - ws://terra-terrad:26657/websocket
- --terraLCD - --terraLCD

View File

@ -101,6 +101,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"BSC", vaa.ChainIDBSC}, {"BSC", vaa.ChainIDBSC},
{"Polygon", vaa.ChainIDPolygon}, {"Polygon", vaa.ChainIDPolygon},
{"Avalanche", vaa.ChainIDAvalanche}, {"Avalanche", vaa.ChainIDAvalanche},
{"Oasis", vaa.ChainIDOasis},
} }
if isTestnet { if isTestnet {

View File

@ -71,6 +71,9 @@ var (
avalancheRPC *string avalancheRPC *string
avalancheContract *string avalancheContract *string
oasisRPC *string
oasisContract *string
terraWS *string terraWS *string
terraLCD *string terraLCD *string
terraContract *string terraContract *string
@ -135,6 +138,9 @@ func init() {
avalancheRPC = NodeCmd.Flags().String("avalancheRPC", "", "Avalanche RPC URL") avalancheRPC = NodeCmd.Flags().String("avalancheRPC", "", "Avalanche RPC URL")
avalancheContract = NodeCmd.Flags().String("avalancheContract", "", "Avalanche contract address") avalancheContract = NodeCmd.Flags().String("avalancheContract", "", "Avalanche contract address")
oasisRPC = NodeCmd.Flags().String("oasisRPC", "", "Oasis RPC URL")
oasisContract = NodeCmd.Flags().String("oasisContract", "", "Oasis contract address")
terraWS = NodeCmd.Flags().String("terraWS", "", "Path to terrad root for websocket connection") terraWS = NodeCmd.Flags().String("terraWS", "", "Path to terrad root for websocket connection")
terraLCD = NodeCmd.Flags().String("terraLCD", "", "Path to LCD service root for http calls") terraLCD = NodeCmd.Flags().String("terraLCD", "", "Path to LCD service root for http calls")
terraContract = NodeCmd.Flags().String("terraContract", "", "Wormhole contract address on Terra blockchain") terraContract = NodeCmd.Flags().String("terraContract", "", "Wormhole contract address on Terra blockchain")
@ -245,6 +251,7 @@ func runNode(cmd *cobra.Command, args []string) {
readiness.RegisterComponent(common.ReadinessBSCSyncing) readiness.RegisterComponent(common.ReadinessBSCSyncing)
readiness.RegisterComponent(common.ReadinessPolygonSyncing) readiness.RegisterComponent(common.ReadinessPolygonSyncing)
readiness.RegisterComponent(common.ReadinessAvalancheSyncing) readiness.RegisterComponent(common.ReadinessAvalancheSyncing)
readiness.RegisterComponent(common.ReadinessOasisSyncing)
if *testnetMode { if *testnetMode {
readiness.RegisterComponent(common.ReadinessEthRopstenSyncing) readiness.RegisterComponent(common.ReadinessEthRopstenSyncing)
} }
@ -289,6 +296,7 @@ func runNode(cmd *cobra.Command, args []string) {
*bscContract = devnet.GanacheWormholeContractAddress.Hex() *bscContract = devnet.GanacheWormholeContractAddress.Hex()
*polygonContract = devnet.GanacheWormholeContractAddress.Hex() *polygonContract = devnet.GanacheWormholeContractAddress.Hex()
*avalancheContract = devnet.GanacheWormholeContractAddress.Hex() *avalancheContract = devnet.GanacheWormholeContractAddress.Hex()
*oasisContract = devnet.GanacheWormholeContractAddress.Hex()
// Use the hostname as nodeName. For production, we don't want to do this to // Use the hostname as nodeName. For production, we don't want to do this to
// prevent accidentally leaking sensitive hostnames. // prevent accidentally leaking sensitive hostnames.
@ -334,6 +342,9 @@ func runNode(cmd *cobra.Command, args []string) {
if *avalancheRPC == "" { if *avalancheRPC == "" {
logger.Fatal("Please specify --avalancheRPC") logger.Fatal("Please specify --avalancheRPC")
} }
if *oasisRPC == "" {
logger.Fatal("Please specify --oasisRPC")
}
if *testnetMode { if *testnetMode {
if *ethRopstenRPC == "" { if *ethRopstenRPC == "" {
logger.Fatal("Please specify --ethRopstenRPC") logger.Fatal("Please specify --ethRopstenRPC")
@ -419,6 +430,7 @@ func runNode(cmd *cobra.Command, args []string) {
polygonContractAddr := eth_common.HexToAddress(*polygonContract) polygonContractAddr := eth_common.HexToAddress(*polygonContract)
ethRopstenContractAddr := eth_common.HexToAddress(*ethRopstenContract) ethRopstenContractAddr := eth_common.HexToAddress(*ethRopstenContract)
avalancheContractAddr := eth_common.HexToAddress(*avalancheContract) avalancheContractAddr := eth_common.HexToAddress(*avalancheContract)
oasisContractAddr := eth_common.HexToAddress(*oasisContract)
solAddress, err := solana_types.PublicKeyFromBase58(*solanaContract) solAddress, err := solana_types.PublicKeyFromBase58(*solanaContract)
if err != nil { if err != nil {
logger.Fatal("invalid Solana contract address", zap.Error(err)) logger.Fatal("invalid Solana contract address", zap.Error(err))
@ -554,6 +566,10 @@ func runNode(cmd *cobra.Command, args []string) {
ethereum.NewEthWatcher(*avalancheRPC, avalancheContractAddr, "avalanche", common.ReadinessAvalancheSyncing, vaa.ChainIDAvalanche, lockC, nil).Run); err != nil { ethereum.NewEthWatcher(*avalancheRPC, avalancheContractAddr, "avalanche", common.ReadinessAvalancheSyncing, vaa.ChainIDAvalanche, lockC, nil).Run); err != nil {
return err return err
} }
if err := supervisor.Run(ctx, "oasiswatch",
ethereum.NewEthWatcher(*oasisRPC, oasisContractAddr, "oasis", common.ReadinessOasisSyncing, vaa.ChainIDOasis, lockC, nil).Run); err != nil {
return err
}
if *testnetMode { if *testnetMode {
if err := supervisor.Run(ctx, "ethropstenwatch", if err := supervisor.Run(ctx, "ethropstenwatch",

View File

@ -10,4 +10,5 @@ const (
ReadinessPolygonSyncing readiness.Component = "polygonSyncing" ReadinessPolygonSyncing readiness.Component = "polygonSyncing"
ReadinessEthRopstenSyncing readiness.Component = "ethRopstenSyncing" ReadinessEthRopstenSyncing readiness.Component = "ethRopstenSyncing"
ReadinessAvalancheSyncing readiness.Component = "avalancheSyncing" ReadinessAvalancheSyncing readiness.Component = "avalancheSyncing"
ReadinessOasisSyncing readiness.Component = "oasisSyncing"
) )

View File

@ -96,6 +96,8 @@ func (c ChainID) String() string {
return "polygon" return "polygon"
case ChainIDAvalanche: case ChainIDAvalanche:
return "avalanche" return "avalanche"
case ChainIDOasis:
return "oasis"
case ChainIDEthereumRopsten: case ChainIDEthereumRopsten:
return "ethereum-ropsten" return "ethereum-ropsten"
default: default:
@ -119,6 +121,8 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDPolygon, nil return ChainIDPolygon, nil
case "avalanche": case "avalanche":
return ChainIDAvalanche, nil return ChainIDAvalanche, nil
case "oasis":
return ChainIDOasis, nil
case "ethereum-ropsten": case "ethereum-ropsten":
return ChainIDEthereumRopsten, nil return ChainIDEthereumRopsten, nil
default: default:
@ -140,6 +144,8 @@ const (
ChainIDPolygon ChainID = 5 ChainIDPolygon ChainID = 5
// ChainIDAvalanche is the ChainID of Avalanche // ChainIDAvalanche is the ChainID of Avalanche
ChainIDAvalanche ChainID = 6 ChainIDAvalanche ChainID = 6
// ChainIDOasis is the ChainID of Oasis
ChainIDOasis ChainID = 7
// ChainIDEthereumRopsten is the ChainID of Ethereum Ropsten // ChainIDEthereumRopsten is the ChainID of Ethereum Ropsten
ChainIDEthereumRopsten ChainID = 10001 ChainIDEthereumRopsten ChainID = 10001

View File

@ -15,6 +15,7 @@ enum ChainID {
CHAIN_ID_BSC = 4; CHAIN_ID_BSC = 4;
CHAIN_ID_POLYGON = 5; CHAIN_ID_POLYGON = 5;
CHAIN_ID_AVALANCHE = 6; CHAIN_ID_AVALANCHE = 6;
CHAIN_ID_OASIS = 7;
// Special case - Eth has two testnets. CHAIN_ID_ETHEREUM is Goerli, // Special case - Eth has two testnets. CHAIN_ID_ETHEREUM is Goerli,
// but we also want to connect to Ropsten, so we add a separate chain. // but we also want to connect to Ropsten, so we add a separate chain.
CHAIN_ID_ETHEREUM_ROPSTEN = 10001; CHAIN_ID_ETHEREUM_ROPSTEN = 10001;