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{"Ropsten", vaa.ChainIDEthereumRopsten})
|
||||||
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})
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(only) > 0 {
|
if len(only) > 0 {
|
||||||
|
|
|
@ -134,6 +134,9 @@ var (
|
||||||
pythnetContract *string
|
pythnetContract *string
|
||||||
pythnetRPC *string
|
pythnetRPC *string
|
||||||
|
|
||||||
|
arbitrumRPC *string
|
||||||
|
arbitrumContract *string
|
||||||
|
|
||||||
logLevel *string
|
logLevel *string
|
||||||
|
|
||||||
unsafeDevMode *bool
|
unsafeDevMode *bool
|
||||||
|
@ -249,6 +252,9 @@ func init() {
|
||||||
pythnetContract = NodeCmd.Flags().String("pythnetContract", "", "Address of the PythNet program (required)")
|
pythnetContract = NodeCmd.Flags().String("pythnetContract", "", "Address of the PythNet program (required)")
|
||||||
pythnetRPC = NodeCmd.Flags().String("pythnetRPC", "", "PythNet RPC URL (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)")
|
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")
|
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.ReadinessEthRopstenSyncing)
|
||||||
readiness.RegisterComponent(common.ReadinessNeonSyncing)
|
readiness.RegisterComponent(common.ReadinessNeonSyncing)
|
||||||
readiness.RegisterComponent(common.ReadinessInjectiveSyncing)
|
readiness.RegisterComponent(common.ReadinessInjectiveSyncing)
|
||||||
|
readiness.RegisterComponent(common.ReadinessArbitrumSyncing)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *statusAddr != "" {
|
if *statusAddr != "" {
|
||||||
|
@ -455,6 +462,9 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
*celoContract = devnet.GanacheWormholeContractAddress.Hex()
|
*celoContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||||
*moonbeamContract = devnet.GanacheWormholeContractAddress.Hex()
|
*moonbeamContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||||
*neonContract = devnet.GanacheWormholeContractAddress.Hex()
|
*neonContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||||
|
if *arbitrumContract == "" {
|
||||||
|
*neonContract = devnet.GanacheWormholeContractAddress.Hex()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify flags
|
// Verify flags
|
||||||
|
@ -566,6 +576,12 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
if *injectiveContract == "" {
|
if *injectiveContract == "" {
|
||||||
logger.Fatal("Please specify --injectiveContract")
|
logger.Fatal("Please specify --injectiveContract")
|
||||||
}
|
}
|
||||||
|
if *arbitrumRPC == "" {
|
||||||
|
logger.Fatal("Please specify --arbitrumRPC")
|
||||||
|
}
|
||||||
|
if *arbitrumContract == "" {
|
||||||
|
logger.Fatal("Please specify --arbitrumContract")
|
||||||
|
}
|
||||||
} 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")
|
||||||
|
@ -588,6 +604,12 @@ 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 *arbitrumRPC != "" && !*unsafeDevMode {
|
||||||
|
logger.Fatal("Please do not specify --arbitrumRPC")
|
||||||
|
}
|
||||||
|
if *arbitrumContract != "" && !*unsafeDevMode {
|
||||||
|
logger.Fatal("Please do not specify --arbitrumContract")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if *nodeName == "" {
|
if *nodeName == "" {
|
||||||
logger.Fatal("Please specify --nodeName")
|
logger.Fatal("Please specify --nodeName")
|
||||||
|
@ -702,6 +724,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
celoContractAddr := eth_common.HexToAddress(*celoContract)
|
celoContractAddr := eth_common.HexToAddress(*celoContract)
|
||||||
moonbeamContractAddr := eth_common.HexToAddress(*moonbeamContract)
|
moonbeamContractAddr := eth_common.HexToAddress(*moonbeamContract)
|
||||||
neonContractAddr := eth_common.HexToAddress(*neonContract)
|
neonContractAddr := eth_common.HexToAddress(*neonContract)
|
||||||
|
arbitrumContractAddr := eth_common.HexToAddress(*arbitrumContract)
|
||||||
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))
|
||||||
|
@ -807,6 +830,7 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
chainObsvReqC[vaa.ChainIDNeon] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
chainObsvReqC[vaa.ChainIDNeon] = make(chan *gossipv1.ObservationRequest, observationRequestBufferSize)
|
||||||
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)
|
||||||
}
|
}
|
||||||
go handleReobservationRequests(rootCtx, clock.New(), logger, obsvReqC, chainObsvReqC)
|
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 {
|
evm.NewEthWatcher(*neonRPC, neonContractAddr, "neon", common.ReadinessNeonSyncing, vaa.ChainIDNeon, lockC, nil, 32, chainObsvReqC[vaa.ChainIDNeon], *unsafeDevMode).Run); err != nil {
|
||||||
return err
|
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 != "" {
|
if *terraWS != "" {
|
||||||
|
|
|
@ -24,4 +24,5 @@ const (
|
||||||
ReadinessTerra2Syncing readiness.Component = "terra2Syncing"
|
ReadinessTerra2Syncing readiness.Component = "terra2Syncing"
|
||||||
ReadinessInjectiveSyncing readiness.Component = "injectiveSyncing"
|
ReadinessInjectiveSyncing readiness.Component = "injectiveSyncing"
|
||||||
ReadinessPythNetSyncing readiness.Component = "pythnetSyncing"
|
ReadinessPythNetSyncing readiness.Component = "pythnetSyncing"
|
||||||
|
ReadinessArbitrumSyncing readiness.Component = "arbitrumSyncing"
|
||||||
)
|
)
|
||||||
|
|
|
@ -134,6 +134,8 @@ func (c ChainID) String() string {
|
||||||
return "terra2"
|
return "terra2"
|
||||||
case ChainIDInjective:
|
case ChainIDInjective:
|
||||||
return "injective"
|
return "injective"
|
||||||
|
case ChainIDArbitrum:
|
||||||
|
return "arbitrum"
|
||||||
case ChainIDPythNet:
|
case ChainIDPythNet:
|
||||||
return "pythnet"
|
return "pythnet"
|
||||||
default:
|
default:
|
||||||
|
@ -185,6 +187,8 @@ func ChainIDFromString(s string) (ChainID, error) {
|
||||||
return ChainIDTerra2, nil
|
return ChainIDTerra2, nil
|
||||||
case "injective":
|
case "injective":
|
||||||
return ChainIDInjective, nil
|
return ChainIDInjective, nil
|
||||||
|
case "arbitrum":
|
||||||
|
return ChainIDArbitrum, nil
|
||||||
case "pythnet":
|
case "pythnet":
|
||||||
return ChainIDPythNet, nil
|
return ChainIDPythNet, nil
|
||||||
default:
|
default:
|
||||||
|
@ -232,6 +236,8 @@ const (
|
||||||
ChainIDTerra2 ChainID = 18
|
ChainIDTerra2 ChainID = 18
|
||||||
// ChainIDInjective is the ChainID of Injective
|
// ChainIDInjective is the ChainID of Injective
|
||||||
ChainIDInjective ChainID = 19
|
ChainIDInjective ChainID = 19
|
||||||
|
// ChainIDArbitrum is the ChainID of Arbitrum
|
||||||
|
ChainIDArbitrum ChainID = 23
|
||||||
// ChainIDPythNet is the ChainID of PythNet
|
// ChainIDPythNet is the ChainID of PythNet
|
||||||
ChainIDPythNet ChainID = 26
|
ChainIDPythNet ChainID = 26
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ func TestChainIDFromString(t *testing.T) {
|
||||||
{input: "neon", output: ChainIDNeon},
|
{input: "neon", output: ChainIDNeon},
|
||||||
{input: "terra2", output: ChainIDTerra2},
|
{input: "terra2", output: ChainIDTerra2},
|
||||||
{input: "injective", output: ChainIDInjective},
|
{input: "injective", output: ChainIDInjective},
|
||||||
|
{input: "arbitrum", output: ChainIDArbitrum},
|
||||||
{input: "ethereum-ropsten", output: ChainIDEthereumRopsten},
|
{input: "ethereum-ropsten", output: ChainIDEthereumRopsten},
|
||||||
|
|
||||||
{input: "Solana", output: ChainIDSolana},
|
{input: "Solana", output: ChainIDSolana},
|
||||||
|
@ -64,6 +65,7 @@ func TestChainIDFromString(t *testing.T) {
|
||||||
{input: "Neon", output: ChainIDNeon},
|
{input: "Neon", output: ChainIDNeon},
|
||||||
{input: "Terra2", output: ChainIDTerra2},
|
{input: "Terra2", output: ChainIDTerra2},
|
||||||
{input: "Injective", output: ChainIDInjective},
|
{input: "Injective", output: ChainIDInjective},
|
||||||
|
{input: "Arbitrum", output: ChainIDArbitrum},
|
||||||
{input: "Ethereum-ropsten", output: ChainIDEthereumRopsten},
|
{input: "Ethereum-ropsten", output: ChainIDEthereumRopsten},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +157,7 @@ func TestChainId_String(t *testing.T) {
|
||||||
{input: 17, output: "neon"},
|
{input: 17, output: "neon"},
|
||||||
{input: 18, output: "terra2"},
|
{input: 18, output: "terra2"},
|
||||||
{input: 19, output: "injective"},
|
{input: 19, output: "injective"},
|
||||||
|
{input: 23, output: "arbitrum"},
|
||||||
{input: 10001, output: "ethereum-ropsten"},
|
{input: 10001, output: "ethereum-ropsten"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue