Basic guardian support
This commit is contained in:
parent
87d146a261
commit
0b6cc9ab44
|
@ -120,6 +120,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
|
|||
networks = append(networks, network{"Ropsten", vaa.ChainIDEthereumRopsten})
|
||||
networks = append(networks, network{"Neon", vaa.ChainIDNeon})
|
||||
networks = append(networks, network{"Injective", vaa.ChainIDInjective})
|
||||
networks = append(networks, network{"Arbitrum", vaa.ChainIDArbitrum})
|
||||
}
|
||||
|
||||
if len(only) > 0 {
|
||||
|
|
|
@ -134,6 +134,9 @@ var (
|
|||
pythnetContract *string
|
||||
pythnetRPC *string
|
||||
|
||||
arbitrumRPC *string
|
||||
arbitrumContract *string
|
||||
|
||||
logLevel *string
|
||||
|
||||
unsafeDevMode *bool
|
||||
|
@ -249,6 +252,9 @@ func init() {
|
|||
pythnetContract = NodeCmd.Flags().String("pythnetContract", "", "Address of the PythNet program (required)")
|
||||
pythnetRPC = NodeCmd.Flags().String("pythnetRPC", "", "PythNet RPC URL (required")
|
||||
|
||||
arbitrumRPC = NodeCmd.Flags().String("arbitrumRPC", "", "Arbitrum RPC URL")
|
||||
arbitrumContract = NodeCmd.Flags().String("arbitrumContract", "", "Arbitrum contract address")
|
||||
|
||||
logLevel = NodeCmd.Flags().String("logLevel", "info", "Logging level (debug, info, warn, error, dpanic, panic, fatal)")
|
||||
|
||||
unsafeDevMode = NodeCmd.Flags().Bool("unsafeDevMode", false, "Launch node in unsafe, deterministic devnet mode")
|
||||
|
@ -403,6 +409,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
readiness.RegisterComponent(common.ReadinessEthRopstenSyncing)
|
||||
readiness.RegisterComponent(common.ReadinessNeonSyncing)
|
||||
readiness.RegisterComponent(common.ReadinessInjectiveSyncing)
|
||||
readiness.RegisterComponent(common.ReadinessArbitrumSyncing)
|
||||
}
|
||||
|
||||
if *statusAddr != "" {
|
||||
|
@ -455,6 +462,9 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
*celoContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||
*moonbeamContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||
*neonContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||
if *arbitrumContract == "" {
|
||||
*neonContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||
}
|
||||
}
|
||||
|
||||
// Verify flags
|
||||
|
@ -566,6 +576,12 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
if *injectiveContract == "" {
|
||||
logger.Fatal("Please specify --injectiveContract")
|
||||
}
|
||||
if *arbitrumRPC == "" {
|
||||
logger.Fatal("Please specify --arbitrumRPC")
|
||||
}
|
||||
if *arbitrumContract == "" {
|
||||
logger.Fatal("Please specify --arbitrumContract")
|
||||
}
|
||||
} else {
|
||||
if *ethRopstenRPC != "" {
|
||||
logger.Fatal("Please do not specify --ethRopstenRPC in non-testnet mode")
|
||||
|
@ -588,6 +604,12 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
if *injectiveContract != "" && !*unsafeDevMode {
|
||||
logger.Fatal("Please do not specify --injectiveContract")
|
||||
}
|
||||
if *arbitrumRPC != "" && !*unsafeDevMode {
|
||||
logger.Fatal("Please do not specify --arbitrumRPC")
|
||||
}
|
||||
if *arbitrumContract != "" && !*unsafeDevMode {
|
||||
logger.Fatal("Please do not specify --arbitrumContract")
|
||||
}
|
||||
}
|
||||
if *nodeName == "" {
|
||||
logger.Fatal("Please specify --nodeName")
|
||||
|
@ -702,6 +724,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
celoContractAddr := eth_common.HexToAddress(*celoContract)
|
||||
moonbeamContractAddr := eth_common.HexToAddress(*moonbeamContract)
|
||||
neonContractAddr := eth_common.HexToAddress(*neonContract)
|
||||
arbitrumContractAddr := eth_common.HexToAddress(*arbitrumContract)
|
||||
solAddress, err := solana_types.PublicKeyFromBase58(*solanaContract)
|
||||
if err != nil {
|
||||
logger.Fatal("invalid Solana contract address", zap.Error(err))
|
||||
|
@ -807,6 +830,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
chainObsvReqC[vaa.ChainIDNeon] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||
chainObsvReqC[vaa.ChainIDEthereumRopsten] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||
chainObsvReqC[vaa.ChainIDInjective] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||
chainObsvReqC[vaa.ChainIDArbitrum] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||
}
|
||||
go handleReobservationRequests(rootCtx, clock.New(), logger, obsvReqC, chainObsvReqC)
|
||||
|
||||
|
@ -984,6 +1008,10 @@ func runNode(cmd *cobra.Command, args []string) {
|
|||
evm.NewEthWatcher(*neonRPC, neonContractAddr, "neon", common.ReadinessNeonSyncing, vaa.ChainIDNeon, lockC, nil, 32, chainObsvReqC[vaa.ChainIDNeon], *unsafeDevMode).Run); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := supervisor.Run(ctx, "arbitrumwatch",
|
||||
evm.NewEthWatcher(*arbitrumRPC, arbitrumContractAddr, "arbitrum", common.ReadinessArbitrumSyncing, vaa.ChainIDArbitrum, lockC, nil, 32, chainObsvReqC[vaa.ChainIDArbitrum], *unsafeDevMode).Run); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if *terraWS != "" {
|
||||
|
|
|
@ -24,4 +24,5 @@ const (
|
|||
ReadinessTerra2Syncing readiness.Component = "terra2Syncing"
|
||||
ReadinessInjectiveSyncing readiness.Component = "injectiveSyncing"
|
||||
ReadinessPythNetSyncing readiness.Component = "pythnetSyncing"
|
||||
ReadinessArbitrumSyncing readiness.Component = "arbitrumSyncing"
|
||||
)
|
||||
|
|
|
@ -134,6 +134,8 @@ func (c ChainID) String() string {
|
|||
return "terra2"
|
||||
case ChainIDInjective:
|
||||
return "injective"
|
||||
case ChainIDArbitrum:
|
||||
return "arbitrum"
|
||||
case ChainIDPythNet:
|
||||
return "pythnet"
|
||||
default:
|
||||
|
@ -185,6 +187,8 @@ func ChainIDFromString(s string) (ChainID, error) {
|
|||
return ChainIDTerra2, nil
|
||||
case "injective":
|
||||
return ChainIDInjective, nil
|
||||
case "arbitrum":
|
||||
return ChainIDArbitrum, nil
|
||||
case "pythnet":
|
||||
return ChainIDPythNet, nil
|
||||
default:
|
||||
|
@ -232,6 +236,8 @@ const (
|
|||
ChainIDTerra2 ChainID = 18
|
||||
// ChainIDInjective is the ChainID of Injective
|
||||
ChainIDInjective ChainID = 19
|
||||
// ChainIDArbitrum is the ChainID of Arbitrum
|
||||
ChainIDArbitrum ChainID = 23
|
||||
// ChainIDPythNet is the ChainID of PythNet
|
||||
ChainIDPythNet ChainID = 26
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ func TestChainIDFromString(t *testing.T) {
|
|||
{input: "neon", output: ChainIDNeon},
|
||||
{input: "terra2", output: ChainIDTerra2},
|
||||
{input: "injective", output: ChainIDInjective},
|
||||
{input: "arbitrum", output: ChainIDArbitrum},
|
||||
{input: "ethereum-ropsten", output: ChainIDEthereumRopsten},
|
||||
|
||||
{input: "Solana", output: ChainIDSolana},
|
||||
|
@ -64,6 +65,7 @@ func TestChainIDFromString(t *testing.T) {
|
|||
{input: "Neon", output: ChainIDNeon},
|
||||
{input: "Terra2", output: ChainIDTerra2},
|
||||
{input: "Injective", output: ChainIDInjective},
|
||||
{input: "Arbitrum", output: ChainIDArbitrum},
|
||||
{input: "Ethereum-ropsten", output: ChainIDEthereumRopsten},
|
||||
}
|
||||
|
||||
|
@ -155,6 +157,7 @@ func TestChainId_String(t *testing.T) {
|
|||
{input: 17, output: "neon"},
|
||||
{input: 18, output: "terra2"},
|
||||
{input: 19, output: "injective"},
|
||||
{input: 23, output: "arbitrum"},
|
||||
{input: 10001, output: "ethereum-ropsten"},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue