diff --git a/README.md b/README.md index 046db87..1c8fcf4 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ GLOBAL OPTIONS: --node value [ --node value ] rpc node endpoint to connect to (specify multiple for high availability) (default: "http://localhost:26657") --no-gov disable calls to gov module (useful for consumer chains) (default: false) --no-staking disable calls to staking module (useful for consumer chains) (default: false) + --no-commission disable calls to get validator commission (useful for chains without distribution module) (default: false) + --no-upgrade disable calls to upgrade module (for chains created without the upgrade module) (default: false) --denom value denom used in metrics label (eg. atom or uatom) --denom-exponent value denom exponent (eg. 6 for atom, 1 for uatom) (default: 0) --start-timeout value timeout to wait on startup for one node to be ready (default: 10s) diff --git a/pkg/app/flags.go b/pkg/app/flags.go index 5f94c6d..c1825b5 100644 --- a/pkg/app/flags.go +++ b/pkg/app/flags.go @@ -43,6 +43,14 @@ var Flags = []cli.Flag{ Name: "no-staking", Usage: "disable calls to staking module (useful for consumer chains)", }, + &cli.BoolFlag{ + Name: "no-commission", + Usage: "disable calls to get validator commission (useful for chains without distribution module)", + }, + &cli.BoolFlag{ + Name: "no-upgrade", + Usage: "disable calls to upgrade module (for chains created without the upgrade module)", + }, &cli.StringFlag{ Name: "denom", Usage: "denom used in metrics label (eg. atom or uatom)", diff --git a/pkg/app/run.go b/pkg/app/run.go index d4fc13e..7f4ad68 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -39,6 +39,8 @@ func RunFunc(cCtx *cli.Context) error { nodes = cCtx.StringSlice("node") noGov = cCtx.Bool("no-gov") noStaking = cCtx.Bool("no-staking") + noUpgrade = cCtx.Bool("no-upgrade") + noCommission = cCtx.Bool("no-commission") denom = cCtx.String("denom") denomExpon = cCtx.Uint("denom-exponent") startTimeout = cCtx.Duration("start-timeout") @@ -95,10 +97,12 @@ func RunFunc(cCtx *cli.Context) error { errg.Go(func() error { return statusWatcher.Start(ctx) }) - commissionWatcher := watcher.NewCommissionsWatcher(trackedValidators, metrics, pool) - errg.Go(func() error { - return commissionWatcher.Start(ctx) - }) + if !noCommission { + commissionWatcher := watcher.NewCommissionsWatcher(trackedValidators, metrics, pool) + errg.Go(func() error { + return commissionWatcher.Start(ctx) + }) + } // // Pool watchers @@ -132,13 +136,17 @@ func RunFunc(cCtx *cli.Context) error { } wh = webhook.New(*whURL) } - upgradeWatcher := watcher.NewUpgradeWatcher(metrics, pool, wh, watcher.UpgradeWatcherOptions{ - CheckPendingProposals: !noGov, - GovModuleVersion: xGov, - }) - errg.Go(func() error { - return upgradeWatcher.Start(ctx) - }) + + var upgradeWatcher *watcher.UpgradeWatcher + if !noUpgrade { + upgradeWatcher = watcher.NewUpgradeWatcher(metrics, pool, wh, watcher.UpgradeWatcherOptions{ + CheckPendingProposals: !noGov, + GovModuleVersion: xGov, + }) + errg.Go(func() error { + return upgradeWatcher.Start(ctx) + }) + } // // Register watchers on nodes events @@ -147,7 +155,10 @@ func RunFunc(cCtx *cli.Context) error { node.OnStart(blockWatcher.OnNodeStart) node.OnStatus(statusWatcher.OnNodeStatus) node.OnEvent(rpc.EventNewBlock, blockWatcher.OnNewBlock) - node.OnEvent(rpc.EventNewBlock, upgradeWatcher.OnNewBlock) + + if upgradeWatcher != nil { + node.OnEvent(rpc.EventNewBlock, upgradeWatcher.OnNewBlock) + } } //