node/pkg/ethereum: readiness status for bsc
Bug: certusone/wormhole#292 Change-Id: Ibb176dc70beeb2c00c7faf7d85395e93d53e9e4c
This commit is contained in:
parent
b28c76618a
commit
b77d408235
|
@ -418,12 +418,12 @@ func runBridge(cmd *cobra.Command, args []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := supervisor.Run(ctx, "ethwatch",
|
if err := supervisor.Run(ctx, "ethwatch",
|
||||||
ethereum.NewEthBridgeWatcher(*ethRPC, ethContractAddr, "eth", vaa.ChainIDEthereum, lockC, setC).Run); err != nil {
|
ethereum.NewEthBridgeWatcher(*ethRPC, ethContractAddr, "eth", common.ReadinessEthSyncing, vaa.ChainIDEthereum, lockC, setC).Run); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := supervisor.Run(ctx, "bscwatch",
|
if err := supervisor.Run(ctx, "bscwatch",
|
||||||
ethereum.NewEthBridgeWatcher(*bscRPC, bscContractAddr, "bsc", vaa.ChainIDBSC, lockC, nil).Run); err != nil {
|
ethereum.NewEthBridgeWatcher(*bscRPC, bscContractAddr, "bsc", common.ReadinessBSCSyncing, vaa.ChainIDBSC, lockC, nil).Run); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,5 @@ const (
|
||||||
ReadinessEthSyncing readiness.Component = "ethSyncing"
|
ReadinessEthSyncing readiness.Component = "ethSyncing"
|
||||||
ReadinessSolanaSyncing readiness.Component = "solanaSyncing"
|
ReadinessSolanaSyncing readiness.Component = "solanaSyncing"
|
||||||
ReadinessTerraSyncing readiness.Component = "terraSyncing"
|
ReadinessTerraSyncing readiness.Component = "terraSyncing"
|
||||||
|
ReadinessBSCSyncing readiness.Component = "bscSyncing"
|
||||||
)
|
)
|
||||||
|
|
|
@ -67,6 +67,8 @@ type (
|
||||||
bridge eth_common.Address
|
bridge eth_common.Address
|
||||||
// Human-readable name of the Eth network, for logging and monitoring.
|
// Human-readable name of the Eth network, for logging and monitoring.
|
||||||
networkName string
|
networkName string
|
||||||
|
// Readiness component
|
||||||
|
readiness readiness.Component
|
||||||
// VAA ChainID of the network we're connecting to.
|
// VAA ChainID of the network we're connecting to.
|
||||||
chainID vaa.ChainID
|
chainID vaa.ChainID
|
||||||
|
|
||||||
|
@ -98,6 +100,7 @@ func NewEthBridgeWatcher(
|
||||||
url string,
|
url string,
|
||||||
bridge eth_common.Address,
|
bridge eth_common.Address,
|
||||||
networkName string,
|
networkName string,
|
||||||
|
readiness readiness.Component,
|
||||||
chainID vaa.ChainID,
|
chainID vaa.ChainID,
|
||||||
messageEvents chan *common.MessagePublication,
|
messageEvents chan *common.MessagePublication,
|
||||||
setEvents chan *common.GuardianSet) *EthBridgeWatcher {
|
setEvents chan *common.GuardianSet) *EthBridgeWatcher {
|
||||||
|
@ -105,6 +108,7 @@ func NewEthBridgeWatcher(
|
||||||
url: url,
|
url: url,
|
||||||
bridge: bridge,
|
bridge: bridge,
|
||||||
networkName: networkName,
|
networkName: networkName,
|
||||||
|
readiness: readiness,
|
||||||
chainID: chainID,
|
chainID: chainID,
|
||||||
msgChan: messageEvents,
|
msgChan: messageEvents,
|
||||||
setChan: setEvents,
|
setChan: setEvents,
|
||||||
|
@ -278,7 +282,7 @@ func (e *EthBridgeWatcher) Run(ctx context.Context) error {
|
||||||
logger.Info("processing new header", zap.Stringer("block", ev.Number),
|
logger.Info("processing new header", zap.Stringer("block", ev.Number),
|
||||||
zap.String("eth_network", e.networkName))
|
zap.String("eth_network", e.networkName))
|
||||||
currentEthHeight.WithLabelValues(e.networkName).Set(float64(ev.Number.Int64()))
|
currentEthHeight.WithLabelValues(e.networkName).Set(float64(ev.Number.Int64()))
|
||||||
readiness.SetReady(common.ReadinessEthSyncing)
|
readiness.SetReady(e.readiness)
|
||||||
p2p.DefaultRegistry.SetNetworkStats(e.chainID, &gossipv1.Heartbeat_Network{
|
p2p.DefaultRegistry.SetNetworkStats(e.chainID, &gossipv1.Heartbeat_Network{
|
||||||
Height: ev.Number.Int64(),
|
Height: ev.Number.Int64(),
|
||||||
BridgeAddress: e.bridge.Hex(),
|
BridgeAddress: e.bridge.Hex(),
|
||||||
|
|
Loading…
Reference in New Issue