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
- --avalancheRPC
- ws://eth-devnet:8545
- --oasisRPC
- ws://eth-devnet:8545
- --terraWS
- ws://terra-terrad:26657/websocket
- --terraLCD

View File

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

View File

@ -71,6 +71,9 @@ var (
avalancheRPC *string
avalancheContract *string
oasisRPC *string
oasisContract *string
terraWS *string
terraLCD *string
terraContract *string
@ -135,6 +138,9 @@ func init() {
avalancheRPC = NodeCmd.Flags().String("avalancheRPC", "", "Avalanche RPC URL")
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")
terraLCD = NodeCmd.Flags().String("terraLCD", "", "Path to LCD service root for http calls")
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.ReadinessPolygonSyncing)
readiness.RegisterComponent(common.ReadinessAvalancheSyncing)
readiness.RegisterComponent(common.ReadinessOasisSyncing)
if *testnetMode {
readiness.RegisterComponent(common.ReadinessEthRopstenSyncing)
}
@ -289,6 +296,7 @@ func runNode(cmd *cobra.Command, args []string) {
*bscContract = devnet.GanacheWormholeContractAddress.Hex()
*polygonContract = 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
// prevent accidentally leaking sensitive hostnames.
@ -334,6 +342,9 @@ func runNode(cmd *cobra.Command, args []string) {
if *avalancheRPC == "" {
logger.Fatal("Please specify --avalancheRPC")
}
if *oasisRPC == "" {
logger.Fatal("Please specify --oasisRPC")
}
if *testnetMode {
if *ethRopstenRPC == "" {
logger.Fatal("Please specify --ethRopstenRPC")
@ -419,6 +430,7 @@ func runNode(cmd *cobra.Command, args []string) {
polygonContractAddr := eth_common.HexToAddress(*polygonContract)
ethRopstenContractAddr := eth_common.HexToAddress(*ethRopstenContract)
avalancheContractAddr := eth_common.HexToAddress(*avalancheContract)
oasisContractAddr := eth_common.HexToAddress(*oasisContract)
solAddress, err := solana_types.PublicKeyFromBase58(*solanaContract)
if err != nil {
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 {
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 err := supervisor.Run(ctx, "ethropstenwatch",

View File

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

View File

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

View File

@ -15,6 +15,7 @@ enum ChainID {
CHAIN_ID_BSC = 4;
CHAIN_ID_POLYGON = 5;
CHAIN_ID_AVALANCHE = 6;
CHAIN_ID_OASIS = 7;
// 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.
CHAIN_ID_ETHEREUM_ROPSTEN = 10001;