node/node: Address review nits
This commit is contained in:
parent
a62edfbdc0
commit
ef555ba78e
|
@ -154,7 +154,7 @@ func mockGuardianRunnable(testId uint, gs []*mockGuardian, mockGuardianIndex uin
|
||||||
ChainID: vaa.ChainIDSolana,
|
ChainID: vaa.ChainIDSolana,
|
||||||
MockObservationC: gs[mockGuardianIndex].MockObservationC,
|
MockObservationC: gs[mockGuardianIndex].MockObservationC,
|
||||||
MockSetC: gs[mockGuardianIndex].MockSetC,
|
MockSetC: gs[mockGuardianIndex].MockSetC,
|
||||||
ObservationDb: obsDb, // TODO(future work) add observation DB to support re-observation request
|
ObservationDb: obsDb,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ func waitForHeartbeatsInLogs(t testing.TB, zapObserver *observer.ObservedLogs, g
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitForPromMetricExceed waits until prometheus metric `metric` >= `min` on all guardians in `gs`.
|
// waitForPromMetricGte waits until prometheus metric `metric` >= `min` on all guardians in `gs`.
|
||||||
// WARNING: Currently, there is only a global registry for all prometheus metrics, leading to all guardian nodes writing to the same one.
|
// WARNING: Currently, there is only a global registry for all prometheus metrics, leading to all guardian nodes writing to the same one.
|
||||||
//
|
//
|
||||||
// As long as this is the case, you probably don't want to use this function.
|
// As long as this is the case, you probably don't want to use this function.
|
||||||
|
@ -257,7 +257,6 @@ func waitForPromMetricGte(t testing.TB, testId uint, ctx context.Context, gs []*
|
||||||
metricBytes := []byte(metric)
|
metricBytes := []byte(metric)
|
||||||
requests := make([]*http.Request, len(gs))
|
requests := make([]*http.Request, len(gs))
|
||||||
readyFlags := make([]bool, len(gs))
|
readyFlags := make([]bool, len(gs))
|
||||||
//logger := supervisor.Logger(ctx)
|
|
||||||
|
|
||||||
// create the prom api clients
|
// create the prom api clients
|
||||||
for i := range gs {
|
for i := range gs {
|
||||||
|
@ -304,7 +303,6 @@ func waitForPromMetricGte(t testing.TB, testId uint, ctx context.Context, gs []*
|
||||||
readyFlags[i] = true
|
readyFlags[i] = true
|
||||||
readyCounter++
|
readyCounter++
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
time.Sleep(time.Second * 5) // TODO
|
time.Sleep(time.Second * 5) // TODO
|
||||||
}
|
}
|
||||||
|
@ -315,7 +313,6 @@ func waitForVaa(ctx context.Context, c publicrpcv1.PublicRPCServiceClient, msgId
|
||||||
var r *publicrpcv1.GetSignedVAAResponse
|
var r *publicrpcv1.GetSignedVAAResponse
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
//logger := supervisor.Logger(ctx)
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
@ -862,7 +859,6 @@ func testGuardianConfigurations(t *testing.T, testCases []testCaseGuardianConfig
|
||||||
// wait for all options to get applied
|
// wait for all options to get applied
|
||||||
// If we were expecting an error, we should never get past this point.
|
// If we were expecting an error, we should never get past this point.
|
||||||
for len(zapObserver.FilterMessage("GuardianNode initialization done.").All()) == 0 {
|
for len(zapObserver.FilterMessage("GuardianNode initialization done.").All()) == 0 {
|
||||||
//logger.Info("Guardian not yet initialized. Waiting 10ms...")
|
|
||||||
time.Sleep(time.Millisecond * 10)
|
time.Sleep(time.Millisecond * 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +969,6 @@ func BenchmarkCrypto(b *testing.B) {
|
||||||
b.Run("ethcrypto (secp256k1)", func(b *testing.B) {
|
b.Run("ethcrypto (secp256k1)", func(b *testing.B) {
|
||||||
|
|
||||||
gk := devnet.InsecureDeterministicEcdsaKeyByIndex(ethcrypto.S256(), 0)
|
gk := devnet.InsecureDeterministicEcdsaKeyByIndex(ethcrypto.S256(), 0)
|
||||||
//gkc := ethcrypto.CompressPubkey(&gk.PublicKey)
|
|
||||||
|
|
||||||
b.Run("sign", func(b *testing.B) {
|
b.Run("sign", func(b *testing.B) {
|
||||||
msgs := signingMsgs(b.N)
|
msgs := signingMsgs(b.N)
|
||||||
|
@ -990,7 +985,6 @@ func BenchmarkCrypto(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
_, err := ethcrypto.Ecrecover(msgs[i], signatures[i])
|
_, err := ethcrypto.Ecrecover(msgs[i], signatures[i])
|
||||||
assert.NoError(b, err)
|
assert.NoError(b, err)
|
||||||
//assert.Equal(b, signer, gkc)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1143,8 +1137,8 @@ func benchmarkConsensus(t *testing.B, name string, numGuardians int, numMessages
|
||||||
assert.NotEqual(t, rootCtx.Err(), context.DeadlineExceeded)
|
assert.NotEqual(t, rootCtx.Err(), context.DeadlineExceeded)
|
||||||
zapLogger.Info("Test root context cancelled, exiting...")
|
zapLogger.Info("Test root context cancelled, exiting...")
|
||||||
|
|
||||||
// wait for everything to shut down gracefully TODO since switching to portIds by `testId`, this is no longer necessary
|
// wait for everything to shut down gracefully
|
||||||
//time.Sleep(time.Second * 11) // 11s is needed to gracefully shutdown libp2p
|
//time.Sleep(time.Second * 11) // 11s is needed to gracefully shutdown libp2p, but since switching to dedicated ports per `testId`, this is no longer necessary
|
||||||
time.Sleep(time.Second * 1) // 1s is needed to gracefully shutdown BadgerDB
|
time.Sleep(time.Second * 1) // 1s is needed to gracefully shutdown BadgerDB
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ func GuardianOptionWatchers(watcherConfigs []watchers.WatcherConfig, ibcWatcherC
|
||||||
readiness.RegisterComponent(common.ReadinessIBCSyncing)
|
readiness.RegisterComponent(common.ReadinessIBCSyncing)
|
||||||
g.runnablesWithScissors["ibcwatch"] = ibc.NewWatcher(ibcWatcherConfig.Websocket, ibcWatcherConfig.Lcd, ibcWatcherConfig.Contract, chainConfig).Run
|
g.runnablesWithScissors["ibcwatch"] = ibc.NewWatcher(ibcWatcherConfig.Websocket, ibcWatcherConfig.Lcd, ibcWatcherConfig.Contract, chainConfig).Run
|
||||||
} else {
|
} else {
|
||||||
return errors.New("Although IBC is enabled, there are no chains for it to monitor")
|
return errors.New("although IBC is enabled, there are no chains for it to monitor")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ func GuardianOptionAdminService(socketPath string, ethRpc *string, ethContract *
|
||||||
rpcMap,
|
rpcMap,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to create admin service: %w", err)
|
||||||
}
|
}
|
||||||
g.runnables["admin"] = adminService
|
g.runnables["admin"] = adminService
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ func GuardianOptionPublicRpcSocket(publicGRPCSocketPath string, publicRpcLogDeta
|
||||||
// local public grpc service socket
|
// local public grpc service socket
|
||||||
publicrpcUnixService, publicrpcServer, err := publicrpcUnixServiceRunnable(logger, publicGRPCSocketPath, publicRpcLogDetail, g.db, g.gst, g.gov)
|
publicrpcUnixService, publicrpcServer, err := publicrpcUnixServiceRunnable(logger, publicGRPCSocketPath, publicRpcLogDetail, g.db, g.gst, g.gov)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to create publicrpc service: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
g.runnables["publicrpcsocket"] = publicrpcUnixService
|
g.runnables["publicrpcsocket"] = publicrpcUnixService
|
||||||
|
|
Loading…
Reference in New Issue