From a2a552fd7e2fabe5c97b210ddf2267ef8e82a966 Mon Sep 17 00:00:00 2001 From: Patrick Bennett Date: Wed, 30 Oct 2024 22:50:01 -0400 Subject: [PATCH] chore(nodemgr): small logging adjustments * Changed log level of average block time message to debug for less noisy logs. * log message when new algod version is detected that differs from pool (and showing pool was updated) --- contracts/__test__/contracts.test.ts | 4 ++++ nodemgr/app.go | 2 +- nodemgr/daemon.go | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contracts/__test__/contracts.test.ts b/contracts/__test__/contracts.test.ts index 0a3f0a4a..4ec08b24 100644 --- a/contracts/__test__/contracts.test.ts +++ b/contracts/__test__/contracts.test.ts @@ -103,6 +103,10 @@ describe('reti', () => { const composer = validatorMasterClient .newGroup() .initStakingContract({ args: { approvalProgramSize: stakingApprovalProgram.length } }) + // simple sanity check for checking on contract sizes + consoleLogger.info( + `registry size:${result.compiledApproval?.compiledBase64ToBytes.length}, pool size:${stakingApprovalProgram.length}`, + ) // load the StakingPool contract into box storage of the validator // call loadStakingContractData - chunking the data from approvalCompiled 2000 bytes at a time diff --git a/nodemgr/app.go b/nodemgr/app.go index f35e1578..45969b65 100644 --- a/nodemgr/app.go +++ b/nodemgr/app.go @@ -34,7 +34,7 @@ func initApp() *RetiApp { logger = slog.New(misc.NewMinimalHandler(os.Stdout, misc.MinimalHandlerOptions{SlogOpts: slog.HandlerOptions{Level: logLevel, AddSource: true}})) } else { - // not on console - output as json, but change json key names to be more compatibl w/ what google logging + // not on console - output as json, but change json key names to be more compatible w/ what google logging // expects opts := &slog.HandlerOptions{ AddSource: true, diff --git a/nodemgr/daemon.go b/nodemgr/daemon.go index 743bc59e..c84cf1df 100644 --- a/nodemgr/daemon.go +++ b/nodemgr/daemon.go @@ -237,7 +237,7 @@ func (d *Daemon) updatePoolVersions(ctx context.Context) { } versString = fmt.Sprintf("%s : %s", versString, getVersionInfo()) - for _, poolAppId := range App.retiClient.Info().LocalPools { + for poolId, poolAppId := range App.retiClient.Info().LocalPools { algodVer, err := App.retiClient.GetAlgodVer(poolAppId) if err != nil && !errors.Is(err, algo.ErrStateKeyNotFound) { misc.Errorf(d.logger, "unable to fetch algod version from staking pool app id:%d, err:%v", poolAppId, err) @@ -250,6 +250,7 @@ func (d *Daemon) updatePoolVersions(ctx context.Context) { misc.Errorf(d.logger, "unable to update algod version in staking pool app id:%d, err:%v", poolAppId, err) return } + misc.Infof(d.logger, "new algod version detected. Updated to:%s in pool:%d", versString, poolId) } } } @@ -273,7 +274,7 @@ func (d *Daemon) setAverageBlockTime(ctx context.Context) error { d.Lock() d.avgBlockTime = blockTime d.Unlock() - misc.Infof(d.logger, "average block time set to:%v", d.AverageBlockTime()) + misc.Debugf(d.logger, "average block time set to:%v", d.AverageBlockTime()) return nil }