diff --git a/zetaclient/keys/keys_test.go b/zetaclient/keys/keys_test.go index 0a0d2d7f6c..1d81397531 100644 --- a/zetaclient/keys/keys_test.go +++ b/zetaclient/keys/keys_test.go @@ -28,10 +28,6 @@ func Test(t *testing.T) { TestingT(t) } var _ = Suite(&KeysSuite{}) -func (*KeysSuite) SetUpSuite(c *C) { - SetupConfigForTest() -} - var ( password = "password" ) @@ -41,6 +37,21 @@ const ( signerPasswordForTest = `password` ) +func setupConfig() { + testConfig := sdk.GetConfig() + testConfig.SetBech32PrefixForAccount(cmd.Bech32PrefixAccAddr, cmd.Bech32PrefixAccPub) + testConfig.SetBech32PrefixForValidator(cmd.Bech32PrefixValAddr, cmd.Bech32PrefixValPub) + testConfig.SetBech32PrefixForConsensusNode(cmd.Bech32PrefixConsAddr, cmd.Bech32PrefixConsPub) + testConfig.SetFullFundraiserPath(cmd.ZetaChainHDPath) + sdk.SetCoinDenomRegex(func() string { + return cmd.DenomRegex + }) +} + +func (*KeysSuite) SetUpSuite(_ *C) { + setupConfig() +} + func (*KeysSuite) setupKeysForTest(c *C) string { ns := strconv.Itoa(time.Now().Nanosecond()) metaCliDir := filepath.Join(os.TempDir(), ns, ".metacli") @@ -110,15 +121,3 @@ func (ks *KeysSuite) TestNewKeys(c *C) { c.Assert(err, IsNil) c.Assert(pubKey.VerifySignature([]byte(msg), signedMsg), Equals, true) } - -func SetupConfigForTest() { - testConfig := sdk.GetConfig() - testConfig.SetBech32PrefixForAccount(cmd.Bech32PrefixAccAddr, cmd.Bech32PrefixAccPub) - testConfig.SetBech32PrefixForValidator(cmd.Bech32PrefixValAddr, cmd.Bech32PrefixValPub) - testConfig.SetBech32PrefixForConsensusNode(cmd.Bech32PrefixConsAddr, cmd.Bech32PrefixConsPub) - //config.SetCoinType(cmd.MetaChainCoinType) - testConfig.SetFullFundraiserPath(cmd.ZetaChainHDPath) - sdk.SetCoinDenomRegex(func() string { - return cmd.DenomRegex - }) -} diff --git a/zetaclient/tss/tss_signer_test.go b/zetaclient/tss/tss_signer_test.go index 4388fc5ef1..d19e2effcc 100644 --- a/zetaclient/tss/tss_signer_test.go +++ b/zetaclient/tss/tss_signer_test.go @@ -5,15 +5,26 @@ import ( "os" "testing" - "github.com/zeta-chain/zetacore/zetaclient/keys" - "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/rs/zerolog" "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/cmd" "github.com/zeta-chain/zetacore/pkg/cosmos" "github.com/zeta-chain/zetacore/pkg/crypto" ) +func setupConfig() { + testConfig := sdk.GetConfig() + testConfig.SetBech32PrefixForAccount(cmd.Bech32PrefixAccAddr, cmd.Bech32PrefixAccPub) + testConfig.SetBech32PrefixForValidator(cmd.Bech32PrefixValAddr, cmd.Bech32PrefixValPub) + testConfig.SetBech32PrefixForConsensusNode(cmd.Bech32PrefixConsAddr, cmd.Bech32PrefixConsPub) + testConfig.SetFullFundraiserPath(cmd.ZetaChainHDPath) + sdk.SetCoinDenomRegex(func() string { + return cmd.DenomRegex + }) +} + func Test_LoadTssFilesFromDirectory(t *testing.T) { tt := []struct { @@ -52,7 +63,7 @@ func Test_LoadTssFilesFromDirectory(t *testing.T) { } func GenerateKeyshareFiles(n int, dir string) error { - keys.SetupConfigForTest() + setupConfig() err := os.Chdir(dir) if err != nil { return err