Skip to content

Commit

Permalink
Merge branch 'main' into signature-aggregation-api-cache-sig-weight-m…
Browse files Browse the repository at this point in the history
…etric
  • Loading branch information
feuGeneA authored Aug 22, 2024
2 parents 503992a + 6cd26a9 commit 6a6b0a7
Show file tree
Hide file tree
Showing 22 changed files with 435 additions and 201 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ require (
github.com/ava-labs/coreth v0.13.7
github.com/ava-labs/subnet-evm v0.6.8
github.com/ava-labs/teleporter v1.0.5
github.com/aws/aws-sdk-go-v2 v1.30.3
github.com/aws/aws-sdk-go-v2 v1.30.4
github.com/aws/aws-sdk-go-v2/config v1.27.9
github.com/aws/aws-sdk-go-v2/service/kms v1.35.3
github.com/aws/aws-sdk-go-v2/service/kms v1.35.4
github.com/ethereum/go-ethereum v1.13.8
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/onsi/ginkgo/v2 v2.20.0
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/pingcap/errors v0.11.4
github.com/pkg/errors v0.9.1
Expand All @@ -33,15 +33,15 @@ require (
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.9 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 // indirect
github.com/aws/smithy-go v1.20.3 // indirect
github.com/aws/smithy-go v1.20.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,34 @@ github.com/ava-labs/subnet-evm v0.6.8 h1:IrHGajBYWs692YIYdd5J0oVWWt88Q/XAZQq/dOt
github.com/ava-labs/subnet-evm v0.6.8/go.mod h1:qt8DXyGm40CY9yffNOe1+4yUyL9mD3v5RPWqAuGj5u4=
github.com/ava-labs/teleporter v1.0.5 h1:51fRzvo7eo9VotYq6cldx+yoAkEk5o9yCXOJ6q3tSEo=
github.com/ava-labs/teleporter v1.0.5/go.mod h1:C5/ETmPQh/MxZOCARrhPV+J40y4R3TOeT0lvQrjz/RE=
github.com/aws/aws-sdk-go-v2 v1.30.3 h1:jUeBtG0Ih+ZIFH0F4UkmL9w3cSpaMv9tYYDbzILP8dY=
github.com/aws/aws-sdk-go-v2 v1.30.3/go.mod h1:nIQjQVp5sfpQcTc9mPSr1B0PaWK5ByX9MOoDadSN4lc=
github.com/aws/aws-sdk-go-v2 v1.30.4 h1:frhcagrVNrzmT95RJImMHgabt99vkXGslubDaDagTk8=
github.com/aws/aws-sdk-go-v2 v1.30.4/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0=
github.com/aws/aws-sdk-go-v2/config v1.27.9 h1:gRx/NwpNEFSk+yQlgmk1bmxxvQ5TyJ76CWXs9XScTqg=
github.com/aws/aws-sdk-go-v2/config v1.27.9/go.mod h1:dK1FQfpwpql83kbD873E9vz4FyAxuJtR22wzoXn3qq0=
github.com/aws/aws-sdk-go-v2/credentials v1.17.9 h1:N8s0/7yW+h8qR8WaRlPQeJ6czVMNQVNtNdUqf6cItao=
github.com/aws/aws-sdk-go-v2/credentials v1.17.9/go.mod h1:446YhIdmSV0Jf/SLafGZalQo+xr2iw7/fzXGDPTU1yQ=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 h1:af5YzcLf80tv4Em4jWVD75lpnOHSBkPUZxZfGkrI3HI=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0/go.mod h1:nQ3how7DMnFMWiU1SpECohgC82fpn4cKZ875NDMmwtA=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 h1:SoNJ4RlFEQEbtDcCEt+QG56MY4fm4W8rYirAmq+/DdU=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15/go.mod h1:U9ke74k1n2bf+RIgoX1SXFed1HLs51OgUSs+Ph0KJP8=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 h1:C6WHdGnTDIYETAm5iErQUiVNsclNx9qbJVPIt03B6bI=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15/go.mod h1:ZQLZqhcu+JhSrA9/NXRm8SkDvsycE+JkV3WGY41e+IM=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 h1:TNyt/+X43KJ9IJJMjKfa3bNTiZbUP7DeCxfbTROESwY=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16/go.mod h1:2DwJF39FlNAUiX5pAc0UNeiz16lK2t7IaFcm0LFHEgc=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 h1:jYfy8UPmd+6kJW5YhY0L1/KftReOGxI/4NtVSTh9O/I=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16/go.mod h1:7ZfEPZxkW42Afq4uQB8H2E2e6ebh6mXTueEpYzjCzcs=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 h1:b+E7zIUHMmcB4Dckjpkapoy47W6C9QBv/zoUP+Hn8Kc=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6/go.mod h1:S2fNV0rxrP78NhPbCZeQgY8H9jdDMeGtwcfZIRxzBqU=
github.com/aws/aws-sdk-go-v2/service/kms v1.35.3 h1:UPTdlTOwWUX49fVi7cymEN6hDqCwe3LNv1vi7TXUutk=
github.com/aws/aws-sdk-go-v2/service/kms v1.35.3/go.mod h1:gjDP16zn+WWalyaUqwCCioQ8gU8lzttCCc9jYsiQI/8=
github.com/aws/aws-sdk-go-v2/service/kms v1.35.4 h1:mG1MH6yPwT5gNEeBrhig3FHc4mK0QaZOXsmQUbphP6Y=
github.com/aws/aws-sdk-go-v2/service/kms v1.35.4/go.mod h1:A5CS0VRmxxj2YKYLCY08l/Zzbd01m6JZn0WzxgT1OCA=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 h1:mnbuWHOcM70/OFUlZZ5rcdfA8PflGXXiefU/O+1S3+8=
github.com/aws/aws-sdk-go-v2/service/sso v1.20.3/go.mod h1:5HFu51Elk+4oRBZVxmHrSds5jFXmFj8C3w7DVF2gnrs=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 h1:uLq0BKatTmDzWa/Nu4WO0M1AaQDaPpwTKAeByEc6WFM=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3/go.mod h1:b+qdhjnxj8GSR6t5YfphOffeoQSQ1KmpoVVuBn+PWxs=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 h1:J/PpTf/hllOjx8Xu9DMflff3FajfLxqM5+tepvVXmxg=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.5/go.mod h1:0ih0Z83YDH/QeQ6Ori2yGE2XvWYv/Xm+cZc01LC6oK0=
github.com/aws/smithy-go v1.20.3 h1:ryHwveWzPV5BIof6fyDvor6V3iUL7nTfiTKXHiW05nE=
github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
github.com/aws/smithy-go v1.20.4 h1:2HK1zBdPgRbjFOHlfeQZfpC4r72MOb9bZkiFwggKO+4=
github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down Expand Up @@ -494,8 +494,8 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw=
github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo=
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
Expand Down
47 changes: 47 additions & 0 deletions peers/app_request_netrwork_metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package peers

import (
"errors"

"github.com/prometheus/client_golang/prometheus"
)

var (
ErrFailedToCreateAppRequestNetworkMetrics = errors.New("failed to create app request network metrics")
)

type AppRequestNetworkMetrics struct {
infoAPICallLatencyMS prometheus.Histogram
pChainAPICallLatencyMS prometheus.Histogram
}

func newAppRequestNetworkMetrics(registerer prometheus.Registerer) (*AppRequestNetworkMetrics, error) {
infoAPICallLatencyMS := prometheus.NewHistogram(
prometheus.HistogramOpts{
Name: "info_api_call_latency_ms",
Help: "Latency of calling info api in milliseconds",
Buckets: prometheus.ExponentialBucketsRange(100, 10000, 10),
},
)
if infoAPICallLatencyMS == nil {
return nil, ErrFailedToCreateAppRequestNetworkMetrics
}
registerer.MustRegister(infoAPICallLatencyMS)

pChainAPICallLatencyMS := prometheus.NewHistogram(
prometheus.HistogramOpts{
Name: "p_chain_api_call_latency_ms",
Help: "Latency of calling p-chain rpc in milliseconds",
Buckets: prometheus.ExponentialBucketsRange(100, 10000, 10),
},
)
if pChainAPICallLatencyMS == nil {
return nil, ErrFailedToCreateAppRequestNetworkMetrics
}
registerer.MustRegister(pChainAPICallLatencyMS)

return &AppRequestNetworkMetrics{
infoAPICallLatencyMS: infoAPICallLatencyMS,
pChainAPICallLatencyMS: pChainAPICallLatencyMS,
}, nil
}
37 changes: 33 additions & 4 deletions peers/app_request_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type AppRequestNetwork struct {
logger logging.Logger
lock *sync.Mutex
validatorClient *validators.CanonicalValidatorClient
metrics *AppRequestNetworkMetrics
}

// NewNetwork creates a p2p network client for interacting with validators
Expand All @@ -53,8 +54,14 @@ func NewNetwork(
),
)

metrics, err := newAppRequestNetworkMetrics(registerer)
if err != nil {
logger.Fatal("Failed to create app request network metrics", zap.Error(err))
panic(err)
}

// Create the handler for handling inbound app responses
handler, err := NewRelayerExternalHandler(logger, registerer)
handler, err := NewRelayerExternalHandler(logger, prometheus.DefaultRegisterer)
if err != nil {
logger.Error(
"Failed to create p2p network handler",
Expand Down Expand Up @@ -98,6 +105,7 @@ func NewNetwork(
logger: logger,
lock: new(sync.Mutex),
validatorClient: validatorClient,
metrics: metrics,
}
go logger.RecoverAndPanic(func() {
testNetwork.Dispatch()
Expand All @@ -123,8 +131,10 @@ func (n *AppRequestNetwork) ConnectPeers(nodeIDs set.Set[ids.NodeID]) set.Set[id
// through connectedPeers for already tracked peers, just iterate through the full list,
// re-adding connections to already tracked peers.

startInfoAPICall := time.Now()
// Get the list of peers
peers, err := n.infoAPI.Peers(context.Background())
n.setInfoAPICallLatencyMS(float64(time.Since(startInfoAPICall).Milliseconds()))
if err != nil {
n.logger.Error(
"Failed to get peers",
Expand All @@ -147,13 +157,19 @@ func (n *AppRequestNetwork) ConnectPeers(nodeIDs set.Set[ids.NodeID]) set.Set[id

// If the Info API node is in nodeIDs, it will not be reflected in the call to info.Peers.
// In this case, we need to manually track the API node.
if apiNodeID, _, err := n.infoAPI.GetNodeID(context.Background()); err != nil {
startInfoAPICall = time.Now()
apiNodeID, _, err := n.infoAPI.GetNodeID(context.Background())
n.setInfoAPICallLatencyMS(float64(time.Since(startInfoAPICall).Milliseconds()))
if err != nil {
n.logger.Error(
"Failed to get API Node ID",
zap.Error(err),
)
} else if nodeIDs.Contains(apiNodeID) {
if apiNodeIPPort, err := n.infoAPI.GetNodeIP(context.Background()); err != nil {
startInfoAPICall = time.Now()
apiNodeIPPort, err := n.infoAPI.GetNodeIP(context.Background())
n.setInfoAPICallLatencyMS(float64(time.Since(startInfoAPICall).Milliseconds()))
if err != nil {
n.logger.Error(
"Failed to get API Node IP",
zap.Error(err),
Expand Down Expand Up @@ -186,11 +202,12 @@ func (c *ConnectedCanonicalValidators) GetValidator(nodeID ids.NodeID) (*warp.Va
// validator information
func (n *AppRequestNetwork) ConnectToCanonicalValidators(subnetID ids.ID) (*ConnectedCanonicalValidators, error) {
// Get the subnet's current canonical validator set
startPChainAPICall := time.Now()
validatorSet, totalValidatorWeight, err := n.validatorClient.GetCurrentCanonicalValidatorSet(subnetID)
n.setPChainAPICallLatencyMS(float64(time.Since(startPChainAPICall).Milliseconds()))
if err != nil {
return nil, err
}

// We make queries to node IDs, not unique validators as represented by a BLS pubkey, so we need this map to track
// responses from nodes and populate the signatureMap with the corresponding validator signature
// This maps node IDs to the index in the canonical validator set
Expand Down Expand Up @@ -241,3 +258,15 @@ func (n *AppRequestNetwork) RegisterRequestID(requestID uint32, numExpectedRespo
func (n *AppRequestNetwork) GetSubnetID(blockchainID ids.ID) (ids.ID, error) {
return n.validatorClient.GetSubnetID(context.Background(), blockchainID)
}

//
// Metrics
//

func (n *AppRequestNetwork) setInfoAPICallLatencyMS(latency float64) {
n.metrics.infoAPICallLatencyMS.Observe(latency)
}

func (n *AppRequestNetwork) setPChainAPICallLatencyMS(latency float64) {
n.metrics.pChainAPICallLatencyMS.Observe(latency)
}
4 changes: 2 additions & 2 deletions peers/external_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (h *RelayerExternalHandler) HandleInbound(_ context.Context, inboundMessage
}

func (h *RelayerExternalHandler) Connected(nodeID ids.NodeID, version *version.Application, subnetID ids.ID) {
h.log.Info(
h.log.Debug(
"Connected",
zap.Stringer("nodeID", nodeID),
zap.Stringer("version", version),
Expand All @@ -105,7 +105,7 @@ func (h *RelayerExternalHandler) Connected(nodeID ids.NodeID, version *version.A
}

func (h *RelayerExternalHandler) Disconnected(nodeID ids.NodeID) {
h.log.Info(
h.log.Debug(
"Disconnected",
zap.Stringer("nodeID", nodeID),
)
Expand Down
2 changes: 1 addition & 1 deletion relayer/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func newListener(
)
return nil, err
}
sub := vms.NewSubscriber(logger, config.ParseVM(sourceBlockchain.VM), blockchainID, ethWSClient)
sub := vms.NewSubscriber(logger, config.ParseVM(sourceBlockchain.VM), blockchainID, ethWSClient, ethRPCClient)

// Marks when the listener has finished the catch-up process on startup.
// Until that time, we do not know the order in which messages are processed,
Expand Down
3 changes: 2 additions & 1 deletion relayer/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func main() {

network, err := peers.NewNetwork(
networkLogLevel,
prometheus.DefaultRegisterer,
registerer,
trackedSubnets,
&cfg,
)
Expand Down Expand Up @@ -282,6 +282,7 @@ func main() {
)
})
}
logger.Info("Initialization complete")
err = errGroup.Wait()
logger.Error("Relayer exiting.", zap.Error(err))
}
Expand Down
4 changes: 4 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env bash
# Copyright (C) 2024, Ava Labs, Inc. All rights reserved.
# See the file LICENSE for licensing terms.

# Root directory
root=$(
cd "$(dirname "${BASH_SOURCE[0]}")"
Expand Down
1 change: 1 addition & 0 deletions signature-aggregator/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func main() {
)
healthcheck.HandleHealthCheckRequest()

logger.Info("Initialization complete")
err = http.ListenAndServe(fmt.Sprintf(":%d", cfg.APIPort), nil)
if errors.Is(err, http.ErrServerClosed) {
logger.Info("server closed")
Expand Down
55 changes: 39 additions & 16 deletions tests/allowed_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,18 @@ func AllowedAddresses(network interfaces.LocalNetwork) {

// Test Relayer 1
log.Info("Testing Relayer 1: All sources -> All destinations")
relayerCleanup := testUtils.BuildAndRunRelayerExecutable(ctx, relayerConfigPath1)
relayerCleanup, readyChan := testUtils.RunRelayerExecutable(
ctx,
relayerConfigPath1,
relayerConfig1,
)
defer relayerCleanup()

// Sleep for some time to make sure relayer has started up and subscribed.
log.Info("Waiting for the relayers to start up")
time.Sleep(10 * time.Second)
// Wait for relayer to start up
log.Info("Waiting for the relayer to start up")
startupCtx, startupCancel := context.WithTimeout(ctx, 15*time.Second)
defer startupCancel()
testUtils.WaitForChannelClose(startupCtx, readyChan)

// Allowed by Relayer 1
testUtils.RelayBasicMessage(
Expand All @@ -196,12 +202,18 @@ func AllowedAddresses(network interfaces.LocalNetwork) {

// Test Relayer 2
log.Info("Testing Relayer 2: Specific source -> All destinations")
relayerCleanup = testUtils.BuildAndRunRelayerExecutable(ctx, relayerConfigPath2)
relayerCleanup, readyChan = testUtils.RunRelayerExecutable(
ctx,
relayerConfigPath2,
relayerConfig2,
)
defer relayerCleanup()

// Sleep for some time to make sure relayer has started up and subscribed.
log.Info("Waiting for the relayers to start up")
time.Sleep(10 * time.Second)
// Wait for relayer to start up
log.Info("Waiting for the relayer to start up")
startupCtx, startupCancel = context.WithTimeout(ctx, 15*time.Second)
defer startupCancel()
testUtils.WaitForChannelClose(startupCtx, readyChan)

// Disallowed by Relayer 2
_, _, id := testUtils.SendBasicTeleporterMessage(
Expand Down Expand Up @@ -236,12 +248,18 @@ func AllowedAddresses(network interfaces.LocalNetwork) {

// Test Relayer 3
log.Info("Testing Relayer 3: All sources -> Specific destination")
relayerCleanup = testUtils.BuildAndRunRelayerExecutable(ctx, relayerConfigPath3)
relayerCleanup, readyChan = testUtils.RunRelayerExecutable(
ctx,
relayerConfigPath3,
relayerConfig3,
)
defer relayerCleanup()

// Sleep for some time to make sure relayer has started up and subscribed.
log.Info("Waiting for the relayers to start up")
time.Sleep(10 * time.Second)
// Wait for relayer to start up
log.Info("Waiting for the relayer to start up")
startupCtx, startupCancel = context.WithTimeout(ctx, 15*time.Second)
defer startupCancel()
testUtils.WaitForChannelClose(startupCtx, readyChan)

// Disallowed by Relayer 3
_, _, id = testUtils.SendBasicTeleporterMessage(
Expand Down Expand Up @@ -276,12 +294,17 @@ func AllowedAddresses(network interfaces.LocalNetwork) {

// Test Relayer 4
log.Info("Testing Relayer 4: Specific source -> Specific destination")
relayerCleanup = testUtils.BuildAndRunRelayerExecutable(ctx, relayerConfigPath4)
relayerCleanup, readyChan = testUtils.RunRelayerExecutable(
ctx,
relayerConfigPath4,
relayerConfig4,
)
defer relayerCleanup()

// Sleep for some time to make sure relayer has started up and subscribed.
log.Info("Waiting for the relayers to start up")
time.Sleep(10 * time.Second)
// Wait for relayer to start up
startupCtx, startupCancel = context.WithTimeout(ctx, 15*time.Second)
defer startupCancel()
testUtils.WaitForChannelClose(startupCtx, readyChan)

// Disallowed by Relayer 4
_, _, id = testUtils.SendBasicTeleporterMessage(
Expand Down
Loading

0 comments on commit 6a6b0a7

Please sign in to comment.