-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Add unit tests to cosmos SDK config set up - Remove an unnecessary `config.Seal` invocation that has been around for a [long time](5e4a1dc#diff-9e0425d31b7cf4072a746feb0c6bc1e0045b639e01dd0b5ac2f08e8c2952c886R120) but isn't necessary because the `init()` command always sets and seals the config.<hr>This is an automatic backport of pull request #3786 done by [Mergify](https://mergify.com). --------- Co-authored-by: Rootul P <rootulp@gmail.com>
- Loading branch information
1 parent
37c7e11
commit 3a2633a
Showing
4 changed files
with
33 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app | ||
|
||
import sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
func init() { | ||
setCosmosSDKConfig() | ||
} | ||
|
||
func setCosmosSDKConfig() { | ||
config := sdk.GetConfig() | ||
config.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) | ||
config.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) | ||
config.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) | ||
config.Seal() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package app | ||
|
||
import ( | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_setCosmosSDKConfig(t *testing.T) { | ||
config := sdk.GetConfig() | ||
assert.Equal(t, Bech32PrefixAccAddr, config.GetBech32AccountAddrPrefix()) | ||
assert.Equal(t, Bech32PrefixAccPub, config.GetBech32AccountPubPrefix()) | ||
assert.Equal(t, Bech32PrefixValAddr, config.GetBech32ValidatorAddrPrefix()) | ||
assert.Equal(t, Bech32PrefixValPub, config.GetBech32ValidatorPubPrefix()) | ||
assert.Equal(t, Bech32PrefixConsAddr, config.GetBech32ConsensusAddrPrefix()) | ||
assert.Equal(t, Bech32PrefixConsPub, config.GetBech32ConsensusPubPrefix()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters