Skip to content

Commit

Permalink
Make a flag to make Test Keysign optional on node startup (zeta-chain…
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD authored Jun 19, 2023
1 parent 3878c8f commit ede1c2f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmd/zetaclientd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type initArguments struct {
p2pDiagnostic bool
p2pDiagnosticTicker uint64
TssPath string
TestTssKeysign bool
}

func init() {
Expand All @@ -52,6 +53,8 @@ func init() {
InitCmd.Flags().Uint64Var(&initArgs.p2pDiagnosticTicker, "p2p-diagnostic-ticker", 30, "p2p diagnostic ticker (default: 0 means no ticker)")
InitCmd.Flags().Uint64Var(&initArgs.configUpdateTicker, "config-update-ticker", 6, "config update ticker (default: 0 means no ticker)")
InitCmd.Flags().StringVar(&initArgs.TssPath, "tss-path", "~/.tss", "path to tss location")
InitCmd.Flags().BoolVar(&initArgs.TestTssKeysign, "test-tss", false, "set to to true to run a check for TSS keysign on startup")

}

func Initialize(_ *cobra.Command, _ []string) error {
Expand Down
1 change: 1 addition & 0 deletions cmd/zetaclientd/keygen_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func GenerateTss(logger zerolog.Logger, cfg *config.Config, zetaBridge *mc.ZetaC
// If keygen is unsuccessful , it will reset the triedKeygenAtBlock flag and try again at a new keygen block.

if cfg.Keygen.Status == crosschaintypes.KeygenStatus_KeyGenSuccess {
cfg.TestTssKeysign = true
return tss, nil
}
// Arrive at this stage only if keygen is unsuccessfully reported by every node . This will reset the flag and to try again at a new keygen block
Expand Down
8 changes: 5 additions & 3 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ func start(_ *cobra.Command, _ []string) error {
if err != nil {
return err
}
err = TestTSS(tss, masterLogger)
if err != nil {
startLogger.Error().Err(err).Msg("TestTSS error")
if cfg.TestTssKeysign {
err = TestTSS(tss, masterLogger)
if err != nil {
startLogger.Error().Err(err).Msg("TestTSS error")
}
}

startLogger.Info().Msgf("TSS address \n ETH : %s \n BTC : %s \n PubKey : %s ", tss.EVMAddress(), tss.BTCAddress(), tss.CurrentPubkey)
Expand Down
1 change: 1 addition & 0 deletions zetaclient/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type Config struct {
ConfigUpdateTicker uint64
P2PDiagnosticTicker uint64
TssPath string
TestTssKeysign bool
}

func (c Config) GetAuthzHotkey() string {
Expand Down

0 comments on commit ede1c2f

Please sign in to comment.