diff --git a/app/apptesting/test_helpers.go b/app/apptesting/test_helpers.go index f34c6ac090..b040488840 100644 --- a/app/apptesting/test_helpers.go +++ b/app/apptesting/test_helpers.go @@ -316,3 +316,16 @@ func (s *AppTestHelper) ConfirmUpgradeSucceededs(upgradeName string, upgradeHeig s.App.BeginBlocker(contextAtUpgrade, beginBlockRequest) }) } + +// Generates a valid and invalid test address (used for non-keeper tests) +func GenerateTestAddrs() (string, string) { + pk1 := ed25519.GenPrivKey().PubKey() + validAddr := sdk.AccAddress(pk1.Address()).String() + invalidAddr := sdk.AccAddress("invalid").String() + return validAddr, invalidAddr +} + +// Modifies sdk config to have stride address prefixes (used for non-keeper tests) +func SetupConfig() { + app.SetupConfig() +} diff --git a/app/test_setup.go b/app/test_setup.go index 0bcbb49cd5..ac5f9d3501 100644 --- a/app/test_setup.go +++ b/app/test_setup.go @@ -9,16 +9,23 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" + + cmdcfg "github.com/Stride-Labs/stride/v4/cmd/strided/config" ) const Bech32Prefix = "stride" func init() { + SetupConfig() +} + +func SetupConfig() { config := sdk.GetConfig() valoper := sdk.PrefixValidator + sdk.PrefixOperator valoperpub := sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic config.SetBech32PrefixForAccount(Bech32Prefix, Bech32Prefix+sdk.PrefixPublic) config.SetBech32PrefixForValidator(Bech32Prefix+valoper, Bech32Prefix+valoperpub) + cmdcfg.SetAddressPrefixes(config) } // Initializes a new StrideApp without IBC functionality