From 6ca05645c325c3e11d7fd6a912466f9c116e64d6 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Wed, 4 Dec 2024 19:00:11 +0800 Subject: [PATCH] fix lint --- finality-provider/service/app_test.go | 6 ++---- finality-provider/service/fp_instance_test.go | 1 + finality-provider/store/fpstore.go | 6 ++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/finality-provider/service/app_test.go b/finality-provider/service/app_test.go index 62bc4a9..f45d910 100644 --- a/finality-provider/service/app_test.go +++ b/finality-provider/service/app_test.go @@ -280,10 +280,7 @@ func FuzzStatusUpdate(f *testing.F) { var err error require.Eventually(t, func() bool { fpIns, err = app.GetFinalityProviderInstance() - if err != nil { - return false - } - return true + return err == nil }, time.Second*5, time.Millisecond*200, "should eventually be registered or active") if votingPower > 0 { @@ -339,6 +336,7 @@ func startFPAppWithRegisteredFp(t *testing.T, r *rand.Rand, homePath string, cfg cfg.BabylonConfig.KeyringBackend, input, ) + require.NoError(t, err) kc, err := keyring.NewChainKeyringControllerWithKeyring(kr, keyName, input) require.NoError(t, err) btcPkBytes, err := em.CreateKey(keyName, passphrase, hdPath) diff --git a/finality-provider/service/fp_instance_test.go b/finality-provider/service/fp_instance_test.go index 90b940c..8b4c487 100644 --- a/finality-provider/service/fp_instance_test.go +++ b/finality-provider/service/fp_instance_test.go @@ -181,6 +181,7 @@ func startFinalityProviderAppWithRegisteredFp(t *testing.T, r *rand.Rand, cc cli fpCfg.BabylonConfig.KeyringBackend, input, ) + require.NoError(t, err) kc, err := fpkr.NewChainKeyringControllerWithKeyring(kr, keyName, input) require.NoError(t, err) keyInfo, err := kc.CreateChainKey("", "", "") diff --git a/finality-provider/store/fpstore.go b/finality-provider/store/fpstore.go index 77a4fa1..ffff533 100644 --- a/finality-provider/store/fpstore.go +++ b/finality-provider/store/fpstore.go @@ -123,13 +123,11 @@ func (s *FinalityProviderStore) UpdateFpStatusFromVotingPower( return proto.FinalityProviderStatus_ACTIVE, s.SetFpStatus(fp.BtcPk, proto.FinalityProviderStatus_ACTIVE) } - // voting power == 0 then set status depending on previous status - //nolint:exhaustive - switch fp.Status { - case proto.FinalityProviderStatus_ACTIVE: + if fp.Status == proto.FinalityProviderStatus_ACTIVE { // previous status is ACTIVE then set to INACTIVE return proto.FinalityProviderStatus_INACTIVE, s.SetFpStatus(fp.BtcPk, proto.FinalityProviderStatus_INACTIVE) } + return fp.Status, nil }