Skip to content

Commit

Permalink
Merge branch 'main' into fix-typos
Browse files Browse the repository at this point in the history
  • Loading branch information
SEJeff authored Dec 9, 2023
2 parents 20a64ba + bf9660f commit 3b33de9
Show file tree
Hide file tree
Showing 119 changed files with 3,372 additions and 8,817 deletions.
2 changes: 1 addition & 1 deletion clients/js/worm-fetch-governance
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cached="$TMPDIR/vaa/$sequence"
# We cache the result once it's ready, so we don't keep making requests if the
# VAA has already been pulled
if [ ! -f "$cached" ]; then
result=$(curl -s "https://wormhole-v2-mainnet-api.certus.one/v1/signed_vaa/1/0000000000000000000000000000000000000000000000000000000000000004/$sequence" | jq '.vaaBytes' -r)
result=$(curl -s "https://api.wormholescan.io/v1/signed_vaa/1/0000000000000000000000000000000000000000000000000000000000000004/$sequence" | jq '.vaaBytes' -r)
# The 'vaaBytes' field is set once quorum has been reached. Otherwise, 'jq'
# returns "null", in which case we just exit 1
if [ "$result" == "null" ]; then
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY README.md cert.pem* /certs/
# Alpine
RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/cert.pem; fi

RUN --mount=type=cache,target=/code/target,id=cosmwasm_target --mount=type=cache,target=/usr/local/cargo/registry optimize_workspace.sh
RUN --mount=type=cache,target=/target,id=cosmwasm_target --mount=type=cache,target=/usr/local/cargo/registry optimize_workspace.sh

FROM scratch as artifacts
COPY --from=builder /code/artifacts /
2 changes: 0 additions & 2 deletions docs/devnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
| Migration Contract | SOL | Ex9bCdVMSfx7EzB3pgSi2R4UHwJAXvTw18rBQm5YQ8gK | |
| Test Wallet | Terra | terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v | Mnemonic: `notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius` |
| Test CW20 | Terra | terra13nkgqrfymug724h8pprpexqj9h629sa3ncw7sh | Tokens minted to Test Wallet |
| Test CW721 | Terra | terra18dt935pdcn2ka6l0syy5gt20wa48n3mktvdvjj | NFTs minted to Test Wallet |
| Bridge Core | Terra | terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5 | |
| Token Bridge | Terra | terra10pyejy66429refv3g35g2t7am0was7ya7kz2a4 | |
| NFT Bridge | Terra | terra1plju286nnfj3z54wgcggd4enwaa9fgf5kgrgzl | |
| Test Wallet | Terra2 | terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v | Mnemonic: `notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius` |
| Test CW20 | Terra2 | terra1zwv6feuzhy6a9wekh96cd57lsarmqlwxdypdsplw6zhfncqw6ftqynf7kp | Tokens minted to Test Wallet |
| Bridge Core | Terra2 | terra14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssrc8au | |
Expand Down
1 change: 0 additions & 1 deletion ethereum/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ REGISTER_ETH_TOKEN_BRIDGE_VAA=01000000000100e2e1975d14734206e7a23d90db48a6b5b669
REGISTER_ETH_NFT_BRIDGE_VAA=01000000000100d073f81a4ecf2469b0674b1902dcbcad2da7f70ecdd7e1aec65414380ca2c05426380c33bb083ab41167c522231c1485b9c8ffce04eaf2e8a6f50edaa72074c50000000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000004e4654427269646765010000000200000000000000000000000026b4afb60d6c903165150c6f0aa14f8016be4aec

REGISTER_TERRA_TOKEN_BRIDGE_VAA=010000000001009a895e8b42444fdf60a71666121d7e84b3a49579ba3b84fff1dbdf9ec93360390c05a88f66c90df2034cb38427ba9b01632e780ce7b84df559a1bf44c316447d01000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000546f6b656e4272696467650100000003000000000000000000000000784999135aaa8a3ca5914468852fdddbddd8789d
REGISTER_TERRA_NFT_BRIDGE_VAA=01000000000100880ab34efd145fa1c9c4f2f7b233f3bc99cb730ab2d2138babf989a2555e2e8f737b759f91970d300c4364249b0740b134dbefb943fb55fd76483261ce68c17b0100000001000000010001000000000000000000000000000000000000000000000000000000000000000400000000023c2cdd0000000000000000000000000000000000000000000000004e465442726964676501000000030000000000000000000000000fe5c51f539a651152ae461086d733777a54a134

REGISTER_BSC_TOKEN_BRIDGE_VAA=01000000000100719b4ada436f614489dbf87593c38ba9aea35aa7b997387f8ae09f819806f5654c8d45b6b751faa0e809ccbc294794885efa205bd8a046669464c7cbfb03d183010000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000002c8bb0600000000000000000000000000000000000000000000546f6b656e42726964676501000000040000000000000000000000000290fb167208af455bb137780163b7b7a9a10c16
21 changes: 21 additions & 0 deletions node/cmd/ccq/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/certusone/wormhole/node/pkg/common"
"github.com/certusone/wormhole/node/pkg/telemetry"
promremotew "github.com/certusone/wormhole/node/pkg/telemetry/prom_remote_write"
"github.com/certusone/wormhole/node/pkg/version"
ethCrypto "github.com/ethereum/go-ethereum/crypto"
ipfslog "github.com/ipfs/go-log/v2"
Expand All @@ -39,6 +40,7 @@ var (
telemetryLokiURL *string
telemetryNodeName *string
statusAddr *string
promRemoteURL *string
)

const DEV_NETWORK_ID = "/wormhole/dev"
Expand All @@ -58,6 +60,7 @@ func init() {
telemetryLokiURL = QueryServerCmd.Flags().String("telemetryLokiURL", "", "Loki cloud logging URL")
telemetryNodeName = QueryServerCmd.Flags().String("telemetryNodeName", "", "Node name used in telemetry")
statusAddr = QueryServerCmd.Flags().String("statusAddr", "[::]:6060", "Listen address for status server (disabled if blank)")
promRemoteURL = QueryServerCmd.Flags().String("promRemoteURL", "", "Prometheus remote write URL (Grafana)")
}

var QueryServerCmd = &cobra.Command{
Expand Down Expand Up @@ -183,6 +186,24 @@ func runQueryServer(cmd *cobra.Command, args []string) {
}()
}

// Start the Prometheus scraper
usingPromRemoteWrite := *promRemoteURL != ""
if usingPromRemoteWrite {
var info promremotew.PromTelemetryInfo
info.PromRemoteURL = *promRemoteURL
info.Labels = map[string]string{
"node_name": *telemetryNodeName,
"network": *p2pNetworkID,
"version": version.Version(),
"product": "ccq_server",
}

err := RunPrometheusScraper(ctx, logger, info)
if err != nil {
logger.Fatal("Failed to start prometheus scraper", zap.Error(err))
}
}

// Handle SIGTERM
sigterm := make(chan os.Signal, 1)
signal.Notify(sigterm, syscall.SIGTERM)
Expand Down
24 changes: 24 additions & 0 deletions node/cmd/ccq/status.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package ccq

import (
"context"
"fmt"
"net/http"
"time"

"github.com/certusone/wormhole/node/pkg/common"
promremotew "github.com/certusone/wormhole/node/pkg/telemetry/prom_remote_write"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap"
Expand Down Expand Up @@ -36,3 +38,25 @@ func (s *statusServer) handleHealth(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "ok")
}

func RunPrometheusScraper(ctx context.Context, logger *zap.Logger, info promremotew.PromTelemetryInfo) error {
promLogger := logger.With(zap.String("component", "prometheus_scraper"))
errC := make(chan error)
common.StartRunnable(ctx, errC, false, "prometheus_scraper", func(ctx context.Context) error {
t := time.NewTicker(15 * time.Second)

for {
select {
case <-ctx.Done():
return nil
case <-t.C:
err := promremotew.ScrapeAndSendLocalMetrics(ctx, info, promLogger)
if err != nil {
promLogger.Error("ScrapeAndSendLocalMetrics error", zap.Error(err))
return err
}
}
}
})
return nil
}
38 changes: 38 additions & 0 deletions node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/certusone/wormhole/node/pkg/node"
"github.com/certusone/wormhole/node/pkg/p2p"
"github.com/certusone/wormhole/node/pkg/supervisor"
promremotew "github.com/certusone/wormhole/node/pkg/telemetry/prom_remote_write"
libp2p_crypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -198,6 +199,9 @@ var (
// Loki cloud logging parameters
telemetryLokiURL *string

// Prometheus remote write URL
promRemoteURL *string

chainGovernorEnabled *bool

ccqEnabled *bool
Expand Down Expand Up @@ -364,6 +368,8 @@ func init() {

telemetryLokiURL = NodeCmd.Flags().String("telemetryLokiURL", "", "Loki cloud logging URL")

promRemoteURL = NodeCmd.Flags().String("promRemoteURL", "", "Prometheus remote write URL (Grafana)")

chainGovernorEnabled = NodeCmd.Flags().Bool("chainGovernorEnabled", false, "Run the chain governor")

ccqEnabled = NodeCmd.Flags().Bool("ccqEnabled", false, "Enable cross chain query support")
Expand Down Expand Up @@ -1033,6 +1039,38 @@ func runNode(cmd *cobra.Command, args []string) {
if err != nil {
logger.Fatal("failed to connect to wormchain", zap.Error(err), zap.String("component", "gwrelayer"))
}

}
usingPromRemoteWrite := *promRemoteURL != ""
if usingPromRemoteWrite {
var info promremotew.PromTelemetryInfo
info.PromRemoteURL = *promRemoteURL
info.Labels = map[string]string{
"node_name": *nodeName,
"guardian_addr": ethcrypto.PubkeyToAddress(gk.PublicKey).String(),
"network": *p2pNetworkID,
"version": version.Version(),
"product": "wormhole",
}

promLogger := logger.With(zap.String("component", "prometheus_scraper"))
errC := make(chan error)
common.StartRunnable(rootCtx, errC, false, "prometheus_scraper", func(ctx context.Context) error {
t := time.NewTicker(15 * time.Second)

for {
select {
case <-ctx.Done():
return nil
case <-t.C:
err := promremotew.ScrapeAndSendLocalMetrics(ctx, info, promLogger)
if err != nil {
promLogger.Error("ScrapeAndSendLocalMetrics error", zap.Error(err))
continue
}
}
}
})
}

var watcherConfigs = []watchers.WatcherConfig{}
Expand Down
1 change: 1 addition & 0 deletions node/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2725,6 +2725,7 @@ github.com/securego/gosec/v2 v2.12.0/go.mod h1:iTpT+eKTw59bSgklBHlSnH5O2tNygHMDx
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/sercand/kuberesolver v2.4.0+incompatible/go.mod h1:lWF3GL0xptCB/vCiJPl/ZshwPsX/n4Y7u0CW9E7aQIQ=
github.com/sercand/kuberesolver/v4 v4.0.0 h1:frL7laPDG/lFm5n98ODmWnn+cvPpzlkf3LhzuPhcHP4=
github.com/sercand/kuberesolver/v4 v4.0.0/go.mod h1:F4RGyuRmMAjeXHKL+w4P7AwUnPceEAPAhxUgXZjKgvM=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/governor/mainnet_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func chainList() []chainConfigEntry {
{emitterChainID: vaa.ChainIDTerra2, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDInjective, dailyLimit: 500_000, bigTransactionSize: 50_000},
{emitterChainID: vaa.ChainIDSui, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDAptos, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDAptos, dailyLimit: 1_000_000, bigTransactionSize: 100_000},
{emitterChainID: vaa.ChainIDArbitrum, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDOptimism, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
{emitterChainID: vaa.ChainIDXpla, dailyLimit: 500_000, bigTransactionSize: 50_000},
Expand Down
Loading

0 comments on commit 3b33de9

Please sign in to comment.